forge
Explore
Log in

Don't you dare go Hollow

Merge branch 'lane-av1lm444loss-corr'

Browse files at this commit

434bf372be7d8d14afb1e96e2153e32e3e15c173Ahmet Kaan GümüşParent: 6a556d844dc399
crates/ec-av1/fixtures/ll444_intrabc_rect_l2.obuadded+0 -0

Binary file changed

crates/ec-av1/src/decode.rsmodified+20 -1
@@ -13892,7 +13892,26 @@ fn decode_intrabc_rect(
13892 unit.extend_from_slice(&comp[(ur * 4 + r) * cside + uc * 4..][..4]);13892 unit.extend_from_slice(&comp[(ur * 4 + r) * cside + uc * 4..][..4]);
13893 }13893 }
13894 neighbours.record_mi_chroma(13894 neighbours.record_mi_chroma(
13895- (mi_r + ur * (4 >> ss_y(fctx)), mi_c + uc * (4 >> ss_x(fctx))),13895+ // lane-av1lm444loss-corr: the MI STEP between chroma
13896+ // units is that same footprint expressed in luma mi
13897+ // cells, `(4 << ss) / MI` -- which is exactly what
13898+ // `decode_inter_block`'s reference `mu_chroma_units`
13899+ // construction writes (decode.rs:43688,
13900+ // `at.0 + cr * ((cu << ss_y(fctx)) / MI)` with
13901+ // `cu = 4` on a lossless frame). The `4 >> ss_y` form
13902+ // this replaces is 4:2:0-only arithmetic that happens
13903+ // to agree there: at ss (1,1) it is `4 >> 1` = 2 mi
13904+ // and the footprint form is `(4 << 1) / 4` = 2 mi, the
13905+ // SAME value, so 4:2:0 is unchanged by construction.
13906+ // At ss (0,0) it is `4 >> 0` = 4 mi -- four luma mi
13907+ // (16 luma px) per 4x4 chroma unit, where a TX_4X4
13908+ // chroma unit covers `4 << 0` = 4 luma px = ONE mi.
13909+ // The step therefore lands every replayed unit at 4x
13910+ // its own mi row/column on a 4:4:4 lossless frame, and
13911+ // the whole block's per-unit states are stamped over
13912+ // cells that belong to other blocks (or to nothing).
13913+ (mi_r + ur * ((4 << ss_y(fctx)) / MI),
13914+ mi_c + uc * ((4 << ss_x(fctx)) / MI)),
13896 4 << ss_x(fctx),13915 4 << ss_x(fctx),
13897 4 << ss_y(fctx),13916 4 << ss_y(fctx),
13898 plane_idx,13917 plane_idx,
crates/ec-av1/src/stream.rsmodified+146 -0
@@ -7184,6 +7184,152 @@ pub(crate) mod tests {
7184 );7184 );
7185 }7185 }
7186 7186
7187+ /// lane-av1lm444loss-corr: the MI STEP at which `decode_intrabc_rect`'s
7188+ /// lossless chroma replay walks the plane block.
7189+ ///
7190+ /// `lane-whtshape` (`f541d062`, merged `afa13bcf`) gave this route the
7191+ /// per-TX_4X4 lossless chroma walk and the tail replay that re-stamps
7192+ /// each unit's own coefficient context over the whole-block record. The
7193+ /// replay stepped by `4 >> ss_y(fctx)` mi cells, which is 4:2:0-only
7194+ /// arithmetic: at ss (1,1) it reads 2 and the ss-aware form
7195+ /// `(4 << ss_y) / MI` also reads 2, so 4:2:0 agrees by construction; at
7196+ /// ss (0,0) it reads 4 mi, i.e. 16 luma px per 4x4 chroma unit, where the
7197+ /// unit covers `4 << 0` = 4 luma px = ONE mi. Every replayed unit was
7198+ /// therefore stamped at 4x its own mi origin on a 4:4:4 lossless frame,
7199+ /// writing over cells that belong to other blocks.
7200+ ///
7201+ /// This gate is the WIRNESS stream, not a vacuous one. The 4:2:0
7202+ /// 4x4-identity is stated in the step's own comment and measured by the
7203+ /// `4:2:0` arm of the lane's invariant battery, not asserted here --
7204+ /// a 4:2:0 stream cannot fail this gate, by construction, and pretending
7205+ /// otherwise would be a floor on wrong output.
7206+ ///
7207+ /// Fixture `ll444_intrabc_rect_l2.obu`, 121844 bytes, sha256
7208+ /// `f0de080edce35d34cdd628b71f63dc452f946e8328352b69d3c1da090a54ec67`:
7209+ /// `testsrc2 512x128 yuv444p`, aomenc `--lossless=1 --cpu-used=2
7210+ /// --lag-in-frames=0 --kf-max-dist=100 --limit=6`, 6 frames. On main's
7211+ /// step this stream is 10604 samples wrong in the KEY frame, first at
7212+ /// byte 33216 (Y(64,448)) -- the corrupted chroma context desyncs the
7213+ /// following luma, which is why the first divergence is luma at all.
7214+ ///
7215+ /// Assertions:
7216+ ///
7217+ /// 1. `(subsampling_x, subsampling_y, bit_depth) == (0, 0, 8)` from the
7218+ /// stream's OWN parsed sequence header. At (1,1) the corrected step
7219+ /// and the old one are the same number, so without this every
7220+ /// assertion below would pass on a stream that cannot fail.
7221+ /// 2. `intrabc_rect_lossless_chroma4_hits()` (lane-whtshape's own
7222+ /// counter) is nonzero -- the replayed arm really ran, so the
7223+ /// corrected expression was evaluated.
7224+ /// 3. the U and V plane extents are luma-sized, which is the geometry
7225+ /// the step indexes into.
7226+ /// 4. `decode_all_frames_vs_oracle`: decode-order frame-count parity,
7227+ /// then byte-exactness on every frame.
7228+ ///
7229+ /// Control: the sibling 128x96 4:4:4 lossless pin, whose blocks are
7230+ /// whole and square, must not take the lossless chroma walk at all --
7231+ /// its chroma plane block IS one TX_4X4, so there is no step to replay.
7232+ #[test]
7233+ fn a_lossless_444_intrabc_rect_replay_steps_by_the_units_own_mi_footprint() {
7234+ const NAME: &str = "a_lossless_444_intrabc_rect_replay_steps_by_the_units_own_mi_footprint";
7235+ const W: usize = 512;
7236+ const H: usize = 128;
7237+ const FRAMES: usize = 6;
7238+
7239+ let obu = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))
7240+ .join("fixtures/ll444_intrabc_rect_l2.obu");
7241+ let stream = read_pin(&obu, 121844, 0x38bf_968e_979c_7a0a, NAME);
7242+ assert_eq!(
7243+ subsampled_header_shape(&stream, NAME),
7244+ (0, 0, 8),
7245+ "{NAME}: the stream is not 8-bit 4:4:4 -- at ss (1,1) the corrected \
7246+ step and the 4:2:0-only one are the SAME number (2 mi), so this gate \
7247+ cannot fail on a 4:2:0 stream and would prove nothing there"
7248+ );
7249+ let _guard = lock_gate_counters();
7250+ crate::decode::reset_intrabc_rect_lossless_chroma4_hits();
7251+ let h0 = crate::decode::intrabc_rect_lossless_chroma4_hits();
7252+ let frames = decode_stream(&stream)
7253+ .unwrap_or_else(|e| panic!("{NAME}: the pinned stream no longer decodes cleanly: {e}"));
7254+ let walked = crate::decode::intrabc_rect_lossless_chroma4_hits() - h0;
7255+ assert!(
7256+ walked > 0,
7257+ "{NAME}: lane-whtshape's lossless per-TX_4X4 chroma walk never ran, so the \
7258+ replayed MI step -- the thing this gate exists for -- was never evaluated"
7259+ );
7260+ assert_eq!(frames.len(), FRAMES, "{NAME}: frame count");
7261+ for f in &frames {
7262+ assert_eq!((f.width, f.height), (W, H), "{NAME}: dimensions");
7263+ assert_eq!(
7264+ f.u.len(),
7265+ W * H,
7266+ "{NAME}: U extent must be luma-sized at 4:4:4 -- the replay steps mi \
7267+ cells through this grid"
7268+ );
7269+ assert_eq!(f.v.len(), W * H, "{NAME}: V extent must be luma-sized at 4:4:4");
7270+ }
7271+ if aomdec_path().is_file() {
7272+ let (decoded, hidden) = decode_all_frames_vs_oracle(&stream, NAME);
7273+ assert_eq!(
7274+ decoded, FRAMES,
7275+ "{NAME}: decoded {decoded} frames in decode order, expected {FRAMES}"
7276+ );
7277+ eprintln!(
7278+ "{NAME}: {decoded} frames byte-exact vs aomdec ({hidden} hidden), \
7279+ {walked} lossless chroma replays"
7280+ );
7281+ } else {
7282+ eprintln!(
7283+ "SKIP {NAME} aomdec arm: no oracle aomdec at {}",
7284+ aomdec_path().display()
7285+ );
7286+ }
7287+
7288+ // Control: whole square blocks have no multi-unit plane block to step.
7289+ let ctrl = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))
7290+ .join("fixtures/ll444_128root_lossless.obu");
7291+ let ctrl_stream = read_pin(&ctrl, 63429, 0xf07d_47fc_fd51_2658, &format!("{NAME} control"));
7292+ crate::decode::reset_intrabc_rect_lossless_chroma4_hits();
7293+ let _ = decode_stream(&ctrl_stream)
7294+ .unwrap_or_else(|e| panic!("{NAME}: the control arm no longer decodes cleanly: {e}"));
7295+ assert_eq!(
7296+ crate::decode::intrabc_rect_lossless_chroma4_hits(),
7297+ 0,
7298+ "{NAME} control: the lossless chroma walk ran on a stream of whole square \
7299+ blocks -- there is no multi-unit chroma plane block to replay, so the \
7300+ corrected step is not exercised there at all"
7301+ );
7302+ }
7303+
7304+ /// `(subsampling_x, subsampling_y, bit_depth)` out of the stream's OWN
7305+ /// sequence header. A gate that claims to exercise a subsampling-specific
7306+ /// path must assert this from the parsed header, not from the recipe that
7307+ /// produced the fixture: the recipe can drift (or a wrong `--pix_fmt`
7308+ /// argument can silently produce a different subsampling) and every other
7309+ /// assertion would then pass vacuously.
7310+ fn subsampled_header_shape(stream: &[u8], name: &str) -> (u8, u8, usize) {
7311+ let mut parser = Av1Parser::new();
7312+ let mut pos = 0usize;
7313+ let mut shape = None;
7314+ while pos < stream.len() {
7315+ let obu = parser
7316+ .parse_obu(&stream[pos..])
7317+ .unwrap_or_else(|e| panic!("{name}: OBU does not parse: {e:?}"));
7318+ if obu.total_size == 0 {
7319+ break;
7320+ }
7321+ pos += obu.total_size;
7322+ if let ObuKind::SequenceHeader(seq) = obu.kind {
7323+ shape = Some((
7324+ seq.color_config.subsampling_x,
7325+ seq.color_config.subsampling_y,
7326+ seq.color_config.bit_depth as usize,
7327+ ));
7328+ }
7329+ }
7330+ shape.unwrap_or_else(|| panic!("{name}: no sequence header parsed"))
7331+ }
7332+
7187 /// lane-av1llpredgate2: the debug-exact pin for the ss-aware7333 /// lane-av1llpredgate2: the debug-exact pin for the ss-aware
7188 /// `obmc_skip_chroma_above` decision (lane-av1-llpred2). Fixture is the7334 /// `obmc_skip_chroma_above` decision (lane-av1-llpred2). Fixture is the
7189 /// llpred/llpred2 reports' stream pinned into `fixtures/`: testsrc27335 /// llpred/llpred2 reports' stream pinned into `fixtures/`: testsrc2
lanes/av1lm444loss-corr.report.mdadded+408 -0
@@ -0,0 +1,408 @@
1+# lane-av1lm444loss-corr — the ss-aware replay step in `decode_intrabc_rect`
2+
3+**Verdict.** One line, one real bug, already on main in everything but that
4+line. `lane-whtshape` (`f541d062`, merged `afa13bcf`) gave `decode_intrabc_rect`
5+the lossless per-TX_4X4 chroma walk and its tail replay. The replay stepped the
6+mi origin by `4 >> ss_y(fctx)` — 4:2:0-only arithmetic — so on a 4:4:4 lossless
7+frame it stamped every replayed unit at **4x its own mi row/column**, writing
8+over cells that belong to other blocks. Corrected to `(4 << ss) / MI`, the form
9+the codebase's own reference construction already uses.
10+
11+**Tree.** `lane-av1lm444loss-corr` off current main `4532caa6`, worktree
12+`~/.cache/wt/av1lm444corr`. One commit, `c9b48f5d`. Not pushed (Main merges).
13+
14+## 0. What happened to the previous branch, stated plainly
15+
16+`lane-av1lm444loss`'s r2/r3 (`5519aaf8`, `6490933c`, `927dbf09`) is
17+**DO-NOT-MERGE**, and the review is right:
18+
19+* `decode_intrabc_rect` on main already carries the lossless arm from
20+ `lane-whtshape` — ss-aware geometry at `decode.rs:13343`/`:13352`, the
21+ `read_inter_chroma_lossless` walk with `hit!(INTRABC_RECT_LOSSLESS_CHROMA4_HITS)`
22+ at `:13687`, and the tail replay. My `5519aaf8` re-implemented all of that on
23+ a stale base (`a21f3680`), unaware of it.
24+* Resolved "theirs", it would have **deleted** main's
25+ `INTRABC_RECT_LOSSLESS_CHROMA4_HITS` and replaced main's
26+ `ll_chroma: Option<(Vec, Vec)>` tail with my `mu_chroma: bool` +
27+ `Grid::Own(mu_units(...))`.
28+* My headline — "two defects, both only at 4:4:4 lossless" — was ~80% already
29+ merged under another lane's name, and my report never mentioned `whtshape`.
30+
31+So: I worked blind to main. The old branch's own report also carried stale
32+provenance (it said "off `a21f3680` with one commit `7b9f46fa`" when by r3 it
33+was off `9249442f` with five) — a report that misstates its own base is a
34+defect in itself, and that is recorded here rather than patched there.
35+
36+What survives from the old branch and is carried here: the **fixture** and the
37+**finding** that the step is wrong. What is dropped: the re-implementation.
38+
39+This is a new report. The old one's history is left exactly as it was.
40+
41+## 1. The line
42+
43+`crates/ec-av1/src/decode.rs`, in `decode_intrabc_rect`'s tail replay, on main
44+at line 13895:
45+
46+```rust
47+// main (WRONG at ss (0,0)):
48+(mi_r + ur * (4 >> ss_y(fctx)), mi_c + uc * (4 >> ss_x(fctx))),
49+
50+// this branch:
51+(mi_r + ur * ((4 << ss_y(fctx)) / MI), mi_c + uc * ((4 << ss_x(fctx)) / MI)),
52+```
53+
54+## 2. Mechanism, and the libaom reference for the step
55+
56+The replay re-stamps each TX_4X4 chroma unit's own coefficient context, because
57+the block's whole-block `record_split_luma_rect_mi` / `record_rect_mi` above it
58+re-stamps the plane from ONE composed grid — level = the sum over units, dc =
59+the top-left unit's sign. libaom does not compose: `decode_token_recon_block`
60+(`av1/decoder/decodeframe.c:972`) walks 64x64 "mu" chunks and, inside each,
61+`for (plane..) for (blk_row..) for (blk_col..)` calls `decode_reconstruct_tx`
62+per unit, and `av1_set_entropy_context` stamps **that unit's** span. So the
63+replay's job is to place unit `(ur, uc)` at the mi cell that unit really
64+occupies.
65+
66+A TX_4X4 chroma unit covers `4 << ss` **luma** pixels. The chroma entropy bands
67+are luma-mi indexed (`Neighbours::record_mi_chroma`'s convention), so the origin
68+advances by that footprint expressed in mi:
69+
70+```
71+step = (4 << ss_y) / MI MI = 4
72+ss (1,1) 4:2:0: (4 << 1) / 4 = 8/4 = 2 mi
73+ss (0,0) 4:4:4: (4 << 0) / 4 = 4/4 = 1 mi
74+```
75+
76+which is exactly what `decode_inter_block`'s reference `mu_chroma_units`
77+construction writes at `decode.rs:43688`:
78+
79+```rust
80+let cu_mi = (
81+ at.0 + cr * ((cu << ss_y(fctx)) / MI),
82+ at.1 + cc * ((cu << ss_x(fctx)) / MI),
83+);
84+```
85+
86+with `cu = 4` on a lossless frame (the same function's `let cu = if lossless(fctx)
87+{ 4usize } else { 32usize };`). Its own comment states the rule: "a TX_4X4
88+chroma unit covers `4 << ss` LUMA pixels ... each unit's own origin sits
89+`(cu << ss) / MI` mi cells out". The intrabc-rect replay was the outlier that
90+had `4 >> ss` instead.
91+
92+The SPAN argument on the same call, `4 << ss_x(fctx)`, was already the
93+ss-aware form on main. Only the STEP was not — which is why the two sit
94+adjacently and disagree, and why the bug is invisible at 4:2:0.
95+
96+## 3. Why 4:2:0 is unchanged — by construction, then measured
97+
98+At ss (1,1) the old expression is `4 >> 1` = **2** and the new one is
99+`(4 << 1) / 4` = **2**. The same integer. So the corrected line cannot alter a
100+4:2:0 decode at all; this is arithmetic, not an empirical hope, and the 4:2:0
101+battery below is confirmation rather than the argument.
102+
103+At ss (0,0) the old is `4 >> 0` = **4 mi** = 16 luma px per 4x4 chroma unit,
104+where the unit covers 4 luma px = 1 mi — a 4x overshoot on both axes. The
105+replayed states land four mi rows and four mi columns beyond where they belong,
106+which is sixteen luma pixels out, over cells that belong to other blocks (or to
107+nothing, past the block's own span).
108+
109+4:2:2 is refused upstream by name, so there is no third case to reason about.
110+
111+## 4. Reachability and measurement
112+
113+Fixture `crates/ec-av1/fixtures/ll444_intrabc_rect_l2.obu` — 121844 bytes,
114+sha256 `f0de080edce35d34cdd628b71f63dc452f946e8328352b69d3c1da090a54ec67`,
115+recipe `testsrc2 512x128 yuv444p`, aomenc `--lossless=1 --cpu-used=2
116+--lag-in-frames=0 --kf-max-dist=100 --limit=6`, 6 frames.
117+
118+**The fixture does reach the corrected step** — no unit-level stand-in needed.
119+Measured on main's own build, decode order against the oracle aomdec:
120+
121+| frame | wrong samples (main) | wrong samples (corrected) | first byte (main) |
122+|---|---|---|---|
123+| 0 (key) | **10604** | **0** | **33216** = Y(64,448) |
124+| 1 | 123987 | 0 | 0 |
125+| 2 | 171773 | 0 | 0 |
126+| 3 | 171988 | 0 | 0 |
127+| 4 | 171783 | 0 | 0 |
128+| 5 | 151736 | 0 | 0 |
129+
130+and the entropy ladder goes from forked to **540833 reads on both sides, zero
131+fork** (ours 540833 / oracle 540833, every read paired on
132+`(value, range, symbol, post_rng)`).
133+
134+Note the first divergence is **luma**, on a chroma-context defect. That is the
135+signature of this bug and worth reading as such: the wrongly-placed chroma
136+stamps corrupt the `txb_skip_ctx` the NEXT unit reads, the tile desyncs, and
137+the pixels that move first are whichever block comes next in luma. Anyone
138+chasing a "luma divergence on a chroma fix" should check the step before
139+suspecting the reconstruction.
140+
141+## 5. Gate
142+
143+`stream::tests::a_lossless_444_intrabc_rect_replay_steps_by_the_units_own_mi_footprint`
144+
145+| # | assertion | what it rules out |
146+|---|---|---|
147+| 1 | `(subsampling_x, subsampling_y, bit_depth) == (0, 0, 8)` from the **parsed sequence header** | at (1,1) the two steps are the same integer, so a 4:2:0 stream cannot fail this gate and every other row would pass vacuously |
148+| 2 | lane-whtshape's own `intrabc_rect_lossless_chroma4_hits()` is nonzero | the walk really ran, so the corrected expression was evaluated — a gate that never reached its own subject |
149+| 3 | U and V plane extents are luma-sized | the grid the replay steps mi cells through |
150+| 4 | `decode_all_frames_vs_oracle`: decode-order frame-COUNT parity, then byte-exactness on every frame | and it covers hidden alt-refs |
151+| 5 | control: the 128x96 4:4:4 lossless pin must read that counter **0** | whole square blocks have no multi-unit chroma plane block, so the step is not exercised there at all |
152+
153+The gate uses **main's** counters (`INTRABC_RECT_LOSSLESS_CHROMA4_HITS` and its
154+`reset_…` helper). Nothing of whtshape's was renamed, removed, or shadowed.
155+
156+### Mutation proof (run)
157+
158+Reverting only the step expression, counters and gate untouched:
159+
160+```
161+=== MUT corr ===
162+panicked at crates/ec-av1/src/stream.rs:9396:
163+ decode-order frame 0 of 6 (6 shown, 0 hidden) differs from the oracle at
164+ byte 33216 (ours 101 vs 100), 10604 bytes differ
165+test result: FAILED. 0 passed; 1 failed
166+MUT EXIT: 101
167+
168+=== LIVE ===
169+test ... a_lossless_444_intrabc_rect_replay_steps_by_the_units_own_mi_footprint ... ok
170+LIVE EXIT: 0
171+```
172+
173+File restored from a saved copy with `cp`, verified with `diff -q`, `grep -c "MUT
174+corr"` = 0.
175+
176+## 6. Invariants
177+
178+| group | result |
179+|---|---|
180+| new gate | 1 passed (mutation red, §5) |
181+| `cargo test -- lossless 444` | **47 passed / 0 failed** |
182+| `cargo test -- intrabc` | **22 passed / 0 failed / 1 ignored** |
183+| `cargo test -- <17 scoped 4:2:0 lossless + frame-edge>` | **17 passed / 0 failed** |
184+| `cargo check -p ec-av1` | 0 warnings, 0 errors |
185+| source-scan guards | untouched — no `include_str!` anchor edited |
186+| blast radius | one expression in `decode.rs`; the rest of the diff is the gate plus one test-only helper. `decode_intrabc_rect`'s chroma walk, its `ll_chroma` tail and whtshape's counter are **byte-identical to main** |
187+
188+## 7. For the reviewer
189+
190+- **Provenance.** This branch is off main `4532caa6` and contains exactly one
191+ commit. The old `lane-av1lm444loss` branch is not to be merged; this one
192+ supersedes it and duplicates none of it.
193+- **4:2:0.** Stated as arithmetic first (`4 >> 1` == `(4 << 1)/4` == 2) and then
194+ measured (§6). The gate deliberately does **not** claim a 4:2:0 arm: a 4:2:0
195+ stream cannot fail it, and a floor-on-wrong-output assertion there would be
196+ theatre.
197+- **Not speculative.** The step is reachable and was measured wrong on main
198+ before the edit (§4): 10604 samples in the key frame, 123987..171988 in the
199+ inter frames.
200+- **Citation.** The step rule is taken from this codebase's own reference
201+ construction (`decode.rs:43688`) rather than re-derived only from libaom, so
202+ the change matches the shape every other replay in the tree already uses.
203+
204+## 8. Handover of the 256x256 cell, and a retraction
205+
206+The 4:4:4 lossless 256x256 cell is a **second defect**, untouched by this
207+branch and by the superseded `lane-av1lm444loss` branch (identical wrong-sample
208+count, first sample and magnitude set on both). Handed to **`Agent02-2`**, who is
209+already working that cell and whose pinned tripwire `(1, 201, 200, 160, 159)` is
210+the same first sample this lane measured. Sent 2026-09-29, in the message
211+thread on `agent://Agent02-2`.
212+
213+Fixture for reproduction: `testsrc2 256x256 rate=25 yuv444p` (rate matters — my
214+rate=1 encodes of the same geometry were byte-exact **at base**), aomenc
215+`--lossless=1 --sb-size=128 --passes=1 --threads=1 --row-mt=0
216+--enable-palette=0 --lag-in-frames=0 --kf-max-dist=100 --limit=6`, 109909 bytes.
217+Signature: key frame only, chroma only, 49 samples (Y=0, U=21, V=28), first
218+U(200,201) ours 160 vs ref 159.
219+
220+### 8.1 Retraction: "the mi labels are transposed" was wrong
221+
222+This lane's earlier report flagged the ladder's first fork at read 125511 with
223+a caveat that the differing `mi` labels looked like a coordinate-grid artefact
224+rather than a decode divergence. **That caveat is withdrawn.** Three
225+measurements, taken before the handover:
226+
227+1. **Both traces print mi in the same field order.** The oracle prints
228+ `ec_symr_mi_row, ec_symr_mi_col` (`aom_dsp/bitreader.h:265-266`); this
229+ decoder prints `SYMR_MI.get().0, .1` (`msac.rs:476-478`). There is no
230+ field-order swap to explain anything.
231+2. **It is not a transposition of the same position either.** Ours reads
232+ `mi=(32,0)`, the oracle `mi=(0,48)`; swapping ours gives `(0,32)`.
233+3. **The label tracks the walk closely**, so its first disagreement is signal.
234+ The two labels agree on **90112 of the first 125511 reads (71.8%)**.
235+
236+At the fork both sides are at `ph=inter`, where both publish **block-level** mi
237+(ours from `decode_inter_block`'s `at`, `decode.rs:38706`; the oracle from the
238+mode-info reader's entry, `decodemv.c:941`) — the same granularity — and they
239+still disagree, off an identical pre-state `(24645, 40117)` with different
240+post-ranges (39316 vs 39862).
241+
242+**SUPERSEDED IN PART BY §10.3.** The measurement above stands — the labels are
243+not transposed, not a field-order artefact, and not noise. What does NOT stand
244+is the conclusion this section drew from it, that read 125511 is "a genuine
245+block-level walk divergence": the frame boundary had not been measured, and
246+§10.1 puts the fork in `decode_idx=1` while the key frame's 49 samples sit in
247+`decode_idx=0`. Retracting a caveat is not the same as getting the rest right;
248+here both halves were wrong in sequence — first the label story, then the
249+fork's home. Both are recorded rather than tidied away, because a reader who
250+arrives at §8.1 first must be stopped there.
251+
252+The generalisable lesson is the mirror of the one in
253+`skill://ec-av1-divergence-debug`: a "the tag disagrees, so it is a labelling
254+artefact" reading is a hypothesis to be TESTED, not a conclusion to be
255+forwarded. This lane forwarded one. Testing it cost three cheap measurements
256+and reversed the conclusion.
257+
258+### 8.2 One more cross-side trap found in the same ladder
259+
260+The **phase vocabulary differs between the two decoders**. This decoder emits
261+`ph=inter8` for the sub-8x8 leaf arm (`decode.rs:47162`) — 13894 reads on this
262+stream — and the oracle has **no `inter8` phase at all**: its `ec_symr_phase`
263+is set at the mode-info reader's entry and lumps those reads under the block's
264+own phase. So `ph` is not a pairable field across the two sides either; only
265+`ph=inter` against `ph=inter` compares.
266+
267+## 9. Two findings recorded for the batch's shared lore
268+
269+**9.1 A luma first-fork is the signature of a chroma arithmetic error.** The
270+bug this branch fixes is a purely CHROMA error — an mi step on the chroma
271+context replay — yet the first wrong sample on the witness stream is **luma**,
272+`Y(64,448)`, in the key frame. Mechanism: the wrongly-placed chroma stamps
273+corrupt the `txb_skip_ctx` the NEXT unit reads, the tile desyncs from there, and
274+whichever block comes next in luma is what moves first. This is the shape that
275+makes a correctly-applied fix look ineffective: the gate goes green and the
276+diff you were watching was never where the bug was. Whenever a chroma-side
277+arithmetic fix appears not to have moved a LUMA first-fork, check the chroma
278+step before suspecting the reconstruction or the filter chain.
279+
280+**9.2 The non-vacuity discipline this gate uses, restated.** Two rows do the
281+real work and both are about *reaching* the corrected expression, not about
282+its value:
283+
284+* the **parsed-header** assert pins `(0,0,8)` from the stream's own sequence
285+ header precisely *because* at `(1,1)` the old and new steps are the same
286+ integer — a 4:2:0 stream cannot fail this gate at all, so without the header
287+ row every other row would be asserting nothing;
288+* the **control pin** reads the counter 0 on a stream of whole square blocks,
289+ because those have no multi-unit chroma plane block to step — which is what
290+ makes "the counter fired" mean "a multi-unit step was actually taken".
291+
292+Together those two mean the gate fails if the step is wrong AND fails if the
293+step is never reached. Neither alone would.
294+
295+## 10. The 256x256 key frame is RECONSTRUCTION-ONLY (measured, after handover)
296+
297+`Agent02-2` asked the decisive question of this cell and it is answerable, so it
298+was answered rather than left open. **My handoff was incomplete in a way that
299+mattered, and the correction is recorded here.**
300+
301+### 10.1 Per-frame read counts, and where the fork actually is
302+
303+On this lane's 109909 B stream (`testsrc2 256x256 rate=25`, `--sb-size=128
304+--passes=1 --threads=1 --row-mt=0 --enable-palette=0 --lag-in-frames=0
305+--kf-max-dist=100 --limit=6`, intrabc ENABLED — `Agent02-2`'s 109215 B stream has
306+`--enable-intrabc=0` and default sb-size, so the two really are different
307+streams, as they noted):
308+
309+| decode_idx | EC_SYMR reads | cumulative |
310+|---|---|---|
311+| 0 (**key**) | **82697** | 82697 |
312+| 1 | 50717 | 133414 |
313+| 2 | 120835 | 254249 |
314+| 3 | 62579 | 316828 |
315+| 4 | 102367 | 419195 |
316+| 5 | 121957 | 541152 |
317+
318+**First fork: read 125511 — inside `decode_idx=1` (82698..133414), not the key
319+frame. First fork within the key frame's 82697 reads: NONE.**
320+
321+### 10.2 What that settles
322+
323+The key frame's 49 chroma samples (first `U(200,201)` ours 160 vs ref 159) are
324+**reconstruction-only**. That frame's entropy is bit-identical end to end, so
325+nothing on the entropy side can be their cause — not the mu-chunk walk, not the
326+plane threading, not the coefficient sets, not the transform-size derivation.
327+`Agent02-2`'s r1 walk fix and r6 plane threading are therefore not the cause of
328+the 49, and their NOT-SETTLED "per-unit coefficient SETS agree or not" question
329+— which is an entropy question — cannot answer it either.
330+
331+Two independent encodes (109909 B and 109215 B, different `--sb-size` and
332+intrabc settings) both show a bit-locked key frame and a ~49-sample
333+chroma-only key-frame divergence. That is one confirmed defect, and it is on
334+the **reconstruction** side: after `decode_token_recon_block`, so at 4:4:4
335+lossless the WHT path (`dequant_and_inverse_wht4x4` / `TxParams::run`), the
336+prediction fetch, or the post-recon filter chain.
337+
338+### 10.3 The correction to my own handoff
339+
340+I told `Agent02-2` that read 125511 was "a genuine block-level walk divergence".
341+The mi-label retraction (§8.1) stands, but that framing was still wrong in
342+substance, because I had not measured the frame boundary when I sent it. The
343+cell has **two symptoms, not one**:
344+
345+* **(a)** key frame, reconstruction-only, 49 chroma samples;
346+* **(b)** frame 1+, an entropy fork at read 125511.
347+
348+They are not linked by reconstruction: frame 1's entropy does not depend on
349+frame 0's pixels, and the CDF state carries across frames untouched by them.
350+So **(b) is its own entropy defect** — `Agent02-2`'s r1 walk fix closed their (b)
351+at read 123121 without closing (a). `Agent02-2`'s ordered-(plane, position,
352+nz-count) sequence diff remains the right decisive test for (b); for (a) the
353+search space is now confined to the reconstruction stage.
354+
355+### 10.4 A pairing-script bug worth recording
356+
357+My first ladder script compared the `cdf0` field directly across the two sides.
358+That is the one field whose convention differs — ours is PRE-adapt, the
359+oracle's is POST-adapt, and the reconciliation is `32768 - ours_cdf0 ==
360+theirs` (`msac.rs`'s own `EC_SYMR` doc). The corrected predicate is
361+`(value, range, n, symbol, post_rng)`, with the `bit` field carrying a constant
362+-15 offset on this stream. Re-running with the right field set **confirmed
363+125511** — so the number I reported stands, but it survived a script that could
364+not have been trusted to find it. A fork index from a script with a known-bad
365+comparison field is a coincidence until re-derived.
366+
367+## 11. Closure of the handover
368+
369+`Agent02-2` (`lane-av1loss444mm`, worktree `~/.cache/wt/av1loss444mm`) reported
370+FINAL after this lane's measurement landed. The split was adopted and
371+independently confirmed on their own encode, and the cell is now owned:
372+
373+* **(b), the frame-1 entropy fork — FIXED and GATED by them.** Their defect was
374+ `decode_inter_block`'s INTRA tail passing the per-mu-chunk lossless chroma
375+ region as `(cu_tx, cu_tx)` with `cu_tx = 32` (the TX_32X32 UNIT size) where
376+ `decode_token_recon_block` walks the chunk's chroma SPAN of `64 >> ss` —
377+ 32x32 at 4:2:0, where 32 was accidentally right, and 64x64 at 4:4:4, i.e.
378+ 16x16 TX_4X4 units per plane. The inter half of the same function already had
379+ `chunk_chroma_w/h`; the intra tail was the stale copy. Frame 1 went 8652 ->
380+ 10368 transform units, exactly the oracle's, and its damage 70151 -> 49.
381+ Their r1 walk fix closed the fork at read 123121 on their stream **without
382+ touching the key frame's 49**.
383+* **(a), the key-frame 49 — RECONSTRUCTION-ONLY, handed over, no fix claimed.**
384+ Confirmed on two independent encodes. Localised to three adjacent 4x8
385+ rectangular 4:4:4 blocks (`#734` px=(196,200) uv_mode 7 D203, `#735`
386+ px=(200,200) uv_mode 7, `#736` px=(204,200) uv_mode 11 CFL) whose neighbours
387+ are exact, with damage on the first of their two stacked TX_4x4 chroma units
388+ and PARTIAL per cell (U 6/16, 9/16, 6/16 — which is why it is not a rounding
389+ constant). Search space in their priority order: (1) the chroma prediction
390+ fetch in `av1/common/reconintra.c` — the angular D203 and CFL source fetch for
391+ a 4-WIDE chroma unit, the only one of the three that explains two different
392+ predictors failing identically in the same place; (2) the WHT/placement in
393+ `dequant_and_inverse_wht4x4` / `TxParams::run`, specifically how a 4x4 unit
394+ is placed inside a 4x8 chroma plane block; (3) the post-recon filter chain,
395+ cheaply, with the oracle's `EC_AV1_POSTDEBLOCK_DUMP` and
396+ `EC_AV1_POSTCDEF_DUMP`.
397+
398+They also reproduced this lane's 109909 B fixture byte-for-byte, so the two
399+encodes are confirmed as independent rather than merely believed to be. They
400+exonerated the dequant scale (0 of 2053 units have non-zero levels with an
401+empty `dq`; all 2053 have both) and corrected two of their own numbers — an
402+r6 "1650 of 1663 chroma grids empty" figure that was an artefact of their own
403+comparison script, and a still-unpaired r9 ladder sequence diff.
404+
405+**This lane claims no part of that cell.** Nothing on
406+`lane-av1lm444loss-corr` asserts on the 256x256 stream, no fixture for it is
407+pinned here, and the only thing this branch contributes to it is the
408+measurement in §10.1 that closed its (a)/(b) question.