lane-av1-ll64: the rect64 64x32 chroma row is named and closed, not invented
Browse files at this commit2b68d1d40daf6286a4d2dafc9a0d403da280de36Parent: 66a65532 changed files +127 -6
- crates/ec-av1/src/decode.rs +19 -6
- lanes/av1ll64.report.md +108 -0
crates/ec-av1/src/decode.rsmodified+19 -6
| @@ -10103,6 +10103,10 @@ fn decode_rect_split( | ||
| 10103 | 10103 | (4, 8) => Some((TxbSet::ChromaRect8x4, &SCAN_4X8[..])), |
| 10104 | 10104 | _ => None, |
| 10105 | 10105 | }; |
| 10106 | + // A 4:4:4 64-axis strip's chroma plane block is larger than one adjusted | |
| 10107 | + // UV transform (TX_64X32 adjusts to TX_32X32). Those sizes are tiled | |
| 10108 | + // below; everything else still needs a single-unit table. | |
| 10109 | + let chroma_tiled = matches!((chroma_w, chroma_h), (64, 32) | (32, 64) | (64, 16) | (16, 64)); | |
| 10106 | 10110 | if !m.skip { |
| 10107 | 10111 | if let Some(i) = match (chroma_w, chroma_h) { |
| 10108 | 10112 | (32, 8) => Some(0), |
| @@ -10119,11 +10123,24 @@ fn decode_rect_split( | ||
| 10119 | 10123 | }); |
| 10120 | 10124 | } |
| 10121 | 10125 | } |
| 10122 | - if chroma.is_none() { | |
| 10126 | + if chroma.is_none() && !chroma_tiled { | |
| 10123 | 10127 | // Diagnostic for the next caller that lands here (class |
| 10124 | 10128 | // refusal-names-a-correlate: the message names the tool, not the |
| 10125 | 10129 | // shape); the refusal below keeps its inventory-pinned wording. |
| 10126 | - eprintln!("EC_RECTCHROMA_GAP luma={bw}x{bh} tx={tx_w}x{tx_h} chroma={chroma_w}x{chroma_h}"); | |
| 10130 | + // The condition is the refusal's exact precondition, so the | |
| 10131 | + // print can never fire without the refusal (or vice versa): the | |
| 10132 | + // four 64-axis chroma shapes are tiled below and at LOSSLESS the | |
| 10133 | + // 4x4 walk never consults `chroma` at all -- libaom has no such | |
| 10134 | + // transform to name a row for (`av1_get_tx_size` returns TX_4X4 | |
| 10135 | + // for every plane at lossless, blockd.h:1383; outside it | |
| 10136 | + // `av1_get_adjusted_tx_size` collapses TX_64X32/32X64 to TX_32X32 | |
| 10137 | + // for chroma, blockd.h:1361-1367). lane-av1-ll64: the old | |
| 10138 | + // ungated print fired on those working routes and mislabelled | |
| 10139 | + // them a gap (one lane report cited it as a decode stop). | |
| 10140 | + eprintln!( | |
| 10141 | + "EC_RECTCHROMA_GAP luma={bw}x{bh} tx={tx_w}x{tx_h} \ | |
| 10142 | + chroma={chroma_w}x{chroma_h} libaom_lossless_tx=none" | |
| 10143 | + ); | |
| 10127 | 10144 | } |
| 10128 | 10145 | } |
| 10129 | 10146 | // lane-rectsplit r2 (verifier finding): with both callers wired |
| @@ -10133,10 +10150,6 @@ fn decode_rect_split( | ||
| 10133 | 10150 | // caller -- a new strip size would otherwise hit the `expect` below and |
| 10134 | 10151 | // panic instead of refusing by name -- and so stays in |
| 10135 | 10152 | // `refusal_inventory::REFUSALS`. |
| 10136 | - // A 4:4:4 64-axis strip's chroma plane block is larger than one adjusted | |
| 10137 | - // UV transform (TX_64X32 adjusts to TX_32X32). Those sizes are tiled | |
| 10138 | - // below; everything else still needs a single-unit table. | |
| 10139 | - let chroma_tiled = matches!((chroma_w, chroma_h), (64, 32) | (32, 64) | (64, 16) | (16, 64)); | |
| 10140 | 10153 | if !m.skip && chroma.is_none() && !chroma_tiled { |
| 10141 | 10154 | return Err(unsupported( |
| 10142 | 10155 | "a coded HORZ/VERT strip whose chroma transform has no rect coefficient tables here", |
lanes/av1ll64.report.mdadded+108 -0
| @@ -0,0 +1,108 @@ | ||
| 1 | +# lane-av1-ll64: the rect64-route 64x32 chroma row — named, not invented (r1) | |
| 2 | + | |
| 3 | +## Ticket | |
| 4 | + | |
| 5 | +Default-partition lossless 4:4:4 stops at a missing 64x32 chroma lossless | |
| 6 | +coefficient row on the rect64 route (the `EC_RECTCHROMA_GAP luma=64x32 | |
| 7 | +tx=4x4 chroma=64x32` diagnostic `lane-av1-llinter2` deferred here). Name | |
| 8 | +the row; add it only if libaom has that transform; do not invent one. | |
| 9 | +`decode_rect4_16_strip` is off-limits (owned by the lossless-444 strip | |
| 10 | +lane). | |
| 11 | + | |
| 12 | +## The named row | |
| 13 | + | |
| 14 | +The `chroma` match in `decode_rect_split` (decode.rs:10086) has no | |
| 15 | +`(64, 32)`/`(32, 64)` arm: a 4:4:4 64-axis strip's chroma plane block | |
| 16 | +cannot be coded as ONE rect unit here. That missing arm is the row the | |
| 17 | +gap print names. | |
| 18 | + | |
| 19 | +## libaom verdict (oracle source, measured): no such transform — row NOT added | |
| 20 | + | |
| 21 | +- Lossless: `av1_get_tx_size` returns TX_4X4 for EVERY plane | |
| 22 | + (`av1/common/blockd.h:1383`), so a 64x32 chroma plane block codes as a | |
| 23 | + plane-major raster of TX_4X4 units (16x8 = 128 per plane at 4:4:4). | |
| 24 | + There is no 64x32 lossless transform at all. | |
| 25 | +- Non-lossless: `av1_get_max_uv_txsize` routes chroma through | |
| 26 | + `av1_get_adjusted_tx_size` (`blockd.h:1361-1367`), which collapses | |
| 27 | + TX_64X32 and TX_32X64 to TX_32X32. A chroma transform wider/taller | |
| 28 | + than 32 is never one coded unit. | |
| 29 | + | |
| 30 | +Per ticket step 3: libaom marks the single-unit 64x32 chroma transform | |
| 31 | +not-codeable ⇒ STOP; no row invented. | |
| 32 | + | |
| 33 | +## The route truth: nothing stops at HEAD — the print was a false gap | |
| 34 | + | |
| 35 | +`decode_rect_split`'s arms already cover every shape that reaches it: | |
| 36 | + | |
| 37 | +- LOSSLESS: the 4x4 walk (decode.rs `else if lossless(fctx)`) is | |
| 38 | + shape-agnostic — for a (64,32) chroma block it walks 128 plane-major | |
| 39 | + `TxbSet::Chroma4` units with `4 << ss` spans, which IS the libaom | |
| 40 | + behavior above. The same code the key-frame gate proves on 16x8 | |
| 41 | + strips. | |
| 42 | +- Non-lossless: `chroma_tiled` tiles those four shapes as 32x32 / | |
| 43 | + 32x16 units (the 10-bit film gates' verified path). | |
| 44 | + | |
| 45 | +The old diagnostic fired whenever `chroma` was None and `!m.skip` — | |
| 46 | +INCLUDING on those two working routes, printing a "GAP" for shapes the | |
| 47 | +function decodes correctly. That false print is what `lane-av1-llinter2`'s | |
| 48 | +report cited as a "named non-panic stop" of default-partition `ll444.obu`. | |
| 49 | + | |
| 50 | +## Change (one diagnostic, no decode-path edit) | |
| 51 | + | |
| 52 | +decode.rs only: the `EC_RECTCHROMA_GAP` print's condition is now the | |
| 53 | +refusal's exact precondition (`chroma.is_none() && !chroma_tiled` inside | |
| 54 | +the existing `!m.skip`, so print↔refusal can never diverge), and its | |
| 55 | +message states the libaom verdict (`libaom_lossless_tx=none`). The | |
| 56 | +inventory-pinned refusal wording is byte-identical; every coefficient | |
| 57 | +read, CDF, span and neighbour stamp untouched. `chroma_tiled`'s `let` | |
| 58 | +moved above its new first use; its explanatory comments stay with it. | |
| 59 | +4:2:0: zero-change (a 64x32 luma strip is 32x16 chroma there — a row | |
| 60 | +that always existed; the print never fired at 4:2:0). | |
| 61 | + | |
| 62 | +## Verification (measured, this tree @ HEAD + this change) | |
| 63 | + | |
| 64 | +- Encoder sweep (aomenc `--lossless=1 --profile=1`, palette/intrabc off, | |
| 65 | + contents from testsrc2 to forced HORZ-biased noise, `--cpu-used` 0..8, | |
| 66 | + partition caps, bottom-edge smooth bands): NO lossless fixture presents | |
| 67 | + a 64x32 intra strip — at lossless RD the encoder picks NONE/SPLIT, so | |
| 68 | + the print never fired on any stream, old or new. | |
| 69 | +- Probes post-change (decode_probe): `ll444.obu` (default partition, 6 | |
| 70 | + frames) OK 6/6; `force_kf.obu`, `h2.obu` OK; committed | |
| 71 | + `lossless_sb128_rect_kf.obu` OK 4/4; pinned `ll444_minp64_inter.obu` | |
| 72 | + OK 6/6; `EC_RECTCHROMA` count 0 on every stream. | |
| 73 | +- Gates (7 passed, 0 failed): `a_lossless_444_min_partition64_inter_ | |
| 74 | + stream_decodes_pixel_exact` (6-frame inter gate: pixel-exact through | |
| 75 | + BOTH oracle aomdec --rawvideo and ffmpeg, counter non-vacuity), | |
| 76 | + `a_real_aomenc_lossless_444_key_frame_decodes_sample_exact` (run for | |
| 77 | + real, not SKIP: pinned bytes `fixtures/ll444-lossless-key.obu` copied | |
| 78 | + from the av1llband2 worktree, sha256 `9fc9ce1f5f6475a1d483f404b44acb9 | |
| 79 | + 0f72a80be2e5c51dedf0aeb1da9a3f5dc`; fixtures/ is gitignored, nothing | |
| 80 | + committed from it), both 4:2:0 lossless gates | |
| 81 | + (`a_lossless_libaom_key_frame_decodes_sample_exact`, | |
| 82 | + `a_lossless_libaom_inter_frame_decodes_sample_exact`), both | |
| 83 | + `a_lossless_sb128_*` gates, `a_lossless_16x4_chroma_pair_*`. | |
| 84 | +- `cargo check -p ec-av1 --all-targets` (target dir | |
| 85 | + `$HOME/.cache/cargo-target-av1ll64`): 0 warnings, 0 errors. | |
| 86 | + | |
| 87 | +## Same-class suspects, measured on scratch streams, deferred (spoken) | |
| 88 | + | |
| 89 | +Repro recipe (scratch, regenerable): `testsrc2 128x96 yuv444p`, aomenc | |
| 90 | +`--profile=1 --lossless=1 --enable-palette=0 --enable-intrabc=0`, | |
| 91 | +`--max-partition-size=64`, 6 frames. Both defects verified PRE-EXISTING | |
| 92 | +at 2ac149e3 via `git stash` probe, so neither is caused by this change; | |
| 93 | +both are the inter sub8 lossless class (a lossless inter route coding a | |
| 94 | +rect TX unit where `av1_get_tx_size` forces TX_4X4 per plane — the | |
| 95 | +`decode_inter_block8`/84acbd09 defect class one route over): | |
| 96 | + | |
| 97 | +- `decode_inter_sub8_rect2` → `read_inter_plane_rect` → | |
| 98 | + `push_mc_rect_tx` → `TxParams::run` lossless WHT assert | |
| 99 | + `(8, 4) != (4, 4)` at decode.rs:2566. deferred(fix-now in the lane | |
| 100 | + owning the inter sub8 lossless rect route; the fix shape is the | |
| 101 | + established per-plane TX_4X4 unit walk). | |
| 102 | +- The 12-frame sibling stream refuses mid-tile: `REFUSED: unsupported: | |
| 103 | + AV1 tile (a Golomb tail longer than this decoder reads)` — same | |
| 104 | + route class, downstream desync form. deferred(with the same lane; | |
| 105 | + likely disappears when the (8,4) read is fixed). | |
| 106 | + | |
| 107 | +`decode_rect4_16_strip`'s 4:2:0-hardcoded lossless chroma walk remains | |
| 108 | +with its owning lane (untouched here, per lane ownership). |