forge
Explore
Log in

Don't you dare go Hollow

lane-av1422lpf: report -- seven sites fixed, all panics gone, the residual is the intra path

Browse files at this commit

9aefbc3f83c989ee87942c2093f10c9dd09015bbAhmet Kaan GümüşParent: d840e80
lanes/av1422lpf.report.mdadded+328 -0
@@ -0,0 +1,328 @@
1+# lane-av1422lpf — the `--lossless=1` 4:2:2 inter chroma panic family is SEVEN sites, and all seven are fixed
2+
3+Base `aef4fa67` (main), worktree `~/.cache/wt/av1422lpf`, branch
4+`lane-av1422lpf`. **All seven panics are gone. The three cells still do not
5+decode byte-exact** — §4 says exactly where that residual lives and why it is
6+not this family. `crates/ec-av1/src/stream.rs` carries no committed probe
7+bypass; `git status` is clean and the `EC_AV1_ALLOW_422_PROBE` patch is
8+reverted (patch-run-restore, never committed).
9+
10+## 0. Verdict
11+
12+| | |
13+|---|---|
14+| sites found | **7** (the previous lane found 5; two are the intra twins of sites 1 and 5) |
15+| sites fixed | **7** |
16+| sites **not** bugs | **1** (the previous lane's "site 3" — measured, §2 site 3) |
17+| panics remaining on the three cells | **0** (was 3) |
18+| regressions on 33 other cells | **0** |
19+| the three cells byte-exact | **NO** — §4, with the control that names the residual's owner |
20+
21+The previous lane reverted because no cell produced a right pixel. That is
22+still true — but the reason is now known and it is **not** this family: a
23+single-key-frame 4:2:2 lossless stream diverges on the **intra** path with
24+the *same* wrong-sample counts on this tree and on main (§4.2). Fixing seven
25+extent sites cannot fix that, and these seven are correct.
26+
27+## 1. The repro, re-verified myself first
28+
29+`main` at `aef4fa67`, all three cells, `decode_probe` with the local
30+`EC_AV1_ALLOW_422_PROBE` bypass:
31+
32+```
33+W_intrabc.obu 130320 B panicked at decode.rs:37565:24
34+X_intrabc_tiled.obu 131696 B range end index 20 out of range for slice of length 16
35+Y_intrabc_10b.obu 202281 B read_inter_chroma_lossless -> decode_inter_block
36+ -> decode_inter_frame_tile_with_cdfs
37+```
38+
39+The previous lane's panic text reproduced exactly. sha256 first 16 hex:
40+
41+| cell | sha256 | recipe |
42+|---|---|---|
43+| `W_intrabc` | `0aad0d6fdd236557` | testsrc2 320x240 4:2:2 + `--lossless=1` |
44+| `X_intrabc_tiled` | `e7c0c60af1a61531` | W + `--tile-columns=1 --tile-rows=1` |
45+| `Y_intrabc_10b` | `ce84d7cb4cfadf3f` | W at 10-bit |
46+
47+Committed as fixtures with size + `fnv1a64` pins (`0xb6d5c4653a32567a`,
48+`0xb6e04621d2116ef7`, `0x2ecf03435a14dbf`).
49+
50+**Instrumented geometry at the failing call**, measured on this tree, not
51+inherited:
52+
53+```
54+ZZLIC plane=1 ox=0 oy=0 org=(0,0) reg=(4,16) blk=(4,16) stride=4 maxidx=15 alloc=16
55+ZZLIC plane=1 ox=0 oy=4 org=(0,0) reg=(4,16) blk=(4,16) stride=4 maxidx=31 alloc=16
56+```
57+
58+A **4-wide × 16-tall** chroma plane block read at `stride` 4, needing 32
59+elements against the square's 16.
60+
61+### 1.1 The previous lane's 4:2:2-only claim is wrong
62+
63+Site 1 is **not** 4:2:2-specific, and this is measurable on a stream this
64+decoder already decodes. A **64x128 4:2:0** block's chroma plane block is
65+32x64, and `stride * stride` allocates 1024 where the walk addresses 2048:
66+
67+```
68+$ cargo run --example decode_probe ll420_a.obu # 4:2:0, --lossless=1
69+panicked at crates/ec-av1/src/decode.rs:37574:24:
70+range end index 1028 out of range for slice of length 1024
71+ZZLIC ... reg=(32,64) blk=(32,64) stride=32 maxidx=1023 alloc=1024
72+ZZLIC ... ox=0 oy=32 ... maxidx=1123 alloc=1024 <- overran
73+```
74+
75+This stream was never in any prior lane's corpus (the previous lane's 4:2:0
76+"lossless" family was encoded from a **4:2:2** y4m — `src_mandel_320x240.y4m`
77+carries `C422`, so those three cells were 4:2:2 all along and their "exact"
78+rows were measuring the wrong chroma format). I re-encoded the 4:2:0 corpus
79+from a real `yuv420p` source; §3 has those numbers.
80+
81+## 2. The per-site table
82+
83+Every site is one of: the composed grid's **allocation** (`stride * stride`),
84+or an **index/argument** that reads the enclosing square `chroma_side` =
85+`max(side >> ss_x, side >> ss_y)` where the plane block's own per-axis
86+`(bw >> ss_x, bh >> ss_y)` belongs. `chroma_side` equals the plane block
87+**exactly when `ss_x == ss_y`**, which is why every fix is inert at 4:2:0 and
88+4:4:4.
89+
90+| site | site (function) | old | new | 4:2:0 | 4:4:4 | gate | mutation |
91+|---|---|---|---|---|---|---|---|
92+| **1** | `read_inter_chroma_lossless` composed-grid extent | `stride * stride` | `stride * blk_h` | `blk_h == stride` → identical | identical | `the_422_lossless_inter_chroma_walk_sites_stay_per_axis`, row 1 | reds: *"site 1 … is BACK"* |
93+| **2** | `decode_inter_block` lossless TX_4x4 unit replay | `(cr*cu+rr) * chroma_side + cc*cu` | `… * chroma_stride + …` | identical | identical | same gate, site-2 assertion | reds: *"site 2 is BACK"* |
94+| **3** | *(the replay's unit counts)* | `write_h >> ss_y(fctx)` | **UNCHANGED — not a bug** | — | — | asserted in the gate's geometry table | n/a |
95+| **4** | `decode_inter_block` strip chroma rect, VERT arm | `else { (4, 8) }` | `else if ss_y == 0 { (4, 16) } else { (4, 8) }` | `(4,8)` — identical | `(4,16)` — identical | same gate, row 3 | reds: *"site 4 … is BACK"* |
96+| **5** | mu-chunk lossless walk stride (single-ref + compound) | `chroma_side` | `chroma_stride` | identical | identical | same gate, row 4 (flattened form) | reds: *"site 5 … is BACK"* |
97+| **6** | intra-in-inter walk block shape (both call sites) | `(chroma_side, chroma_side)` | `(chroma_stride, chroma_buf_h)` | identical | identical | same gate, site-6 assertion | reds: *"site 6 is BACK"* |
98+| **7** | `read_intra_chroma_lossless` composed-grid extent | `stride * stride` | `stride * blk_h` | identical | identical | same gate, row 2 | reds: *"site 7 … is BACK"* |
99+
100+### Site-by-site justification
101+
102+**Site 1.** `u_out`/`v_out` is the block's whole chroma **plane block** read at
103+`stride`, and libaom's plane block is per-axis. The walk addresses row
104+`org_y + reg_h - 1` at column `org_x + reg_w`; every one of the nine call
105+sites passes a region that is a sub-rect of `blk` with `org` inside `blk`, so
106+the requirement is exactly `stride * blk_h` (the last row's end
107+`(blk_h-1)*stride + blk_w` fits because `blk_w <= stride` at all nine). Where
108+the plane block is square — 4:2:0 and 4:4:4 on a square block — `blk_h ==
109+stride` and this reduces to the old expression **verbatim**. Measured panic
110+removed: `range end index 20 … length 16` gone on all three cells, **and**
111+`range end index 1028 … length 1024` gone on the 4:2:0 stream.
112+
113+**Site 2.** The composed grid this replays is the plane block at
114+`chroma_stride` — the same stride site 1 sized it at and the same stride
115+`read_inter_chroma_lossless` wrote it at. `chroma_side` at 4:2:2 is the LUMA
116+side, twice a strip block's plane-block width. Measured: `range end index 68
117+out of range for slice of length 64` on `W_intrabc` frame 1.
118+
119+**Site 3 is NOT a bug — the previous lane's site 3 was a misreading.** It
120+proposed changing the unit counts
121+
122+```rust
123+let (rows, cols) = ((write_h >> ss_y(fctx)).div_ceil(cu), (write_w >> ss_x(fctx)).div_ceil(cu));
124+```
125+
126+These are *already* per-axis: `>> ss_y` and `>> ss_x` are the plane block's own
127+axes, so `rows` counts chroma rows at 4:2:2 exactly as at 4:2:0. Measured on
128+the failing cell: `write=(8,16) ss=(1,0)` gives `rows=4, cols=1` against a
129+`(4,16)` plane block — correct. Applying the previous lane's
130+`(chroma_buf_h, chroma_stride)` rewrite would have been a no-op at best.
131+**Not changed.** The gate asserts the per-axis geometry table instead.
132+
133+**Site 4.** A `PARTITION_VERT_4` strip is 4x16 luma and pairs on **columns**
134+while `ss_x == 1` (`is_chroma_reference` on `mi_col` parity,
135+`av1_common_int.h:1454`), so the pair is 8x16 luma. 4:2:2 subsamples X only,
136+which leaves the pair's plane block at `8>>1 x 16>>0` = **4x16**, twice as
137+tall as 4:2:0's 4x8. Measured: a 4x16 vert strip got `chroma_stride = 4`,
138+`chroma_buf_h = 8`, a 32-sample grid, and the replay's last unit row read
139+index 64 of it. The HORZ arm needs **no** third shape at 4:2:2 and gets none:
140+a HORZ_4 strip pairs on rows only while `ss_y == 1`, and 4:2:2 has `ss_y == 0`,
141+so each 16x4 strip is its own chroma reference with its own `(8>>1, 4>>0)`
142+= (8,4) plane block — the number the existing arm already returned. The gate
143+asserts both of those geometries, so a future "simplification" that folds
144+the VERT arm back cannot pass silently.
145+
146+**Site 5.** The stride the walk indexes `su`/`sv` at is the **prediction
147+buffer's own** `chroma_stride` — the number `su`/`sv` were built at and the
148+number the composed grid is sized and written at (site 1). Measured on
149+`X_intrabc_tiled` frame 1: `cpx=64 cpy=0 reg=(32,64) blk=(64,128) ss=(1,0)`,
150+the walk addressed `oy*128 + ox` on a 64-wide 8192-sample buffer and the last
151+unit row ran off the end (`offset 8192 .. 8580 of 8192`).
152+
153+**Site 6.** The intra-in-inter twin of site 5. `palette_uv_bufs` is the decoded
154+colour-index map at `(write_w >> ss_x, write_h >> ss_y)` — per-axis already —
155+and the lossless walk windows it at this `stride`. Measured on
156+`Y_intrabc_10b.obu`: `buf_len=128 stride=16 org=(0,8)` put the third unit row
157+at index 180 (`palette_window`, `decode.rs:2946`).
158+
159+**Site 7.** `read_intra_chroma_lossless` carries site 1's defect verbatim,
160+including its own `(blk_w, blk_h)` parameter, so the intra twin gets
161+`stride * blk_h` too. Measured: `range end index 36 out of range for slice of
162+length 32`.
163+
164+## 3. End state, per cell, with controls
165+
166+Comparator: the crate's own `count_rawvideo_diffs` logic (via a throwaway
167+sweep harness modelled on it — oracle `aomdec --rawvideo` bytes read
168+directly, per-frame plane attribution from each decoded frame's own plane
169+lengths). A pristine-main binary was built in a separate worktree
170+(`~/.cache/wt/av1422base`, same harness, same probe bypass) so every number
171+below is a **diff against main**, not a claim.
172+
173+### 3.1 The three panic cells
174+
175+| cell | main `aef4fa67` | this lane |
176+|---|---|---|
177+| `W_intrabc` | **PANIC** `decode.rs:37565` | Golomb-tail refusal at frame 2 |
178+| `X_intrabc_tiled` | **PANIC** `decode.rs:37565` | Golomb-tail refusal at frame 2 |
179+| `Y_intrabc_10b` | **PANIC** `decode.rs:37565` | decodes 16/16, diverges Y 2 069 389 / U 1 031 181 / V 1 084 387 |
180+
181+All three panics are gone. None is byte-exact. §4 says why.
182+
183+### 3.2 Zero regressions — the full 33-cell diff
184+
185+Every cell re-run on both trees; `diff` of the two tables is **empty** except
186+the three cells above.
187+
188+| family | cells | main | this lane |
189+|---|---|---|---|
190+| 4:2:2 committed pins | `422_allskip_2f`, `422_intrabc_sb128_strip`, `…_notxsearch`, `422_residual_compound_warp_16f`, `…_nolr_16f`, `422_sb128_3f` | 6/6 EXACT | **6/6 EXACT** |
191+| 4:2:2 lossy corpus | `AA_inter_compound`, `AD_inter_nogm`, `A`,`B`,`C`,`D`,`E`,`F`,`H`,`I`,`J`,`K`,`L`,`R`,`T`,`U`,`V` | 17/17 EXACT | **17/17 EXACT** |
192+| 4:2:2 pre-existing divergences | `AB_inter_warp_odd`, `O_odd322x242`, `Q_odd320x242`, `S_odd326x242_10b` | DIVERGES | **DIVERGES, identical counts** |
193+| 4:2:0 lossless (re-encoded from a real `yuv420p` source) | `ll420_a/b/c/d` | 4/4 EXACT | **4/4 EXACT** |
194+| 4:4:4 lossless | `ll444_a`, `ll444_b` | 2/2 EXACT | **2/2 EXACT** |
195+| 4:4:4 lossless + altref | `ll444_c` | DIVERGES 7/16 | **DIVERGES, identical counts** |
196+| 4:2:0/4:4:4 all-intra lossless controls | `ll420_allintra`, `ll444_allintra` | 2/2 EXACT | **2/2 EXACT** |
197+
198+### 3.3 The site-4 lossy re-quote (the regression surface)
199+
200+Site 4 is the one change with a real regression surface: it alters
201+`chroma_stride`/`chroma_buf_h` for the **whole** of `decode_inter_block` at
202+4:2:2, including the LOSSY arms. Re-quoted individually, not as a set:
203+
204+| cell | shape exercising site 4 | main | this lane | bytes |
205+|---|---|---|---|---|
206+| `422_residual_compound_warp_16f` | vertical-midpoint compound + warp | EXACT 16/16 | EXACT 16/16 | 0 wrong |
207+| `422_residual_compound_warp_nolr_16f` | same, LR off | EXACT 16/16 | EXACT 16/16 | 0 wrong |
208+| `422_sb128_3f` | sb128 skip-heavy inter | EXACT 3/3 | EXACT 3/3 | 0 wrong |
209+| `AA_inter_compound` | compound inter, 40 frames | EXACT 40/40 | EXACT 40/40 | 0 wrong |
210+| `AD_inter_nogm` | inter, no global motion, 40 frames | EXACT 40/40 | EXACT 40/40 | 0 wrong |
211+| `L_tiled` / `T_tilecols2` / `U_tilerows1` / `V_tile2x2_odd` | tiled inter | EXACT 16/16 each | EXACT 16/16 each | 0 wrong |
212+| `AB_inter_warp_odd` | warp on odd dims | DIVERGES U 3 642 / V 10 186 | **identical** | unchanged |
213+
214+**Site 4 is not a regression.** Every lossy 4:2:2 arm that measured
215+byte-exact on main still measures byte-exact, to the sample, and the one
216+pre-existing divergence is unchanged in magnitude.
217+
218+### 3.4 Gates, with mutation proof
219+
220+`the_422_lossless_inter_chroma_walk_sites_stay_per_axis` — one assertion per
221+site. Every scan assertion has a **forbidden twin** (the square-cut spelling
222+is absent) *and* a **required twin** (the per-axis spelling is present), so
223+neither an unreverted site nor a matcher that stopped matching can pass.
224+
225+| mutation | result |
226+|---|---|
227+| site 1 → `stride * stride` | **RED** *"site 1 … is BACK"* |
228+| site 7 → `stride * stride` | **RED** *"site 7 … is BACK"* |
229+| site 2 → `chroma_side` | **RED** *"site 2 is BACK"* |
230+| site 4 → drop the `ss_y == 0` arm | **RED** *"site 4 … is BACK"* |
231+| site 5 → `chroma_side` at both mu-chunk walks | **RED** *"site 5 … is BACK"* |
232+| site 6 → `(chroma_side, chroma_side)` | **RED** *"site 6 is BACK"* |
233+
234+**Two matchers were dead on first write and are named as such.** Sites 5 and
235+6 initially passed their own revert mutation: the literals being searched for
236+never matched even *with* the fix in place, because a line-anchored matcher
237+cannot span the comment the fix itself writes into its argument list. That is
238+the `dead-matcher-positive-control` class, caught by running the mutation
239+rather than trusting the green. The gate now builds a **whitespace-flattened**
240+second form of each body for the matchers that span an argument list, and both
241+re-run mutations now red. A gate I did not mutate would have shipped two holes
242+in it.
243+
244+### 3.5 Gates run, scoped
245+
246+Clean tree at `69a3a4df`:
247+
248+- `the_pinned_422_lossless_inter_chroma_panics_refuse_by_name` — pass
249+- `the_422_lossless_inter_chroma_walk_sites_stay_per_axis` — pass
250+- `the_pinned_422_intrabc_sb128_strip_witnesses_refuse_by_name` — pass
251+- `the_pinned_422_bigblock_witnesses_are_present_and_refuse_by_name` — pass
252+- `the_pinned_422_lr_off_witness_is_present_and_refuses_by_name` — pass
253+- `the_pinned_422_residual_compound_warp_witness_is_present_and_refuses_by_name` — pass
254+- `a_lossless_libaom_inter_frame_decodes_sample_exact` — pass
255+- 4:4:4 family (`444`, `lossless`, `ll444` filters) — **62 passed, 0 failed**
256+- 4:2:0 family (`pixel_exact_420`, `420` filters) — **6 passed, 0 failed**
257+- oracle binary `~/.cache/aom-oracle/build/aomdec` (instrumented, rung 12)
258+
259+## 4. What is NOT byte-exact, and the control that names its owner
260+
261+The charter asked for the three cells byte-exact. **They are not.** The
262+residual is real, and the measurement below locates it **outside** this family.
263+
264+### 4.1 Two of them refuse; one decodes and diverges
265+
266+| cell | symptom | located at |
267+|---|---|---|
268+| `W_intrabc` | `a Golomb tail longer than this decoder reads` | mi (16,52) |
269+| `X_intrabc_tiled` | same | mi (8,64) |
270+| `Y_intrabc_10b` | decodes all 16 frames, diverges from frame 0 byte 16 (luma, got 40 want 68) | frame 0, first luma sample |
271+
272+A Golomb-tail refusal is always the **symptom** of an earlier desync (the code
273+says so at `decode.rs:7965`), never a reader gap.
274+
275+### 4.2 The control that decides it
276+
277+A **single-key-frame**, `--lossless=1` 4:2:2 stream with **no inter content
278+at all** — nothing in this family is reachable — diverges identically on this
279+tree and on main:
280+
281+| cell | main | this lane |
282+|---|---|---|
283+| `ll422_allintra` (1 key frame, all-intra, 4:2:2 lossless) | DIVERGES **Y 75 210 / U 38 234 / V 38 207** | **Y 75 210 / U 38 234 / V 38 207** — identical |
284+| `ll420_allintra` (same recipe, 4:2:0) | EXACT | EXACT |
285+| `ll444_allintra` (same recipe, 4:4:4) | EXACT | EXACT |
286+
287+**Byte-identical wrong-sample counts on the same recipe at two chroma
288+formats and clean at the other two.** The 4:2:2 lossless **intra** path
289+diverges from `aomdec` on main, before any inter chroma walk runs, and my
290+seven extents neither caused nor changed one sample of it. That is a
291+pre-existing defect with its own owner; chasing it here would be the
292+"substitute an easier problem" failure, and closing it is not what makes these
293+seven extents correct.
294+
295+`Y_intrabc_10b` diverges from **frame 0 byte 16** — its first key frame, i.e.
296+the same intra path. `W`/`X` reach frame 2 before their entropy desync, which is
297+where a *later* inter defect can still be hiding; I have not excluded that a
298+second inter-side defect exists behind the intra one. That is named in
299+`not_done`, not claimed clean.
300+
301+## 5. `not_done`
302+
303+- **The three cells do not decode byte-exact.** Two refuse with a Golomb-tail
304+ desync at frame 2, one diverges from frame 0. Exact reason and control: §4.
305+- **The 4:2:2 lossless INTRA path diverges from `aomdec`** (byte-identical on
306+ main and here, §4.2) — pre-existing, not in this family, **not fixed here**.
307+ It must be fixed before any of the three cells can reach byte-exact, and it
308+ is a separate lane.
309+- **A possible second inter-side defect behind the intra one is NOT excluded.**
310+ `W`/`X` desync at frame 2, and an intra-only stream already diverges, so the
311+ frame-2 desync cannot yet be attributed. Only "no panic" is claimed.
312+- **Site 4's HORZ arm was measured, not exercised by a witness.** The gate
313+ derives its (8,4) geometry; no pinned stream is cited as hitting it.
314+- **Decode-order (rung 12) comparison was not run on the three cells** — they
315+ do not decode to completion, so there is nothing to zip against the oracle's
316+ per-frame dumps. Presented-order only, and only for the cells that complete.
317+- **Full suite not run** (lane rules: scoped only; project-wide validation is
318+ Main's).
319+
320+## 6. Instrumentation disclosure
321+
322+Five temporary `eprintln` probes (`ZZLIC`, `ZZLIC2`, `ZZLIC3`, `ZZLIC4`,
323+`ZZLIC5`, `ZZGOL`) and one throwaway `examples/zz_sweep.rs`, **all removed**
324+before the commit — `crates/ec-av1/src/decode.rs` at `6d816368` contains only
325+the seven fixes and their comments. The `EC_AV1_ALLOW_422_PROBE` bypass at
326+`stream.rs` is patch-run-restore and is in **no** commit; `git status` is
327+clean. Nothing was added to the decoder or the oracle beyond the seven
328+expression changes.