forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on 2cccf178a8bb4ba04fa845f4a9ed002c6a135fe3Filtered to crates/ec-aac/src/lib.rsClear filter

2026-08-19

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

2026-08-14

feat(aac): AAC-LC decoder, encoder and rusty_aac shimAhmet Kaan Gümüş · 9a848b4
feat(aac): AAC-LC decoder, encoder and rusty_aac shim

Decoder covers AAC-LC end to end: AudioSpecificConfig and ADTS framing,
all four window sequences and both window shapes, section and scalefactor
data, every spectral codebook including the escape one, pulse data, TNS,
M/S and intensity stereo, PNS, and SCE/CPE/LFE/DSE/PCE/FIL elements.
Output is film order FL, FR, FC, LFE, BL, BR (SL, SR), which is the order
the downmix in this family folds, so a 5.1 track needs no caller-side
permutation. HE-AAC's SBR is not reconstructed: such a stream decodes to
its AAC-LC core and reports the core rate rather than claiming the
extension's.

Encoder is a full two-loop search: 2048-point FFT masking with spectral
flatness for tonality, bark-ish spreading, a relative hearing-threshold
floor, transient-driven window switching, per-band mid/side, exact
Huffman bit counts for codebook choice, and a bit reservoir against a CBR
target. Both ADTS and bare raw_data_block output.

The normative tables were derived rather than transcribed: access units
with a chosen spectral payload were decoded by a reference decoder and
read back through the inverse MDCT, which enumerates each codebook by a
binary tree walk. Every one came out with a Kraft sum of exactly 1 and
the entry count the standard prescribes.

forbid(unsafe_code) in both crates.