From 2b68d1d40daf6286a4d2dafc9a0d403da280de36 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 12:39:11 +0300 Subject: [PATCH] lane-av1-ll64: the rect64 64x32 chroma row is named and closed, not invented libaom has no such transform to add: av1_get_tx_size forces TX_4X4 for every plane at lossless (blockd.h:1383) and av1_get_adjusted_tx_size collapses TX_64X32/32X64 to TX_32X32 for chroma outside it (blockd.h:1361-1367), so the four 64-axis chroma shapes are never one coded unit -- the lossless arm already walks them as TX_4X4 units and the chroma_tiled arm already tiles them. The EC_RECTCHROMA_GAP diagnostic fired on exactly those working routes and mislabelled them a gap (one lane report cited it as a decode stop); it now fires only at the refusal's exact precondition and names the libaom verdict. No decode-path edit: refusal wording byte-identical, 4:2:0 zero-change, decode_rect4_16_strip untouched. Gates: 6-frame inter gate pixel-exact through aomdec and ffmpeg; key-frame gate run for real on the pinned ll444-lossless-key bytes; both 4:2:0 lossless gates green. cargo check 0 warnings. --- crates/ec-av1/src/decode.rs | 25 +++++++-- lanes/av1ll64.report.md | 108 ++++++++++++++++++++++++++++++++++++ 2 files changed, 127 insertions(+), 6 deletions(-) create mode 100644 lanes/av1ll64.report.md diff --git a/crates/ec-av1/src/decode.rs b/crates/ec-av1/src/decode.rs index c62e404a..6e27f93a 100644 --- a/crates/ec-av1/src/decode.rs +++ b/crates/ec-av1/src/decode.rs @@ -10103,6 +10103,10 @@ fn decode_rect_split( (4, 8) => Some((TxbSet::ChromaRect8x4, &SCAN_4X8[..])), _ => None, }; + // A 4:4:4 64-axis strip's chroma plane block is larger than one adjusted + // UV transform (TX_64X32 adjusts to TX_32X32). Those sizes are tiled + // below; everything else still needs a single-unit table. + let chroma_tiled = matches!((chroma_w, chroma_h), (64, 32) | (32, 64) | (64, 16) | (16, 64)); if !m.skip { if let Some(i) = match (chroma_w, chroma_h) { (32, 8) => Some(0), @@ -10119,11 +10123,24 @@ fn decode_rect_split( }); } } - if chroma.is_none() { + if chroma.is_none() && !chroma_tiled { // Diagnostic for the next caller that lands here (class // refusal-names-a-correlate: the message names the tool, not the // shape); the refusal below keeps its inventory-pinned wording. - eprintln!("EC_RECTCHROMA_GAP luma={bw}x{bh} tx={tx_w}x{tx_h} chroma={chroma_w}x{chroma_h}"); + // The condition is the refusal's exact precondition, so the + // print can never fire without the refusal (or vice versa): the + // four 64-axis chroma shapes are tiled below and at LOSSLESS the + // 4x4 walk never consults `chroma` at all -- libaom has no such + // transform to name a row for (`av1_get_tx_size` returns TX_4X4 + // for every plane at lossless, blockd.h:1383; outside it + // `av1_get_adjusted_tx_size` collapses TX_64X32/32X64 to TX_32X32 + // for chroma, blockd.h:1361-1367). lane-av1-ll64: the old + // ungated print fired on those working routes and mislabelled + // them a gap (one lane report cited it as a decode stop). + eprintln!( + "EC_RECTCHROMA_GAP luma={bw}x{bh} tx={tx_w}x{tx_h} \ + chroma={chroma_w}x{chroma_h} libaom_lossless_tx=none" + ); } } // lane-rectsplit r2 (verifier finding): with both callers wired @@ -10133,10 +10150,6 @@ fn decode_rect_split( // caller -- a new strip size would otherwise hit the `expect` below and // panic instead of refusing by name -- and so stays in // `refusal_inventory::REFUSALS`. - // A 4:4:4 64-axis strip's chroma plane block is larger than one adjusted - // UV transform (TX_64X32 adjusts to TX_32X32). Those sizes are tiled - // below; everything else still needs a single-unit table. - let chroma_tiled = matches!((chroma_w, chroma_h), (64, 32) | (32, 64) | (64, 16) | (16, 64)); if !m.skip && chroma.is_none() && !chroma_tiled { return Err(unsupported( "a coded HORZ/VERT strip whose chroma transform has no rect coefficient tables here", diff --git a/lanes/av1ll64.report.md b/lanes/av1ll64.report.md new file mode 100644 index 00000000..fdc920ca --- /dev/null +++ b/lanes/av1ll64.report.md @@ -0,0 +1,108 @@ +# lane-av1-ll64: the rect64-route 64x32 chroma row — named, not invented (r1) + +## Ticket + +Default-partition lossless 4:4:4 stops at a missing 64x32 chroma lossless +coefficient row on the rect64 route (the `EC_RECTCHROMA_GAP luma=64x32 +tx=4x4 chroma=64x32` diagnostic `lane-av1-llinter2` deferred here). Name +the row; add it only if libaom has that transform; do not invent one. +`decode_rect4_16_strip` is off-limits (owned by the lossless-444 strip +lane). + +## The named row + +The `chroma` match in `decode_rect_split` (decode.rs:10086) has no +`(64, 32)`/`(32, 64)` arm: a 4:4:4 64-axis strip's chroma plane block +cannot be coded as ONE rect unit here. That missing arm is the row the +gap print names. + +## libaom verdict (oracle source, measured): no such transform — row NOT added + +- Lossless: `av1_get_tx_size` returns TX_4X4 for EVERY plane + (`av1/common/blockd.h:1383`), so a 64x32 chroma plane block codes as a + plane-major raster of TX_4X4 units (16x8 = 128 per plane at 4:4:4). + There is no 64x32 lossless transform at all. +- Non-lossless: `av1_get_max_uv_txsize` routes chroma through + `av1_get_adjusted_tx_size` (`blockd.h:1361-1367`), which collapses + TX_64X32 and TX_32X64 to TX_32X32. A chroma transform wider/taller + than 32 is never one coded unit. + +Per ticket step 3: libaom marks the single-unit 64x32 chroma transform +not-codeable ⇒ STOP; no row invented. + +## The route truth: nothing stops at HEAD — the print was a false gap + +`decode_rect_split`'s arms already cover every shape that reaches it: + +- LOSSLESS: the 4x4 walk (decode.rs `else if lossless(fctx)`) is + shape-agnostic — for a (64,32) chroma block it walks 128 plane-major + `TxbSet::Chroma4` units with `4 << ss` spans, which IS the libaom + behavior above. The same code the key-frame gate proves on 16x8 + strips. +- Non-lossless: `chroma_tiled` tiles those four shapes as 32x32 / + 32x16 units (the 10-bit film gates' verified path). + +The old diagnostic fired whenever `chroma` was None and `!m.skip` — +INCLUDING on those two working routes, printing a "GAP" for shapes the +function decodes correctly. That false print is what `lane-av1-llinter2`'s +report cited as a "named non-panic stop" of default-partition `ll444.obu`. + +## Change (one diagnostic, no decode-path edit) + +decode.rs only: the `EC_RECTCHROMA_GAP` print's condition is now the +refusal's exact precondition (`chroma.is_none() && !chroma_tiled` inside +the existing `!m.skip`, so print↔refusal can never diverge), and its +message states the libaom verdict (`libaom_lossless_tx=none`). The +inventory-pinned refusal wording is byte-identical; every coefficient +read, CDF, span and neighbour stamp untouched. `chroma_tiled`'s `let` +moved above its new first use; its explanatory comments stay with it. +4:2:0: zero-change (a 64x32 luma strip is 32x16 chroma there — a row +that always existed; the print never fired at 4:2:0). + +## Verification (measured, this tree @ HEAD + this change) + +- Encoder sweep (aomenc `--lossless=1 --profile=1`, palette/intrabc off, + contents from testsrc2 to forced HORZ-biased noise, `--cpu-used` 0..8, + partition caps, bottom-edge smooth bands): NO lossless fixture presents + a 64x32 intra strip — at lossless RD the encoder picks NONE/SPLIT, so + the print never fired on any stream, old or new. +- Probes post-change (decode_probe): `ll444.obu` (default partition, 6 + frames) OK 6/6; `force_kf.obu`, `h2.obu` OK; committed + `lossless_sb128_rect_kf.obu` OK 4/4; pinned `ll444_minp64_inter.obu` + OK 6/6; `EC_RECTCHROMA` count 0 on every stream. +- Gates (7 passed, 0 failed): `a_lossless_444_min_partition64_inter_ + stream_decodes_pixel_exact` (6-frame inter gate: pixel-exact through + BOTH oracle aomdec --rawvideo and ffmpeg, counter non-vacuity), + `a_real_aomenc_lossless_444_key_frame_decodes_sample_exact` (run for + real, not SKIP: pinned bytes `fixtures/ll444-lossless-key.obu` copied + from the av1llband2 worktree, sha256 `9fc9ce1f5f6475a1d483f404b44acb9 + 0f72a80be2e5c51dedf0aeb1da9a3f5dc`; fixtures/ is gitignored, nothing + committed from it), both 4:2:0 lossless gates + (`a_lossless_libaom_key_frame_decodes_sample_exact`, + `a_lossless_libaom_inter_frame_decodes_sample_exact`), both + `a_lossless_sb128_*` gates, `a_lossless_16x4_chroma_pair_*`. +- `cargo check -p ec-av1 --all-targets` (target dir + `$HOME/.cache/cargo-target-av1ll64`): 0 warnings, 0 errors. + +## Same-class suspects, measured on scratch streams, deferred (spoken) + +Repro recipe (scratch, regenerable): `testsrc2 128x96 yuv444p`, aomenc +`--profile=1 --lossless=1 --enable-palette=0 --enable-intrabc=0`, +`--max-partition-size=64`, 6 frames. Both defects verified PRE-EXISTING +at 2ac149e3 via `git stash` probe, so neither is caused by this change; +both are the inter sub8 lossless class (a lossless inter route coding a +rect TX unit where `av1_get_tx_size` forces TX_4X4 per plane — the +`decode_inter_block8`/84acbd09 defect class one route over): + +- `decode_inter_sub8_rect2` → `read_inter_plane_rect` → + `push_mc_rect_tx` → `TxParams::run` lossless WHT assert + `(8, 4) != (4, 4)` at decode.rs:2566. deferred(fix-now in the lane + owning the inter sub8 lossless rect route; the fix shape is the + established per-plane TX_4X4 unit walk). +- The 12-frame sibling stream refuses mid-tile: `REFUSED: unsupported: + AV1 tile (a Golomb tail longer than this decoder reads)` — same + route class, downstream desync form. deferred(with the same lane; + likely disappears when the (8,4) read is fixed). + +`decode_rect4_16_strip`'s 4:2:0-hardcoded lossless chroma walk remains +with its owning lane (untouched here, per lane ownership).