forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on 7bceff22ca718dc2fd4a08953183606336c87c20

2026-08-14

feat(image): PNG decoding and the still-image APIAhmet Kaan Gümüş · 7bceff2
feat(image): PNG decoding and the still-image API

ec-image decodes stills for the engine's placed-picture path. This first
stage is the shared API — format guessing from content, a Pixels buffer in
the file's own colour form, parsed-but-unapplied metadata, and pixel limits
checked before any buffer is sized from a header — plus the PNG decoder
over ec-inflate.

Every colour type at every legal bit depth, all five filter types, Adam7
interlace, palette and colour-key transparency, gamma and sRGB exposed,
ancillary chunks skipped by length, and every chunk CRC verified: a PNG
that fails its own checksum is refused rather than decoded into a picture
nobody can tell is wrong.

scripts/gen-still-fixtures.sh generates the seeded corpus the later stages
measure against; the fixtures themselves stay out of the repository.
feat(aac): AAC-LC decoder, encoder and rusty_aac shimAhmet Kaan Gümüş · 9a848b4
feat(aac): AAC-LC decoder, encoder and rusty_aac shim

Decoder covers AAC-LC end to end: AudioSpecificConfig and ADTS framing,
all four window sequences and both window shapes, section and scalefactor
data, every spectral codebook including the escape one, pulse data, TNS,
M/S and intensity stereo, PNS, and SCE/CPE/LFE/DSE/PCE/FIL elements.
Output is film order FL, FR, FC, LFE, BL, BR (SL, SR), which is the order
the downmix in this family folds, so a 5.1 track needs no caller-side
permutation. HE-AAC's SBR is not reconstructed: such a stream decodes to
its AAC-LC core and reports the core rate rather than claiming the
extension's.

Encoder is a full two-loop search: 2048-point FFT masking with spectral
flatness for tonality, bark-ish spreading, a relative hearing-threshold
floor, transient-driven window switching, per-band mid/side, exact
Huffman bit counts for codebook choice, and a bit reservoir against a CBR
target. Both ADTS and bare raw_data_block output.

The normative tables were derived rather than transcribed: access units
with a chosen spectral payload were decoded by a reference decoder and
read back through the inverse MDCT, which enumerates each codebook by a
binary tree walk. Every one came out with a Kraft sum of exactly 1 and
the entry count the standard prescribes.

forbid(unsafe_code) in both crates.
feat(h264): inter prediction, decoded picture buffer, display-order outputAhmet Kaan Gümüş · cd996f4
feat(h264): inter prediction, decoded picture buffer, display-order output

P and B slices under both entropy coders, with the clause 8.2 decoded
picture buffer behind them.

- inter.rs: quarter-sample luma interpolation (8.4.2.2.1), eighth-sample
  chroma (8.4.2.2.2) and the weighted combination of 8.4.2.3. Plane
  borders are replicated once per picture, which turns the per-sample
  Clip3 of Equations 8-239/8-240 into a single clamp of the block origin;
  the unit test checks every fractional position, inside the picture and
  far outside it, against the spec's clipped definition written out
  separately.
- mv.rs: macroblock and sub-macroblock partitioning (Tables 7-13, 7-14,
  7-17, 7-18), neighbouring motion data (8.4.1.3.2) and motion vector
  prediction (8.4.1.3) including the directional segmentation shortcuts.
- dpb.rs: picture order count types 0, 1 and 2, sliding-window and
  adaptive (MMCO 1..6, long-term references included) marking, reference
  list initialisation and modification, frame_num gap handling per
  8.2.5.2, and the output bumping of C.4.5.3.
- decoder.rs: P/B macroblock decode, P_Skip, B_Skip and both direct modes
  (spatial and temporal), constrained intra prediction, the inter scaling
  lists, and boundary strength derivation per 8.7.2.1 so deblocking now
  varies across an edge.
- Output is display order by default; OutputOrder::Decode is the escape
  hatch for a caller that reorders itself. Timestamps travel with the
  picture, not the packet.

The tC0 table rows for bS 1 and 2 were transcribed but unexercised by an
intra-only decoder, and both were wrong: whole-row shifts. Re-derived
from Table 8-17; inter edges reach them now.

CABAC initialisation gains the cabac_init_idc columns of Tables 9-13 to
9-21 (ctxIdx 11..59 and the idc columns of 70..275, 399..401), extracted
from the spec text by column alignment.
fix(ac3): switch the spectral extension noise with the dither optionAhmet Kaan Gümüş · 6432e08
fix(ac3): switch the spectral extension noise with the dither option

§E3.6.4.2.4's noise() is a zero-mean unit-variance source the standard
leaves to the implementation, exactly like §7.3.4's dither: two conformant
decoders differ by it and by nothing else. It now follows the same option,
so a comparison against another decoder can isolate what the standard does
specify, and the default still generates both.

On the Dolby Digital Plus track that uses spectral extension this is the
whole remaining difference: 0.9988 per-channel correlation with both
decoders' noise in, 0.9994 with it out.
fix(ac3): correct the hebap-4 vector quantizer tableAhmet Kaan Gümüş · 9a40807
fix(ac3): correct the hebap-4 vector quantizer table

Table E4.4's index column is offset by one against its value rows. The
vector an encoder selects with index k is the row the document prints at
k + 1, and index 31 selects the all-zero vector, which the table never
prints. The other six VQ tables need no such correction.

Measured, not guessed: recovering each block's coefficients by running the
analysis transform over ffmpeg's PCM makes the comparison per bin rather
than per sample. Bucketed that way, only hebap-4 bins diverged -- 0.63% of
a channel's energy, and index 31 alone by ten orders of magnitude, with
fifteen independent occurrences all recovering exactly zero.

Coded bins on that stream now land within 0.01% of ffmpeg's energy.
fix(ac3): rearm the coupling run state when E-AC-3 turns coupling offAhmet Kaan Gümüş · 777214d
fix(ac3): rearm the coupling run state when E-AC-3 turns coupling off

Table E1.4's !cplinu branch resets firstcplcos[] and firstcplleak alongside
chincpl[], so a frame that switches coupling off and back on again sends
its coordinates and leak values unconditionally in the block that revives
it. Reading a presence bit there instead desynchronises the rest of the
frame: 57 of the 297782 frames of a Dolby Digital Plus track refused with
an out-of-range exponent, all of them frames that toggle coupling.

That track now decodes to EOF with zero errors.
feat(h265): wavefront-parallel intra IDR encoderAhmet Kaan Gümüş · fa29faa
feat(h265): wavefront-parallel intra IDR encoder

One encode_idr call uses every core: entropy_coding_sync (WPP) makes each
CTB row a substream, a worker starts a row once the row above is two CTBs
ahead, and the only shared mutable state is one atomic byte per boundary
sample plus a progress counter. No unsafe, no rayon, and the bitstream is
identical whatever the thread count - a test asserts that.

Deblocking and SAO are signalled off. An intra-only stream predicts from
its own reconstruction, so an in-loop filter changes what a decoder shows
without changing what either side predicts from; off, the encoder's
reconstruction is bit-identical to ffmpeg's decode, which the conformance
test checks at four picture shapes including 1916x1080.
feat(h265): intra prediction and coding-unit rate-distortion decisionsAhmet Kaan Gümüş · d43b87f
feat(h265): intra prediction and coding-unit rate-distortion decisions

All 35 modes with the spec's reference substitution, smoothing and
boundary filters, then a quadtree that minimises SSD + lambda * bits with
the bits measured rather than modelled.

Two things the trial machinery has to put back that are easy to miss: the
bytes a losing trial wrote over the winner's, and the z-scan availability
map a leaf trial marked. Either one left behind desynchronises the
decoder - a whole picture of noise, not a fraction of a dB.
feat(h265): integer transforms, quantiser and the CABAC coderAhmet Kaan Gümüş · 990d3ac
feat(h265): integer transforms, quantiser and the CABAC coder

The inverse transform and the dequantiser are the normative ones, so the
encoder's reconstruction is what a decoder produces. Only the first 16
columns of the 32x32 matrix are typed in; the rest follow from the
matrix's own symmetry, and tests check both the printed second half and
orthogonality, because a mistyped column is the classic defect here.

The CABAC coder can run in counting mode - identical context updates, no
bytes kept - which is how rate-distortion decisions are priced at the
rate they actually cost. A spec-derived decoder in the tests reads back
what the encoder writes.
feat(h265-syntax): NAL framing, parameter sets, slice headers and SEIAhmet Kaan Gümüş · 0d07f18
feat(h265-syntax): NAL framing, parameter sets, slice headers and SEI

Writers and parsers for the same structures, so a round trip is a test
rather than an article of faith. Sized by what a stateless hardware
decoder asks for: every field of VAPictureParameterBufferHEVC and
VASliceParameterBufferHEVC is a field here or a named method on one.

The conformance window is first class - 1920x1080 codes as 1920x1088 and
crops - and the slice header hands back where the data starts, escape
bytes counted, which is what slice_data_byte_offset means.
build(shims): every shim manifest stands on its ownAhmet Kaan Gümüş · a132a9d
build(shims): every shim manifest stands on its own

Shims are built by the consumer as path dependencies, from outside this
workspace. Any inherited field (`edition.workspace`, and the family's dep
table) makes that build read this workspace's root manifest, so a root that
does not parse -- mid-edit, mid-rename, a member being created -- breaks the
consumer's build for a reason that has nothing to do with the shim.

Measured, not assumed: with an unparseable root, a shim carrying
`edition.workspace = true` fails with "invalid potential workspace manifest"
and the same shim with literal fields builds. A member whose manifest has no
source file does not break it either way -- cargo loads only the members it
needs.

So every shim now spells out edition, license, authors and its `ec-*`
dependencies as relative paths; `flacenc` already did, and the rest match it.

Check: `cargo check --manifest-path shims/<name>/Cargo.toml` for all twelve.
fix(riff): refuse the headers hound refuses, and say so honestlyAhmet Kaan Gümüş · 30d372e
fix(riff): refuse the headers hound refuses, and say so honestly

The WAV reader accepted three files hound rejects, each one a silent misread
rather than an error: a `data` chunk shorter than its declared size read as a
complete file, a padded container (8-bit samples in 2-byte slots) read at the
wrong stride so every frame after the first came from the wrong offset, and a
depth that is not a whole number of bytes (12-, 20-bit) taken as if it were.

The stride and depth checks live in `ec-riff`'s `parse_fmt`, where every reader
routes through; the odd depth is `corrupt` and the padded container
`unsupported`, which the shim maps to hound's `FormatError` and `Unsupported`
respectively. Truncation is checked in the shim instead: `ec-riff` deliberately
reads what is there and reports it, so the shim compares the sample count
against the frame count the `data` header promised and yields hound's
`UnexpectedEof`. The write path is untouched.

The shim's header claimed its differences were "all in the strict direction",
which was true of writing and false of reading; it now lists the reader
divergences that remain -- single-item error iterators where hound repeats the
refusal per sample, and its own wording.

Checks: `cargo test -p hound` (5 tests) covers a truncated file, a padded
container, 12- and 20-bit depths and a well-formed control; `cargo test -p
ec-riff` is unchanged, its truncation-tolerance test included.
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(mp3): Layer III decoder and encoder, tables measured not copiedAhmet Kaan Gümüş · 1325107
feat(mp3): Layer III decoder and encoder, tables measured not copied

ec-mp3 decodes MPEG-1, MPEG-2 LSF and MPEG-2.5 Layer III and encodes CBR
MPEG-1 Layer III, and shims/rusty_mp3 carries the incumbent's name, version
and call shape over it.

Layer III's Huffman code tables and its 512-tap polyphase window are
normative data no formula produces. Instead of copying them out of an
existing implementation, scripts/mp3-tables measures them against a
reference decoder: it writes legal frames whose main-data bits it chooses,
decodes them with ffmpeg, and reads the answer back through a model of the
decode chain. Every code tree is walked to its leaves and checked for a
Kraft sum of exactly 1, complete coverage of its value grid and no
duplicates; the window is least-squares fitted to a 1.6e-6 residual, the
f32 noise floor of the decoder measured. The same rig produced the MPEG-1
long scalefactor band widths, which came out equal to the published
layouts, and it corrected two things a description would not have: the
MPEG-2.5 11.025 and 12 kHz short-block layouts are the 16 kHz ones, and the
short-block region boundary is three scalefactor bands rather than the
fixed 36 lines that only holds where those bands are four wide.

Decoder: header and CRC, side info, scalefactors (MPEG-1 with scfsi and the
LSF partition scheme), all Huffman tables, requantisation, mid/side and
intensity stereo, short-block reorder, alias reduction, IMDCT with the four
block windows, and a DCT-based polyphase bank from ec-dsp. ID3v2 and the
Xing/LAME/VBRI header frame are skipped, junk is resynced over, and
free-format is refused by name rather than guessed at.

Encoder: polyphase analysis (the synthesis bank's adjoint, reconstructing
to its -85 dB design limit), MDCT with block switching, an FFT-based
masking model whose gaps are stated in the module docs, inner rate and
outer distortion loops, Huffman table and region selection, and a bit
reservoir that emits frames one behind so a granule can start inside the
previous frame's payload.

Measured, all against ffmpeg:
- decode: 47 fixtures (nine sample rates, mono/stereo/joint/simple, CBR and
  VBR) at correlation 1.000000, 333-3232x realtime
- encode: at or above rusty_mp3 0.6.1 on the same corpus and metric at
  128/192/320 kbit/s, mono and stereo, every stream decoding without an
  ffmpeg warning
test(ac3): fixture matrix against ffmpeg, header surface and no-panic floorAhmet Kaan Gümüş · 2d69f73
test(ac3): fixture matrix against ffmpeg, header surface and no-panic floor

The matrix decodes every generated ac3/eac3 fixture and compares per
channel against ffmpeg with dither off, which is what isolates everything
but the two decoders' implementation-defined noise. Alongside it: the
exact header calls a container makes, the downmix, and a damage sweep
that truncates and corrupts every byte of a frame.

The example is the harness those numbers come from -- it also prints the
decode speed, 313-514x realtime for 5.1 on real Blu-ray and streaming
tracks.
feat(ac3): Enhanced AC-3 — Annex E syntax, spectral extension and AHTAhmet Kaan Gümüş · 7fa4038
feat(ac3): Enhanced AC-3 — Annex E syntax, spectral extension and AHT

Annex E bsi/audfrm/audblk, driving the same bit allocation and transform
as AC-3. Spectral extension synthesises the high band by translation,
noise blending and envelope scaling; the adaptive hybrid transform brings
its six-point DCT with the vector and gain-adaptive quantizers.

Two details the published document states ambiguously, resolved against a
real Dolby Digital Plus stream: the coupling banding array is indexed by
absolute sub-band (like the spectral extension one), and the AHT inverse
DCT carries sqrt(2), not the 2 its printed equation shows -- with 2 every
AHT channel comes out exactly sqrt(2) too loud.

Enhanced coupling and dependent substreams above 5.1 are refused by name.
feat(ac3): AC-3 decoder — coupling, rematrixing, DRC and the public surfaceAhmet Kaan Gümüş · 5bc2be2
feat(ac3): AC-3 decoder — coupling, rematrixing, DRC and the public surface

One packet is one syncframe; frames come out as interleaved f32 in the
family's channel order, with an optional section 7.8 Lo/Ro downmix for
callers that want stereo. Dynamic range compression is applied by default
because section 7.7.1 says a decoder shall, with drc_scale to turn it
down; dialnorm is surfaced and never applied.

Every fixture decodes to a per-channel correlation of 1.000000 against
ffmpeg (mono, stereo and 5.1 at 32/44.1/48 kHz).
feat(ac3): A/52 headers, bit allocation model and transform primitivesAhmet Kaan Gümüş · bd2188c
feat(ac3): A/52 headers, bit allocation model and transform primitives

syncinfo/bsi (including the Annex D alternate syntax), the parametric bit
allocation of section 7.2.2 with its spec tables, exponent and mantissa
unpacking, and the 512/256-sample IMDCT with window and overlap-add over
the shared ec-dsp FFT.

Grouped mantissas are shared across exponent sets, per section 7.3.5: the
group state belongs to the audio block, not to the channel.
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.
test(h264): CABAC conformance sweep, QP and geometry matrices, no-panic floorAhmet Kaan Gümüş · c7660d1
test(h264): CABAC conformance sweep, QP and geometry matrices, no-panic floor

The vector sweep is dynamic, so the eight JVT streams whose only barrier was
CABAC I-decode moved from refused to bit-exact on their own: CABA1_SVA_B,
CABA2_SVA_B, CABA3_SVA_B, CACQP3_Sony_D and CANL1..4_SVA_B. 18 bit-exact and
17 refused becomes 26 bit-exact and 9 refused; CAMACI3_Sony_C, CAMASL3_Sony_B
and MR9_BT_B moved from the CABAC refusal to the interlaced one, which is what
they also use, and nothing is unaccounted for.

Added around that:
- the 51-quantiser ffmpeg matrix and the geometry/slice matrix now run under
  both entropy coders (`-coder ac` for CABAC, verified to set
  entropy_coding_mode_flag), which walks context initialisation across every
  SliceQPY and re-initialisation across slice boundaries;
- inter slices under CABAC are refused by name after the intra pictures of the
  same GOP decode, so the arithmetic decoder cannot be mistaken for P and B
  support;
- the 8x8 transform refusal is proved under CABAC as well as CAVLC, where the
  flag is a context-coded bin;
- the zero-allocation proof and the corrupt-stream no-panic sweep both gained
  a CABAC stream.

ns/MB, first IDR, single thread, deblocking included: CABA1_SVA_B 1860,
CABA3_SVA_B 1892, against 923..1321 for the CAVLC streams.
feat(vorbis): rusty_vorbis shim over ec-vorbisAhmet Kaan Gümüş · 2127132
feat(vorbis): rusty_vorbis shim over ec-vorbis

Carries the incumbent's name and version, and drops the two behaviours
the replica corrects by hand: the pre-roll hop and the stereo-only setup
header.
test(vorbis): Xiph vectors, fixture sweep and encode oracleAhmet Kaan Gümüş · c547ecb
test(vorbis): Xiph vectors, fixture sweep and encode oracle

25 Xiph decoder vectors against ffmpeg, the repo's mono/stereo/5.1
fixtures, and the encoder's own output decoded by ffmpeg and by us.
feat(vorbis): Vorbis I decoder and encoderAhmet Kaan Gümüş · c0023ff
feat(vorbis): Vorbis I decoder and encoder

Decode is the whole format: codebooks with the entry-order codeword rule
(not sorted-canonical - a Laplacian book assigns differently and every
packet desynchronises silently), floor 0 and floor 1, residues 0/1/2,
square-polar coupling, every blocksize and the four long-window shapes.
Encode writes its own codebooks and a setup header per channel layout,
centres the first block on input sample 0 so no caller pre-roll is needed,
and states the input's own sample count as the last granule.
feat(h264): CABAC entropy decoding for I slicesAhmet Kaan Gümüş · 7cdaf34
feat(h264): CABAC entropy decoding for I slices

Clause 9.3, transcribed from Rec. ITU-T H.264 (V15):

- arithmetic decoding engine (9.3.3.2) with the spec's exact integer steps —
  DecodeDecision over rangeTabLPS, DecodeBypass, DecodeTerminate, RenormD;
- context variable initialisation (9.3.1.1) from SliceQPY, and the engine
  restart after I_PCM samples (9.3.1.2);
- binarizations: the I-slice mb_type tree (Table 9-36), TU, FL and the UEG0
  suffix of coeff_abs_level_minus1 (9.3.2.1 to 9.3.2.7);
- context selection including the neighbour-derived increments of 9.3.3.1.1
  for mb_type, intra_chroma_pred_mode, coded_block_pattern, mb_qp_delta and
  coded_block_flag, plus the significance-map positions of 9.3.3.1.3;
- the CABAC slice-data loop: cabac_alignment_one_bit, then a macroblock and an
  end_of_slice_flag per iteration.

The picture state grows the two neighbour facts CABAC needs and CAVLC did not:
the coded block pattern per macroblock, and the DC coded_block_flags. The
macroblock loop is otherwise untouched — parse and reconstruction stay fused.

Only the values an I slice of a frame-coded 4:2:0 8-bit stream reads are
transcribed. The cabac_init_idc columns, the field-coded significance
contexts and the 8x8 transform block categories belong to slices this decoder
still refuses by name; a later release adds them against its own oracle rather
than shipping numbers no test can reach. Inter slices under CABAC keep the
existing inter-slice refusal, and transform_size_8x8_flag is now refused as a
decoded bin rather than a raw one.
refactor(h264): entropy seat between the macroblock loop and CAVLCAhmet Kaan Gümüş · 6480b8e
refactor(h264): entropy seat between the macroblock loop and CAVLC

The slice-data syntax reader becomes an enum seam (`Entropy`) covering every
element the macroblock loop reads: mb_type, the intra prediction modes,
coded_block_pattern, mb_qp_delta, the residual blocks, the I_PCM samples and
the end-of-slice test. CABAC (clause 9.3) codes all of those differently, so
the seam has to sit there rather than around residual_block alone; the
parse-and-reconstruct loop stays fused.

Enum dispatch, not a generic: the variant is constant for a whole slice, so
the branches predict perfectly and the macroblock loop is monomorphised once.

The neighbour derivations now hand out the raw (left, above) pair instead of
a CAVLC nC, because CABAC reduces the same pair a different way.

CAVLC ns/MB, median of three runs, before -> after:
BA1_Sony_D 1331 -> 1328, CI_MW_D 1137 -> 1126, NL1_Sony_D 948 -> 933.
test(h264): all-vector sweep, 51-QP and geometry matrices, avcC entryAhmet Kaan Gümüş · 3e1c177
test(h264): all-vector sweep, 51-QP and geometry matrices, avcC entry

The fixed stream lists could only ever record what passed the day they
were written: a vector added later went untested and one regressing from
bit-exact to refused was invisible. The sweep now walks every fixture
directory and each one must land as bit-exact or as a named refusal.

ffmpeg fills what the JVT set does not reach: one Baseline picture per
quantiser covers all 51 rows of the deblocking alpha/beta/tC0 tables (a
whole wrong column there once passed the vectors), and a geometry matrix
covers 1080-line cropping, a non-multiple-of-16 width, four slices, the
loop filter off, a chroma QP offset and a 16x16 picture. Each refusal is
proved against a stream that really uses the feature, and cqm=jvt pins
the scaling matrices as decoded rather than refused.
feat(h264): registry Decoder entry, avcC extradata, mechanism-named refusalsAhmet Kaan Gümüş · 19f3903
feat(h264): registry Decoder entry, avcC extradata, mechanism-named refusals

The NAL-level Decoder is what a bitstream tool wants; a demuxer wants
packets. H264Decoder implements ec_core::registry::Decoder over the same
decode core and adds the two things a container brings with it: parameter
sets carried out of band in an avcC record (14496-15 clause 5.3.3.1), and
NAL units framed by a length prefix instead of Annex B start codes. The
framing is decided once, by whether extradata held an avcC, and the SPS
inside it publishes the picture size before the first packet arrives.

Every refusal's why-text now names the syntax element that fired and the
machinery it would need, not just "not implemented" — the conformance
suite proves each one against a stream that really uses the feature, so
the text is the capability statement a caller reads.
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(h264-syntax): NAL, SPS/PPS incl VUI+HRD, slice headersAhmet Kaan Gümüş · f07dac7
feat(h264-syntax): NAL, SPS/PPS incl VUI+HRD, slice headers

Clean-room from Rec. ITU-T H.264 (V15, 08/2024) alone. Annex B scan and
emulation-prevention removal reuse a caller buffer (no per-NAL alloc);
SPS/PPS carry decode-ready derived geometry (MB counts, crop, bit depth)
so a decoder feeds flat per-picture arrays without re-deriving anything.
Slice headers parse all five slice types including P/B reference-list
modification, prediction weights and dec_ref_pic_marking, ready for the
inter slices that arrive with S18c. Scaling lists resolve fall-back
rules A/B at parse time.
test(mp4): fixtures, real library, remux round trip and a fuzz loopAhmet Kaan Gümüş · 1bc9080
test(mp4): fixtures, real library, remux round trip and a fuzz loop

34 mp4/mov/m4a fixtures field-compare against ffprobe and remux into
files ffmpeg decodes with the same fields; the 23.976 ones assert the
exact 24000/1001. The extension test writes av01, hvc1, vp09, colr with
mdcv/clli, udta/name and a tx3g track from cues, and reads each back
through ffprobe. Ten thousand byte mutations of a real file open, demux
and seek without a panic, and the ignored real-library test walks every
mp4-family file in the manifest to EOF against ffprobe -count_packets.
feat(mp4): the writer, with the boxes edith wrote by hand in-crateAhmet Kaan Gümüş · 7336903
feat(mp4): the writer, with the boxes edith wrote by hand in-crate

One pass: ftyp, then an mdat the samples stream into, then the moov built
from what was written (a faststart layout would have to copy the whole
mdat a second time). Sample tables are generated from the packets --
run-length stts, ctts only where something is reordered, stss only where
some sample is not a sync one, co64 where the file is big enough to need
it -- and an elst is written where the first picture is not the first
decoded one, so a reordered track does not start late.

The four boxes edith patched into the incumbent's output are written here
instead: av01+av1C, hvc1+hvcC, colr nclx (with mdcv/clli beside it, so an
HDR grade survives a remux) and udta/name for the movie and each track,
plus a tx3g entry with its style and font table.
feat(mp4): ISOBMFF box model, esds descriptors and the demuxerAhmet Kaan Gümüş · 49be010
feat(mp4): ISOBMFF box model, esds descriptors and the demuxer

The box walk checks every size against its parent and every table entry
count against the box that holds it, so a crafted header is an error and
never an allocation. The moov walk resolves the sample tables into
offset/size/dts/cts/sync per sample, reads fragments (moof/traf/trun)
into the same tables, and takes the frame rate off stts as an exact
rational -- whole track over whole track, so NTSC film stays 24000/1001
instead of decaying into 23.

A sample entry is read for what it says it is: an mp4a holding MP3 is an
MP3 track rather than a dropped one, ac-3/ec-3/alac/Opus/fLaC and the
QuickTime PCM entries are their own codecs, and an entry with no CodecId
leaves its track listed rather than decoded as something else. The esds
parser hands back the DecoderSpecificInfo as bytes, which is the field
callers previously had to rebuild from parsed fields.
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(shim): hound WavReader, the read half edith's tests callAhmet Kaan Gümüş · babff90
feat(shim): hound WavReader, the read half edith's tests call

The W1 replica swap found the gap: engine's own suite reopens a WAV
export with hound::WavReader and iterates samples::<i16>(), which the
write-only shim could not compile. WavReader/spec/samples now wrap
ec_riff::WavReader, and Sample gains the reader's two constructors and a
width so TooWide and InvalidSampleFormat are decided the way the
incumbent decides them, not by a silent conversion.
feat(vp9,av1): bitstream header parsers for stateless hardware decodeAhmet Kaan Gümüş · ee46976
feat(vp9,av1): bitstream header parsers for stateless hardware decode

ec-vp9-syntax parses the superframe index and the whole uncompressed frame
header (profiles 0-3, colour config, size-from-reference, loop filter,
quantization, segmentation, tile info), carrying the state VP9 spreads across
frames: reference sizes, segmentation data and loop filter deltas. The spec
8.6.1 dequantization tables and the 8.8.1 loop filter level derivation ship
with it, so every field of VADecPictureParameterBufferVP9 and
VASegmentParameterVP9 comes out of the parse.

ec-av1-syntax parses OBU framing, the sequence header and the frame header in
full (superres, reference signalling incl. set_frame_refs, tile info, quant,
segmentation, delta q/lf, loop filter, CDEF, loop restoration, tx mode, skip
mode, global motion, film grain) plus tile group offsets, and derives the warp
shear validity VAWarpedMotionParamsAV1 asks for.

Both are BitReader-based, forbid unsafe, and answer malformed input with a
typed error rather than a panic. Verified against every VP9/AV1 fixture stream
with ffprobe as the oracle: dimensions, profile, bit depth, chroma, per-frame
key flags and shown-frame counts all agree, including 10-bit, 4:4:4,
monochrome, multi-tile, superframes and show_existing_frame.
feat(core): Packet::with_pts/with_duration buildersAhmet Kaan Gümüş · ffd766f
feat(core): Packet::with_pts/with_duration builders

The Ogg shim's caller builds a packet in one expression; these are the two
setters that chain.
feat(subs): SRT/WebVTT/ASS parsing, PGS bitmaps, oxideav shimsAhmet Kaan Gümüş · 1f445c1
feat(subs): SRT/WebVTT/ASS parsing, PGS bitmaps, oxideav shims

ec-subs carries the cue IR the family answers with (time range plus
styled runs, positioning beside them) and the SubRip and WebVTT parsers
over it; ec-ass reads ASS/SSA into the same IR, override tags included;
ec-pgs decodes Blu-ray display sets to straight RGBA canvases.

Tolerance is the point on the text side: BOM (UTF-8 and UTF-16), CRLF and
lone CR, invalid UTF-8, missing or wrong indices, dotted fractions,
trailing SubRip coordinates, overlapping and backwards cues all parse; a
block that cannot be read is skipped and counted, and only a document
with no timing line at all is refused. The PGS decoder holds an epoch
across display sets, keeps a partial segment until the rest arrives and
drops a torn set rather than the track.

shims/oxideav-{core,subtitle,ass,sub-image} carry the incumbent package
names and versions and cover exactly the surface the replica consumes, so
the swap is a [patch.crates-io] line. The replica's own call shapes are
transcribed as a test, which is what proves the swap rather than the
crates' own suites.

Checks: 34 tests green (unit plus real streams extracted from the library
by scripts/gen-subtitle-fixtures.sh); the first painted display set of a
1080p PGS track agrees with ffmpeg's own render of the same set — same
bounding box within two pixels, every reference ink pixel painted,
colours within 1/255.
test(matroska): fixture remux, seek loop and real-library sweepAhmet Kaan Gümüş · 2c0d9b8
test(matroska): fixture remux, seek loop and real-library sweep

Every mkv/webm/mka fixture is demuxed, written back out through this crate's
muxer and field-compared with ffprobe before ffmpeg decodes the result; a
hundred random seeks per fixture run on one reader each and every one lands
on a random-access point at or before its target.

The ignored sweep walks ten films of the real library end to end, matches
their per-stream packet counts against ffprobe and seeks twenty times in
each.
feat(matroska): Matroska/WebM muxer with SeekHead and CuesAhmet Kaan Gümüş · 550709b
feat(matroska): Matroska/WebM muxer with SeekHead and Cues

Streams declared, packets rescaled into the millisecond tick every Matroska
muxer writes, a cluster opened at each video keyframe, and three fields
patched at finish: the segment size, the duration and the SeekHead reserved
in front of the Info. Cues name every keyframe cluster, so a file written
here seeks in this crate's own reader and in ffmpeg.

Beyond the engine's writer, which wrote neither index: WebM doc type with the
codec subset enforced, colour and mastering metadata carried through, Opus
CodecDelay and SeekPreRoll off the OpusHead, DisplayWidth for anamorphic
sources, and BlockGroup durations for subtitle cues.
feat(matroska): EBML grammar and Matroska/WebM demuxerAhmet Kaan Gümüş · 4888147
feat(matroska): EBML grammar and Matroska/WebM demuxer

The element grammar both directions share (variable-length ids and sizes,
in-memory child walks, the unknown-length rule) and the reader on top of it:
segment and track walk, cluster walk, SimpleBlock and BlockGroup, all three
lacings, ContentEncodings undone (zlib through ec-inflate, header stripping
put back, everything else refused by name), and cue-driven seeking on the one
reader a file was opened with.

Ported from the engine's own demuxer, restructured around the ec-core Demuxer
contract: packets stream out of one cluster-sized allocation instead of a
frame index built for a video editor, and every track of the file becomes a
StreamInfo rather than one picture track plus a sound list.
test(ec-ogg): FLAC-in-Ogg recognition against a real streamAhmet Kaan Gümüş · 573addd
test(ec-ogg): FLAC-in-Ogg recognition against a real stream

The mapping header parse had no bytes behind it: ffmpeg makes a
FLAC-in-Ogg file from a fixture in the test, and the demuxer has to name
the codec, read the rate out of STREAMINFO and count the packets ffprobe
counts.
feat(flac): ec-flac decoder + encoder and the flacenc shimAhmet Kaan Gümüş · 339321d
feat(flac): ec-flac decoder + encoder and the flacenc shim

Decoder: metadata blocks, frame headers (fixed and variable blocking),
constant/verbatim/fixed/LPC subframes to order 32, escaped and
Rice-coded partitions, all three stereo decorrelations, 8..32-bit,
CRC-8 + CRC-16 verified per frame, STREAMINFO MD5 check, seek-table
positioning, and frame-sync resynchronisation for streams that start
mid-file. Malformed input errors, never panics.

Encoder: fixed block size, wasted-bit detection, fixed predictors,
LPC (Tukey window, Levinson-Durbin, error-feedback quantisation),
exact-cost Rice partition search, per-block stereo decision, 1..8
channels and 4..32 bits, with the input MD5 in STREAMINFO.

shims/flacenc carries package flacenc 0.5.1 over ec-flac for the exact
surface the replica calls (component::BitRepr, error::Verify,
config::Encoder, source::MemSource, encode_with_fixed_block_size,
bitsink::ByteSink).

Verified: 64/64 Xiph subset vectors decode bit-exact vs ffmpeg,
6/6 decodable uncommon vectors bit-exact, faulty vectors error out;
14/14 fixture encodes decode back bit-exact through ffmpeg at 0.961x
the size of ffmpeg's default FLAC.
feat(ec-ogg): Ogg demux/mux with Vorbis, Opus and FLAC mappingsAhmet Kaan Gümüş · 47772cb
feat(ec-ogg): Ogg demux/mux with Vorbis, Opus and FLAC mappings

RFC 3533 pages both ways: lacing (255-runs and the zero terminator),
packet reassembly across continuations, unreflected page CRC with
resync-on-damage, granule positions per mapping, BOS/EOS, and seek by
granule bisection.

Timing lives in the mapping, not in Ogg: Vorbis and FLAC count samples at
the stream rate, Opus counts 48 kHz samples including its pre-skip and
states per-packet durations in the TOC byte. Packets carry the page
granule they end on as side data, which is what lets a remux reproduce
positions the demuxer could not otherwise express.

Verified against ffprobe/ffmpeg on the nine Ogg fixtures: packet counts
and durations match, and every fixture remuxes to audio that decodes byte
for byte identical to the source.

feat(shims/oxideav-ogg): mux surface over ec-ogg

xiph_lace, open_concrete and set_page_target_bytes beside the
oxideav_core::Muxer methods, with the replica's "pts is the granule
position" convention translated here rather than at the call site.
feat(core): H.273 color model + dsp remap, ported from edith engineAhmet Kaan Gümüş · 81a11c6
feat(core): H.273 color model + dsp remap, ported from edith engine

Ports the engine's first-party colorspace model into the family IR: the
three-tier resolve (container tags over bitstream tags over the 720-line
heuristic), the H.273 code tables, the HEVC/H.264/AV1 parameter-set walks
that read a VUI colour_description, and the HDR SEI/mdcv/clli readers.

ColorInfo keeps its raw CICP triplet and gains the meaning behind it
(tags/describe/primaries and a From<ColorDescription> back out);
VideoParameters gains the ContentLight the mastering-display and
content-light metadata needs, which costs those four structs their Eq.

remap lands in ec-dsp beside the transforms: same 8.8 fixed-point
coefficients, same rounding, same no-op on a matching pair.
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(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.
feat(va): hand-written libva FFI with RAII handles and picture typestateAhmet Kaan Gümüş · 0eac457
feat(va): hand-written libva FFI with RAII handles and picture typestate

Minimal VA-API bindings for the hardware-video lane, no bindgen and no
build-time tooling. `sys` transcribes the libva 1.23 subset the family needs;
everything above it is safe.

- ABI: struct layouts asserted at compile time against numbers printed by
  abi-probe.c compiled against the system headers; `vaInitialize` version
  guard refuses libva older than 1.23 at runtime. Together these close the
  header-drift trap that broke the incumbent bindings at 1.23.
- Soundness: C enums stay `i32` in `sys`; the safe `Profile`/`Entrypoint`
  mirrors carry an `Unknown(i32)` arm, so a value from a newer driver can
  never be transmuted into an invalid Rust enum.
- RAII: Display/Config/Surface/Context/Buffer each destroy exactly what they
  created, and children hold an `Arc` of their parent, so libva's destruction
  order is a borrow-checker fact. Image and buffer mappings unmap on drop;
  PRIME exports own and close their descriptors.
- Picture typestate: New -> Rendering -> Ended -> Synced, transitions consume
  the picture; out-of-order submission does not compile.
- Caps probe reports per-pair RT formats plus driver-legal surface sizes
  (radeonsi refuses below 64x64) instead of assuming them.

55 unsafe blocks, every one SAFETY-commented. Tests run against the real GPU:
11 live tests (caps table vs vainfo, 100 pool create/destroy cycles under an
RSS bound, PRIME fd ownership, derive/map/unmap round trip) plus 4
compile_fail doctests pinning the typestate on E0599.
feat(inflate): DEFLATE/zlib decompression + miniz_oxide shimAhmet Kaan Gümüş · b73c680
feat(inflate): DEFLATE/zlib decompression + miniz_oxide shim

ec-inflate decodes RFC 1951 blocks (stored, fixed, dynamic) through a
two-level Huffman table and wraps them in the RFC 1950 header check and
Adler-32 verification. Every entry point carries the caller's output
ceiling, checked before each write, so a crafted block fails with an
error instead of taking all the memory there is; malformed input is
always an error, never a panic.

shims/miniz_oxide carries the incumbent name and version over it,
exposing the one function edith's Matroska ContentEncodings path uses,
with the same statuses and message strings so the swap needs no source
change.

Tests: round-trip against flate2 at levels 0-9 over seven input shapes
(raw and zlib), ceiling boundaries with partial output preserved,
truncation, Adler-32 mismatch, and a 10k-iteration mutation loop that
must never panic.
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.