forge
Explore
Log in

Don't you dare go Hollow

lane-av1422verify: refute-first pass over 19b16ffd (grain) and 2677c97a (census)

Browse files at this commit

1d955801d552144965dec6171be13bbc6f36df5aAhmet Kaan GümüşParent: e267222
Both fixes are RIGHT. Every load-bearing figure reproduces, most of them digit-for-digit,
on instruments of my own rather than the lanes' own.

Grain (19b16ffd). Measured against ffmpeg 8.1.3 through the post-grain sink path
(EC_AV1_FINAL_DUMP is pre-grain, so the dump comparator cannot be used here):
g422_t5 / g422_t11 / g444_t5 / g422_10_t5 all byte-exact per plane, plus a 12-bit
4:2:2 cell and an 11-cell ragged-geometry sweep (66x66, 100x50, 130x34, 34x130,
322x242, ...) that are also byte-exact. The negative control was reproduced on the
ACTUAL pre-fix tree 697b1308 rather than on a reconstruction of it: 0/23370/22631,
exactly the lane's figure, luma exact, no panic. And 4:4:4 grain is RED at
19b16ffd~1 (45612/43755 of each chroma plane) and GREEN after -- the pre-fix geometry
really was silently wrong there too. All three libaom traps verified against the C with
lines quoted, including re-deriving that row csub_y at stride 2>>ss_x equals the C's
flat element offset for every ss_x. Controls: 8 and 95, both reproducing exactly.

Census (2677c97a). Built before/after binaries from one tree differing in the arming
expression alone: [0,0,0] -> [2338,1328,1328] on a 4994-unit walk, digit-for-digit on
all four cells. All five 4:2:0/4:4:4 controls IDENTICAL across the widening. The strip
domain was re-enumerated independently: 12 iterations, 12 distinct (strip, format) pairs,
so nothing is double-counted, and hit == handled so no arm fell out of reach. Both
mutations re-run and bite.

The self-flagged gaps hold and are understated, not overstated: chroma422_chunk and
chroma422_pair_wide read 0 on all EIGHTEEN 4:2:2 cells, not just four, and the dump
path really is pre-grain (byte-identical with and without EC_AV1_NO_GRAIN=1, 76.7%/55.5%/
52.6% from ffmpeg). That finding is a sequencing trap for the lift and the census lane
caught it before someone else did.

No decode defect in either patch. Two documentation findings, reported as corrections:
the census report's strip-derivation table has one wrong cell (32x64 at 4:4:4 is
(32,32), not (16,32); the code is right), and the 19b16ffd merge message claims a
committed 4:2:2/4:4:4 byte-exactness gate that is not in the tree -- the lane report is
honest about deferring it, the commit message is not.

Primary checkout untouched and clean; both bypassed scratch trees restored and removed.
lanes/av1422verify.report.mdadded+518 -0
@@ -0,0 +1,518 @@
1+# lane-av1422verify — refutation pass over `19b16ffd` (grain) and `2677c97a` (census)
2+
3+**Role:** refute-first. Every load-bearing figure below was re-derived with my own
4+instruments, not read off the lane report.
5+**Trees:** `main` = `2677c97a`. My worktree `lane/av1422verify` (clean, no decoder edits).
6+Scratch trees `vfy-after` (main) and `vfy-prefix` (`697b1308` = `19b16ffd~1`) were
7+patched, measured, restored, and **removed**.
8+**Instruments:** ffmpeg 8.1.3 (pixel oracle), the oracle `aomenc`
9+(`~/.cache/aom-oracle/build/aomenc`), the C at `~/.cache/aom-oracle/src/av1/decoder/grain_synthesis.c`.
10+
11+## 0. Verdict summary
12+
13+| # | Claim | Verdict |
14+|---|---|---|
15+| G-a | a real 4:2:2 grain stream decodes byte-exact | **CONFIRMED** |
16+| G-b | negative control: forcing ss back to (1,1) fails `0/23370/22631`, no panic, no counter | **CONFIRMED** (and strengthened — measured on the real pre-fix tree, not a mutation) |
17+| G-c | the pre-fix geometry was also wrong for 4:4:4 | **CONFIRMED** |
18+| G-d | the three libaom traps (block size, luma-unit walk, flat element offset) | **CONFIRMED**, lines quoted in §3 |
19+| G-e | `grain_hits()` rises per cell **and the gate re-parses OBUs to assert `apply_grain`** | **PARTIAL** — the counter claim is unmeasurable from outside the crate; **the committed gate does not exist** |
20+| G-f | controls unchanged: `--lib film_grain` 8 passed, blast sweep 95 passed | **CONFIRMED** |
21+| C-1 | arming at ss (0,0) alone made every unit counter read 0 on 4:2:2; widening makes them move | **CONFIRMED**, all four cells digit-for-digit |
22+| C-2 | 4:2:0 (405) and 4:4:4 (11292, 1373) control counts unchanged | **CONFIRMED** with my own before/after binaries |
23+| C-3 | strip enumeration walks `[(0,0),(1,0),(1,1)]`, `checked == 12`, no unit missing | **CONFIRMED**, but **one cell of the report's own derivation table is wrong** (see §7 F1) |
24+| C-4 | `chroma422_chunk` / `chroma422_pair_wide` read 0 | **CONFIRMED** and strengthened: 0 on **all 18** 4:2:2 cells, not just four |
25+| C-5 | `g422_t5` is walk-shape only, not comparator-clean through the dump path | **CONFIRMED**, and the dump is provably pre-grain |
26+
27+**No code defect found in either patch.** The port is faithful to the C at every site I
28+checked, the census widening is a one-expression change with disjoint conditions, and
29+every counter's "every exit path" claim holds in the source. The two findings below are
30+**figure/claim defects in the committed documentation**, not decode defects.
31+
32+---
33+
34+## 1. Grain: the 4:2:2 / 4:4:4 exactness claim, re-derived
35+
36+### 1.1 Method
37+
38+`EC_AV1_FINAL_DUMP` is pre-grain (§5), so the grain comparator must go through the
39+in-memory sink. `decode_probe`'s `EC_PROBE_OUT` / `EC_PROBE_OUT16` are written from the
40+`decode_stream_with` sink closure, i.e. from the **post-grain** `output` picture
41+(`stream.rs:1326-1335` builds `output` by calling `apply_grain` and `reorder.push`es it;
42+the sink drains `reorder`). Oracle: `ffmpeg -i cell.obu -pix_fmt yuv422p -f rawvideo`.
43+8-bit cells use `EC_PROBE_OUT` (u16 planes narrowed to u8 — lossless at 8-bit); the
44+10/12-bit cells use `EC_PROBE_OUT16` (u16 LE), never a u8 narrowing.
45+
46+### 1.2 AFTER (`main` = `2677c97a`), mine beside the lane's
47+
48+| cell | format | mine (Y / U / V differing) | lane §6 |
49+|---|---|---|---|
50+| `g422_t5.obu` | 4:2:2 8b | **0/76800, 0/38400, 0/38400** | byte-exact |
51+| `g422_t11.obu` | 4:2:2 8b | **0/76800, 0/38400, 0/38400** | byte-exact |
52+| `g444_t5.obu` | 4:4:4 8b | **0/76800, 0/76800, 0/76800** | byte-exact |
53+| `g422_10_t5.obu` | 4:2:2 10b | **0/153600B, 0/76800B, 0/76800B** | byte-exact |
54+| `g422_12b.obu` (**mine, not the lane's**) | 4:2:2 **12-bit** | **0/153600B, 0/76800B, 0/76800B** | — |
55+
56+The lane tested 8-bit and 10-bit at 4:2:2 and 8-bit at 4:4:4. I added a **12-bit 4:2:2**
57+cell (`aomenc --profile=2 --input-bit-depth=12 --bit-depth=12 --film-grain-test=5`;
58+`ffprobe`: `subsampling_x: 1, subsampling_y: 0`, `seed 17968`) to hit the
59+`grain_range`/`scale_lut` bit-depth-generic path at a third depth. It is byte-exact too.
60+
61+### 1.3 PRE-FIX (`697b1308` = `19b16ffd~1`) — the negative control, and claim G-c
62+
63+The lane produced its negative control by mutating `Ss::read` in a scratch tree. I did
64+not need to: I built the **actual pre-fix tree** with only the probe bypass, so the
65+negative control measures the defect rather than a reconstruction of it.
66+
67+| cell | `697b1308` (mine) | lane §5 (their mutation) |
68+|---|---|---|
69+| `g422_t5.obu` | Y=**0**/76800, U=**23370**/38400 (max 8), V=**22631**/38400 (max 16) | `(0, 23370, 22631)` |
70+| `g422_t11.obu` | Y=0/76800, U=23788/38400 (max 7), V=22884/38400 (max 16) | — |
71+| `g444_t5.obu` | Y=0/76800, U=**45612**/76800 (max 16), V=**43755**/76800 (max 16) | — |
72+
73+**G-b CONFIRMED, digit-for-digit**, and on a stronger instrument than the lane used. The
74+shape is exactly as described — luma exact, chroma wrong, no panic (exit 0), no refusal.
75+
76+**G-c CONFIRMED**: `g444_t5.obu` is RED at `19b16ffd~1` (59% / 57% of each chroma plane
77+wrong) and GREEN at `19b16ffd`. The pre-fix geometry really was silently wrong for 4:4:4.
78+
79+### 1.4 Grain synthesis provably ran (the params-without-apply false green)
80+
81+`grain_hits()` is `pub(crate)` and **not reachable from `decode_probe`** — the only
82+instrument that can read a 4:2:2 stream while the header refusal stands. I substituted
83+a stronger differential: decode the same bytes with `EC_AV1_NO_GRAIN=1` and compare to
84+the normal sink output.
85+
86+```
87+g422_t5: sink differs from EC_AV1_NO_GRAIN=1 in 100396 samples
88+g444_t5: sink differs from EC_AV1_NO_GRAIN=1 in 144020 samples
89+```
90+
91+Grain synthesis ran and changed the picture. (Incidentally 100396 is exactly the figure
92+the census lane independently measured for this cell — see §5.)
93+
94+### 1.5 Comparator liveness — my own, on all four cells
95+
96+One oracle sample flipped per plane, then the plane-diff tuple must be exactly `(1,1,1)`:
97+
98+```
99+TAMPER g422_t5: (1, 1, 1)
100+TAMPER g422_t11: (1, 1, 1)
101+TAMPER g444_t5: (1, 1, 1)
102+TAMPER g422_10_t5: (1, 1, 1)
103+```
104+
105+The comparator reads both sides. A zero above would have been meaningless.
106+
107+### 1.6 Ragged-geometry sweep (mine, not the lane's) — 11/11 byte-exact
108+
109+The four committed cells are all 320x240-ish. The port's per-axis clipping is where a
110+ragged tail would break, so I encoded and compared eleven more geometries, including
111+tall-thin (`34x130`), narrow-short (`100x50`, `130x34`) and sub-block (`66x66`):
112+
113+```
114+g422_320x240 (0,0,0) g422_322x242 (0,0,0) g422_66x66 (0,0,0)
115+g422_64x98 (0,0,0) g422_100x50 (0,0,0) g422_130x34 (0,0,0)
116+g444_320x240 (0,0,0) g444_66x66 (0,0,0) g444_100x50 (0,0,0)
117+g444_34x130 (0,0,0) g444_162x98 (0,0,0)
118+```
119+
120+All BYTE-EXACT. `g444_34x130` in particular forces `ver_boundary_overlap`'s `width == 2`
121+arm (the `27/17` blend, dead at 4:2:0) over a ragged tail — the claim that the port makes
122+those arms live holds against the oracle, not just against the in-crate reference.
123+
124+---
125+
126+## 2. Grain controls (claim G-f)
127+
128+```
129+$ cargo test -p ec-av1 --lib film_grain
130+test result: ok. 8 passed; 0 failed; 0 ignored; 0 measured; 800 filtered out
131+$ cargo test -p ec-av1 --lib -- 422 444 chroma
132+test result: ok. 95 passed; 0 failed; 0 ignored; 0 measured; 713 filtered out
133+$ EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib \
134+ a_pixel_exact_444_stream_walks_the_same_coefficient_units
135+test result: ok. 1 passed; 0 failed
136+```
137+
138+**G-f CONFIRMED.** The 8 and the 95 reproduce exactly.
139+
140+---
141+
142+## 3. The three libaom traps, against the C
143+
144+Read from `~/.cache/aom-oracle/src/av1/decoder/grain_synthesis.c` (oracle snapshot).
145+
146+### Trap (a) — the chroma BLOCK is `16 << (1 - ss)`, not `chroma_subblock_size << (1 - ss)`
147+
148+`add_noise_to_block` sizes its loop from **luma half-extents** scaled per axis:
149+
150+```c
151+680| for (int i = 0; i < (half_luma_height << (1 - chroma_subsamp_y)); i++) {
152+681| for (int j = 0; j < (half_luma_width << (1 - chroma_subsamp_x)); j++) {
153+```
154+
155+and every caller passes the *luma* half-extent, capped at `luma_subblock_size >> 1 = 16`:
156+
157+```c
158+1285| AOMMIN(luma_subblock_size_y >> 1, height / 2 - y) - i,
159+1286| AOMMIN(luma_subblock_size_x >> 1, width / 2 - x) - j, bit_depth,
160+```
161+
162+So the block is `16 << (1 - ss_y)` by `16 << (1 - ss_x)`: 16x16 at 4:2:0, **32x16 at
163+4:2:2**, **32x32 at 4:4:4**. `chroma_subblock_size << (1 - ss)` (where
164+`chroma_subblock_size = 32 >> ss`) would give 64 at `ss == 0` — 2x. **Trap confirmed.**
165+
166+Rust, `film_grain.rs:1494-1502` (and the twin at `:2285-2287`):
167+
168+```rust
169+// the block size is `16 << (1 - ss)`, NOT `chroma_subblock_size << (1 - ss)`: the two differ wherever
170+let cblk_stride = ((LUMA_SUBBLOCK >> 1) << (1 - ss.x)) as usize;
171+let cblk_rows = ((LUMA_SUBBLOCK >> 1) << (1 - ss.y)) as usize;
172+```
173+
174+`LUMA_SUBBLOCK >> 1 == 16`. Matches the C.
175+
176+### Trap (b) — the block walk is in LUMA units at every subsampling
177+
178+```c
179+1080| for (int y = 0; y < height / 2; y += (luma_subblock_size_y >> 1)) {
180+1083| for (int x = 0; x < width / 2; x += (luma_subblock_size_x >> 1)) {
181+```
182+
183+`height / 2` and `width / 2` are **luma** and must not become the chroma stride. Only the
184+chroma ORIGIN and EXTENT derived from them are per-axis — the origin is
185+`(y + i) << (1 - chroma_subsamp_y)` (`:1129-1130`, `:1143-1144`, `:1269-1270`).
186+**Trap confirmed.**
187+
188+Rust, `film_grain.rs:1363` and `:1418-1421`:
189+
190+```rust
191+let chroma_row = |y: usize| (2 * y) >> ss.y;
192+let nrows = ((height / 2).max(0) as usize).div_ceil(row_step as usize);
193+```
194+
195+`(2*y) >> ss.y` is `(y + i) << (1 - ss_y)`. Matches.
196+
197+### Trap (c) — `copy_area`'s `cb_col_buf + (chroma_subblock_size_y << (1 - ss_x))` is a FLAT ELEMENT offset
198+
199+The C's `copy_area` takes a **pointer**, and advances it by the stride itself:
200+
201+```c
202+873| static void copy_area(int *src, int src_stride, int *dst, int dst_stride,
203+874| int width, int height) {
204+875| while (height) {
205+876| memcpy(dst, src, width * sizeof(*src));
206+877| src += src_stride;
207+```
208+
209+so `src_row0 * src_stride + src_col0` is how a row index reaches an offset. The call:
210+
211+```c
212+1296| copy_area(
213+1297| cb_col_buf + (chroma_subblock_size_y << (1 - chroma_subsamp_x)),
214+1298| 2 >> chroma_subsamp_x,
215+1299| cb_line_buf + (x << (1 - chroma_subsamp_x)), chroma_stride,
216+1300| 2 >> chroma_subsamp_x, 2 >> chroma_subsamp_y);
217+```
218+
219+The first argument is a flat element offset into `cb_col_buf`; the *second* is the stride.
220+Rust's `copy_area` (`film_grain.rs:1217-1226`) takes an explicit `src_row0`, so the flat
221+value had to be folded back into a row index. The port passes `csub_y`:
222+
223+```rust
224+copy_area(&mut cb_line_buf, c_stride, 0, x << (1 - ss.x),
225+ &cb_col_buf, ss.two_x(), csub_y, 0, ss.two_x(), ss.two_y(), fctx);
226+```
227+
228+**I re-derived the arithmetic independently:** row `csub_y` at stride `2 >> ss_x` is
229+`csub_y * (2 >> ss_x)`, and `2 >> ss_x == 1 << (1 - ss_x)`, so this equals
230+`csub_y << (1 - ss_x)` = `chroma_subblock_size_y << (1 - ss_x)` — the C's flat offset, for
231+every `ss_x`. And the lane's "len is 68 but the index is 128 at 4:4:4" checks out against
232+the C's allocation (`(csub_y + (2 >> ss_y)) * (2 >> ss_x)` = `(32 + 2) * 2 = 68`):
233+passing the flat `64` as a row index addresses `64 * 2 = 128`, past the end.
234+**Trap confirmed, and the port's row index is the only correct one.**
235+
236+### Other sites I checked and found faithful
237+
238+`ver_boundary_overlap` chroma width `2 >> ss_x` and height
239+`AOMMIN(csub_y + (2 >> ss_y), (height - 2y) >> ss_y)` (`:1104-1120`) →
240+`film_grain.rs:1558` `hc_count`; `hor_boundary_overlap` chroma width
241+`AOMMIN(csub_x - ((x?1:0) << (1-ss_x)), (width - ((x?x+1:0) << 1)) >> ss_x)` (`:1183-1194`)
242+→ `film_grain.rs:1658-1659` `cskip` / `cw`; the two blend coefficient sets
243+`23/22` vs `27/17` and `17/27` (`:912-939`, `:941-970`) → `overlap_inplace`'s
244+`skip == 1` / `j == 0` / else arms and the reference's `(2 >> ss_y) == 1` / `i == 0` / else
245+arms; `average_luma` horizontal pair at `ss_x == 1` and bare sample at `ss_x == 0`
246+(`:683-691`) → `film_grain.rs:797-810` `if pair { ... } else { ... }`, and the SIMD
247+dispatch guard `if pair && n >= 4 && Avx2` (`film_grain.rs:756`) which correctly never
248+sends a 4:4:4 row to the pair-shaped AVX2 kernel.
249+
250+Two arm-counter facts, because they bear on G-c: `chroma422_square/rect/sub8` and
251+`ibc128` are all **0** on a 4:4:4 cell (`s444_320x240`) — the 4:2:2 arms are correctly keyed
252+to `ss (1,0)` and did not start firing at 4:4:4.
253+
254+---
255+
256+## 4. Census: the widening, re-derived
257+
258+### 4.1 Method
259+
260+Two `decode_probe` builds from **the same tree**, differing in exactly one expression —
261+`set_census_nonsub`'s `ss_x == 0 || ss_y == 0` vs `ss_x == 0 && ss_y == 0`:
262+
263+```
264+before = main + probe print, arming reverted to (ss_x == 0 && ss_y == 0)
265+after = main
266+```
267+
268+Both carry the probe bypass so both can decode 4:2:2 at all.
269+
270+### 4.2 C-1 — the 4:2:2 delta (mine vs the lane's §3.2)
271+
272+| cell | mine BEFORE | mine AFTER | lane AFTER |
273+|---|---|---|---|
274+| `s422_320x240` | `[0,0,0]` / coded `[0,0,0]`, total **4994** | `[2338,1328,1328]` / coded `[1020,843,949]` | `[2338,1328,1328]` / `[1020,843,949]` / 4994 |
275+| `s422_320x242_10b` | `[0,0,0]`, total **4344** | `[2046,1149,1149]` / coded `[860,799,825]` | identical |
276+| `s422_326x240` | `[0,0,0]`, total **5664** | `[2798,1433,1433]` / coded `[1200,876,1029]` | identical |
277+| `s422_416x250_10b` | `[0,0,0]`, total **5779** | `[2927,1426,1426]` / coded `[1068,837,996]` | identical |
278+| `g422_t5` (mine) | `[0,0,0]`, total **2501** | `[1443,529,529]` / coded `[238,268,269]` | identical |
279+
280+**C-1 CONFIRMED, digit-for-digit on all five cells.** `units_total` is unchanged across
281+the widening, which is what makes the `[0,0,0]` column a vacuity proof rather than an
282+empty walk: the decode walked 4994 units while the census read zero.
283+
284+### 4.3 C-2 — the controls, byte-for-byte against `19b16ffd`
285+
286+```
287+av1_192x128_8bit_intra64_in_inter 4:2:0 IDENTICAL [0,0,0]/[0,0,0] total 405
288+s420_320x240 4:2:0 IDENTICAL [0,0,0]/[0,0,0] total 3514
289+ll444_minp8_inter 4:4:4 IDENTICAL [3764,3764,3764]/[975,1793,1859] total 11292
290+444_lossy_rect4_inter_witness 4:4:4 IDENTICAL [629,372,372]/[130,253,278] total 1373
291+s444_320x240 4:4:4 IDENTICAL [2920,2104,2104]/[1178,1367,1561] total 7128
292+```
293+
294+**C-2 CONFIRMED** with my own binaries (not the lane's). The two conditions are
295+disjoint, so the 4:2:0 zero control and the 4:4:4 exact counts are structurally unable to
296+move — and they did not. The existing 4:4:4 gate that pins `[3764,3764,3764]` /
297+`[975,1793,1859]` against libaom's `EC_ECDUMP_IN` still passes.
298+
299+Whole-sweep check over all 54 cells (18 per format):
300+
301+```
302+4:2:2 cells with a NON-ZERO per-plane census: 18/18
303+4:2:0 cells reading exactly [0,0,0]: 18/18
304+4:4:4 cells with a NON-ZERO per-plane census: 18/18
305+```
306+
307+### 4.4 C-3 — the strip enumeration: 12 distinct units, no double-count
308+
309+I re-derived the domain independently of the Rust loop (same `wl/hl` bounds, same
310+`max == 64` and `ratio in {2,4}` filters, the same three formats, the same
311+`min(_, 32)` cap) and printed every row:
312+
313+```
314+16x64 ss(0,0) chroma 16x64 unit (16,32) IN 16x64 ss(1,0) chroma 8x64 unit (8,32) IN
315+16x64 ss(1,1) chroma 8x32 unit (8,32) IN 32x64 ss(0,0) chroma 32x64 unit (32,32) IN
316+32x64 ss(1,0) chroma 16x64 unit (16,32) IN 32x64 ss(1,1) chroma 16x32 unit (16,32) IN
317+64x16 ss(0,0) chroma 64x16 unit (32,16) IN 64x16 ss(1,0) chroma 32x16 unit (32,16) IN
318+64x16 ss(1,1) chroma 32x8 unit (32,8) IN 64x32 ss(0,0) chroma 64x32 unit (32,32) IN
319+64x32 ss(1,0) chroma 32x32 unit (32,32) IN 64x32 ss(1,1) chroma 32x16 unit (32,16) IN
320+
321+checked = 12 distinct (strip, format) pairs = 12 distinct units = 5
322+hit == handled: True hit = [(8,32),(16,32),(32,8),(32,16),(32,32)]
323+```
324+
325+- **12 iterations, 12 distinct `(strip, format)` pairs — nothing is counted twice.**
326+- Every resolved unit is a member of the `handled` set, so the
327+ `decode_block_rect64` `_` arm stays dead for 4:2:2: **C-3's "no unit missing" claim holds.**
328+- `hit == handled` holds, so the non-vacuity assert (`the enumeration stopped exercising
329+ every arm`) is not vacuous either — all five arms are still hit.
330+
331+Mutation proof, re-run by me (removing `(1, 0)` from the loop):
332+
333+```
334+$ cargo test -p ec-av1 --lib every_chroma_unit_a_64_axis_strip
335+assertion `left == right` failed: the strip domain is not the four 64-axis strips
336+ x three codable chroma formats (4:4:4, 4:2:2, 4:2:0)
337+ left: 8
338+ right: 12
339+```
340+
341+Restored (`git checkout --`); the test passes again. Reverted and re-verified.
342+
343+**The `(0,1)` exclusion is sound.** `sequence.rs:481` reads `subsampling_y` only when
344+`subsampling_x == 1` (and the 12-bit branch at `:479-483` does the same), so the reachable
345+set is exactly `{(1,1), (1,0), (0,0)}` and 4:4:0 cannot be handed to the decoder. The
346+existing gate `the_440_cell_is_not_a_codable_chroma_shape` passes.
347+
348+### 4.5 What a 4:2:2 gate can now assert (the census lane's §5)
349+
350+Demonstrated: `census_nonsub_units()` and `census_nonsub_coded()` read `[0,0,0]` on a
351+4:2:2 cell **by construction** under the old arming, and non-zero per plane under the new
352+one, on the same bytes. A gate could therefore assert non-zero on every plane and have it
353+be a real statement about the stream. Before the widening that assertion was a literal.
354+
355+**One caveat for whoever writes that gate**, which I measured and which neither report
356+states: the counters are `thread_local!`, and so is `census_unit_n()`. With
357+`EC_AV1_THREADS=4` (default is 1, `stream.rs:410-421`):
358+
359+```
360+EC_AV1_THREADS=1 4:4:4 [3764,3764,3764] total 11292 4:2:2 [2338,1328,1328] total 4994
361+EC_AV1_THREADS=4 4:4:4 [ 768, 768, 768] total 2304 4:2:2 [1081, 427, 427] total 1935
362+```
363+
364+They read **partial**, not zero, so the failure mode is a plausible wrong number rather
365+than an obvious one. This is a pre-existing property of every counter in the crate and is
366+why `decode_threads()` defaults to 1 and documents that choice; it is not introduced here.
367+But §3.5 of the census report hands these numbers to a future gate as "the numbers a
368+committed gate should pin", and a gate must pin them under `EC_AV1_THREADS=1` (or assert
369+`units_total` consistency) or it is thread-count dependent.
370+
371+---
372+
373+## 5. The self-flagged gaps, checked rather than accepted
374+
375+### C-4 — `chroma422_chunk` / `chroma422_pair_wide`: really 0, on all 18 cells
376+
377+```
378+for all 18 sweep/s422_*.obu:
379+ chroma422_chunk: 0 chroma422_pair_wide: 0 intrabc_128rect_chroma_chunk: units=0 shape=0x0
380+```
381+
382+The report says 0 "on all four cells". It is 0 on **every** 4:2:2 cell in the 54-cell
383+sweep — stronger than claimed, and the conclusion is unchanged: no 4:2:2 gate can claim
384+128-root chunked chroma or the 4-wide strip pair on this evidence.
385+
386+Reading the two arm sites confirms what would reach them and that the census would count
387+their units if they ran:
388+
389+- `decode.rs:30892` `hit!(CHROMA422_CHUNK_HITS)` is keyed to `invalid_ss_plane` — the
390+ 128-root chunked chroma walk — reached through `read_inter_plane_rect`, so its units
391+ **would** be inside a census total. The blocker is a recipe, not the census.
392+- `decode.rs:13084` `hit!(CHROMA422_PAIR_WIDE_HITS)` is keyed to `chroma_422_pair_wide`,
393+ documented at `decode.rs:2211-2216` as "keyed to a 2-px-wide chroma block, which only a
394+ 1-mi-wide strip at ss (1, 0) produces". Same conclusion.
395+
396+So the census's structural reach does cover those arms; it is the fixture set that does
397+not. The report's framing is accurate.
398+
399+### C-5 — `g422_t5` really is unusable through the dump path
400+
401+Proved, not taken on faith. `EC_AV1_FINAL_DUMP` writes the pre-grain picture
402+(`stream.rs:2216-2233`, the `final_dump` block inside the function that returns
403+`FrameOutput { picture, .. }`, before `apply_grain` runs at `:1326`):
404+
405+```
406+$ EC_AV1_FINAL_DUMP=dump_grain decode_probe g422_t5.obu
407+$ EC_AV1_FINAL_DUMP=dump_nograin EC_AV1_NO_GRAIN=1 decode_probe g422_t5.obu
408+$ cmp dump_grain.f0 dump_nograin.f0 -> IDENTICAL
409+```
410+
411+Byte-identical with and without grain synthesis: the dump is pre-grain. Against ffmpeg's
412+post-grain rawvideo:
413+
414+```
415+DUMP-PATH Y: 58877/76800 differ (76.7%), max delta 4
416+DUMP-PATH U: 21325/38400 differ (55.5%), max delta 12
417+DUMP-PATH V: 20194/38400 differ (52.6%), max delta 16
418+```
419+
420+**Exactly** the census report's §7.2 figures (76.7% / 55.5% / 52.6%, max 16). The
421+self-flag is accurate and correctly attributed: the cause is the dump's placement, not the
422+decode. The grain lane's `g422_t5` byte-exactness claim (§6 of its report) is reproducible
423+only through the in-memory sink, exactly as the census lane says.
424+
425+This matters for sequencing: a grain-cell gate written on the `EC_AV1_FINAL_DUMP` path will
426+be red for a reason unrelated to film grain. That is a real trap and the census lane caught
427+it before someone else did.
428+
429+---
430+
431+## 6. Non-vacuity summary
432+
433+| requirement | evidence | bites? |
434+|---|---|---|
435+| grain comparator reads both sides | flipped oracle sample per plane → exactly `(1,1,1)` on 4 cells | yes |
436+| grain synthesis actually ran at 4:2:2 | `EC_AV1_NO_GRAIN=1` differential, 100396 samples | yes |
437+| the grain pass comes from this port | real pre-fix tree `697b1308`, `0/23370/22631` | yes |
438+| strip enumeration is load-bearing | `(1, 0)` removed → `left: 8, right: 12` | yes |
439+| census arming is load-bearing | `(ss_x==0 && ss_y==0)` → `[0,0,0]` on a 4994-unit walk | yes |
440+| 4:2:0 / 4:4:4 controls unmoved | before/after binaries IDENTICAL on 5 controls | yes |
441+| census counts every reading unit | `read_coeffs` has one `return` (`decode.rs:8403`, `all_zero`) and calls `census_unit` at `:8393` **before** it; `read_coeffs_rect` likewise (`:8690` before `:8692`). No other `return` in either function. | yes |
442+
443+---
444+
445+## 7. Findings
446+
447+### F1 — the census report's strip-derivation table has a wrong cell
448+
449+`lanes/av1422census422.report.md:46` lists the 32x64 strip at 4:4:4 as resolving to chroma
450+unit **`16x32`**. The loop it is supposed to be transcribing computes
451+`(bw >> ss_x, bh >> ss_y).min(32)`; at `ss (0,0)` a 32x64 strip is a **32x64** chroma
452+block, so the unit is **`(32, 32)`**. My independent enumeration of the domain prints
453+`32x64 ss(0,0) chroma 32x64 unit (32,32) IN`.
454+
455+The code is right — the test's own enumeration and its `arms == handled` pin both use the
456+correct value, and the test passes. Only the report's table is wrong, and it is wrong in
457+the one direction that would matter if someone re-derived the domain from the prose: it
458+makes the 4:4:4 32x64 row look like it lands on the same arm as the 16x64 row, which is
459+not true. Fix the cell to `(32, 32)`.
460+
461+The remaining three rows and the 4:2:2 column are correct, and the report's prose
462+("the cap resolves both to `(16, 32)`" for the 32x64 pair) is correct.
463+
464+### F2 — the merge message on `19b16ffd` claims a committed gate that is not in the tree
465+
466+The `19b16ffd` commit message asserts three things about instrumentation:
467+
468+> "A real 4:2:2 film-grain stream decodes byte-exact with `grain_hits()` rising per cell
469+> (3 -> 4), **the gate re-parses the OBUs and asserts a frame header carries
470+> `film_grain.apply_grain`** ... **Coverage closed**: 4:2:2 and 4:4:4 film grain had NO
471+> test before this lane"
472+
473+`crates/ec-av1/src/film_grain.rs` contains exactly four `#[test]`s
474+(`simd_matches_scalar_luma_noise_row`, `simd_matches_scalar_chroma_noise_row`,
475+`untouched_planes_and_ragged_tail_come_back_clean`,
476+`ragged_overlap_tail_matches_spec_reference`), and
477+`crates/ec-av1/fixtures/` contains no grain fixture. There is **no committed 4:2:2 or
478+4:4:4 byte-exactness gate** — the measurements live in a scratch tree that was deleted.
479+
480+Two of the three assertions are still true. `ragged_overlap_tail_matches_spec_reference`
481+*is* now driven over all three formats from one per-axis reference with the
482+last-chroma-row assertion, and I ran it (part of the 8). But the *oracle* comparison — the
483+thing that catches a regression against libaom rather than against our own transcription —
484+is not in the tree. `grain_hits()` is `pub(crate)` and unreachable from `decode_probe`, the
485+only instrument that can read a 4:2:2 stream while the refusal stands, so no external
486+check can substitute for it either.
487+
488+The lane's own report is honest about this (§9: "The end-to-end gate is NOT committed, and
489+cannot be until the guard is lifted"), so this is a merge-message overclaim, not a hidden
490+gap. It still matters: the commit message is what a reviewer reads, and it says the coverage
491+is closed when a whole-stream regression would pass unnoticed. I reproduced the four cells
492+byte-exact independently (§1.2), so the fix is right — the risk is purely that nothing
493+guards it.
494+
495+### Non-findings (checked, clean)
496+
497+- No decode defect found in `film_grain.rs` or `decode.rs`. Every geometry expression I
498+ traced back to the C matches, including the three traps and the two `== 2` blend arms.
499+- The census widening is a one-expression change; `census_unit` is called on every exit path
500+ of both readers, before the return, so the "counts every reading unit" claim holds.
501+- `chroma422_*` arms correctly do not fire at 4:4:4, so the widening did not silently
502+ re-key an arm.
503+- `census_nonsub_units` / `census_nonsub_coded` being made `pub` while `grain_hits` stayed
504+ `pub(crate)` is an asymmetry, not a defect: an in-crate `#[cfg(test)]` gate can read
505+ `grain_hits` fine.
506+
507+## 8. Discipline
508+
509+- Primary checkout `/home/user/Documents/Code/Rust/edith_codecs`: `git status --porcelain`
510+ **empty**; `TEMP-PROBE-BYPASS` count **0** in `stream.rs`, `decode.rs`,
511+ `refusal_inventory.rs`, `film_grain.rs`. Nothing was edited there.
512+- This worktree: no decoder source modified; only this report is added.
513+- `vfy-after` and `vfy-prefix` were the only bypassed trees; both were `git checkout --`-restored
514+ and then `git worktree remove --force`'d. `git worktree list` no longer lists either.
515+- Two mutations were run (census arming revert, strip-format narrowing). Both were reverted in
516+ the same tree and the tree verified clean before removal.
517+- `EC_AV1_ALLOW_422_PROBE` was never used — the bypass was patch-run-restore, as the env var
518+ is inert.