forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on 30d372e461d4e2e07cec9b2bc0acd2dbf213b646Filtered to crates/ec-opus/src/lib.rsClear filter

2026-08-14

test(opus): fuzz every mode with garbage payloads; document the PLC gapAhmet Kaan Gümüş · acb0d04
test(opus): fuzz every mode with garbage payloads; document the PLC gap

Every TOC configuration is fed random payloads and every prefix of real packets
is fed to the decoder: a malformed stream must return an error, never panic,
and the debug build's overflow checks make that a real test of the fixed-point
paths too. The crate docs now state what is deliberately absent -- packet loss
concealment, which a container-fed decoder never needs -- and why CELT cannot
use ec-dsp's power-of-two MDCT directly.
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.
feat(opus): range decoder and packet framingAhmet Kaan Gümüş · b05a16e
feat(opus): range decoder and packet framing

RFC 6716 Section 4.1 range decoder (exact u32 arithmetic, raw bits from the
frame end, ec_tell/ec_tell_frac) and Section 3 + Appendix B framing: TOC,
codes 0-3, padding, and the self-delimiting variant multistream needs.

Checks: symbol round-trip against a test-only range encoder written from
Section 5.1, tell/tell_frac agreement, and a malformed-input sweep that must
never panic.