Fix TNS Decoder Rejection Bugs & Remove Obsolete Profiles#106
Merged
Conversation
Fixes a non-spec-compliant bug where a TNS filter order up to 20 was allowed at low sample rates, causing frame rejections and audio dropouts in FFmpeg/FAAD. The dead code paths for the MAIN, LTP, and SSR profiles have been removed, completing what was started with commit ac65a6d
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.
This PR resolves a critical compatibility issue where generated AAC bitstreams would trigger frame rejections and audio dropouts in standard decoders like FFmpeg and FAAD.
The root cause was that the encoder allowed the Temporal Noise Shaping (TNS) long-block filter order to scale up to
20for MPEG-4 streams at low sample rates. Per specification, the standard AAC-LC (Low Complexity) profile enforces a hard cap of12.Because
libfaacis effectively a dedicated Low Complexity encoder—and the experimental code paths for MAIN, LTP, and SSR profiles were already disabled in the top-level configuration—this PR cascades that spec enforcement into a thorough cleanup of those dead, unmaintained profile paths.🔍 Detailed Changes
1. Core TNS Spec Fix
TNS_MAX_ORDERfrom20to12incoder.h.TnsInit: Eliminated complex, nested conditional switches that allowed the order to drift past spec constraints based on sample rates. It now statically applies safe, spec-compliant low-complexity bounds.2. Codebase Refactoring & Profile Stripping
overlap_selectlogic. The function now cleanly processes normal overlapped data paths without checking for experimental non-overlapped modes.MOVERLAPPEDandMNON_OVERLAPPEDdefinitions fromfiltbank.h.main.cto unconditionally stateObject type: Low Complexity, removing the broken selection block.📊 Testing & Verification
4.024.38Benchmark shows at default parameters (TNS-off) no regressions which is expected: https://github.com/nschimme/faac/actions/runs/26182013325
💭 Reviewer Notes