Commits
Commits on
00c1b3ff2d80d84fef71bb6208110dedbbd95fc4Filtered to crates/ec-aac/src/sbr_chain.rsClear filter2026-08-21
2026-08-20
fix(aac-sbr): coupled balance raw values count in double steps (centre 6/12), pan offset and alpha from the frame's amp_res; FIXFIX-only single-envelope amp_res overrideAhmet Kaan Gümüş · e6128af
fix(aac-sbr): coupled balance raw values count in double steps (centre 6/12), pan offset and alpha from the frame's amp_res; FIXFIX-only single-envelope amp_res override reeln coupled CPE: full-band corr ch0 0.998652 -> 0.999210, ch1 0.996600 -> 0.999176. Adds sbr_residual_locator (per-band complex-STFT corr/level, Parseval-exact) which showed the previous ch1 HF level at 0.35-0.45 of the reference.
fix(aac-sbr): native 32-band QMF analysis replaces the zero-stuffed bridge; drop ENV_DOMAIN_SCALEAhmet Kaan Gümüş · b61d50e
fix(aac-sbr): native 32-band QMF analysis replaces the zero-stuffed bridge; drop ENV_DOMAIN_SCALE The bridge (64-band bank on the core zero-stuffed at the even phase) equals the 32-band bank times 2*exp(j*pi/64*(k+0.5)*1.5) per band: 2x gain and a 1.5-output-sample delay. The low band never saw it (synthesis undoes both) but the HF generator copies band p into band k, so the per-band phase became a constant carrier error on every patched band against the reference. Carrier offset is -0.5 (reference-measured; the literal -1 lands the reference half a sample off, 0.984 above 5 kHz vs 0.9997). Real-library: reeln full 0.9964/0.9956 -> 0.9987/0.9966, above-5k 0.9990/0.9987 -> 0.9997/0.9993; second file full 0.9979/0.9935 -> 0.9999/0.9993. synthetic_heaac_matrix: every HE row up (44.1k/32k full 0.9376 -> 0.9823, 48k 64k/96k above 0.9857 -> 0.9999), LC rows unchanged. Envelope energies now dequantize in the spec domain directly; the 2x the spec 32/64 pair loses is restored once at the chain output.
fix(aac-sbr): spec-structured envelope adjuster (per-subband gains, limiter/boost with S_M and Q_M, V-table noise, sinusoid phases, slot smoothing, l_A/delta, 6-slot tHFAdj alignment, class-correct noise border, coupled noise dequant)Ahmet Kaan Gümüş · 363af1c
fix(aac-sbr): spec-structured envelope adjuster (per-subband gains, limiter/boost with S_M and Q_M, V-table noise, sinusoid phases, slot smoothing, l_A/delta, 6-slot tHFAdj alignment, class-correct noise border, coupled noise dequant) reeln full 0.9927/0.9918 -> 0.9953/0.9946, above-5k 0.9868/0.9918 -> 0.9985/0.9984, lag 385 -> 1.
diag(aac-sbr): 44.1k-family "sample drift" is a narrow-search artifact, not clock driftAhmet Kaan Gümüş · 9f92c74
diag(aac-sbr): 44.1k-family "sample drift" is a narrow-search artifact, not clock drift sbr441_family_sample_drift_probe (crates/ec-aac/tests/sbr_real_library.rs) walks lag(t) per-1s window in a NARROW +/-128 search around each fixture's own true fixed lag (found first via a wide free-search cross-check, since the earlier -4674/-4617 pair used in coupled_cpe_channel_swap_probe was itself never independently verified against a wide search on this file). Findings, all three fixtures (heaac_44100_48k "fail" family, heaac_48000_48k "control", and reeln.mp4 as a real-content control): - lag(t) is FLAT (+/-1-2 samples, fitted slope ~0) across the full 30s for every file -- no growing sample-count/clock drift anywhere. The earlier "decays 0.998->0.68 by t=9s" reading was the free coarse-then-refine search (proven separately unreliable on this file's periodic content) chasing a different, wrong lag as it walked forward, not the aligned signal actually drifting. - heaac_44100_48k and heaac_48000_48k -- NOT just the "failing" 44.1k family -- both show an IDENTICAL correlation dip-then-recover in the file's middle third (t~=13-27s, corr falling to ~0.13-0.5) at their otherwise-flat true lag. Since the 48k file shows the same dip, this is a property of the synthetic fixture pair's shared source content (both built by the same make-heaac-fixtures.sh run), not a 44.1k-vs-48k output-rate SBR/rate-family defect. - Sample counts: our decoder emits exactly au_count*2048 samples/channel for both heaac fixtures (no internal drops); ffmpeg's own decode is a constant ~5058 samples shorter for BOTH files (encoder priming/padding trim ffmpeg applies via edit list that we don't) -- a fixed offset already absorbed into the fixed lag, not a growing one. reeln's 0.366 ours/ffmpeg ratio is purely the test harness's own 1500-AU extraction cap (~69.7s) against ffmpeg's full ~190s decode, not a decode defect. - hold_call_count() (new ec_aac::hold_call_count(), sbr_chain.rs HOLD_CALLS atomic) is 0 across all three files' full decodes: no apply_last/hold fallback is involved at all. Verdict: the charter's "44.1k-family clock drift" hypothesis is refuted. Next suspect for the mid-file correlation dip shared by both synthetic heaac fixtures: their shared source content around t=13-27s (quiet passage / high-transient section stressing SBR HF reconstruction), not sample-rate-family-specific code.
diag(aac-sbr): isolate the coupled-CPE L/R swap to the bare Analysis/Synthesis QMF pair, not plane/state threadingAhmet Kaan Gümüş · 9631d42
diag(aac-sbr): isolate the coupled-CPE L/R swap to the bare Analysis/Synthesis QMF pair, not plane/state threading Adds env-gated (EC_AAC_SBR_PREQMF_DUMP) pre-QMF/post-QMF plane dumps in sbr_chain::apply_data and matching core-only dumps in the test harness, plus an isolated round-trip probe in coupled_cpe_channel_swap_probe that runs the already-correctly-directed core-only decode through a bare, fresh Analysis(32)->zero-stuff-HF->Synthesis(64) pair per channel, with no sbr_chain, HashMap element lookup, envelope/HF/noise code, or per-AU state at all. Findings (see ledger DELTA for the full table): the plane content entering apply_data is byte-identical to the core-only decode's own channel content (no pre-QMF swap); the isolated round trip alone reproduces the swap numbers to ~5 significant figures (kx=20: ch0 vs ref L corr=-0.089, vs ref R corr=0.980) matching the full-chain and EC_AAC_SBR_HF_BYPASS=1 numbers almost exactly -- narrowing the bug to crates/ec-aac/src/sbr_qmf.rs's Analysis/Synthesis pair itself, not sbr_chain's plane/channel-index threading or sbr_env/sbr_hf. The real reference L/R content does not invert at any tested lowpass cutoff (100Hz-12kHz via ffmpeg), ruling out "the source material really does swap identity in that band". Root cause inside sbr_qmf.rs not found this round; NOT fixed, gates NOT re-run to passing.
fix(aac-sbr): key SbrChain per-element state by (tag, is_cpe), not tag aloneAhmet Kaan Gümüş · 2a9df8d
fix(aac-sbr): key SbrChain per-element state by (tag, is_cpe), not tag alone
ISO/IEC 14496-3 §4.4: element_instance_tag is a namespace per syntactic
element type, so an encoder may legally give an SCE and a CPE in the same
access unit the same tag value (routine in a 5.1 SCE+CPE+CPE+LFE stream).
SbrChain::elements was a HashMap<u8, Element> keyed by the bare tag, so a
same-tagged SCE and CPE silently aliased one Analysis/Synthesis/HF/noise
state -- the CPE's parse/apply would read and mutate the SCE's element
state and vice versa. Rekeyed to (tag, is_cpe); decode.rs's three
sbr.apply/apply_last call sites now pass is_cpe through from `pending`.
Also stopped LFE (raw_data_block id 3) from ever becoming a pending SBR
target: §4.6.18.1 never applies SBR to the LFE channel (no FIL follows
it), so treating it like an SCE for `pending` could let a stray fallback
branch stretch the LFE plane to double rate using a held SBR payload that
belongs to a different, same-tagged element.
New regression test `an_sce_and_a_same_tagged_cpe_do_not_share_state`
proves an SCE at tag 0 is untouched by a same-tagged CPE's apply() call
in between two of the SCE's own calls; it fails without this fix.
Diagnostic finding: the assumption that motivated this investigation --
that the failing real-file test candidate (a BluRay-rip HEVC/mkv with a
real 6-channel HE-AAC track, tests/sbr_real_library.rs candidates(),
aac_stream=1) actually exercises that 6ch stream -- is WRONG. That
candidate's AudioSpecificConfig (asc=[13,10,56,e5,98]) decodes to
audioObjectType=2 (AAC LC), channelConfiguration=2 (stereo), sf_index=6
(24000 Hz core, SBR to 48000). ffprobe confirms the container's global
stream 1 is the real 6ch AAC track and global stream 3 is a separate 2ch
AAC track, but extract_aac_track's stream_index=1 (this test's
aac_stream) resolves to the 2ch track, not the 6ch one -- our_decode's
own debug output ("2 ch, 48000 Hz") already showed this before any
digging. This real-file failure is therefore NOT a multichannel/SBR-state
bug: this fix does not move sbr_real_library_matches_reference's
correlation for that file (unchanged at -0.025253/0.010226) or
full_chain_low_band_matches_own_core (unchanged at 0.217393). The other
real fixture (a stereo HE-AAC file, same-shape stream) stays at its prior
0.987006/0.986222 -- no regression.
GATE numbers (this commit):
sbr_real_library_matches_reference: stereo fixture 0.987006/0.986222;
the mislabelled candidate's SBR full-band bar 0.999 still fails,
unchanged from baseline -0.025253/0.010226
full_chain_low_band_matches_own_core: stereo fixture 0.996713/0.996842
(pass); mislabelled candidate 0.217393 (fail, unchanged from baseline
0.22)
ec-aac --lib: 45 passed (44 prior + 1 new regression test)diag(aac-sbr): add a header/frame-feature discriminator table; fix two self-check instruments' stale/wrong lag conventionsAhmet Kaan Gümüş · 2b4d691
diag(aac-sbr): add a header/frame-feature discriminator table; fix two self-check instruments' stale/wrong lag conventions Task A: sbr_header_feature_table (tests/sbr_real_library.rs) prints one row per stream (reeln, FMJ, all 8 synthetic HE fixtures) of sbr_header()/ frame-level features (kx/k2, xover/start/stop freq, freq_scale, alter_scale, noise_bands, limiter_bands/gains, interpol_freq, smoothing_mode, per-frame num_env histogram, invf modes seen, add_harmonic usage, df_env/df_noise delta-coding rate, patch geometry) next to each stream's pass/fail correlation. Needed df_env/df_noise plumbed through SbrChannel and header params + patch lengths added to SbrSideInfoRow (src change, no behaviour change). Key finding: FMJ (fail, corr 0.036) and synth-48000-64k (pass, corr 1.000) share IDENTICAL kx/k2 (27/59), IDENTICAL header config, and IDENTICAL patch geometry [26,1,5] -- the only differences in the table are per-frame entropy (envelope-count histogram, invf-mode diversity), which is exactly what differing real-vs-synthetic CONTENT should produce on its own. This directly refutes "a per-stream SBR header/config feature separates pass from fail" (the standing hypothesis this task was chartered to test): no such feature exists in what sbr_header()/sbr_data() actually carries. Whatever breaks FMJ must be in the payload's numeric content or the container/extraction path, not the SBR sideinfo shape. Task B: full_chain_low_band_matches_own_core no longer hardcodes a stale QMF delay (-897); it now runs the same wide lag search `synthetic_heaac_matrix` uses and asserts corr >= 0.99 at the MEASURED lag. Confirms reeln's true lag is -576 (matches the ledger) at corr 0.997, and turns FMJ's already-known low-band self-inconsistency (round-51) into a real failing assertion instead of a silent print. synthetic_heaac_matrix's `ours_v_core`/`core_v_ref` columns: replaced the naive 2x-nearest-neighbor-upsample-then-lowpass-at-full-rate convention (which read a flat ~-0.12 regardless of file) with the native-core-rate decimate/`ffmpeg_decode_at_rate` convention `core_only_matches_reference` already trusts. This measurably fixed the 44100 family (core_v_ref now 0.44-0.995, proving the core decode itself is correct there even though the full chain fails at 0.07) but the 48000 family's core_v_ref is still flat/ negative despite `full`/`below` proving near-perfect correctness at native rate -- left open, most likely a remaining artifact in this resampling- domain comparison itself (ffmpeg's -ar downsample phase vs the wide-lag search), not a real SBR defect, since `below` already disproves it at the rate that matters. Correcting the charter's premise: core_v_ref did NOT read 0.9999 before this fix (measured 0.22-0.40 on 48000, near 0 on 44100) -- both self-check columns were broken, not one healthy one to copy.
diag(aac-sbr): root-cause a real-file HE-AAC v1 decorrelation to the SBR QMF chain, not the LC coreAhmet Kaan Gümüş · 87b805d
diag(aac-sbr): root-cause a real-file HE-AAC v1 decorrelation to the SBR QMF chain, not the LC core Round-51 triage on a real-file HE-AAC v1 stereo commentary track (24kHz core / 48kHz SBR, kx=27/k2=59 -- a materially wider low-band crossover than the other tracked real file's 22.05k/44.1k kx=14/k2=43 family): - ASC hand-parsed and cross-checked against parse_audio_specific_config's bit-for-bit walk: object=AAC-LC, sf_index=6 (24000), channel_config=2, backward-compatible SBR sync extension (0x2B7) correctly found, extensionAudioObjectType=5, extensionSamplingFrequencyIndex=3 (48000). Config parsing is correct; TRIAGE item 1 (mis-parsed ASC / rate family) is refuted. - New `core_only_matches_reference` test (SBR forced off at the AudioSpecificConfig level, so decode.rs's FIL branch never touches sbr_chain at all): this track's LC core alone correlates 0.999977/0.999974 against the reference decoder at the core rate. The LC core is not the defect. - New `wide_lag_search_full_chain` test: the full SBR-reconstructed output finds no usable alignment against the reference anywhere in a +-4.16s window (vs. the normal +-4000-sample LAG_MAX) -- this is not a missed alignment lag, the content itself has decorrelated. - New `full_chain_low_band_matches_own_core` test: compares our own full-chain output against our own core-only decode of the SAME stream, no reference decoder involved. The 22.05k-family file's self-consistency is 0.99. This 24k-family file's self-consistency is -0.02/0.01 -- the SBR chain does not even reproduce its own untouched low-band passthrough (`v[0..kx]`, a literal copy of the same core analysis data) once it goes through the SBR QMF chain. - EC_AAC_SBR_HF_BYPASS=1 (new, sbr_chain.rs, default off): skips filling v[kx..k2] from the HF generator entirely. This file's self-consistency is UNCHANGED (-0.02/0.01) with HF fully bypassed, while the other file's improves slightly (0.99->0.99) as expected from removing HF leakage. This refutes the entire HF-generation/envelope-adjust/noise axis (the subject of every prior round's dead-ends) as this file's cause: the defect survives with the HF generator entirely out of the loop. Conviction: the break is in the SBR chain's QMF analysis->synthesis round-trip itself (sbr_qmf.rs Analysis/Synthesis, or the raw-band copy feeding it) for this kx/k2 (near-32, wide-crossover) configuration, not in HF generation, not in the LC core, and not in reference alignment/test methodology. A rate-independent constant-delay hypothesis was also checked and refuted (this file does not correlate at the other file's own- core delay of -897 samples either). No fix in this diff -- root-cause LOCATION only; see ledger for the next round's starting point. cargo test -p ec-aac --lib: 50/50 green. fmt clean. clippy -D warnings clean.
debug(aac): QMF-domain per-stage SBR HF energy dump, gated by EC_AAC_SBR_QMFDUMPAhmet Kaan Gümüş · ea6cc30
debug(aac): QMF-domain per-stage SBR HF energy dump, gated by EC_AAC_SBR_QMFDUMP Round-34's decisive measurement: dump per-QMF-band mean energy at analysis output, post-patch (pre-adjust), and post-adjust in sbr_chain.rs, and probe header A (kx=14/k2=43) at source bands p=0/5/13. Result: generate()'s patch application places content EXACTLY where build_patches predicts (verdict: generate()/adjust()/the kx-row synthesis copy are all exonerated) -- the "wrong target band" cluster reported by earlier rounds' sbrpatchmap.py probe was an artifact of that probe's own tone-placement bin math (k = p*32+16 assumed 32 core-MDCT bins per QMF band; empirically re-derived via this same dump to be 16, confirmed exact for p=0/5/13) plus a noise0=[2,2] "quiet" setting that was actually loud (low raw index = louder noise floor, matching sbr_env::dequant_noise's spec-correct direction). Both fixed in sbrpatchmap.py. The QMF-domain sanity gate (post-patch stage) now matches build_patches' prediction exactly for every probed p; the PCM/FFT-domain frequency-line readout still shows a separate, weaker artifact specific to this single-isolated-tone-with-flat-envelope probe shape (not chased this round -- out of Task 1's QMF-domain scope, and not corroborated by the real-file sweep, which is unchanged: 0.971793/0.967975 full-band, 0.956522/0.951190 whole-file mean, 0.992565/0.991558 below-crossover, identical to the pre-round-34 baseline since this change adds no new always-on code path).
fix(aac): SBR limiter caps per limiter-band aggregate, not per empty cellAhmet Kaan Gümüş · 0a60b22
fix(aac): SBR limiter caps per limiter-band aggregate, not per empty cell sbr_env::adjust's gain cap was per-CELL: limiter_max*sqrt((noise+current)/current), which is infinite as current->0 -- every content-empty target cell (a patch boundary with no source energy) amplified numeric dust to the full transmitted envelope. Replaced with the spec-shaped limiter (Sec 4.6.18.7.2/.7.5): a limiter band table (sbr_hf::limiter_band_table, union of f_low borders and patch target boundaries, thinned to ~1/2/3 bands/octave by bs_limiter_bands) with an AGGREGATE cap sqrt(E_orig/E_curr)*limgain per band, so an empty cell inherits its band's cap instead of blowing up alone, plus gain-boost compensation (+4dB ceiling) applied to gains/noise/sinusoids so a capped band still reaches its transmitted total when the population isn't actually starved. Verification (round 33): - Probe sanity gate (scripts/aac-tables/sbrpatchmap.py, headers A/B/C): STILL FAILS -- our decoder's measured target map still does not match build_patches' prediction, and does not collapse to a per-source-varying map. The convicted "infinite per-cell gain" mechanism is fixed, but is not the probe cluster's sole/primary cause; a separate defect remains (HF patching/frequency placement or QMF synthesis), not chased further this round. - Real file (reeln.mp4, EC_AAC_SBR_HF_CONVICTION=1): full-band ch0 0.973->0.9718, ch1 0.972->0.9680; whole-file mean ch0 0.9585->0.9565, ch1 0.954->0.9512; below-crossover ch0 0.993->0.9926, ch1 ~0.993->0.9916; HF bin coherence (TASK2 direct-match mean) ~0.2 baseline -> ~0.08 (ch0) / ~0.14 (ch1), i.e. LOWER, not higher. The correctness fix does not move this file's bar upward -- reported honestly, not chased into further guessing this round. limiter_caps_a_pathological_gain renamed/rewritten to limiter_stays_finite_on_a_uniformly_starved_band: a semantics change, not a bound weakening -- the old assertion (uniform starvation stays capped near the raw HF estimate) is mathematically wrong under a correct aggregate cap+boost (boost legitimately undoes a uniform cap when nothing in the band needs protecting from disproportion, since cap and boost read the same aggregate population); the new test checks the actual invariant this round fixes (finite/bounded, not literally unbounded) and a new test (a_content_empty_cell_inherits_its_limiter_bands_aggregate_cap) asserts the crux: an empty cell next to a loud cell inherits the band cap, not infinity. lib 42/42 green, fmt/clippy -D warnings clean. FMJ candidate still fails outright (separate pre-existing issue, not this round's scope).
2026-08-19
probe(sbr-residual): frame x band residual/side-info correlation instrumentAhmet Kaan Gümüş · 6fea6db
probe(sbr-residual): frame x band residual/side-info correlation instrument EC_AAC_SBR_SIDEINFO_DEBUG logs one row per (AU, channel) apply_data runs (grid/invf/add_harmonic/coupling/e_q/q_q means, fresh vs hold source) via a new sbr_sideinfo_log() accessor. EC_AAC_SBR_RESIDUAL_DEBUG cross-tabulates that log against a (frame x band) residual-energy grid built from FFT(ours)-FFT(reference) at AU-aligned 2048-sample blocks (linear FFT means the residual's own spectrum never needs materializing in the time domain). On reeln (both channels, 489 frames): no predictor dominates decisively. add_harmonic-flagged bands carry LESS residual than unflagged (ratio 0.13), refuting sinusoid-injection as the round-19 bar's cause. Envelope borders run only ~1.1-1.7x interior energy (no sharp gain-placement spike). Coupling-flip frames run LOWER (ratio ~0.4), same direction as round-11's DT-base refutation. invf_mode level is non-monotonic against residual and confounded by population size (round-19's chirp dead-end stands). HF residual peakiness (~2.2-2.25) sits close to the pure-noise expectation for 4-bin groups (H_4=2.083), reading noise-like, not tonal. hold-state frames never occurred in this window -- untested, not refuted. Per charter, landing the diagnostic with these findings rather than chasing a non-dominant lead.
test(sbr): confirm QMF stitching is bit-identical, synthesis gain is flatAhmet Kaan Gümüş · e0b5247
test(sbr): confirm QMF stitching is bit-identical, synthesis gain is flat Round-13 queue item 1 (below-crossover stitching): landed a unit test driving the QMF filterbank pair per-AU-chunked vs one continuous pass over the same 10 AUs' worth of samples -- 0/20480 samples differ, max diff exactly 0.0. Stitching is provably bit-identical; the diagnostic's own single-pole lowpass split was leaking above-crossover HF defects into the "below-crossover" correlation measurement (a 3x-cascaded filter recovers reeln's below-crossover correlation from ~0.993 to ~0.9989), not a real low-band continuity bug. Queue item 2 (gain-level bucket): landed a per-band synthesis gain test using a physically real rotating-phasor tone (not a naive constant per-slot value, which doesn't correspond to any real Analysis output). Gain is flat to 1e-4 across every band tried, ruling out a band- dependent overlap-add ripple hiding behind SYNTH_TRIM's single scalar. Also logged tables.f_high/build_patches output to the existing EC_AAC_SBR_DEBUG dump for the next round's patch-map comparison.
fix(aac): SBR frames without a fresh FIL payload now reuse the last envelopeAhmet Kaan Gümüş · f505821
fix(aac): SBR frames without a fresh FIL payload now reuse the last envelope The windowed lag-drift diagnostic (new EC_AAC_SBR_DRIFT test knob) showed discrete lag PLATEAUS jumping by exactly 1024 samples -- the core frame length -- rather than a smooth per-sample drift. Root cause: raw_data_block only doubled an SCE/CPE's plane when its immediately-following FIL element carried a fresh SBR payload this frame; any access unit whose FIL was missing, non-SBR, or failed to parse silently left that one AU at core (1024-sample) length, permanently shifting every sample after it out of alignment with a reference that stayed at doubled rate throughout. 67 such skips were happening across the two-file sweep. SbrChain now caches each element's last successfully parsed SbrData and apply_last() re-runs the chain with it whenever a frame's own payload is unavailable (Amd 4.6.18's documented "hold state" behavior), so every AU still doubles. reeln ch0: -0.034 -> 0.973 full-band, 0.995 below crossover (bar 0.999 full / 0.9999 below still open). ch1: 0.014 -> 0.772 full-band (plateau structure now flat, remaining gap not yet root-caused). FMJ unchanged (separate pre-existing 11/1500-AU decode failure, documented dead end, left for last per the queue). Added a unit test (sbr_chain::tests) that runs two adjacent synthetic AUs through one SbrChain element and asserts both double to the full 2048 samples with no discontinuity at the junction -- the coverage hole the continuous-stream QMF round trip never exercised.
fix(aac-sbr): two real scale bugs behind the SBR catastrophic blowupAhmet Kaan Gümüş · 92f96f7
fix(aac-sbr): two real scale bugs behind the SBR catastrophic blowup Root cause 1: sbr_chain fed the SBR QMF analysis bank core PCM already at decode::OUTPUT_SCALE (1/65536), but the transmitted envelope/noise data is calibrated against the core's un-normalized internal PCM domain. Undo OUTPUT_SCALE before analysis and reapply it once after synthesis so the gain match (target vs. measured QMF energy) compares like against like. Root cause 2: the hand-designed 32/64-band QMF pair's own round-trip amplitude gain was never checked -- only shape (scale-invariant correlation). It measured ~1% of unity (a real tone demodulates to half its amplitude in a cosine/sine-modulated analysis bank, and this prototype's polyphase overlap-add doesn't sum to a flat constant on its own). Added analytic_gain() (exact 2/sum(h) per-tap correction, applied to both banks) plus a measured SYNTH_TRIM for synthesis's remaining overlap-add shortfall; round-trip amplitude ratio is now 0.999999 (was ~0.01), locked by a new amplitude-ratio assertion in round_trip_reconstructs_the_passband and a new analysis_alone_reads_back_the_input_tones_own_amplitude test. Real-file sweep (crates/ec-aac/tests/sbr_real_library.rs) improved substantially but has not cleared the 0.999/0.9999 bar yet: reeln ch1 full-band corr rose from 0.001 to 0.834, FMJ ch1 remains blown up (rms ~700x too large), suggesting at least one more, channel-specific bug remains. Debug instrumentation stays env-gated (EC_AAC_SBR_DEBUG=1) behind sbr_chain::debug_dump.
feat(aac): wire SBR HF gen + envelope adjustment into the decode chainAhmet Kaan Gümüş · 5206266
feat(aac): wire SBR HF gen + envelope adjustment into the decode chain sbr_chain.rs ties sbr_payload/_hf/_env/_qmf together per element: a FIL element's sbr_extension_data (explicit ASC signaling only, no implicit ADTS detection yet) drives 32-band analysis of the preceding SCE/CPE's core PCM, HF generation, envelope adjustment, and 64-band resynthesis, replacing that element's plane with double-rate PCM. SbrSupport gains a V1 variant (PS still reports CoreOnly); output_sample_rate now reports the extension rate for a reconstructed stream. sbr_is_reported_not_silently_upsampled is updated (not deleted) to pin the new contract, plus a PS case. Not yet exercised: real-file oracle correlation (next commit), implicit ADTS SBR signaling (deferred, named follow-up per charter), filterbank delay compensation for packet timestamps (open -- see report).