forge
Explore
Log in

Don't you dare go Hollow

Merge lane-av1422444b: the 4:4:4 census cell was already exact -- class D is empty and the 4:2:2 lift no longer has a 4:4:4 constraint

Browse files at this commit

18aa2112bb644074f5d28503341813e6d8192446Ahmet Kaan GümüşParent: 63036d2990a9b4
`s444_352x242_10b` needs no fix: it is byte-exact at main, and the reason is ancestry, not luck. `f3afa5b7`
(the chroma-palette unit window) is an ancestor of main and postdates the census tree `ed7c99bc`, so the census
table was describing a tree 36 commits behind. Cause named and confirmed as 4:4:4-SPECIFIC:
`decode_block_rect64`'s chroma palette walk caps units at 32, so at ss=00 a 64-axis luma strip's chroma is
TILED, and both tiled arms handed each unit the WHOLE block's palette buffer -- `PlaneBuf::reconstruct` reads
the first `side*side` entries, so unit (0,1) rebuilt the block's row-0 palette where libaom writes row 32's.
That is a different arm at a different depth from the 4:2:2 family's `b8eed69f` (sub8_leaf_chroma422's
skipped-INTRABC DV copy), and 4:2:0 is structurally immune (nw*nh == 1 on every 4:2:0 block). The sensitive
axis is the CHROMA UNIT COUNT, not the frame size -- which is why the sibling geometries at the same depth were
already fine.

Measured two ways at main: 0/0/0 vs ffmpeg 8.1.3 (`yuv444p10le`, 16 shown frames) AND 0/0/0 vs the
instrumented aomdec on all 17 decode-order frames including the hidden altref, so the hidden frame is not a
blind spot; ffmpeg's and aomdec's rawvideo agree byte-for-byte over all 8177664 B. The cell is already pinned by
a pre-existing gate (`stream.rs:51024`), which was re-proven to bite on THIS tree by reverting the windowing in
both tiled arms: red at decode frame 0 byte 328192 (ours 209 vs 216, 104 bytes differ), ffmpeg comparator
0/1112/1362, first divergence U row 224 col 64. No new gate: a second pin on the same bytes would be a
duplicate. Family sweep with no skips: 18/18 fresh 4:4:4, 18/18 fresh 4:2:0, 36/36 committed 4:4:4 fixtures,
69/69 committed 4:2:0 fixtures.

Report-only: no source change, tree byte-identical to main. Three corrections are owed to
`lanes/av1422census2.report.md` (its §3.2 row, its §3.4 "21 of 22 with the single exception", and its §7 "a lift
would not fix class D" -- class D is empty), and they land separately as annotations rather than as a rewrite of
another lane's report. The lane also found and fixed three bugs in its OWN comparator (a missing plane offset
that reported 1.36M wrong chroma samples on an exact cell, geometry parsed from the file name instead of the
header, and a hardcoded bps) -- worth recording, because each of those would have produced a confident, wrong
table.
lanes/av1422444b.report.mdadded+291 -0
@@ -0,0 +1,291 @@
1+# lane-av1422444b — `s444_352x242_10b` is ALREADY CLOSED at `main`; the census row is superseded, and here is the measurement that says so
2+
3+**Outcome in one line: the cell is byte-exact against ffmpeg on all 16 shown frames and
4+against instrumented aomdec on all 17 decode-order frames at `main` = `affe70dc`; the
5+cause is a 4:4:4-specific chroma PALETTE PREDICTION window, already fixed by
6+`f3afa5b7` and already pinned by the gate
7+`a_444_lossy_palette_chroma_unit_window_is_byte_exact_at_352x242_10bit`
8+(`crates/ec-av1/src/stream.rs:51024`); this lane adds no source change and re-proves the
9+closure, the gate's bite, and the whole 4:4:4 and 4:2:0 control surface.**
10+
11+Worktree `/home/user/.cache/wt/av1422444b`, branch `lane/av1422444b`, base
12+`affe70dc`. `CARGO_TARGET_DIR=/home/user/.cache/tgt/av1422444b`.
13+**The tree carries no source diff** (`git diff --quiet` → clean, verified after the
14+mutation of §4 was reverted). The 4:2:2 sequence-header refusal is untouched and
15+`EC_AV1_ALLOW_422_PROBE` was never needed: 4:4:4 is a supported format, so this cell
16+decodes on the shipped tree with no bypass.
17+
18+---
19+
20+## 1. What the census claimed, and why it no longer holds
21+
22+`lanes/av1422census2.report.md` (measured at `ed7c99bc`) lists `s444_352x242_10b` as
23+DIVERGES `0/1166/1413` over 17 decode frames, and names it as class D, "not 4:2:2:
24+10-bit 4:4:4 chroma", with the load-bearing note that a 4:2:2 refusal lift would not fix
25+it. **Both halves of that are now false, and the cause is a commit the census's own
26+base predates.**
27+
28+`git merge-base --is-ancestor f3afa5b7 main` → true. `f3afa5b7` is *"window the 32-capped
29+chroma palette buffer per unit (the 352x242 4:4:4 chroma divergence)"*, and it landed
30+after `ed7c99bc`. So the census's row is a true reading of a tree that no longer exists,
31+not a live defect. Re-measured here on `affe70dc`, the same cell is 0/0/0.
32+
33+The census cell and the committed fixture are the same bytes, which is what makes the
34+two measurements comparable rather than merely similar:
35+
36+```
37+84df2f37cc7982f9a572443d85dfcc13bf366a64f3fb567391dcd5acd58a0ad2 crates/ec-av1/fixtures/444_lossy_palette_chroma_352x242_10b.obu
38+84df2f37cc7982f9a572443d85dfcc13bf366a64f3fb567391dcd5acd58a0ad2 ~/.cache/census422b/sweep/s444_352x242_10b.obu
39+```
40+
41+## 2. The cause, localised — 4:4:4-SPECIFIC, and NOT shared with the 4:2:2 family
42+
43+**It does not share a cause with the 4:2:2 family.** The two defects are different arms
44+at different depths of the pipeline, and the evidence is not merely that both are
45+"chroma":
46+
47+| | 4:2:2 family (`b8eed69f`) | this cell (`f3afa5b7`) |
48+|---|---|---|
49+| arm | `sub8_leaf_chroma422` — a SKIPPED INTRABC chroma leaf | `decode_block_rect64` — the 32-capped chroma PALETTE walk |
50+| what was wrong | the arm took `if skip` and never ran the INTRABC frame copy at its DV | each tiled unit was handed the WHOLE block's palette prediction buffer instead of its own window |
51+| subsampling reach | 4:2:2 only (`ss_x=1, ss_y=0`) | 4:2:0 is structurally immune (chroma never exceeds 32); 4:4:4 (`ss=00`) is the only shipped format where a 64-axis luma strip's chroma exceeds the 32 cap and gets tiled |
52+| depth | 8- and 10-bit both | 10-bit only among the shipped sweep cells (the 4:4:4 8-bit cells never tile) |
53+
54+The mechanism, in the arm's own terms. `crates/ec-av1/src/decode.rs:20051` computes
55+`(uw, uh) = (chroma_w.min(32), chroma_h.min(32))` and `(nw, nh) = (chroma_w/uw,
56+chroma_h/uh)`, so at 4:4:4 a 64x64 luma block yields 4 chroma units of 32x32. Both
57+tiled arms then did `set_palette_pred(<whole block buffer>.clone(), fctx)`, and
58+`PlaneBuf::reconstruct` reads the first `side * side` entries of whatever it is given —
59+so unit (0,1) reconstructed the block's row-0 palette values where libaom writes row
60+32's. `f3afa5b7` routes both arms through `palette_window(pbuf, chroma_w, cu_col * uw,
61+cu_row * uh, uw, uh)` (`decode.rs:3009`), which re-strides the correct sub-rectangle.
62+
63+**The sensitive axis is CHROMA UNIT COUNT, not frame width or height** — the census's
64+own "geometry-sensitive" framing is the misleading part. 352x242 is not special as a
65+*frame*; what makes this cell bite is that its block structure produces a block whose
66+4:4:4 chroma is tiled at all. That is why the sibling geometries at the same depth
67+(320x242 10-bit, 352x250 10-bit, 416x242 10-bit, 416x250 10-bit) were already exact:
68+their partition search never produced a tiled palette chroma block.
69+
70+## 3. The cell, byte-exact on BOTH bases, with a proven-live comparator
71+
72+Two independent oracles, two independent bases, same verdict.
73+
74+**Base 1 — ffmpeg 8.1.3, SHOWN frames** (the pixel oracle of record):
75+
76+```
77+ffmpeg -v error -i s444_352x242_10b.obu -f rawvideo -pix_fmt yuv444p10le ref.yuv
78+# 8177664 B = 16 x 511104 B; 511104 = 352*242*3*2
79+```
80+
81+| cell | frames | Y | U | V | verdict |
82+|---|---|---|---|---|---|
83+| `s444_352x242_10b` | 16 shown | 0 | 0 | 0 | **BYTE-EXACT** |
84+
85+per frame, all 16: `0/0/0`. First divergence: none. Wrong-sample bbox: none in any plane.
86+
87+**Base 2 — instrumented aomdec, DECODE-order frames** (17 = 16 shown + 1 hidden altref,
88+so the hidden frame is not a blind spot):
89+
90+| cell | frames | Y | U | V | verdict |
91+|---|---|---|---|---|---|
92+| `s444_352x242_10b` | 17 decode | 0 | 0 | 0 | **BYTE-EXACT** |
93+
94+per frame, all 17: `0/0/0`.
95+
96+### 3.1 The comparator's liveness, proven before any "exact" verdict was read
97+
98+`~/.cache/wt444/cmp.py` (shown frames) and `~/.cache/wt444/cmporder.py` (decode order).
99+Geometry is an explicit argument taken from the cell's own `ffprobe`
100+`width,height,pix_fmt` — never from a file name, never from a file size. Plane
101+attribution is per FRAME from that frame's own plane lengths. A wrong SAMPLE is one
102+`bps`-wide unit. A zero-frame count is a hard error, not a vacuous 0/0/0.
103+
104+**Control A — one-sample flip, three planes, on the byte-exact cell.** Bit 0 of one
105+oracle sample's LOW byte, per plane, in decode frame 0. At 10 bit the sample sits in a
106+16-bit LE container and `2**10 < 2**16`, so +1 is exact by construction.
107+
108+| arm | Y | U | V |
109+|---|---|---|---|
110+| baseline | 0 | 0 | 0 |
111+| flip Y sample 5 | **1** | 0 | 0 |
112+| flip U sample 7 | 0 | **1** | 0 |
113+| flip V sample 9 | 0 | 0 | **1** |
114+
115+Each arm moves its own plane by exactly +1 and leaves the other two at 0. A comparator
116+that dropped chroma, mis-attributed a plane, or compared our samples with themselves
117+fails at least one of these.
118+
119+**Control B — the two oracles agree with each other.** `cmp ref.yuv aom.raw` (ffmpeg vs
120+`aomdec --rawvideo`) is byte-identical over all 8177664 B, so the two bases are not
121+disagreeing about what the pixels are.
122+
123+**Control C — the mutated tree reds on this exact comparator** (§4), which rules out
124+the comparator being unable to see a 4:4:4 chroma defect at all.
125+
126+Two of my own instrument bugs were found and fixed by these controls rather than by
127+reading a verdict; both are recorded here because each would have produced a confident
128+wrong number:
129+
130+* the first `cmp.py` indexed the ORACLE buffer with the frame offset but read the OURS
131+ buffer at a per-plane-zero offset, reporting 1.36 M wrong chroma samples on a cell that
132+ is in fact exact. It surfaced as an implausible count, not as a plausible one.
133+* `cmp.py` hardcoded `bps=2` and `cmp.sh` parsed geometry out of the cell's FILE NAME,
134+ which reported the 4:2:0 cells as "ours=16 ref=8" — a name-parsing artefact, since
135+ `ffprobe -count_frames` says 16 and the ref file is 16 frames of 230400 B. Both are
136+ fixed: `bps` is an argument, and geometry comes from the oracle's own `ffprobe`.
137+
138+## 4. The gate, and proof that it bites (red-before by mutation, on the current tree)
139+
140+The gate is **pre-existing and pins this cell exactly** — no new gate was needed, and
141+adding a second one for the same cell and the same bytes would be a duplicate.
142+
143+* gate: `stream::tests::a_444_lossy_palette_chroma_unit_window_is_byte_exact_at_352x242_10bit`
144+ (`crates/ec-av1/src/stream.rs:51024`)
145+* fixture: `crates/ec-av1/fixtures/444_lossy_palette_chroma_352x242_10b.obu`, asserted
146+ length 24875 and FNV-1a64 `0x7fda_dbb4_3bbf_9af3`
147+* non-vacuity: `decode::chroma_palette_window_hits()` read as a delta must be >= 4, and
148+ the counter is guarded on `nw * nh > 1`, so a hit is PROOF the tiled arm ran rather
149+ than proof that some palette chroma block existed
150+* the gate's own oracle comparator carries a per-plane one-byte-flip liveness control in
151+ the crate (`every_oracle_comparator_reds_on_a_one_byte_wrong_oracle`)
152+
153+**Green at `affe70dc`:**
154+
155+```
156+test stream::tests::a_444_lossy_palette_chroma_unit_window_is_byte_exact_at_352x242_10bit ... ok
157+ fixtures/444_lossy_palette_chroma_352x242_10b.obu 17 decode-order frame(s) (1 hidden)
158+ byte-exact vs aomdec, 4 windowed palette chroma unit(s)
159+```
160+
161+**Red by mutation, on THIS tree, with `palette_window` reverted in both tiled arms
162+(`decode.rs:20223` and `decode.rs:20291`, square-unit and rect-unit):**
163+
164+```
165+panicked at crates/ec-av1/src/stream.rs:11108:
166+a_444_..._352x242_10bit: decode-order frame 0 of 17 (16 shown, 1 hidden) differs from the
167+oracle at byte 328192 (ours 209 vs 216), 104 bytes differ
168+test result: FAILED. 0 passed; 1 failed
169+```
170+
171+The same mutation measured through the ffmpeg comparator, shown-frame basis:
172+
173+| | Y | U | V | first divergence |
174+|---|---|---|---|---|
175+| mutated (fix reverted) | 0 | **1112** | **1362** | frame 0, plane U, row 224 col 64, ours 209, oracle 216 |
176+| restored (`affe70dc`) | 0 | 0 | 0 | none |
177+
178+Wrong-region bbox under mutation, U: rows 222..226, cols 63..118; V: rows 222..226,
179+cols 63..114. That is a 32x32 chroma unit plus the 19 columns a neighbouring
180+`PAETH_PRED` block propagates along its own top row, which is precisely the signature
181+`f3afa5b7`'s commit message describes. The mutated per-frame U counts
182+(53, 170, 54, 54, 54, 162, 58, 54, 54, 61, 54, 54, 61, 61, 54, 54) confirm the error is
183+re-seeded by each keyframe and decays between them, i.e. it is a per-frame chroma
184+reconstruction error and not an entropy-read desync — luma is 0 in every frame, and the
185+stream parses identically on both sides (the mutation touches reconstruction only, so the
186+bit reader is untouched by construction).
187+
188+**Restored:** the tree is byte-identical to `affe70dc` (`git diff --quiet`, clean) and
189+the gate is green again. No source change is carried by this lane.
190+
191+## 5. Family sweep — the whole 4:4:4 and 4:2:0 surface re-measured
192+
193+Not only the target cell. Every 4:4:4 sweep cell and every 4:2:0 control, at `affe70dc`,
194+against ffmpeg, on the shown-frame basis with the §3.1 comparator.
195+
196+**Fresh sweep cells (`~/.cache/census422b/sweep`, the census's own encodes):**
197+
198+| class | cells | byte-exact | diverging | skipped |
199+|---|---|---|---|---|
200+| `s444_*` (4:4:4) | 18 | **18** | 0 | 0 |
201+| `s420_*` (4:2:0) | 18 | **18** | 0 | 0 |
202+
203+The 10-bit 4:4:4 cells among them, named, since the census named four of them as
204+controls: `s444_320x242_10b`, `s444_320x250_10b`, **`s444_352x242_10b`**,
205+`s444_352x250_10b`, `s444_416x242_10b`, `s444_416x250_10b` — all 0/0/0 over 16 frames.
206+
207+**Committed corpus (`crates/ec-av1/fixtures`), selected by each cell's own oracle
208+`pix_fmt`:**
209+
210+| class | cells | byte-exact | diverging | skipped |
211+|---|---|---|---|---|
212+| 4:4:4 (any depth) | 36 | **36** | 0 | 0 |
213+| 4:2:0 (any depth) | 69 | **69** | 0 | 0 |
214+
215+The 4:2:0 run first reported `pass=68 skip=1`, the skip being
216+`fixtures/reelb_intra14_witness.obu` with an EMPTY `pix_fmt` — a transient `ffprobe` read
217+failure in the driver, not a decode or oracle failure, and the shape a "zero skips" claim
218+is exactly what catches. Re-run standalone, that cell is 3840x1608 `yuv420p10le`,
219+1 shown frame, **0/0/0 BYTE-EXACT**, so the 4:2:0 corpus is 69 of 69. Zero skips in
220+either class after that: every cell enumerated, decoded, and compared. A sweep that
221+silently drops a cell is not a measurement, which is why the skip counter is reported
222+next to the pass count rather than dropped.
223+
224+### 5.1 The 4:2:0 control set is unchanged
225+
226+The census's load-bearing control was that 4:2:0 and 4:4:4 were bit-identical across the
227+4:2:2 fix, so that fix's delta was 4:2:2-specific. That control still holds, and it
228+holds a second time for the 4:4:4 palette fix: 4:2:0 is structurally immune to this
229+defect by construction, because at `ss=11` a luma block's chroma never exceeds 32 and so
230+is never tiled — `nw * nh == 1` on every 4:2:0 block, which is exactly the case the
231+`palette_window` call is a no-op for.
232+
233+The sibling 4:4:4 gate is green as well:
234+`a_444_palette_chroma_horizontal_unit_window_is_byte_exact_10bit_and_12bit` ... ok — the
235+horizontal arm of the same 32-capped walk in `decode_block_rect64`, on 640x480 10-bit and
236+12-bit cells, i.e. the same family at two more depths.
237+
238+## 6. Correction to the census of record, stated plainly
239+
240+`lanes/av1422census2.report.md` needs three edits, and this lane does not make them
241+because that report is another lane's artifact and its owner may still be amending it:
242+
243+1. §3.2's table row `s444_352x242_10b | 0 | 17/17 | 4:4:4, chroma only` — the cell is
244+ byte-exact at `main`; the row is superseded by `f3afa5b7`.
245+2. §3.4's "4:4:4 controls: 21 of 22 byte-exact, the single exception `s444_352x242_10b`
246+ (0/1166/1413, identical counts on both trees)" — that "identical on both trees" was
247+ true only of the two trees the census had; a third tree closes it.
248+3. §7's "a lift would NOT fix class D: `s444_352x242_10b` is a 4:4:4 defect" — still
249+ true as a statement about the 4:2:2 lift, but class D is now empty, so it no longer
250+ constrains the lift.
251+
252+The census's own numbers were not wrong; they were bound to `ed7c99bc`, and it said so.
253+
254+## 7. What is NOT measured here
255+
256+* the 4:2:2 cells. They refuse by name on this tree and this lane does not touch them;
257+ the `EC_AV1_ALLOW_422_PROBE` bypass was neither needed nor used, and no source edit
258+ was made, so the refusal is intact.
259+* a recipe-dependence sweep over `--cpu-used`. The census measured that axis for 4:2:2;
260+ this lane re-measured the census's own recipe only. The four other 10-bit 4:4:4 sweep
261+ cells at the same depth are exact at that recipe, which bounds but does not eliminate
262+ a recipe-dependent 4:4:4 defect.
263+* the u8-narrowing dump. It was not used for any 10-bit cell here, by construction:
264+ every 10-bit comparison is depth-correct on both sides.
265+* no full-suite run and no repo-wide rustfmt, per the lane's tree discipline.
266+
267+## 8. Reproduction
268+
269+```bash
270+git worktree add -b lane/av1422444b /home/user/.cache/wt/av1422444b main
271+cd /home/user/.cache/wt/av1422444b
272+CARGO_TARGET_DIR=/home/user/.cache/tgt/av1422444b cargo build --release -p ec-av1 --examples
273+
274+# the cell, ffmpeg basis
275+~/.cache/tgt/av1422444b/release/examples/dump_yuv \
276+ ~/.cache/census422b/sweep/s444_352x242_10b.obu /tmp/ours
277+ffmpeg -v error -i ~/.cache/census422b/sweep/s444_352x242_10b.obu \
278+ -f rawvideo -pix_fmt yuv444p10le /tmp/ref.yuv -y
279+python3 ~/.cache/wt444/cmp.py s444_352x242_10b 352 242 0 0 /tmp/ours /tmp/ref.yuv 2
280+
281+# the gate, with aomdec available
282+CARGO_TARGET_DIR=$PWD/../../tgt/av1422444b \
283+PATH=~/.cache/aom-oracle/build:$PATH \
284+ cargo test --release -p ec-av1 --lib a_444_lossy_palette_chroma -- --nocapture
285+
286+# the family sweeps
287+bash ~/.cache/wt444/sweep.sh s444_ # 18/18
288+bash ~/.cache/wt444/sweep.sh s420_ # 18/18
289+bash ~/.cache/wt444/corpus.sh # 36/36 4:4:4 committed fixtures
290+bash ~/.cache/wt444/corpus420.sh # 4:2:0 committed fixtures
291+```