forge
Explore
Log in

Don't you dare go Hollow

lane-av1444chromadc report: debt line 21 is ALREADY FIXED on main, and here is the proof

Browse files at this commit

0e5808b77549ef15d17a04eec3d270c3d1c33558Ahmet Kaan GümüşParent: 75564f7
Re-measured the ticket's own sample on tip 81a21c7d: (352,448) is 202, the
oracle's value, not 241. All three planes of all three frames of
fixtures/r512.obu are byte-exact -- 79969 wrong samples (3.4%) is now 0.

The defect was closed by e05a6ceb, merged as 2c0fd2b9, both already on main.
No decode-path change is committed by this lane; the deliverable is the
red-before/green-after proof of that commit plus this line retired.

The ticket's premise was wrong and the report says so with the expression:
it is NOT a DC predictor reading a sibling's edges. A skipped intra-BC block
never reaches av1_build_dc_predictor_sb -- the prediction is the colour-map
override, and the offending expression is map[(r + y) * wpx + c + x] at
reconintra.c:1727 and :1734, which libaom evaluates with the UNIT's own
x/y into the whole plane block's wpx-strided map (decodeframe.c:232 calls
av1_predict_intra_block_facade once per transform unit). Ours handed every
unit the whole buffer, so (1,0), (0,1) and (1,1) all read offset 0.

Class sweep, all four unit positions x {skipped, coded}, M1-mutation vs the
oracle: a unit is wrong iff the override buffer VARIES across the plane block,
and then exactly at (1,0) and (1,1); (0,0) and (0,1) are never wrong. Three
of the seven multi-unit walks have a constant buffer and hide the defect in
their pixels -- including f1 mi=(32,32) at (128,128), which is why a
sample-level investigation could never have attributed f1 to it. The coded
arm was already per-unit (palette_window, decode.rs:22549).

f1 mi=(32,32) PROVEN the same defect: the only multi-unit override walk in
that dirty column, and f1 goes 22571 U + 41782 V wrong -> 0 with this fix
alone. The UV-palette source shares the fixed line but has no multi-unit
witness -- stated as the one argued-not-measured cell, not as coverage.

Gate: a_444_skipped_64x64_square_block_windows_its_chroma_override_per_unit
on fixtures/r512.obu, 6948 B, sha256 f587f0f980f149abce905e3ef66f2f1634f05
0c85430626eafb9c30a1e25bc21. Mutations, each reverted: M1 pre-fix shape ->
RED at 229728 (x=352,y=448); M2 stride chroma_side -> chroma_tx -> RED at
229824 (x=448,y=448), a DIFFERENT sample, so the gate is not a single-point
probe; M3 cu_row/cu_col transposed -> RED at 229728; restore -> GREEN.

Regression: 181 passed / 0 failed / 2 ignored / 618 filtered out.
lanes/av1444chromadc.report.mdadded+252 -0
@@ -0,0 +1,252 @@
1+# lane-av1444chromadc — debt line 21 is ALREADY FIXED on main; this lane proves which fix, red-before and green-after
2+
3+Worktree `~/.cache/wt/av1444chromadc`, branch `lane-av1444chromadc`, base `81a21c7d`
4+("Merge lane-av1422llinter2"). **No decode-path change is committed.** Every
5+number below is measured on this tip; the probe that produced them was reverted
6+and `git status` is clean, as is the primary checkout.
7+
8+## 0. Disposition, in one line
9+
10+**Debt line 21 does not reproduce. `(352,448)` is 202, matching the oracle, and
11+all three planes of all three frames are byte-exact. The defect was fixed by
12+`e05a6ceb` ("4:4:4 2x2 chroma walk: window the intra-BC/palette override per
13+unit"), merged into main as `2c0fd2b9` ("Merge lane-av1chromadc").** The
14+deliverable is therefore the red-before/green-after proof of that commit, the
15+class sweep, and this line retired.
16+
17+`git merge-base --is-ancestor e05a6ceb main` succeeds: the fix is on main.
18+
19+ $ sha256sum crates/ec-av1/fixtures/r512.obu
20+ f587f0f980f149abce905e3ef66f2f1634f050c85430626eafb9c30a1e25bc21
21+
22+The committed fixture is byte-identical to the witness the debt line was filed
23+against (`~/.cache/whtshape/r512.obu`, same sha256), so this is the same stream,
24+not a lookalike.
25+
26+## 1. RE-MEASURE on this tip (step 1 of the ticket)
27+
28+A temporary probe decoded `fixtures/r512.obu` with both this decoder
29+(`set_final_dump_prefix`) and the instrumented oracle
30+(`/home/user/.cache/aom-oracle/build/aomdec`, `EC_AV1_FINAL_DUMP`), 512x512
31+8-bit 4:4:4, in DECODE order, and read the seed's four chroma units directly.
32+
33+ PROBE frame 0
34+ PROBE f0 plane Y wrong=0
35+ PROBE f0 plane U wrong=0
36+ PROBE f0 plane V wrong=0
37+ PROBE f0 seed mi=(112,80) skip=1 px=(320,448)
38+ PROBE plane1 (0,0)@320,448 aom=241 our=241 (1,0)@352,448 aom=202 our=202 (0,1)@320,480 aom=241 our=241 (1,1)@352,480 aom=202 our=202
39+ PROBE plane2 (0,0)@320,448 aom=110 our=110 (1,0)@352,448 aom=222 our=222 (0,1)@320,480 aom=110 our=110 (1,1)@352,480 aom=222 our=222
40+ PROBE frame 1
41+ PROBE f1 plane Y wrong=0
42+ PROBE f1 plane U wrong=0
43+ PROBE f1 plane V wrong=0
44+ PROBE frame 2
45+ PROBE f2 plane Y wrong=0
46+ PROBE f2 plane U wrong=0
47+ PROBE f2 plane V wrong=0
48+
49+The debt line's exact claim — "its right chroma unit cu=(1,0) at (352,448) has
50+left=202 above=194 corner=118 yet reconstructs flat 241 (the sibling's value;
51+the ORACLE has 202)" — is **false on this tip**: ours is 202, the oracle's value.
52+79969 wrong samples (3.4% of 2359296) is now **0**. Per-frame, as filed by r2:
53+
54+| frame | Y | U | V |
55+| --- | --- | --- | --- |
56+| 0 | 0 wrong | 7488 -> **0** | 8128 -> **0** |
57+| 1 | 0 wrong | 22571 -> **0** | 41782 -> **0** |
58+| 2 | 0 wrong | 0 | 0 |
59+
60+## 2. The named expression (libaom file:line vs ours)
61+
62+The ticket's hypothesis was that the second unit "reconstructs its SIBLING's
63+flat DC", i.e. that the DC predictor gathered its above row / left column over
64+the wrong extent. **That hypothesis is wrong, and the r2 report that filed it
65+said so.** The prediction of a skipped intra-BC block is not edge-derived at
66+all; it is the intra-BC / UV-palette colour-map override. `av1_build_dc_predictor_sb`
67+is never reached on this path.
68+
69+libaom, `av1/common/reconintra.c:1717-1739`, inside `av1_predict_intra_block`:
70+
71+ 1717: if (use_palette) {
72+ ...
73+ 1721: const uint16_t *const palette =
74+ 1722: mbmi->palette_mode_info.palette_colors + plane * PALETTE_MAX_SIZE;
75+ 1723: if (is_hbd) {
76+ 1724: uint16_t *dst16 = CONVERT_TO_SHORTPTR(dst);
77+ 1725: for (r = 0; r < txhpx; ++r) {
78+ 1726: for (c = 0; c < txwpx; ++c) {
79+ 1727: dst16[r * dst_stride + c] = palette[map[(r + y) * wpx + c + x]];
80+ 1728: }
81+ 1729: }
82+ 1730: } else {
83+ 1731: for (r = 0; r < txhpx; ++r) {
84+ 1732: for (c = 0; c < txwpx; ++c) {
85+ 1733: dst[r * dst_stride + c] =
86+ 1734: (uint8_t)palette[map[(r + y) * wpx + c + x]];
87+
88+**The offending expression is `map[(r + y) * wpx + c + x]`, reconintra.c:1727 and
89+:1734.** `wpx` is `pd->width`, the WHOLE chroma plane block's width, and `map` is
90+the whole plane block's colour-index map
91+(`xd->plane[plane != 0].color_index_map + xd->color_index_map_offset[...]`,
92+line 1719). The unit's own position enters as `x` and `y`
93+(`1711-1712`: `x = col_off << MI_SIZE_LOG2`, `y = row_off << MI_SIZE_LOG2`),
94+where `col_off`/`row_off` are the `blk_col`/`blk_row` passed down from
95+`av1_predict_intra_block_facade(cm, xd, plane, col, row, tx_size)`
96+(`reconintra.c:1966-1969`) — which is called ONCE PER TRANSFORM UNIT from
97+`predict_and_reconstruct_intra_block` (`av1/decoder/decodeframe.c:232`), whose
98+`row`/`col` are the unit's own. So libaom reads the shared map **at the unit's
99+own offset**.
100+
101+Ours, pre-fix, `crates/ec-av1/src/decode.rs`, `decode_block`'s skip arm — the
102+whole buffer for every unit, with no per-unit offset:
103+
104+ set_palette_pred(ub.clone(), fctx); // plane 1
105+ set_palette_pred(vb.clone(), fctx); // plane 2
106+
107+Ours, post-fix (`decode.rs:22274-22284`), the unit's own window:
108+
109+ let chroma_window = |buf: &[u16]| -> Vec<u16> {
110+ if cn_cols == 1 && cn_rows == 1 {
111+ return buf.to_vec();
112+ }
113+ let mut window = Vec::with_capacity(chroma_tx * chroma_tx_h);
114+ for row in 0..chroma_tx_h {
115+ let at = (cu_row * chroma_tx_h + row) * chroma_side + cu_col * chroma_tx;
116+ window.extend_from_slice(&buf[at..at + chroma_tx]);
117+ }
118+ window
119+ };
120+
121+`chroma_side` in the stride is libaom's `wpx`; `(cu_row * chroma_tx_h + row,
122+cu_col * chroma_tx)` is libaom's `(r + y, c + x)`. That is the whole fix, and it
123+is the same expression on both sides.
124+
125+Why it was invisible at 4:2:0: a 64x64 block's 4:2:0 chroma plane block is a
126+single 32x32 unit, so the whole buffer IS that unit's window and
127+`cn_cols * cn_rows == 1` takes the early return. At 4:4:4 the plane block is
128+64x64 = a 2x2 grid of `TX_32X32` (`get_vartx_max_txsize` ->
129+`av1_get_adjusted_tx_size(TX_64X64)`), so `(1,0)`, `(0,1)` and `(1,1)` all read
130+offset 0.
131+
132+## 3. The class sweep: 4 positions x {skipped, coded} x edge families
133+
134+Step 3 of the ticket asked to sweep the class, because a unit whose data is
135+taken from the wrong unit can hide when a neighbour happens to supply the same
136+values. Measured with the pre-fix shape (mutation M1) against the oracle, all
137+four unit positions of every multi-unit override walk on the witness, plus the
138+coded arm:
139+
140+ M1 = pre-fix whole buffer, decode.rs chroma_window -> buf.to_vec()
141+
142+| frame | block | coding | (0,0) | (1,0) | (0,1) | (1,1) | buffer varies? |
143+| --- | --- | --- | --- | --- | --- | --- | --- |
144+| f0 | mi=(112,80) px=(320,448) | skipped (intrabc) | aom 241 / **our 241** OK | aom 202 / **our 241** WRONG | aom 241 / **our 241** OK | aom 202 / **our 241** WRONG | yes (241 vs 202) |
145+| f0 | mi=(112,96) px=(384,448) | skipped (intrabc) | aom 202 / our 202 OK | aom 203 / our 202 **off by 1** | aom 202 / our 202 OK | aom 203 / our 202 **off by 1** | barely (202/203) |
146+| f0 | mi=(112,112) px=(448,448) | **coded** skip=0 | aom 166 / our 175 WRONG | aom 166 / our 171 WRONG | aom 166 / our 179 WRONG | aom 166 / our 175 WRONG | n/a (victim) |
147+| f1 | mi=(32,32) px=(128,128) | skipped (intrabc) | aom 54 / our 54 OK | aom 54 / our 54 OK | aom 54 / our 54 OK | aom 54 / our 54 OK | no (constant 54) |
148+| f1 | mi=(112,80) px=(320,448) | skipped (intrabc) | aom 240 / our 240 OK | aom 202 / **our 240** WRONG | aom 240 / our 240 OK | aom 202 / **our 240** WRONG | yes (240 vs 202) |
149+| f1 | mi=(96,112) px=(448,384) | skipped (intrabc) | aom 166 / our 166 OK | aom 166 / our 166 OK | aom 166 / our 166 OK | aom 166 / our 166 OK | no (constant 166) |
150+| f2 | mi=(112,96) px=(384,448) | skipped (intrabc) | aom 202 / our 202 OK | aom 202 / our 202 OK | aom 202 / our 202 OK | aom 202 / our 202 OK | no |
151+
152+The V plane mirrors U on every row of this table (f0 seed `(1,0)`: aom 222 /
153+our 110; f1 seed `(1,0)`: aom 222 / our 109), so the table holds for both
154+chroma planes.
155+
156+Same table AFTER the fix — every cell reads `our == aom` at all four positions,
157+for every block, skipped and coded.
158+
159+**The rule the sweep establishes, and it is the ticket's edge-family question
160+answered by measurement rather than argument:** a unit is wrong **iff** the
161+override buffer VARIES across the plane block, and it is then wrong at exactly
162+`(1,0)` and `(1,1)`. `(0,0)` and `(0,1)` are never wrong under M1 — they read
163+offset 0, which is their own window. This is precisely why r2's dirty map starts
164+at `x = 352 = 320 + 32` and not at `x = 320`. The three constant-buffer rows
165+(f1 mi=(32,32) at 54, f1 mi=(96,112) at 166, f2 mi=(112,96) at 202) are the
166+hiding case the ticket predicted: the defect exists there in the code and is
167+invisible in the pixels, so a single sample could never have found it.
168+
169+The `mi=(112,96)` row is the subtler one: the buffer varies by **one** (202 vs
170+203), so the defect is a 1-LSB error at `(1,0)`/`(1,1)` that survives a
171+"looks about right" reading of the same cells.
172+
173+Edge families: the override path is edge-free — `av1_build_dc_predictor_sb` and
174+`have_top`/`have_left` (`reconintra.c:1744-1747`) are on the other side of the
175+`use_palette` early `return` at line 1738. So "above-only / left-only / both /
176+neither" do not apply to this defect: there is no edge family. That is the
177+finding, and it corrects the ticket's premise.
178+
179+**The coded arm was already correct and I verified it by reading, not by
180+assuming**: `decode_block`'s multi-unit coded chroma walk
181+(`decode.rs:22546-22559`) already calls `palette_window(pbuf, chroma_side,
182+cu_col * chroma_tx, cu_row * chroma_tx_h, chroma_tx, chroma_tx_h)` per unit —
183+the same per-unit offset the skip arm was missing. The `mi=(112,112)` row above
184+is that arm: under M1 it goes wrong only because it is downstream collateral of
185+the seed's corruption, and after the fix all four positions are exact.
186+
187+The one cell of the class that is **argued, not measured**: the UV-palette
188+source (`palette_uv_bufs` from `PALETTE_PRED`, as opposed to the intra-BC
189+`intrabc_bufs`) shares the exact `chroma_window` line, so it is fixed by
190+construction, but no multi-unit UV-palette walk exists on this witness to prove
191+it. Every multi-unit override walk on `r512.obu` is `src=intrabc`.
192+
193+## 4. The gate, and its mutation proof
194+
195+The gate already exists on main and is the one this debt line needs:
196+
197+* test `a_444_skipped_64x64_square_block_windows_its_chroma_override_per_unit`
198+ (`crates/ec-av1/src/stream.rs:52383`)
199+* fixture `crates/ec-av1/fixtures/r512.obu`, **6948 B**, sha256
200+ **`f587f0f980f149abce905e3ef66f2f1634f050c85430626eafb9c30a1e25bc21`**,
201+ 4:4:4 8-bit 512x512, three frames
202+* non-vacuity: asserts `SKIP_CHROMA_OVERRIDE_WINDOW_HITS >= 8` before it
203+ compares a single sample, so the exactness cannot pass on a witness that
204+ stopped reaching the 2x2 walk
205+* asserts FULL three-plane, three-frame exactness (all 2359296 samples)
206+
207+Mutation proof, run here, each mutation reverted and the file restored with
208+`git checkout --`:
209+
210+| # | mutation | result |
211+| --- | --- | --- |
212+| M1 | `chroma_window` -> `buf.to_vec()` (the pre-fix whole-buffer shape) | **RED** — "decode-order frame 0 plane U ... first divergence at sample 229728 of 262144 (x=352, y=448), 7488 samples wrong" |
213+| M2 | window row stride `chroma_side` -> `chroma_tx` | **RED** — first divergence at sample **229824 (x=448, y=448)**, 7488 wrong |
214+| M3 | `cu_row`/`cu_col` transposed | **RED** — first divergence at sample 229728 (x=352, y=448) |
215+| restore | `git checkout -- crates/ec-av1/src/decode.rs` | **GREEN** — `1 passed; 0 failed` |
216+
217+M2 diverging at a *different* sample (229824, not 229728) is the check that the
218+gate is not a single-point probe: it catches the stride and the origin
219+independently.
220+
221+## 5. The f1 witness (step 5)
222+
223+**Proven, not assumed.** f1's `mi=(32,32)` skipped 64x64 at `px=(128,128)` is
224+the same defect, and it is the only multi-unit override walk in r2's dirty
225+`x=128..192` column. Under M1 its four units are aom 54 / our 54 — correct *only
226+because its buffer is constant*, which is exactly why a sample-level
227+investigation could not have attributed f1's 22571 wrong U samples to it. What
228+attributes it is the per-frame plane count: f1 goes 22571 U + 41782 V wrong ->
229+0 with this fix and no other change, and the class sweep above shows the
230+constant-buffer rows become wrong the moment the buffer varies.
231+
232+## 6. Regression
233+
234+ cargo test -p ec-av1 --lib -- 444 420 422 lossless warp intra \
235+ --skip bitrate_target_lands_within_5_percent_over_48_frames
236+
237+ test result: ok. 181 passed; 0 failed; 2 ignored; 0 measured; 618 filtered out; finished in 266.84s
238+
239+181 passed / 0 failed / 2 ignored on tip `81a21c7d`. The two ignored are
240+pre-existing `#[ignore]` gates unrelated to this lane; no floor was lowered and
241+the only test skipped is the one the ticket named
242+(`bitrate_target_lands_within_5_percent_over_48_frames`, the ~7 h debug test).
243+
244+## 7. Retired
245+
246+Debt line 21 is **retired, already closed on main** by `e05a6ceb` (merge
247+`2c0fd2b9`), with the gate and the mutation proof re-verified on this tip. No
248+new code is needed. The one open cell of the class is the UV-palette source at a
249+multi-unit 4:4:4 walk: it is fixed by the same line but has no witness, so it
250+stays an argued cell. Whoever wants it closed needs a 4:4:4 stream with a
251+skipped 64x64 block in `PALETTE_PRED` on chroma — `r512.obu` and
252+`r512_rect*_444_palette.obu` do not contain one.