forge
Explore
Log in

Don't you dare go Hollow

lane-cpu2formatprobe: the --cpu-used 2 luma divergence is FORMAT-SPECIFIC -- 16/16 supported cells byte-exact, the 4:2:2 cells refuse by name

Browse files at this commit

63036d2c6554e9e5f5d66b4609915e3c2ecd90f6Ahmet Kaan GümüşParent: 0b7aabe
The 4:2:2 census's finding that `rc2_s422_320x242` diverges on 890107 samples INCLUDING 436945 LUMA raised the
question that mattered more than the 4:2:2 lift decision: does the same encoder setting break a SUPPORTED cell?
Answer, measured: no. Sixteen cells (4:2:0 and 4:4:4 x 320x242 and 256x128 x 8-bit and 10-bit x --cpu-used 2 and
--cpu-used 6) all decode byte-exact against aomdec -- 0 differing samples on EVERY plane of every decode frame,
17 frames each -- while four 4:2:2 cells from the same recipe refuse by name. So the cpu-used 2 divergence is
specific to the refused format and is not a live defect in any supported cell.

Comparator discipline, because this is exactly the class of claim two refutations already caught this wave:
the census's own cmp422.py is IMPORTED rather than reimplemented; both sides dump decode-order frames through
the depth-correct EC_AV1_FINAL_DUMP (never the u8-narrowing dump); geometry comes from the y4m header, never a
file size, and a frame whose length disagrees with the geometry is a hard error; plane attribution is per frame
from that frame's own plane lengths; and a wrong sample is one bps-wide unit so 10-bit samples cannot hide
behind a byte compare. Two controls ran BEFORE any verdict: 54 per-cell per-plane oracle-sample flips, all 54
biting (and 8 cross-stream same-geometry pairs, all 8 diverging, which rules out comparing our stream with
itself). Report-only: no decoder source edited, no fix proposed.

The report also records an instrument trap worth keeping: importing the census's comparator while leaving its
WORK root stale silently pointed the driver at a previous run's dumps, which is how a first pass of the
cross-stream control "passed" on random pairs; the re-run fixed it by pairing at equal geometry.
lanes/cpu2formatprobe.report.mdadded+258 -0
@@ -0,0 +1,258 @@
1+# lane-cpu2formatprobe — does the `--cpu-used 2` luma divergence bite a SUPPORTED format?
2+
3+**Outcome in one line: no. At the census's exact `--cpu-used 2` recipe, 4:2:0 and 4:4:4 at
4+8 and 10 bit are byte-exact against `aomdec` in 16 of 16 cells (0/0/0 wrong samples on
5+every plane of every decode frame), while the same recipe's 4:2:2 cells still refuse by
6+name — the luma divergence is FORMAT-SPECIFIC to 4:2:2, which is the refused format, so
7+it is not a live defect in any supported cell at this encoder setting.**
8+
9+Report-only. No decoder source was edited, nothing was committed, no fix is proposed.
10+Tree under test: `main` = **`e0818f17`** of `/home/user/Documents/Code/Rust/edith_codecs`.
11+
12+---
13+
14+## 1. Provenance
15+
16+| role | binary | path |
17+|---|---|---|
18+| our decoder | `decode_probe` example, built from `main` `e0818f17` | `/home/user/.cache/tgt/cpu2probe/debug/examples/decode_probe` (`cargo build -p ec-av1 --example decode_probe`, `CARGO_TARGET_DIR=/home/user/.cache/tgt/cpu2probe`) |
19+| oracle encoder | instrumented `aomenc` | `/home/user/.cache/aom-oracle/build/aomenc` |
20+| oracle decoder | instrumented `aomdec` (carries the `EC_AV1_FINAL_DUMP` rung) | `/home/user/.cache/aom-oracle/build/aomdec` |
21+| source video | system `ffmpeg` 8.1.3, `testsrc2` | `ffmpeg` |
22+
23+Both sides dump **decode-order** frames as `EC_AV1_FINAL_DUMP=<prefix>` writing
24+`<prefix>.f<N>` by DECODE index, hidden alt-refs included. The comparator is the 4:2:2
25+census's own `cmp422.py`, **imported, not reimplemented**:
26+`/home/user/.cache/census422b/cmp422.py` (plus its `run.py::y4m_geometry`). Driver
27+and controls: `/home/user/.cache/cpu2probe/{run,liveness,cross}.py`, cells in
28+`/home/user/.cache/cpu2probe/cells/`, dumps in `…/work/`, JSON in
29+`…/{results,liveness,cross}.json`.
30+
31+The four disciplines that instrument carries, unchanged:
32+
33+1. **Geometry is an explicit argument**, parsed from `aomdec`'s OWN y4m header
34+ (`W320 H242 … C422` / `C420p10`), never from a file size; a frame whose length
35+ disagrees with the geometry is a hard error.
36+2. **Plane attribution is per frame**, from that frame's own plane lengths.
37+3. **A wrong sample is one `bps`-wide unit** — at 10 bit the walk is over 16-bit LE
38+ samples, so the top bits cannot hide.
39+4. **A count over zero frames is a hard error** naming the vacuous `0/0/0`.
40+
41+---
42+
43+## 2. Inputs, built correctly
44+
45+Source: `ffmpeg -f lavfi -i "testsrc2=size=WxH:rate=25" -frames:v 16 -pix_fmt <pix> -f rawvideo`.
46+
47+The y4m is assembled by the census's own builder (`mksweep.sh`/`mkrecipe.sh`, copied
48+verbatim into `/home/user/.cache/cpu2probe/mkencode.sh`): libaom's `y4m_input_fetch_frame`
49+requires the six bytes `FRAME\n` **before every frame**, which is the framing bug that
50+made the earlier "42 encode" sweep weak evidence. This builder writes a correct y4m (and
51+asserts the raw length is a whole number of frames before writing). All 20 encodes decode
52+to 16 shown frames each, so no input was the degenerate zero-frame case.
53+
54+## 3. Encoder command lines
55+
56+One command, five variables, everything else held fixed — so **format is the only
57+independent variable** and the encoder mode is identical to the census's `rc` recipe:
58+
59+```bash
60+AOMENC=/home/user/.cache/aom-oracle/build/aomenc
61+$AOMENC --codec=av1 --profile=<0:420|1:444|2:422> \
62+ --input-bit-depth=<8|10> --bit-depth=<8|10> \
63+ --limit=16 --lag-in-frames=25 --auto-alt-ref=1 --enable-global-motion=1 \
64+ --pass=1 --cq-level=24 --threads=4 --kf-min-dist=0 --kf-max-dist=999999 \
65+ --width=<W> --height=<H> --cpu-used=<2|6> --obu -o <cell>.obu <cell>.y4m
66+```
67+
68+`--pass=1` is libaom's `--end-usage=q` (constant quality), `--cq-level=24` is the census's
69+value, and `--cpu-used` is the only flag varied along the recipe axis. This is the census's
70+`mkrecipe.sh` flag set verbatim; **it reproduces the census's own 4:2:2 bytes exactly**,
71+which is the provenance proof that the recipe is the same recipe:
72+
73+| cell | mine | census (`census422b/recipe.log`) |
74+|---|---|---|
75+| `rc2_s422_320x242` | 20600 B, `3bd62e422dfb7911` | 20600 B, `3bd62e42…` |
76+| `rc6_s422_320x242` | 21310 B, `462f39ec882b9425` | 21310 B, `462f39ec…` |
77+
78+Cells: geometries 320x242 (odd height) and 256x128; formats 4:2:0, 4:4:4, 4:2:2; depths
79+8 and 10 (4:2:2 at 8 bit only — the format the census swept); `--cpu-used` 2 and 6.
80+20 cells.
81+
82+---
83+
84+## 4. Results — per cell, per plane, per decode frame
85+
86+Wrong **sample** counts, decode-order basis, geometry taken from `aomdec`'s own y4m
87+header. "First" is `(decode frame, plane, row, col, ours, oracle)`.
88+
89+| cell | chroma | size | depth | cpu-used | header ss / depth (parsed) | our status | oracle | frames | wrong Y / U / V | first divergence |
90+|---|---|---|---|---|---|---|---|---|---|---|
91+| `rc2_s420_320x242_8b` | 4:2:0 | 320x242 | 8 | 2 | `11` / 8 | decodes | aomdec | 17 | **0 / 0 / 0** | none |
92+| `rc6_s420_320x242_8b` | 4:2:0 | 320x242 | 8 | 6 | `11` / 8 | decodes | aomdec | 17 | **0 / 0 / 0** | none |
93+| `rc2_s420_320x242_10b` | 4:2:0 | 320x242 | 10 | 2 | `11` / 10 | decodes | aomdec | 17 | **0 / 0 / 0** | none |
94+| `rc6_s420_320x242_10b` | 4:2:0 | 320x242 | 10 | 6 | `11` / 10 | decodes | aomdec | 17 | **0 / 0 / 0** | none |
95+| `rc2_s420_256x128_8b` | 4:2:0 | 256x128 | 8 | 2 | `11` / 8 | decodes | aomdec | 17 | **0 / 0 / 0** | none |
96+| `rc6_s420_256x128_8b` | 4:2:0 | 256x128 | 8 | 6 | `11` / 8 | decodes | aomdec | 17 | **0 / 0 / 0** | none |
97+| `rc2_s420_256x128_10b` | 4:2:0 | 256x128 | 10 | 2 | `11` / 10 | decodes | aomdec | 17 | **0 / 0 / 0** | none |
98+| `rc6_s420_256x128_10b` | 4:2:0 | 256x128 | 10 | 6 | `11` / 10 | decodes | aomdec | 17 | **0 / 0 / 0** | none |
99+| `rc2_s444_320x242_8b` | 4:4:4 | 320x242 | 8 | 2 | `00` / 8 | decodes | aomdec | 17 | **0 / 0 / 0** | none |
100+| `rc6_s444_320x242_8b` | 4:4:4 | 320x242 | 8 | 6 | `00` / 8 | decodes | aomdec | 17 | **0 / 0 / 0** | none |
101+| `rc2_s444_320x242_10b` | 4:4:4 | 320x242 | 10 | 2 | `00` / 10 | decodes | aomdec | 17 | **0 / 0 / 0** | none |
102+| `rc6_s444_320x242_10b` | 4:4:4 | 320x242 | 10 | 6 | `00` / 10 | decodes | aomdec | 17 | **0 / 0 / 0** | none |
103+| `rc2_s444_256x128_8b` | 4:4:4 | 256x128 | 8 | 2 | `00` / 8 | decodes | aomdec | 17 | **0 / 0 / 0** | none |
104+| `rc6_s444_256x128_8b` | 4:4:4 | 256x128 | 8 | 6 | `00` / 8 | decodes | aomdec | 17 | **0 / 0 / 0** | none |
105+| `rc2_s444_256x128_10b` | 4:4:4 | 256x128 | 10 | 2 | `00` / 10 | decodes | aomdec | 17 | **0 / 0 / 0** | none |
106+| `rc6_s444_256x128_10b` | 4:4:4 | 256x128 | 10 | 6 | `00` / 10 | decodes | aomdec | 17 | **0 / 0 / 0** | none |
107+| `rc2_s422_320x242_8b` | 4:2:2 | 320x242 | 8 | 2 | `10` / 8 | **REFUSES** | aomdec | — | — | — |
108+| `rc6_s422_320x242_8b` | 4:2:2 | 320x242 | 8 | 6 | `10` / 8 | **REFUSES** | aomdec | — | — | — |
109+| `rc2_s422_256x128_8b` | 4:2:2 | 256x128 | 8 | 2 | `10` / 8 | **REFUSES** | aomdec | — | — | — |
110+| `rc6_s422_256x128_8b` | 4:2:2 | 256x128 | 8 | 6 | `10` / 8 | **REFUSES** | aomdec | — | — | — |
111+
112+Totals: **16 supported cells decoded and byte-exact, 0 diverging; 4 of 4 4:2:2 cells
113+refused by name.** Not one supported cell has a single wrong sample on any plane in any
114+of its 17 decode frames.
115+
116+The refusal, verbatim and identical on all four 4:2:2 cells (a refusal is a result, not
117+an error — it is the sequence header's own statement of the cell):
118+
119+```
120+unsupported: AV1 decode_stream (a chroma format of 4:2:2 (subsampling_x != subsampling_y):
121+this decoder decodes 4:2:0 and 4:4:4; 4:2:2 is not ported, and 4:4:0 (0,1) is not a
122+codable cell)
123+```
124+
125+Note on the 4:2:2 arm: the census's `436945`-wrong-luma count for `rc2_s422_320x242`
126+**cannot be re-measured on the shipped tree** — main has no `EC_AV1_ALLOW_422_PROBE` env
127+gate (it is a patch-run-restore source hack, deliberately never committed; grep finds only
128+doc comments referring to it). Reproducing that number would require editing the refusal,
129+which this lane is not permitted to do. The census's number is taken as given and is
130+untouched by anything measured here.
131+
132+### 4.1 The exact cells are not vacuous streams
133+
134+A byte-exact verdict is only worth what the stream exercised. These `--cpu-used 2`
135+streams hit non-trivial decoder arms, read from the run's own counters (each decoded 16
136+shown frames; `TILING: 23 frame headers parsed`; 17 decode-order dumps, so hidden alt-refs
137+are inside the compared set):
138+
139+| counter (`decode_probe` stdout) | `rc2_s420_320x242_8b` | `rc2_s444_320x242_10b` |
140+|---|---|---|
141+| `cfl_ac` | `420sq=708 420rect=50` | `444=60` |
142+| `reelc_chroma: dir_1to4_pairs` | 0 | 22 |
143+| `rect_intrabc_reads` | 87 | 100 |
144+| `intra_in_inter_palette` | `y=25 uv=23` | `y=6 uv=5` |
145+| `intrabc_hits` | 14 | 58 |
146+| `leaf8_intrabc_hits` | 9 | 9 |
147+| `skipped_intrabc_chroma_arm_hits` | 0 | 14 |
148+| `intrabc_rect` | 1 | 5 |
149+| `uv_left_ss_y: reads` | 608 | 0 |
150+
151+CfL, palette-in-inter, intra-BC (including the skipped-chroma arm and rect reads),
152+leaf-8 intra-BC and rect transforms all fire on the cpu-2 streams, and all of them are
153+byte-exact.
154+
155+---
156+
157+## 5. Non-vacuity: what the comparator control was
158+
159+Two independent controls, both run **before** any "exact" verdict is read off.
160+
161+### 5.1 Per-cell, per-plane oracle flip — 54 arms, 54 PASS, 0 FAIL
162+
163+One oracle **sample** flipped (bit 0 of the sample's low byte; at 10 bit the sample sits in
164+a 16-bit LE container and `2**10 < 2**16`, so the change is exactly +1 by construction),
165+in the middle of the named plane, in a named decode frame; each arm restored before the
166+next so the planes are independent. Requirement: the SAME comparator's counts move by
167+**exactly +1 in that plane**, every other plane at +0, and every other frame's three
168+counts bit-identical.
169+
170+* 16 cells × 3 planes at decode frame 16 (last): 48/48 PASS, all `other_frames_unchanged`.
171+* 2 cells × 3 planes at decode frame **0**: 6/6 PASS (`rc2_s420_320x242_8b`,
172+ `rc6_s444_320x242_10b`) — e.g. Y `51`→`50`, U `f0`→`f1`, V `6e`→`6f` on baseline
173+ `0/0/0` → `1/0/0`, `1/1/0`, `1/1/1`, with the other 16 frames untouched.
174+
175+At 10 bit the arms show the 16-bit container behaviour, e.g. `4401`→`4501` (+1 Y),
176+`6801`→`6901` (+1 U), `c003`→`c103` (+1 V).
177+
178+Log: `/home/user/.cache/cpu2probe/liveness.json` (last frame) and
179+`cross.json::flip_at_frame0` (frame 0).
180+
181+### 5.2 Cross-stream control — 8 same-geometry pairs, 8 DIVERGE
182+
183+The flip control cannot rule out "the comparator compared our stream with itself". So:
184+cell A's **ours** dumps against cell B's **oracle** dumps, where A and B share the exact
185+geometry, chroma format and bit depth but are **different streams** (same content,
186+different `--cpu-used`). All 8 pairs must diverge hard:
187+
188+| ours | vs oracle of | geometry | Y / U / V | first |
189+|---|---|---|---|---|
190+| `rc2_s420_320x242_8b` | `rc6_s420_320x242_8b` | 320x242 `11` d8 | 125476 / 42343 / 41721 | f0 Y(0,53) ours 81 oracle 80 |
191+| `rc2_s420_320x242_10b` | `rc6_s420_320x242_10b` | 320x242 `11` d10 | 217724 / 76139 / 70941 | f0 Y(0,4) 317/318 |
192+| `rc2_s420_256x128_8b` | `rc6_s420_256x128_8b` | 256x128 `11` d8 | 73754 / 26788 / 24808 | f0 Y(0,0) 78/79 |
193+| `rc2_s420_256x128_10b` | `rc6_s420_256x128_10b` | 256x128 `11` d10 | 137616 / 44779 / 47012 | f0 Y(0,0) 312/313 |
194+| `rc2_s444_320x242_8b` | `rc6_s444_320x242_8b` | 320x242 `00` d8 | 146010 / 245465 / 255451 | f0 Y(0,54) 146/145 |
195+| `rc2_s444_320x242_10b` | `rc6_s444_320x242_10b` | 320x242 `00` d10 | 336685 / 457332 / 455053 | f0 Y(0,0) 319/318 |
196+| `rc2_s444_256x128_8b` | `rc6_s444_256x128_8b` | 256x128 `00` d8 | 81622 / 143560 / 152723 | f0 Y(0,0) 78/79 |
197+| `rc2_s444_256x128_10b` | `rc6_s444_256x128_10b` | 256x128 `00` d10 | 172711 / 255186 / 260196 | f0 Y(0,0) 312/313 |
198+
199+A comparator that silently returned 0 on any of these would have failed. It returned
200+hundreds of thousands of wrong luma samples on every one.
201+
202+*(A first pass of this control paired cells at random and mostly crossed geometries, so
203+the comparator hard-errored on the byte length instead — that is the geometry-explicit
204+discipline working, but it is not a tautology test. The table above is the re-run, paired
205+by geometry. A related first-pass bug: `sys.path.insert(0, census422b)` shadowed the local
206+`liveness.py` with the census's, so `WORK` pointed at a stale root and the first re-run
207+read "no frame dumps"; fixed by path order, recorded here because the same shadowing will
208+bite any future lane that imports a helper from the census instrument directory.)*
209+
210+### 5.3 What makes the exact verdicts non-vacuous, in one line
211+
212+16 supported cells × 17 decode frames × 3 planes, every frame's byte length checked
213+against the explicit geometry (a length disagreement is a hard error, and none fired),
214+zero wrong samples — measured by a comparator proven live by 54 flip arms and 8
215+cross-stream divergences on the very same dumps.
216+
217+---
218+
219+## 6. Verdict
220+
221+**FORMAT-SPECIFIC.** At the census's `--cpu-used 2` recipe the luma divergence does
222+**not** bite 4:2:0 or 4:4:4 at 8 or 10 bit: 16 of 16 supported cells are byte-exact vs
223+`aomdec` (0/0/0 on every plane of every decode frame), while all four 4:2:2 cells from the
224+same recipe refuse by name. The `--cpu-used 2` mode itself reaches serious decoder arms in
225+the supported formats (CfL, palette-in-inter, intra-BC incl. skipped-chroma and rect,
226+leaf-8, rect TU) and is exact on all of them.
227+
228+Consistent with, and sharpening, the census's own §5 reading: `--cpu-used` was the only
229+flag varied there too, its 4:2:0 controls were 22/22 exact and its 4:4:4 controls 21/22.
230+This lane adds the missing arm — the *same* `rc` recipe (byte-reproduced against the
231+census's own 4:2:2 output) at `--cpu-used 2` specifically, across both supported formats,
232+both depths, and two geometries including an odd height.
233+
234+**No supported-cell defect is localisable, so no owning surface is named.** The only
235+open item is the census's 4:2:2 class E, which lives inside a refused format and is
236+therefore not reachable on a shipping path; nothing here changes its status, and no fix is
237+proposed.
238+
239+## 7. What this does NOT establish
240+
241+* One content source (`testsrc2`), one CQ (24), one frame count (16), one alt-ref /
242+ global-motion configuration. The census's own recipe-dependence class shows verdicts
243+ are recipe-sensitive in 4:2:2; a supported-format divergence could in principle need a
244+ different recipe to reach. What is established is that this recipe — the one that broke
245+ luma in 4:2:2 — does not break any supported cell.
246+* 12-bit is not covered here (not requested; supported, and a separate sweep's business).
247+* The census's `436945`-luma number was not re-measured (shipped tree refuses 4:2:2 and
248+ the bypass is deliberately not committed). It is quoted, not re-derived.
249+
250+## 8. Reproduce
251+
252+```bash
253+D=/home/user/.cache/cpu2probe
254+$D/mkencode.sh # 20 encodes -> $D/cells/*.obu
255+python3 $D/run.py $D/results.json # per plane per decode frame vs aomdec
256+python3 $D/liveness.py $D/results.json $D/liveness.json # 48 flip arms
257+python3 $D/cross.py # 8 cross-stream + 6 flip-f0 arms
258+```