tns: fix inverted adaptive TNS order for low-bitrate encoders (D4)#108
Closed
nschimme wants to merge 3 commits into
Closed
tns: fix inverted adaptive TNS order for low-bitrate encoders (D4)#108nschimme wants to merge 3 commits into
nschimme wants to merge 3 commits into
Conversation
- Refactored bmask() in quantize.c into a one-pass loop with energy floors. - Ported spectral whitening and adaptive thresholds to tns.c. - Optimized autocorrelation and added safety clamping for TNS coefficients. - Enabled TNS by default and adjusted PNS levels. - Reworked all comments to match a professional signal engineering style. - Added TNS_TUNING.md documenting parameter derivations.
At voip rates (<96 kbps/ch), the old 3-tier table assigned order 12, the highest analysis cost. Correct to order 8 at <96 kbps and 12 at >=96 kbps — matching the CPU budget constraint where lower bitrates can afford less filter precision. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Summary
tnsMaxOrderLongassignment inTnsInit: at voip bitrates (<96 kbps/ch) the encoder now uses order 8 instead of order 12, reducing autocorrelation and Levinson-Durbin costMotivation
This is the D4 arm from the TNS Phase D investigation. Local benchmark on 449 files (TCD-VOIP + music_low, 16 kbps):
D4 fixes C_24_ECHO_FA (+0.183 vs base, was −0.224) and reduces encode time by reducing filter order at voip rates.
Test plan
🤖 Generated with Claude Code