h264: expose chroma DC 2x2 Hadamard as public API #25

Merged
marfrit merged 1 commits from noether/h264-chroma-dc-hadamard-api into main 2026-05-25 11:35:17 +00:00
Owner

Promotes the Hadamard from tests/-only spec reference (added in PR #23) to a public src/ symbol — void daedalus_h264_chroma_dc_hadamard_2x2(int16_t c[4]). Pure CPU primitive (4 adds + 4 subs); no substrate-dispatch wrapper needed.

All 8 tests PASS including a new public-API parity test that links against the public symbol and verifies it produces byte-identical output to the spec ref.

Unblocks marfrit-packages substitution arc patch 0011 — H264DSPContext.chroma_dc_dequant_idct will compose this Hadamard with QP-dependent scaling and re-injection.

Promotes the Hadamard from tests/-only spec reference (added in PR #23) to a public src/ symbol — `void daedalus_h264_chroma_dc_hadamard_2x2(int16_t c[4])`. Pure CPU primitive (4 adds + 4 subs); no substrate-dispatch wrapper needed. All 8 tests PASS including a new public-API parity test that links against the public symbol and verifies it produces byte-identical output to the spec ref. Unblocks marfrit-packages substitution arc patch 0011 — `H264DSPContext.chroma_dc_dequant_idct` will compose this Hadamard with QP-dependent scaling and re-injection.
marfrit added 1 commit 2026-05-25 11:32:07 +00:00
PR #23 added the Hadamard as a test-only spec reference; this PR
promotes it to a public symbol in src/ so consumers (the eventual
marfrit-packages substitution-arc patch 0011) can link against it.

  New: void daedalus_h264_chroma_dc_hadamard_2x2(int16_t c[4]);
       — operates in-place on 4 int16, no QP-dependent scaling
       (caller composes that themselves per §8.5.11.2).

The src/ implementation is byte-for-byte identical to the test-only
ref in tests/h264_chroma_dc_hadamard_ref.c (kept as a separate
spec-validation copy).  A new "public API parity" test case verifies
the two produce identical output for a non-trivial input.

Pure CPU primitive — no substrate-dispatch wrapper because the work
is 4 adds + 4 subs; the substrate machinery would cost more than
the kernel itself.

Verified on hertz:

  $ ./build/test_chroma_dc_hadamard
    all-uniform 5                    PASS
    col gradient [0,10,0,10]         PASS
    row gradient [0,0,10,10]         PASS
    anti-diagonal [10,0,0,10]        PASS
    asymmetric [1,2,3,4]             PASS
    sign-alternating [-5,5,-5,5]     PASS
    double-Hadamard = 4*orig         PASS
    public API parity vs _ref        PASS

  ALL chroma DC Hadamard tests PASS

  $ nm -g build/libdaedalus_core.a | grep chroma_dc_hadamard
  0000000000000000 T daedalus_h264_chroma_dc_hadamard_2x2

Unblocks marfrit-packages 0011 (substituting
H264DSPContext.chroma_dc_dequant_idct, which composes the Hadamard
+ qmul scaling).
marfrit merged commit b9f9ff2a89 into main 2026-05-25 11:35:17 +00:00
marfrit deleted branch noether/h264-chroma-dc-hadamard-api 2026-05-25 11:35:25 +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/daedalus-fourier#25