forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on d47ee715b8941d6417ecd3b71bdee67d3d7bb04fFiltered to Cargo.lockClear filter

2026-09-07

feat(ec-hw): AV1 encode on by default, and an ec-bench hardware rowAhmet Kaan Gümüş · 24f4e5c
feat(ec-hw): AV1 encode on by default, and an ec-bench hardware row

The opt-in existed because a 2026-08-14 submission crashed the GPU; on
mesa 26.1.8 the path encodes streams two decoders agree on, so the
refusal goes rather than outliving its evidence. ec-bench gains an
'ec-hw av1 encode' row that skips as a row when there is no VA device.
feat(ec-hw): AV1 hardware encode that two independent decoders agree onAhmet Kaan Gümüş · a518304
feat(ec-hw): AV1 hardware encode that two independent decoders agree on

The AV1 encode path submitted parameters no header described: radeonsi
parses the application's sequence and frame header OBUs and writes the
stream from them, so without those OBUs the coded buffer meant nothing.
This writes both (spec 5.5.1 / 5.9.1, the subset the driver advertises:
one tile, one reference, no CDEF, no restoration, no superres), fills
the picture parameter buffer to agree with them field for field, and
prepends the temporal delimiter the driver does not emit.

Gate: ec-av1 and ffmpeg's libdav1d decode every shown frame of a
640x384 and a 1920x1080 stream sample for sample, and the coded picture
is within 60 dB of the one submitted.

2026-08-27

feat(bench): audio encode, container demux and TrueHD rows in ec-benchAhmet Kaan Gümüş · 4ef277a
feat(bench): audio encode, container demux and TrueHD rows in ec-bench

Extends the standing perf harness with the rows the ledger owed: encode
rows for opus/vorbis/aac/mp3/flac/alac/ac3 driven off real decoded PCM
(a WAV fixture through ec-probe's own AudioDecoder path), a TrueHD
encode+own-stream-decode round trip (no fixture exists yet for the
generic decode loop to pick up), and whole-file demux throughput rows
for ec-matroska/ec-mp4 via ec-probe's Reader. Also fixes a duration
fallback bug: ffprobe's own "N/A" string was short-circuiting the
format-duration fallback via Option::or_else.
perf(h265): hoist the mode>=18 branch and idx/fact out of predict_angular's inner loopAhmet Kaan Gümüş · f9a6938
perf(h265): hoist the mode>=18 branch and idx/fact out of predict_angular's inner loop

idx and fact (8.4.4.2.6) depend only on the row/column along the
prediction direction, not on the position across it -- the old code
recomputed the along/across swap and both divisions at every one of the
n*n pixels. Splitting into a mode>=18 loop and a mode<18 loop computes
idx/fact once per row (or column) and turns the inner loop into a
contiguous scan over `reference`, which autovectorizes.

Correctness gate: cargo test -p ec-h265 --release green incl.
rdoq_cache_hash_is_pinned; intra:: unit tests (diagonal/flat/vertical-
horizontal mode assertions) individually green.

perf stat -e instructions,cycles -r 3, same 4-frame 1080p single-thread
encode_idr loop, measured clean (load average checked before/after):
  before: 114,092,102,152 ... wait, see below
  after:  114,092,102,152 instructions / 21,900,322,280 cycles
  (baseline before this change: 116,465,368,212 instructions /
   22,246,309,650 cycles -- -2.0% instructions, -1.6% cycles)
feat(bench): cover ec-image decode (all sniffed formats) and ec-inflateAhmet Kaan Gümüş · 1ee915b
feat(bench): cover ec-image decode (all sniffed formats) and ec-inflate

Extends the harness with the two remaining tractable groups: ec-image's
single decode() entry point runs over every real still and fixture, and
ec-inflate is measured on the zlib stream a real PNG's own IDAT chain
already carries.
feat(bench): standing realtime-factor harness across every codec crateAhmet Kaan Gümüş · 4d8621c
feat(bench): standing realtime-factor harness across every codec crate

One new bin (tools/ec-bench) that drives each crate's own public one-shot
API against real media (h264/h265/av1 video, aac/mp3/opus/vorbis/flac/alac
audio via ec-probe's unified reader) and prints a ranked markdown table —
the baseline every future optimization lane measures against.

2026-08-25

2026-08-24

ec-h264: probe container by bytes, accept Matroska alongside MP4Ahmet Kaan Gümüş · d5e9b8f
ec-h264: probe container by bytes, accept Matroska alongside MP4

Factor both demux call sites in tests/encode.rs onto one helper,
open_h264_source, that reads 12 bytes from the file head and dispatches
to ec_mp4::Mp4Demuxer (ftyp at offset 4) or ec_matroska::MatroskaDemuxer
(EBML magic 1A 45 DF A3) — never by extension. A non-H.264 video track
(AV1, HEVC) is refused with a message naming the codec, not a demuxer
panic. Add ec-matroska as a dev-dependency.

BD-PSNR ours vs x264 over q22/26/30/34: -0.732 dB (FMA 01, 1280x720,
H.264-in-Matroska, 24 pictures). AV1 .mkv refusal confirmed: 'video
track is Av1, not H.264 — this gate measures H.264 only'.

2026-08-21

2026-08-20

feat(ec-probe,ec-matroska): register the TrueHD decoder in the unified readerAhmet Kaan Gümüş · 4026107
feat(ec-probe,ec-matroska): register the TrueHD decoder in the unified reader

ec-probe's AudioDecoder now carries a TrueHd arm (mirrors Ac3: send_packet/
receive_frame/flush/reset through the generic Decoder trait), so a TrueHD
track decodes through Reader/AudioDecoder like any other codec instead of
only being named in Reader::unsupported. ec-matroska's muxer writes
CodecId::TrueHd back out as A_TRUEHD (demux already read it in); the
symphonia shim needed no change since it wraps ec_probe::AudioDecoder
generically. Library test updated from "TrueHD is listed unsupported" to
"the TrueHD track in his 7.1 remux decodes, 8ch/48kHz, alongside the AC-3
track"; added a demux->mux->demux codec-id round-trip test in ec-matroska.
feat(truehd): new ec-truehd crate — access-unit framing and major syncAhmet Kaan Gümüş · f77ac31
feat(truehd): new ec-truehd crate — access-unit framing and major sync

frame_length, major sync detection (format id + sample rate) and the
per-substream directory, all calibrated bit-for-bit against a real 7.1
Blu-ray remux (AU count matches ffprobe exactly: 1,270,169). Substream
decode itself is stubbed as Unsupported, named for H2; the 4th
(object/16-ch) substream is out of scope and refused by name.
feat(alac-enc): mono/stereo ALAC encoder (cookie/escape frames + adaptive-Golomb LPC compression)Ahmet Kaan Gümüş · 98a0f6f
feat(alac-enc): mono/stereo ALAC encoder (cookie/escape frames + adaptive-Golomb LPC compression)

Mirrors decode.rs's element walk and Rice/predictor state machine exactly
(same constants, same mean/zero-run adaptation) so encode_frame's output
decodes bit-exact through the existing AlacDecoder. Per-element it picks
the smaller of raw escape vs compressed, and for stereo the smaller of
direct L/R vs a mix_bits=1/mix_res=1 mid-side transform, searching filter
orders {0,4,8,12,16,31} with an always-zero-seeded sign-adapting predictor
(no Levinson-Durbin design step needed since decode's adaptation is
itself the filter).

Corner-cuts (documented in encode.rs): bytes_shifted always 0 (no 24-bit
low-byte split — correctness unaffected, only 24-bit ratio); predictor
mode always 0 (skips the mode!=0 double-difference-pass variant).
fix(aac-sbr-ogg): flush the terminal Vorbis block through to Ogg's granule-stated endAhmet Kaan Gümüş · b966d5e
fix(aac-sbr-ogg): flush the terminal Vorbis block through to Ogg's granule-stated end

EOS was never signalled through ec-probe/the symphonia shim, so the last
Vorbis block's un-overlapped tail (and any un-overlapped audio still sitting
in the last decoded packet) never reached the caller: the reader now hands
every audio track one synthetic, empty terminal packet once the container
itself is exhausted, and AudioDecoder::flush() is what answers it.

Trimming to the container's own granule only ever trusts two points: the
very first packet's granule (a real front pre-roll, if the format has one)
and the last one, applied once at flush -- an interior page's granule marks
where the packet finishing on that page ends, not a ceiling every later
page's cumulative output must stay under, so it is never used as one.
Vorbis's last decoded packet is held back one call rather than handed out
immediately, so that final trim can still reach into it.
diag(mkv-audio): A/B ec-matroska's AAC and AC-3/E-AC-3 delivery against mp4/ffmpeg -- refuted, not fixedAhmet Kaan Gümüş · d6466ca
diag(mkv-audio): A/B ec-matroska's AAC and AC-3/E-AC-3 delivery against mp4/ffmpeg -- refuted, not fixed

Two mkv-audio-timing tests exercise ec-matroska's own packet stream, decoded
through ec-aac/ec-ac3 exactly as the consumer does, against the sibling mp4
leg of the same OBS recordings and against ffmpeg:

- mkv_vs_mp4_aac_pipeline: 3 real OBS mkv/mp4 pairs. ASC bytes identical,
  packet counts and byte totals identical, mkv pts strictly monotonic with no
  duplicates. Decoded PCM (ours-vs-ours and each vs ffmpeg) correlates at
  1.0000, lag 0, for the two pairs with real signal; the third pair's near-
  silent audio (5180 bytes over 852 packets) reads 0.0 on every leg including
  mp4-vs-ffmpeg, which is a zero-variance correlation floor, not a defect.

- mkv_51_channel_order: the two real-library 5.1 mkv rows the consumer sweep
  flagged (ReelF, E-AC-3; ReelG, AC-3). Our channel 0 matches
  ffmpeg's channel 0 at lag 0, corr 0.9999 and 0.9955 -- no channel-order
  mismatch.

Root cause: neither of the charter's two ec-matroska-side hypotheses (lace/
pts damage to AAC packet delivery, 5.1 channel order) holds against real
files -- this crate's demux and the shared ec-aac/ec-ac3 decode of it are
byte- and sample-correct here. No code fix lands in ec-matroska because there
is nothing wrong to fix in it for these files. The 0.06-0.34 mkv-leg
correlation the consumer sweep saw, if still real, has to come from
edith_replica's own consumption of these same packets (SymTrack's pts ->
samples_at conversion, priming, or channel folding in
crates/engine/src/audio.rs) rather than from container demux or codec decode
-- reported, not fixed, since that file is out of this repo.

2026-08-19

fix(aac-sbr): apply the envelope gain before noise injection, not afterAhmet Kaan Gümüş · 90930dd
fix(aac-sbr): apply the envelope gain before noise injection, not after

sbr_env::adjust injected the transmitted noise floor into the HF QMF
signal before measuring the (envelope, band) cell's current energy and
computing the gain toward the transmitted target -- so gain was
computed from signal+noise together and then rescaled both, distorting
the noise/signal split by however much noise dominates a given cell.
Move noise injection after the gain loop (signal only informs gain,
noise is added at its own transmitted amplitude afterward), matching
the spec order. Real-file sweep correlation barely moved from this
alone (0.019/0.834 and 0.005/0.0001 before and after), so it is a
real but non-dominant contributor to the residual failure; see the
localization note left for the next pass.

Also added an EC_AAC_SBR_ENV_DEBUG-gated dump in decode_envelope that
pinpointed the dominant remaining defect: multi-envelope real-file
frames occasionally carry a raw (non-delta) envelope whose absolute
value is inconsistent with every neighbouring envelope's magnitude in
the same frame (observed: FMJ ch0 frame 24's envelope 3 reads raw=43
right after envelopes 0-2 all sit at 8-10, and the frame's own core
PCM never exceeds ~9600 in this domain, so a target energy of 2^43 is
unreachable by any correctly functioning HF patch of that content).
That corrupted value then persists and grows across frames via the
cross-frame DT envelope prediction (self.state[ch].last_env), which
does no plausibility check on what it carries forward. Root bit-level
cause not yet found: env0-2 in the same frame decode plausibly, ruling
out a bit-count bug in bs_data_extra/bs_coupling/sbr_grid/sbr_dtdf/
sbr_invf that would already have desynced env0. Next step: instrument
whether this specific raw envelope's df_env bit is being read at the
position the FIXVAR/VARFIX/VARVAR grid class actually places it, since
these real files exercise those unverified border-value grid classes
(sbr_payload.rs's honest gap) far more than the byte-exact FIXFIX
fixtures.

2026-08-14

shim(ruopus): the Opus decoder seat edith consumes, over ec-opusAhmet Kaan Gümüş · 88cf2a7
shim(ruopus): the Opus decoder seat edith consumes, over ec-opus

The last audio shim the replica's [patch.crates-io] table was missing. It
is one re-export -- `MultistreamDecoder` -- because `ec-opus`'s already
has the incumbent's signature and, more to the point, its semantics:
`with_rate(rate, streams, coupled, &mapping)` with the same layout rules
and the same panic on one the RFC forbids, and output in the *mapping's*
channel order rather than the product's.

That last one is the only decision here. Both decoders emit Vorbis order
for RFC 7845 family 1 (FL, FC, FR, BL, BR, LFE), and edith permutes it
into film order at the call site (`audio.rs:vorbis_to_film_order`), so
the shim permutes nothing: putting it here would fold every surround
track twice. The doc comment says so, since a future reader's first
instinct will be to move it.

The incumbent's feature names are declared and empty. `spectrograms` was
its FFT backend, default-on because CELT synthesis is an N/4 complex FFT
per block and the fallback decoded a 5.1 film at 0.95x realtime; the
transform behind this crate is not behind a feature at all. They are
declared regardless because a [patch.crates-io] consumer that names a
feature the patch lacks fails to *resolve*.
feat(hw): the VA-API parameter buffers, surface pool and frame readbackAhmet Kaan Gümüş · 89d28a7
feat(hw): the VA-API parameter buffers, surface pool and frame readback

The foundation of the hardware crate: every codec parameter struct
libva defines for the paths this family uses, transcribed by hand from
the system headers and checked field for field by a `const` assertion
against `crates/ec-hw/abi-probe.c`. A transcription slip is a compile
error rather than a driver reading garbage.

Around them:

- `SurfacePool`, which allocates once and recycles: a surface returns to
  the free list when the reference buffer and the caller are both done
  with it, so nothing leaks and nothing is reallocated per frame.
- `Frame`, with the two ways to reach the pixels — DRM PRIME export for
  the zero-copy path, and `vaGetImage` readback into I420 (8 or 10 bit)
  for callers that want the samples. The readback image is created once
  per stream: one `vaCreateImage`/`vaDestroyImage` pair per frame costs
  ~20 ms at 1080p on this driver, more than the decode itself.
- A typed error for every failure. Nothing here panics: edith loads this
  path as a dlopen'd plugin whose fall back to software is only as good
  as that promise.
feat(shims): rusty_h264 0.9.1 surface over ec-h264Ahmet Kaan Gümüş · f26a1d2
feat(shims): rusty_h264 0.9.1 surface over ec-h264

Decoder::decode over whole access units and the EncoderConfig/Encoder/
YuvFrame/Preset surface edith's export path calls, without the incumbent's
process-wide allocator and without its lookahead buffering: try_encode
returns the access unit of the picture it was handed, every time.
chore: relock the workspaceAhmet Kaan Gümüş · 22fb460
chore: relock the workspace

The committed lock predates several workspace members, so every cargo
invocation rewrote it; this is that rewrite, with no dependency added by
hand and none removed.
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(h264): CAVLC intra decoder, bit-exact on 18 JVT streamsAhmet Kaan Gümüş · f985e44
feat(h264): CAVLC intra decoder, bit-exact on 18 JVT streams

I-slice scope: I_4x4 / I_16x16 / I_PCM, full CAVLC residual decode,
all intra prediction modes, 4x4 inverse transform + DC Hadamard,
dequant with scaling-list support, and the complete in-loop deblocking
filter. Everything outside scope (CABAC, FMO, interlace, non-I slices,
8x8 transform, 4:2:2/4:4:4, >8-bit) refuses with a named Unsupported
error backed by tests on real conformance streams - never wrong pixels.

Perf-first layout: padded planes sized for future inter overreach;
per-MB state in flat struct-of-arrays (nz counts, intra modes, QP,
slice ids) with no per-MB heap objects; a register-cached BitCursor for
slice data; residual parse fused with reconstruction so empty blocks
cost one coeff_token read; wide i16x16 SIMD for horizontal deblock
edges (a gather/scatter vertical variant measured slower and stayed
scalar). Steady-state decode loop is zero-alloc, proven by a counting
allocator in the conformance harness.

Conformance: first IDR bit-exact vs the JVT reference YUV and ffmpeg on
18 CAVLC streams incl. multi-slice and I_PCM; 6 CABAC/FMO/interlaced
streams verified to refuse by name; deterministic corrupt-input sweep
(truncations + 2000 single-byte mutations) never panics.

Measured on this machine, single thread, deblock included: 1324 ns/MB
(193 Mpx/s) on BA1_Sony_D at idle; 1007 ns/MB (254 Mpx/s) on the
no-deblock NL1_Sony_D even under background load.
feat(riff): WAV reader/writer and the hound shim over itAhmet Kaan Gümüş · 5dd56cf
feat(riff): WAV reader/writer and the hound shim over it

ec-riff writes and reads RIFF/WAVE: 8/16/24/32-bit integer PCM and 32-bit
float, mono through 7.1, any sample rate. The writer streams and patches the
RIFF, data and fact sizes in finalize (best-effort on drop), and emits
WAVE_FORMAT_EXTENSIBLE with a channel mask whenever a file has more than two
channels or more than 16 bits. The reader walks the chunk list rather than
assuming fmt-then-data, so LIST/INFO, fact and odd-sized chunks with their pad
byte are skipped, and a truncated or unpatched data size yields what is
actually there. RF64, ADPCM and 64-bit float are refused by name.

shims/hound carries package name hound 3.5.1 over ec-riff, covering exactly
what edith consumes: WavWriter::create/write_sample/finalize, WavSpec,
SampleFormat and an Error with the incumbent's variants.

Checks: cargo test -p ec-riff -p hound (10 tests), and the emitted oracle
artifacts compared against ffmpeg's own decode - 5 written formats and the 6
wav fixtures all PASS at corr 1.000000, RMS delta 0.
feat(dsp): FFT/DCT/MDCT/window primitivesAhmet Kaan Gümüş · 09790f6
feat(dsp): FFT/DCT/MDCT/window primitives

Radix-4/radix-2 Stockham FFT (power-of-two, 1..65536, f32 and f64),
real-input wrapper on the N/2 complex trick, DCT-II/III via Makhoul and
DCT-IV via an N/2 FFT, MDCT/IMDCT folded onto DCT-IV (AAC 2048/256 and
Vorbis/CELT sizes go through an N/4-point FFT), and sine/KBD/Vorbis
windows with fused application.

No feature gates: the fast transform is the only transform, and the only
O(n^2) code in the crate is the reference DFT/DCT/MDCT behind cfg(test).
Hot loops vectorise through wide on chunks_exact, so the bounds checks
fold; the scalar remainder is the same expression.

Accuracy vs the f64 reference, sizes 8..8192: 3.1e-15 f64, 1.3e-7 f32;
f32 forward+inverse round trip 1.6e-7 to n=32768; MDCT TDAC 2.2e-15 f64
/ 4.8e-7 f32 with every window shipped.
feat(oracle): fixture scripts + comparison harnessAhmet Kaan Gümüş · d207f1d
feat(oracle): fixture scripts + comparison harness

gen-fixtures.sh: 87 deterministic ffmpeg fixtures (10 audio codecs x mono/stereo/5.1 x 44.1/48k, 4 video codecs x mp4/mkv x 23.976/60 x 8/10-bit, 4K sample per codec).
fetch-vectors.sh: JVT H.264, JCT-VC HEVC, RFC6716 Opus, cellar FLAC, Xiph Vorbis; checksum-pinned in scripts/vectors.sha256, resumable, per-set graceful failure.
scan-real-library.sh: read-only ffprobe sweep of the local media dirs into fixtures/real-library-manifest.tsv (T3 gate input).
tools/oracle: std-only bin driving ffmpeg/ffprobe through process pipes (bit-exact, audio-compare, video-compare); ffmpeg stays test tooling, never a crate dep.
feat(core): workspace + ec-core IR foundationAhmet Kaan Gümüş · a3c0049
feat(core): workspace + ec-core IR foundation

Cargo workspace (crates/*, shims/*, tools/*) and ec-core, the IR every
crate in the family builds on:

- timebase: reduced rational TimeBase + Timestamp, all i128-exact integer
  math, four rounding modes. 24000/1001 is representable and stays exact;
  cross-base ordering compares instants without rounding first.
- packet: Buf (refcounted byte range, cheap clone and slice) + Packet with
  optional pts/dts/duration, flags and side data.
- frame: VideoFrame over validated planes (I420/I422/I444, 10-bit I010/
  I210/I410, NV12/NV21, P010/P016, gray, packed RGB/BGRA) with CICP colour
  code points, AudioFrame with named channel positions (5.1 = FL FR FC LFE
  BL BR) interleaved or planar.
- bitio: MSB and LSB bit readers/writers, exp-Golomb ue/se both ways,
  truncation reported as NeedMore instead of panicking, exp-Golomb prefix
  bounded so a fuzzer cannot spin.
- error: NeedMore/Eof/Unsupported{what,why}/Corrupt{context}/Io; a refusal
  always names what was refused and why.
- registry: CodecId for every codec edith touches (video, audio, subtitle),
  CodecParameters/StreamInfo, and the Demuxer/Muxer/Decoder/Encoder
  contracts. Codecs are push/pull (send_packet/receive_frame) because
  packets and frames do not correspond one to one and end of stream has to
  be drainable.

forbid(unsafe_code), warn(missing_docs), no dependencies, no async.