forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on 00c1b3ff2d80d84fef71bb6208110dedbbd95fc4Filtered to crates/ec-h264/src/mv.rsClear filter

2026-08-14

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