forge
Explore
Log in

Don't you dare go Hollow

Lane-t900 r3 handoff -- chroma coefficient contexts wiped by the non-chroma-reference inter block

Browse files at this commit

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