Commit 52e44f5
committed
feat(codec): PR-X12 v1 — λ-RDO mode selection + rANS entropy coder
Completes the x265-shaped cognitive codec to a usable v1 by adding the
two stages the board tracked as missing (RDO + ANS):
- `codec::rdo` (A6) — λ-rate-distortion mode selection: scores all four
modes by `(rate << 8) + λ_q8·distortion` and picks the minimum. The
soft, cost-weighted generalization of `predict_intra`'s hard tree. Uses
an integer fixed-point λ (λ × 256) rather than the design's f32, for
deterministic, cross-platform-bit-exact decisions consistent with the
substrate's no-float discipline.
- `codec::ans` (A7) — static-table rANS over the 4-symbol mode alphabet
(Skip/Merge/Delta/Escape). Self-contained stream (count + normalized
freq table + payload); bit-exact round-trip. Chosen over CABAC per the
design's open-Q1 ruling.
Grounded against the existing integer-only LeafCu/CellMode/MergeDir and
the 2/3/3/6-byte wire format; transform (A4) stays deferred to v2 per
design Q2, stream (A8) is the remaining follow-on.
81 lib tests + 20 doctests green; clippy -D warnings clean.
https://claude.ai/code/session_01HbqooFZHAjaUtFEzhA1R2u1 parent d67b6d4 commit 52e44f5
4 files changed
Lines changed: 1007 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
38 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
39 | 41 | | |
40 | 42 | | |
41 | 43 | | |
| |||
0 commit comments