From 74dab5c583674649b746ed938c250d1796e2dd6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Fri, 25 Sep 2026 10:38:07 +0300 Subject: [PATCH] ec-av1: lane-av1-422l -- name the rect-set refusal (4, 32); libaom marks it invalid, no row added 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.rs | 9 ++++ lanes/av1422l.report.md | 99 +++++++++++++++++++++++++++++++++++++ 2 files changed, 108 insertions(+) create mode 100644 lanes/av1422l.report.md diff --git a/crates/ec-av1/src/decode.rs b/crates/ec-av1/src/decode.rs index 23ab70b1..91ca47f1 100644 --- a/crates/ec-av1/src/decode.rs +++ b/crates/ec-av1/src/decode.rs @@ -22425,6 +22425,15 @@ fn rect_inter_chroma_set(w: usize, h: usize) -> Result { (8, 8) => TxbSet::Chroma8, (4, 4) => TxbSet::Chroma4, _ => { + // lane-av1-422l: the refusing (w, h) for the owning lane -- the + // 4:2:2 frontier stops here at (4, 32), the plane residual of an + // 8x32 luma block, which libaom itself marks BLOCK_INVALID + // (`av1_ss_size_lookup[BLOCK_8X32][1][0]`, common_data.c:38) and + // for which no TX_4X32 exists -- that chroma is coded as a + // TX_8X32-chunked merge, not a 4-px unit. + if crate::envflags::env_flag!("EC_AV1_TRACE_422") { + eprintln!("EC_422 rect_inter_chroma_set missing (w,h)=({w},{h})"); + } return Err(unsupported( "a rectangular inter chroma transform unit whose shape has no coefficient table set here", )); diff --git a/lanes/av1422l.report.md b/lanes/av1422l.report.md new file mode 100644 index 00000000..cc12551f --- /dev/null +++ b/lanes/av1422l.report.md @@ -0,0 +1,99 @@ +# 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 + +## Outcome + +Two results. + +1. The k report's frontier attribution was measured under a release build: +`at_mi.0 - 1` subtract-overflow WRAPPED silently there, so decode continued +to `rect_inter_chroma_set`. A debug build panics first — the true first stop +at 8e7238b2 was a hard underflow panic in the inter-strip chroma pairing +(`decode.rs` ~41531:42 horz `at_mi.0 - 1`, then ~41544:55 vert +`at_mi.1 - 1`), hit because `strip_has_chroma`'s `|| ss_y(fctx) == 0` +clause makes every strip chroma-bearing at 4:2:2 including strip i = 0 at +mi row/col 0. Fixed in its own commit (below); 4:2:0 and 4:4:4 are +byte-identical by construction. +2. After the fix the frontier is exactly the refusal the k report named: +`rect_inter_chroma_set` fires with (w, h) = **(4, 32)** — the 4:2:2 plane +residual of an 8x32 luma block. libaom itself marks that size invalid, so +per the lane charter NO table row is invented and the refusal stays. + +## Fix 1 (own commit): strip pairing keys on the strip's own subsampled axis + +`decode_inter_frame_tile_with_cdfs`'s 1:4 strip walk +(`PARTITION_HORZ_4`/`VERT_4`, 16x4 / 4x16 strips): + +- `strip_has_chroma`: horz keeps `i % 2 == 1 || ss_y == 0` (no chroma row + parity at ss_y == 0 — every 16x4 strip is its own reference, mirroring the + intra strip arm's `else if ss_y(fctx) == 0` at the 14700s key-frame path); + vert becomes `i % 2 == 1 || ss_x == 0` (column parity governs, 4:4:4 keeps + self-paired strips, 4:2:2 keeps the proven 4:2:0 column pairing, and an odd + strip's left neighbour always exists so `at_mi.1 - 1` cannot underflow). +- `pair_mi`: self when the strip's pair axis is not subsampled (horz && + ss_y == 0, or vert && ss_x == 0), otherwise the existing pair merge. +- `prev`: pair motion only when the strip actually pairs (horz && ss_y == 1, + vert && ss_x == 1); self-coded chroma predicts from its own motion. + +Format-by-format equivalence to the pre-lane code: 4:2:0 horz/vert and +4:4:4 horz/vert produce identical `has_chroma`/`pair_mi`/`prev` in every +branch; only 4:2:2 changes (horz self-pairs, vert pairs as at 4:2:0). + +Fail-before witness: HEAD 8e7238b2 + env-gated header bypass panics +`attempt to subtract with overflow` at the two lines above under +`EC_AV1_ALLOW_422_PROBE=1`; after the fix the same run reaches the named +refusal. Fail-after does not apply (this is a panic, not a test). + +## Fix 2: the refusing shape, named — and why no row is added + +`EC_AV1_TRACE_422` at the `_ =>` arm of `rect_inter_chroma_set` prints +`(w,h)=(4,32)` on `/tmp/t422.obu` (sha256 +`d3fa4beeb1309033e4a03f5ae5c431c8fa8386ba1ada088684710423c7938129`, the k +report's fixture). 4x32 is the 4:2:2 plane residual of an 8x32 luma block +(write rect 8x32 -> `>> ss_x` = 4x32). Against the pinned oracle source +(`~/.cache/aom-oracle/src`): + +- `av1_ss_size_lookup[BLOCK_8X32][1][0] = BLOCK_INVALID` + (`av1/common/common_data.c:38`) — an 8x32 luma block HAS NO 4:2:2 plane + residual block. +- `TX_4X32`/`TX_32X4` do not exist: zero occurrences in + `av1/common/enums.h`; the largest 4-px-axis transform is `TX_4X16`. +- `max_txsize_rect_lookup[BLOCK_8X32] = TX_8X32` — libaom reaches that + chroma through luma-granular chunking, never as a standalone 4-px unit. + +So the ticket's escape hatch ("if libaom marks it invalid, stop and name +it") applies: adding a (4, 32) row would invent a size libaom never codes. +The owning lane's next step is modelling the 8x32-at-(1,0) chroma merge +(`get_vartx_max_txsize` / `decode_token_recon_block` chunking), not an +entropy set. The trace print stays (env-gated, `env_flag!`, zero-cost). + +## Verification + +- Counters on the probe run prove real 4:2:2 chroma units read before the + stop: `chroma422_square: 25`, `chroma422_rect: 100`, + `chroma422_sub8: 26`. +- Default refusal fires (bypass reverted): + `REFUSED: unsupported: AV1 decode_stream (a chroma format of 4:2:2 ...)`. +- 420 gates green under `EC_AV1_REQUIRE_AOMENC=1` + (target dir `~/.cache/cargo-target-av1422l`): + `a_non_420_subsampled_sequence_header_is_refused_by_name` + + `a_real_aomenc_stream_with_a_skipped_8x8_intra_leaf_whose_tx_split_decodes_ + pixel_exact`: 2 passed, 0 failed. +- `cargo check -p ec-av1`: 0 warnings. +- Header refusal NOT deleted (16-frame stream is not pixel-exact; it is + refused at the named (4, 32) stop). +- The k lane's intra-arm chroma prediction sizing is untouched. + +## Latent site named (not fixed, out of reach) + +`decode.rs` ~14107 (INTRABC 16x4/4x16 dense path) subtracts +`lmi.0 - 1` / `lmi.1 - 1` under `has_chroma` with no subsampled-axis key. +Unreachable at 4:2:2 today (the header refusal precedes any INTRABC +decode), so no test can exercise it; flagged for the INTRABC lane so the +pairing class lands there too when 4:2:2 INTRABC is chartered. + +## State + +- Commits on lane-av1-422l (no push): (1) strip-pairing fix, (2) the + (4, 32) trace print + this report. +- No table row added to `rect_inter_chroma_set`. The 4:2:0 group-tail + chroma SKIP arm was not touched.