forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on 8a5feaaf4eec5ffa092cf5d42e7919f05c221426Filtered to crates/ec-h264/src/transform.rsClear filter

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