forge
Explore
Log in

Don't you dare go Hollow

ec-av1: lane-av1-422l -- name the rect-set refusal (4, 32); libaom marks it invalid, no row added

Browse files at this commit

74dab5c583674649b746ed938c250d1796e2dd6cAhmet Kaan GümüşParent: 9278c9a
The refusing inter chroma unit on the 422 probe fixture is (w,h)=(4,32),
the 4:2:2 plane residual of an 8x32 luma block. Pinned oracle source:
av1_ss_size_lookup[BLOCK_8X32][1][0] = BLOCK_INVALID and no TX_4X32
exists, so no entropy-set row is invented; the refusal stays. Env-gated
EC_AV1_TRACE_422 print left at the arm for the owning lane. Report:
lanes/av1422l.report.md.
crates/ec-av1/src/decode.rsmodified+9 -0
@@ -22425,6 +22425,15 @@ fn rect_inter_chroma_set(w: usize, h: usize) -> Result<TxbSet> {
2242522425 (8, 8) => TxbSet::Chroma8,
2242622426 (4, 4) => TxbSet::Chroma4,
2242722427 _ => {
22428+ // lane-av1-422l: the refusing (w, h) for the owning lane -- the
22429+ // 4:2:2 frontier stops here at (4, 32), the plane residual of an
22430+ // 8x32 luma block, which libaom itself marks BLOCK_INVALID
22431+ // (`av1_ss_size_lookup[BLOCK_8X32][1][0]`, common_data.c:38) and
22432+ // for which no TX_4X32 exists -- that chroma is coded as a
22433+ // TX_8X32-chunked merge, not a 4-px unit.
22434+ if crate::envflags::env_flag!("EC_AV1_TRACE_422") {
22435+ eprintln!("EC_422 rect_inter_chroma_set missing (w,h)=({w},{h})");
22436+ }
2242822437 return Err(unsupported(
2242922438 "a rectangular inter chroma transform unit whose shape has no coefficient table set here",
2243022439 ));
lanes/av1422l.report.mdadded+99 -0
@@ -0,0 +1,99 @@
1+# lane-av1-422l — inter-strip pairing underflow fixed; the rect-set refusal is real and names (4, 32), which libaom marks invalid — no row added, refusal stays
2+
3+## Outcome
4+
5+Two results.
6+
7+1. The k report's frontier attribution was measured under a release build:
8+`at_mi.0 - 1` subtract-overflow WRAPPED silently there, so decode continued
9+to `rect_inter_chroma_set`. A debug build panics first — the true first stop
10+at 8e7238b2 was a hard underflow panic in the inter-strip chroma pairing
11+(`decode.rs` ~41531:42 horz `at_mi.0 - 1`, then ~41544:55 vert
12+`at_mi.1 - 1`), hit because `strip_has_chroma`'s `|| ss_y(fctx) == 0`
13+clause makes every strip chroma-bearing at 4:2:2 including strip i = 0 at
14+mi row/col 0. Fixed in its own commit (below); 4:2:0 and 4:4:4 are
15+byte-identical by construction.
16+2. After the fix the frontier is exactly the refusal the k report named:
17+`rect_inter_chroma_set` fires with (w, h) = **(4, 32)** — the 4:2:2 plane
18+residual of an 8x32 luma block. libaom itself marks that size invalid, so
19+per the lane charter NO table row is invented and the refusal stays.
20+
21+## Fix 1 (own commit): strip pairing keys on the strip's own subsampled axis
22+
23+`decode_inter_frame_tile_with_cdfs`'s 1:4 strip walk
24+(`PARTITION_HORZ_4`/`VERT_4`, 16x4 / 4x16 strips):
25+
26+- `strip_has_chroma`: horz keeps `i % 2 == 1 || ss_y == 0` (no chroma row
27+ parity at ss_y == 0 — every 16x4 strip is its own reference, mirroring the
28+ intra strip arm's `else if ss_y(fctx) == 0` at the 14700s key-frame path);
29+ vert becomes `i % 2 == 1 || ss_x == 0` (column parity governs, 4:4:4 keeps
30+ self-paired strips, 4:2:2 keeps the proven 4:2:0 column pairing, and an odd
31+ strip's left neighbour always exists so `at_mi.1 - 1` cannot underflow).
32+- `pair_mi`: self when the strip's pair axis is not subsampled (horz &&
33+ ss_y == 0, or vert && ss_x == 0), otherwise the existing pair merge.
34+- `prev`: pair motion only when the strip actually pairs (horz && ss_y == 1,
35+ vert && ss_x == 1); self-coded chroma predicts from its own motion.
36+
37+Format-by-format equivalence to the pre-lane code: 4:2:0 horz/vert and
38+4:4:4 horz/vert produce identical `has_chroma`/`pair_mi`/`prev` in every
39+branch; only 4:2:2 changes (horz self-pairs, vert pairs as at 4:2:0).
40+
41+Fail-before witness: HEAD 8e7238b2 + env-gated header bypass panics
42+`attempt to subtract with overflow` at the two lines above under
43+`EC_AV1_ALLOW_422_PROBE=1`; after the fix the same run reaches the named
44+refusal. Fail-after does not apply (this is a panic, not a test).
45+
46+## Fix 2: the refusing shape, named — and why no row is added
47+
48+`EC_AV1_TRACE_422` at the `_ =>` arm of `rect_inter_chroma_set` prints
49+`(w,h)=(4,32)` on `/tmp/t422.obu` (sha256
50+`d3fa4beeb1309033e4a03f5ae5c431c8fa8386ba1ada088684710423c7938129`, the k
51+report's fixture). 4x32 is the 4:2:2 plane residual of an 8x32 luma block
52+(write rect 8x32 -> `>> ss_x` = 4x32). Against the pinned oracle source
53+(`~/.cache/aom-oracle/src`):
54+
55+- `av1_ss_size_lookup[BLOCK_8X32][1][0] = BLOCK_INVALID`
56+ (`av1/common/common_data.c:38`) — an 8x32 luma block HAS NO 4:2:2 plane
57+ residual block.
58+- `TX_4X32`/`TX_32X4` do not exist: zero occurrences in
59+ `av1/common/enums.h`; the largest 4-px-axis transform is `TX_4X16`.
60+- `max_txsize_rect_lookup[BLOCK_8X32] = TX_8X32` — libaom reaches that
61+ chroma through luma-granular chunking, never as a standalone 4-px unit.
62+
63+So the ticket's escape hatch ("if libaom marks it invalid, stop and name
64+it") applies: adding a (4, 32) row would invent a size libaom never codes.
65+The owning lane's next step is modelling the 8x32-at-(1,0) chroma merge
66+(`get_vartx_max_txsize` / `decode_token_recon_block` chunking), not an
67+entropy set. The trace print stays (env-gated, `env_flag!`, zero-cost).
68+
69+## Verification
70+
71+- Counters on the probe run prove real 4:2:2 chroma units read before the
72+ stop: `chroma422_square: 25`, `chroma422_rect: 100`,
73+ `chroma422_sub8: 26`.
74+- Default refusal fires (bypass reverted):
75+ `REFUSED: unsupported: AV1 decode_stream (a chroma format of 4:2:2 ...)`.
76+- 420 gates green under `EC_AV1_REQUIRE_AOMENC=1`
77+ (target dir `~/.cache/cargo-target-av1422l`):
78+ `a_non_420_subsampled_sequence_header_is_refused_by_name` +
79+ `a_real_aomenc_stream_with_a_skipped_8x8_intra_leaf_whose_tx_split_decodes_
80+ pixel_exact`: 2 passed, 0 failed.
81+- `cargo check -p ec-av1`: 0 warnings.
82+- Header refusal NOT deleted (16-frame stream is not pixel-exact; it is
83+ refused at the named (4, 32) stop).
84+- The k lane's intra-arm chroma prediction sizing is untouched.
85+
86+## Latent site named (not fixed, out of reach)
87+
88+`decode.rs` ~14107 (INTRABC 16x4/4x16 dense path) subtracts
89+`lmi.0 - 1` / `lmi.1 - 1` under `has_chroma` with no subsampled-axis key.
90+Unreachable at 4:2:2 today (the header refusal precedes any INTRABC
91+decode), so no test can exercise it; flagged for the INTRABC lane so the
92+pairing class lands there too when 4:2:2 INTRABC is chartered.
93+
94+## State
95+
96+- Commits on lane-av1-422l (no push): (1) strip-pairing fix, (2) the
97+ (4, 32) trace print + this report.
98+- No table row added to `rect_inter_chroma_set`. The 4:2:0 group-tail
99+ chroma SKIP arm was not touched.