Commits
Commits on
06be4662aa7e00a09b7b23aea8097a37e5aae6fdFiltered to scripts/aac-tables/sbrpayload_fixtures.pyClear filter2026-08-19
fix(aac): uncoupled SBR CPEs read envelope+noise as two channel passesAhmet Kaan Gümüş · 3745d45
fix(aac): uncoupled SBR CPEs read envelope+noise as two channel passes sbr_channel_pair_element()'s envelope/noise interleave depends on bs_coupling: the coupled form reads sbr_envelope(ch)/sbr_noise(ch) interleaved per channel, but the uncoupled form reads two separate passes -- both channels' envelopes, then both channels' noise floors. The parser (and the fixture rig's writer) read both forms the same, per-channel-interleaved way. Total bit count is order-invariant, so byte-accounting fixtures never caught it; content desyncs every field after channel 0's envelopes whenever the channels' envelope (6/7-bit) and noise (5-bit) field counts differ -- exactly the shape round-11 pinned to channel 1's second envelope going to garbage. A synthetic uncoupled CPE (ch0 FIXVAR 4-env loud HF, ch1 FIXFIX 2-env quiet HF -- the real failing shape) decoded to real PCM confirms the fix: writing the two candidate orders and decoding both, the separated (spec) order reproduces the coded amplitude cleanly while the interleaved order desyncs it. Fixed the parser and the rig's CPE writer together, regenerated CPE_UNCOUPLED_BODY (bits unchanged: order is still byte-count-invariant). reeln real-file sweep: ch0 full 0.9726 (unchanged), ch1 full 0.7716 -> 0.9705, ch1 above-crossover 0.0055 -> 0.7227. FMJ's separate pre-SBR bug is unaffected and still queued last.
fix(aac-sbr): the missing bs_pointer field and FIXVAR's reversed freq_resAhmet Kaan Gümüş · 7dabfff
fix(aac-sbr): the missing bs_pointer field and FIXVAR's reversed freq_res FIXVAR/VARFIX/VARVAR sbr_grid() all carry a bs_pointer field (width ceil(log2(num_env+1))) between the relative borders and bs_freq_res, which this parser never read -- and FIXVAR alone transmits bs_freq_res in reverse time order (envelopes are numbered from the trailing variable border backwards). Confirmed against a reference decoder's own byte accounting on a non-uniform freq_res list (scripts/aac-tables/sbrgrid_probe.py) -- a uniform list hid both bugs, which is why the byte-exact fixtures never caught them. The missing pointer field also explains the standing "VARVAR num_env==3 reads one byte fewer" mystery: ptr_bits(3)=2 crosses a byte boundary. bs_pointer also drives the noise floor's middle time border (ISO/IEC 14496-3 Sec 4.6.18.3.3), which this parser was deriving with a nearest-midpoint heuristic instead; Grid::new now follows the spec formula. Adds a plausibility clamp on the carried DT state (last_env/last_noise) as containment against any still-undiscovered desync, not a fix for one. Regenerates the FIXVAR/VARFIX/VARVAR fixtures from the corrected wire format (all still oracle-verified byte-exact).
feat(ec-aac): the SBR payload parser -- bitstream to dequantized envelope/noise intsAhmet Kaan Gümüş · 6a3d21e
feat(ec-aac): the SBR payload parser -- bitstream to dequantized envelope/noise ints sbr_payload.rs parses sbr_header (persisted across frames) and sbr_data for SCE and CPE (coupled and uncoupled), all four grid classes, dt/df envelope and noise coding through the twelve Huffman books, and extension payloads by their own length. Stops at exact integer scalefactors/noise floors -- no QMF, no gain application. Field widths and grid-class bit layout checked against a reference decoder's own byte accounting via scripts/aac-tables/sbrpayload_fixtures.py (same method as sbrtables.py's codebook derivation), which also generates the byte-exact test fixtures embedded in the module's test module.