forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on mainFiltered to crates/ec-aac/src/sbr_qmf.rsClear filter

2026-10-23

Restore edith_codecs after local data loss (2026-10-23)Ahmet Kaan Gümüş · b7434a2
Restore edith_codecs after local data loss (2026-10-23)

On 2026-10-23 an automated agent ran `rm -rf $HOME` and deleted the local
repository with all of its history. This commit restores the working tree
from the newest surviving copy, the host-c server lane mirror. That mirror
matches local main as of the testcut Phase 2 reports, including the tool
cache, the nextest fast profile and changed-crates.sh. The history before
this commit was not recovered.

2026-08-21

2026-08-20

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): port the numpy-verified normative 64-band QMF bank into sbr_qmf.rs; delete the fitted Kaiser bankAhmet Kaan Gümüş · ddccd80
fix(aac-sbr): port the numpy-verified normative 64-band QMF bank into sbr_qmf.rs; delete the fitted Kaiser bank

Part (A)/(B) bisection (numpy, scripts/aac-tables/qmf_check.py):
zero-stuffing 32 core samples into the VERIFIED 64-band analysis
(x64[2m]=2*x32[m], odd=0), keeping bands 0..32 and dropping the
zero-stuffing image in bands 32..64, reaches corr=0.9994 against an
ideal band-limited 2x upsample (scipy resample reference) -- short of
the 0.9999 numpy target but a real, spec-traceable near-PR bank. The
per-k ratio probe (Analysis32 vs zero-stuff+Analysis64) showed the two
converge to a near-constant per-band complex factor after a few slots'
transient, consistent with the charter's predicted decimation identity,
but does not by itself explain Analysis32's/Synthesis32Downsampled's own
0.70-corr ceiling in isolation -- left as an open dead end, sidestepped
per charter option (B) instead of chased further.

crates/ec-aac/src/sbr_qmf.rs: `Analysis` and `HfAnalysis` now share one
`QmfAnalysis64` core (ISO/IEC 14496-3 4.6.18.4, the window-checksum-pinned
640-tap table from `sbr_qmf_window`); `Analysis` zero-stuffs its 32 core
samples into a 64-sample slot before running the shared core and keeps
the low 32 bands. `Synthesis` is the verified 4.6.18.8.2 64-band bank
directly. Deleted: `prototype`/`theta`/`modulation_tables`/
`analytic_gain`/`bessel_i0`/`sinc`/`KAISER_BETA`/`SYNTH_TRIM` (the fitted
Kaiser-window machinery this design used to build coefficients from).

crates/ec-aac/src/sbr_hf.rs: `band_shift_correction` returns 0
unconditionally -- the normative bank carries its own correct phase from
the spec equations directly, no per-slot quarter-turn patch-site
correction needed.

Removed 7 unit tests that encoded the fitted bank's own assumptions
(flat per-band synthesis gain, a specific band-index-to-frequency
mapping, the old patch-rotation convention) and no longer apply to the
literal spec equations' own indexing; kept/added: window checksum
(`qmf_window_checksum_matches_the_pinned_source`),
`round_trip_reconstructs_the_passband` (noise round-trip, unchanged,
still clears its native >=0.9999 bar for the multitone-passband case),
`synthesis_energy_gain_for_{white_noise,lowpassed_noise}_excitation`,
patch-map determinism (`sbr_hf::patch_map_is_deterministic_...`). Did
NOT add the charter's requested standalone "all-k passthrough tone" and
"patch p->p+8 coherence" tests -- out of this round's remaining budget,
left as a gap (see ledger).

GATE (cargo test -p ec-aac --lib): 44/44 pass (down from 50/50 pre-round;
6 net removed, see above).

GATE (cargo test -p ec-aac --test sbr_real_library):
  reeln ch0 full-band corr 0.972474 -> 0.987006 (IMPROVED)
  reeln ch1 full-band corr 0.969785 -> 0.986222 (IMPROVED)
  FMJ ch0 full-band corr -0.024 -> -0.025253 (unchanged, pre-existing
    documented defect per ledger round-46, unrelated to this bank)
  full_chain_low_band_matches_own_core: PASS
  sbr_real_library_matches_reference: FAILS on FMJ's worst_full>=0.999
    bar (pre-existing, not caused or fixed by this round)

Did not merge main / run synthetic_heaac_matrix -- out of this round's
remaining tool-call budget; next round should do that first.
test(aac): QMF-domain exact third witness for SBR HF content (round-46)Ahmet Kaan Gümüş · be3ee94
test(aac): QMF-domain exact third witness for SBR HF content (round-46)

Adds HfAnalysis (a 64-band forward analysis bank sharing Synthesis's own
convention) plus a validated self-consistency control, and rebuilds the
STFT-approximate patch-copy simulator (round-45) in this exact band grid
(EC_AAC_SBR_QMF_WITNESS) with a per-band 2nd-order complex transfer fit
between the plain-copy sim and the reference's real HF content
(hf_patch_transfer_fit) plus a bw-value dump (EC_AAC_SBR_BW_DUMP) for
comparison against our own chirp coefficients.

On reeln, the exact-domain witness overturns round-45's STFT-based
lead: for patch (3,28,11) sim-vs-reference clears 0.5 on most bands
(0.42-0.79) while sim-vs-ours stays well under it (0.26-0.42) -- the
opposite polarity from the STFT approximation's hint. The fitted
sim-to-reference transfer on that same patch shows non-trivial order-2
structure with a phase signature (~i, ~-1, ~-i across taps 0/1/2) matching
this file's own already-characterized (and currently disabled)
band_shift_correction quarter-turn convention -- flagged in the ledger as
the next concrete thing to re-test with this sharper instrument, not
implemented here (round-37's contrary real-file evidence used a
scale-trap-prone 8-bin STFT metric this round's own control work found
unreliable; re-enabling a previously-reverted correction needs its own
verification budget).
fix(sbr): correct the QMF in-band measurement bug, box-car the injected noise drawAhmet Kaan Gümüş · 3b60454
fix(sbr): correct the QMF in-band measurement bug, box-car the injected noise draw

sbr_qmf's synthesis_energy_gain_for_white_noise_excitation measured its
in-band FFT window at k0/SYNTHESIS_BANDS; band k's passband is actually
centred at (k+0.5)*omega_step with omega_step = pi/(2*SYNTHESIS_BANDS),
half that fraction of Nyquist, so the window sat on the alias image, not
the signal -- the round-43 "~0% in-band survival" reading was this bug,
not a Synthesis defect. Corrected, a raw i.i.d.-per-slot draw already
lands ~0.49 of its own energy in-band; a 2-slot boxcar (sbr_env::NoiseGen)
raises that to ~0.61 while staying noise-like (spread across the band,
not a residual tone).

Re-measuring the real-file whole-HF realized noise fraction after
shipping the boxcar shows it barely moves (0.1787 -> 0.1770): that metric
sums energy across the whole swept HF spectrum, and energy an i.i.d. draw
aliases to a neighbouring QMF band still lands inside that same sweep, so
it was never actually excluded. The ~0.38 bookkept vs ~0.18 actual gap is
therefore a genuine energy shortfall plus a content defect (measured
coherence sits well below even the actual-fraction ceiling), not the
noise-sequence-shape problem round-43 diagnosed. Tightens
sbr_actual_noise_fraction's regression floor from 0.15 to 0.17, the level
both before and after this fix.
fix(ec-aac): convict the SBR noise-realization gap in synthesis, not adjustAhmet Kaan Gümüş · 30721a2
fix(ec-aac): convict the SBR noise-realization gap in synthesis, not adjust

Round-43 Task 1/2: EC_AAC_SBR_CELLDUMP on reeln (with the charter's
quoted Hz bands corrected -- they were read off bin_level_conviction's
172.3Hz FFT-analysis spacing, not this file's true 344.5Hz SBR band
spacing) shows sbr_env::adjust injecting 40-85% noise share in the QMF
domain, at or above the ~0.37 bookkept split -- not starved. The
add_harmonic/sinusoid-interaction hypothesis is also refuted: no harmonic
flags fire on any of the convicted bands in this stream.

synthesis_energy_gain_for_white_noise_excitation (sbr_qmf.rs) drives one
Synthesis subband with the same independent-per-slot random complex value
adjust() injects and finds ~0% of that energy reconstructs back in the
source subband's own frequency range, against a tone's clean in-band
placement -- an i.i.d.-per-slot draw isn't a legitimate "bandlimited
subband content" input to this filterbank's complex-modulation
convention, so it aliases out almost entirely instead of surfacing as
audible noise near the intended frequency. This is the charter's Task 3
"noise SEQUENCE is the last mile" scenario, not an adjust() accounting
bug; sbr_actual_noise_fraction's regression floor is documented
accordingly and left untightened since the actual gating defect is still
open.
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.
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.

2026-08-19

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): 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): 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.