forge
Explore
Log in

Don't you dare go Hollow

Merge lane-av1chromarect-r2: the 79969 residual is NARROWED to a different defect class (report only)

Browse files at this commit

bd8cc17ca5abb6f893c76445975e428bae3957e8Ahmet Kaan GümüşParent: 64a504327b4e62
Not the multi-unit walk: all five coded/skipped strips are pixel-clean on their own frames and the
new walk runs once over four units inside a clean footprint. Every dirty cell falls inside a SQUARE
64x64 block (decode_block, side=64, cset=Chroma32) walked as a 2x2 grid of Chroma32 units - the path
this lane never touched. Mechanism: the second chroma unit of that 2x2 walk reconstructs its
SIBLING's flat DC (241) instead of its own (202), while our geometry, mode, uv_mode, skip and tx all
agree with the instrumented oracle - a reconstruction difference, not a bitstream one. Seed
mi=(112,80) f0 cu=(1,0): left=202 above=194 corner=118 -> flat 241; clean sibling control
mi=(112,96). No decode-path change in this commit.
lanes/av1chromarect-r2.report.mdadded+164 -0
@@ -0,0 +1,164 @@
1+# lane-av1chromarect-r2 — localising the 79969-sample residual
2+
3+Worktree `~/.cache/wt/av1chromarect2`, branch `lane-av1chromarect-r2`, base
4+`5324a685` ("Merge lane-av1chromarect"). No decode-path change is committed: the
5+residual is a **different defect class in a function this lane does not own**, and
6+the yield is the narrowed statement below, with every number measured here.
7+
8+All probes were temporary and are reverted; `git status` is clean and the main
9+checkout is untouched.
10+
11+## 1. What the residual IS
12+
13+Same oracle as r1 (aomdec `EC_AV1_FINAL_DUMP` vs `set_final_dump_prefix`,
14+512x512 8-bit 4:4:4, decode order), reproduced on this base:
15+
16+| frame | Y | U | V |
17+| --- | --- | --- | --- |
18+| 0 | 0 wrong (byte-exact) | **7488 wrong from 229728** (x=352, y=448) | **8128 wrong from 229728** |
19+| 1 | 0 wrong (byte-exact) | **22571 wrong from 65704** (x=168, y=128) | **41782 wrong from 65704** |
20+| 2 | 0 wrong (byte-exact) | 0 | 0 |
21+
22+Total 79969 of 2359296 samples (3.4 %), all chroma, luma exact everywhere.
23+
24+Per-frame, the strip footprints (`EC_HALVSWEEP=1`, `mi` in 4-px units,
25+`px = mi * 4`) and the dirty-cell map (`{x}/{wrong samples in that 8x8 cell}`):
26+
27+ f0 strip mi=(32,40) px=(160,128) 32x64 skip=false <-- the only CODED strip
28+ f1 strip mi=(48,64) px=(256,192) 32x64 skip=true
29+ f1 strip mi=(64,108) px=(432,256) 16x64 skip=true
30+ f2 strip mi=(112,96) px=(384,448) 32x64 skip=true
31+ f2 strip mi=(112,104) px=(416,448) 32x64 skip=true
32+
33+* f0 dirty cells: x = 352,360,368,376(24),416(48),424(32),432..504, y = 448..504.
34+ The coded strip's footprint is x=160..192, y=128..192 — **clean**.
35+* f1 dirty cells: x = 128..192 for y=192..504, plus x=192..280 for y=128..168,
36+ plus x=352..368 for y=448..504. Strip 1's footprint is x=256..288, y=192..256
37+ — **clean**; strip 2's is x=432..448, y=256..320 — **clean** (x=432 is inside
38+ f1's V bbox but its U cells are clean).
39+* f2 is byte-exact on all three planes and carries two strips.
40+
41+**All five strips are pixel-clean on their own frames.** The residual is not the
42+new walk, and it is not "a second strip on the same plane block" that the walk
43+missed: on this witness the multi-unit walk (`read_intrabc_rect_chroma_split`)
44+runs exactly once, for f0's single coded strip, and it reads four units
45+(`EC_IBCCU`: plane 1 at (160,128) and (160,160), plane 2 at the same two
46+positions) whose footprint is exact.
47+
48+## 2. Attribution — the seed unit
49+
50+`EC_IBBLK` (every `decode_block` / `decode_block_rect` entry, frame-tagged) puts
51+every dirty cell inside a **square** block decoded by `decode_block`, at 4:4:4,
52+`side=64`, `cset=Chroma32 ctx=32 ctxh=32 cside=64 cheight=64` — i.e. a 64x64
53+luma block whose 64x64 chroma plane block is walked as a 2x2 grid of
54+`Chroma32` units, in the SQUARE path, which this lane never touched.
55+
56+The f0 seed, with the oracle's own mode rung as the control
57+(`EC_TRACE_MODE=1` on `~/.cache/aom-oracle/build/aomdec`):
58+
59+ ours IBM f=0 mi=(112,80) px=(320,448) side=64 skip=true mode=0 uv=0
60+ ours IBM f=0 mi=(112,96) px=(384,448) side=64 skip=true mode=0 uv=0
61+ ours IBM f=0 mi=(112,112) px=(448,448) side=64 skip=false mode=0 uv=0
62+ ours IBM f=0 mi=(112,64) px=(256,448) side=64 skip=false mode=12 uv=12
63+
64+ oracle EC_IMODE_VAL mi_row=112 mi_col=80 mode=0 uv_mode=0 skip=1 tx=0
65+ oracle EC_IMODE_VAL mi_row=112 mi_col=96 mode=0 uv_mode=0 skip=1 tx=0
66+ oracle EC_IMODE_VAL mi_row=112 mi_col=112 mode=0 uv_mode=0 skip=0 tx=0
67+ oracle EC_IMODE_VAL mi_row=112 mi_col=64 mode=12 uv_mode=12 skip=0 tx=0
68+
69+**Geometry, mode, uv_mode, skip and tx all agree with the oracle.** This is not
70+a bitstream or partition difference; it is a reconstruction difference on a
71+block both decoders agree exists with the same flags.
72+
73+f0 U, y=448, x = 256 272 288 304 320 336 | 352 368 | 384 400 416 | 432 448 464 480 496:
74+
75+ oracle: 192 241 241 241 241 239 | 202 202 | 202 202 203 | 165 166 166 166 166
76+ ours : 192 241 241 241 241 239 | 241 239 | 202 202 202 | 202 175 175 171 171
77+
78+The agreement region ends exactly at x=352 = 320 + 32, the 4:4:4 chroma plane
79+block's 2x2 grid boundary. The oracle's block [320,384) is 241 on its left unit
80+and 202 on its right unit; ours is ~241 on both. The neighbouring
81+`mi=(112,96)` block [384,448) agrees. The coded `mi=(112,112)` block [448,512)
82+is wrong throughout (202/175 against 165/166) — the victim of whatever the seed
83+leaves behind.
84+
85+f0 V, same row, is the mirror image (ours 110/110 against 222/222 on the seed's
86+right unit), so both chroma planes are wrong in the same unit.
87+
88+## 3. The mechanism, as far as it is pinned
89+
90+The seed is `skip = true`, `mode = uv_mode = 0` (DC_PRED), so its chroma is pure
91+PREDICTION with a zero residual — the error is in the prediction, not in a
92+coefficient read. Its 2x2 chroma walk's edge samples, read from the plane just
93+before each unit is pushed (`EC_IBSKIP`, plane U):
94+
95+ mi=(112,80) px=(320,448) [the dirty block]
96+ cu=(0,0) xy=(320,448) left=241 above=241 corner=241
97+ cu=(1,0) xy=(352,448) left=202 above=194 corner=118
98+ cu=(0,1) xy=(320,480) left=241 above=202 corner=241
99+ cu=(1,1) xy=(352,480) left=202 above=202 corner=202
100+ mi=(112,96) px=(384,448) [the clean block, control]
101+ cu=(0,0) xy=(384,448) left=202 above=202 corner=152
102+ cu=(1,0) xy=(416,448) left=202 above=203 corner=163
103+ cu=(0,1) xy=(384,480) left=202 above=203 corner=202
104+ cu=(1,1) xy=(416,480) left=202 above=203 corner=165
105+
106+The clean block's edges are all ~202, so any DC rule reproduces the oracle. The
107+dirty block's are NOT: its right unit has an above row at 194 and a left column
108+whose first sample is 202, yet it reconstructs flat 241 — the sibling unit's
109+value. **So the second chroma unit of a 4:4:4 64x64 square block's 2x2 chroma
110+walk does not get its own DC prediction; it gets its sibling's.**
111+
112+That is the narrowed mechanism. The site is `decode_block`'s skip/palette chroma
113+loop (`crates/ec-av1/src/decode.rs`, the `for cu_row { for cu_col { push_intra_unit
114+(1, cu_x, cu_y, chroma_tx, chroma_tx_h, uv_predict_mode, …) } }` walk and its
115+plane-2 twin, followed by the whole-block `neighbours.record`) — a prediction
116+that is resolved per BLOCK where libaom resolves it per UNIT
117+(`av1_predict_intra_block` is called per (plane, transform unit) with the unit's
118+own above row and left column; `av1_build_dc_predictor_sb`). I did not pin it to
119+a line inside the predictor: `push_intra_unit` -> `push_intra` -> `inline_intra`
120+-> `exec_intra` takes the unit's own `x, y, bw, bh`, so the block-level reuse is
121+either upstream of that call or inside `exec_intra`'s DC arm, and separating
122+those needs a per-unit DC trace on both sides that I did not build.
123+
124+## 4. Ruled out, by measurement
125+
126+* **The new walk.** All five strips pixel-clean on their own frames (§1); the
127+ four `EC_IBCCU` units are exact.
128+* **The extent / coefficient set.** `cset=Chroma32 ctx=32 ctxh=32` is
129+ `get_vartx_max_txsize`'s `av1_get_adjusted_tx_size(TX_64X64) = TX_32X32`, the
130+ same conclusion r1 reached for the strip arm, and it is the set already in use.
131+* **CfL.** `cfl=false` on all four bottom-row 64x64 blocks, and the r1 probe
132+ found zero `cfl_ac_q3_at` calls on the whole witness.
133+* **The skip arm's coefficient-context record.** libaom's
134+ `av1_reset_entropy_context` zeroes a skipped block's footprint on every plane;
135+ this crate's `record_mi_rect` writes all three planes over the luma cells
136+ (`fill_span(&mut self.left, mi_r, luma_h, states)` with `states: [Neighbour; 3]`)
137+ and the chroma-only tail is empty at 4:4:4, so the zero stamp DOES land.
138+ Forcing an extra per-unit zero `record_mi_chroma` into the skip arm changed
139+ **no** number in any frame or plane.
140+* **A stale/partition/bitstream difference.** The oracle's own `EC_TRACE_MODE`
141+ rung agrees with our decode on the seed's bsize, mode, uv_mode, skip and tx.
142+
143+## 5. What is left, and where the next lane starts
144+
145+`decode_block`'s square-path DC_PRED chroma, second unit, on a 4:4:4 64x64 block
146+(`cn_cols == cn_rows == 2`, `chroma_tx == chroma_tx_h == 32`, `uv_predict_mode ==
147+DC_PRED`, skipped or palette). f1's larger region is very likely the same defect
148+seen with more instances — f1 has a skipped 64x64 at `mi=(32,32)` px=(128,128),
149+the only 64x64 block in the dirty x=128..192 column, and its first dirty cell is
150+(168,128), 40 px into that block.
151+
152+The reproduction is cheap and needs no new encode: `fixtures/r512.obu`, decode,
153+compare per plane against aomdec, look at frame 0 U from sample 229728. A gate for
154+it would want a 4:4:4 stream with a skipped 64x64 block and 4:4:4
155+`--min-partition-size=64`, which this witness happens to contain.
156+
157+NOT DONE: the line inside the DC predictor. I did not build the paired
158+per-unit-DC trace (ours + oracle) that would separate "the block-level DC is
159+computed once and reused" from "the unit's edges are gathered over the wrong
160+extent" — those two need different fixes and I could not tell them apart from
161+the edge samples alone.
162+
163+Also untouched here, as instructed: the 4:2:0 and 4:4:4-lossless arms. No gate
164+family was re-run on this branch because no code changed on it.