lane-av1-444interband: report - the inter 1:4 strip pair rewrite is 4:2:0-only
Browse files at this commit808012f5d271ca3a991da985429b5d4d62ddd2edParent: 1ddefc11 changed file +118 -0
- lanes/av1444interband.report.md +118 -0
lanes/av1444interband.report.mdadded+118 -0
| @@ -0,0 +1,118 @@ | |||
| 1 | +# lane-av1-444interband: the inter 1:4 strip's 4:4:4 chroma band stamping | ||
| 2 | + | ||
| 3 | +## Ticket | ||
| 4 | + | ||
| 5 | +Fix the 4:4:4 lossless 16x4 inter strip band stamping (t6 next-site from | ||
| 6 | +av1sub8rect444's measurement: post-fix desync at the 16x4 INTER strip | ||
| 7 | +mi(2,8), U unit (2,8) — ours `txb_skip` ctx 3 vs oracle ctx 11 with raw | ||
| 8 | +cells `above=[0,] left=[23,]`), or stop with the site narrowed further. | ||
| 9 | +Worktree at f41d649b, branch lane-av1-444interband. | ||
| 10 | + | ||
| 11 | +## Named site, re-measured (the report's attribution needed one correction) | ||
| 12 | + | ||
| 13 | +Fixture `/tmp/llkf/t6.obu`, sha256 | ||
| 14 | +`1e6dd4e05038c8d51e2c8d29f8c337130c4fea0aed629415535e6e53af9a2c72`, | ||
| 15 | +32487 bytes (scratch, regenerable per av1llkf.report.md's recipe; | ||
| 16 | +testsrc2 128x96, 1 key + 5 inter frames, `--profile=1 --lossless=1 | ||
| 17 | +--enable-palette=0 --enable-intrabc=0`, default partition, sb128). | ||
| 18 | +Oracle: the shared patched `$HOME/.cache/aom-oracle/build`, fresh | ||
| 19 | +`aomdec --rawvideo` on the same bytes. | ||
| 20 | + | ||
| 21 | +- Pre-change at f41d649b, our decoder refuses mid-frame-1 | ||
| 22 | + (`a Golomb tail longer than this decoder reads`) — fail-before, | ||
| 23 | + measured before the edit on this tree. | ||
| 24 | +- The oracle's cell dump (`EC_ECDUMP`) walks `left[2][1]` (U plane, mi | ||
| 25 | + row 2) across frame 1: the last writer before the failing read is the | ||
| 26 | + 16x16-INTRA block (0,4)'s U unit bc=3/br=2 (event #2379), which | ||
| 27 | + stamps cul_level 23 (mag 7, dc set); nothing else touches the cell | ||
| 28 | + until the (2,8) strip's U bc=0 reads it as 23. The skipped inter | ||
| 29 | + strips (0,8)/(1,8) log no coefficients and their | ||
| 30 | + `av1_reset_entropy_context` (decodeframe.c:1180) zero only their OWN | ||
| 31 | + cells — row 2's chroma left cell is not theirs to clear. | ||
| 32 | +- Correction to the inherited attribution: our ctx 3 on the failing | ||
| 33 | + read is a `TxbSet::Chroma4` TABLE ROW (base 0 in the +3 offset-10 | ||
| 34 | + layout), not a luma `skip_contexts` value — the read is the strip's | ||
| 35 | + U bc=0 (`side=4` = the 4x4 chroma tables), so the report's "U unit | ||
| 36 | + (2,8), ctx 3 vs 11" stands; the detour through "luma bc=3" was a | ||
| 37 | + rung-semantics misread (our `EC_ECDUMP_IN` logs the raw `skip_ctx` | ||
| 38 | + argument, which for chroma callers is the pre-offset base/row). | ||
| 39 | + | ||
| 40 | +## Root cause | ||
| 41 | + | ||
| 42 | +`decode_inter_block`'s strip tail ran lane-inter16ab r2's `pair_chroma` | ||
| 43 | +rewrite unconditionally. The rewrite stamps the PAIR-form chroma span — | ||
| 44 | +16x8 (HORZ) / 8x16 (VERT) at `pair_mi`, planes 1/2 — which is libaom's | ||
| 45 | +single `av1_set_entropy_contexts` call for the 4:2:0 pair's 8x4 (4x8) | ||
| 46 | +chroma unit. At ss 0/0 there is no pair: `pair_mi` == the strip's own | ||
| 47 | +mi, every strip is its own chroma reference, and the strip's own | ||
| 48 | +`record_rect_mi` (zero grids on the skip arm) already stamps exactly | ||
| 49 | +its own 16x4 (4x16) chroma span — the `av1_set_entropy_contexts` / | ||
| 50 | +`av1_reset_entropy_context` behaviour. The rewrite therefore smeared | ||
| 51 | +the strip's state one extra row (col) too far: skipped strip (1,8) | ||
| 52 | +wrote zero over `left[2][1..2]`, erasing the (0,4) intra block's U/V | ||
| 53 | +stamps, and (2,8)'s U walk then read base 0 where aom reads base 1. | ||
| 54 | +Counter evidence: `INTER16_CHROMA_PAIR_HITS` fired 31x on this | ||
| 55 | +pairless 4:4:4 stream (its documented meaning is "odd strips that | ||
| 56 | +close a 4:2:0 chroma pair"). | ||
| 57 | + | ||
| 58 | +## Change (decode.rs, one filter + one trace rung) | ||
| 59 | + | ||
| 60 | +1. `pair_chroma` now carries `.filter(|_| ss_x(fctx) == 1 && | ||
| 61 | + ss_y(fctx) == 1)`: the pair-span rewrite exists only at 4:2:0, where | ||
| 62 | + it is byte-preserved (the added condition is false-only-at-ss-0). | ||
| 63 | +2. `record_mi_chroma` gained the chroma twin of the existing | ||
| 64 | + `EC_ECPUB` rung: `EC_CHROMA_PUB plane= mi=() wh=() lvl= dc=`, | ||
| 65 | + env-gated eprintln (the instrument that localized this site; kept | ||
| 66 | + for the next band hunt). | ||
| 67 | + | ||
| 68 | +Sibling ownership clean: the edit is in `decode_inter_block`'s tail | ||
| 69 | +(lane-inter16ab's rewrite region), not `sub8_leaf_chroma444` nor | ||
| 70 | +`decode_intra_sub8_leaf`. | ||
| 71 | + | ||
| 72 | +## Verification (measured, this tree @ d5325172) | ||
| 73 | + | ||
| 74 | +- Entropy/pixel witness, t6.obu vs fresh `aomdec --rawvideo` | ||
| 75 | + ($HOME/.cache/aom-oracle/build): all 6 frames decode (pre-change the | ||
| 76 | + decode refused mid-frame-1) and frames 0..5 are **byte-exact, 0 | ||
| 77 | + differing bytes** per frame (36864 B/frame compared). Frame exactness | ||
| 78 | + is claimed on exactly that basis. | ||
| 79 | +- Non-vacuity: `inter16_1to4` counters on the full t6 decode: | ||
| 80 | + `horz4=20 vert4=28 chroma_pairs=0` (was `chroma_pairs=31` while the | ||
| 81 | + strips decoded); the strips themselves still decode and the frames | ||
| 82 | + above prove it. | ||
| 83 | +- Gates: `cargo test -p ec-av1 --lib a_lossless` → 7 passed, 0 failed | ||
| 84 | + (both 4:2:0 lossless libaom gates, the 444 min-partition-64 and | ||
| 85 | + min-partition-8 inter gates, the sb128 pair, the 16x4 pair). The | ||
| 86 | + 4:2:0 inter 16x4 aomenc sweep | ||
| 87 | + (`a_real_aomenc_inter_sequence_with_intra_16x4_strips_...`) is | ||
| 88 | + yuv420p-only and the change is no-op at 4:2:0 by construction (the | ||
| 89 | + filter's condition is satisfied there); not re-run this round. | ||
| 90 | +- `cargo check -p ec-av1 --all-targets` (target dir | ||
| 91 | + `$HOME/.cache/cargo-target-av1444interband`, ec-av1 cleaned first): | ||
| 92 | + 0 warnings, 0 errors. `rustfmt --check` reports no hunks inside the | ||
| 93 | + edited ranges (the crate's pre-existing let-chains drift is | ||
| 94 | + untouched). | ||
| 95 | +- Commit d5325172 on lane-av1-444interband. Not pushed. | ||
| 96 | + | ||
| 97 | +## Named, not chased (spoken) | ||
| 98 | + | ||
| 99 | +1. `Neighbour::level` clamps `cul_level` to 7 while aom stores up to 15 | ||
| 100 | + (`COEFF_CONTEXT_MASK` = 15, dc sign in bit 4). Invisible to every | ||
| 101 | + context derived from the cells (the `txb_skip` categories only | ||
| 102 | + distinguish {0} / {1..3} / {>=4}, and dc sign rides its own field), | ||
| 103 | + so it is representation drift, not a defect — noted so nobody | ||
| 104 | + "fixes" the stored value into a desync. | ||
| 105 | +2. Oracle-side f2 cross-reference: lane-av1lrflush's 444sb witness f2 | ||
| 106 | + diverges at PREFILT entering at column 128 (inter 64x128 at | ||
| 107 | + (128,0)), plausibly this same skipped-inter-strip class one size up | ||
| 108 | + (their filter-pipeline/LR exoneration is consistent with our | ||
| 109 | + entropy-domain finding). Main owns the 444sb gate extension | ||
| 110 | + (take(2) -> take(3)) once this lands. deferred(that check, unblock: | ||
| 111 | + their f2 witness bytes against this tree). | ||
| 112 | +3. Whole-stream read-pairing via `EC_ECDUMP_IN`/`EC_ECDUMP` (dif,rng) | ||
| 113 | + triples is NOT a reliable event alignment across the two | ||
| 114 | + implementations: the internal daala-EC representations legitimately | ||
| 115 | + diverge while decoding identically (frame 0 is pixel-exact yet its | ||
| 116 | + pre-read triples fail 1:1 pairing). The robust comparators are | ||
| 117 | + pixels, refusal points, and ctx/cell values. Recorded so the next | ||
| 118 | + band lane doesn't burn a round on the same lesson. | ||