forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on mainFiltered to crates/ec-opus/src/multistream_enc.rsClear filter

2026-11-24

2026-11-08

Encoder fixes from round-trip sweep follow-upAhmet Kaan Gümüş · f849ee9
Encoder fixes from round-trip sweep follow-up

- ec-opus: 40/60 ms CELT/Hybrid as code-3 packets of 20 ms frames; self-delimited framing for code-3 packets (multistream 40/60 ms); multistream buffer sized for 60 ms
- ec-image GIF: pixels turning transparent re-emit the previous frame with disposal 2 over the cleared area
- ec-mp3: padding bit at 44.1/22.05/11.025 kHz
- ec-aac: refuse bitrate 0
- ec-vorbis: refuse non-finite quality
- ec-h264: refuse non-positive frame rate instead of clamping to 1
- ec-av1: with_pyramid doc matches behaviour (mini_gop > gop is clamped)

2026-09-06

feat(opus): libopus dc_reject on the API input, and lag-dependent tests read look_aheadAhmet Kaan Gümüş · 0151578
feat(opus): libopus dc_reject on the API input, and lag-dependent tests read look_ahead

The CELT input delay is back (revert of the revert): the analysis window now
sits where libopus's does.  On top of it, opus_encoder.c's dc_reject -- a 3 Hz
one-pole (coef = 6.3*cutoff/Fs, y = x - m, m = coef*x + (1-coef)*m, state per
channel across frames) -- runs once on the API input before both layers, the
way libopus filters into pcm_buf that silk_Encode and celt_encode_with_ec both
read.  libopus takes hp_cutoff instead for VOIP; not ported.

The seven tests that compared at a hardcoded 120-sample lag now read the
encoder's advertised look_ahead for the frame size they used, so they follow
the layer's real delay: delayed_corr takes it as an argument, the Ogg pre-skip
and the duration expectation come from look_ahead, and the hybrid lag window
is centred on it.  MultistreamEncoder grew look_ahead for the 5.1 file.

Sweep knobs for the re-tune on the aligned spectrum: EC_OPUS_TWO_PASS,
EC_OPUS_TRIM13 (the continuous 1.3 alloc_trim form).

2026-08-14

feat(opus): multi-rate input, application-driven bandwidth, whole shim surfaceAhmet Kaan Gümüş · 339a2ea
feat(opus): multi-rate input, application-driven bandwidth, whole shim surface

Grafts onto the merged CELT encoder, all four bitstream-neutral at 48 kHz
fullband (the four regression cells re-encode byte for byte):

- encoder: input at 8, 12, 16, 24 or 48 kHz, zero-stuffed to CELT's native
  rate with the coded bandwidth capped at the input's own Nyquist, so the
  images the stuffing puts there are never coded; look_ahead() reports the
  delay in input samples (120 at 48 kHz, scaled).
- encoder: Application reaches the encoder instead of being discarded at the
  shim boundary — it biases the coded bandwidth (Voip one step narrower),
  which is the only thing a CELT-only encoder can honestly do with it, and
  the TOC now spans configs 16..31 rather than fullband alone.
- celt_enc: `end` is a parameter, so the caller bounds the coded bands.
- ogg: the RFC 7845 header builders (opus_head, opus_tags, default_mapping)
  move into the crate, where the encoder, a muxer and the tests share one
  definition; the conformance test's hand-rolled OpusHead is now that call,
  and MultistreamEncoder::surround reads the mapping table from it.
- shims/opus-rs: the rest of the incumbent's surface — OpusDecoder,
  MultistreamEncoder::surround, the Bandwidth enum, the vbr field,
  look_ahead(), final_range() and encode_i16() — so a caller needs no
  second crate for the decode half or for surround.

Proof: the shim's own tests round-trip every input rate through the decoder
with range-state parity per packet, hold the 8 kHz..48 kHz look-ahead, force
a wideband TOC and read it back, and encode 5.1; the ec-opus suite (RFC
vectors, libopus rate table, opus_demo, Ogg duration, zero-alloc) is
unchanged and green.
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).