forge
Explore
Log in

Don't you dare go Hollow

lanes/av1chromarect-r3: the r512.obu chroma residual is 0 on main, proven by mutation

Browse files at this commit

a4c05600d2788f4f936fe3209f200aba6a82b4caAhmet Kaan GümüşParent: 91004d1
The ticket asked for a re-measurement before any change. On main 70ed5601, a
temporary per-(frame, plane) wrong-sample counter over fixtures/r512.obu
(512x512 8-bit 4:4:4, three frames, instrumented aomdec EC_AV1_FINAL_DUMP vs
set_final_dump_prefix) reads 0 wrong of 2359296, with IBC_OWNED_RECT_CHROMA_FOOTPRINT_444_HITS
= 5 and SKIP_CHROMA_OVERRIDE_WINDOW_HITS = 24 on the same decode.

The 0 is not a blind compare: putting decode_block's pre-lane-av1chromadc
chroma_window shape back (one line, the single-unit early return made
unconditional, so every chroma unit takes the whole override buffer) reproduces
the ticket's numbers digit for digit -- f0 U 7488 / V 8128 first at 229728
(x=352, y=448), f1 U 22571 / V 41782 first at 65704 (x=168, y=128), 79969 total
-- and reds both committed gates. The residual was closed by 2c0fd2b9 (windowed
per-unit chroma override), not by lane-av1ibcfork's footprint correction; the
mutation places all 79969 in chroma_window.

No decode-path change. Gate floors untouched: the strip gate's EXACT_PREFIX is
already [[262144; 3]; 3], full byte-exactness, and the mutation message quoting
"the exact prefix this gate pins is 262144" is the proof.
lanes/av1chromarect-r3.report.mdadded+162 -0
@@ -0,0 +1,162 @@
1+# lane-av1chromarect-r3 — the `r512.obu` chroma residual is already 0 on main
2+
3+Worktree `~/.cache/wt/chromarect-r3`, branch `lane-av1chromarect-r3`, base
4+`70ed5601`. **No decode-path change is committed on this branch**: the ticket's
5+first measurement came back at zero, so there is nothing left to fix. The
6+working tree at commit time is byte-identical to main; the only file added is
7+this report.
8+
9+Result shape: the same as `lane-av1loss444` — a re-measurement that closes the
10+ticket with numbers instead of a patch.
11+
12+## 1. First measurement: per (frame, plane) WRONG-SAMPLE COUNT on current main
13+
14+Not the gate's own verdict — a temporary probe test that decoded
15+`crates/ec-av1/fixtures/r512.obu` (6948 B, 512x512 8-bit 4:4:4, three frames),
16+dumped both sides and COUNTED mismatching samples per (frame, plane) instead of
17+panicking on the first one. Compare method, named in full:
18+
19+* oracle: the instrumented libaom `aomdec` at `~/.cache/aom-oracle/build/aomdec`,
20+ `aomdec --codec=av1` with `EC_AV1_FINAL_DUMP=<prefix>`, per-frame dumps
21+ `<prefix>.f0/.f1/.f2`;
22+* ours: this crate's `decode_stream` with `set_final_dump_prefix(<prefix>)`, the
23+ same rung, so both sides are the SHOWN 8-bit planes in decode order;
24+* unit of comparison: one sample, 262144 per plane, `3 * 3 * 262144 = 2359296`
25+ samples total; luma exactness is checked, not assumed.
26+
27+With `EC_AV1_REQUIRE_AOMDEC=1 EC_AV1_REQUIRE_AOMENC=1 EC_AV1_REQUIRE_FIXTURES=1`
28+and a private `CARGO_TARGET_DIR`, on main `70ed5601` unmodified:
29+
30+ ibc_rect_hits=5 skip_window_hits=24
31+ f0 Y: 0 wrong from 262144 f0 U: 0 wrong from 262144 f0 V: 0 wrong from 262144
32+ f1 Y: 0 wrong from 262144 f1 U: 0 wrong from 262144 f1 V: 0 wrong from 262144
33+ f2 Y: 0 wrong from 262144 f2 U: 0 wrong from 262144 f2 V: 0 wrong from 262144
34+ TOTAL 0 wrong from 2359296
35+
36+Both engagement counters fired on the same decode (`IBC_OWNED_RECT_CHROMA_FOOTPRINT_444_HITS
37+= 5`, matching the five `EC_HALV` strips the earlier rounds counted, and
38+`SKIP_CHROMA_OVERRIDE_WINDOW_HITS = 24`), so the 0 is measured on a decode that
39+reached the arms, not on a witness that stopped exercising them. The probe was
40+removed before the commit; it is not in the diff.
41+
42+**The ticket's residual is 0. 79969 → 0 happened on main, not in this lane.**
43+
44+## 2. Who closed it, and by what mechanism
45+
46+`2c0fd2b9` — "Merge lane-av1chromadc: the skipped-block chroma override is
47+windowed per unit (79969 → 0)", whose report is
48+`lanes/av1chromadc.report.md`. It is in main's history and predates this lane's
49+base.
50+
51+Mechanism, restated because the ticket asks for it and r2's `NOT DONE` left it
52+open: at 4:4:4 a skipped 64x64 square block has a **64x64 chroma plane block**,
53+which libaom walks as a 2x2 grid of `TX_32X32` units
54+(`get_vartx_max_txsize` → `av1_get_adjusted_tx_size(TX_64X64) = TX_32X32`; the
55+64-point `av1_get_max_eob` truncation is a luma rule, and the chroma walk steps
56+by `tx_size_*_unit[max_tx_size]`, decodeframe.c:994-1004). r2 read the dirty map
57+correctly and stopped one step short: the defect is **not** a per-unit DC
58+predictor. It is that the block's chroma prediction is not edge-derived at all —
59+it is the intra-BC / UV-palette **override** carried whole on the `PALETTE_PRED`
60+slot (`decode_block`'s `intrabc_bufs` / `palette_uv_bufs` →
61+`set_palette_pred` → `PlaneBuf::reconstruct`'s `pred`), and `reconstruct` uses
62+the buffer it is handed as the UNIT's own `side x side` prediction. The pre-fix
63+call handed every unit the whole buffer, so at 4:4:4 each unit predicted from
64+the block's top-left unit. At 4:2:0 the chroma plane block of a 64x64 block is
65+one 32x32 unit, so the whole buffer IS that unit's window and the defect is
66+structurally invisible — which is why no 4:2:0 gate ever went red.
67+
68+The site is `decode_block`'s skip-arm chroma unit loop (both planes),
69+`crates/ec-av1/src/decode.rs:21938` — the `chroma_window` closure — and it is
70+outside `decode_intrabc_owned_rect`, which is why the strip arm's own counters
71+(`IBC_OWNED_RECT_CHROMA_FOOTPRINT_444_HITS`) are unchanged by the fix.
72+
73+## 3. Non-vacuity: the 0 is not a blind compare
74+
75+A compare that cannot fail proves nothing, so the closing arm was put back the
76+way it was before the fix and the SAME probe re-run. Mutation: `chroma_window`'s
77+`if cn_cols == 1 && cn_rows == 1` early return changed to `if true`, i.e. every
78+unit gets the whole buffer — the pre-fix shape, in one line.
79+
80+ f0 Y: 0 wrong f0 U: 7488 wrong from 262144, first=229728 (x=352, y=448)
81+ f0 V: 8128 wrong from 262144, first=229728 (x=352, y=448)
82+ f1 Y: 0 wrong f1 U: 22571 wrong from 262144, first=65704 (x=168, y=128)
83+ f1 V: 41782 wrong from 262144, first=65704 (x=168, y=128)
84+ f2: all three planes 0
85+ TOTAL 79969 wrong from 2359296
86+
87+Those are the ticket's numbers, the r2 numbers and the r1 numbers, digit for
88+digit, including both first-divergence coordinates. So the compare reaches the
89+seed (`x=352 = 320 + 32`, the 2x2 chroma grid boundary of the skipped 64x64 at
90+`px=(320,448)`) and the f1 column (`x=168, y=128`, inside the skipped 64x64 at
91+`px=(128,128)`), and the green 0 on the unmutated tree is a real measurement.
92+
93+Both COMMITTED gates also red under the same one-line mutation, and green
94+without it:
95+
96+| gate | mutation | unmutated |
97+| --- | --- | --- |
98+| `a_444_skipped_64x64_square_block_windows_its_chroma_override_per_unit` | **FAILED** — `frame 0 plane U … first divergence at sample 229728 of 262144 (x=352, y=448), 7488 samples wrong` | ok |
99+| `a_444_intrabc_owned_rect_strip_sizes_its_chroma_plane_block_and_decodes` | **FAILED** — `frame 0 plane U diverges at sample 229728 of 262144 (x=352, y=448) -- the exact prefix this gate pins is 262144` | ok |
100+
101+The second gate is the one whose floors the ticket names. Its `EXACT_PREFIX` is
102+`[[262144; 3]; 3]` — FULL byte-exactness on all three planes of all three
103+frames, raised from `[[262144, 229728, 229728], [262144, 65704, 65704],
104+[262144, 262144, 262144]]`. No floor was lowered by this lane, because this
105+lane changed no floor. The mutation message quoting `the exact prefix this gate
106+pins is 262144` is the proof that the floor is already at the top.
107+
108+## 4. Corroborating gate families, clean tree, no change
109+
110+ $ EC_AV1_REQUIRE_AOMDEC=1 EC_AV1_REQUIRE_AOMENC=1 EC_AV1_REQUIRE_FIXTURES=1 \
111+ cargo test -p ec-av1 --lib -- a_444 lossless_444 intrabc_rect 444_lossless
112+ test result: ok. 37 passed; 0 failed; 0 ignored; 0 measured; 736 filtered out
113+
114+(`a_444_intrabc_owned_rect_strip_sizes_its_chroma_plane_block_and_decodes` and
115+`a_444_skipped_64x64_square_block_windows_its_chroma_override_per_unit` are
116+both in that set.) The wide family, same env, same filter string:
117+
118+ $ EC_AV1_REQUIRE_AOMDEC=1 EC_AV1_REQUIRE_AOMENC=1 EC_AV1_REQUIRE_FIXTURES=1 \
119+ cargo test -p ec-av1 --lib -- rect intrabc ibc chroma 444 420 subsampl
120+ test result: ok. 145 passed; 0 failed; 5 ignored; 0 measured; 623 filtered out; 246.13s
121+
122+The 5 `#[ignore]`d tests are main's (two superblock-size globals, a directional
123+sweep, an intrabc probe needing the real-library manifest, the rectx recipe
124+sweep). This branch is byte-identical to main outside this report, so there is
125+no set-difference against main to run.
126+
127+`cargo check -p ec-av1 --all-targets` clean, 0 errors 0 warnings, on the private
128+`CARGO_TARGET_DIR`, and `git status --porcelain` empty after the probe was
129+removed — a green gate next to an unbuilt tree would have been a stale binary.
130+
131+## 5. The two refuted premises, confirmed as refuted
132+
133+Both were named in the ticket as already refuted and were not re-derived. For
134+the record, what the measurement says about each:
135+
136+* **"ours 2688 vs oracle 2395 reads"** — not reachable from this ticket: no
137+ coefficient read is involved in a zero-residual skipped block, and the
138+ pixel-level compare above reproduces the residual to the digit without any
139+ symbol accounting.
140+* **"the skip-arm footprint"** (lane-av1ibcfork, `e7152d26`) — that fix landed
141+ and is correct on its own witness (`444_intrabc_rect4_witness.obu`, full
142+ exactness, gate `a_444_intrabc_rect4_witness_is_byte_exact_after_the_skip_arm_footprint`),
143+ but it is **not** what closed THIS residual. Restoring the pre-`chromadc`
144+ windowing shape on top of both fixes reproduces 79969 exactly, which places
145+ the whole residual in `chroma_window` and leaves nothing for the footprint
146+ correction to explain on this stream.
147+
148+## 6. Not done
149+
150+1. The **UV-palette arm** of the class (`palette_uv_bufs` on a non-intrabc
151+ multi-unit chroma walk) still has no witness. It shares the fixed line with
152+ the intra-BC arm, but the measurement is inherited, not observed. Unblock: a
153+ 4:4:4 encode with `--enable-palette=1` and a SKIPPED block of side 64 or
154+ above, `--min-partition-size=64`, and a gate reading
155+ `SKIP_CHROMA_OVERRIDE_WINDOW_HITS` with `src=palette` distinguished from
156+ `src=intrabc`. That encode was not run here.
157+2. `decode_intrabc_rect` (the non-`owned` sibling) and the other rect chroma
158+ paths were not re-verified against a multi-unit override; they window per
159+ unit already and this lane changed nothing. Unblock: a witness per path, or
160+ one sweep of all override-carrying rect arms.
161+3. No heavy encode, no server fleet run. The measurement is fixture-driven against
162+ the local instrumented oracle; this lane requested no fleet capacity.