lane-av1-llsub8b: 444 lossless inter sub8 rect chroma raster
Browse files at this commit92ce89431dd555efe984611a78721c0b8ac29f56Parent: 2b68d1d2 changed files +109 -0
- crates/ec-av1/src/decode.rs +17 -0
- lanes/av1llsub8b.report.md +92 -0
crates/ec-av1/src/decode.rsmodified+17 -0
| @@ -36624,6 +36624,23 @@ fn decode_inter_sub8_rect2( | |||
| 36624 | push_mc_rect(2, px, py, SIDE, bw, bh, sv, &ZERO_RESIDUAL[..SIDE * SIDE], fctx); | 36624 | push_mc_rect(2, px, py, SIDE, bw, bh, sv, &ZERO_RESIDUAL[..SIDE * SIDE], fctx); |
| 36625 | neighbours.record_mi_chroma(lmi, bw, bh, 1, &ZERO_RESIDUAL[..bw * bh]); | 36625 | neighbours.record_mi_chroma(lmi, bw, bh, 1, &ZERO_RESIDUAL[..bw * bh]); |
| 36626 | neighbours.record_mi_chroma(lmi, bw, bh, 2, &ZERO_RESIDUAL[..bw * bh]); | 36626 | neighbours.record_mi_chroma(lmi, bw, bh, 2, &ZERO_RESIDUAL[..bw * bh]); |
| 36627 | + } else if lossless(fctx) && !mono(fctx) { | ||
| 36628 | + // lane-av1-llsub8b: lossless codes TX_4X4 on EVERY plane | ||
| 36629 | + // (`av1_get_tx_size`, blockd.h:1383), so this 4:4:4 piece's | ||
| 36630 | + // (8,4)/(4,8) chroma plane block is a 2x1/1x2 raster of | ||
| 36631 | + // TX_4X4 units, not the ONE TX_8X4 rect unit the lossy arm | ||
| 36632 | + // below reads -- that single rect is what tripped | ||
| 36633 | + // `TxParams::run`'s WHT assert ((8,4) != (4,4), | ||
| 36634 | + // decode.rs:2566). The walk stamps each unit's own | ||
| 36635 | + // coefficient context, so -- unlike the lossy arm -- no | ||
| 36636 | + // whole-block `record_mi_chroma` runs after it: the walk's | ||
| 36637 | + // per-unit stamps ARE the block's chroma contexts (the same | ||
| 36638 | + // rule `leaf8_inter_chroma_lossless`'s caller obeys). | ||
| 36639 | + read_inter_chroma_lossless( | ||
| 36640 | + dec, cdfs, neighbours, u, v, su, sv, | ||
| 36641 | + (rmi, cmi), (px, py), (0, 0), (bw, bh), (bw, bh), SIDE, 0, | ||
| 36642 | + base_q_idx, &mut Vec::new(), &mut Vec::new(), fctx, | ||
| 36643 | + )?; | ||
| 36627 | } else { | 36644 | } else { |
| 36628 | let ca = neighbours.around_mi_rect(lmi, bw, bh); | 36645 | let ca = neighbours.around_mi_rect(lmi, bw, bh); |
| 36629 | let (ug, _) = read_inter_plane_rect( | 36646 | let (ug, _) = read_inter_plane_rect( |
lanes/av1llsub8b.report.mdadded+92 -0
| @@ -0,0 +1,92 @@ | |||
| 1 | +# lane-av1-llsub8b: the inter sub8 rect route's 4:4:4 lossless chroma raster | ||
| 2 | + | ||
| 3 | +## Ticket | ||
| 4 | + | ||
| 5 | +`decode_inter_sub8_rect2` hit `TxParams::run`'s lossless WHT assert | ||
| 6 | +`(8, 4) != (4, 4)` at decode.rs:2566 (pre-existing at the parent, named by | ||
| 7 | +`lane-av1-ll64`'s same-class sweep). Port sibling `84acbd09` if it covers | ||
| 8 | +this route; else fix only the unit size that trips the assert. | ||
| 9 | +`decode_rect4_16_strip` untouched (sibling-owned). The 12-frame stream's | ||
| 10 | +Golomb-tail refusal was expected to disappear once the (8,4) read was | ||
| 11 | +fixed. | ||
| 12 | + | ||
| 13 | +## Sibling verdict: not covered — own fix, same shape | ||
| 14 | + | ||
| 15 | +`84acbd09` (already ported here as fb4e4b0e) routed `decode_inter_block8`'s | ||
| 16 | +INTER arms' 8x8 chroma through `leaf8_inter_chroma_lossless`. The rect2 | ||
| 17 | +route was one arm over: `decode_inter_sub8_rect2`'s `chroma_444` coded arm | ||
| 18 | +read each piece's (8,4)/(4,8) U/V plane block as ONE `TxbSet::ChromaRect8x4` | ||
| 19 | +rect unit — at lossless that unit hits the WHT assert, exactly the ll64 | ||
| 20 | +report's prediction. | ||
| 21 | + | ||
| 22 | +## Change (decode.rs, one branch) | ||
| 23 | + | ||
| 24 | +New arm in `decode_inter_sub8_rect2`'s `chroma_444` coded path: | ||
| 25 | +`lossless(fctx) && !mono(fctx)` routes the piece's chroma through the | ||
| 26 | +sibling's `read_inter_chroma_lossless` walk with region and block | ||
| 27 | +`(bw, bh)` at stride `SIDE` — lossless codes TX_4X4 on EVERY plane | ||
| 28 | +(`av1_get_tx_size`, blockd.h:1383), so the plane block is a 2x1/1x2 raster | ||
| 29 | +of `TxbSet::Chroma4` units. The walk stamps each unit's own coefficient | ||
| 30 | +context, so — unlike the lossy arm — no whole-block `record_mi_chroma` | ||
| 31 | +runs after it (the leaf8 rule). `piece_tx_type` inheritance stays lossy- | ||
| 32 | +only (lossless is DCT_DCT on every plane). 4:2:0: zero change — the branch | ||
| 33 | +lives inside `chroma_444`, and the reserved 4:2:0 group-tail chroma arm was | ||
| 34 | +not touched. Luma was already correct (`lane-lossless2`'s TX_4X4 leaf walk). | ||
| 35 | + | ||
| 36 | +## Verification (measured, this tree @ HEAD + this change) | ||
| 37 | + | ||
| 38 | +- Fail-before: `testsrc2 128x96 yuv444p`, aomenc `--profile=1 --lossless=1 | ||
| 39 | + --enable-palette=0 --enable-intrabc=0 --max-partition-size=64`, 6 frames | ||
| 40 | + → panic `(8, 4) != (4, 4)` at decode.rs:2566, backtrace | ||
| 41 | + `read_inter_plane_rect → push_mc_rect_tx`. Fail-after: gone; the decoder | ||
| 42 | + reads through the rect2 pieces and arrives coherently at the next | ||
| 43 | + (pre-existing) defect site — see deferred (1). | ||
| 44 | +- Witness with the route actually firing: mandelbrot 128x96 6 frames, same | ||
| 45 | + recipe, `--cpu-used` 0 and 3 both decode ALL 6 frames; | ||
| 46 | + `sub8_inter_rect: horz8x4=22 vert4x8=15` (cpu0) / `10/12` (cpu3) — 37 | ||
| 47 | + and 22 lossless 444 rect2 chroma pieces through the new walk, stream | ||
| 48 | + completes. | ||
| 49 | +- Sibling non-regression: the ORIGINAL `/tmp/ll444/dodge2.obu` (sibling's | ||
| 50 | + own witness bytes) decodes byte-exact vs fresh `aomdec --rawvideo`, all 6 | ||
| 51 | + frames, in this tree with this change. | ||
| 52 | +- Entropy alignment on the repro stream: frames 0-2 of the 6-frame | ||
| 53 | + testsrc2 stream byte-exact vs aomdec; `sub8_inter_rect` counters 0 there | ||
| 54 | + (its first rect2 piece sits behind deferred (1)'s site), and its frame 3 | ||
| 55 | + reads through the new arm up to the (8,8) site without a desync-form | ||
| 56 | + failure. | ||
| 57 | +- Gates: `cargo test -p ec-av1 --lib a_lossless` → 6 passed, 0 failed | ||
| 58 | + (both 4:2:0 lossless libaom gates, the 444 min-partition-64 inter gate, | ||
| 59 | + the sb128 pair). | ||
| 60 | +- `cargo check -p ec-av1 --all-targets` (target dir | ||
| 61 | + `$HOME/.cache/cargo-target-av1llsub8b`): 0 warnings, 0 errors. | ||
| 62 | +- Fixtures are scratch in /tmp/llsub8b (regenerable recipes above); | ||
| 63 | + fixtures/ is gitignored, nothing committed from it. | ||
| 64 | + | ||
| 65 | +## Named, not chased (spoken) | ||
| 66 | + | ||
| 67 | +1. `decode_inter_block8`'s INTRA-leaf chroma arm (decode.rs:38958/:38985, | ||
| 68 | + `u_grid`/`v_grid = read_plane(..)` at `chroma_side == 8`) reads 4:4:4 | ||
| 69 | + lossless chroma as ONE TX_8X8 unit → the same WHT assert, `(8, 8) != | ||
| 70 | + (4, 4)`. Same class, the one arm the sibling's fix did not cover (it | ||
| 71 | + routed the INTER arms only). decode_inter_block8 is the llinter lane's | ||
| 72 | + function — deferred(fix-now by the lane owning block8's intra arm; the | ||
| 73 | + fix shape is the same per-unit lossless walk with intra-plane read | ||
| 74 | + semantics, not a port of the inter helper). | ||
| 75 | +2. The 12-frame stream's `REFUSED: AV1 tile (a Golomb tail …)` from the | ||
| 76 | + ll64 report: GONE after this fix — that stream now stops at deferred | ||
| 77 | + (1)'s (8,8) site instead, exactly as ll64 predicted. | ||
| 78 | +3. Fresh observation on today's regenerated fixtures: a mandelbrot | ||
| 79 | + default-partition lossless 444 KEY frame pixel-differs from aomdec | ||
| 80 | + (key-frame-only stream, zero sub8 counters, no refusal, first diff at | ||
| 81 | + sample 40). Key frames never enter `decode_inter_sub8_rect2`, so this | ||
| 82 | + is pre-existing and intra-side — the earlier lanes' key-frame proofs | ||
| 83 | + ran min-partition-64 keys, which stay exact. deferred(the intra lane). | ||
| 84 | + | ||
| 85 | +## Note on the shared oracle | ||
| 86 | + | ||
| 87 | +aomenc/aomdec binaries are the shared `$HOME/.cache/aom-oracle/build`. | ||
| 88 | +Today's aomenc produces different RD picks than this morning's (the | ||
| 89 | +regenerated min-partition-64 testsrc2 stream's inter frames differ from | ||
| 90 | +the sibling's original bytes) — streams were therefore compared only | ||
| 91 | +against aomdec output of THE SAME bytes, and the sibling's original | ||
| 92 | +dodge2.obu was used verbatim for the non-regression check. | ||