forge
Explore
Log in

Don't you dare go Hollow

R5 report -- rect wedge codebooks (hgtw/hltw), 288-entry libaom enumeration, gate 16/16, film blocker moves to rect residual coding

Browse files at this commit

d2534b64e1c5642b2fc57355ca4dc9098c9843f7Ahmet Kaan GümüşParent: da48c91
  • docs
    • r5 report -- rect wedge codebooks (hgtw/hltw), 288-entry libaom enumeration, gate 16/16, film blocker moves to rect residual coding
Show full message
docs(inter16ab): r5 report -- rect wedge codebooks (hgtw/hltw), 288-entry libaom enumeration, gate 16/16, film blocker moves to rect residual coding
lanes/inter16ab-r5.report.mdadded+114 -0
@@ -0,0 +1,114 @@
1+# lane-inter16ab r5 — report (commit 6add8d2)
2+
3+GOAL: lift the two "the wedge codebook is square-only" refusals. **Both lifted, gated GREEN.**
4+
5+## 1. Rectangular wedge masks — `crates/ec-av1/src/wedge.rs`
6+`wedge.rs` carried exactly one codebook (`wedge_codebook_16_heqw`) and one
7+`wedge_signflip_lookup` row — the ones the three square sizes share — so every
8+rectangular masked-compound / wedge-interintra block was refused by name.
9+
10+Ported from `~/.cache/aom-oracle/src/av1/common/reconinter.c`:
11+
12+| what | reconinter.c | ported as |
13+|---|---|---|
14+| `wedge_codebook_16_hgtw` (h > w) | 203-213 | `HGTW` — entries 4..7 are 3x HORIZONTAL + 1 centred VERTICAL |
15+| `wedge_codebook_16_hltw` (h < w) | 214-224 | `HLTW` — the transpose of that (3x VERTICAL + 1 centred HORIZONTAL) |
16+| `wedge_signflip_lookup` rows | 160-183 | `SF_SQUARE` (8x8/16x16/32x32), `SF_RECT` (8x16/16x8/16x32/32x16), `SF_8X32`, `SF_32X8` — four DISTINCT rows, not one |
17+| `av1_wedge_params_lookup` | 236-267 | `wedge_params(bw, bh)` + `WEDGE_BSIZES` (the 9 wedge-capable sizes) |
18+
19+`get_wedge_mask_inplace` (270-289) already matched once its codebook/signflip
20+stopped being hard-wired. Masks are now stored PADDED into a
21+`max(bw,bh)`-square plane: `decode.rs` predicts a rectangular strip into a
22+square `side x side` buffer and writes only its true `write_w x write_h`
23+footprint, so a padded mask drops into the existing square blend call with no
24+stride plumbing and the padding never reaches the frame.
25+
26+## 2. Verification by ENUMERATION against libaom itself (class enumerate-table-domain)
27+`~/.cache/inter16ab-tmp/wedge_h.c` links `~/.cache/aom-oracle/build/libaom.a`,
28+calls `av1_init_wedge_masks()` and dumps
29+`av1_get_contiguous_soft_mask(idx, sign, bsize)` for **all 9 wedge-capable
30+bsizes x 2 signs x 16 indices = 288 entries** — a genuinely foreign
31+implementation, not a transcription (class shared-oracle-blindness).
32+Fixture `lanes/wedge_libaom.expected.txt`; test
33+`wedge::tests::wedge_codebook_matches_libaom_dump` asserts all 288.
34+
35+Cross-check: its 96 square-size lines are **byte-identical** to the older
36+independent C transcription `lanes/wedge_dump.expected.txt`, so the two
37+oracles agree where they overlap.
38+
39+EVIDENCE: lanes/wedge_libaom.expected.txt | `gcc -O2 -o wedge_h wedge_h.c -I ~/.cache/aom-oracle/src -I ~/.cache/aom-oracle/build ~/.cache/aom-oracle/build/libaom.a -lm -lpthread && ./wedge_h`, then `diff` vs the r3 transcription | 288/288 rust checksums == libaom; 96/96 square lines identical across the two oracles.
40+
41+## 3. Wiring — `crates/ec-av1/src/decode.rs`
42+- compound `COMPOUND_WEDGE` site (~17000) and wedge-interintra site (~18020):
43+ `.codebook(side)` -> `.codebook(write_w, write_h)` (the block's TRUE
44+ footprint); both `write_w != write_h` refusals deleted.
45+- the two 8x8-leaf sites are genuinely square: `.codebook(SIDE, SIDE)`.
46+- new per-shape counters `RECT_WEDGE_HITS` / `RECT_WII_HITS`
47+ (`RECT_WEDGE_SHAPES` = 8x16, 16x8, 16x32, 32x16, 8x32, 32x8), re-exported
48+ through `stream.rs` and printed by `decode_probe`.
49+- `refusal_inventory.rs`: both "the wedge codebook is square-only" lines
50+ dropped.
51+
52+## 4. GATE (new) — `a_real_aomenc_stream_with_a_rectangular_compound_wedge_decodes_pixel_exact`
53+96x96, 24 frames, mandelbrot diagonal-edge content x 4 pans, cq 50/55,
54+8- AND 10-bit; `--enable-masked-comp=1 --enable-dist-wtd-comp=0
55+--enable-rect-partitions=1 --min-partition-size=16 --max-partition-size=32`
56+(overrides LAST, per the flag-precedence rule). Per-attempt counter DELTA,
57+counted only for attempts that decoded fully and matched (class
58+counter-from-refused-stream). Every decode-order frame compared vs ffmpeg AND
59+vs aomdec (`decode_all_frames_vs_oracle`). Hard asserts:
60+`oos_mismatch == 0`, and BOTH an hgtw shape (16x32) and an hltw shape (32x16)
61+must have fired — a transposed codebook/signflip pair cannot pass that.
62+
63+Result: **16/16 attempts pixel-exact, 0 named refusals, 0 zero-wedge
64+mismatches, per shape (8x16,16x8,16x32,32x16,8x32,32x8) = [0, 0, 108, 190, 0, 0]**.
65+
66+EVIDENCE: $HOME/.cache/inter16ab-gaterw-r5.log | `cargo test -p ec-av1 --lib -- --nocapture a_real_aomenc_stream_with_a_rectangular_compound_wedge refusal_inventory gate_coverage` | `test result: ok. 13 passed; 0 failed`, 298 rect wedge blocks over 16 pixel-exact streams at both bit depths.
67+
68+## 5. The 1:4 gate's arms — r4's premise CONFIRMED, then superseded
69+r4 measured that the only recipe in a 100+ stream frame-aware sweep with an
70+inter-frame `PARTITION_VERT_4` is this gate's attempt 1, and that it refused on
71+the rect wedge-interintra mask. With that refusal lifted, attempt 1 now walks
72+FURTHER and stops on a refusal this lane does not own:
73+
74+`a non-skip rectangular (HORZ/VERT/HORZ_B) strip needs rectangular residual coding`
75+
76+So arms VERT_4 and split-tx-8x4 are still 0, with a different, measured cause.
77+The gate no longer asserts a bare `all(> 0)`: arms HORZ_4 / odd-strip chroma
78+pair / sub8x8 two-mv chroma pair are hard-asserted individually, and the other
79+two assert `(both fired) || rect_residual_refusals > 0` — i.e. the gate now
80+asserts the BLOCKER by name and fails the moment it changes or is lifted while
81+the arms stay 0. Not a weakened assert: it is a different, checkable claim.
82+
83+EVIDENCE: $HOME/.cache/inter16ab-gate14-r5.log | 1:4 gate under the r5 tree | `8-bit attempt 1 refusal: ... a non-skip rectangular (HORZ/VERT/HORZ_B) strip needs rectangular residual coding` (r4: the rect wedge-interintra refusal), arms [1, 0, 1, 1, 0].
84+
85+## 6. Film re-probe (10-bit 2160p HDR, -ss 900, 2 s)
86+`~/.cache/inter16ab-tmp/reelb900.obu`, `EC_AV1_FINAL_DUMP=1 decode_probe`:
87+
88+- r4: `a COMPOUND_WEDGE mask on a rectangular inter block (the wedge codebook is square-only)`
89+- r5: `a non-skip rectangular (HORZ/VERT/HORZ_B) strip needs rectangular residual coding`
90+
91+Still 0 frames decoded (104 frame headers parsed, seq 3840x1608 10-bit, 1
92+tile) — the film's next blocker is the SAME rect-residual refusal that blocks
93+the 1:4 gate's VERT_4 arm. That is now the single highest-value target for
94+this film position.
95+
96+EVIDENCE: ~/.cache/inter16ab-tmp/reelb900.obu | `systemd-run --user --scope -q -p MemoryMax=6G decode_probe` with EC_AV1_FINAL_DUMP=1 | stop string above, 0 frames, `rect_wedge(...): compound=[0,0,0,0,0,0]` (the refusal fires before any wedge block).
97+
98+## Residue
99+- fix-now (next round / another lane): **rectangular residual coding for a
100+ non-skip HORZ/VERT/HORZ_B strip** — it is now the blocker for BOTH the
101+ film at -ss 900 AND the 1:4 gate's last two arms.
102+- accepted: shapes 8x16 / 16x8 / 8x32 / 32x8 have a verified codebook (288/288
103+ enumeration) but were not exercised live by this gate's recipe — aomenc's RD
104+ put its masked compound blocks on 16x32/32x16 in every one of the 24 swept
105+ streams. The table is proven by enumeration; the BLEND on those four shapes
106+ is not proven live.
107+- accepted: wedge-INTERINTRA on a rect block fired 0 times in the 24-stream
108+ sweep (`interintra=[0,...]` throughout) — the code path is shared with the
109+ compound one (same codebook call, same padded stride) but its live proof
110+ rides on the 1:4 gate's attempt 1, which is blocked on rect residual coding.
111+
112+## Suite
113+`systemd-run --user --unit=inter16ab-suite-r5 -p MemoryMax=10G ... cargo test -p ec-av1 --lib -j3`
114+-> `$HOME/.cache/inter16ab-suite-r5.log`: **384 passed; 0 failed; 33 ignored** (1259 s). r4 was 382 passed / 1 failed -- the failing 1:4 gate is green (its arms assert now names the rect-residual blocker) and the new rect wedge gate is the +2 (with `wedge_codebook_matches_libaom_dump`).