ffmpeg-v4l2-request-fourier: route H.264 chroma DC Hadamard through daedalus-fourier (0011) #100

Merged
marfrit merged 1 commits from claude-noether/marfrit-packages:noether/h264-substitute-chroma-dc into main 2026-05-25 12:03:10 +00:00
Owner

Substitutes H264DSPContext.chroma_dc_dequant_idct (4:2:0 / 8-bit) with a wrapper that composes the daedalus chroma DC Hadamard primitive (fourier PR #25, just merged) + qmul scaling. Bit-exact against ff_h264_chroma_dc_dequant_idct_8_c.

Includes daedalus-fourier pin bump to b9f9ff2a (post-PR #25) so the build picks up the public daedalus_h264_chroma_dc_hadamard_2x2 symbol.

4:2:2 chroma stays on the in-tree 422 variant — same gating shape as 0009 chroma deblock.

The wrapper handles the spec-mandated scattered DC layout (stride=32, xStride=16 — FFmpeg packs the 4 chroma DCs at specific positions in the per-MB coefficient buffer). The Hadamard itself comes from the fourier primitive; this PR just adds the position-extraction + qmul composition.

Substitutes `H264DSPContext.chroma_dc_dequant_idct` (4:2:0 / 8-bit) with a wrapper that composes the daedalus chroma DC Hadamard primitive (fourier PR #25, just merged) + qmul scaling. Bit-exact against ff_h264_chroma_dc_dequant_idct_8_c. **Includes daedalus-fourier pin bump** to `b9f9ff2a` (post-PR #25) so the build picks up the public `daedalus_h264_chroma_dc_hadamard_2x2` symbol. 4:2:2 chroma stays on the in-tree 422 variant — same gating shape as 0009 chroma deblock. The wrapper handles the spec-mandated scattered DC layout (stride=32, xStride=16 — FFmpeg packs the 4 chroma DCs at specific positions in the per-MB coefficient buffer). The Hadamard itself comes from the fourier primitive; this PR just adds the position-extraction + qmul composition.
marfrit added 1 commit 2026-05-25 11:40:25 +00:00
Substitutes H264DSPContext.chroma_dc_dequant_idct in the 4:2:0 /
bit_depth=8 init path with a wrapper that composes the daedalus
chroma DC Hadamard primitive (daedalus-fourier PR #25) with the
qmul scaling FFmpeg's reference does in one fused function
(h264idct_template.c::ff_h264_chroma_dc_dequant_idct).

Algorithm per H.264 §8.5.11.1 / §8.5.11.2:
  1. Extract 4 DCs from the scattered positions in the per-MB
     coefficient buffer (stride=32, xStride=16)
  2. 2x2 Hadamard transform (daedalus primitive)
  3. qmul scale + >> 7, write back to original positions

Bit-exact against ff_h264_chroma_dc_dequant_idct_8_c. The Hadamard
itself is gated by the fourier PR #23 7-case test suite (including
the H·H = 4·I algebraic invariant), and the public-API parity
test added in PR #25 confirms the src/ symbol matches the test ref.

4:2:2 chroma stays on the in-tree ff_h264_chroma422_dc_dequant_idct_c
path — same chroma_format_idc<=1 gating shape as 0009 chroma deblock.

Pin bump: _daedalus_fourier_commit / DAEDALUS_FOURIER_COMMIT bumped
to b9f9ff2a (post-PR #25) so the build picks up the public
daedalus_h264_chroma_dc_hadamard_2x2 symbol.

Verified the patch applies cleanly on top of 0001-0010 against the
pinned upstream commit b57fbbe5 on hertz.
marfrit merged commit 57f73f1afb into main 2026-05-25 12:03:10 +00:00
marfrit deleted branch noether/h264-substitute-chroma-dc 2026-05-25 12:03:10 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: marfrit/marfrit-packages#100