forge
Explore
Log in

Don't you dare go Hollow

lanes: av1chromarect-r2 -- the 79969-sample residual is a DIFFERENT defect,

Browse files at this commit

27b4e620f1751d85b79fd418451ff6a05328e752Ahmet Kaan GümüşParent: 972e329
in decode_block's square 4:4:4 multi-unit chroma DC, not in the strip arm

No decode-path change. The residual r1 reported as an open fork is localised
and it is not this lane's arm.

MEASURED (aomdec EC_AV1_FINAL_DUMP vs set_final_dump_prefix, 512x512 8-bit
4:4:4, decode order), reproduced on 5324a685:

  f0  Y exact | U  7488 wrong from 229728 (x=352, y=448) | V  8128 wrong from 229728
  f1  Y exact | U 22571 wrong from 65704  (x=168, y=128) | V 41782 wrong from 65704
  f2  Y exact | U 0 | V 0

ALL FIVE STRIPS ARE PIXEL-CLEAN ON THEIR OWN FRAMES. EC_HALVSWEEP gives one
CODED strip (f0 mi=(32,40) px=(160,128) 32x64) and four skipped ones; the
coded one's footprint x=160..192, y=128..192 is clean, and the multi-unit walk
read exactly four units (EC_IBCCU, plane 1 at (160,128) and (160,160), plane 2
at the same two) inside it. f2 is byte-exact on all three planes. So the
residual is neither the new walk nor a second strip on the same plane block.

Every dirty cell falls inside a SQUARE block from decode_block at 4:4:4 with
side=64, cset=Chroma32 ctx=32 ctxh=32 cside=64 cheight=64 -- a 64x64 luma block
whose 64x64 chroma plane block is a 2x2 grid of Chroma32 units, in a function
this lane never touched.

The f0 seed, with the oracle's own mode rung as the control (EC_TRACE_MODE=1 on
the instrumented aomdec):

  ours  IBM f=0 mi=(112,80)  px=(320,448) side=64 skip=true  mode=0 uv=0
  ours  IBM f=0 mi=(112,96)  px=(384,448) side=64 skip=true  mode=0 uv=0
  ours  IBM f=0 mi=(112,112) px=(448,448) side=64 skip=false mode=0 uv=0
  ours  IBM f=0 mi=(112,64)  px=(256,448) side=64 skip=false mode=12 uv=12
  oracle EC_IMODE_VAL mi_row=112 mi_col=80  mode=0  uv_mode=0  skip=1 tx=0
  oracle EC_IMODE_VAL mi_row=112 mi_col=96  mode=0  uv_mode=0  skip=1 tx=0
  oracle EC_IMODE_VAL mi_row=112 mi_col=112 mode=0  uv_mode=0  skip=0 tx=0
  oracle EC_IMODE_VAL mi_row=112 mi_col=64  mode=12 uv_mode=12 skip=0 tx=0

Geometry, mode, uv_mode, skip and tx all agree, so this is a reconstruction
difference on a block both decoders agree exists with the same flags.

f0 U, y=448, x = 256 272 288 304 320 336 | 352 368 | 384 400 416 | 432..496:
  oracle 192 241 241 241 241 239 | 202 202 | 202 202 203 | 165 166 166 166 166
  ours   192 241 241 241 241 239 | 241 239 | 202 202 202 | 202 175 175 171 171
Agreement ends at x=352 = 320+32, the chroma plane block's 2x2 boundary. The
seed is skip=true mode=uv_mode=0, so its chroma is pure prediction; its right
unit's edges read above=194, left=202, corner=118, yet it reconstructs flat 241
-- the SIBLING unit's value. The mechanism is therefore: the second chroma unit
of a 4:4:4 64x64 square block's 2x2 walk does not get its own DC prediction.
libaom resolves the DC per unit (av1_predict_intra_block is called per plane per
transform unit, av1_build_dc_predictor_sb over the unit's own above row and left
column); this path resolves it per block.

RULED OUT BY MEASUREMENT: the new walk (four exact units); the extent and set
(Chroma32 IS get_vartx_max_txsize's av1_get_adjusted_tx_size(TX_64X64) =
TX_32X32, same conclusion r1 reached for the strip arm); CfL (cfl=false on all
four bottom-row blocks, and zero cfl_ac_q3_at calls on the witness); the skip
arm's coefficient-context record (record_mi_rect writes all three planes over the
luma cells, so the zero stamp does land at 4:4:4, and forcing an extra per-unit
zero record_mi_chroma into the skip arm changed NO number in any frame or
plane); a bitstream or partition difference (the oracle's mode rung agrees).

NOT DONE: the line inside the DC predictor. push_intra_unit -> push_intra ->
inline_intra -> exec_intra takes the unit's own x, y, bw, bh, so the block-level
reuse is either upstream of that call or inside exec_intra's DC arm, and
separating those needs a paired per-unit-DC trace (ours + oracle) that I did not
build. Handed back as a narrowed statement with the unit and the class named.

The 4:2:0 and 4:4:4-lossless arms were not touched and no gate family was
re-run, because no code changed on this branch.
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.