forge
Explore
Log in

Don't you dare go Hollow

Lane-t900 r5 handoff -- per-plane warp bail-out and the 128-root second half's cdef literal

Browse files at this commit

798ed37af2e9a8ec1beb3f49ffd6333833295f6cAhmet Kaan GümüşParent: 3aa99eb
  • docs
    • lane-t900 r5 handoff -- per-plane warp bail-out and the 128-root second half's cdef literal
Show full message
docs(av1): lane-t900 r5 handoff -- per-plane warp bail-out and the 128-root second half's cdef literal
lanes/t900-r5.handoff.mdadded+144 -0
@@ -0,0 +1,144 @@
1+# lane-t900 r5 handoff -- two root causes closed; 14 exact decode-order frames on the 900 s cut
2+
3+Branch `lane-t900`, tip `2e59d5a4` (3 commits this round, all on top of r4's
4+`28f176cb`). Worktree `edith_codecs-t900`.
5+`CARGO_TARGET_DIR=$HOME/.cache/cargo-target-t900-b` carries the release
6+`decode_probe`. Reproduction still needs BOTH `EC_INTRA128_IN_INTER=1` and
7+`EC_INTRA16X4_DECODE=1`. NO suite was run this round (turn cap) -- `cargo
8+build -p ec-av1 --release --example decode_probe` is clean, `cargo test`
9+UNRUN. That is the first thing the next round must do.
10+
11+## ROOT CAUSE 1 (`e9f287af`) -- the per-plane warp bail-out used the SQUARE side
12+
13+STEP 1 of the charter asked whether `mc::predict`'s kernel choice is wrong
14+for chroma of rect luma blocks. It is NOT. Measured, not assumed:
15+
16+* libaom `av1_get_interp_filter_params_with_block_size` (filter.h:247) takes
17+ the X filter from `block_width` and the Y filter from `block_height`
18+ (`init_interp_filter_params`, reconinter.h:169-181), `w <= 4` picking
19+ `av1_interp_4tap[interp_filter]` -- and `av1_interp_4tap[MULTITAP_SHARP]`
20+ is `av1_sub_pel_filters_4`, i.e. the regular 4-tap, exactly what
21+ `InterpFilterKind::tables()` (mc.rs:183-190) already returns.
22+* our chroma calls already pass `kern_w = write_chroma_w = write_w / 2`
23+ (decode.rs:19803), so an 8x16 luma block's chroma passes `kern_w = 4` and
24+ takes the 4-tap horizontally / 8-tap vertically. Correct before this round.
25+
26+The real defect was one rung further down. `EC_MC_TRACE` on the first bad
27+block (`EC_IB px=728 py=96 side=16 w=8 h=16`, mi(24,182)) showed the block
28+is WARPED, not convolved: `EC_MC_WARP x=728 y=96 w=16 h=16` and
29+`EC_MC_WARP x=364 y=48 w=8 h=8` for chroma. libaom `av1_init_warp_params`
30+(reconinter.c:58-60) returns before setting `WARP_PRED` when
31+`inter_pred_params->block_height < 8 || block_width < 8`, and those are the
32+PLANE's own dims -- so in 4:2:0 the chroma of every luma block narrower or
33+shorter than 16 is predicted translationally while its luma warps. Every
34+warp site gated that on `chroma_side` (`side / 2`), which for an 8x16 or
35+16x8 luma block is 8 while the real chroma block is 4x8 / 8x4.
36+
37+Fix: `warp_plane_allowed(w, h)` (decode.rs, next to `cdef_idx_hits`) at all
38+5 chroma sites (single-ref + both compound taps for U and V) and the 3 luma
39+sites, reading `write_chroma_w/h` and `write_w/h`; a counter
40+`decode::warp_plane_suppress_hits()` counts every suppression (gate proof --
41+NOT yet asserted anywhere, see BELOW). The luma half also matters: a
42+PARTITION_HORZ/VERT strip is `write_w x write_h`, so a 16x4 / 4x16 strip
43+under global motion warped where libaom does not.
44+
45+2-frame cut `~/.cache/inter128intra-tmp/t900_2.obu`, prefilter compare
46+(`~/.cache/t900-tmp/pf.sh` + `sb.py`):
47+
48+| | f0 | f1 Y | f1 U | f1 V | final (cmp.sh) |
49+|---|---|---|---|---|---|
50+| before | EXACT | 0 | 98 | 62 | 258 bytes |
51+| after | EXACT | 0 | **0** | **0** | **0 bytes, both frames EXACT** |
52+
53+## ROOT CAUSE 2 (`4261ea72`) -- the second 128-root HORZ/VERT half read no cdef_idx
54+
55+STEP 3's four 2 s cuts: `~/.cache/rectres-tmp/t900.obu` first differed at
56+decode-order frame 10. A 0.6 s re-cut `~/.cache/t900-tmp/t900_h.obu`
57+(`ffmpeg -c copy -t 0.6`, 16 decode-order frames) reproduces it.
58+
59+Localisation: first differing luma pixel px(192,0) of frame 10 = mi(0,48).
60+The `EC_MODE`-only greedy ladder (`~/.cache/t900-tmp/lad.py`, the r2 recipe
61+restricted to the ONE rung both decoders emit -- `EC_MODE_VAL` is NOT
62+comparable, aomdec prints it after the mv and we print it before the interp
63+filter) is exact through mi(0,32) and splits at mi(0,48): aomdec rng 40079,
64+ours 39850. The coefficient traces of the block in between are
65+IDENTICAL rung for rung and both end at rng 57521, so the divergence is in
66+the pre-mode symbols of the second half -- a literal, invisible to a value
67+ladder (class `literal-width-invisible-to-ladder`).
68+
69+libaom keeps `cdef_transmitted[4]`, one flag per 64x64 CDEF unit of a
70+128x128 superblock, indexed `(mi_col & 16) != 0 + 2 * ((mi_row & 16) != 0)`
71+(`read_cdef`, decodemv.c:50-81), reset only at the SB origin. Ours is a
72+single bool reset per coded piece; the INTER tile loop's 128-root HORZ/VERT
73+arm (decode.rs `sb128_rect`) was the one arm that never reset it between the
74+two halves -- the key-frame loop already did -- so the right half skipped a
75+`cdef_bits`-wide literal.
76+
77+Prefilter compare of the 16-frame cut, differing bytes per decode-order frame:
78+
79+| frame | 10 | 11 | 12 | 13 | 14 | 15 |
80+|---|---|---|---|---|---|---|
81+| before | 2316966 | 1746025 | 1307747 | 2161740 | 1914869 | 2164666 |
82+| after | **0** | **0** | **0** | **0** | 14 | 24 |
83+
84+frames 0..9 exact before and after.
85+
86+## FILM TABLE (decode-order compare, `~/.cache/t900-tmp/cmp.sh`, after both fixes)
87+
88+| cut | frames (aomdec/ours) | first differing frame | bytes there | bad frames |
89+|---|---|---|---|---|
90+| t900 2 s | 267 / 267 | **14** (was 10) | 32 | 234 |
91+| t5400 2 s | 275 / 275 | 1 | 794216 | 273 |
92+| t6300 2 s | 125 / 125 | 1 | 2674129 | 124 |
93+| t8100 2 s | 96 / 32 | 1 | 2027 | 31 + REFUSED "a Golomb tail longer than this decoder reads" at frame 32 |
94+| t900_2 (2 frames) | 2 / 2 | -- | -- | **0, fully exact** |
95+
96+## STEP 2 (modes_above_left sweep) -- NOT DONE
97+
98+No site was changed and no ladder was re-run for it: the two root causes
99+above consumed the round. The r4 table stands unchanged -- callers at
100+decode.rs 7813, 9656, 11178, 11839, 13059, 22499, 23664 are unswept (12162
101+already wraps, 7668 was fixed in r4), and 7813 / 13059 feed the intra-mode
102+CDF row so they need the r2 rng ladder after any change.
103+
104+## STEP 4/5 (witness fixture, lifts, named gates, suite) -- NOT DONE
105+
106+Nothing was pinned, no refusal was lifted, no gate was written or run, and
107+the suite was not run. `warp_plane_suppress_hits()` exists but has NO
108+assert. Both fixes are currently proven only by the two cuts above.
109+
110+## EXACT NEXT STEP
111+
112+1. `cargo test -p ec-av1 --lib` (systemd unit form, COMMON's SUITE RUNS
113+ recipe) -- the round's changes are UNVERIFIED against the suite. The
114+ `cdef_transmitted` reset and the warp bail-out both touch shipped gates
115+ (grep `warp`, `sb128`, `cdef` in stream.rs); the sibling-gate rule applies.
116+2. Pin a witness. `~/.cache/t900-tmp/t900_h.obu` (177773 bytes, 16
117+ decode-order frames, 15 shown) is the natural one for root cause 2 but
118+ its frames 14/15 still differ -- cut it back to 14 decode-order frames
119+ (`ffmpeg -c copy -t ~0.52`, hash twice) before pinning, or pin it and
120+ assert only what is exact and say so. Counters to hard-assert:
121+ `decode::warp_plane_suppress_hits()` (root cause 1),
122+ `INTER_SB128_VERT_HITS` / `cdef_idx_hits()` (root cause 2). Gate shape:
123+ copy `a_10bit_film_hidden_arf_with_split_superblock_strips_decodes_pixel_exact`
124+ (stream.rs:30240) -- fixture read, `decode_stream`, delta-counted
125+ counter assert, all shown frames vs `ffmpeg_decode_sequence_10bit`.
126+ `git add -f` under crates/ec-av1/fixtures/.
127+3. Next defect on this cut: decode-order frame 14, U plane ONLY, 14 samples
128+ (f15: 24), all inside SB(4,7) px(896,512), first chroma sample (472,284)
129+ = luma px(944,568) = mi(142,236). Our mode trace has that block as an
130+ INTRA block inside an inter frame at 8-px granularity (mi cols 236, 238,
131+ 239 on row 142) -- U-only with V exact smells like the CfL alpha or the
132+ chroma DC of an intra-in-inter leaf. `~/.cache/t900-tmp/o14.mode` has the
133+ trace; frame 14 is the second-to-last block group in it.
134+4. Then t5400 / t6300 / t8100 frame 1 (three separate defects, untouched),
135+ and t8100's Golomb-tail refusal at frame 32.
136+
137+## Artifacts
138+
139+`~/.cache/t900-tmp/`: `t900_h.obu` (0.6 s 16-frame cut), `pf.sh` `cmp.sh`
140+`sb.py` `px.py` `reg.py` (as r4), NEW `lad.py` (EC_MODE-only greedy ladder,
141+prints last match + both sides' next line), `a10.mode`/`o10.mode`,
142+`a10.co`/`o10.co` (coefficient traces, 80 MB each), `a10.st` (aomdec
143+`EC_TRACE_MODE_STEP`, has the `motion_mode`/`interp` rungs), `o14.mode`,
144+`pf_t900h/`, `pf_t900_2/`, `d_t900/ d_t5400/ d_t6300/ d_t8100/`.