forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on 8dbd683068d7f87f21dcc4ed1dfdca786d82c52b

2026-08-20

diag(aac): AU-level failure printing for the sbr_real_library sweepAhmet Kaan Gümüş · cc56143
diag(aac): AU-level failure printing for the sbr_real_library sweep

EC_AAC_SBR_AU_FAIL_DEBUG=1 gates a per-AU index/error/first-bytes dump
in our_decode(), for tracing which access units a real HE-AAC track
fails to decode. Run against the HE-AAC commentary candidate (48kHz,
mkv, absolute stream 3): zero of 1500 access units fail this round --
the "N/1500 AUs fail" fact recorded earlier in the investigation no
longer reproduces at HEAD, superseded by intervening grid/pointer
fixes. That file's catastrophic full-band decorrelation persists with
a clean, non-dropped AU count, so it is not a timeline-shift artifact
of missing samples -- the remaining cause is upstream of AU-level
decode failure and is not root-caused this round.
test(sbr): sweep for a constant HF-only QMF-slot lag against the referenceAhmet Kaan Gümüş · 4c5640d
test(sbr): sweep for a constant HF-only QMF-slot lag against the reference

Round-38 Task 1: EC_AAC_SBR_HF_LAG_SWEEP shifts only our decoded HF read
position by k*64 samples (k = -8..=8 QMF slots), reference and low band
held fixed at the already-established global alignment, and averages
per-bin direct coherence over every HF band. On reeln both channels
peak cleanly at k=0 (ch0 0.1739, ch1 0.1845) with every other k lower
(0.10-0.15) -- refutes the HF-only constant-lag hypothesis; no sbr_chain
delay implemented.
revert(aac-sbr): the patch copy stays unrotated -- the reference matches the raw conventionAhmet Kaan Gümüş · 1b74eca
revert(aac-sbr): the patch copy stays unrotated -- the reference matches the raw convention

The round-35 quarter-turn correction is frequency-pure by unit measurement,
and wrong by the bar: a 4-way A/B on the real file (off / as-is / sign
flipped / half rate) has the uncorrected copy winning decisively in the very
bands the correction targeted (odd-gap direct coherence 0.19 vs 0.07). The
reference reproduces the same cross-band convention, so matching it means
leaving the copy raw. band_shift_correction stays as documentation of the
characterized convention, pinned by its own tests; the production-path test
now exercises generate() itself and pins the raw-copy placement.
probe(sbr): parity-split direct-coherence instrument, even-gap vs odd-gap territoryAhmet Kaan Gümüş · c39572e
probe(sbr): parity-split direct-coherence instrument, even-gap vs odd-gap territory

EC_AAC_SBR_PARITY_SPLIT reports bin_level_conviction's direct-coherence mean
separately for header A's even-gap patch territory (bands 14..28, from
(0,14,14), already exact before round-35) and its odd-gap territory (bands
28..43, from (3,28,11)/(0,39,3)/(13,42,1), where round-35's Synthesis
phase-intercept correction landed) -- the region split the full-band/HF
"direct" numbers can't see (odd-gap bands are ~15 of ~100 total HF bands,
swamped by even-gap's dominant energy in any energy-weighted metric).

Round-36 before/after (git-checked-out src at HEAD~1 vs HEAD, same real
file): odd-gap direct coherence REGRESSES sharply after round-35's fix
(ch0 0.1907->0.0714, ch1 0.2461->0.0741) while even-gap stays flat (ch0
0.1526->0.1510, ch1 0.1848->0.1749) -- the opposite of the charter's
"odd-gap improves" expectation. bw=0 (EC_AAC_SBR_BW_SCALE=0) moves neither
region (ch0 even 0.1517/odd 0.0707, ch1 even 0.1745/odd 0.0727, both
indistinguishable from bw=1), exonerating the chirp/whitening IIR as the
cause of either number.
fix(aac): SBR HF patch copies land at the wrong absolute frequency, one full band offAhmet Kaan Gümüş · 2f5c8e2
fix(aac): SBR HF patch copies land at the wrong absolute frequency, one full band off

Unit-level conviction (sbr_qmf.rs): Synthesis's odd-stacked modulation
kernel centres band k with a phase intercept of (k+0.5)*pi/4, which only
cancels against a receiving band's own reconstruction when source and
target band coincide. Replaying a source band's raw complex series into a
*different* synthesis band -- exactly what sbr_hf's HF patch copy does --
lands the content one full synthesis-band-width off whenever the band gap
is odd, sign alternating with (target-source) mod 4; even gaps were
already exact. Pinned by two new sbr_qmf tests (patch_replay_preserves_
absolute_frequency_mapping, synthesis_offset_sense_is_self_consistent_
within_a_band) that measure the dominant spectral line via Analysis+
Synthesis round trips instead of asserting against a hand-derived
constant.

Fix applied at the patch-copy site (sbr_hf::generate), not the tuned QMF
bank convention itself: round-trip/gain-flatness bounds there were
hard-won by prior brute-force search and a same-shape retune was out of
this round's scope. band_shift_correction() computes the needed
quarter-turn-per-slot counter-rotation from (target - source) mod 4 and
HfHistory now carries a slot-phase counter so the correction stays phase
continuous across frame boundaries.
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).
probe(sbr): engagement bisection converges on the harness, not the payloadAhmet Kaan Gümüş · 854ea37
probe(sbr): engagement bisection converges on the harness, not the payload

Round-32: field-by-field bisection of stream() (known-engaging) against
stream_one_band() found every candidate flip (header shape, core content,
delta-Huffman words) engages identically once wrapped through wrap_sbr's
explicit-SBR ASC -- stream_one_band's bit construction was never the bug.
sbrpatchmap.py's run_header() was still routing the reference side through
bare-ADTS ffmpeg decode (P.decode), never adopting wrap_sbr after round-31
built it; ref_decode() fixes that, and the reference now shows genuine,
per-source-band-varying patch maps with the dequant warning firing once at
stream head only.

Also fixes adts_to_pcm's --same-rate-sbr config, which independently
diverged from wrap_sbr's ASC (object_type=2/AAC-LC and sample_rate=44100 for
what is actually a 22050 Hz core) -- now built via the same
write_audio_specific_config + with_config_bytes round trip wrap_sbr uses.

Task 2's sanity gate (ours == build_patches prediction) still fails after
both fixes -- our decoder's measured target set is a near-constant
[14,15,18,19,20,21] band cluster regardless of source band or header,
unlike the reference's now-varying read -- a distinct, unresolved defect in
sbr_hf.rs's generate() or the QMF path, blocking Task 3/4 (the verdict).
aac(sbr): explicit-SBR AudioSpecificConfig writer, plus a wrap-to-mp4 probe instrumentAhmet Kaan Gümüş · 9b44442
aac(sbr): explicit-SBR AudioSpecificConfig writer, plus a wrap-to-mp4 probe instrument

write_audio_specific_config never emitted the extension sf_index/
extensionAudioObjectType an AOT_SBR/AOT_PS config needs (§1.6.2.1) -- it
wrote plain GASpecificConfig fields regardless of object type, so every
config it built for an SBR-signalling caller was spec-invalid. Extended it
minimally (parse_audio_specific_config already read the extension fields
correctly, so only the writer was missing them) and added a round-trip
unit test.

Also adds crates/ec-aac/examples/wrap_sbr, the round-30/31 instrument
blocker's fix: wraps bare ADTS probe streams (the SBR patch-map scripts'
output) in an mp4 carrying this explicit-SBR ASC as their esds, so the
reference decoder has an out-of-band AudioSpecificConfig to arm HE-AAC
output from instead of only its (never-engaging) implicit per-frame
detection on bare ADTS.
diag(sbr): fix source-band placement math to 32 bins/band, surface a deeper SBR-engagement blockerAhmet Kaan Gümüş · 7049a6c
diag(sbr): fix source-band placement math to 32 bins/band, surface a deeper SBR-engagement blocker

sbrpatchmap.py's probe placed its isolated tone at k = p*16 + offset,
assuming a source (low) QMF band is 16 core-MDCT bins wide. It is 32
(1024-bin core MDCT / 32 core bands). Fixed to k = p*32 + 16 (band
center, lands cleanly on a group boundary so no fractional-offset
trick is needed).

Calibrating that fix against the unambiguous header-A anchor
((13, 42, 1), a width-1 patch) surfaced a deeper, blocking problem:
ffprobe shows these synthetic ADTS probe streams never engage the
reference decoder's SBR/HE-AAC upsampling at all (sample_rate=22050,
no HE-AAC profile, decoded PCM length exactly core-rate), unlike the
real reeln fixture (profile=HE-AAC, sample_rate=44100). The "No
quantized data read for sbr_dequant." warning's raw occurrence count
(fires once per 26-frame stream) reads as benign by the charter's own
heuristic but is not: an env0 power sweep shows the predicted target
window is flat while a large, smoothly-scaling, envelope-driven signal
appears well outside it, and never flips the decoder into HE-AAC
output. Reproduces for both tone_core and broadband_core_bits content,
so it's a property of the shared frame/extension-payload construction,
not either core-spectrum writer -- a generalization of round-27's
tone_core-specific dead-end.

Sanity gate (our decoder's map == build_patches prediction) and the
reference-map read are both gated on fixing that engagement bug first;
sbr_hf.rs is left untouched pending it. crates/ec-aac --lib: 40/40.
fix(sbr-tables): stop sbrpatchmap's delta-huffman filler desyncing envelope1/noise1Ahmet Kaan Gümüş · a913c84
fix(sbr-tables): stop sbrpatchmap's delta-huffman filler desyncing envelope1/noise1

sbr_bits_full's slot() defaulted every un-supplied delta band to T.FILL (24
raw zero bits); ENV30_F/NOISE_F's shortest codeword (delta=0) is only 1 bit,
so 23 leftover zero bits per slot bled into every field transmitted after
the first multi-band delta run, silently corrupting envelope1/noise1's raw
values to 0 regardless of what stream_one_band asked for (confirmed via
EC_AAC_SBR_DEBUG before/after). Also switched the readout from power buckets
to fractional-frequency-offset line detection per round-29's charter, and
moved the tone off the ambiguous band-boundary bin.

Sanity gate (ours vs build_patches) still fails: localized to the tone's
bin-placement assumption (k = p*16), not build_patches or the runtime
(patches dumped via EC_AAC_SBR_DEBUG match build_patches exactly). Left
documented as open in the module docstring; reference maps not read this
round since Task 1's own gate blocks it.
fix(sbr-probe): tone_core's pulse/tns/gain flags sat after spectral data, not beforeAhmet Kaan Gümüş · 23f057e
fix(sbr-probe): tone_core's pulse/tns/gain flags sat after spectral data, not before

tone_core() (scripts/aac-tables/sbrchirp.py) is the isolated-single-MDCT-line
probe writer used by sbrpatchmap.py's patch-map fingerprinting; it desynced
the reference decoder on every real-header probe ("channel element X.Y is not
allocated" / "buffer exhausted before END"). Byte-accounted against sce_core's
proven field order: the `pulse_data_present/tns_data_present/gain_control_
data_present` 3-bit field must precede spectral_data(), not follow it -- the
misplaced write shifted every bit after it. Core-only round-trip is now
byte-clean (0 errors) and the real reeln header/grid shape (kx=14/k2=43)
decodes to nonzero PCM instead of 0.

Also fixes sbr_hf.rs's `real_file_tables()` test fixture, whose stop_freq=3/
xover_band=2 guess was wrong (gave kx=16/k2=29); the real value read off the
file's own bitstream is stop_freq=8/xover_band=0 (kx=14/k2=43) -- confirmed
build_patches() on the corrected header exactly matches sbrpatchmap.py's
independently-ported prediction: [(0,14,14),(3,28,11),(0,39,3),(13,42,1)].

Running the full three-header patch-map sweep against both the reference and
our own decoder (adts_to_pcm) surfaced a new blocker, not fixed here: our own
decoder's *measured* map disagrees with build_patches' own prediction (empty
for source band 0, a constant band range for every other source band) even
though build_patches itself is proven correct in isolation -- the runtime HF
generation/envelope path or the probe's PCM analysis is unverified, not
build_patches. Per the probe's own sanity rule this blocks trusting the
reference's measured map until resolved.
probe(sbr-patchmap): infra for measuring the reference's real HF patch mapAhmet Kaan Gümüş · e3a8adf
probe(sbr-patchmap): infra for measuring the reference's real HF patch map

adts_to_pcm example lets our own decoder be driven through the same
one-band-at-a-time probe streams sbrpatchmap.py builds for the reference
decoder (needs an explicit same-rate-SBR AudioSpecificConfig -- plain
AacDecoder::new() never turns SBR on from bare ADTS). sbrpatchmap.py reads
reeln's ACTUAL header off our own decoder's EC_AAC_SBR_DEBUG dump
(start_freq=5 stop_freq=8 xover_band=0 -> kx=14 k2=43 n_q=3, matching the
ledger's fact but NOT sbr_hf.rs's real_file_tables() unit test, whose
guessed stop_freq/xover_band=3/2 gives a different kx=16 k2=29 header) and
ports build_patches to Python for a live prediction-vs-measurement diff.

Blocked before a single measurement: tone_core()'s isolated-MDCT-bin core
(sbrchirp.py) fails outright against this header/grid shape ("channel
element 0.0 is not allocated" / "Invalid data found", zero PCM decoded),
reproducing round-19's "isolated-tone encoding does not round-trip" dead
end on the real header instead of the round-18 SBR-engagement bug it was
first seen with. Not fixed this round -- see ledger for next steps.
diag(aac-sbr): convict per_band_lag_search's bandpass, task-2 finds direct-matchAhmet Kaan Gümüş · bf135ff
diag(aac-sbr): convict per_band_lag_search's bandpass, task-2 finds direct-match

Round-26 Task 1: bandpass_offset_probe correlates the SAME 3x-cascaded
RC bandpass at band k (ours) against band k+/-10 (reference) -- the
downward offset consistently reads HIGHER correlation than the
nominal same-band pairing across every HF band tried on the real
library file (e.g. band 34: same 0.937 vs -10 0.966), which a filter
with real ~172Hz selectivity cannot produce. This convicts the
bandpass as instrument bug #7: "band k" was really "everything up to
band k", manufacturing the smooth monotonic decline rounds 14-25
chased via cumulative low-band leakage. per_band_lag_search's doc
comment now records the conviction -- its LAG output stays valid
(passband delay still tracks true alignment) but its per-band
AMPLITUDE reading does not.

Task 2: bin_level_conviction compares bin-level complex content
direct/mirrored/shifted-a-whole-band between the two decodes in the
same energetic HF bands. No mirror or shift wins systematically
(direct wins 9/12 tested bands, sometimes decisively); this is the
"direct-match winning" outcome the charter calls out as needing a
follow-up tone-fingerprint patch-map measurement, not a mirror/shift
code fix -- so no production code changes this round.

2026-08-19

fix(ec-aac): the SBR "second-half collapse" was a mismatched-split test artifactAhmet Kaan Gümüş · 8bdf7f5
fix(ec-aac): the SBR "second-half collapse" was a mismatched-split test artifact

sbr_real_library's SWEEP_SEGMENT diagnostic sliced ours/theirs at their
own independent len()/2, but ours is capped at MAX_SAMPLES while the
reference decodes the file in full (30s vs our 22.7s on reeln) --
so the "second half" compared ours' 11.35s-22.7s against the
reference's 15.0s-30.0s, two different passages 3.6s apart, reading as
a catastrophic collapse (~-0.01 corr) with no decode defect behind it.
Splitting both sides at the shorter side's midpoint fixes it (0.981/
0.976 full-band). A new whole-file corr-vs-time timeline (windowed
local-lag search, EC_AAC_SBR_TIMELINE) confirms there is no sustained
mid-file collapse on reeln: 0.958/0.954 mean windowed corr across
all 22.7s, dipping briefly (~0.2s) only near t=0 and t=20.2s.
sbr: env-gated parameter-sensitivity sweep instruments (round-22)Ahmet Kaan Gümüş · 0fb1dc2
sbr: env-gated parameter-sensitivity sweep instruments (round-22)

EC_AAC_SBR_BW_SCALE (chirp/inverse-filter target scale, clamped <1),
EC_AAC_SBR_CHIRP_SMOOTH=none|swap (attack/release curve), EC_AAC_SBR_GAIN_LERP
(per-slot gain interpolation toward the next envelope), and
EC_AAC_SBR_LIMITER_OFF probe whether real-content correlation is sensitive to
these knobs. All zero-cost when unset; default behavior unchanged (40/40
lib tests, reeln baseline bit-identical). EC_AAC_SBR_SWEEP_SEGMENT=1 lets
the real-file test measure the second half of a file for stability checks.

Sweep result: BW_SCALE shows a small monotonic response (best at scale=0,
i.e. no chirp resonance at all -- ch1 delta 0.0023, just past the 0.002
material bar) but a two-segment stability check was inconclusive (the
file's second half has near-zero baseline correlation for both candidate and
default, invalidating the comparison), so the default is NOT changed.
Chirp-smoothing curve and limiter are flat (eliminated). Gain-lerp
catastrophically regresses (full-band 0.97->0.07) and is eliminated.
fix(aac-sbr): noise-floor dequant is a signal-relative ratio, not an absolute energyAhmet Kaan Gümüş · 5537fae
fix(aac-sbr): noise-floor dequant is a signal-relative ratio, not an absolute energy

Round-21 Task 1: a reference-decoder probe (scripts/aac-tables/sbrnoise.py)
sweeping the noise-floor raw value q_q at a fixed envelope target shows
total HF-band output power staying nearly flat across the whole q_q range,
not scaling additively with dequant_noise(q_q) as our own decoder assumed.
That's the signature of the envelope target being split
signal=target/(1+Q_div), noise=target*Q_div/(1+Q_div) with
Q_div=dequant_noise(q_q), not noise added independently on top of the full
target. adjust() now computes that split per (envelope, band) cell and
injects noise there directly, replacing the old separate noise-grid pass
that treated dequant_noise's return value as a standalone absolute energy
comparable to dequant_env's unrelated unit scale.

On the real-file bar (reeln) this moves correlation only slightly
(ch0 0.9726->0.9732, ch1 0.9705->0.9716): real transmitted q_q values
apparently keep Q_div small regardless of interpretation, so the
noise-floor circularity hypothesis still doesn't explain this file's HF
correlation gap -- but the fix itself is now unit-consistent with the
measured reference behavior and is kept as a correctness fix.
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.
probe(sbr-chirp): repair the non-engaging instrument, refute the bw-per-level hypothesisAhmet Kaan Gümüş · 9a984c9
probe(sbr-chirp): repair the non-engaging instrument, refute the bw-per-level hypothesis

Round-18's stream() never exercised the reference decoder's SBR gain stage:
amp_res=0 (coarse envelope resolution) and num_env=1 (FIXFIX single
envelope) each independently make it ignore the payload's envelope AND
bs_invf_mode, and the same recipe was missing the FIL byte-padding loop
before END (silent bitstream desync, masked because the byte-count still
happened to work out on most inputs). Bisected against a known-working CPE
probe to isolate both culprits.

Repaired stream() (SCE, FIXFIX num_env=2, amp_res=1, byte-padded) engages:
sweeping envelope raw value 3->60 swings output power by three-to-four
orders of magnitude. On this working instrument, the four bs_invf_mode
levels (NONE/LOW/MID/HIGH) produce indistinguishable output (<0.1% power
drift, no resolvable flatness difference) against a BW_TABLE spanning
0.0..0.98 -- STOP RULE: hypothesis refuted for this measurement, sbr_hf.rs
left unchanged.
scripts(sbr): black-box chirp/bw probe -- dead end, harness never engaged SBR envelopeAhmet Kaan Gümüş · 054aa95
scripts(sbr): black-box chirp/bw probe -- dead end, harness never engaged SBR envelope

Attempted to measure the reference decoder's per-invf-mode bandwidth-
expansion factor by black box (round 18, Task 1). Two dead ends recorded
in the script's own docstring for a successor:

* An isolated single-MDCT-line core (for an exact-AR2 pure-tone source,
  whose LPC coefficients are analytically known) desyncs the bitstream --
  most HCB3 codewords beyond the one tuple earlier probes exercised are
  unverified.
* Falling back to the already-proven-clean broadband comb core, every
  real SBR decode attempt makes the reference print "No quantized data
  read for sbr_dequant." and then produce PCM that is value-independent
  of both bs_invf_mode (all four levels byte-identical) and the envelope
  amplitude itself -- the envelope/gain stage never engages, for a reason
  the byte-count oracle (which only checks framing) cannot see.

No bw fingerprint extracted; sbr_hf.rs is unchanged -- no measurement to
base a fix on, and the task's own stop rule forbids fitting constants to
noise.
diag(ec-aac): SBR noise-fraction ceiling hypothesis, measured and refutedAhmet Kaan Gümüş · 2cccf17
diag(ec-aac): SBR noise-fraction ceiling hypothesis, measured and refuted

Round-17 Task 1: EC_AAC_SBR_NOISE_FRACTION_DEBUG accumulates per-QMF-band
transmitted signal vs. noise energy (from our own dequantized envelope/
noise data) during decode; the real-file test prints the predicted
sqrt(1-f_noise) correlation ceiling alongside per_band_lag_search's
measured curve. On reeln ch0 the noise energy fraction is ~1e-7 in
every HF band (predicted ceiling flat at 1.0000) while measured |corr|
declines smoothly 0.999->0.85 -- the curves do not match. EC_AAC_SBR_NOISE_ZERO
corroborates: zeroing our injected noise entirely leaves the measured
per-band correlation bit-for-bit identical, so our noise generator is not
in the causal path for the decline either. Hypothesis not convicted; no
noise-table derivation follows per the charter's stop condition.
test(sbr): fix the per-band STFT correlation and cross-spectrum diagnosticsAhmet Kaan Gümüş · 80e5af3
test(sbr): fix the per-band STFT correlation and cross-spectrum diagnostics

per_band_correlation was correlating each FFT bin's magnitude series then
averaging |corr| across a band's 8 bins -- a tiny inter-bin energy
redistribution between our filterbank and the reference decorrelates each
bin individually even when the band's total energy tracks closely. Sum the
band's bin magnitudes coherently first, then correlate once.

Added per_band_phase (round-16 Task 2): a cross-spectrum phase/magnitude-
ratio probe over the same aligned window. Its first version complex-summed
a band's bins before forming the cross product, which mixes in O_b*conj(T_b')
cross terms for b != b' -- pure noise between unrelated bin frequencies. Fixed
to accumulate the cross-spectrum per bin across hops, then sum bins.

Neither fix reconciles the STFT-domain reading with per_band_lag_search's
direct PCM bandpass-and-correlate result above the crossover: STFT magnitude
and cross-spectrum phase both go noisy/unstable there (phase swings over
hundreds of degrees band to band, magnitude ratio spans 0.003-8.9), while
per_band_lag_search finds a clean lag-0/-1 peak with correlation declining
smoothly from ~0.999 to ~0.80. Below the crossover both diagnostics agree
cleanly (phase <0.5deg, magnitude ratio ~1.00-1.01), so the below-crossover
0.9989-vs-0.9999 residual is not a phase story. No calibration applied --
the charter's decision tree calls for reporting both curves and stopping
when neither a smooth phase curve nor a stable magnitude curve emerges.
test(aac): per-HF-band PCM lag search discriminates round-15 candidate AAhmet Kaan Gümüş · b768ffa
test(aac): per-HF-band PCM lag search discriminates round-15 candidate A

round-14's per-band STFT magnitude-series correlation (0.04-0.5, even
spread) was consistent with either a per-stage time-alignment bug or a
common patch-map transform -- both give an even spread with no cliffs.
This adds a per-band bandpass PCM-domain lag search (sharp cascaded
RC bandpass + coarse-then-refine lag search, same shape as
best_lag_correlation) that searches actual sample lag directly instead
of relying on the STFT hop's 1024-sample bucket, which is too coarse to
see a one-QMF-slot (64-sample) delay.

Result on reeln (the one healthy real-file candidate): every HF band
from 2412Hz to 21878Hz peaks at lag 0 (ch0) / -1 (ch1), with a smooth,
monotonically-declining (not noisy) correlation from ~0.999 near the
crossover down to ~0.80 at 22kHz -- no band drifts to a nonzero multiple
of 64 samples. This exonerates candidate A (per-stage delay): the HF
path is not time-offset from the reference at any QMF-band granularity.
FMJ (the separately pre-SBR-broken file) shows the opposite signature --
noisy, band-to-band-jumping lags (288-704) with near-zero correlation --
confirming the diagnostic is sensitive to a real misalignment when one
exists, not just reporting 0 by construction.
test(aac): per-QMF-band correlation diagnostic for the SBR HF regionAhmet Kaan Gümüş · 12a3673
test(aac): per-QMF-band correlation diagnostic for the SBR HF region

Task 2 of the above-crossover residual hunt: no 64-band QMF Analysis
exists standalone, so this substitutes an STFT magnitude-per-bin time
series correlated bin-by-bin and grouped into QMF-width bands
(core_rate/128, i.e. output_rate/256 -- measured, not assumed: the
correlation break on reeln lands exactly at kx*172Hz=2412Hz, not
at kx*345Hz). Opt-in via EC_AAC_SBR_BANDS so the default run stays at
its current cost.
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): 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): clamp envelope and noise rows to their field's own widthAhmet Kaan Gümüş · d1237c2
fix(aac-sbr): clamp envelope and noise rows to their field's own width

Defensive: a corrupt DT delta chain could previously snowball without
bound inside one frame. Measured zero effect on the real-file bar --
the implausible values there are legal within the field width, a
separate open defect.
fix(sbr): limiter clamp actually caps gain instead of always no-oppingAhmet Kaan Gümüş · 407561c
fix(sbr): limiter clamp actually caps gain instead of always no-opping

sbr_env::adjust's limiter cap used `.max(gain.min(limiter_max))`, which is
always >= the intended cap and so the .min() around it never restricted
anything -- flagged in the ledger as likely backwards, now confirmed and
fixed: the cap is limiter_max * sqrt((noise+current)/current), matching
Sec 4.6.18.7.5's headroom shape (a cell with zero transmitted noise floor
still gets the plain limiter_max ceiling). Zero measured effect on the two
real-file fixtures (limiter rarely the binding constraint there), but
lib tests 38/38 and this closes a genuine correctness gap flagged for two
rounds.

Also tried and reverted in this same pass: per-subband bs_interpol_freq
gain interpolation (a centre-frequency lerp across sfb gains) regressed
reeln ch0 full-band 0.972756 -> 0.960561, so it's left as a documented
corner-cut rather than shipped -- header.interpol_freq/smoothing_mode stay
parsed but unapplied.
test(sbr): below-crossover band searches its own alignment lag, not the full-band winnerAhmet Kaan Gümüş · 226d633
test(sbr): below-crossover band searches its own alignment lag, not the full-band winner

reeln ch1's full-band search lands on lag 65 while the below-crossover
(low-passed, core-only) content's own true alignment is lag 64 -- the two
differ by only 0.0015 in full-band correlation (broadband content barely
cares) but by 0.88 in below-crossover correlation, which is exactly what a
narrowband correlation surface reusing the wrong neighbour of a near-tied
full-band lag looks like. Below-crossover corr for ch1 moves 0.062 -> 0.945,
in line with ch0's own 0.993 -- the "ch1 below-crossover is worse than
full-band" anomaly was this measurement bug, not a second SBR defect.
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-test): the real-library correlation search was a false witnessAhmet Kaan Gümüş · 25a65cb
fix(aac-sbr-test): the real-library correlation search was a false witness

best_lag_correlation's signed-max search, combined with a `best.1 < 0.0`
fallback meant to catch "no in-bounds lag found", was silently discarding
every genuinely-negative full-WINDOW refined correlation and substituting
the COARSE (4096-sample) pass's result instead -- a window 20x shorter and
prone to spuriously reading ~0.87 on real audio by chance. That fallback is
where every "reeln ch0 ~0.87, healthy" measurement this week came from;
ch0's actual full-window correlation at its own best-aligned lag is -0.034.
Search by |correlation| and gate the fallback on "no candidate lag existed"
rather than on sign, so a real negative (inverted) result is reported as
what it is instead of getting silently replaced.

Corrected picture: reeln ch0 -0.034 / ch1 0.014, both near-zero -- this
is not a channel-1-specific defect, both channels of the SBR-armed decode
are badly decorrelated from the reference. FMJ's ch0 0.005 / ch1 0.024 are
unchanged by this fix (their true refined correlation was never negative,
so the buggy fallback never masked them). Root cause of the SBR-armed
decode's own corruption is still open -- this only fixes the instrument.
fix(aac-sbr): coupled envelope de-mix ratio needed a -12 offset, not raw balanceAhmet Kaan Gümüş · 81915ce
fix(aac-sbr): coupled envelope de-mix ratio needed a -12 offset, not raw balance

Pinned empirically by writing coupled CPE payloads with known
(channel0, balance) raw pairs through a decodable HE-AAC stream and
fitting the left/right PCM energy split against the balance raw value
for both bs_amp_res=0 and 1. Both collapse to the same
`2*alpha*raw - 12` exponent (previously used `alpha*raw`, uncentred).

Real-file sweep still misses the bar: below-crossover (pure core,
no SBR) correlation for the second channel is already near zero on
both real files, meaning the dominant remaining fault is upstream of
sbr_env, in core-level channel-pair decode -- not a de-mix convention
issue. See ledger for the swap/cross-channel correlation evidence.
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).
fix(aac-sbr): apply the envelope gain before noise injection, not afterAhmet Kaan Gümüş · 90930dd
fix(aac-sbr): apply the envelope gain before noise injection, not after

sbr_env::adjust injected the transmitted noise floor into the HF QMF
signal before measuring the (envelope, band) cell's current energy and
computing the gain toward the transmitted target -- so gain was
computed from signal+noise together and then rescaled both, distorting
the noise/signal split by however much noise dominates a given cell.
Move noise injection after the gain loop (signal only informs gain,
noise is added at its own transmitted amplitude afterward), matching
the spec order. Real-file sweep correlation barely moved from this
alone (0.019/0.834 and 0.005/0.0001 before and after), so it is a
real but non-dominant contributor to the residual failure; see the
localization note left for the next pass.

Also added an EC_AAC_SBR_ENV_DEBUG-gated dump in decode_envelope that
pinpointed the dominant remaining defect: multi-envelope real-file
frames occasionally carry a raw (non-delta) envelope whose absolute
value is inconsistent with every neighbouring envelope's magnitude in
the same frame (observed: FMJ ch0 frame 24's envelope 3 reads raw=43
right after envelopes 0-2 all sit at 8-10, and the frame's own core
PCM never exceeds ~9600 in this domain, so a target energy of 2^43 is
unreachable by any correctly functioning HF patch of that content).
That corrupted value then persists and grows across frames via the
cross-frame DT envelope prediction (self.state[ch].last_env), which
does no plausibility check on what it carries forward. Root bit-level
cause not yet found: env0-2 in the same frame decode plausibly, ruling
out a bit-count bug in bs_data_extra/bs_coupling/sbr_grid/sbr_dtdf/
sbr_invf that would already have desynced env0. Next step: instrument
whether this specific raw envelope's df_env bit is being read at the
position the FIXVAR/VARFIX/VARVAR grid class actually places it, since
these real files exercise those unverified border-value grid classes
(sbr_payload.rs's honest gap) far more than the byte-exact FIXFIX
fixtures.
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.
fix(ec-aac): bound the HF LPC predictor so it cannot divergeAhmet Kaan Gümüş · 01987f4
fix(ec-aac): bound the HF LPC predictor so it cannot diverge

sbr_hf::lpc2 solves a covariance-method normal-equation system, which carries
no built-in stability guarantee the way the spec's own Levinson-Durbin
reflection coefficients do. Clamp |a1|+|a2| below 1 (a standard sufficient
BIBO bound) before the coefficients feed the per-frame y = residual +
ca1*y[n-1] + ca2*y[n-2] resynthesis recursion.

Measured effect on the real-file sweep: none -- output rms before and after
is bit-identical, so the clamp never actually triggers on these two files
and the catastrophic energy blowup seen in that sweep (rms up to ~1e6
against ~0.2 for a correct decode) lives somewhere else. Kept anyway as a
real, spec-honest gap this module had; see sbr_real_library.rs for where
the actual fault is now localized to for the next pass.
test(ec-aac): reach the SBR chain from real HE-AAC files, not just ADTS fixturesAhmet Kaan Gümüş · 5bbfe62
test(ec-aac): reach the SBR chain from real HE-AAC files, not just ADTS fixtures

tests/oracle.rs remuxes every source to bare ADTS before decoding, and ADTS
carries no AudioSpecificConfig, so with_config_bytes()/set_sbr_rate() never
armed and no existing test exercised the SBR path at all. This adds a
container-native harness (ec-mp4/ec-matroska as dev-deps, via the shared
Demuxer trait) that pulls the real esds/CodecPrivate AudioSpecificConfig and
access units out of whichever real HE-AAC files a live library sweep finds,
decodes them through with_config_bytes, and compares against the reference
decoder by lag-searched correlation, split into below/above-crossover bands
for localization. Skips loudly when ffmpeg or no such files are present.
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).
feat(aac): SBR HF generation and envelope adjustment, unwiredAhmet Kaan Gümüş · 49f840b
feat(aac): SBR HF generation and envelope adjustment, unwired

sbr_hf.rs: patch construction (copy-up from below kx into [kx,k2)
aligned to f_high borders), order-2 complex covariance LPC per source
subband, and bandwidth-expanded ("chirped") whitening driven by
bs_invf_mode with fast-attack/slow-release smoothing.

sbr_env.rs: envelope/noise dequantization (including a best-effort
symmetric coupled-CPE balance de-mix, corner-cut noted -- no real-file
fixture exercises it yet), per-(envelope,band) gain toward the
transmitted energy with a noise-floor-relative limiter, noise
injection and add_harmonic sinusoids.

Neither module is wired into the decoder yet (next commit); both carry
their own unit tests and compile clean.
feat(aac): the SBR QMF filterbank pair, phase convention and prototype closedAhmet Kaan Gümüş · f29cb75
feat(aac): the SBR QMF filterbank pair, phase convention and prototype closed

The odd-stacked complex-exponential phase reference needed +bands/2, not
-bands/2 (found by a brute-force sweep over the small discrete convention
space against the round-trip correlation itself); with that settled, a
Kaiser-beta sweep against the same metric closed the residual prototype-shape
gap. Round trip now correlates 0.999949 (bar 0.9999) at a measured 898-sample
delay, and the impulse test's in-band frequency window is resynced to the
synthesis bank's own omega_step.
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.
feat(aac): the SBR frequency-band derivation, ported from the validated rigAhmet Kaan Gümüş · 3a933f6
feat(aac): the SBR frequency-band derivation, ported from the validated rig

The master/high/low/noise band tables as the probe rig derived and proved
them — 6387/6387 header configurations agree with the reference parser —
carried over with 500 embedded cross-check vectors generated by the rig's
own function. Not yet consumed by a decode path.
feat(ec-aac): close the eight envelope SBR Huffman codebook valuesAhmet Kaan Gümüş · 86f03f9
feat(ec-aac): close the eight envelope SBR Huffman codebook values

The values-stage classifier misread the reference decoder's unconditional
"channel element 0.1 is not allocated" complaint (fires on every mono
sce probe regardless of range) as a crash signal, hiding in-range
codewords as gaps; the discriminator is now whether the parser's byte
count matches the full predicted frame length. ENV30_F/ENVB30_F needed
their own two-envelope probe config since a lone envelope always forces
the 1.5 dB resolution. All twelve SBR codebooks now close with Kraft
sum 1 and full values.
feat(ec-aac): derive four SBR noise Huffman codebooks, black boxAhmet Kaan Gümüş · c53ad6b
feat(ec-aac): derive four SBR noise Huffman codebooks, black box

Wires the SBR table-derivation rig's widths/books/values stages into its
CLI and adds the value-assignment stage (bisecting a codeword's raw start
value to the reference decoder's own range-check boundary), then emits
the codebooks that closed with a complete, fully-valued prefix code:
NOISE_T, NOISE_F, NOISEB_T, NOISEB_F. The eight envelope books derive
lengths cleanly but each hit at least one codeword whose value probe
crashes the reference decoder rather than range-checking gracefully
("channel element 0.1 is not allocated"); they are left out of
sbr_tables.rs rather than shipped with a guessed value, per the rig's own
rule against fabricating table entries.
test(hw): the reference feed keeps the film's own cadence, and RSS is measured aloneAhmet Kaan Gümüş · 3c2d14b
test(hw): the reference feed keeps the film's own cadence, and RSS is measured alone

Three fixes to the live GPU suite:
- the reference decode now passes pictures through at their coded cadence
  instead of conforming to the container's nominal rate, which duplicated or
  dropped frames on films whose real cadence differs and read as every frame
  being one off from some point onward
- elementary-stream extraction is bounded to the frames under comparison plus
  a reorder margin, instead of piping a whole feature film through memory
- the resident-set leak check re-runs itself in a child process: VmRSS is
  process-wide, and a sibling test allocating between baseline and end showed
  up as a 200 MB leak that no code caused

2026-08-14

shim(ruopus): the Opus decoder seat edith consumes, over ec-opusAhmet Kaan Gümüş · 88cf2a7
shim(ruopus): the Opus decoder seat edith consumes, over ec-opus

The last audio shim the replica's [patch.crates-io] table was missing. It
is one re-export -- `MultistreamDecoder` -- because `ec-opus`'s already
has the incumbent's signature and, more to the point, its semantics:
`with_rate(rate, streams, coupled, &mapping)` with the same layout rules
and the same panic on one the RFC forbids, and output in the *mapping's*
channel order rather than the product's.

That last one is the only decision here. Both decoders emit Vorbis order
for RFC 7845 family 1 (FL, FC, FR, BL, BR, LFE), and edith permutes it
into film order at the call site (`audio.rs:vorbis_to_film_order`), so
the shim permutes nothing: putting it here would fold every surround
track twice. The doc comment says so, since a future reader's first
instinct will be to move it.

The incumbent's feature names are declared and empty. `spectrograms` was
its FFT backend, default-on because CELT synthesis is an N/4 complex FFT
per block and the fallback decoded a 5.1 film at 0.95x realtime; the
transform behind this crate is not behind a feature at all. They are
declared regardless because a [patch.crates-io] consumer that names a
feature the patch lacks fails to *resolve*.