forge
Explore
Log in

Don't you dare go Hollow

Merge lane/av1422ibctxsel: 4:2:2 intraBC non-split chroma gather uses the pair rule

Browse files at this commit

dfdddd5d901ccf4c7ab93b9ce24c69391d846b01Ahmet Kaan GümüşParent: 717112f6550585
decode_intrabc_owned_rect gathered chroma context over the luma span. At
ss (1,0) that doubles the above vote. A pinned 4:2:2 strip enters the arm
24 times; 5 of those entries differ (2A+L=-8 vs A+L=0) and the pre-fix
tree refuses the stream mid-frame while ffmpeg and aomdec decode it.
Routed through around_mi_422_chroma under ss (1,0) only. Reviewer PASS:
the other subsamplings keep the old gather, no other function changed,
fixture sha256 4f82d5da8b4c3d6553953fc373001a1c7a729c9b189214b65503af1e04eb6b68.

The new pin has no fixture-library.tsv row. Regenerating the manifest on
a pristine tree already drifts 651 lines, so that row waits for a
canonical regen.
crates/ec-av1/fixtures/ibc422_nonsplit_ctx.obuadded+0 -0

Binary file changed

crates/ec-av1/src/decode.rsmodified+59 -18
@@ -5167,6 +5167,15 @@ thread_local! {
51675167 /// strip's chroma plane block.
51685168 static IBC_OWNED_RECT_CHROMA_FOOTPRINT_444_HITS: std::cell::Cell<usize> =
51695169 const { std::cell::Cell::new(0) };
5170+ /// lane-av1422ibctxsel: `decode_intrabc_owned_rect`'s NON-SPLIT chroma
5171+ /// gather taken through the 4:2:2 pair rule (`around_mi_422_chroma`)
5172+ /// under the ss (1, 0) guard -- both residual branches (the var-tx tree
5173+ /// and the no-leaves twin). `>= 1` can only come from a 4:2:2 stream
5174+ /// that reaches this function's non-split chroma arm; the 4:2:0/4:4:4
5175+ /// arms keep the plain `around_mi_rect` gather (`ss_y != 0` / `ss_x == 0`
5176+ /// take the else), so the counter stays 0 for them.
5177+ static IBC_OWNED_RECT_422_PAIR_HITS: std::cell::Cell<usize> =
5178+ const { std::cell::Cell::new(0) };
51705179 }
51715180
51725181 /// lane-av1-intrabc r4: coded (`skip == 0`) rect intrabc blocks reconstructed,
@@ -5222,6 +5231,18 @@ pub(crate) fn reset_ibc_owned_rect_chroma_footprint_444_hits() {
52225231 IBC_OWNED_RECT_CHROMA_FOOTPRINT_444_HITS.with(|c| c.set(0));
52235232 }
52245233
5234+/// lane-av1422ibctxsel: [`IBC_OWNED_RECT_422_PAIR_HITS`].
5235+#[allow(dead_code)] // read only from the `#[cfg(test)]` gates
5236+pub fn ibc_owned_rect_422_pair_hits() -> usize {
5237+ IBC_OWNED_RECT_422_PAIR_HITS.with(|c| c.get())
5238+}
5239+
5240+/// lane-av1422ibctxsel: zeroes [`IBC_OWNED_RECT_422_PAIR_HITS`].
5241+#[allow(dead_code)] // read only from the `#[cfg(test)]` gates
5242+pub(crate) fn reset_ibc_owned_rect_422_pair_hits() {
5243+ IBC_OWNED_RECT_422_PAIR_HITS.with(|c| c.set(0));
5244+}
5245+
52255246 /// lane-whtshape: [`INTRABC_RECT_LOSSLESS_CHROMA4_HITS`].
52265247 #[allow(dead_code)] // read only from the `#[cfg(test)]` gates
52275248 pub fn intrabc_rect_lossless_chroma4_hits() -> usize {
@@ -18019,22 +18040,29 @@ fn decode_intrabc_owned_rect(
1801918040 u_grid = ug;
1802018041 v_grid = vg;
1802118042 } else {
18022- // lane-av1422gathercensus: the only `around_mi_rect` in the file
18023- // that feeds a CHROMA coefficient context and can run at ss
18024- // (1, 0): its above extent is the whole block's LUMA width, and
18025- // libaom's `get_txb_ctx_general` reads one vote per CHROMA 4-px
18026- // cell, so at ss (1, 0) the per-mi sum counts each chroma column
18027- // twice (the class `around_mi_422_chroma` fixes).
18028- // Kept verbatim because it is UNWITNESSED, not because it is
18029- // unreachable: it runs only for a NON-skipped, non-lossless
18030- // intrabc-owned 64x32/32x64 (or smaller) rect strip, and no
18031- // committed 4:2:2 fixture codes one -- an env-gated probe here
18032- // fired 0 times across the whole committed 4:2:2 corpus (24 gate
18033- // tests, 21 decoding cells; see
18034- // `lanes/av1422gathercensus.report.md`). A future fixture that
18035- // enters it must route through `around_mi_422_chroma` under the
18036- // ss (1, 0) guard.
18037- let around = neighbours.around_mi_rect((mi_r, mi_c), bw, bh);
18043+ // lane-av1422ibctxsel: at ss (1, 0) a chroma 4-px cell spans TWO
18044+ // luma mi columns, so a luma-span gather counts each chroma
18045+ // column twice; libaom's `get_txb_ctx_general` reads one vote per
18046+ // CHROMA cell, which is what `around_mi_422_chroma`'s
18047+ // every-second sampling produces. Both non-split chroma arms of
18048+ // this function route through it under the ss (1, 0) guard; every
18049+ // other subsampling keeps the plain gather verbatim. WITNESS: the
18050+ // no-leaves twin below (24 entries on
18051+ // `fixtures/ibc422_nonsplit_ctx.obu`, five of them V-plane reads
18052+ // whose two gathers disagree -- `dc_sign_ctx` 1 vs 0; gate
18053+ // `a_422_intrabc_owned_rect_nonsplit_chroma_context_uses_the_pair_rule`).
18054+ // THIS branch has no stream that splits a transform on the strip:
18055+ // it needs `TX_MODE_SELECT` plus a `txfm_partition` split of the
18056+ // 64x32 strip, a conjunction no measured stream has produced
18057+ // (`lane-av1422ibcrect` measured 0 entries under
18058+ // `TX_MODE_LARGEST`); the routing here is identical, so a future
18059+ // witness takes the same code.
18060+ let around = if ss_x(fctx) == 1 && ss_y(fctx) == 0 {
18061+ hit!(IBC_OWNED_RECT_422_PAIR_HITS);
18062+ neighbours.around_mi_422_chroma((mi_r, mi_c), bw, bh)
18063+ } else {
18064+ neighbours.around_mi_rect((mi_r, mi_c), bw, bh)
18065+ };
1803818066 let (ug, _) = read_inter_plane_rect(
1803918067 dec,
1804018068 cdfs,
@@ -18115,6 +18143,19 @@ fn decode_intrabc_owned_rect(
1811518143 u_grid = ug;
1811618144 v_grid = vg;
1811718145 } else {
18146+ // lane-av1422ibctxsel: the twin of the tree branch above -- the
18147+ // CHROMA context at ss (1, 0) is the pair rule (one vote per
18148+ // chroma 4-px cell); `around` stays the plain luma-span gather
18149+ // for plane 0 (lane-av1422ibcrect measured this arm entered 24
18150+ // times by a 4:2:2 64x32 strip whose two gathers happened to
18151+ // agree -- `fixtures/ibc422_nonsplit_ctx.obu` is the stream where
18152+ // they do not).
18153+ let around_chroma = if ss_x(fctx) == 1 && ss_y(fctx) == 0 {
18154+ hit!(IBC_OWNED_RECT_422_PAIR_HITS);
18155+ neighbours.around_mi_422_chroma((mi_r, mi_c), bw, bh)
18156+ } else {
18157+ around
18158+ };
1811818159 let (ug, _) = read_inter_plane_rect(
1811918160 dec,
1812018161 cdfs,
@@ -18122,7 +18163,7 @@ fn decode_intrabc_owned_rect(
1812218163 (cw, ch),
1812318164 cside,
1812418165 1,
18125- around[1],
18166+ around_chroma[1],
1812618167 0,
1812718168 u,
1812818169 cpx,
@@ -18139,7 +18180,7 @@ fn decode_intrabc_owned_rect(
1813918180 (cw, ch),
1814018181 cside,
1814118182 2,
18142- around[2],
18183+ around_chroma[2],
1814318184 0,
1814418185 v,
1814518186 cpx,
crates/ec-av1/src/stream.rsmodified+94 -0
@@ -3533,6 +3533,100 @@ pub(crate) mod tests {
35333533 }
35343534 }
35353535
3536+ /// lane-av1422ibctxsel: the firing gate for `decode_intrabc_owned_rect`'s
3537+ /// NON-SPLIT chroma coefficient context at 4:2:2.
3538+ ///
3539+ /// `lanes/av1422gathercensus.report.md` closed its ss (1, 0) class sweep
3540+ /// with this one gather at STOP -- unwitnessed: `around_mi_rect` over the
3541+ /// block's LUMA span feeds the CHROMA `dc_sign_ctx`, and at ss (1, 0) a
3542+ /// chroma 4-px cell spans TWO luma mi columns, so the per-mi sum counts
3543+ /// every chroma column twice (`around_mi_422_chroma`'s every-second
3544+ /// sampling is libaom's one-vote-per-cell sum). `lane-av1422ibcrect`
3545+ /// found a stream that ENTERS the gather (24 entries) but whose two
3546+ /// gathers agree on every entry, so the class stayed harmless-ON-THAT-
3547+ /// STREAM, not proven.
3548+ ///
3549+ /// This fixture is the discriminating witness: aomenc profile 2, 384x288
3550+ /// 4:2:2, 4 key frames, `--sb-size=64` with the last superblock row half
3551+ /// outside the frame (so the 64-root partition is a single gathered bit
3552+ /// and the strips are 64x32 HORZ intra-BC strips), `--enable-tx-size-
3553+ /// search=1` plus a high-frequency patch that keeps the frame's `tx_mode`
3554+ /// at `TX_MODE_SELECT` (`txb_split_count > 0`; without it encodeframe.c
3555+ /// :2690 downgrades every frame to `TX_MODE_LARGEST`), and a chroma band
3556+ /// above the strips so a full-weight above context meets a full-weight
3557+ /// left one of the opposite sign.
3558+ ///
3559+ /// Measured on the pinned bytes: 24 non-split chroma gathers entered (6
3560+ /// strips x 4 frames; 48 plane reads), and FIVE of them -- plane 2, strips
3561+ /// mi (64,16)..(64,80) of frame 0 -- read `dc_sign_ctx` 1 through the
3562+ /// luma-span gather against libaom's 0 through the pair rule (`full = 2A +
3563+ /// L = -8`, `pair = A + L = 0`: the double-counted above vote crosses
3564+ /// zero, and the context is a sign).
3565+ ///
3566+ /// Red-before (the route reverted, same fixture bytes): the wrong sign
3567+ /// context changes the decoded dc-sign CDF and desyncs the tile -- the
3568+ /// decoder refuses the stream mid-frame with "a block size 4x8, 8x16 or
3569+ /// 16x4 ... has no chroma plane block at this frame's subsampling mode",
3570+ /// so NO frame decodes at all. That refusal is also the proof it is a
3571+ /// desync symptom and not a real sub-8x8 shape: both oracles decode the
3572+ /// pinned bytes fully. Green-after: 4/4 frames byte-exact against
3573+ /// ffmpeg's `yuv422p` rawvideo, with the per-plane coefficient-unit
3574+ /// census (the helper's) and the pair-rule route counter as the
3575+ /// non-vacuity arms. The 4:4:4 arm below pins the guard's other side:
3576+ /// the same function at ss (0, 0) keeps the verbatim luma-span gather and
3577+ /// must NOT fire the route.
3578+ #[test]
3579+ fn a_422_intrabc_owned_rect_nonsplit_chroma_context_uses_the_pair_rule() {
3580+ const NAME: &str = "a_422_intrabc_owned_rect_nonsplit_chroma_context_uses_the_pair_rule";
3581+ const FILE: &str = "ibc422_nonsplit_ctx.obu";
3582+ const LEN: usize = 2170;
3583+ /// sha256 `4f82d5da8b4c3d6553953fc373001a1c7a729c9b189214b65503af1e04eb6b68`,
3584+ /// fnv1a64 `0x92e2c4e45ca27e34`.
3585+ const FNV: u64 = 0x92e2c4e45ca27e34;
3586+ if !have_ffmpeg() {
3587+ eprintln!("SKIP {NAME}: no ffmpeg");
3588+ return;
3589+ }
3590+ let path = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))
3591+ .join("fixtures")
3592+ .join(FILE);
3593+ let data = std::fs::read(&path).unwrap_or_else(|e| {
3594+ panic!(
3595+ "{NAME}: pinned witness {} is missing ({e}) -- the gate cannot run",
3596+ path.display()
3597+ )
3598+ });
3599+ assert_eq!(data.len(), LEN, "{NAME}: {FILE} size drifted");
3600+ assert_eq!(fnv1a64(&data), FNV, "{NAME}: {FILE} bytes drifted");
3601+ // No `lock_gate_counters()` here: the bumps are thread-local, and
3602+ // `assert_422_stream_pixel_exact` takes that same (non-reentrant)
3603+ // mutex itself -- holding it across this call self-deadlocks.
3604+ crate::decode::reset_ibc_owned_rect_422_pair_hits();
3605+ assert_422_stream_pixel_exact(NAME, &data, 384, 288, 4, 8, true);
3606+ let hits = crate::decode::ibc_owned_rect_422_pair_hits();
3607+ assert_eq!(
3608+ hits, 24,
3609+ "{NAME}: the pair-rule route fired {hits} times, not 24 (6 non-split chroma gathers \
3610+ x 4 frames) -- the witness stopped exercising the arm, or the guard's extent moved"
3611+ );
3612+ // The guard's other arm: the 4:4:4 owner-rect stream (`r512.obu`,
3613+ // pinned by the gate below) reaches this same function at ss (0, 0),
3614+ // where the verbatim luma-span gather is correct -- the route counter
3615+ // must stay put.
3616+ let r512 = std::fs::read(
3617+ std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("fixtures/r512.obu"),
3618+ )
3619+ .expect("r512.obu must exist");
3620+ crate::decode::reset_ibc_owned_rect_422_pair_hits();
3621+ let _ = decode_stream(&r512).expect("the 4:4:4 owner-rect witness decodes");
3622+ assert_eq!(
3623+ crate::decode::ibc_owned_rect_422_pair_hits(),
3624+ 0,
3625+ "{NAME}: the 4:2:2 pair-rule route fired on a 4:4:4 stream -- the ss (1, 0) guard \
3626+ leaks (class gate-blind-to-feature)"
3627+ );
3628+ }
3629+
35363630 /// lane-av1-ibc128chunk: the SOURCE-SCAN arm of the witness gate above.
35373631 ///
35383632 /// The decode-level half of the red/green evidence now runs in committed
lanes/av1422ibctxsel.report.mdadded+218 -0
@@ -0,0 +1,218 @@
1+# lane-av1422ibctxsel — the ss (1, 0) non-split chroma gather of
2+# `decode_intrabc_owned_rect` is DISCRIMINATED by a pinned witness, routed
3+# through the pair rule, and gated red-before/green-after
4+
5+Base `main` = `6d646f65` (branch `lane/av1422ibctxsel`, worktree
6+`~/.cache/wt/av1422ibctxsel`). Local only: no push, no merge. The fix commit
7+is `b5e034d4` (source + fixture + gate); this report is a second commit.
8+
9+## Verdict
10+
11+**Witnessed and fixed.** A real aomenc 4:2:2 stream enters the non-split
12+chroma gather of `decode_intrabc_owned_rect` **24 times** and, on **five** of
13+those entries (plane 2, strips mi (64,16)..(64,80) of frame 0), the two
14+gathers disagree: `dc_sign_ctx` **1** through the luma-span `around_mi_rect`
15+vs **0** through libaom's pair rule. Pre-fix that wrong context desyncs the
16+tile and **no frame decodes at all** (the decoder refuses mid-frame); post-fix
17+the pinned bytes are **byte-exact against ffmpeg on 4/4 frames**, with the
18+route counter reading 24. Both non-split chroma arms of the function are
19+routed under the `ss_x == 1 && ss_y == 0` guard; every other subsampling keeps
20+the plain gather verbatim. The witness is committed and pinned (size +
21+fnv1a64 + sha256) and the gate is mutation-proven (route reverted → red).
22+
23+## 1. The class, and the exact arithmetic a witness has to flip
24+
25+Both residual branches of `decode_intrabc_owned_rect` (`leaves.is_some()` —
26+the var-tx tree — and its `leaves == None` twin) read their **chroma**
27+coefficient context from `neighbours.around_mi_rect((mi_r, mi_c), bw, bh)` —
28+the block's **luma** span — and hand `around[1]`/`around[2]` to
29+`read_inter_plane_rect` planes 1 and 2 (`decode.rs:18037→18045/18062` in the
30+tree branch, `18076→18125/18142` in the twin, base line numbers). At ss
31+(1, 0) one chroma 4-px cell spans TWO luma mi columns, so the per-mi sum
32+counts each chroma column twice; libaom's `get_txb_ctx_general` reads one
33+vote per CHROMA cell, which is `around_mi_422_chroma`'s every-second
34+sampling (`decode.rs:10555`).
35+
36+`dc_sign_ctx(vote)` is `vote.signum()` → {0 zero, 1 negative, 2 positive}
37+(`decode.rs:8254`), so a witness needs the **sign** to differ:
38+
39+* full gather = `2A + L`; pair rule = `A + L`, where `A` = the pair-rule
40+ above sum and `L` = the left sum (identical in both).
41+* Chroma units at 4:2:2 are ≥2 luma mi wide and even-mi aligned, so the
42+ above part obeys **`full_above = 2 × pair_above` ALWAYS** — the above
43+ votes alone can never disagree in sign. The asymmetry lives in `L`: a flip
44+ needs `A` and `L` of **opposite sign with |L| ∈ [|A|, 2|A|)**.
45+* With one 32x32 chroma TU per strip (the non-split arm's unit), `L = 8 ×
46+ (previous strip's unit sign)` ∈ {+8, −8, 0} and `A = Σ (W_u/2) s_u` over
47+ the units covering the row above. The sharpest case is `A = ±8, L = ∓8`:
48+ `full = ±8` (a sign) vs `pair = 0` (ZERO) — a `dc_sign_ctx` 2-vs-0 or
49+ 1-vs-0 split.
50+
51+This is also why `lane-av1422ibcrect`'s A1 measured 0/24: on that stream all
52+above votes shared one sign (and `A = 0` for strips 1..5), so no arithmetic
53+could flip.
54+
55+## 2. Encoder facts the hunt established (libaom source in `~/.cache/aom-oracle/src`)
56+
57+* **`tx_mode` is downgraded to `TX_MODE_LARGEST` when the frame splits no
58+ transform**: `encodeframe.c:2690` — `if (features->tx_mode == TX_MODE_SELECT
59+ && cpi->td.mb.txfm_search_info.txb_split_count == 0) features->tx_mode =
60+ TX_MODE_LARGEST;`. A1's smooth sine content never splits → `txsel=false`
61+ (the ibcrect report's observation) even with `--enable-tx-size-search=1`.
62+ **A high-frequency patch makes `txb_split_count > 0` and the header bit
63+ stays SELECT** (E5+ below) — so the ticket's "vary tx-mode" lever is this.
64+* **The intraBC hash is LUMA-ONLY**: `hash_motion.c:398` `av1_get_block_hash_
65+ value(..., const uint8_t *y_src, ...)` hashes 2x2 Y sub-blocks of
66+ `cpi->source`; chroma is not in the key. Chroma offsets therefore cannot
67+ break a luma match — but they do enter the DV's RD cost (E4's −20 strip
68+ band made the encoder drop intraBC on 4 of 6 strips).
69+* **The geq source runs in the 4:2:0 domain** (`nullsrc … format=yuv420p`),
70+ so a band written in "luma rows" silently never fires for chroma: E2
71+ changed NOTHING (bit-identical output to A1, same sha256). The band must be
72+ expressed in 4:2:0 chroma rows (luma row `y` = chroma row `y/2`).
73+
74+## 3. The attempt table (8 aomenc encodes, all ≤180 s; budget was ≤12)
75+
76+Common flags (all rows): `--codec=av1 --i422 --profile=2 --passes=1
77+--end-usage=q --cpu-used=0 --threads=1 --row-mt=0 --lag-in-frames=0
78+--kf-max-dist=1 --tile-columns=0 --sb-size=64 --min-partition-size=32
79+--max-partition-size=64 --enable-rect-partitions=1 --enable-ab-partitions=1
80+--enable-1to4-partitions=0 --enable-palette=0 --tune-content=screen
81+--enable-intrabc=1 --deltaq-mode=0 --enable-tx-size-search=1 --obu`,
82+384x288, 4 frames, from a `geq` source; A1's base content is
83+`lum=128+90*sin((X+2N)/37)+30*sin(Y/29) cb=128+30*sin(X/23)
84+cr=128+30*sin((Y+N)/19)`.
85+
86+| id | delta over A1 | bytes | sha256 | arm | txsel | entries | ctx diffs |
87+|---|---|---|---|---|---|---|---|
88+| **A1** control | none (cq 32) | 1244 | `fd36bae4…b397db` | lar twin | false | 24 | **0** |
89+| E2 | `cr += 30*if(between(Y,192,255))` (luma rows — never fires) | 1244 | `fd36bae4…` (same) | lar | false | 24 | 0 |
90+| E2b | same band written in 4:2:0 chroma rows (96..127) | 1203 | `3bf9709a…3b1e54` | lar | false | 24 | 0 (above `A=+8`, strips `+8`) |
91+| E3 | band `−30` (chroma rows 96..127) | 1312 | `77d58313…077306` | lar | false | 11 | 0 (above mostly `None`) |
92+| E4 | E2b plus strip band `−20` (chroma rows 128..143) | 1339 | `fc68088a…8c3415b` | lar | false | 5 (intraBC survived on 2 of 6 strips) | 0 |
93+| E5 | luma `+40*sin(X*π/2)` patch, rows 0..31 x<64 | 2173 | `f4495f32…043c26f5e` | lar | **true** | 18 | 0 |
94+| E6 | E5 + `cr += 25*if(Y in 0..31) + 30*if(Y in 96..127)` + same luma patch inside strip 0's band | 3226 | `8d1bc1ec…e64459166` | lar | true | 17 | **4** (1 visible before the pre-fix refusal aborted the decode) |
95+| **E7** witness | E6 minus the strip luma patch | 2170 | `4f82d5da8b4c3d6553953fc373001a1c7a729c9b189214b65503af1e04eb6b68` | lar | true | 24 | **5** |
96+
97+E7's five discriminating entries (probe print, pre-fix):
98+
99+ EC_IBCNS422P lar mi=(64,16) … ss=(1,0) txsel=true plane=2 fv=-8 pv=0 fctx=1 pctx=0 diff=1
100+ EC_IBCNS422P lar mi=(64,32) … plane=2 fv=-8 pv=0 fctx=1 pctx=0 diff=1
101+ EC_IBCNS422P lar mi=(64,48) … plane=2 fv=-8 pv=0 fctx=1 pctx=0 diff=1
102+ EC_IBCNS422P lar mi=(64,64) … plane=2 fv=-8 pv=0 fctx=1 pctx=0 diff=1
103+ EC_IBCNS422P lar mi=(64,80) … plane=2 fv=-8 pv=0 fctx=1 pctx=0 diff=1
104+
105+i.e. `A = −8` (above uniform, the `+30` band) and `L = +8` (each strip's own
106+32x32 V unit is positive) → `full = 2A + L = −8` (negative, ctx 1) vs
107+`pair = A + L = 0` (zero, ctx 0). Five strips, frame 0 (frame 0 is the one
108+whose `cr` phase puts the strip residual positive).
109+
110+The entry/diff columns above were re-measured in one pass with the temporary
111+probe (the probe prints the raw gather vs the pair rule explicitly, so its
112+`diff` is independent of the route the decoder currently takes). E7's 24 is
113+corroborated by a second, committed instrument: the route counter
114+`IBC_OWNED_RECT_422_PAIR_HITS` reads exactly 24 in the gate.
115+
116+The probe (`EC_IBCNS422P`, env-gated, both arms, printing the luma-span
117+gather vs the pair rule) was **removed before the commit** — no probe and no
118+`EC_AV1_ALLOW_422_PROBE` remains in the tree.
119+
120+## 4. The fix
121+
122+`decode.rs`, `decode_intrabc_owned_rect` only:
123+
124+* tree branch: `let around = if ss_x(fctx) == 1 && ss_y(fctx) == 0 {
125+ hit!(IBC_OWNED_RECT_422_PAIR_HITS); neighbours.around_mi_422_chroma(…) }
126+ else { neighbours.around_mi_rect(…) };` (plane 0 unused in this branch);
127+* twin branch: the same gate on a NEW `around_chroma` used by planes 1/2;
128+ `around` stays the plain luma-span read that plane 0's own context uses
129+ (`ss_x == 0` / `ss_y != 0` keep it for chroma too, verbatim);
130+* new counter `IBC_OWNED_RECT_422_PAIR_HITS` + accessor/reset
131+ (`ibc_owned_rect_422_pair_hits`), in the crate's `hit!` pattern.
132+
133+The census's stale comment at the tree branch ("UNWITNESSED", "the only
134+`around_mi_rect` …") was replaced by the dated routing comment; it also
135+records the honest residue: the tree branch itself still has **no** stream
136+that splits a transform on the strip (`TX_MODE_SELECT` + `txfm_partition` on
137+the 64x32 strip) — the witness enters the twin, and both branches share the
138+same routed code.
139+
140+## 5. Evidence
141+
142+* **Gate**: `a_422_intrabc_owned_rect_nonsplit_chroma_context_uses_the_pair_rule`
143+ (`stream.rs`) — pins size 2170 + fnv1a64 `0x92e2c4e45ca27e34` + sha256,
144+ asserts `assert_422_stream_pixel_exact(…, 384, 288, 4, 8, true)` (ffmpeg
145+ `yuv422p`, per-plane coefficient-unit census deltas
146+ `units=[149, 219, 225] coded=[126, 27, 98]`, all non-zero), asserts the
147+ route fired exactly **24** times, and asserts the 4:4:4 `r512.obu` arm
148+ fires it **0** times (guard-does-not-leak arm).
149+* **Red-before (mutation proof)**: with both routed conditions forced
150+ `if false` (temporary, reverted), the gate FAILS on the same pinned bytes:
151+ `decode_stream refused a real 4:2:2 stream: … a block size 4x8, 8x16 or
152+ 16x4 … has no chroma plane block at this frame's subsampling mode`.
153+* **Green-after**: 4/4 frames byte-exact vs ffmpeg; counter 24; gate + the
154+ 422 `sb128_strip` gate + `a_16x4_intrabc_pair_strip_decodes_pixel_exact`
155+ (4:2:0) + `a_444_intrabc_owned_rect_strip_sizes_its_chroma_plane_block_and_decodes`
156+ (4:4:4) all pass in one scoped run (`4 passed; 846 filtered out`,
157+ 1.8 s). Scoped tests only; no full suite.
158+* `cargo check -p ec-av1` clean (the one pre-existing `pin_reporting`
159+ dead-code warning, unrelated).
160+
161+## 6. Findings for other lanes (measured here, not fixed here)
162+
163+1. **The pre-fix refusal on E6/E7 was a DESYNC SYMPTOM, not a real
164+ sub-8x8 shape.** Pre-fix, our decoder refuses those bytes mid-frame while
165+ **both oracles decode them fully** (`aomdec --rawvideo` → exit 0,
166+ 884736 B = 4×221184; ffmpeg → 884736 B). Post-fix (same bytes, route
167+ fixed) the refusal is gone and the decode is byte-exact. So the wrong
168+ `dc_sign_ctx` → wrong dc-sign symbol → desync → the subsize guard fires on
169+ garbage. The refusal string itself is libaom's
170+ `decodeframe.c:1456` rule, but its trigger here was ours. `lane-av1422ibcrect`'s
171+ A2/A4 refusals were NOT re-examined by this lane; their streams were not
172+ measured against aomdec here.
173+2. **`scripts/fixture-library.tsv` needs a canonical-environment
174+ regeneration** (deferred, unblock: run
175+ `scripts/gen-fixture-library.sh` where `$ROOT/fixtures` is the real
176+ library). Measured: regenerating on a **pristine `git archive` of
177+ `6d646f65` with no edits** already differs from the committed manifest by
178+ 651 diff lines here (e.g. "212" vs "48" unresolved media literals,
179+ double-slash `fixtures//…` rows), and even with
180+ `EC_FIXTURES=<primary>/fixtures` the output is not idempotent with HEAD's
181+ file (dropped `encode.rs` rows, unreferenced-pin count 4→6). So this lane
182+ does NOT commit manifest churn; the new fixture's row (measured:
183+ `crates/ec-av1/fixtures/ibc422_nonsplit_ctx.obu crates/ec-av1/src/stream.rs:3587 … 4f82d5da…`)
184+ and the stream.rs line shifts will land with that regeneration.
185+3. Process note (recorded for truthfulness): during the mutation proof a
186+ bulk in-place replace of the routed-condition line matched a THIRD,
187+ pre-existing site in another function (`around_mi_422_chroma(pair_mi, pw, ph)`
188+ at base `19863-19872`). It was restored exactly and verified: the final
189+ `git diff` hunks touch only statics/accessors and
190+ `decode_intrabc_owned_rect` in `decode.rs`, and that function's text is
191+ byte-identical to HEAD outside the intended hunks.
192+
193+## 7. Repro
194+
195+```text
196+git worktree add -b lane/av1422ibctxsel ~/.cache/wt/av1422ibctxsel 6d646f65
197+cd ~/.cache/wt/av1422ibctxsel
198+
199+# witness (E7): aomenc = ~/.cache/aom-oracle/build/aomenc
200+ffmpeg -v error -f lavfi -i "nullsrc=size=384x288:rate=25,format=yuv420p,\
201+ geq=lum='128+90*sin((X+2*N)/37)+30*sin(Y/29)+40*sin(X*1.5707963)*(lt(X,64)*lt(Y,32))':\
202+ cb='128+30*sin(X/23)':\
203+ cr='128+30*sin((Y+N)/19)+25*if(between(Y,0,31),1,0)+30*if(between(Y,96,127),1,0)'" \
204+ -frames:v 4 -pix_fmt yuv422p -strict -1 -f yuv4mpegpipe -y E7.y4m
205+aomenc --codec=av1 --i422 --profile=2 --passes=1 --end-usage=q --cpu-used=0 \
206+ --threads=1 --row-mt=0 --lag-in-frames=0 --kf-max-dist=1 --tile-columns=0 \
207+ --sb-size=64 --min-partition-size=32 --max-partition-size=64 \
208+ --enable-rect-partitions=1 --enable-ab-partitions=1 --enable-1to4-partitions=0 \
209+ --enable-palette=0 --tune-content=screen --enable-intrabc=1 --deltaq-mode=0 \
210+ --enable-tx-size-search=1 --obu --cq-level=32 --limit=4 -o E7.obu E7.y4m
211+sha256sum E7.obu # 4f82d5da8b4c3d6553953fc373001a1c7a729c9b189214b65503af1e04eb6b68
212+
213+# gate (green)
214+CARGO_TARGET_DIR=~/.cache/tgt-av1422ibctxsel \
215+ cargo test -p ec-av1 --lib a_422_intrabc_owned_rect_nonsplit_chroma_context_uses_the_pair_rule
216+```
217+
218+`E7` = `crates/ec-av1/fixtures/ibc422_nonsplit_ctx.obu` (byte-identical).