forge
Explore
Log in

Don't you dare go Hollow

lane-av1mixllres report: the residue arms and the >8-bit arm are MEASURED, and the class is not bit-depth-dependent

Browse files at this commit

ec0357ff4a5cf04d89408f05dfb5baae540b6f08Ahmet Kaan GümüşParent: af4d9c7
The one missing publish is already in main (f2dd27b0) and the residue fixtures
and gate with it (f8a66917 / 167548c6); this lane lands no code. What it adds is
the measurement nobody had, on 167548c6 with no local change:

- 6-frame 256x128 and both 320x240 arms: 7/7, 7/7, 6/6 decode-order byte-exact.
  Base 46a7e67b counts (mine, per plane per frame): red f1..f6 by
  6051/4115/2962/26566/41876/14749, f1..f5 by 15031/16259/21932/65405/90077, and
  f6 by 19398.
- The 10-bit 4:2:0 arm, built by hand for the first time (scripts/raw_to_y4m.py,
  header line plus FRAME\n before every frame). At base it REFUSED after 4 dumps
  with f1/f2/f4 red by 12766/5382/24764; on main 7/7 byte-exact. The 12-bit arm
  likewise: 7 dumps with 5 red at base, 7/7 exact on main.
- So the class is NOT bit-depth-dependent: one missing TXFM_CONTEXT publish
  desyncs 8-, 10- and 12-bit cells of the same recipe, and one line closes all
  three. Band bookkeeping carries no depth term.
- Comparator non-vacuity at 10-bit: a 1-LSB oracle flip on one sample of frame 4
  reports exactly 1 differing byte at sample 1000, so the clean zero is measured,
  not vacuous. Both sides are the depth-correct EC_AV1_FINAL_DUMP; the
  u8-narrowing rung is not used.
- Cause localised independently from base: first divergent read 64674 at
  mi=(40,52), a txfm_partition ctx read with above=16 where libaom reads 4 --
  the band replay puts the last write to mi column 52 at a skipped 16-px inter
  block at mi=(16,52), and the per-site ctx lock (reverted) makes the whole cell
  exact. On main the operand pair av1mixllconj specified reads ctx=1 on its own.

Scoped: cargo test -p ec-av1 --lib -- a_420_mixed_lossless = 3 passed / 0 failed;
-- lossless mixll txctx vartx = 38 passed / 0 failed.
lanes/av1mixllres.report.mdadded+274 -0
@@ -0,0 +1,274 @@
1+# lane-av1mixllres — the mixed-lossless class's residue arms and its >8-bit arm: MEASURED, all closed on `main` by one publish that was NOT mine to land
2+
3+Base `main` = `167548c6` ("Merge lane-av1txctxband2 r2: the mixed-lossless RESIDUE arms
4+are the SAME missing publish, not three more defects"). Worktree
5+`/home/user/.cache/wt/av1mixllres`, target dir
6+`$HOME/.cache/cargo-target-av1mixllres`, `EC_NOMEMGUARD=1`. Oracle
7+`~/.cache/aom-oracle/build/{aomdec,aomenc}` (shared, untouched — not rebuilt, not
8+re-instrumented). ffmpeg 8.1.3.
9+
10+**No decoder change is in this lane.** `git diff --stat HEAD -- crates/` is empty at
11+`167548c6`: every number below describes `main` as it stands. The one-line publish
12+this lane independently derived and measured is already in `main` as `f2dd27b0`
13+(`c23e8b90`), and the three residue fixtures + gate are `f8a66917` (`167548c6`).
14+The deliverable is the measurement — including the **10-bit and 12-bit arms, which
15+no lane had built** — and the red-before control that shows the class is
16+**not bit-depth-dependent**.
17+
18+## 0. Verdict
19+
20+| | |
21+|---|---|
22+| 6-frame 256x128 residue arm (`420_mixll_256x128_6f.obu`) | at `46a7e67b`: 7 dumps, **red f1..f6 by 6051 / 4115 / 2962 / 26566 / 41876 / 14749**; on `167548c6`: **7/7 byte-exact**, 0 differing bytes, every plane, every decode-order frame |
23+| 320x240 arm, 5 frames (`420_mixll_320x240_5f.obu`) | at `46a7e67b`: 6 dumps, **red f1..f5 by 15031 / 16259 / 21932 / 65405 / 90077**; on `167548c6`: **6/6 byte-exact** |
24+| 320x240 arm, 6 frames (`420_mixll_320x240_6f.obu`) | at `46a7e67b`: 7 dumps, **red f6 only, 19398**; on `167548c6`: **7/7 byte-exact** |
25+| **10-bit 4:2:0 arm (built here for the first time)** | at `46a7e67b`: **REFUSED** ("a Golomb tail longer than this decoder reads") after 4 dumps, with f1/f2/f4 red by 12766 / 5382 / 24764; on `167548c6`: **7/7 byte-exact** |
26+| **12-bit 4:2:0 arm (built here)** | at `46a7e67b`: 7 dumps, red f1/f2/f4/f5/f6 by 15003 / 7155 / 43328 / 54347 / 25047; on `167548c6`: **7/7 byte-exact** |
27+| Is the class bit-depth-dependent? | **NO.** The same one missing publish desyncs 8-bit, 10-bit and 12-bit cells of the identical recipe, and the same one line closes all three. The defect is in band BOOKKEEPING, which has no depth term anywhere in `txfm_partition_context` / `set_txfm_ctxs`. |
28+| Already-closed cells, re-measured here on `167548c6` | pin `m5_256x128` **6/6**, 176x144 **7/7**, 352x288 **7/7**, 4:4:4 8-frame **9/9**, 640x480 5f **6/6**, 640x480 6f **7/7** — all byte-exact |
29+| Fix / fixture / gate / counter | **not mine.** All four are `lane-av1txctxband2`'s, in `main`. This lane adds **no** fixture and **no** gate; see §6 for why adding one would be a duplicate. |
30+
31+## 1. The recipe, and the HBD source built by hand
32+
33+8-bit cells are `ffmpeg testsrc2` at the stated size → the class's encode line:
34+
35+```text
36+aomenc --codec=av1 --obu -o <cell>.obu --passes=1 --cpu-used=4 --limit=<N> \
37+ --end-usage=q --cq-level=0 --aq-mode=1 <src>.y4m # 8-bit 4:2:0
38+```
39+
40+**The >8-bit source is built by hand**, because no `ffmpeg` here emits a >8-bit y4m
41+and a raw 16-bit-LE one is rejected by the shared `aomenc` with `Loss of framing in
42+Y4M input data`. Recipe (the same shape as `lanes/av1444d10.report.md` §1, adapted to
43+4:2:0):
44+
45+```python
46+# scripts/raw_to_y4m.py W H FPS out.y4m DEPTH (repo-owned helper, unmodified)
47+# DEPTH = BYTES per sample on stdin (2 for 10- and 12-bit), asserted against stdin length.
48+# Header: YUV4MPEG2 W256 H128 F25:1 Ip A1:1 C420p10
49+# then, PER FRAME: b"FRAME\n" + 256*128*2 + 2*((256+1)//2)*((128+1)//2)*2
50+ffmpeg -v error -f lavfi -i testsrc2=size=256x128:rate=25 -frames:v 6 \
51+ -pix_fmt yuv420p10le -f rawvideo src10.raw
52+python3 scripts/raw_to_y4m.py 256 128 25 src10.y4m 10 < src10.raw
53+```
54+
55+libaom's `y4minput.c:1163-1171` requires the six bytes `FRAME\n` before **EVERY**
56+frame; the helper emits them per frame and its length assertion is what stops a
57+misframed y4m (a 10-bit stream of N frames is exactly 2N 8-bit frames, so no
58+length-only check can catch a depth mistake — the DEPTH argument is asserted).
59+
60+Then the same class line, plus the depth:
61+
62+```text
63+aomenc --codec=av1 --obu -o m_256x128_10b.obu --passes=1 --cpu-used=4 --limit=6 \
64+ --end-usage=q --cq-level=0 --aq-mode=1 \
65+ --input-bit-depth=10 --bit-depth=10 src10.y4m
66+```
67+
68+| cell | bytes | sha256 (prefix) |
69+|---|---:|---|
70+| `m_256x128.obu` (6 f) | 22 336 | `8a203e520f12f4ba` |
71+| `m_320x240.obu` (6 f) | 38 686 | `37fbe7cb…` |
72+| `m5_320x240.obu` (5 f) | 28 716 | `40d613fd…` |
73+| **`m_256x128_10b.obu`** | **41 012** | 10-bit 4:2:0 profile 0 |
74+| **`m_256x128_12b.obu`** | **56 039** | `aomenc` prints `Warning: automatically updating to profile 2 to match input format` — the encoder ACCEPTS 12-bit 4:2:0, so the 12-bit arm exists and is measured |
75+| `m5_256x128.obu` (the pin) | 18 525 | `3e06b5641e6a0f5a` — reproduces the committed pin's sha256 exactly |
76+| `m_176x144.obu` / `m_352x288.obu` / `m5_640x480.obu` / `m_640x480.obu` / `m444_8.obu` | 20 069 / 46 490 / 87 537 / 115 615 / 79 051 | `02b15d0d…` / `e43c74b8…` / `3d505fd2…` / `c82ba4d7…` / — every byte count reproduces the inherited reports' |
77+
78+Both byte counts and the sha prefixes the prior reports name reproduce on the first
79+try. **The 10-bit cell is genuinely mixed-lossless**, not a lossy cell that happens
80+to be HBD: at base it desyncs at a `txfm_partition` context read like the 8-bit ones
81+(§3), and the fix that closes it is the same publish.
82+
83+## 2. The comparator, and its non-vacuity at 10-bit
84+
85+Both sides are the **decode-order `EC_AV1_FINAL_DUMP`** (rung 12 of
86+`scripts/instrument-aom-oracle.sh`), which is depth-correct: 8-bit as `u8`, 10/12-bit
87+as `u16` LE. **The u8-narrowing trap is avoided by construction** — the
88+`EC_AV1_DECODE_ORDER_DUMP` rung that narrows every plane is never used here, and
89+comparing a narrowed dump against a depth-correct one would make every HBD cell
90+diverge by construction.
91+
92+Per-frame plane spans come from **our frame's own plane lengths** (never a formula,
93+never frame 0's), and the sample depth from the **byte length the frame actually
94+is** — 98 304 B at 10-bit 4:2:0 256x128 = `256*128*1.5*2`, asserted, versus 49 152 B
95+if it were 8-bit. So a 10-bit difference in the top bits cannot hide.
96+
97+**Non-vacuity control (the check that matters at HBD):** with the same dumps, flip
98+the low bit of ONE oracle sample of frame 4 and re-compare.
99+
100+```text
101+clean compare differing bytes: 0
102+after a 1-LSB oracle flip, differing BYTES: 1 first byte: 2000 = sample 1000
103+```
104+
105+The comparator is live at 10-bit: it reports zero only because the two sides are
106+byte-identical, not because it cannot see a 10-bit difference. (This is the same
107+discipline as `count_rawvideo_diffs`' `flip` argument in `stream.rs`.)
108+
109+## 3. Per-plane, per-frame, decode order — base vs main
110+
111+`EC_AV1_FINAL_DUMP` both sides, per differing frame. Base `46a7e67b` (pre-publish) vs
112+main `167548c6`, **no local change on either side**.
113+
114+| cell | base `46a7e67b` | main `167548c6` |
115+|---|---|---|
116+| `m5_256x128` (pin, 5 f) | 6 dumps, **0 differing** | 6/6 exact |
117+| **`m_256x128` (6 f)** | 7 dumps, f1..f6 red **6051 / 4115 / 2962 / 26566 / 41876 / 14749** | **7/7 EXACT** |
118+| **`m_320x240` (6 f)** | 7 dumps, f0..f5 exact, **f6 red 19398** | **7/7 EXACT** |
119+| **`m5_320x240` (5 f)** | 6 dumps, f1..f5 red **15031 / 16259 / 21932 / 65405 / 90077** | **6/6 EXACT** |
120+| `m_176x144` (6 f) | 7/7 exact | 7/7 exact |
121+| `m_352x288` (6 f) | 7/7 exact | 7/7 exact |
122+| `m444_8` (4:4:4, 8 f) | 9/9 exact | 9/9 exact |
123+| `m5_640x480` (5 f) | **REFUSED** at frame 4; f1..f3 red 64181 / 98673 / 63442 | **6/6 EXACT** |
124+| `m_640x480` (6 f) | REFUSED | **7/7 EXACT** |
125+| **`m_256x128_10b` (10-bit, 6 f)** | **REFUSED** after 4 dumps; f1 12766, f2 5382, f4 24764; f5/f6 never decoded | **7/7 EXACT** |
126+| **`m_256x128_12b` (12-bit, 6 f)** | 7 dumps, f1 15003, f2 7155, f4 43328, f5 54347, f6 25047 | **7/7 EXACT** |
127+
128+Every base figure here is my own count, taken on my own worktree and target dir; the
129+per-plane split of each red frame is in the raw output above (e.g. 256x128 f5
130+`Y=28424@0 U=6858@0 V=6594@0`). The residue arms' totals match `lane-av1txctxband2`'s
131+independent measurement to the byte (6051/4115/2962/26566/41876/14749,
132+15031/16259/21932/65405/90077, 19398).
133+
134+**The premise, measured rather than assumed:** "the cell decodes" was false on the
135+10-bit arm at base (it REFUSED) and true-but-wrong on the 12-bit arm (all 7 frames
136+decoded, 5 wrong). Neither state is visible without the per-plane pixel count.
137+
138+## 4. Cause: one missing publish, and it is the SAME site for every depth
139+
140+The one line, already in `main` as `f2dd27b0`, at `read_block_tx_size`'s lossless
141+early return:
142+
143+```rust
144+set_txfm_ctxs(n, at_mi, 4, side_mi, side_mi, skip && is_inter);
145+```
146+
147+libaom's `parse_decode_block` (`decodeframe.c:1244-1261`) is an EITHER/OR: the var-tx
148+branch's condition carries `!xd->lossless[mbmi->segment_id]`, so a lossless block
149+takes the `else` branch, where `read_tx_size` returns `TX_4X4` **and then
150+`set_txfm_ctxs` publishes over the block's own width/height**. The early return
151+skipped the PUBLISH, not the symbol read. `read_block_tx_size_rect` has published on
152+that same arm since `lane-av1lm444loss`; only the square arm had the hole. A lossless
153+block therefore left `above_txfm_context`/`left_txfm_context` holding whatever an
154+earlier block wrote, and the next LOSSY block's `txfm_partition` context read took
155+its `above`/`left` operands from that stale neighbour.
156+
157+**My own localisation, from the base tree, on the 320x240 5-frame cell** (this is the
158+discriminator the charter asked for, and it is a `txfm_partition` read, NOT the
159+`tx_size_cat0` site of the 640x480 case):
160+
161+* paired `EC_SYMR`, whole stream: **first divergence at read 64 674** (ours
162+ 212 273 reads, oracle 157 953). Both sides are at `mi=(40,52)` and both read
163+ `n=2 s=0`; the post-range differs (ours 47814, oracle 33426) because the two read
164+ **different CDF rows**.
165+* the operands, from the oracle's own `EC_VARTXCTX` against ours:
166+ `mi=(40,52) txw=8 txh=8 above=4 left=4 ctx=20` versus ours
167+ `above=16 left=4 ctx=19`. The `above` band cell is the whole difference.
168+* the band replay (`EC_TXUPD`, `above_txfm_context` scope = per tile,
169+ `left_txfm_context` = per superblock row, init `TXFM_CTX_INIT = 64`) puts the last
170+ write to mi column 52 at a **skipped 16-px inter block at `mi=(16,52)` publishing
171+ 16**, and nothing between it and the read — libaom reads 4, i.e. it has a write in
172+ rows 17..39 that this tree did not make. Same signature the conjunct report named
173+ for the 640x480 cell.
174+* the per-site ctx lock (temporary, reverted): forcing `ctx=20` at `mi=(40,52)` alone
175+ makes all 6 decode-order frames of that cell byte-exact, which is the symptom-mask
176+ proof that the ctx FORMULA is right and the band VALUE is the cause. The same lock
177+ on the 6-frame 256x128 cell is `ctx=18` at `mi=(24,40)`, and it makes all 7 frames
178+ byte-exact too.
179+
180+On `167548c6` the same lock is unnecessary, and the operand pair av1mixllconj §4.3
181+specified as the discriminator now reads, on `m5_640x480` with no forced ctx
182+anywhere:
183+
184+```text
185+oracle EC_TXCTXB mi=80,110 abv=4 lft=8 above=0 left=1 ctx=1
186+ours EC_TXCTX mi=80,110 above_txfm=4 left_txfm=8 above=false left=true -> ctx=1
187+```
188+
189+That is the report's FIRST outcome row (`above_txfm` 4, `ctx` 1 on its own): the band
190+is closed, and the forced-`ctx=1` mask is retired as a symptom mask rather than a
191+repair.
192+
193+## 5. Scoped test command and output
194+
195+```text
196+CARGO_TARGET_DIR=$HOME/.cache/cargo-target-av1mixllres EC_NOMEMGUARD=1 \
197+ cargo test -p ec-av1 --lib -- a_420_mixed_lossless --nocapture
198+```
199+
200+```text
201+a_420_mixed_lossless_alt_ref_sub8_vartx_witness_is_byte_exact_in_decode_order:
202+ 6 decode-order frame(s) byte-exact (1 hidden), 5 shown frame(s) exact per plane,
203+ 10 sub-8 leaf/leaves on a lossless segment read no var-tx symbol
204+test ...a_420_mixed_lossless_alt_ref_sub8_vartx_witness_is_byte_exact... ok
205+a_420_mixed_lossless_residue_arms_are_byte_exact_in_decode_order/420_mixll_256x128_6f.obu:
206+ 7 decode-order frame(s) byte-exact (1 hidden), 265 lossless square inter block(s) overwrote a stale above-band size
207+a_420_mixed_lossless_residue_arms_are_byte_exact_in_decode_order/420_mixll_320x240_5f.obu:
208+ 6 decode-order frame(s) byte-exact (1 hidden), 432 lossless square inter block(s) overwrote a stale above-band size
209+a_420_mixed_lossless_residue_arms_are_byte_exact_in_decode_order/420_mixll_320x240_6f.obu:
210+ 7 decode-order frame(s) byte-exact (1 hidden), 487 lossless square inter block(s) overwrote a stale above-band size
211+test ...a_420_mixed_lossless_residue_arms_are_byte_exact_in_decode_order ... ok
212+a_420_mixed_lossless_alt_ref_640x480_txfm_band_publish_is_byte_exact_in_decode_order:
213+ 6 decode-order frame(s) byte-exact (1 hidden), 5 shown frame(s) exact per plane,
214+ 944 lossless square inter block(s) overwrote a stale above-band size
215+test ...a_420_mixed_lossless_alt_ref_640x480_txfm_band_publish_is_byte_exact... ok
216+test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 805 filtered out; finished in 4.17s
217+```
218+
219+The wider scope on the same tip, no local change:
220+
221+```text
222+CARGO_TARGET_DIR=$HOME/.cache/cargo-target-av1mixllres EC_NOMEMGUARD=1 \
223+ cargo test -p ec-av1 --lib -- lossless mixll txctx vartx
224+```
225+
226+```text
227+test result: ok. 38 passed; 0 failed; 0 ignored; 0 measured; 770 filtered out; finished in 153.26s
228+```
229+
230+## 6. Why this lane lands no fixture, no gate, and no fix
231+
232+The one line is in `main` (`f2dd27b0`, merged `c23e8b90`); the three residue fixtures
233+and their gate are in `main` (`f8a66917`, merged `167548c6`). A second publish at the
234+same site would be a duplicate change and at best a no-op diff. A second fixture set
235+for the same three cells would duplicate `f8a66917`'s, and a 10-bit gate would need a
236+cell whose only difference from the 8-bit gate is the depth argument of the same
237+comparator — which is exactly the kind of gate that proves nothing the existing one
238+does not. The 10-bit and 12-bit arms are therefore reported as **measurements**, and
239+the decision about whether a depth-parameterised gate earns its keep is left to the
240+main agent with the numbers in hand.
241+
242+**Class-sweep note, one open item, not fixed here.** `lane-av1txctxband2` §7 site 3:
243+`read_block_tx_size_rect`'s lossless arm publishes `(4, 4)` where libaom's
244+`set_txfm_ctxs` carries the `skip && is_inter` block-size term. It is REACHED (their
245+29/1/9/6/16 hit counts) but moving it changed nothing on any fixture that reaches it.
246+**My cells do not unblock it** — the 10-bit and 12-bit cells go byte-exact with no
247+change there, so they add no reader to that gap.
248+
249+## 7. What is NOT measured
250+
251+* **No committed corpus sweep is claimed.** I measured the class's own recipe at nine
252+ geometries × three depths, base and tip. I did not run the 112-fixture corpus
253+ before/after (a partial run of mine was interrupted and its bucket counts are not
254+ trustworthy enough to publish), so this report makes **no** claim about corpus-wide
255+ status change. `lane-av1txctxband2` §0 already carries that sweep (110 fixtures, zero
256+ rows changed).
257+* The class is content-dependent: every cell here is `testsrc2` at one rate. That is a
258+ sweep of the class at three depths and nine geometries, not of all content.
259+* `EC_SYMR` ladders for the 10-bit and 12-bit arms were not taken; the pixel-level
260+ result on all 7 decode-order frames plus the non-vacuity flip control is the
261+ evidence offered for them, and the causal localisation (§4) is from the 8-bit
262+ 320x240 cell, where the class's mechanism is the same.
263+
264+## 8. fix-now | deferred | accepted
265+
266+* **accepted** — the residue measurement and the HBD measurement, on `main`, with the
267+ red-before control and the comparator's non-vacuity at 10-bit. No code landed.
268+* **accepted** — every diagnostic this lane added (`EC_VARTXSPLIT`, the per-site
269+ `EC_VARTXLOCK` ctx override, the picture-index tag on the `EC_TXUPD` rungs, the
270+ `EC_LLPUB` probe) is **reverted**; `git diff --stat HEAD -- crates/` is empty. The
271+ shared oracle was never rebuilt or edited.
272+* **deferred(unblock: a cell on which `read_block_tx_size_rect`'s lossless `skip &&
273+ is_inter` term has an observable reader)** — `lane-av1txctxband2`'s site 3. My
274+ 10-bit and 12-bit cells do not supply one.