forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on mainFiltered to crates/ec-h264/src/cabac_tables.rsClear filter

2026-10-23

Restore edith_codecs after local data loss (2026-10-23)Ahmet Kaan Gümüş · b7434a2
Restore edith_codecs after local data loss (2026-10-23)

On 2026-10-23 an automated agent ran `rm -rf $HOME` and deleted the local
repository with all of its history. This commit restores the working tree
from the newest surviving copy, the host-c server lane mirror. That mirror
matches local main as of the testcut Phase 2 reports, including the tool
cache, the nextest fast profile and changed-crates.sh. The history before
this commit was not recovered.

2026-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.
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.
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.
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.