forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on 698943dd9fbe0bcf4721a76ce288f7b4a7ea162e

2026-08-23

feat(opus-sb/r1): port libopus dynalloc_analysis; decoder diag exposes allocationAhmet Kaan Gümüş · 698943d
feat(opus-sb/r1): port libopus dynalloc_analysis; decoder diag exposes allocation

The old second-difference spike heuristic boosted the top coded band
(14.4-18.7 kHz) by ~220-260 1/8-bit per frame on reelm/hein@64k where
libopus gives 3, and starved 240-3000 Hz on short-block frames. The port
(follower/median masking over long-window energies, stereo cross-talk,
width-scaled boost units, CVBR halving, 2/3 cap) brings the per-band boost
table to within a few 1/8-bit of libopus.

Gate (reelm,hein,her,reell): reelm@64 gap +.0046 -> +.0037, hein@64 +.0031 ->
+.0022, no row loses more than .0003 corr, drops 0, rate within 5%.

CeltDecDiag gains alloc_trim/pulses/fine_quant/intensity/dual_stereo/
coded_bands/balance/offsets; new ignored test short_block_bits_vs_libopus
prints the per-band allocation ours vs libopus (lanes/opus-sb-r1.bits.txt).
feat(opus-64/r5): ship transient_analysis port; reject tf_estimate consumers by measurementAhmet Kaan Gümüş · aa1dd3a
feat(opus-64/r5): ship transient_analysis port; reject tf_estimate consumers by measurement

libopus VBR boost and trim terms from tf_estimate both regress reelm/hein@64
(dropouts, rate -1.8%); transient counts now match libopus within 1.5%, so the
remaining 64k residue is short-block coding, not detection. Spectral test gains
SWEEP_KBPS, her/reelm/hein sources and a decoder-seen transient count.
feat(opus-64/r4): paste tf_analysis port, gate OFFAhmet Kaan Gümüş · c1fe246
feat(opus-64/r4): paste tf_analysis port, gate OFF

Port the libopus tf_analysis Viterbi search and float-mode
transient_analysis from lanes/opus-64-r3.handoff.md (edits 1-6).
tf_analysis is gated behind const TF_ANALYSIS: bool = false: the
2-row gate (reelm/hein @64k) showed both corr gaps grow and minsec
drop vs the no-analysis baseline, so the search stays disabled.
tf_res falls back to the no-analysis default.

transient_analysis is replaced unconditionally (Edit 3); the new
float-mode detector is the source of the baseline divergence
(ON ~= OFF on the gate rows).

cargo check clean; cargo test -p ec-opus --release 34+27 green;
gate RATE+DROPOUT passed (ON and OFF). See lanes/opus-64-r4.report.md.
test(opus): parametrise the startup hop-energy and band-window diagnosticsAhmet Kaan Gümüş · 488aada
test(opus): parametrise the startup hop-energy and band-window diagnostics

HOP_SRC/HOP_MS recentre reell_startup_hop_energies on any source and instant;
WIN_CENTRE recentres spectral_divergence_vs_libopus's per-band window dump;
'her' joins its source list. Used to name the her@96 residue: a missed
right-channel HF transient at 88.29 s coded as a long block.
wip(opus-64): r3 handoff — tf_analysis port, code ready to pasteAhmet Kaan Gümüş · 74c150a
wip(opus-64): r3 handoff — tf_analysis port, code ready to paste

Third round to hit the tool cap before the first edit; the handoff carries
the verified port with line numbers and borrow plan.
fix(opus): code tf_res=is_transient so transient frames keep short blocksAhmet Kaan Gümüş · 5b61429
fix(opus): code tf_res=is_transient so transient frames keep short blocks

Raw tf_res=0 with tf_select=0 on a transient frame maps through TF_SELECT to
+LM, merging the short blocks back into one long block and smearing the attack
across the whole frame. The reference's no-analysis default codes
tf_res[i]=isTransient (no change). reell err_ratio 21x -> 1.6x at 64 k and
24x -> 3.3x at 96 k; 14-row library gate green, no corr regression.

Decoder diag gains tf_res/spread/anti_collapse; repro tests
celt_silence_then_attack_decodes_bounded, reell_startup_hop_energies and
celt_click_peak_offset; hybrid layer tolerance 2->3 and SILK-vs-CELT margin
.005 re-sized against the sharper transient reconstruction.
vorbis rate: ≥100 kbps target scale 1.0→0.98, sweep 14/14Ahmet Kaan Gümüş · 583d94d
vorbis rate: ≥100 kbps target scale 1.0→0.98, sweep 14/14

dl8a@128 +3.50%→+1.41% (was the only FAIL). New RATE_TARGET_SCALE_HI
= 0.98 for the ≥100 kbps branch of update_rate; <100 kbps keeps 0.97.
No row's gap worse than baseline by >.001 (max +.0003). Suite green.
vorbis: clamp reservoir debt, split rate scale and HF co-mask cap at 100 kbpsAhmet Kaan Gümüş · 14e8a86
vorbis: clamp reservoir debt, split rate scale and HF co-mask cap at 100 kbps

Per-second dropouts at 96 kbps were reservoir windup: debt reached
831 k bits with repayment bounded to 25% of a block, so headroom stayed
suppressed for ~90 s after each transient run. Clamp the debt to 8x the
block budget. Short blocks get a 31 dB headroom floor with a ramp. The
0.97 target scale applies only below 100 kbps and the bark>19 co-mask
cap (-30 dB) likewise, since both cost high-rate rows.

Equal-size sweep vs libvorbis on the library: 13/14 PASS, max corr gap
+.0027, 0 dropout seconds; dl8a@128 rate +3.5% remains.
opus: VBR target shaping with activity cut and credit banking (celt)Ahmet Kaan Gümüş · b6d1cd3
opus: VBR target shaping with activity cut and credit banking (celt)

The reelm@64k dropout second was reservoir arithmetic: quiet frames
spent the flat rate at reservoir 0, the following transient run went
into debt, and the two loudest frames starved at 135 B vs libopus 252 B.
Port libopus compute_vbr shaping: activity cut below .4 (peak band
level proxy, no tonality analysis), tot_boost and tf terms, floor-depth
and 2x caps; release reservoir debt at most 8 B/frame and floor the
reservoir at -8x rate so quiet runs bank credit for attacks.

14-row library gate: 0 dropout rows, rate -1.1%..0%, 12/14 corr >= ref,
worst change her@64 -0.0002.
opus: validate opus_compare_err against the C opus_compare (byte-exact)Ahmet Kaan Gümüş · 87603a5
opus: validate opus_compare_err against the C opus_compare (byte-exact)

Six real pairs (source vs libopus, source vs ec-opus on reelm/dl8a/reell)
agree with the C tool to 1e-6 in err. Negative Q and wide err ratios are
the tool's designed behaviour on source-vs-lossy input, not a scale bug.
Adds opus_compare_err_pinned_against_c (synthetic signal, C-pinned err)
as a regression guard, plus two ignored harness entry points.
opus: encoder library gate vs libopus (equal-size sweep, dropout assert)Ahmet Kaan Gümüş · a3a2974
opus: encoder library gate vs libopus (equal-size sweep, dropout assert)

Adds encoder_library_gate_vs_libopus (#[ignore]) to the conformance
binary: 7 real sources x {64,96} kbps, libopus reference via ffmpeg,
ours at the reference's measured kbps, both decoded by ec-opus.
Asserts rate within 5% and no ours-only dropout seconds (corr<0.9);
reports corr gap and a spectral err ratio (report-only, unvalidated).

r1 result: rate worst -0.5%; dropout fires on reelm@64k.
vorbis: report r3 — headroom tilt, 14-row sweep 11/14 at equal sizeAhmet Kaan Gümüş · fbafcda
vorbis: report r3 — headroom tilt, 14-row sweep 11/14 at equal size

Full equal-size sweep on the winner: mean corr gap .0153 -> .0031,
11/14 rows pass (baseline 2/14). reelm@96/128 and hein@96 remain
(rate overshoot at 79 kbps reference, HF droop files).
test(vorbis): per-second dropout gate in the library sweepAhmet Kaan Gümüş · 4174c4b
test(vorbis): per-second dropout gate in the library sweep

A post-transient silence is invisible in whole-file corr and bimodal per second,
so the sweep now traces corr per second and fails any row with a second under
0.9 where libvorbis is not. Proven both ways on reelm.wav: main 0 dropout
seconds (min-second .911/.934 vs ref .927/.950); reservoir disabled 357/295
seconds, min-second .117.
docs(vorbis): floor geometry refuted as the equal-size lever (lane-vorbis-floor r1)Ahmet Kaan Gümüş · 6937294
docs(vorbis): floor geometry refuted as the equal-size lever (lane-vorbis-floor r1)

Mean gap on 8 rows: 12 posts .01525, 16 .01786, 24 .02171, 32 .02594, Bark@12 .02163.
Bits per non-zero and non-zero count do not move with the post grid; the step is set
by the peak-hold floor, not the grid. Baseline band/bit tables kept for the next round.
Merge branch 'lane-vorbis-psy': band-error and bit-split oracles locate the libvorbis gapAhmet Kaan Gümüş · f21c50b
Merge branch 'lane-vorbis-psy': band-error and bit-split oracles locate the libvorbis gap

Instruments only; encoder output byte-identical to 4b007cd (reelm 120 s 128k, cmp).
Per-Bark-band NSR vs libvorbis at equal size on 7 library sources x {96,128}k:
the gap sits at 300-1080 Hz (dNSR +9..+15 dB) where we code 45-57% as many
non-zero residues at 1.5-2.1x the bits each; HF droop (15.5-24 kHz, -5..-19 dB)
on nik/reelm/hein is a second, source-dependent contributor. Package-merge
Huffman (01cfce6) changes main's book lengths and is not carried.
ec-vorbis: band-error + bit-split oracle vs libvorbis, 7 sources x {96,128}kAhmet Kaan Gümüş · 2f04c6e
ec-vorbis: band-error + bit-split oracle vs libvorbis, 7 sources x {96,128}k

Instrument test (ignored) folding the bit-split oracle into one pass:
band NSR/E vs source through our decoder, ours vs ffmpeg libvorbis at
matched rate. All 14 rows: bits/nonzero 1.48-2.12x ref on ~half the
nonzeros, dNSR concentrated 300-1080 Hz (+9..+15 dB), HF droop on
nik/reelm/hein only. Lanes files + report + round-3 handoff.

2026-08-22

Revert "perf(vorbis): length-limited Huffman via package-merge (cherry-pick 01cfce6)"Ahmet Kaan Gümüş · 427c236
Revert "perf(vorbis): length-limited Huffman via package-merge (cherry-pick 01cfce6)"

This reverts commit 8cdffcd2326bb25f2f830a3cbb1a484845341e07.
perf(vorbis): length-limited Huffman via package-merge (cherry-pick 01cfce6)Ahmet Kaan Gümüş · c52d51c
perf(vorbis): length-limited Huffman via package-merge (cherry-pick 01cfce6)

Base byte-identical to main's codebook.rs, applies trivially. Package-merge is
optimal under the 24-bit cap and Kraft-complete; identical bit counts claimed.
Byte-identity proof in this lane confirms encoder output unchanged.
test(vorbis): bit split oracle — floor vs residue bits per coded value (cherry-pick 107b096)Ahmet Kaan Gümüş · a4a1e96
test(vorbis): bit split oracle — floor vs residue bits per coded value (cherry-pick 107b096)

Decoder captures (floor bits, residue bits, packet bits) per block; histogram
report prints residue bits per non-zero for ours vs ref. Output stays
lanes/vorbis-psy-r1.histogram.txt.
test(vorbis): histogram shape metrics + -vn audio-only ref encode (cherry-pick 4db6f24)Ahmet Kaan Gümüş · 647bc2d
test(vorbis): histogram shape metrics + -vn audio-only ref encode (cherry-pick 4db6f24)

Rename output paths to lanes/vorbis-psy-r1.{histogram,sweep}.txt.
test(vorbis): decoder-side residue reference — valid histogram oracle (cherry-pick 5ede0ed)Ahmet Kaan Gümüş · 454cb75
test(vorbis): decoder-side residue reference — valid histogram oracle (cherry-pick 5ede0ed)

Resolve add/add conflicts in oracle.rs: keep both residue_histogram_vs_reference
(theirs) and real_library_sweep_vs_reference (ours); git auto-merged identical
ffmpeg_decode_limited/shellexpand bodies. Adapt capture hook to main's BlockConfig
(main has no residue_end field — codes full half*channels region, so coded=half).
fix(vorbis): bit reservoir stops the rate loop winding up on short-block runsAhmet Kaan Gümüş · fc5a0f8
fix(vorbis): bit reservoir stops the rate loop winding up on short-block runs

Blocks next to a short window are quantised with a forced minimum
precision the loop cannot lower, yet their overspend stepped the headroom
-2 dB each; a 16-32 block run drove it to the -24 dB floor, the floor sat
above the signal, and ~10 silent long blocks followed every transient:
200 ms dropouts at -20 dBFS on reelm.wav, per-second corr 0.27-0.70 where
libvorbis holds 0.99. Forced blocks now bank their excess as reservoir
debt that steady blocks repay at <=25% of a block's share, so the rate
still lands on target over about a second. reelm 128k: all 30 seconds
>= 0.9935; quiet_content_reaches_the_target_or_is_transparent, failing
since 5314f5a for the same reason, passes.

The library sweep joins the oracle binary (ignored, SWEEP_ONLY=name,...).
ffmpeg's libvorbis under -b:a is unmanaged VBR and lands 10-30% under
nominal on real music, so ours is encoded at the size libvorbis produced
and compared there (rate within 3%, correlation gap <= .005):

source  kbps  ours   ref    rate%  corr_ours corr_ref gap
nik     96    84.0   84.5   -0.61  0.9690    0.9903   0.0213
nik     128   115.5  115.8  -0.24  0.9838    0.9951   0.0113
reelo    96    81.5   81.8   -0.30  0.9739    0.9922   0.0183
reelo    128   109.1  108.6  +0.45  0.9868    0.9955   0.0087
her     96    89.9   89.9   +0.04  0.9668    0.9867   0.0199
her     128   123.5  124.9  -1.13  0.9810    0.9927   0.0117
reell     96    85.4   85.5   -0.12  0.9792    0.9923   0.0131
reell     128   121.3  120.9  +0.39  0.9914    0.9968   0.0054
reelm   96    80.5   79.3   +1.52  0.9796    0.9865   0.0069
reelm   128   93.5   91.0   +2.70  0.9890    0.9906   0.0017  PASS
dl8a    96    86.9   86.9   -0.01  0.9655    0.9916   0.0261
dl8a    128   118.7  117.8  +0.80  0.9826    0.9957   0.0132
hein    96    80.3   79.1   +1.53  0.9789    0.9869   0.0080
hein    128   92.8   90.7   +2.31  0.9883    0.9906   0.0023  PASS

Rate tracks on every row; the remaining gap is the psychoacoustic model,
not dropouts.