forge
Explore
Log in

Don't you dare go Hollow

lanes/av1loss444: the 4:4:4-lossless chroma divergence is GONE on main -- all four witnesses exact 6/6, 0 wrong samples in 19 cells

Browse files at this commit

66391df70fe01fee5fd61db1d0630845347fe289Ahmet Kaan GümüşParent: 28bc592
lanes/av1loss444.report.mdadded+256 -0
@@ -0,0 +1,256 @@
1+# lane-av1loss444 — the 4:4:4 LOSSLESS chroma divergence: ALL FOUR WITNESSES ARE ALREADY EXACT ON MAIN
2+
3+**Tree.** branch `lane-av1loss444` off main `fc264573`, worktree
4+`~/.cache/wt/av1loss444`, `CARGO_TARGET_DIR=$HOME/.cache/cargo-target-av1loss444`
5+(lane-private). One file touched: this report. **No decoder change was made and
6+none was needed** — see §0. Nothing pushed (Main merges).
7+
8+## 0. Verdict in one table
9+
10+| recorded witness | bytes / sha256 (re-derived) | status on main `fc264573` |
11+|---|---|---|
12+| (i) 256x128 yuv444p lossless, `--tile-columns=1 --cpu-used=2` | 77847 / `87b0d1a5…` | **EXACT 6/6**, 0 wrong luma, 0 wrong U, 0 wrong V |
13+| (ii) 256x128 yuv444p lossless, `--tile-columns=1`, tools defaulted | 75446 / `65e94e91…` | **EXACT 6/6** |
14+| (iii) 4:4:4 10-bit lossless untiled 256x128 | 122730 / `ec7a6a0e…` | **EXACT 6/6** |
15+| (iv) 4:4:4 12-bit lossless untiled 256x128 | 171599 / `ef733813…` | **EXACT 6/6** |
16+
17+Every recorded first-divergence sample — `U(110,26)`, `U(237,58)`, `Y(128,0)`
18+on f1, `U(109,0)` on f0 — now compares equal, in the same frame the record
19+named. **The cell is closed; the class has no open instance on main.** The
20+unit-addressed dump the charter asked for as the next measurement is not
21+reachable: there is no first wrong sample to address. §4 records what was run
22+instead, and §5 the one cell of the neighbourhood that is *not* reachable, for a
23+reason that has nothing to do with this defect.
24+
25+## 1. Re-derivation: every witness reproduced byte-for-byte before any measurement
26+
27+All encodes: `~/.cache/aom-oracle/build/aomenc`, source piped as y4m
28+(`ffmpeg -f lavfi -i "testsrc2=size=WxH:rate=25" -frames:v 6 -pix_fmt yuv444p*`
29+— `mandelbrot` + `gblur=sigma=6` for the 12-bit cell, the recipe
30+`lanes/av1formatsweep` §6.1 recorded), common flags
31+`--codec=av1 --passes=1 --end-usage=q --threads=1 --row-mt=0 --lag-in-frames=0
32+--kf-max-dist=100 --limit=6 --obu -o - -`.
33+
34+| # | source | per-cell flags | bytes | sha256 | recorded as |
35+|---|---|---|---|---|---|
36+| i | testsrc2 256x128 444p 8-bit | `--lossless=1 --tile-columns=1 --cpu-used=2` | 77847 | `87b0d1a5b3044552fc1fae839e868c30fdc0bebe79f8b3a3104030ffea24ab50` | Agent142-2 witness A |
37+| ii | testsrc2 256x128 444p 8-bit | `--lossless=1 --tile-columns=1` (tools default) | 75446 | `65e94e91c56178d21f5c8441877d0dbfbee17bce0916e971fbe6c51677c9891e` | Agent142-2 witness B / H3 |
38+| — | testsrc2 256x128 444p 8-bit | `--lossless=1` (tools default) | 74076 | `6c49502811b1a5d8faf6dfbb76bb6acc39039697bc082f1102ce3cf58b6d212b` | tilemeasure H3 control |
39+| iii | testsrc2 256x128 444p10le | `--lossless=1 --input-bit-depth=10 --bit-depth=10` | 122730 | `ec7a6a0ed9d7c2bada8816bb692de3379620856644a462f287a6cc3e6d9c5103` | formatsweep `t444_10_notile` |
40+| iv | mandelbrot+gblur 256x128 444p12le | `--lossless=1 --input-bit-depth=12 --bit-depth=12` | 171599 | `ef7338136d560674677cb5fd903e60906ef4df7b2f4c93a990e65a5b5ed4402c` | formatsweep `t444_12_notile` |
41+| — | testsrc2 256x256 444p 8-bit | `--lossless=1 --enable-palette=0 --enable-intrabc=0` | 109215 | `4563a01f1778600020ffa9f15bc05f5559321cf5712b99a29ed7192675dee6a4` | tilemeasure §3 "DIVERGENT f0, 49 samples" |
42+
43+Three of the five shas are the *full* 64-hex the record published (i, ii, iii)
44+and match it exactly; the 256x256 carrier matches `lanes/av1tilemeasure` §2.4/
45+§3's `4563a01f…`. **Nothing had drifted**, so every "already fixed" below is a
46+measurement on the recorded bytes, not on a look-alike.
47+
48+Wire-level facts, read from each stream's OWN sequence header by
49+`decode_probe` (not from the recipe): i → `bit_depth=8`, tile `cols=2 rows=1`,
50+`use_128x128_superblock=false`; ii → `bit_depth=8`, `cols=2 rows=1`, sb128;
51+iii → `bit_depth=10`, `cols=1 rows=1`; iv → `bit_depth=12`, `cols=1 rows=1`;
52+256x256 → `bit_depth=8`, sb128, `cols=1 rows=1`. The 4:4:4 subsampling itself is
53+confirmed by file length: `dump_yuv` writes `W*H` samples per plane and the
54+oracle's per-frame file is the same length, which a 4:2:0-coded frame of the
55+same dimensions could not be (§3).
56+
57+## 2. Per-frame, per-plane wrong-sample counts (ours vs oracle rung 12)
58+
59+Ours = `ec-av1`'s `EC_AV1_FINAL_DUMP` (rung 12's twin, the post-store reference
60+picture). Oracle = instrumented `aomdec --codec=av1` with
61+`EC_AV1_FINAL_DUMP=<prefix>`, 6 `.f<N>` files a side. Frames are DECODE order;
62+the streams carry no altrefs (`--lag-in-frames=0`, `--limit=6`), so decode order
63+is display order. **The compare asserts equal per-frame byte lengths before
64+counting** — the prefix-compare trap that produced a false "byte-exact 6/6" for
65+this very cell class (`lanes/av1formatsweep` §6.0 trap 1) is structurally
66+excluded: a length mismatch prints as `LENGTH MISMATCH` and no count follows.
67+
68+| stream | f0 | f1 | f2 | f3 | f4 | f5 |
69+|---|---|---|---|---|---|---|
70+| (i) `87b0d1a5` 8-bit tiled | Y0 U0 V0 | Y0 U0 V0 | Y0 U0 V0 | Y0 U0 V0 | Y0 U0 V0 | Y0 U0 V0 |
71+| (ii) `65e94e91` 8-bit tiled, tools default | Y0 U0 V0 | Y0 U0 V0 | Y0 U0 V0 | Y0 U0 V0 | Y0 U0 V0 | Y0 U0 V0 |
72+| untiled control `6c495028` | Y0 U0 V0 | Y0 U0 V0 | Y0 U0 V0 | Y0 U0 V0 | Y0 U0 V0 | Y0 U0 V0 |
73+| (iii) `ec7a6a0e` 10-bit | Y0 U0 V0 | Y0 U0 V0 | Y0 U0 V0 | Y0 U0 V0 | Y0 U0 V0 | Y0 U0 V0 |
74+| (iv) `ef733813` 12-bit | Y0 U0 V0 | Y0 U0 V0 | Y0 U0 V0 | Y0 U0 V0 | Y0 U0 V0 | Y0 U0 V0 |
75+| 256x256 `4563a01f` 8-bit | Y0 U0 V0 | Y0 U0 V0 | Y0 U0 V0 | Y0 U0 V0 | Y0 U0 V0 | Y0 U0 V0 |
76+
77+**Total wrong samples across all 36 frame-dumps of the six streams: 0** (5 × 6
78+frames × 3 planes; 8-bit cells 32768 samples/plane/frame, 10/12-bit 65536 bytes
79+per plane per frame = the full 12-bit range is compared, not a narrowed `u8`).
80+The recorded fingerprints — 29..103 chroma samples per frame with `x >= 108`,
81+12 U + 40 V, 290506 samples from f1, 264180 from f0 — are all zero now.
82+
83+## 3. The class sweep around them (15 further 4:4:4-lossless cells, all 6/6 EXACT)
84+
85+The four witnesses being exact is a fact about four streams. To say something
86+about the CLASS, thirteen adjacent cells of the same family were encoded and
87+compared the same way, spanning depth 8/10/12, sb64/sb128, untiled / 1 tile
88+column / 1 tile row / 2×2 tile grid, palette+intrabc on, and 4:2:0-untouched
89+`--tile-rows=1` no-op controls:
90+
91+| cell | flags | bytes / sha256 | wrong (all 6 frames) |
92+|---|---|---|---|
93+| 256x128 untiled 8-bit | `--lossless=1` | 76468 / `c2cc3bd5…` | 0 |
94+| 128x256 sb128 8-bit | `--sb-size=128` | 67946 / `d47e87df…` | 0 |
95+| 320x256 8-bit | `--tile-rows=1 --tile-columns=1` | 123285 / `b06387f0…` | 0 |
96+| 256x320 8-bit | `--tile-rows=1` | 114368 / `f147a546…` | 0 |
97+| 512x256 8-bit | `--sb-size=128 --tile-rows=1` | 160585 / `aa113c42…` | 0 |
98+| 256x256 8-bit | `--sb-size=128 --enable-palette=1 --enable-intrabc=1` | 107320 / `31bfdb9b…` | 0 |
99+| 256x128 10-bit | `--sb-size=128` | 124855 / `a628e835…` | 0 |
100+| 256x128 12-bit mandelbrot | `--enable-palette=0 --enable-intrabc=0` | 295035 / `d2b25ee2…` | 0 |
101+| 256x128 12-bit mandelbrot | `--tile-rows=1 --tile-columns=1` | 293037 / `6e2258b3…` | 0 |
102+| 256x256 12-bit mandelbrot | `--sb-size=128` | 731936 / `6838684c…` | 0 |
103+| 512x256 12-bit mandelbrot | `--sb-size=128 --tile-rows=1` | 1172597 / `d6d23a72…` | 0 |
104+| 256x128 12-bit flat grey | `--enable-palette=0 --enable-intrabc=0` | 122 / `7d07a7e7…` | 0 |
105+| 256x128 12-bit black | `--enable-palette=0 --enable-intrabc=0` | 137 / `23197378…` | 0 |
106+
107+Two facts in that table are worth keeping:
108+
109+* **The 12-bit cell is reachable after all.** The record inherited the belief
110+ that 4:4:4 lossless at 12 bits is only observable through the
111+ `allow_screen_content_tools=1` refusal. It is not: aomenc decides that bit per
112+ frame from the screen-content detector (`av1_set_screen_content_options`,
113+ `~/.cache/aom-oracle/src/av1/encoder/encoder.c:2426`), and a `mandelbrot`
114+ source at 12 bits does not trip it. That gives a 295 KB six-frame 12-bit
115+ 4:4:4-lossless cell, exact 6/6 — so the 12-bit arm of the class is covered by
116+ measurement, not by a refusal.
117+* **`--sb-size=128` is a no-op at 256x128** (byte-identical to sb64, 295035 /
118+ `d2b25ee2…` both ways), the same trap `lanes/av1formatsweep` §6.0 trap 2
119+ recorded for `--tile-rows=1`. The sb128 claims in this table are therefore
120+ only measured at 256x256 and 512x256, where the flag provably moved bytes
121+ (`t8_sb128_ibc` 107320 vs the sb64 4563a01f 109215).
122+
123+## 4. What replaced the unit-addressed dump: a non-vacuity proof of the compare
124+
125+The charter's next measurement ("our levels vs oracle `EC_COEFF_VAL`, then the
126+WHT, on the first affected lossless chroma unit") is **unreachable**: there is no
127+first affected unit on this tree. `EC_COEFF_VAL` / `EC_DQCOEFF` were therefore
128+not run — running them would produce a trace pair with no fork in it, and
129+quoting that as evidence would be the vacuous shape the contract forbids.
130+
131+What replaces it is the proof that the *zero* is a measurement and not a broken
132+harness. Two negative controls, both on the real dumps:
133+
134+1. **8-bit, 2 injected wrong samples.** Taking witness (i)'s own `f0` pair and
135+ flipping one bit at `Y(110,26)`, `U(110,26)`, `V(110,26)` — the very
136+ coordinates the recorded fingerprint named — the compare reports
137+ `Y 2 / U 2 / V 2, first (110,26)`. It sees exactly what was injected.
138+2. **12-bit, 1 injected LSB.** On witness (iv)'s `f0` pair, flipping a single
139+ low bit of `U(109,0)` (the recorded 12-bit first divergence) reports
140+ `U 1 wrong` with `Y 0, V 0`. The high-bit path compares the full 12-bit
141+ range, not an 8-bit narrowing, so a 1-LSB fork cannot hide in it.
142+
143+Both controls use the identical code path that produced every 0 in §2 and §3.
144+The zeros are therefore zeros, not silence.
145+
146+## 5. The one neighbouring cell that is NOT reachable, and why it is a different class
147+
148+`testsrc2` 256x128 yuv444p12le (not mandelbrot) at `--lossless=1
149+--enable-palette=0 --enable-intrabc=0` encodes to 251777 B / `873f8a49…` and this
150+decoder **refuses it by name**:
151+
152+```
153+AV1 decode_stream (a 12-bit frame with screen content tools
154+(allow_screen_content_tools=1: neither palette nor intrabc has a 12-bit witness))
155+```
156+
157+That is the deliberate H6 refusal at `crates/ec-av1/src/stream.rs:1821`, gated
158+by `a_12bit_screen_content_stream_is_refused_by_name` (§6, green). It fires on
159+the header BIT, not on palette/intrabc actually being used, and aomenc sets the
160+bit from the screen detector for this source. It is **not** the 4:4:4-lossless
161+chroma defect: the 12-bit lossless cells that the detector does *not* trip
162+(§3, four of them) decode byte-exact. If the screen-content refusal is ever
163+lifted, that 251777 B cell becomes a live 12-bit witness and belongs to the
164+refusal lane, not to this one. **Recorded, not touched.**
165+
166+## 6. Neighbouring gates, re-quoted unchanged on this tree
167+
168+No source file changed, so these are re-quotes, not re-baselines. All green on
169+`fc264573` in this worktree:
170+
171+| scope | result |
172+|---|---|
173+| `cargo test -p ec-av1 --lib lossless` | **25 passed, 0 failed** (all 20 stream gates + 5 `transform::lossless_tx_tests`) |
174+| `cargo test -p ec-av1 --lib 444` | **43 passed, 0 failed** |
175+| `cargo test -p ec-av1 --lib 12bit` | **14 passed, 0 failed** |
176+| `cargo test -p ec-av1 --lib screen_content` | **4 passed, 0 failed** |
177+| `cargo check -p ec-av1 --all-targets` | **clean, no warnings** |
178+
179+Named individually, the 4:4:4-lossless chroma gates that own this class:
180+`a_lossless_444_sub8_rect_leaf_chroma_reach_decodes_the_key_frame_pixel_exact`
181+(the `lane-av1loss444kf` sub8 4x4 chroma reach — 49 → 0),
182+`a_lossless_444_intrabc_rect_leaf_walks_per_4x4_units`,
183+`a_lossless_444_intrabc_rect_replay_steps_by_the_units_own_mi_footprint`
184+(`lane-av1lm444loss-corr`),
185+`a_444_lossless_sb64_intrabc_rect_chroma_walks_4x4_units`,
186+`a_lossless_444_128_root_lossless_stream_reads_chunks_chunk_major`,
187+`a_lossless_444_rect16x4_chroma_reach_is_ss_aware`,
188+`a_lossless_sb128_square_frame_clips_overhanging_chroma_tus`,
189+`a_real_aomenc_lossless_444_key_frame_decodes_sample_exact`,
190+`a_lossless_444_8bit_untiled_control_and_its_two_tile_column_sibling_decode_pixel_exact`
191+(witness (i)'s own control+sibling), `a_lossless_444_10bit_inter_stream_decodes_pixel_exact`,
192+`a_lossless_444_min_partition8_inter_stream_decodes_sample_exact`,
193+`a_lossless_444_min_partition64_inter_stream_decodes_pixel_exact`,
194+`a_lossless_444_defaultp_inter_strip_stream_decodes_byte_exact`. The 4:2:0
195+neighbours `a_lossless_libaom_key_frame_decodes_sample_exact` and
196+`a_lossless_libaom_inter_frame_decodes_sample_exact` are in the same 25/25 set.
197+
198+**A correction to the charter's gate list: there are no `ishm` gates.** The
199+string does not occur in `crates/ec-av1/` (any file, any case) nor in any
200+`lanes/*.report.md`. The nearest neighbours to whatever was meant are the
201+intra-in-inter `ibc128` / `intra128_lossless_counters` unit tests, which live in
202+`crates/ec-av1/src/decode.rs` and are exercised by the 43-gate `444` set above.
203+
204+**No committed floor was raised, and no counter was added**: nothing moved, so
205+there is no measured value to re-pin and no new arm to witness.
206+
207+## 7. Provenance notes for whoever reads this next
208+
209+* **The 256x256 inter-frame walk fix is NOT in main and main is still exact.**
210+ `lane-av1loss444mm` (`71ca43b1`, 11 rounds) is unmerged
211+ (`git merge-base --is-ancestor` says no) and its r2 finding — f1's transform
212+ units 8652 vs the oracle's 10368, a chroma walk fork at TU 4488 — cannot
213+ still be true: that exact stream (`4563a01f…`) measures 0 wrong on f1. The
214+ same arithmetic was therefore fixed under another lane's name
215+ (`lane-av1ibc128arm`'s per-mu-chunk chroma walk, which that branch's own
216+ report already anticipated). Do not re-charter the mm walk bug.
217+* `lane-av1loss444mm` is still worth keeping for its instrumentation work
218+ (`EC_DQCOEFF`'s lossless, plane-tagged twin) — that is an analysis tool
219+ question, not a defect question, and its lossless twin is what the next
220+ genuinely-divergent unit in this class should be compared against.
221+* The recorded "the error is already in the stored reference picture" fact is
222+ consistent with what is measured now: with the reconstruction itself exact,
223+ there is nothing left in the store for the later stages to corrupt.
224+
225+## 8. What could not be separated
226+
227+* **Whether the class is closed because of `lane-av1loss444kf` +
228+ `lane-av1lm444loss-corr` + `lane-av1ibc128arm` or because of something else
229+ entirely.** This lane measured the current state; it did not bisect which
230+ commit closed it, and the three branches are tangled (kf unmerged, corr
231+ unmerged, ibc128arm unmerged, all exact on main). Naming a single culprit
232+ commit here would be a guess, so none is named.
233+* **A full-suite run.** By contract no local full suite was executed; only the
234+ four scoped filters and `cargo check --all-targets`. Suite-wide validation is
235+ Main's, once, after the branches land.
236+* **The 251777 B screen-tools cell (§5)** stays unmeasured against the oracle
237+ because this decoder refuses it by name. Whether it would be exact if decoded
238+ is unknown and is not claimed.
239+
240+## 9. Reproduce
241+
242+```bash
243+D=$HOME/.cache/loss444; mkdir -p $D; cd $D
244+ffmpeg -v error -f lavfi -i "testsrc2=size=256x128:rate=25" -frames:v 6 \
245+ -pix_fmt yuv444p -strict -1 -f yuv4mpegpipe -y s6.y4m
246+~/.cache/aom-oracle/build/aomenc --limit=6 --kf-max-dist=100 --threads=1 \
247+ --row-mt=0 --lag-in-frames=0 --passes=1 --end-usage=q --lossless=1 \
248+ --tile-columns=1 --cpu-used=2 --obu -o w1.obu - < s6.y4m # 77847, 87b0d1a5…
249+python3 cmp_final.py w1.obu 256 128 8 ./wk_w1 # 6× "Y=0 U=0 V=0"
250+```
251+
252+`cmp_final.py` is outside the repo (a read-only analysis script, as the mm
253+lane's were): length-asserting per-frame compare of `EC_AV1_FINAL_DUMP` dumps
254+from `dump_yuv` and from `aomdec`, per plane, with first-sample coordinates and
255+delta range. The two negative controls of §4 are the same script with a bit
256+flipped in a dump.