diff --git a/lanes/t900-r3.handoff.md b/lanes/t900-r3.handoff.md new file mode 100644 index 00000000..3c521b87 --- /dev/null +++ b/lanes/t900-r3.handoff.md @@ -0,0 +1,127 @@ +# lane-t900 r3 handoff -- the non-chroma-reference inter block wiped its neighbours' chroma coefficient contexts + +Branch `lane-t900`, tip `f9720de` (merge of main `243f125` = `d61ac08`, then +the fix). Worktree `edith_codecs-t900`, `CARGO_TARGET_DIR=$HOME/.cache/cargo-target-t900` +(a second `-t900-b` dir carried the release `decode_probe` while the gate unit +held the first). + +## STEP 0 -- merge of main `243f125` (commit `d61ac08`) + +Clean auto-merge, no conflicts (decode.rs + stream.rs + refusal_inventory.rs). +`cargo check -p ec-av1`: clean. + +Gates, unit `t900-gates-r3-1788370694`, log `$HOME/.cache/t900-gates-r3.log`, +filter `rect64_corner_tus hidden_arf refusal_inventory gate_coverage 1to4`: +**23 passed; 0 failed; 4 ignored** (122 s). Named ones: +`a_10bit_film_frames_with_rect64_corner_tus_decode_pixel_exact ... ok`, +`a_10bit_film_hidden_arf_with_split_superblock_strips_decodes_pixel_exact ... ok`, +every `refusal_inventory::*` and `gate_coverage::*` ok. So r2's five ctx +switches did NOT need bisecting -- the r2 red was the pre-rename gate, and the +renamed gate (rect64 asserts only) is green as merged. No revert was made. + +IMPORTANT for reproduction: main's re-added 16x4 refusal means this cut needs +**both** `EC_INTRA128_IN_INTER=1` and `EC_INTRA16X4_DECODE=1`; with only the +first, `t900_2.obu` stops at the intra 16x4/4x16-in-inter refusal. + +## ROOT CAUSE (fixed, `f9720de`) + +libaom codes no chroma transform for a block that is not the chroma reference +of its 4:2:0 pair -- `av1_reset_entropy_context`: +`nplanes = 1 + (num_planes - 1) * xd->is_chroma_ref` -- so such a block leaves +the above/left CHROMA entropy contexts untouched. Our INTER block reader +(`decode.rs`, the `record_split_luma_rect_mi` / `record_rect_mi` pair right +before the `pair_chroma` block, ~line 22955) wrote all three planes +unconditionally, and for a non-chroma-reference strip the chroma grids are the +all-zero ones built in the `!has_chroma` arm. So the EVEN 4x16 strip of the +`PARTITION_VERT_4` at mi(40,220) cleared the real left-neighbour chroma state, +and the PAIR's own `all_zero` then read `txb_skip_ctx` one row low. + +Measured, decode-order frame 1 of the 2-frame cut +`~/.cache/inter128intra-tmp/t900_2.obu` (10-bit 1920x792, 128 SB): + +| | before | after | aomdec | +|---|---|---|---| +| chroma `all_zero`, entry rng 37582 | ctx base 1 -> rng 37384 | ctx base **2** -> rng **51992** | ctx 9 (2+7) -> **51992** | + +`EC_DCDUMP` (now dumping all three planes, not plane 0 only -- without the +chroma cells the wipe is invisible) showed it directly: at strip 220's own +luma read `left[40..43][1] = Some(true)/1`; at strip 221's read the same cells +are `None/0`. The wiper is between them, i.e. strip 220's record. + +Fix shape: snapshot planes 1/2 of the block's left/above cells when +`!has_chroma` and restore them after the recorders run -- equivalent to not +writing them, without threading a flag through both recorders. + +Sibling sweep (class `context-read-from-one-cell` / `new-map-ignores-tile-edge`): +`decode_rect4_16_strip` writes chroma only under `if has_chroma`; the sub8 +intra rect reader early-returns on `!has_chroma` before its chroma block; +`decode_leaf_rect8`/`decode_leaf_split4` use `record_mi_luma*` (plane 0 only). +The inter reader was the only unguarded site. + +## LADDER STATE -- the whole 2-frame cut is now ENTROPY-EXACT + +Deduped `(all_zero value, rng)` sequence, ours vs instrumented aomdec, both +frames: **15865 symbols in each, identical value and range in order, no +mismatch**. (Do not diff `tag=eob` across decoders: aomdec prints an eob line +where our `read_plane` path prints none; the first "mismatch" at index 25 is +that rung-set gap, not a divergence.) + +## DECODE-ORDER COMPARE (`~/.cache/t900-tmp/cmp.sh`, both under EC_AV1_FINAL_DUMP) + +`t900_2.obu`: f0 EXACT, f1 differs by **114374 bytes** (was 1924240 before +this fix, 2134171 before r2's). The pre-loop-filter dumps (`EC_AV1_PREFILT_DUMP16`, +`~/.cache/t900-tmp/d_pf/`) differ too: f0 0 px, f1 105282 px. So what remains +is **reconstruction, not entropy** -- Y 82345 px max |d| 111, U 15362 max 148, +V 15073 max 162; dominant delta +1 (43448 px), then -1 (9742). + +## NEXT STEP (exact, do not re-bisect) + +First differing block in DECODE order (superblock (0,7), x896..1023 y0..127 -- +every earlier superblock is pixel-exact in the prefilter dump): + +* frame 1, mi(24,248) = px(992,96), `EC_PART bsize=9 value=1` (32x32 + PARTITION_HORZ -> two 32x16), top half `mode=13` (NEARESTMV) `ref0=5` + `mv0=(-166,354)` `motion_mode=0` `interp=0`, no `tx_depth` rung => skip + (pure prediction). +* Its 32x16 top half is off by **exactly -2 on every one of the 512 pixels** + (aom - ours = -2, no dither at all); the bottom 32x16 (rows 112..127, which + does carry residual) is a dithered mix of 0/-1/-2. +* NOTE the trace disagreement worth one check first: aomdec prints + `ref1=0` (INTRA_FRAME => interintra) for this block where OUR `EC_MODE_VAL` + prints `ref1=-1` (none), and our counters do report + `rect_wedge ... interintra=[5,6,2,4,0,0]` (4 of them 32x16). Either our + print normalises INTRA_FRAME to -1, or we are not applying interintra on + this block at all -- resolve that before touching the convolve. A uniform + (dither-free) offset over a whole skip block means a DC-only difference: + an unapplied/extra interintra blend term or an offset in the 10-bit + convolve rounding chain, NOT a filter-tap error (taps would dither). +* A hand-rolled 8-tap REGULAR prediction from the (exact) f0 reference at + mv (-20.75, +44.25) did NOT reproduce either decoder's pixels, so the + position/convention of that hand check was wrong -- do not trust it. + +Not this shape: there is NO intra 16x4/4x16 strip in superblock (0,7) +(`EC_INTRA16X4=1` list: nearest are mi cols 320+/172-175), and only 30 of the +107 strips in the frame overlap a diff at all -- the reconstruction defect is +NOT the 16x4 shape. + +`intra128_in_inter` is now **0** on this cut (it was 15 in r2, before the +chroma-ctx fix): those 128x64 intra-in-inter arrivals were desync artifacts, +exactly like wit16x4's phantom counters. So STEP 2 of the r3 charter (pin a +`reelc_intra128_witness.obu`, lift the refusal) has **no witness on this cut** +and must not be attempted from it. `EC_INTRA128_IN_INTER` stays opt-in; +`refusal_inventory.rs` / `gate_coverage.rs` untouched this round. + +## Not run this round + +Full suite (coordinator: no suite), the four 2 s cuts +(`~/.cache/rectres-tmp/{t900,t5400,t6300,t8100}.obu`) after the fix, and the +`~/.cache/reelc-0-10s.obu` re-probe. + +## Artifacts + +`~/.cache/t900-tmp/`: `cmp.sh` (now points at the `-t900-b` probe and passes +both env vars), `ours2.trace` (`EC_TRACE_COEFF` after the fix), +`ours_dc.trace` (`EC_DCDUMP`), `ours3.mode` (`EC_TRACE_MODE`/`EC_TRACE_PART`), +`i16.log` (`EC_INTRA16X4` strip list), `aom_coeff.trace` / `aom_full.trace` +(aomdec, r2, still valid -- entropy unchanged on that side), +`d_pf/` (prefilter dumps both decoders), `d_t900_2/` (final dumps).