forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on mainFiltered to crates/ec-h264/tests/conformance.rsClear filter

2026-10-23

testcut P2 ec-h264: delete four heavy tests with mutation kill evidenceAhmet Kaan Gümüş · e9b9397
testcut P2 ec-h264: delete four heavy tests with mutation kill evidence

Delete every_quantiser_matches_ffmpeg, every_quantiser_with_motion_matches_ffmpeg,
high_profile_8x8_matches_ffmpeg and x264_hi444_10bit (222.2 s saved). Keep
x264_hi444_8bit (K'=4), both never_panic tests (weak oracle, kill 4 each) and
jvt_hi444_vectors_bit_exact (protected). Evidence from the r4 run; r1-r3 invalid.
Mutation runs exclude encode::real_library_frames_encode_and_decode_exactly
(needs personal media).
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-29

Merge lane-h264reallib @ 25c996b2 — real-media-library test sites reshaped to #[ignore] with fact-based reasons, plus four follow-upsAhmet Kaan Gümüş · 616d822
Merge lane-h264reallib @ 25c996b2 — real-media-library test sites reshaped to #[ignore] with fact-based reasons, plus four follow-ups

Real-library tests that silently SKIP when ffmpeg/ffprobe or a media file is
absent are reshaped to #[ignore] carrying the concrete reason each site needs
its dependency, so 'not run' stops reading as 'passed'.

Four follow-ups in the same tip:
  * ec-probe: a silent skip replaced by a named SKIP that states what was
    missing rather than returning quietly;
  * ec-aac: two env::var("HOME").unwrap() -> unwrap_or_default() so a
    HOME-less run degrades instead of panicking;
  * ec-h264: one hardcoded absolute manifest path -> CARGO_MANIFEST_DIR-relative.

NOTE (do not amend): the branch's commit message cites line numbers that the
SAME commit's rustfmt pass renumbered. The citations were accurate when
written and are stale at this tip; they are left as-is deliberately.
tests: make the real-library sweeps LOCAL-ONLY, and report the classAhmet Kaan Gümüş · fcb9ffb
tests: make the real-library sweeps LOCAL-ONLY, and report the class

real_library_streams_match_ffmpeg reds every fleet run with "only 0 real
files swept end to end; the sweep is the point". It is not a decoder defect:
the precondition is a PERSONAL media library, reachable only through the
gitignored fixtures/real-library-manifest.tsv that
scripts/scan-real-library.sh generates by scanning the user's own media
directories.

Both of its runner behaviours are wrong, which is why this is #[ignore] and
not an env-gated SKIP:
  - manifest absent  -> the existing "SKIP: missing" return prints GREEN,
    which is the silent-skip class this batch is removing;
  - manifest present, paths unresolvable (a host that ran the scan against
    an empty library) -> zero swept, `decoded >= 3` fails, red for a reason
    unrelated to the decoder.
An env gate whose variable is absent on the runner prints that same green --
the defect, not the fix. An ignore is visible in --list, cannot go green
silently, and leaves the assertion intact.

ec-aac's real_library_tracks_match_ffmpeg gets the identical one-liner: same
manifest, same "skip if missing then assert checked >= 3" shape, same two
failure modes.

Local verdict on the workstation, where the library is: 15 files decoded
bit-exact, 0 refused by name, 0 failures, 1918 s, across matroska and
mov/mp4 at 576px-3840px, with one file taking the container-demux fallback.
The decoder is fine. The 1918 s is now in the ignore reason so the next
person does not read a 30-minute wall time as a wedge.

lanes/h264reallib.report.md carries the full class sweep: 51 sites examined,
2 fixed here, 3 that need a decision (ec-probe library.rs:490, whose own
header comment the assert contradicts, and two bare HOME unwraps that want
unwrap_or_default), and the false positives that must not be touched.
ec-h264: a missing conformance vector FAILS under EC_REQUIRE_FIXTURESAhmet Kaan Gümüş · a737185
ec-h264: a missing conformance vector FAILS under EC_REQUIRE_FIXTURES

Five gates took `if !base.is_dir() { eprintln!("SKIP ..."); return; }`
over the JVT vector directory, and a sixth skipped a missing
`fixtures/video/h264-open-gop.mp4`. On a worktree -- which has no
gitignored root `fixtures/` -- all six reported green having decoded
nothing, so a conformance run there measures nothing while looking
clean. That is the same "gate skips on its own failure" class the ec-av1
inventory pins, one crate over.

A shared `require_fixtures(path, what, generator)` now drives every arm:
default-off it skips and says what it skipped and which command fixes it;
`EC_REQUIRE_FIXTURES=1` turns it into a hard failure naming the exact
missing path, `scripts/link-fixtures.sh` (the root cause) and the
generator for that particular fixture. Tests only; no decoder change.

Red: EC_REQUIRE_FIXTURES=1 with `fixtures/` unlinked fails
jvt_cavlc_first_idr_bit_exact ("the JVT conformance vectors missing at
.../fixtures/vectors/h264-jvt -- this gate would prove nothing") and
h264_seek_matches_linear_open_gop ("the open-GOP fixture missing at
.../fixtures/video/h264-open-gop.mp4"). Green: all six pass with
`fixtures/` linked (1.58s / 5.59s / 0.73s / 20.85s / 9.94s / 0.75s).

2026-09-28

audit: assert equal lengths before every ours-vs-oracle walk (68 sites)Ahmet Kaan Gümüş · b7b2e07
audit: assert equal lengths before every ours-vs-oracle walk (68 sites)

The prefix-truncation false PASS: an ours-vs-oracle compare that walks
`got.iter().zip(want)` without first asserting equal lengths reports EXACT
for any defect outside the compared prefix, because zip stops at the shorter
operand. A frame-count assert says nothing about a plane's byte length.

Audited 124 sites across ec-av1/ec-h264/ec-h265/ec-vp9/ec-alac/ec-flac/
ec-aac/ec-ac3 and tools/oracle: 68 UNSAFE, 38 SAFE, 18 N/A. 68 fixed by
inserting the length assert AFTER the existing diff assert, on the same
buffers, so a real divergence still fails for the same reason with the same
message and only the previously-silent short-plane case becomes loud. The
canonical shape already in the tree is decode_all_frames_vs_oracle.

encode.rs::first_difference returned None ("exact") for any length
mismatch; it now returns Some, copying first_plane_mismatch. encode.rs's
nine `encoded.frames` vs ffmpeg loops and two GOP zips gained the count
assert they never had. ec-h264's round_trip rejected only an over-long
frame, so a short one zipped to zero and four call sites printed
"bit-exact".

Truthfulness: a comment above stream.rs:29006 claimed the gate compared
every decode-order frame when it compares the shown ones; the pinned-
scratch loop truncated a three-way .min() silently; a message called a
shown-frame count "decode-order"; two frame-count asserts were tautological
and are now a comment; examples/dump_yuv.rs wears a decode-index filename
on a display index.

Red/green per crate in lanes/av1cmpaudit.report.md. Not pushed.

2026-08-20

fix(h264): drop leading pictures after a seek's open-GOP recovery pointAhmet Kaan Gümüş · 03dc6e9
fix(h264): drop leading pictures after a seek's open-GOP recovery point

Root cause (crates/ec-h264/src/dpb.rs, crates/ec-h264/src/decoder.rs;
mirrored in crates/ec-hw/src/dec/dpb264.rs, crates/ec-hw/src/dec/h264.rs):
an open-GOP I picture is not an IDR — it is a plain I slice whose
predecessors in decode order can still be referenced by pictures that
follow it. A decoder started fresh at that I (exactly what a seek does)
has none of those earlier references, so `build_ref_lists` pads the
missing entries with whatever it has. The old code decoded and output
those leading pictures anyway, handing back frames predicted from padded
(garbage) references before the stream ever reaches a picture whose
references are all real.

Annex D.2.8 defines a `recovery_point` SEI whose absence (the common
case, and this fixture's case) defaults `recovery_frame_cnt` to 0: the
recovery point is the RAP's own POC, i.e. only pictures with a POC at or
after the leading I's own POC are guaranteed fully referenced. The SEI
itself is deliberately not parsed — the default already gives the
correct threshold for the case that matters (mid-GOP seek), and a real
non-zero `recovery_frame_cnt` is out of scope for this fix.

`build_ref_lists` now returns whether it had to pad a list
((lists, padded)); `Decoder`/`H264Decoder` OR that per-slice into
`cur_ref_padded`/`Current::ref_padded`, latch the first post-reset
picture's POC into `recovery_poc` on `end_picture`/`finish_picture`, and
compute `output_ok = !(ref_padded && poc < recovery_poc)`. `Dpb::store`
takes that flag and marks the picture `Mark::Unused`-eligible for output
gating (`pic.output = output_ok`) — it still joins the DPB as a
reference and for bookkeeping, but a gated picture is never handed to a
caller. `reset_pictures` clears `recovery_poc` so a later seek gets its
own threshold.

New test `h264_seek_matches_linear_open_gop` in both suites drives this
through the real entry surface: fixtures/video/h264-open-gop.mp4
(x264 open-GOP, generated via scripts/gen-fixtures.sh) primes a fresh
decoder with the leading IDR's parameter sets, resets picture state (a
seek's exact contract), feeds it from the open-GOP I access unit before
display frame 30, and asserts the first decoded picture matches a linear
decode of frame 30. Confirmed failing before this fix (forcing
output_ok true reproduces the mismatch) and passing after, on both the
software decoder (crates/ec-h264/tests/conformance.rs) and the VA-API
path (crates/ec-hw/tests/gpu.rs, real hardware).

cargo test -p ec-h264: 70 lib + 23 conformance + 8 encode passed, 0
failed. cargo test -p ec-hw --test gpu -- --test-threads=1: 19 passed
(18 pre-existing + the new one), 0 failed.

2026-08-14

feat(h264): High-profile 8x8 transform, both entropy codersAhmet Kaan Gümüş · 49bb32e
feat(h264): High-profile 8x8 transform, both entropy coders

transform_size_8x8_flag (7.3.5) in the intra and inter positions with
the neighbour context of 9.3.3.1.1.10, Intra_8x8 prediction with the
reference sample filter of 8.3.2.2.1, the 8x8 residual under CAVLC
(four interleaved 4x4 blocks) and CABAC (ctxBlockCat 5, ctxIdx 402..435
transcribed from Table 9-24, no coded_block_flag), the 8x8 scaling and
inverse transform of 8.5.13 with the 8x8 scaling lists, and the 8.7
rule that an 8x8 macroblock has no transform edge at luma 4 or 12.

This is what real content needs: every H.264 file in the library that
is not Main profile uses it, so eight of twelve were refused by name
before and all twelve now decode 500 frames bit-exactly against ffmpeg.
The MP4 whose Annex B extraction ffmpeg itself could only decode three
frames of is demuxed by ec-mp4 instead, which restores the oracle.

Coverage: 51 quantisers x both coders all-intra, P and B sequences with
and without sub-8x8 partitions, and a parameter-set assertion so an
encoder silently dropping back to 4x4 cannot make the sweep vacuous.
fix(h264): colZeroFlag reads the co-located block's own reference indexAhmet Kaan Gümüş · b5f5ec8
fix(h264): colZeroFlag reads the co-located block's own reference index

Spatial direct prediction (8.4.1.2.2) zeroes a motion vector when the
co-located block sits still on a short-term picture referencing entry 0
of that picture's list. The index that decides it is refIdxCol, of the
list clause 8.4.1.2.1 selected; accepting "either index is 0" instead
zeroes vectors that must keep their prediction whenever the co-located
block is bi-predicted with a non-zero list 0 index.

That only happens when the co-located picture is itself a coded B
picture, which is the first B of every run under a B pyramid: two real
1080p library files decoded with localized wrong regions in exactly
those pictures and nowhere else. The new test reproduces it with
b-pyramid and four references, and fails on the previous reading.
feat(h264): display-order output reaches the packet entry surfaceAhmet Kaan Gümüş · 5a58bb1
feat(h264): display-order output reaches the packet entry surface

A player never touches the NAL-level API, so the reordering has to arrive
at H264Decoder: packets in, frames out, timestamps travelling with their
pictures rather than with the packets that carried them.

packet_entry_surface_reorders_and_carries_timestamps drives exactly that
path — one access unit per packet, frames pulled with receive_frame —
and proves three things at once: every frame is bit-exact against
ffmpeg, the output order is a real permutation of the packet order, and
the tag on each emitted frame identifies the packet whose picture it
actually is (checked against the same stream decoded in decode order).

Also: the crate description now states the scope it reached, the debug
tracing added while chasing the inter defects is gone, and clippy and
rustfmt are clean.
test(h264): QP and geometry sweeps with motion, real library, SP refusalAhmet Kaan Gümüş · 7c078b5
test(h264): QP and geometry sweeps with motion, real library, SP refusal

- every_quantiser_with_motion_matches_ffmpeg: all 51 quantisers over a
  P/B GOP under both entropy coders. Boundary strengths 1 and 2 only
  exist between inter macroblocks, so their tC0 columns had no oracle
  before this and both were wrong; every row of both is now covered.
- geometry_with_motion_matches_ffmpeg: 1080p, odd sizes, four slices per
  picture, loop filter off, a single-macroblock picture and five
  reference frames with B-pyramid — all over GOPs, both coders.
- real_library_streams_match_ffmpeg: the H.264 files actually on this
  machine, 500 frames each, streamed against ffmpeg one frame at a time
  so a 1080p sweep costs two frames of memory. Three files bit-exact at
  500 frames; eight refused by name, every one of them for the 8x8
  transform, which is what stands between this decoder and most real
  H.264 content.
- switching_slices_are_refused_by_name: no encoder here emits SP slices,
  so the stream is hand built, because an unproven refusal string is
  indistinguishable from a hidden bug.
- The corrupt sweep now includes a B-slice, multi-reference stream and
  exercises the whole-sequence path, where a mangled slice meets the
  decoded picture buffer.
test(h264): B pictures, display order, frame_num gaps, zero-alloc on BAhmet Kaan Gümüş · 6e48da7
test(h264): B pictures, display order, frame_num gaps, zero-alloc on B

- b_pictures_match_ffmpeg_every_frame: spatial and temporal direct,
  B-pyramid and weighted prediction, under both entropy coders, every
  frame bit-exact. The first version of this test measured nothing:
  x264's adaptive decision produced no B slices at all on the synthetic
  source, so the test now counts slice types out of the stream and fails
  if the encoder did not actually emit any.
- output_is_display_order_and_the_reorder_is_real: display order matches
  ffmpeg frame for frame, and the same stream decoded in decode order is
  a genuine permutation of it — 15 of 20 frames move.
- a_frame_num_gap_keeps_decoding: dropping a whole picture leaves the
  remaining 11 decodable, which is what a seek into a GOP looks like.
- The zero-allocation proof now covers a B-slice, multi-reference stream
  and counts a whole second pass over the stream rather than one
  picture, so picture-pool recycling is part of the claim.

Emitting a picture no longer looks its parameter set up: a stored
picture carries its own crop, output size and colour description, which
also removes the per-slice parameter-set clone that made the decode loop
allocate.
fix(h264): unavailable neighbours carry reference index -1, not 0Ahmet Kaan Gümüş · 276058c
fix(h264): unavailable neighbours carry reference index -1, not 0

Two derivation defects that only inter coding can reach:

- Nb::default() derived Default, so an unavailable neighbouring partition
  reported refIdxLXN 0 instead of the -1 that clause 8.4.1.3.2 assigns.
  Every median prediction with a missing neighbour then saw a phantom
  match on reference picture 0 and took the wrong branch of 8.4.1.3.1.
  Picture-edge macroblocks came out wrong in most inter frames.
- coded_block_flag (9.3.3.1.1.9): an unavailable neighbour counts as set
  only when the current macroblock is intra. The chroma DC block of an
  inter macroblock at the left picture edge read the opposite value and
  desynchronised the arithmetic decoder.

JVT full-sequence sweep: 4 vectors bit-exact end to end before, 18 now.

Adds the full-sequence conformance test that found them, plus an
env-gated macroblock trace (EC_H264_TRACE) and deblocking bypass
(EC_H264_NO_DEBLOCK) that split reconstruction defects from filter
defects; both resolve their environment once so the decode loop stays
allocation free.
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(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.
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): 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.