quantize: restore short-window masking penalty to fix energy drops#103
Merged
Conversation
Commit 577c649 ("initial windows grouping support") split bmask() into short- and long-window branches and introduced `target *= 1.5` for short blocks. This inflated the psychoacoustic masking threshold 50%, causing the quantizer to allocate too few bits during transients and producing audible energy drops. Restore the pre-577c6499 multiplier of SHORT_PENALTY (0.45), which tightens the masking target for short-window blocks. Extract the formula constants as named macros: NOISETONE (noise-floor weight), TONEMASK (tone-masking component weight), and SHORT_PENALTY (short-window quality penalty) — keeping them separate so each can be tuned independently.
Contributor
Author
Contributor
|
@nschimme yes, I can confirm that this fixes the issue. Thank you very much for investigating this again! |
Contributor
Author
|
@fabiangreffrath we're safe to merge then :-) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Commit 577c649 ("initial windows grouping support") split bmask() into short- and long-window branches and introduced
target *= 1.5for short blocks. This inflated the psychoacoustic masking threshold 50%, causing the quantizer to allocate too few bits during transients and producing audible energy drops.Restore the pre-577c6499 multiplier of SHORT_PENALTY (0.45), which tightens the masking target for short-window blocks. Extract the formula constants as named macros: NOISETONE (noise-floor weight), TONEMASK (tone-masking component weight), and SHORT_PENALTY (short-window quality penalty) — keeping them separate so each can be tuned independently.
Benchmark report shows no performance changes but some changes in psychoacoustic model as expected where the benefits outweigh the negatives: https://github.com/nschimme/faac/actions/runs/25871625558