Commits
Commits on
86fb0f3d0c47e6aff7ce60ab0d4653cbde35f00aFiltered to crates/ec-opus/src/lib.rsClear filter2026-11-24
ec-opus: SILK packet loss concealment (port of libopus silk/PLC.c: conceal, update, glue frames, BWE after loss, voiced->unvoiced transition); Decoder::conceal, decode_fec without LBRR and DTX frames now use it for SILK/hybrid; SilkDecoder::decode takes SilkFrameMode {Normal, Lbrr, Lost}Ahmet Kaan Gümüş · 86fb0f3Browse files
ec-opus: in-band FEC (SILK LBRR): Encoder::set_inband_fec/set_packet_loss_perc (libopus decide_fec, loss-aware equiv rate, FEC forces SILK/hybrid; mono SILK/hybrid 10/20 ms), Decoder::decode_fec (LBRR decode, hybrid CELT band concealment, PLC fallback); interop with libopus 1.6 both ways; FEC-off output unchangedAhmet Kaan Gümüş · 90e21f2Browse files
2026-11-23
2026-10-23
Restore edith_codecs after local data loss (2026-10-23)Ahmet Kaan Gümüş · b7434a2
Restore edith_codecs after local data loss (2026-10-23) On 2026-10-23 an automated agent ran `rm -rf $HOME` and deleted the local repository with all of its history. This commit restores the working tree from the newest surviving copy, the host-c server lane mirror. That mirror matches local main as of the testcut Phase 2 reports, including the tool cache, the nextest fast profile and changed-crates.sh. The history before this commit was not recovered.
2026-09-30
lane-stackbox: box the by-value fields in ec-opus, ec-ac3 and ec-vp9, and gate each crate on a measured boundAhmet Kaan Gümüş · 958901b
lane-stackbox: box the by-value fields in ec-opus, ec-ac3 and ec-vp9, and gate each crate on a measured bound
Same class as ec-av1's stack sweep (d202b8b4): a large struct returned BY VALUE from a public
constructor is a stack cost the CALLER pays. The inventory from that lane named these; this lane re-measured
each one, boxed the dominant fields, proved no output changed, and added a per-crate gate.
ec-opus::Encoder 87,024 -> 4,072 (21.4x) silk_nb/mb/wb, silk_stereo_nb/mb/wb, silk_buf
ec-opus::Decoder 7,576 -> 1,280 (5.9x) silk (it was already at 92.5% of budget)
ec-ac3::Ac3Decoder 20,024 -> 3,160 (6.3x) Core::exps/bap/coeffs/delay
ec-vp9::Decoder 10,944 -> 768 (14.3x) frame_ctxs: Box<[FrameContext; 4]>, ctx: Box<FrameContext>
API COMPATIBILITY: no public field type changed in any of the three crates -- ec-opus::Encoder/Decoder
and ec-vp9::Decoder have private fields, ec-ac3::decode::Core is pub(crate) and Core itself is
crate-private, and every public method signature (Encoder::new, Decoder::new, Ac3Decoder::new,
Ac3Decoder::with_options, vp9::Decoder::new) is untouched. The only observable change is a few extra
heap allocations AT CONSTRUCTION, not on the per-frame path.
NO OUTPUT CHANGE, per crate, before vs after: ec-opus lib 36/0 -> 42/0 (the +6 are the new gates) and
conformance 28/0/16 -> 28/0/16 unchanged (its closed-loop range-state-exact gate against the
RFC-vector-verified decoder); ec-ac3 lib 36/0 -> 43/0 and both matrices 8/0 and 6/0 unchanged; ec-vp9
lib 10/0 -> 16/0 and ALL eight bit-exactness integration families unchanged (keyframe 3, inter_pixels 3,
hbd 1, subsampling 3, odd_dimensions 2, scaledref 3, intraonly 1). Main re-ran the three crates' lib
suites on the branch: 42/0, 16/0, 43/0.
DELIBERATELY LEFT INLINE: ec-opus::Encoder::analysis (2,168) + celt (1,592) -- together already under
budget, so a Box per field buys no bound and costs a per-frame indirection on a hot path. ec-vp9::Picture's
public fields are 96 B of Vec handles, not a stack cost. A measurement, not a shrug.
Gate modules: crates/{ec-opus,ec-ac3,ec-vp9}/src/stack_budget.rs, same shape as ec-av1's (inventory
printer, bound asserted by name, a real small-thread capability arm, non-vacuity control).
PRE-EXISTING REDS CARRIED, not caused here: ec-ac3
encode_matrix::real_fixtures_round_trip_through_our_decoder_and_the_oracle and ec-vp9
keyframe_exact::lossless_64_matches_ffmpeg both fail NotFound on a missing fixture (the same
fixture-root shape the fixture-library verifier complains about); and ec-vp9 generates 5 warnings
(unused read_partition, TM_PRED, partition_probs, x_mis, y_mis) which are present on main too.2026-09-06
feat(opus): port libopus's tonality analysis (MDCT features + MLP music_prob), consumers behind switchesAhmet Kaan Gümüş · 2d08e3d
feat(opus): port libopus's tonality analysis (MDCT features + MLP music_prob), consumers behind switches The analysis runs on the undelayed API frame exactly where opus_encode does; alloc_trim's tonality_slope term and compute_vbr's tonality/activity terms are wired but default off pending their gate rows. music_prob separates the gate's speech source (hein 0.161) from its music sources (reell 0.991, reelo 0.976).
2026-08-23
wip(opus-silkq/r1): SILK decoder index oracle; ours-vs-libopus per-frame table for worst secondsAhmet Kaan Gümüş · 8eefeccBrowse files
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-20
feat(opus-hybrid): mono 20 ms SWB/FB hybrid packets (SILK 16 kHz + CELT from band 17)Ahmet Kaan Gümüş · a6d0278
feat(opus-hybrid): mono 20 ms SWB/FB hybrid packets (SILK 16 kHz + CELT from band 17) CeltEncoder::encode takes a start band and mirrors the decoder's start_band paths (no silence flag mid-stream, no postfilter bit, zeroed x below start, cleared energy history outside the coded span). SilkEncoder::encode_hybrid writes the chosen frame into a shared range coder and replay() advances the mirror from the finished payload. Encoder: Voip 20-40 kbps mono 20 ms -> config 13/15, reference's SILK rate share, no-redundancy flag under the decoder's exact presence rule, SILK input delayed 70 samples so both layers land at CELT's 120 (click-measured LB +121 / HB +120). Decoder gains a doc(hidden) per-layer mute for the tests.
feat(opus-silk): SILK payload writer, mono 20 ms NB/WB, decoder-mirrored stateAhmet Kaan Gümüş · 12e4d27
feat(opus-silk): SILK payload writer, mono 20 ms NB/WB, decoder-mirrored state Writes every symbol in silk::decode()'s order (VAD/LBRR flags, frame type, gains, NLSF stage 1/2 + interp, pitch lag/contour + LTP codebook + scale, seed, rate level, shell-coded pulses with LSB escape, signs) and quantises the excitation open-loop against the decoder's own reconstruction, with the encoder replaying each packet through a SilkDecoder so its LTP history is the real one. Unit test round-trips NB/WB through the decoder including the LSB escape, range state equal.
feat(opus-silk): SILK encoder analysis front endAhmet Kaan Gümüş · 79db13a
feat(opus-silk): SILK encoder analysis front end Adds silk_enc.rs: 48k->8/12/16k FIR decimator, simplified VAD, LPC analysis with unit-circle P/Q NLSF conversion, NLSF VQ search against the decoder codebooks, pitch estimation and gain quantisation. Decoder helpers made pub(crate) for reuse; no decoder logic changes.
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).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.