Commits
Commits on
5c8eff8ca5a0d547bfb22a690b3f7afb373da607Filtered to crates/ec-opus/src/celt.rsClear filter2026-08-23
feat(opus-sp/r1): port libopus spreading_decision (tonal/hf averages, tapset, spread_weight)Ahmet Kaan Gümüş · 7a1f515
feat(opus-sp/r1): port libopus spreading_decision (tonal/hf averages, tapset, spread_weight) Decoder-seen spread histogram on long frames, ours vs libopus: reelm [0,12,3442,739] vs [0,0,3303,910]; hein [1,20,3800,151] vs [0,0,3809,138] (was a constant SPREAD_NORMAL). Gate reelm,hein,her,reell: corr within .0001 of lane-opus-sb, reelm@64 err_ratio .69 -> .65.
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).
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.
2026-08-21
2026-08-14
feat(opus): CELT encoder — mono/stereo/multistream, all rates, CBR+CVBRAhmet Kaan Gümüş · 52ead44
feat(opus): CELT encoder — mono/stereo/multistream, all rates, CBR+CVBR
Throughput-first CELT-only Opus encoder (RFC 6716 Section 5, coding path
mirrored symbol-for-symbol from the normative Appendix A; analysis replaced
by fast deterministic heuristics: no pitch prefilter, tf_res fixed, spread
fixed NORMAL, single-pass coarse energy):
- range.rs: full RFC 5.1 range encoder (fixed-size frames, shrink, raw-bit
tail), tell()/tell_frac()/range-state exact against the decoder per symbol
- celt_enc.rs: forward MDCT as the exact adjoint of the decoder's inverse,
transient/trim/dynalloc/stereo analyses, encode-side allocation, PVQ
search (wide f32x8 lanes) + V(N,K) enumeration, Laplace coarse energy
- encoder.rs: TOC framing (configs 28..31), CBR and constrained-VBR, plain
and self-delimited (App B) packets
- multistream_enc.rs: RFC 7845 family-1 surround (5.1 helper), per-stream
self-delimited framing, coupled streams weighed 2:1 in the rate split
- shims/opus-rs: the opus-rs 0.1.26 surface edith consumes, mono fixed and
no rate ceiling; root-cause doc for the incumbent's ~165 kbps cliff in
lib.rs
Proof in tests/conformance.rs (same binary): per-packet range-state parity
encoder vs vector-verified decoder at 32..510 kbps x {mono,stereo} x all
frame sizes x CVBR; libopus (ffmpeg) decodes the whole rate table at worst
corr 0.9565 (32k stereo) to 1.0000; 5.1 order-preserved >=0.9978; reference
opus_demo 0.9995 at 256k stereo; Ogg-Opus duration exact; zero-alloc steady
state; speed floors (measured ~150-580x realtime per config).feat(opus): multistream decoding, 5.1 and 7.1Ahmet Kaan Gümüş · 8bd3b2b
feat(opus): multistream decoding, 5.1 and 7.1 MultistreamDecoder splits a packet into its elementary streams by the self-delimiting framing of Appendix B and routes each stream's channels through the mapping table, silent channels included. Constructor takes the layout the container header carries (rate, streams, coupled, mapping), which is the shape the product already calls. The CELT N/4 FFT's 15-point stage is now radix-3 then radix-5 rather than a direct 15x15 evaluation, which is where a third of multichannel decode time was going: a real 7.1 film track went from 102x to 124x realtime. Checks (all in tests/conformance.rs): the mono, stereo and 5.1 Ogg-Opus fixtures decode to correlation 1.00000 per channel against libopus through ffmpeg; the 5.1 fixture's per-channel tones land in the RFC 7845 family 1 (Vorbis) order the reference produces, each channel carrying its own tone; decode speed is 430x realtime stereo (fixture and testvector01 music alike) and 236x realtime 5.1, against floors of 135x and 104x. The twelve RFC vectors are unchanged. An env-driven sweep (EC_OPUS_FILES, #[ignore]) runs the same comparison over real files.
feat(opus): SILK layer, hybrid frames and packet redundancyAhmet Kaan Gümüş · ece2a35
feat(opus): SILK layer, hybrid frames and packet redundancy Full RFC 6716 Section 4.2 decode in exact integer arithmetic: header and LBRR flags, gains, NLSF stage-1/stage-2 dequantisation with Laroia weighting, stabilisation and interpolation, LSF-to-LPC conversion with prediction-gain limiting, pitch lags and LTP filters, shell-coded excitation with LSBs and signs, LTP and LPC synthesis, stereo unmixing, and the output resampler for 8/12/16 kHz internal rates. The Opus layer now joins the two layers: SILK-only, hybrid (SILK below 8 kHz plus CELT above), and the redundancy frames that carry a mode switch across a packet boundary. Check: all twelve RFC 6716 vectors, decoded at 48 kHz stereo, match the reference range coder state on every one of 18075 packets, and score 96.96 to 100.00 % on the opus_compare metric (0 is the passing threshold). The three SILK-only vectors are sample-for-sample identical to the reference output. Unit checks cover the fixed-point helpers, gain dequantisation monotonicity and LSF stabilisation.
feat(opus): CELT layer decoder and the single-stream decoderAhmet Kaan Gümüş · a882b8b
feat(opus): CELT layer decoder and the single-stream decoder Full RFC 6716 Section 4.3 decode: coarse/fine/final energy with the Laplace model, the implicit bit allocation (caps, dynalloc boosts, trim, interpolation, skip), PVQ shapes with spreading, folding and splits, time-frequency changes, anti-collapse, denormalisation, inverse MDCT with overlap-add, post-filter and de-emphasis. All frame sizes 2.5-20 ms, all bandwidths NB..FB, mono and stereo. The MDCT sizes are 15*2^k, so the N/4 FFT runs a 15-point stage over ec-dsp's power-of-two transform rather than anything O(N^2). Checks (tests/conformance.rs, one binary for the whole suite): the three CELT-only RFC 6716 vectors decode with the reference range-coder state on every packet -- 2147/2147, 4186/4186, 553/553 -- and score 99.8/99.6/99.7 % on the opus_compare metric, reimplemented in Rust from the criterion in Section 6 and cross-checked against the C tool (99.871 vs its 99.9 %, same internal error 0.000315). Unit checks cover the IMDCT (overlap-add reconstruction at every size), the 15*2^k FFT against a direct transform, and the PVQ combinatorics.