forge
Explore
Log in

Don't you dare go Hollow

Merge branch 'lane-av1tilerows'

Browse files at this commit

048a8599a5a7c9516943a8d1945762ca2500fae5Ahmet Kaan GümüşParent: 810f6bc6a71455
crates/ec-av1/fixtures/ll444_rect16x4_chroma_reach.obuadded+0 -0

Binary file changed

crates/ec-av1/src/decode.rsmodified+23 -6
@@ -17479,12 +17479,26 @@ fn decode_rect4_16_strip(
17479 for rr in 0..ch / 4 {17479 for rr in 0..ch / 4 {
17480 for cc in 0..cw / 4 {17480 for cc in 0..cw / 4 {
17481 let (ox, oy) = (cc * 4, rr * 4);17481 let (ox, oy) = (cc * 4, rr * 4);
17482+ // The unit's origin and extent in LUMA pixels: `<< ss`
17483+ // at 4:2:0 (8x8 luma for a 4x4 chroma unit), identity
17484+ // at 4:4:4 -- the same form as the block-walk sibling
17485+ // at decode.rs:35342. The hardcoded `ox * 2 / 8` is
17486+ // only right at ss (1,1): at 4:4:4 it claims a 4x4
17487+ // chroma unit is 8x8 luma, so `of_tu`'s
17488+ // `col_off + tx_w < bw` test answers against a
17489+ // footprint twice the real one and every unit past
17490+ // the block's midpoint wrongly reports
17491+ // `above_right = false` -- a directional chroma
17492+ // strip then predicts from a neighbour libaom
17493+ // never reads (measured: key frame 0, 4:4:4 lossless
17494+ // 16x4 strip at (104,26), U 29 + V 34 samples wrong,
17495+ // entropy bit-identical over 351109 EC_SYMR reads).
17482 let cu_reach = tu_reach(17496 let cu_reach = tu_reach(
17483 pw,17497 pw,
17484 ph,17498 ph,
17485- ox * 2,17499+ ox << ss_x(fctx),
17486- oy * 2,17500+ oy << ss_y(fctx),
17487- 8,17501+ 4 << ss_x(fctx),
17488 pair_reach,17502 pair_reach,
17489 ppx,17503 ppx,
17490 ppy,17504 ppy,
@@ -17563,12 +17577,15 @@ fn decode_rect4_16_strip(
17563 // one entry over the unit's two cells17577 // one entry over the unit's two cells
17564 // (`read_intra_chroma_lossless`).17578 // (`read_intra_chroma_lossless`).
17565 let cu_around = neighbours.around_mi(cu_mi, MI);17579 let cu_around = neighbours.around_mi(cu_mi, MI);
17580+ // Same ss-aware luma footprint as the skip arm
17581+ // above -- `ox * 2 / 8` is the 4:2:0-only form and
17582+ // mis-answers `of_tu` at 4:4:4 (see there).
17566 let cu_reach = tu_reach(17583 let cu_reach = tu_reach(
17567 pw,17584 pw,
17568 ph,17585 ph,
17569- ox * 2,17586+ ox << ss_x(fctx),
17570- oy * 2,17587+ oy << ss_y(fctx),
17571- 8,17588+ 4 << ss_x(fctx),
17572 pair_reach,17589 pair_reach,
17573 ppx,17590 ppx,
17574 ppy,17591 ppy,
crates/ec-av1/src/stream.rsmodified+180 -0
@@ -9562,6 +9562,186 @@ pub(crate) mod tests {
9562 "{NAME}: measured byte 108"9562 "{NAME}: measured byte 108"
9563 );9563 );
9564 }9564 }
9565+
9566+ /// lane-av1tilerows: the 4:4:4 LOSSLESS rect-pair chroma REACH fix --
9567+ /// the defect lane `av1formatsweep` filed as **H4** ("4:4:4 lossless +
9568+ /// `--tile-rows=1`, frame 3 onward the whole plane goes flat") and this
9569+ /// lane's red-before actually measured.
9570+ ///
9571+ /// **The H4 label was wrong; the defect it points at is real.** Two
9572+ /// corrections to the sweep's framing, both measured:
9573+ ///
9574+ /// 1. `--tile-rows=1` at 256x128 is a **no-op**. aomenc's default
9575+ /// superblock is 128px, so 256x128 is 2x1 superblocks -- there is no
9576+ /// second superblock ROW to split, and aomenc silently emits a
9577+ /// stream BYTE-IDENTICAL to `--tile-columns=0 --tile-rows=0`
9578+ /// (verified: both 64828 bytes, `cmp` equal). The sweep's "tiled"
9579+ /// fixture contained no tile rows at all. Tile rows at 4:4:4
9580+ /// lossless are exact here: measured pixel-exact at 1, 2 and 4 tile
9581+ /// rows, both axes (2x2), at 256x128 / 256x256 / 128x256 / 512x128,
9582+ /// on a recipe that is exact without tiles.
9583+ /// 2. The "frames 0-2 byte-exact, frame 3 onward flat, Y(0,0) 128 vs
9584+ /// 81" signature is a **harness frame-order mismatch, not a decode
9585+ /// defect**: with altref on, aomdec's `EC_AV1_FINAL_DUMP` writes 7
9586+ /// frames in DECODE order while `ffmpeg -f rawvideo` writes 6 in
9587+ /// DISPLAY order. Indexing one against the other makes frame 1 differ
9588+ /// by 29109 samples (30%) -- and aomdec-vs-ffmpeg ALONE reproduces
9589+ /// the identical 29109/24412/20046/19906 counts with no edith
9590+ /// decoder in the loop. Our decode-order output is byte-exact against
9591+ /// the oracle on all 7.
9592+ ///
9593+ /// The defect IS real, is in the class the sweep named (a hardcoded
9594+ /// 4:2:0-shaped walk at 4:4:4), and is tile-INDEPENDENT: it reproduces
9595+ /// on the zero-tile stream. `decode.rs`'s lossless 16x4/4x16 chroma-pair
9596+ /// walk passed `tu_reach` a hardcoded 4:2:0 luma footprint
9597+ /// (`ox * 2, oy * 2, 8`) for every chroma transform unit. At 4:4:4 a
9598+ /// 4x4 chroma unit is 4x4 LUMA, so the footprint is doubled:
9599+ /// `Reach::of_tu`'s `col_off + tx_w < bw` test then answers against a
9600+ /// block twice its real width and every unit past the midpoint wrongly
9601+ /// reports `above_right = false`, so a directional chroma strip predicts
9602+ /// from a neighbour libaom never reads.
9603+ ///
9604+ /// **Measured site (red-before, `git stash` of the fix, same tree):**
9605+ /// `testsrc2 256x128 yuv444p`, aomenc `--profile=1 --lossless=1
9606+ /// --passes=1 --end-usage=q --threads=1 --row-mt=0 --limit=6
9607+ /// --cpu-used=2 --lag-in-frames=0 --kf-max-dist=100` (pinned below).
9608+ /// Frame 0 (the KEY frame) and all five inter frames: **63 samples wrong
9609+ /// per frame, U 29 + V 34, first at U(110,26) / V(108,26), deltas -10..+13**,
9610+ /// region x108..125 y26..29 -- a 16x4 chroma strip at 4:4:4, whose rows
9611+ /// are NOT block-aligned (y26), which is the signature of a REACH
9612+ /// answer and not of a coefficient or transform error.
9613+ ///
9614+ /// **Entropy is bit-identical**: `EC_SYMR` on both sides, 351109 reads
9615+ /// compared on `(value, range, symbol, post_rng)` with the CDF-row
9616+ /// convention reconciled (`32768 - ours_cdf0 == oracle_cdf0`): **zero
9617+ /// divergence**. So this is reconstruction arithmetic, not an entropy
9618+ /// fork -- which is what separates it from the H1 rect-partition fork
9619+ /// (that one forks `EC_SYMR` at `decodetxb.c:158` `txb_skip`).
9620+ ///
9621+ /// A second, far worse instance of the SAME defect is the 512x128
9622+ /// `--cpu-used=2` stream (18779 wrong in the key frame, growing to
9623+ /// 130708 by frame 5) -- but that stream ALSO forks entropy
9624+ /// (459866 oracle reads vs 369136 ours), so it is not claimed here;
9625+ /// it belongs to the H1 rect-partition lane. The pinned fixture below is
9626+ /// the entropy-clean, fully-repaired instance.
9627+ ///
9628+ /// Non-vacuity: the fixture bytes are pinned (length + FNV-1a, like the
9629+ /// other `ll444_*` pins), the header must really be `ss (0,0)` at 8-bit
9630+ /// with `lossless == 1` (asserted from the parsed sequence header, not
9631+ /// assumed), the tiled sweep gates' counter
9632+ /// `decode::rect4_16_lossless_chroma_hits()` must FIRE (measured 80
9633+ /// units on this fixture -- a 4:2:0 stream of the same content leaves it
9634+ /// at 0, because a 4:2:0 lossless 16x4 pair is an 8x4 chroma block and
9635+ /// takes the pair-merge, not this walk), and every frame must be
9636+ /// byte-exact through BOTH the oracle `aomdec --rawvideo` (decode order,
9637+ /// the 7-frame compare that the hidden-frame gates use) and ffmpeg
9638+ /// (display order, 4:4:4 full-resolution chroma).
9639+ #[test]
9640+ fn a_lossless_444_rect16x4_chroma_reach_is_ss_aware() {
9641+ const NAME: &str = "a_lossless_444_rect16x4_chroma_reach_is_ss_aware";
9642+ const FIXTURE_LEN: usize = 77918;
9643+ const FIXTURE_FNV: u64 = 0xe2a2_90ac_f249_4bf7;
9644+ const W: usize = 256;
9645+ const H: usize = 128;
9646+ const FRAMES: usize = 6;
9647+ let obu = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))
9648+ .join("fixtures/ll444_rect16x4_chroma_reach.obu");
9649+ let stream = std::fs::read(&obu).unwrap_or_else(|e| {
9650+ panic!(
9651+ "{NAME}: pinned fixture {} is missing ({e}) -- the gate cannot run, \
9652+ which is a failure, not a skip",
9653+ obu.display()
9654+ )
9655+ });
9656+ assert_eq!(stream.len(), FIXTURE_LEN, "{NAME}: fixture length moved");
9657+ assert_eq!(fnv1a64(&stream), FIXTURE_FNV, "{NAME}: fixture bytes moved");
9658+
9659+ // The header must really be the shape the fix is about: 4:4:4
9660+ // (ss 0/0) at 8-bit. A fixture that silently became 4:2:0 would
9661+ // take the pair-merge and make every arm below vacuous.
9662+ {
9663+ let mut p = Av1Parser::new();
9664+ let mut pos = 0usize;
9665+ let mut seq = None;
9666+ while pos < stream.len() {
9667+ let Ok(obu) = p.parse_obu(&stream[pos..]) else {
9668+ break;
9669+ };
9670+ pos += obu.total_size;
9671+ if matches!(obu.kind, ObuKind::SequenceHeader(_)) {
9672+ seq = p.sequence_header();
9673+ break;
9674+ }
9675+ }
9676+ let seq = seq.unwrap_or_else(|| panic!("{NAME}: no sequence header parsed"));
9677+ assert_eq!(
9678+ (seq.color_config.subsampling_x, seq.color_config.subsampling_y),
9679+ (0, 0),
9680+ "{NAME}: fixture is not 4:4:4 (ss {}x{})",
9681+ seq.color_config.subsampling_x,
9682+ seq.color_config.subsampling_y
9683+ );
9684+ assert_eq!(
9685+ seq.color_config.bit_depth, 8,
9686+ "{NAME}: fixture bit depth moved"
9687+ );
9688+ assert_eq!(seq.max_frame_width, W as u32, "{NAME}: fixture width moved");
9689+ assert_eq!(seq.max_frame_height, H as u32, "{NAME}: fixture height moved");
9690+ }
9691+
9692+ let _guard = lock_gate_counters();
9693+ crate::decode::reset_rect4_16_pair_hits();
9694+ let frames = decode_stream(&stream).unwrap_or_else(|e| {
9695+ panic!("{NAME}: the pinned stream no longer decodes cleanly: {e}")
9696+ });
9697+ let hits = crate::decode::rect4_16_lossless_chroma_hits();
9698+ assert!(
9699+ hits > 0,
9700+ "{NAME}: gate is vacuous -- no lossless 16x4/4x16 chroma-pair unit was \
9701+ walked (rect4_16_lossless_chroma_hits = {hits}), so the repaired \
9702+ `tu_reach` call site never ran"
9703+ );
9704+ assert_eq!(frames.len(), FRAMES, "{NAME}: shown frame count");
9705+ for f in &frames {
9706+ assert_eq!((f.width, f.height), (W, H), "{NAME}: dimensions");
9707+ }
9708+
9709+ // The oracle, DECODE order, every frame including hidden alt-ref
9710+ // frames. This is the arm that proves the repair against aomdec's
9711+ // own reconstruction, not just ffmpeg's.
9712+ if aomdec_path().is_file() {
9713+ let (decoded, hidden) = decode_all_frames_vs_oracle(&stream, NAME);
9714+ assert!(
9715+ decoded >= FRAMES,
9716+ "{NAME}: oracle decoded {decoded} frames, expected at least {FRAMES}"
9717+ );
9718+ let _ = hidden;
9719+ } else {
9720+ eprintln!(
9721+ "SKIP {NAME} aomdec arm: no oracle aomdec at {}",
9722+ aomdec_path().display()
9723+ );
9724+ }
9725+
9726+ // ffmpeg's decoder: DISPLAY order, full-resolution chroma.
9727+ if have_ffmpeg() {
9728+ let refs = ffmpeg_decode_sequence_444(&stream, W, H, FRAMES);
9729+ for (i, (got, want)) in frames.iter().zip(refs.iter()).enumerate() {
9730+ for (p, (g, r)) in [(&got.y, &want.y), (&got.u, &want.u), (&got.v, &want.v)]
9731+ .iter()
9732+ .enumerate()
9733+ {
9734+ let bad = g.iter().zip(r.iter()).filter(|(a, b)| a != b).count();
9735+ assert_eq!(
9736+ bad, 0,
9737+ "{NAME}: ffmpeg frame {i} plane {p}: {bad} samples differ"
9738+ );
9739+ }
9740+ }
9741+ } else {
9742+ eprintln!("SKIP {NAME} ffmpeg arm: no ffmpeg");
9743+ }
9744+ }
9565 /// lane-av1-intrabc r4: the reviewer's unblock witness for the rect-strip9745 /// lane-av1-intrabc r4: the reviewer's unblock witness for the rect-strip
9566 /// reconstruction -- a CODED `use_intrabc` block (so its residual reader9746 /// reconstruction -- a CODED `use_intrabc` block (so its residual reader
9567 /// runs, not just the prediction copy) on a 2:1 strip in BOTH9747 /// runs, not just the prediction copy) on a 2:1 strip in BOTH
lanes/av1tilerows.report.mdadded+284 -0
@@ -0,0 +1,284 @@
1+# lane-av1tilerows — H4: 4:4:4 lossless + tile rows
2+
3+**Verdict.** The H4 *label* is wrong; the defect it points at is real, and it is
4+**not** a tile defect. Fixed: a hardcoded 4:2:0-shaped chroma reach at 4:4:4 in
5+the lossless 16x4/4x16 chroma-pair walk (`decode.rs`). Red-before **63 samples
6+wrong per frame**; entropy **bit-identical** over 351,109 `EC_SYMR` reads.
7+
8+**Tree.** `lane-av1tilerows` off `4155c7c7`, worktree `~/.cache/wt/av1tilerows`.
9+Not pushed (Main merges).
10+
11+## 1. Two corrections to the sweep's H4 framing
12+
13+Both measured, both reproducible.
14+
15+### 1.1 `--tile-rows=1` at 256x128 is a no-op
16+
17+aomenc's default superblock is 128px, so **256x128 is 2x1 superblocks** — there
18+is no second superblock *row* to split. aomenc silently emits a stream
19+**byte-identical** to `--tile-columns=0 --tile-rows=0`:
20+
21+```
22+g_256x128_notile.obu vs g_256x128_rows1.obu identical=True (64828/64828 bytes)
23+```
24+
25+The sweep's "tiled" H4 fixture contained **no tile rows at all**. (Same trap at
26+512x128: `g_512x128_notile` == `g_512x128_rows1`, 90553 bytes both.)
27+
28+Tile rows at 4:4:4 lossless are **exact**. Measured pixel-exact, 6-8 frames
29+each, against ffmpeg display order, on a recipe that is itself exact untiled:
30+
31+| recipe | tile grid | wrong/frame |
32+|---|---|---|
33+| `clean_notile` | 1x1 | 0 |
34+| `clean_sb64_r1` | 1x2 | 0 |
35+| `clean_sb64_r2` | 1x2 | 0 |
36+| `clean_sb64_r1c1` | 2x2 | 0 |
37+| `clean_512_r1` | 1x2 | 0 |
38+| `clean_256x256_r2` | 1x4 | 0 |
39+| `clean_128x256_r1` | 1x2 | 0 |
40+
41+(`clean` = `--enable-rect-partitions=0 --enable-palette=0 --cpu-used=2
42+--lag-in-frames=0 --lossless=1`, so the tile path is measured in isolation.)
43+
44+### 1.2 The "flat plane from frame 3" is a harness frame-order mismatch
45+
46+The reported signature — *frames 0-2 byte-exact, frame 3 onward the whole plane
47+comes out flat, Y(0,0) ours 128 vs ref 81* — is **not a decode defect**. With
48+altref on (the recipe's default), aomdec's `EC_AV1_FINAL_DUMP` writes **7**
49+frames in **decode** order while `ffmpeg -f rawvideo` writes **6** in **display**
50+order. Indexing one against the other:
51+
52+```
53+aomdec_decode[i] vs ffmpeg_display[i]: f0 EXACT, f1 29109 (30%), f2 EXACT,
54+ f3 24412 (25%), f4 20046, f5 19906
55+```
56+
57+**aomdec vs ffmpeg alone reproduces the identical counts with no edith decoder
58+in the loop.** Our decode-order output is byte-exact against the oracle on all 7
59+frames of that exact stream. Any H4-shaped verdict obtained by pairing a
60+decode-order dump against a display-order reference is a harness artefact.
61+
62+## 2. The real defect (found at the same recipe, tile-independent)
63+
64+The stream at the sweep's recipe **does** diverge, and it does so **with zero
65+tiles** — so it was never a tile-row bug:
66+
67+```
68+notile 256x128 wrong=[63, 63, 63, 63, 63, 63]
69+rows1 256x128 wrong=[63, 63, 63, 63, 63, 63] (same counts)
70+```
71+
72+**First wrong sample: U(110,26)** (ours 8, ref 7). V first at (108,26). 63
73+samples/frame, U 29 + V 34, deltas **-10..+13**, region x108..125 y26..29.
74+Frame 0 (the **key** frame) is already wrong, and all five inter frames inherit
75+it identically.
76+
77+**Entropy: bit-identical.** `EC_SYMR` both sides, 351,109 reads compared on
78+`(value, range, symbol, post_rng)` with the CDF convention reconciled
79+(`32768 - ours_cdf0 == oracle_cdf0`): **zero divergence**. So this is
80+reconstruction arithmetic, not an entropy fork — which is exactly what
81+separates it from H1.
82+
83+**Bisect** (all at 256x128, `--lossless=1`):
84+
85+| toggle | wrong/frame |
86+|---|---|
87+| baseline (default partitions) | 63 |
88+| `--enable-rect-partitions=0` | **0** |
89+| `--enable-palette=0` | **0** |
90+| `--min-partition-size=32` | **0** |
91+| `--min-partition-size=8` | **0** |
92+| `--max-partition-size=64` | 63 |
93+| `--enable-ab-partitions=0` | 63 |
94+| `--enable-tx-size-search=0` | 63 |
95+| `--enable-cfl-intra=0` | 63 |
96+
97+So the site is a **rect-partitioned 16x4/4x16 luma block** whose **lossless**
98+4:4:4 chroma pair walk mis-answers `Reach::of_tu`.
99+
100+## 3. Class and fix
101+
102+**Class: hardcoded 4:2:0-shaped walk at 4:4:4** (`reach-is-4:2:0-shaped`), the
103+same class the wave fixed in the 422 monochrome-table and chroma-block-size bugs.
104+
105+`decode.rs`, the lossless 16x4/4x16 chroma-pair walk (both the skip and the
106+coded arm) passed `tu_reach` a hardcoded **4:2:0 luma footprint**:
107+
108+```rust
109+tu_reach(pw, ph, ox * 2, oy * 2, 8, pair_reach, ...)
110+```
111+
112+A 4x4 chroma unit is 8x8 **luma** at 4:2:0 — so `ox * 2 / 8` is right there and
113+**only** there. At 4:4:4 the same unit is 4x4 luma, so the footprint is doubled:
114+`Reach::of_tu`'s `col_off + tx_w < bw` test then answers against a block twice
115+its real width, and every unit past the midpoint wrongly reports
116+`above_right = false`. A directional chroma strip then predicts from a
117+neighbour libaom never reads.
118+
119+The wrong rows are **not block-aligned** (y26 is not a multiple of 4) — the
120+signature of a REACH answer, not of a coefficient or transform error.
121+
122+Fix: the ss-aware form, identical to the block-walk sibling at
123+`decode.rs:35342` (`<< ss` at 4:2:0, identity at 4:4:4):
124+
125+```rust
126+tu_reach(pw, ph, ox << ss_x(fctx), oy << ss_y(fctx), 4 << ss_x(fctx), ...)
127+```
128+
129+Both copies patched (the class sweep found exactly two). The 4:2:0 answer is
130+unchanged by construction — `<< 1` is `* 2` and `4 << 1` is `8` — which is why
131+every 4:2:0 gate stayed green.
132+
133+## 4. Gate
134+
135+`a_lossless_444_rect16x4_chroma_reach_is_ss_aware` (`stream.rs`), fixture
136+`fixtures/ll444_rect16x4_chroma_reach.obu`:
137+
138+- **77918 bytes**, sha256 `382e67c0cc0988d14c500a62f5c3457a3f3b5f76d05acce2f655b1089bb8e7e3`,
139+ FNV-1a `0xe2a290acf2494bf7`. Recipe: `testsrc2 256x128 yuv444p`, aomenc
140+ `--profile=1 --lossless=1 --passes=1 --end-usage=q --threads=1 --row-mt=0
141+ --limit=6 --cpu-used=2 --lag-in-frames=0 --kf-max-dist=100`.
142+- **Non-vacuity**: header asserted `ss (0,0)` / 8-bit / 256x128 from the
143+ *parsed* sequence header; `rect4_16_lossless_chroma_hits()` must fire
144+ (measured **80** on this fixture; a 4:2:0 stream of the same content takes the
145+ pair-merge and leaves it at 0); every frame byte-exact through the oracle
146+ `aomdec --rawvideo` in **decode** order (all 7) and ffmpeg in **display**
147+ order with full-resolution chroma.
148+- **Mutation proof (non-vacuous, run)**: reverting the two calls to `ox * 2 /
149+ oy * 2 / 8` turns the gate **RED** —
150+ `decode-order frame 0 ... differs from the oracle at byte 39534 (ours 8 vs 7),
151+ 63 bytes differ` — byte 39534 is exactly U(110,26), the measured site.
152+
153+## 5. Identity (all green locally, this tree)
154+
155+| group | result |
156+|---|---|
157+| new gate `a_lossless_444_rect16x4_chroma_reach_is_ss_aware` | ok (mutation red) |
158+| all `a_lossless` (10, incl. 4:2:0 `a_lossless_16x4_chroma_pair_repairs_the_measured_site`, `a_lossless_sb128_rect_intra`, `a_lossless_libaom_key_frame`, `a_lossless_libaom_inter_frame`) | 10 passed / 0 failed |
159+| all `444` (9, incl. the 4 committed `ll444_*` pins and `a_444_sb128_root_rect_stream_with_restoration`) | 9 passed / 0 failed |
160+| tile gates (3: two_tile_rows, …_through_decode_stream, four_tile_rows) | 3 passed / 0 failed |
161+| sweep's 3 new gates, run in `~/.cache/wt/av1fmt` with this `decode.rs` applied, then restored | 3 passed / 0 failed |
162+
163+## 6. Handed back to the H1 lane (NOT fixed here)
164+
165+**512x128, `--cpu-used=2`, `--lossless=1`**: 18779 wrong in the key frame,
166+growing to **130708** by frame 5. Same *shape* of damage, but it **also forks
167+entropy** — 459,866 oracle `EC_SYMR` reads vs 369,136 ours — so it is not this
168+defect and not claimable here. The 512x128 damage is **unchanged by this fix**
169+(measured before and after: `[18779, 84910, 93811, 104654, 82976, 130708]` both
170+times) — it forks entropy before any reach is consulted, so
171+**the residual is an entropy fork in the H1 rect-partition class**. Recommended
172+for whoever takes H1: re-run the `EC_SYMR` ladder on
173+`testsrc2 512x128 yuv444p --lossless=1 --cpu-used=2 --lag-in-frames=0
174+--kf-max-dist=100 --limit=6` and pair the first fork against
175+`decodetxb.c:158` (`txb_skip`) exactly as the sweep's H1 section did.
176+
177+Two other pre-existing items found but **not** fixed (out of scope, not
178+introduced here, and neither is a tile-row defect):
179+
180+1. **256x256 4:4:4 lossless, zero tiles, `--sb-size=64`**: panics at
181+ `decode.rs:2787` — `debug_assert_eq!((self.w, self.h), (4, 4))` in
182+ `TxParams::run`, i.e. a non-4x4 unit reached the lossless WHT path. Release
183+ builds miss the assert, so this is a latent wrong-shape reconstruction.
184+2. **256x256 4:4:4 lossless with default (128px) superblocks**: exact. Only the
185+ 64px-SB variant panics.
186+
187+## 7. Hygiene
188+
189+- The H4 diagnosis added no instrumentation: it used existing env-gated rungs
190+ only (`EC_SYMR`, `EC_TRACE` on the oracle).
191+- The §8 class sweep DID add one temporary env-gated counter
192+ (`EC_TMP_SB128CHROMA`, at the `decode.rs:41930` arm) to prove 4:4:4
193+ reachability. It is **removed** — `grep -c EC_TMP_SB128CHROMA
194+ crates/ec-av1/src/decode.rs` is 0 at HEAD and `git status` is clean against
195+ the lane commit.
196+- `git diff` for the fix itself touches `decode.rs` (the two reach calls +
197+ comments), `stream.rs` (the gate) and the pinned fixture. Nothing else.
198+- No formatters run.
199+- Local runs used `EC_NOMEMGUARD=1`: the repo's `scripts/memguard-runner.sh`
200+ transient-scope wrapper collided with stale `run-p*.scope` units on this box
201+ ("Unit run-p…scope was already loaded"), which aborts `cargo test` before any
202+ test runs. That is an environment artefact, not a test failure — every gate
203+ above was run with the wrapper bypassed.
204+
205+## 8. Class sweep — is the class closed repo-wide?
206+
207+Enumerated **every** production call site of `tu_reach`, `tu_reach_rect` and
208+`Reach::of_tu` (excluding the two wrapper bodies at `decode.rs:1593`/`1622` and
209+`encode.rs:16024`/`16031`/`16180`, which are inside `mod tests`). Result:
210+**32 production sites — 27 ss-aware, 4 4:2:2-only, 1 remaining hardcoded
211+4:2:0-shaped site.** `Reach` is referenced by no crate outside
212+`crates/ec-av1/src/{decode,encode}.rs`, and no site sits behind a feature or
213+`cfg` other than `#[cfg(test)]`.
214+
215+Three correct conventions exist, and no fourth:
216+
217+- **A — canonical ss shift** `ox << ss_x(fctx), oy << ss_y(fctx), 4 << ss_x(fctx)`:
218+ 17401, 17488 (fixed here), 35359 (the reference form).
219+- **B — hoisted per-axis luma-span locals** (`span_x = 4 << ss_x`,
220+ `luma_span_x = chroma_tx << ss_x`, …): 11610, 20401, 20660, 21021, 21618,
221+ 42370, 42497. Semantically identical to A.
222+- **C — 4:4:4-gated identity literal** (a bare `4` / `chroma_tx`, no shift):
223+ 22235, 22288, 42249, 44605. Each sits under a guard that *names*
224+ `ss_x == 0 && ss_y == 0` (or `chroma_444`), so the literal IS the identity
225+ and the guard is load-bearing. Correct as written, but these are the four
226+ sites that would break first if a 4:2:0/4:2:2 sibling arm were ever added
227+ beside them — flagged, not changed.
228+
229+All remaining luma sites pass pure luma pixel offsets and are SS_AWARE by
230+construction. The 4 HARDCODED_422_ONLY sites (15514, 15782, 17567, 17650) are
231+guarded by `chroma422_rect32 = … && ss_x == 1 && ss_y == 0` (15417) and
232+`chroma422_pair16 = … && ss_x == 1` (17341) — 4:2:2, refused by name at
233+`stream.rs:1749`, and unreachable at 4:4:4. Their `(0, unit_row*8, 8, 8)` is
234+exactly the ss(1,0) luma footprint of a 4x8 chroma unit.
235+
236+### The one remaining member: `decode.rs:41934` — reachable at 4:4:4, NOT fixed here
237+
238+```rust
239+if side > 64 { // plain geometry, not a subsampling test
240+ let cu_tx = 32usize; // a CHROMA extent, the 4:2:0 answer
241+ let luma_span = cu_tx * 2; // 4:2:0 luma scale -- THE CLASS
242+ let (cu_x, cu_y) = (cpx + cc * cu_tx, cpy + cr * cu_tx);
243+ let cu_reach = crate::decode::tu_reach(side, side, cc * luma_span, cr * luma_span, luma_span, …);
244+```
245+
246+**Reachability PROVED by counter, not by argument.** A temporary env-gated
247+counter (added, measured, removed — `grep EC_TMP_SB128CHROMA` is 0 at HEAD)
248+fired **32 times at `ss=(0,0) side=128`** on a 4:4:4 lossy
249+`--sb-size=128 --cq-level=20` stream. 4:4:4 is admitted; only
250+`subsampling_x != subsampling_y` is refused. No committed 4:4:4 fixture fires
251+it (`444_sb128rect_lr_witness`, `444_leaf8_oob`, and all three `ll444_*` pins
252+each fire **0**), so this arm has **no 4:4:4 coverage at all**.
253+
254+**Why it is not patched.** I could not build a witness, and I will not ship an
255+unvalidated change into a path with zero coverage:
256+
257+1. The only recipes that fire the arm are also broken by the **pre-existing H1
258+ entropy fork** — 31272 wrong from frame 3, and byte-identical between base
259+ `4155c7c7` and this lane's tip, so it is not mine. A reach delta is invisible
260+ under that much damage: A/B-ing `luma_span = cu_tx << ss_x(fctx)` against
261+ `cu_tx * 2` gave **byte-identical output on every frame**.
262+2. Every recipe that IS pixel-exact at 4:4:4 refuses to fire the arm
263+ (`--enable-rect-partitions=0` and `--enable-1to4-partitions=0` both give 0
264+ fires across six cq/geometry variants, all exact).
265+3. `luma_span` is not the whole defect. Per `blockd.h:1372`,
266+ `av1_get_max_uv_txsize(BLOCK_128X128, 0, 0)` is
267+ `max_txsize_rect_lookup[BLOCK_128X128]` = `TX_64X64` (adjusted → itself),
268+ **not** the `TX_32X32` the comment assumes: at 4:2:0 the plane block is
269+ halved to `BLOCK_64X64` first. So at 4:4:4 `cu_tx` should be 64 and
270+ `cu_x = cpx + cc * cu_tx` should be `cc * 64`, not `cc * 32` — the arm
271+ addresses the wrong chroma region entirely, independently of the reach
272+ argument. Patching only `luma_span` would be a **half fix**: it would change
273+ the reach answer in an arm whose unit geometry is still 4:2:0-shaped, with
274+ no gate able to catch the difference.
275+
276+**Recommendation.** Fix H1 first; this site then becomes witnessable and
277+should be repaired as a unit (`cu_tx = 32 << ss_x(fctx)`, `luma_span =
278+cu_tx << ss_x(fctx)`, and the per-chunk chroma origin with it), with the same
279+`<< 1 == * 2` 4:2:0 identity argument. The 4:2:0 identity is not in question —
280+`32 << 1 == 64` — so the repair is provably a no-op for the only format with
281+committed coverage on this path.
282+
283+**Net class status: the class is closed except for this one site, which is
284+proven reachable and documented rather than silently changed.**