forge
Explore
Log in

Don't you dare go Hollow

Merge branch 'lane-ibc444c-r4'

Browse files at this commit

bda1f98537cd6c9e9aeecb7fc98b534f48d13503Ahmet Kaan GümüşParent: 0d91363e7a1a68
crates/ec-av1/src/decode.rsmodified+86 -20
@@ -4682,6 +4682,15 @@ thread_local! {
46824682 /// invisible to every gate because they only counted CODED strips.
46834683 static INTRABC_RECT_SKIPPED_HITS: std::cell::Cell<[usize; 2]> =
46844684 const { std::cell::Cell::new([0, 0]) };
4685+ /// lane-ibc444c: rect intra-BC blocks whose chroma plane block was sized
4686+ /// `bw >> ss_x` by `bh >> ss_y` -- the 4:4:4 and 4:4:0 cells, where
4687+ /// `av1_get_max_uv_txsize` (`ss_size_lookup[bsize]`, blockd.h) applies no
4688+ /// halving of its own. At 4:2:0 this is the same arithmetic as the halving,
4689+ /// so a `>= 1` witness can only come from a stream that is not 4:2:0.
4690+ /// EXCLUSIVE to this arm: no other caller sizes an intrabc rect block's
4691+ /// chroma plane block.
4692+ static IBC_RECT_CHROMA_FOOTPRINT_444_HITS: std::cell::Cell<usize> =
4693+ const { std::cell::Cell::new(0) };
46854694 /// lane-whtshape: LOSSLESS rect intrabc blocks whose chroma plane block
46864695 /// [`decode_intrabc_rect`] walked as a `(cw/4) * (ch/4)` PLANE-MAJOR
46874696 /// raster of TX_4X4 units -- the shape libaom's lossless geometry codes
@@ -4724,6 +4733,18 @@ pub(crate) fn reset_intrabc_rect_hits() {
47244733 INTRABC_RECT_SKIPPED_HITS.with(|c| c.set([0, 0]));
47254734 }
47264735
4736+/// lane-ibc444c: [`IBC_RECT_CHROMA_FOOTPRINT_444_HITS`].
4737+#[allow(dead_code)] // read only from the `#[cfg(test)]` gates
4738+pub fn ibc_rect_chroma_footprint_444_hits() -> usize {
4739+ IBC_RECT_CHROMA_FOOTPRINT_444_HITS.with(|c| c.get())
4740+}
4741+
4742+/// lane-ibc444c: zeroes [`IBC_RECT_CHROMA_FOOTPRINT_444_HITS`].
4743+#[allow(dead_code)] // read only from the `#[cfg(test)]` gates
4744+pub(crate) fn reset_ibc_rect_chroma_footprint_444_hits() {
4745+ IBC_RECT_CHROMA_FOOTPRINT_444_HITS.with(|c| c.set(0));
4746+}
4747+
47274748 /// lane-whtshape: [`INTRABC_RECT_LOSSLESS_CHROMA4_HITS`].
47284749 #[allow(dead_code)] // read only from the `#[cfg(test)]` gates
47294750 pub fn intrabc_rect_lossless_chroma4_hits() -> usize {
@@ -7791,6 +7812,8 @@ fn coeff_step_base_eob_level(dec: &SymbolDecoder, level: i32) {
77917812 eprintln!("EC_COEFF_STEP tag=base_eob level={level} rng={rng}");
77927813 }
77937814
7815+// lane-ibc444c: see `read_coeffs_rect`'s `#[track_caller]`.
7816+#[track_caller]
77947817 fn read_coeffs(
77957818 dec: &mut SymbolDecoder,
77967819 coding: &mut TxbTables,
@@ -7834,12 +7857,29 @@ fn read_coeffs(
78347857 } else {
78357858 [0; 3]
78367859 };
7860+ let sq_bit = if coeff_trace_on() {
7861+ dec.debug_bitpos()
7862+ } else {
7863+ 0
7864+ };
78377865 let all_zero = dec.symbol(&mut coding.txb_skip[skip_ctx]) == 1;
7866+ // lane-ibc444c: this reader logs an `all_zero` step even for a read that
7867+ // consumes ZERO bits, so `post_bit == bit` means "no symbol was read" --
7868+ // filter on it before pairing anything against the oracle.
7869+ if crate::envflags::env_flag!("EC_IBCTX") {
7870+ eprintln!(
7871+ "EC_IBCTX2 side={} skip_ctx={skip_ctx} sign_ctx={sign_ctx} bit={sq_bit} at {}",
7872+ coding.side,
7873+ std::panic::Location::caller(),
7874+ );
7875+ }
78387876 if coeff_trace_on() {
78397877 let (rng, _) = dec.debug_state();
78407878 eprintln!(
7841- "EC_COEFF_STEP tag=all_zero side={} ctx={skip_ctx} dcctx={sign_ctx} cdf={dbg_txbskip:?} all_zero={} rng={rng}",
7842- coding.side, all_zero as i32
7879+ "EC_COEFF_STEP tag=all_zero side={} ctx={skip_ctx} dcctx={sign_ctx} cdf={dbg_txbskip:?} all_zero={} rng={rng} bit={sq_bit} post_bit={}",
7880+ coding.side,
7881+ all_zero as i32,
7882+ dec.debug_bitpos()
78437883 );
78447884 }
78457885 if crate::envflags::env_flag!("EC_AV1_TELL") {
@@ -8098,6 +8138,11 @@ fn read_coeffs(
80988138 /// neither `base_ctx_rect`/`br_ctx_rect` nor [`class_scan_table`] have a rect
80998139 /// form for those.
81008140
8141+// lane-ibc444c: `#[track_caller]` so the EC_IBCTX rung below names the CALLER
8142+// of this reader -- the only thing that identifies a unit's route. No plane is
8143+// printed here: the plane is the ORACLE's side of the pairing, and a label
8144+// here is one more thing that can disagree with it.
8145+#[track_caller]
81018146 fn read_coeffs_rect(
81028147 dec: &mut SymbolDecoder,
81038148 coding: &mut TxbTables,
@@ -8122,12 +8167,28 @@ fn read_coeffs_rect(
81228167 // `read_inter_plane_rect`'s corner) are all plane 0 -- the stamp's initial
81238168 // value -- and the other plane-owning readers stamp on entry.
81248169 set_census_plane(plane);
8170+ let ibctx_on = crate::envflags::env_flag!("EC_IBCTX");
8171+ let entry_bit = if ibctx_on { dec.debug_bitpos() } else { 0 };
81258172 let all_zero = dec.symbol(&mut coding.txb_skip[skip_ctx]) == 1;
81268173 if rect_trace {
81278174 eprintln!(
8128- "EC_COEFF_STEP tag=all_zero plane={plane} ctx={skip_ctx} entry={entry_rng} all_zero={} rng={}",
8175+ "EC_COEFF_STEP tag=all_zero plane={plane} ctx={skip_ctx} entry={entry_rng} all_zero={} rng={} bit={entry_bit} post_bit={}",
81298176 all_zero as i32,
8130- dec.debug_state().0
8177+ dec.debug_state().0,
8178+ dec.debug_bitpos()
8179+ );
8180+ }
8181+ if ibctx_on {
8182+ // lane-ibc444c. `bit`/`post_bit` are the STREAM POSITION, not the coder
8183+ // range: the only collision-free key for pairing this unit against the
8184+ // oracle's `EC_ECDUMP_IN`. And `post_bit != bit` is how a caller tells
8185+ // a real symbol read from a 0-bit one -- the SQUARE reader logs a step
8186+ // either way, which is exactly the artifact that made an earlier
8187+ // round of this lane claim a false exactness.
8188+ eprintln!(
8189+ "EC_IBCTX w={w} h={h} skip_ctx={skip_ctx} sign_ctx={sign_ctx} bit={entry_bit} post_bit={} at {}",
8190+ dec.debug_bitpos(),
8191+ std::panic::Location::caller(),
81318192 );
81328193 }
81338194 if all_zero {
@@ -13464,26 +13525,21 @@ fn decode_intrabc_rect(
1346413525 // 16x8 intrabc block's chroma plane block came out 8x4 and the lossless
1346513526 // walk below coded 2 units per plane where libaom codes 8.
1346613527 //
13467- // Scoped to `lossless` ON PURPOSE. The 4:2:0 halving is right at 4:2:0,
13468- // and every pinned 4:4:4 stream that reaches this helper does so LOSSY
13469- // (measured: zero pinned fixtures decode a LOSSLESS intrabc rect block),
13470- // whose footprint is a separate, already-named open cell --
13471- // lanes/av1444rect.report.md's 4:4:4 intra-BC chroma. This lane must not
13472- // move it, and a lossless-only split here changes no green pin either way.
13473- let (cpx, cpy) = if lossless(fctx) {
13474- (px >> ss_x(fctx), py >> ss_y(fctx))
13475- } else {
13476- (px / 2, py / 2)
13477- };
13528+ // lane-ibc444c: UNSCOPED now. lane-whtshape split this on `lossless` and
13529+ // named the LOSSY 4:4:4 footprint as another lane's open cell; this is
13530+ // that cell. Measured on `444_intrabc_rect4_witness.obu`: with the
13531+ // halving, an 8x16 luma block's 8x16 chroma plane block was read as ONE
13532+ // 4x8 rect unit where libaom codes ONE TX_8X16, and the U `txb_skip` of
13533+ // the block at mi (92, 104) read all_zero=0 here against the oracle's
13534+ // all_zero=1 -- the bit position forks there. Identical arithmetic at
13535+ // 4:2:0, where `ss_x = ss_y = 1`, so the pinned 4:2:0 twin of the
13536+ // witness is the identity arm of this lane's gate.
13537+ let (cpx, cpy) = (px >> ss_x(fctx), py >> ss_y(fctx));
1347813538 // `av1_get_max_uv_txsize(bw x bh)`: 4:2:0 halves the footprint and the
1347913539 // halved shape's own `max_txsize_rect_lookup` entry IS that size for every
1348013540 // shape this helper is called at, so the uv plane block is ONE unit --
1348113541 // the same call `decode_token_recon_block`'s own chroma loop makes.
13482- let (cw, ch) = if lossless(fctx) {
13483- (bw >> ss_x(fctx), bh >> ss_y(fctx))
13484- } else {
13485- (bw / 2, bh / 2)
13486- };
13542+ let (cw, ch) = (bw >> ss_x(fctx), bh >> ss_y(fctx));
1348713543 // lane-av1-intrabc r2: the square stride the proven INTER path uses
1348813544 // (`side`). The residual grids, the prediction windows AND
1348913545 // `TxParams::stride` are all laid out at it -- the block's own width
@@ -13509,6 +13565,16 @@ fn decode_intrabc_rect(
1350913565 if leaves.is_some() {
1351013566 hit!(INTRABC_RECT_VARTX_HITS);
1351113567 }
13568+ if ss_x(fctx) == 0 && ss_y(fctx) == 0 {
13569+ hit!(IBC_RECT_CHROMA_FOOTPRINT_444_HITS);
13570+ }
13571+ // lane-ibc444c: per-block geometry, for the chroma-tail attribution.
13572+ if crate::envflags::env_flag!("EC_IBCBLOCK") {
13573+ eprintln!(
13574+ "EC_IBCBLOCK mi=({mi_r},{mi_c}) bw={bw} bh={bh} cpx={cpx} cpy={cpy} \
13575+ cw={cw} ch={ch} cside={cside} skip={skip}"
13576+ );
13577+ }
1351213578 // The whole-block prediction: `predict_inter_block` runs once, before any
1351313579 // coefficient is read. `flush_recon` first -- the source is this frame's
1351413580 // own reconstruction, including the writes this superblock has queued.
crates/ec-av1/src/stream.rsmodified+183 -0
@@ -47992,4 +47992,187 @@ pub(crate) mod tests {
4799247992 );
4799347993 }
4799447994 }
47995+ /// lane-ibc444c: the 4:4:4 intra-BC chroma cell. `decode_intrabc_rect`
47996+ /// sized a rect intra-BC block's chroma plane block with a hardcoded 4:2:0
47997+ /// halving (`bw / 2`, `bh / 2`, origin `px / 2`).
47998+ /// `av1_get_max_uv_txsize` (`av1/common/blockd.h`) is `ss_size_lookup[bsize]`
47999+ /// and applies NO halving of its own, and `get_vartx_max_txsize` (`:1447`)
48000+ /// then reads that plane block as `max_txsize_rect_lookup[plane_bsize]`. So
48001+ /// at 4:4:4 an 8x16 luma block's chroma plane block is 8x16 and libaom
48002+ /// codes it as ONE TX_8X16, while the halving read the same 8x16 footprint
48003+ /// as ONE 4x8 rect unit.
48004+ ///
48005+ /// **Localised by trace, not by reading** (`EC_IBCTX`, this commit's rung
48006+ /// on `read_coeffs_rect`, paired against the oracle's `EC_ECDUMP_IN` by
48007+ /// STREAM BIT POSITION — never by the 16-bit `rng`, which collides at this
48008+ /// scale, and never by a plane label, which is the ORACLE's side of the
48009+ /// pairing):
48010+ ///
48011+ /// ```text
48012+ /// oracle bit 6870 plane=0 mi=(92,104) tx=7 (TX_8X16) all_zero=0
48013+ /// ours bit 6885 8x16 skip_ctx=0 decode.rs (read_inter_plane_rect)
48014+ /// oracle bit 6878 plane=1 mi=(92,104) tx=7 (TX_8X16) all_zero=1
48015+ /// ours bit 6893 4x8 skip_ctx=0 decode.rs <-- FORK
48016+ /// oracle bit 6879 plane=2 mi=(92,104) tx=7 (TX_8X16) all_zero=1
48017+ /// ours bit 6902 4x8 skip_ctx=0 decode.rs
48018+ /// ```
48019+ ///
48020+ /// The `txb_skip` VALUE first disagrees one unit before the bit position
48021+ /// does: the oracle skips the U unit, we do not, we burn 14 extra bits, and
48022+ /// every later symbol decodes from the wrong place. Reverting the two
48023+ /// arithmetic lines reproduces luma sample **205264** as the first wrong
48024+ /// sample — the exact ceiling `lanes/av1444rect.report.md` rounds 3-4
48025+ /// documented — which is the red-before proof.
48026+ ///
48027+ /// **The 4:4:4 pixel arm is a PREFIX, not an exactness claim, and the
48028+ /// residual is an ENTROPY fork — NOT a reconstruction one.** An earlier
48029+ /// round of this lane claimed the coefficient ladder was "bit-exact for all
48030+ /// 2359 oracle units" and inferred from that the tail was reconstruction.
48031+ /// **That claim was wrong and is retracted** (see this branch's report r2):
48032+ /// the walk compared entry bits at matching LIST INDICES across two traces
48033+ /// of different lengths, and the square `read_coeffs` reader logs an
48034+ /// `all_zero` step even for a read that consumes ZERO bits, so it paired
48035+ /// 0-bit lines against real units. Measured on this branch, with the
48036+ /// 0-bit filter applied to BOTH sides:
48037+ ///
48038+ /// ```text
48039+ /// oracle all_zero reads 2395 (2359 with a real position)
48040+ /// our all_zero lines 3999
48041+ /// our lines that consumed bits 1326
48042+ /// 1:1 entry-bit matches, monotone merge 71
48043+ /// ```
48044+ ///
48045+ /// We perform ~1069 FEWER real symbol reads than the oracle. A
48046+ /// reconstruction-only defect cannot make a symbol count come up short, so
48047+ /// the tail is a second entropy fork, first visible in U and V at
48048+ /// **(x=160, y=80) = mi (20, 40)**, spreading to the whole x[320,640)
48049+ /// y[160,480) quadrant. (A figure of "1910 units matching 1:1 with 486 vs
48050+ /// 486 non-zero-bit reads" was relayed to this lane and does NOT reproduce
48051+ /// here — re-measure before quoting either number.)
48052+ ///
48053+ /// **The next reader must pair by BIT INTERVAL, not by index.** The oracle's
48054+ /// `EC_ECDUMP_IN` prints only the ENTRY position; there is no post position,
48055+ /// and entry bits alone drift the moment per-unit bit consumption differs.
48056+ /// The unblock is one line of oracle instrumentation OUTSIDE the repo —
48057+ /// print `aom_reader_tell(r)` after the `aom_read_symbol` at
48058+ /// `~/.cache/aom-oracle/src/av1/decoder/decodetxb.c:158` — then pair on
48059+ /// `(entry, post)`, which is exact and collision-free. Coordinate the
48060+ /// rebuild with the main session; every lane's oracle binary moves.
48061+ ///
48062+ /// 4:2:0 identity is a first-class arm, not a claim: `ss_x = ss_y = 1`
48063+ /// makes `bw >> ss_x` the same arithmetic as the halving, and the pinned
48064+ /// 4:2:0 twin (`420_intrabc_rect4_witness.obu`) is asserted byte-exact
48065+ /// against the oracle in the same run.
48066+ #[test]
48067+ fn a_444_intrabc_rect_chroma_plane_block_is_the_block_footprint() {
48068+ const NAME: &str = "a_444_intrabc_rect_chroma_plane_block_is_the_block_footprint";
48069+ const F444: &str = "444_intrabc_rect4_witness.obu";
48070+ const F444_LEN: usize = 1016;
48071+ const F420: &str = "420_intrabc_rect4_witness.obu";
48072+ const F420_LEN: usize = 890;
48073+ let read = |name: &str, file: &str, len: usize| -> Vec<u8> {
48074+ let path = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))
48075+ .join(format!("fixtures/{file}"));
48076+ let bytes = std::fs::read(&path)
48077+ .unwrap_or_else(|e| panic!("{name}: pinned fixture {file} missing: {e}"));
48078+ assert_eq!(bytes.len(), len, "{name}: {file} length moved");
48079+ bytes
48080+ };
48081+ let stream444 = read(NAME, F444, F444_LEN);
48082+ let stream420 = read(NAME, F420, F420_LEN);
48083+ // The defect only exists where `ss_size_lookup` != the 4:2:0 halving.
48084+ assert_444_header(&stream444, NAME, 8);
48085+
48086+ let _guard = lock_gate_counters();
48087+ crate::decode::reset_ibc_rect_chroma_footprint_444_hits();
48088+ let frames = decode_stream(&stream444)
48089+ .unwrap_or_else(|e| panic!("{NAME}: the pinned 4:4:4 witness was refused: {e}"));
48090+ let hits = crate::decode::ibc_rect_chroma_footprint_444_hits();
48091+ assert_eq!(frames.len(), 1, "{NAME}: frame count");
48092+ assert!(
48093+ hits > 0,
48094+ "{NAME}: no rect intra-BC block was sized at 4:4:4 -- the corrected \
48095+ footprint never ran, so this gate is measuring the hardcoded 4:2:0 \
48096+ halving (class gate-blind-to-feature)"
48097+ );
48098+
48099+ // lane-av1oraclepost: main's shared probe. With
48100+ // EC_AV1_REQUIRE_AOMDEC / EC_AV1_REQUIRE_AOMENC set it is a HARD
48101+ // failure, so a batch run cannot report GREEN with the compare never
48102+ // run -- ONE presence-check shape in the crate.
48103+ if !aomdec_available(NAME) {
48104+ eprintln!("{NAME}: {hits} rect intra-BC block(s) sized at 4:4:4; pixel arm SKIPPED");
48105+ return;
48106+ }
48107+
48108+ // 4:2:0 identity FIRST and in full.
48109+ decode_all_frames_vs_oracle(&stream420, &format!("{NAME}-420"));
48110+
48111+ // 4:4:4 is a per-plane exact PREFIX, not an exactness claim, and the
48112+ // doc above says why. Asserting "wrong by exactly N" would encode the
48113+ // open entropy fork as expected behaviour; the floor is the honest form
48114+ // and it only ever grows.
48115+ const PLANE: usize = 640 * 480;
48116+ const EXACT_PREFIX: [usize; 3] = [PLANE, 51360, 51360];
48117+ let dir = std::env::temp_dir().join(format!("ec-av1-{NAME}-{}", std::process::id()));
48118+ let _ = std::fs::remove_dir_all(&dir);
48119+ std::fs::create_dir_all(&dir).expect("scratch dir");
48120+ let in_obu = dir.join("in.obu");
48121+ std::fs::write(&in_obu, &stream444).expect("writing the stream");
48122+ let aom_prefix = dir.join("aom");
48123+ let out = Command::new(aomdec_path())
48124+ .args(["--codec=av1", "-o"])
48125+ .arg(dir.join("out.y4m"))
48126+ .arg(&in_obu)
48127+ .env("EC_AV1_FINAL_DUMP", &aom_prefix)
48128+ .stdin(Stdio::null())
48129+ .stdout(Stdio::piped())
48130+ .stderr(Stdio::piped())
48131+ .output()
48132+ .expect("aomdec failed to run");
48133+ assert!(
48134+ out.status.success(),
48135+ "{NAME}: the oracle aomdec refused the stream: {}",
48136+ String::from_utf8_lossy(&out.stderr)
48137+ );
48138+ let ours_prefix = dir.join("ours");
48139+ set_final_dump_prefix(Some(ours_prefix.display().to_string()));
48140+ let _ = decode_stream(&stream444).expect("second decode");
48141+ set_final_dump_prefix(None);
48142+ let aom_dump = std::fs::read(format!("{}.f0", aom_prefix.display())).expect("oracle dump");
48143+ let our_dump = std::fs::read(format!("{}.f0", ours_prefix.display())).expect("our dump");
48144+ assert_eq!(
48145+ our_dump.len(),
48146+ aom_dump.len(),
48147+ "{NAME}: our frame is {} bytes, the oracle's is {}",
48148+ our_dump.len(),
48149+ aom_dump.len()
48150+ );
48151+ assert_eq!(aom_dump.len(), 3 * PLANE, "{NAME}: 8-bit 4:4:4 640x480");
48152+ for (plane, name) in [(0usize, "Y"), (1, "U"), (2, "V")] {
48153+ let at = plane * PLANE;
48154+ let floor = EXACT_PREFIX[plane];
48155+ if our_dump[at..at + floor] == aom_dump[at..at + floor] {
48156+ continue;
48157+ }
48158+ let first = (0..floor)
48159+ .find(|&s| our_dump[at + s] != aom_dump[at + s])
48160+ .unwrap_or(floor);
48161+ panic!(
48162+ "{NAME}: plane {name} diverges from the oracle at sample {first} of {PLANE} \
48163+ (x={}, y={}) -- the exact prefix this gate pins is {floor} and it only \
48164+ grows; the chroma tail is the OPEN entropy fork in \
48165+ lanes/ibc444c.report.md r2",
48166+ first % 640,
48167+ first / 640
48168+ );
48169+ }
48170+ let _ = std::fs::remove_dir_all(&dir);
48171+ eprintln!(
48172+ "{NAME}: {hits} rect intra-BC block(s) sized at 4:4:4; 4:2:0 twin \
48173+ byte-exact; 4:4:4 luma byte-exact (307200/307200), U and V byte-exact to \
48174+ sample 51360 -- the chroma tail is the OPEN entropy fork \
48175+ (lanes/ibc444c.report.md r2), NOT an assertion"
48176+ );
48177+ }
4799548178 }
lanes/ibc444c.report.mdadded+720 -0
@@ -0,0 +1,720 @@
1+# lane-ibc444c — the 4:4:4 intra-BC chroma fork
2+
3+Branch `lane-ibc444c`, fresh off `a21f3680` (not a continuation of
4+`lane-whtshape` — that branch's lossless WHT work is separate and stays
5+there). One commit `6bff63b4`.
6+
7+Files: `crates/ec-av1/src/decode.rs`, `crates/ec-av1/src/stream.rs` (the new
8+gate). Witness already committed, nothing pinned:
9+`crates/ec-av1/fixtures/444_intrabc_rect4_witness.obu`, 1016 B, sha256
10+`7fe888edf18caa74bdb415f0de643dc59963e87e0255d77191200b7a62eb2542`, FNV
11+`0x27c2_fad5_4047_2994`; 4:2:0 twin `420_intrabc_rect4_witness.obu`, 890 B,
12+FNV `0x57ec_3da2_a63b_403a`.
13+
14+---
15+
16+## r1 — Caller and plane: ESTABLISHED (this was the deliverable's first half)
17+
18+Not by reading. This commit adds the **`EC_IBCTX`** rung to `read_coeffs_rect`
19+and the **`EC_IBCTX2`** rung to `read_coeffs`, both env-gated, both printing
20+`w, h, skip_ctx, sign_ctx, entry/post stream bit` and the `#[track_caller]`
21+site — and **no plane label at all**.
22+
23+Two pairing hazards, both hit and both worth recording:
24+
25+1. **The existing `EC_COEFF_STEP` rung hardcodes `plane=0`** (`decode.rs:7845`
26+ and the square reader). Pairing on it attributes every chroma unit to luma.
27+ The new rungs deliberately carry no plane; the plane comes from the
28+ pairing.
29+2. **The 16-bit `rng` is not a usable pairing key at this scale.** With 2395
30+ units, `difflib` on the `rng` ladder produced **2519 non-equal blocks** and
31+ a "largest common run" of 80 that landed at a completely unrelated mi —
32+ pure birthday collisions. The exact key is the **stream bit position**:
33+ our `SymbolDecoder::debug_bitpos()` against libaom's `aom_reader_tell()`
34+ (the oracle's `EC_ECDUMP_IN` third field), with a **constant +15 bit
35+ offset** = the OBU header libaom counts before `aom_reader_init`. With
36+ that key the ladders agree to the unit.
37+
38+The fork, verbatim:
39+
40+```text
41+oracle bit 6870 plane=0 mi=(92,104) tx=7 (TX_8X16) all_zero=0
42+ours bit 6885 8x16 skip_ctx=0 sign_ctx=0 decode.rs:28451 (read_inter_plane_rect)
43+oracle bit 6878 plane=1 mi=(92,104) tx=7 (TX_8X16) all_zero=1
44+ours bit 6893 4x8 skip_ctx=0 sign_ctx=0 decode.rs:28451 <-- FORK
45+oracle bit 6879 plane=2 mi=(92,104) tx=7 (TX_8X16) all_zero=1
46+ours bit 6902 4x8 skip_ctx=0 sign_ctx=0 decode.rs:28451
47+```
48+
49+(`TX_SIZE` order from `aom_dsp/txfm_common.h:25`: 0 TX_4X4, 1 TX_8X8,
50+2 TX_16X16, 3 TX_32X32, 4 TX_64X64, 5 TX_4X8, 6 TX_8X4, **7 TX_8X16**,
51+8 TX_16X8, 9 TX_16X32, 10 TX_32X16, 11 TX_32X64, 12 TX_64X32, 13 TX_4X16,
52+**14 TX_16X4**, 15 TX_8X32, 16 TX_32X8, 17 TX_16X64, 18 TX_64X16.)
53+
54+So, answering the question as posed:
55+
56+* **Plane: 1 (U).** The first *symbol-value* disagreement is the U plane's
57+ `txb_skip` at mi (92, 104) = px (368, 416): the oracle reads `all_zero = 1`
58+ (unit skipped), we read `all_zero = 0`. Note the ticket had this inverted
59+ ("the ORACLE reads a chroma txb_skip"); what is true is that the two sides
60+ disagree on the *value* of that `txb_skip`, and the oracle's is 1.
61+* **Caller: `decode_intrabc_rect` → `read_inter_plane_rect` →
62+ `read_coeffs_rect(w = 4, h = 8, skip_ctx = 0)`.** The `w = 4, h = 8` in the
63+ ticket was right; the line number had drifted to `28451` in
64+ `read_inter_plane_rect`'s own `read_coeffs_rect` call.
65+* **Root cause: the unit SHAPE, and it comes from the FOOTPRINT.**
66+ `read_inter_plane_rect` is handed `(cw, ch)` by `decode_intrabc_rect`, which
67+ computed it as `bw / 2, bh / 2`. The luma block is 8x16, so the halving
68+ produced a **4x8** chroma unit where the chroma plane block is really 8x16
69+ and libaom codes it as **one TX_8X16**.
70+
71+**Not a token-order defect, confirmed independently.** The earlier rounds'
72+"2688 vs 2395, no blowup" reading was right and the raw counts mislead: our
73+trace emits 3999 `all_zero` entries but **2673 of them consume zero bits**
74+(the square reader logs a step even for a 0-bit read), so the real symbol
75+count matches.
76+
77+## r2 — The libaom sites that decide the shape, and the fix
78+
79+Two sites, neither of which halves:
80+
81+* `av1_get_max_uv_txsize` (`av1/common/blockd.h`) is `ss_size_lookup[bsize]`
82+ — the plane block is `bw >> ss_x` by `bh >> ss_y` at
83+ `(px >> ss_x, py >> ss_y)`.
84+* `get_vartx_max_txsize` (`blockd.h:1447`) reads that plane block as
85+ `max_txsize_rect_lookup[plane_bsize]` (luma) or
86+ `av1_get_adjusted_tx_size` of it (chroma), and
87+ `decode_token_recon_block` (`decodeframe.c:972-1005`) walks the units from
88+ that.
89+
90+The fix is the two lines in `decode_intrabc_rect`:
91+
92+```rust
93+let (cpx, cpy) = (px >> ss_x(fctx), py >> ss_y(fctx));
94+let (cw, ch) = (bw >> ss_x(fctx), bh >> ss_y(fctx));
95+```
96+
97+replacing the hardcoded `/ 2`. **At 4:2:0 this is the same arithmetic**
98+(`ss_x = ss_y = 1`), which is why the 4:2:0 twin is a first-class arm of the
99+gate and not a claim.
100+
101+This is the *same defect class* the `lane-whtshape` commit fixed on the
102+**lossless** arm of this very function; this lane does it unscoped, so the
103+lossy 4:4:4 cell falls out with it.
104+
105+## r3 — Measurements
106+
107+**Entropy (the strong claim).** After the fix, our `all_zero` entry bit
108+matches the oracle's for **all 2359 oracle units that report a real bit
109+position**, with every `txb_skip` value agreeing. The last 36 oracle units
110+report an `aom_reader_tell` sentinel near 2^32 — an oracle-side artifact
111+(`8 * (bptr - buf) - (cnt + 15)` wrapping at the end of the buffer), not a
112+fork. The witness's coefficients are now **identical to the oracle's**, so the
113+remaining pixel work is reconstruction, not bitstream.
114+
115+**Pixels**, `444_intrabc_rect4_witness.obu`, 640x480 4:4:4 8-bit, frame 0,
116+against the oracle's `EC_AV1_FINAL_DUMP`:
117+
118+| | Y | U | V | total |
119+| --- | --- | --- | --- | --- |
120+| before | 195615 | 149314 | 45051 | **390380** of 921600 |
121+| after | **0** | 72945 | 64865 | **137810** of 921600 |
122+
123+Luma is now byte-exact on all 307200 samples. U and V are byte-exact for
124+their first 51360 samples — the whole frame above row 80, plus row 80 out to
125+column 160.
126+
127+**OPEN after this lane (measured):** 72945 U + 64865 V samples still differ,
128+first at **(x=160, y=80)** on both planes. Because the coefficient ladder is
129+symbol-exact, this is a **reconstruction** divergence — the residual is being
130+read at the right place with the right values and written to the wrong place,
131+or a neighbouring unit's context is being clobbered. Candidates left standing,
132+in the order I would test them:
133+
134+1. `decode_intrabc_owned_rect` (`decode.rs:16221`) and `decode.rs:19294` still
135+ carry the same `let (cw, ch) = (bw / 2, bh / 2);`. The post-fix trace shows
136+ no remaining halved chroma footprint on THIS witness, so neither is reached
137+ here — but both are the same latent defect on the same class of stream and
138+ should be swept by whoever owns them.
139+2. The per-unit chroma entropy-context replay: `decode_intrabc_rect`'s tail
140+ `record_split_luma_rect_mi` rewrites every chroma cell with ONE composed
141+ state, which drops the per-unit DC signs and levels (class
142+ `override-slot-on-one-arm`). `lane-whtshape` added exactly that replay to
143+ this function's lossless arm; the LOSSY arm has no such replay, and at
144+ 4:4:4 the chroma plane block is now 2x4 units instead of one, so the
145+ composed state is wrong for a region the old single-unit code got right by
146+ accident. **This is my leading candidate for (160, 80)** and it is the
147+ first thing the next lane should test.
148+3. Nothing in the remaining 4x8 / 8x4 chroma rect reads is a halved 4:4:4
149+ footprint: the post-fix trace attributes them to `decode_rect4_16_strip`
150+ (1:4 strips, where an 8x4 chroma unit IS what
151+ `av1_get_adjusted_tx_size(TX_16X4)` gives) and to the
152+ `read_chroma_coeffs_rect` wrapper.
153+
154+## r4 — Gate and mutation proof
155+
156+`stream::tests::a_444_intrabc_rect_chroma_plane_block_is_the_block_footprint`:
157+
158+1. 4:4:4 8-bit header asserted (`assert_444_header`) — the defect needs
159+ `ss_size_lookup` to differ from the 4:2:0 halving;
160+2. `IBC_RECT_CHROMA_FOOTPRINT_444_HITS > 0` — **exclusive** to the corrected
161+ arm: a 4:2:0 stream can never bump it (`ss_x == ss_y == 0` is required),
162+ and no other caller sizes an intrabc rect block's chroma;
163+3. the 4:2:0 twin is **byte-exact** against the oracle (identity arm, run
164+ first and in full);
165+4. a **per-plane exact PREFIX** against the oracle in decode order —
166+ `[307200, 51360, 51360]`. This is a progress gate and the gate's own doc
167+ says so; asserting "wrong by exactly N" would encode r3's open defect as
168+ expected behaviour.
169+
170+### Mutations (release profile, arithmetic only reverted; counters and gate kept)
171+
172+```
173+MUT the two arithmetic lines back to `(px / 2, py / 2)` / `(bw / 2, bh / 2)`
174+ -> RED at stream.rs:43748
175+ "plane Y diverges from the oracle at sample 205264 of 307200
176+ (x=464, y=320)"
177+ test result: FAILED. 0 passed; 1 failed
178+
179+MUT2 hit!(IBC_RECT_CHROMA_FOOTPRINT_444_HITS) removed
180+ -> RED at stream.rs:43671
181+ "no rect intra-BC block was sized at 4:4:4 -- the corrected footprint
182+ never ran, so this gate is measuring the hardcoded 4:2:0 halving
183+ (class gate-blind-to-feature)"
184+ test result: FAILED. 0 passed; 1 failed
185+
186+LIVE restored tree: ok. 1 passed
187+```
188+
189+**MUT lands on 205264 — the exact luma ceiling the av1444rect rounds 3-4
190+documented** ("the LUMA plane is exact to sample 205264 (it was 164416)").
191+Reverting two arithmetic lines in a different lane reproduces that number to
192+the sample, which is independent confirmation that this is the same defect
193+they were measuring and that nothing else had moved it.
194+
195+### Regression (release, named tests; no full suite on this box)
196+
197+```
198+444 16 passed; 0 failed
199+lossless 16 passed; 0 failed
200+intrabc_rect 5 passed; 0 failed
201+a_444_sb128 2 passed; 0 failed
202+a_444_intrabc_rect4 1 passed; 0 failed
203+a_444_lossy_rect4_inter 1 passed; 0 failed
204+a_444_intrabc_rect_chroma_plane_block 1 passed; 0 failed (the new gate)
205+```
206+
207+`cargo check -p ec-av1` warning-free.
208+
209+## r5 — Reusable, for whoever takes the chroma tail
210+
211+* Pair decoder and oracle units by **stream bit position**
212+ (`debug_bitpos()` vs `aom_reader_tell()`), not by `rng` and not by a plane
213+ label. Both traps cost real time here and the second one is already baked
214+ into the repo's existing `EC_COEFF_STEP` rung.
215+* The oracle's last ~36 units report an `aom_reader_tell` sentinel near 2^32.
216+ Treat `>= 2^31` as "no position", not as a divergence.
217+* Our square reader logs an `all_zero` step even for a 0-bit read, so raw
218+ trace-line counts overstate the symbol count by ~2x. Count `post_bit != bit`.
219+* The `EC_IBCTX` / `EC_IBCTX2` rungs are left in the tree, env-gated, and are
220+ the tool for the remaining chroma tail.
221+
222+---
223+
224+# r2 — the chroma tail: a CORRECTION, and the attribution table
225+
226+## r2.0 First: r1's "symbol-exact" claim was WRONG. It is not symbol-exact.
227+
228+r1 and r3 claimed the coefficient ladder was bit-exact against the oracle
229+"for all 2359 oracle units that report a real bit position". **That claim is
230+false and must not be relied on.** The measurement that produced it was a
231+lockstep walk `for i in range(min(len(aom), len(our)))` comparing entry bits.
232+Our trace emits **3999** `all_zero` lines for the oracle's **2395** units, and
233+**2673 of ours consume zero bits** (the square `read_coeffs` reader logs a step
234+even for a 0-bit read — the trap this same report warned about in r5, which I
235+then failed to apply to my own walk). The walk therefore paired our *0-bit*
236+trace lines against the oracle's *real* units, and "2359 index positions
237+matched" said nothing about symbol count.
238+
239+The correct measurement, counting only reads that consumed bits
240+(`post_bit != bit`):
241+
242+```text
243+oracle all_zero reads 2395 (2359 with a real position)
244+ours all_zero reads that consumed 1326 bits
245+```
246+
247+**We perform 1326 real `all_zero` symbol reads where the oracle performs
248+2395 — roughly 1069 reads short.** The entropy ladder is *not* exact. The
249+footprint fix removed one real fork (and made luma exact); a second one
250+remains. Everything in r1/r3 that says "the remaining divergence is
251+reconstruction, not bitstream" is retracted.
252+
253+Two lessons, both now in the managed skill: apply the 0-bit filter to the
254+*pairing* and not only to the census, and never report a lockstep index match
255+as a symbol-count match.
256+
257+## r2.1 Why the bit-position key cannot finish the job on its own
258+
259+The oracle's `EC_ECDUMP_IN` prints only the **entry** position
260+(`8 * (bptr - buf) - (cnt + 15)` at unit entry). There is no post position, and
261+`rng` is the coder range, not a position. So the only oracle-side key is the
262+entry bit, and entry bits alone cannot be lockstepped here: our per-unit bit
263+consumption differs from the oracle's, so the offset drifts immediately.
264+Measured: filtering both sides to real reads gives a first-unit offset of
265+**+32** (not the +15 the mixed walk reported) and the offset is already wrong
266+by index 1 (oracle 45 vs ours 49).
267+
268+**The unblock is one line of oracle instrumentation, outside the repo:**
269+add the post-read position to the `EC_ECDUMP_IN` rung in
270+`~/.cache/aom-oracle/src/av1/decoder/decodetxb.c` (print
271+`aom_reader_tell(r)` after the `aom_read_symbol` at `decodetxb.c:158`). Then
272+pair on the **(entry, post) interval**, which is exact and collision-free, and
273+the next real fork is one script away. I did not make that change: it is the
274+shared oracle build, and rebuilding it mid-wave would move every other lane's
275+binary.
276+
277+## r2.2 Per-sample attribution (the deliverable)
278+
279+`444_intrabc_rect4_witness.obu`, frame 0, against the oracle's
280+`EC_AV1_FINAL_DUMP`. 8x8-cell granularity, 4-neighbour connected components
281+over the union of the U and V difference sets:
282+
283+| | differing | first differing sample | ours | oracle |
284+| --- | --- | --- | --- | --- |
285+| Y | **0** of 307200 | — | — | — |
286+| U | 72945 of 307200 | (x=160, y=80) | 55 | 54 |
287+| V | 64865 of 307200 | (x=160, y=80) | 34 | 32 |
288+
289+Components (U ∪ V, 8x8 cells):
290+
291+| cells | x range | y range | shape |
292+| --- | --- | --- | --- |
293+| 8 | [160, 192) | [80, 96) | 4x2 cells = 32x16 px |
294+| 1182 | [320, 640) | [160, 480) | 40x40 cells = 320x320 px |
295+
296+The dominant component is the whole bottom-right quadrant from (320, 160) —
297+the shape of a desync that starts in the small component at (160, 80) and
298+then runs away, not the shape of a per-block prediction error. The error
299+magnitudes at the first divergence are small (1 and 2 of 255) only because
300+the run-away has not yet accumulated there.
301+
302+**So the next fork is at or just before U(160, 80) = mi (20, 40)**, and given
303+r2.0 it is an entropy fork, not a reconstruction one. The r3 candidate list in
304+this report is therefore **withdrawn**: the `override-slot-on-one-arm` replay
305+theory predicted a reconstruction-only divergence and is ruled out by the
306+symbol count.
307+
308+## r2.3 What is eliminated, and what is not
309+
310+Ruled out by measurement:
311+
312+- **A second halved chroma footprint on this witness.** The `EC_IBCBLOCK` rung
313+ added in this round prints every `decode_intrabc_rect` block's
314+ `bw/bh/cw/ch/cside`; after the fix every 4:4:4 block's `cw, ch` equals its
315+ `bw, bh` (`32x8 -> 16x4`, `16x32 -> 8x16`, `8x16 -> 4x8`, all with
316+ `ss_x = ss_y = 0`). No halved footprint remains on this stream.
317+- **A 4:2:0 regression.** The pinned twin `420_intrabc_rect4_witness.obu` is
318+ byte-exact against the oracle in every gate run; `>> ss_x` is the same
319+ arithmetic as `/2` there.
320+- **Token-order blowup.** Confirmed not a blowup — the raw 3999-vs-2395 line
321+ count is 2673 zero-bit artifacts. The real gap is 1326-vs-2395, which is
322+ *reads missing*, not reads duplicated.
323+
324+Still open, in the order I would test them next:
325+
326+1. **A chroma unit read that this decoder never reaches at all.** 1069 missing
327+ `all_zero` reads on a stream whose luma is byte-exact is a *unit-count*
328+ problem, not a context problem: some chroma units libaom codes are not being
329+ read. The natural suspect is `decode_rect4_16_strip` and
330+ `read_chroma_coeffs_rect` (the two other sites still emitting 4x8/8x4 chroma
331+ units in the post-fix trace), and the 1:4 chroma pair geometry at 4:4:4.
332+2. `decode_intrabc_owned_rect` (`decode.rs:16221`) and `decode.rs:19294` still
333+ carry `let (cw, ch) = (bw / 2, bh / 2);` — unreachable on this witness, but
334+ the same latent defect and worth a sweep by whoever owns them.
335+
336+## r2.4 Invariant batch (release, run in one batch after r2's probes)
337+
338+See the commit message for the tails. Summary: `444` 16 passed, `lossless` 16
339+passed, `intrabc_rect` 5 passed, the 4:2:0 identity arm byte-exact, the new
340+gate green. Nothing green moved.
341+
342+---
343+
344+# r3 — REWORK status: items 1 and 2 done, item 3 done by construction, item 4 NOT VERIFIED
345+
346+State honestly: **this branch is not ready to land and nothing is committed
347+for r3.** Details, because the difference matters.
348+
349+## Done
350+
351+**(1) The gate doc no longer asserts the retracted claim.** `stream.rs`'s
352+`a_444_intrabc_rect_chroma_plane_block_is_the_block_footprint` doc now states
353+the corrected finding: the ladder is NOT exact; the entry-position pairing was
354+invalid because 2673 of our trace lines consume zero bits and the two lists
355+differ in length; the counts, MEASURED on this branch with the 0-bit filter on
356+BOTH sides:
357+
358+```text
359+oracle all_zero reads 2395 (2359 with a real position)
360+our all_zero lines 3999
361+our lines that consumed bits 1326
362+1:1 entry-bit matches, monotone merge 71
363+```
364+
365+and it states the requirement explicitly — **pair by BIT INTERVAL, not by
366+index** — with the one-line oracle instrumentation that unblocks it
367+(`aom_reader_tell(r)` after the `aom_read_symbol` at
368+`~/.cache/aom-oracle/src/av1/decoder/decodetxb.c:158`).
369+
370+**NOTE, and this is a correction to a figure relayed to this lane:** the
371+"1910 units matching 1:1 with 486 vs 486 non-zero-bit reads" number does NOT
372+reproduce here. This branch measures 1326 real reads and 71 interval matches.
373+I have written the branch's own measurement into the doc rather than the
374+relayed one, and flagged the discrepancy, so the next reader re-measures
375+instead of inheriting either figure.
376+
377+**(2) The silent skip is routed.** The pixel arm's
378+`if !aomdec_path().is_file() { eprintln!(...); return; }` is now preceded by
379+`have_aomenc()`'s exact shape, so with `EC_AV1_REQUIRE_AOMENC=1` a missing
380+aomdec FAILS instead of reporting GREEN with the compare skipped:
381+
382+```rust
383+let present = aomdec_path().is_file();
384+assert!(
385+ present || std::env::var_os("EC_AV1_REQUIRE_AOMENC").is_none(),
386+ "EC_AV1_REQUIRE_AOMENC is set but no aomdec at {} -- run scripts/build-aom-oracle.sh",
387+ aomdec_path().display()
388+);
389+```
390+
391+It is written to the same shape main's `have_aomenc()` uses, so it merges
392+trivially when `lane-av1oracleskip`'s shared `aomdec_available(name)` lands.
393+
394+**(3) The rustfmt churn is gone, BY CONSTRUCTION rather than by split.** The
395+earlier fix commit reflowed `mu_chunk_order`'s signature and a
396+`decode_inter_block` comparison. Rather than splitting the hunk out, r3 was
397+rebuilt **from main's copy of the files**: `git checkout main --
398+crates/ec-av1/src/{decode,stream,transform}.rs` and then re-applying the
399+change set by exact anchor. `git diff main -- crates/ec-av1/src/decode.rs` now
400+touches zero `mu_chunk_order` / `read_intra_chroma_lossless` lines. The only
401+removed lines in the whole decode.rs diff are the `lane-whtshape` `if lossless`
402+conditional that this lane unscopes, plus the two trace-format strings this
403+lane extends.
404+
405+## NOT DONE — and why
406+
407+**(4) The post-rebase gate run is not verified.** `git rebase main` CONFLICTED
408+on both `decode.rs` and `stream.rs`, so I aborted it and rebuilt from main's
409+copies of the three files. The result is a tree that is **old base
410+(`a21f3680`) + three files from `main` + this lane's edits** — `git diff main
411+--stat` shows 73 files changed and 9897 deletions, i.e. this worktree is
412+missing the ~70 files the other wave-3 merges added, including gates and
413+fixtures.
414+
415+An A/B on that tree is meaningless, and I am not going to report it as one:
416+
417+```text
418+MAIN ONLY (stashed) ok. 25 passed; 0 failed (713 tests)
419+MAIN + MY CHANGE FAILED. 36 passed; 12 failed (744 tests)
420+```
421+
422+The 12 failures are all gates whose pins or scripts live in files this
423+half-rebased tree does not have (`a_444_lossy_superres_*`,
424+`a_444_lossy_rect4_strip_*`, `a_pinned_444_rect_inter_*`,
425+`a_real_aomenc_lossless_444_*`, `a_444_lossless_sb64_*`), and the test count
426+moving 713 -> 744 from a change that adds one test confirms the tree is not
427+what I think it is. **I have not established that my change is regression-free
428+on main**, and I will not claim it.
429+
430+The single gate this lane owns, on the same tree, IS green:
431+
432+```text
433+a_444_intrabc_rect_chroma_plane_block ok. 1 passed; 0 failed
434+ 14 rect intra-BC block(s) sized at 4:4:4; 4:2:0 twin byte-exact;
435+ 4:4:4 luma byte-exact (307200/307200), U and V byte-exact to sample 51360
436+a_444_intrabc_rect4 ok. 1 passed; 0 failed
437+lossless_tx_tests ok. 5 passed; 0 failed
438+cargo check -p ec-av1 0 errors, 0 warnings
439+```
440+
441+## The exact next step for whoever finishes this
442+
443+A real `git rebase main` resolving both conflicts **by hand, hunk by hunk**,
444+then the invariant batch. The conflict surface is known and small on my side:
445+`decode_intrabc_rect`'s `cpx/cpy` + `cw/ch` block (main carries
446+`lane-whtshape`'s `if lossless` conditional; this lane unscopes it), the
447+`INTRABC_RECT_SKIPPED_HITS` thread_local block (main carries
448+`lane-whtshape`'s counter next to it), and the tail of `mod tests` in
449+`stream.rs` (main has ~30 gates this branch's base never saw). The `fixtures/`
450+directory is gitignored and points at a durable store, so re-checking it out
451+from main is what brings the other lanes' pins back.
452+
453+## Provenance note
454+
455+`lane-av1oraclepost` independently localised the same fork (the U `txb_skip`
456+at mi (92, 104), from the same hardcoded halving) and has agreed to drop its
457+duplicate hunk in favour of this one. **This branch is the canonical fix for
458+that route**; the other branch keeps its oracle instrumentation (the
459+post-position rung, which is also what unblocks r2's entropy fork) and its
460+class sweep.
461+
462+---
463+
464+# r3 — REWORK COMPLETE. Rebuilt on main's full tree, A/B is real, branch is green.
465+
466+## The tree problem, and the fix
467+
468+`git rebase main` conflicted on both files. The first attempt at the rework
469+rebuilt from main's THREE files, which left the worktree as *old base
470+(a21f3680) + 3 files from main + my edits* — `git diff main --stat` was 73 files
471+/ 9897 deletions, and the A/B on it was meaningless (main-only 25/0 vs
472+main+change 36/**12 failed**). I refused to report that as an A/B, and that
473+refusal was the right call: the test count moved 713 -> 744 from a change that
474+adds ONE test, which is only possible if the tree is a mixture.
475+
476+The recipe that worked — **rebuild from the current tree, never replay
477+commit-by-commit**:
478+
479+1. patch each of my files against main (`git diff main -- <file>`), saved to
480+ `/tmp/{d,s,t}.patch` — `t.patch` came out EMPTY, confirming I make no change
481+ to `transform.rs`;
482+2. `git checkout -B lane-ibc444c-r3 main`, so the WHOLE tree is main's
483+ (fixtures included: 48 -> 70 committed pins came back);
484+3. `git apply --3way` the two patches;
485+4. **and then reject the result of step 3 for `stream.rs`.** The 3-way apply
486+ put back the OLD base's text wherever the patch's context overlapped, which
487+ silently restored two things other lanes had removed: 167 lines of
488+ `gate_coverage.rs` (the `no_tool_presence_check_outside_its_probe` guard)
489+ and 83 lines of `lanes/av1oracleSkip.report.md`. I caught it because
490+ `stream.rs` showed **489 deletions** for a change that adds one test, then
491+ rebuilt `stream.rs` from main's copy and appended only my gate.
492+4. `git checkout main --` the two files step 3 had reverted.
493+
494+Final state, verified before anything was run:
495+
496+```text
497+$ git diff main --stat
498+ crates/ec-av1/src/decode.rs | 102 +++++++++++++++++++-----
499+ crates/ec-av1/src/stream.rs | 185 ++++++++++++++++++++++++++++++++++++++++++++
500+ 2 files changed, 267 insertions(+), 20 deletions(-)
501+
502+$ git diff main -- crates/ec-av1/src/decode.rs | grep -cE 'mu_chunk_order|read_intra_chroma_lossless'
503+0
504+```
505+
506+Only my two files, +267/-20, and **zero** rustfmt-churn lines — item 3
507+verified on a real tree rather than asserted. The only removed lines are the
508+`lane-whtshape` `if lossless` conditional this lane unscopes (its comment block
509+plus the two branches) and the two trace-format strings this lane extends.
510+
511+Main had also moved to `235416a6` ("Merge lane-av1oracleskip @ 7bf95961 — one
512+aomdec_available() for 18 guard sites, 7 redundant else skip-arms deleted"),
513+so the branch now rebases onto the tree that HAS `aomdec_available(name)`, and
514+the gate's guard calls it instead of a second hand-rolled shape. The crate ends
515+with ONE presence-check shape.
516+
517+## The A/B, on a tree whose --stat is clean
518+
519+Both halves rebuilt (`touch` before each) in the same target dir:
520+
521+```text
522+ MAIN ONLY MAIN + THIS LANE
523+444 ok. 34 passed; 0 failed ok. 35 passed; 0 failed
524+lossless ok. 23 passed; 0 failed ok. 23 passed; 0 failed
525+intrabc_rect ok. 5 passed; 0 failed ok. 6 passed; 0 failed
526+```
527+
528+**The 12 failures VANISH on a clean tree. They were tree artifacts, not
529+regressions** — every one was a gate whose pin or script lived in a file the
530+half-rebased tree lacked (`a_444_lossy_superres_*`, `a_444_lossy_rect4_*`,
531+`a_pinned_444_rect_inter_*`, `a_real_aomenc_lossless_444_*`,
532+`a_444_lossless_sb64_*`). The +1 in `444` and `intrabc_rect` is my gate. No
533+test that was green on main is red here.
534+
535+Full batch on the committed tree (release, files touched before the build):
536+
537+```text
538+a_444_intrabc_rect_chroma_plane_block ok. 1 passed; 0 failed
539+ 14 rect intra-BC block(s) sized at 4:4:4; 4:2:0 twin byte-exact;
540+ 4:4:4 luma byte-exact (307200/307200), U and V byte-exact to sample 51360
541+a_444_intrabc_rect4 ok. 1 passed; 0 failed
542+lossless_tx_tests ok. 5 passed; 0 failed
543+gate_coverage ok. 13 passed; 0 failed
544+refusal_inventory ok. 16 passed; 0 failed
545+444 ok. 35 passed; 0 failed
546+lossless ok. 23 passed; 0 failed
547+intrabc_rect ok. 6 passed; 0 failed
548+cargo check -p ec-av1 --all-targets 0 errors, 0 warnings
549+```
550+
551+Red-before is unchanged in substance: reverting only the two arithmetic lines
552+makes the gate's luma floor bite at sample **205264** — the exact ceiling
553+`lanes/av1444rect.report.md` rounds 3-4 documented.
554+
555+## CORRECTION — an unverified figure that must not survive as quotable
556+
557+A figure of **"1910 units matching 1:1, with 486 vs 486 non-zero-bit reads"**
558+was relayed to this lane (source: the review's brief, via Main) and **does not
559+reproduce here**. Measured on this branch, with the 0-bit filter applied to
560+BOTH sides:
561+
562+```text
563+oracle all_zero reads 2395 (2359 with a real position)
564+our all_zero lines 3999
565+our lines that consumed bits 1326
566+1:1 entry-bit matches, monotone merge 71
567+```
568+
569+**I measure 1326 real reads and 71 interval matches.** The gate doc carries
570+this branch's own numbers and flags the discrepancy, so the next reader
571+re-measures instead of inheriting either figure. Neither number should be
572+quoted without re-running the measurement; writing an unverified figure as fact
573+is the exact mistake r2 retracted.
574+
575+## The one open item, unchanged
576+
577+The chroma tail is a second ENTROPY fork: ~1069 real `txb_skip` reads are
578+missing versus the oracle, first visible in U and V at **(x=160, y=80) =
579+mi (20, 40)**, spreading to the whole x[320,640) y[160,480) quadrant. The gate
580+pins a measured per-plane exact prefix and says so. The unblock is still the
581+one line of oracle instrumentation outside the repo — print
582+`aom_reader_tell(r)` after the `aom_read_symbol` at
583+`~/.cache/aom-oracle/src/av1/decoder/decodetxb.c:158` — then pair on the
584+`(entry, post)` bit INTERVAL, which is exact and collision-free. Coordinate
585+the rebuild; every lane's oracle binary moves.
586+
587+## Provenance
588+
589+`lane-av1oraclepost` independently localised the same fork (the U `txb_skip` at
590+mi (92, 104), from the same hardcoded halving) and has agreed to drop its
591+duplicate hunk in favour of this one. **This branch is the canonical fix for
592+that route**; that branch keeps its oracle instrumentation (the post-position
593+rung, which is also this lane's r2 unblock) and its class sweep.
594+
595+---
596+
597+# r4 — moved onto `f33b9d41` (wave3c-b), A/B real and green
598+
599+Main advanced again, so r3's tree went stale the same way (it was based on
600+`0dfdf0c8` and `git diff main --stat` showed 47 files / 6984 deletions — the
601+`scripts/pin-gate-audit.py`, `scripts/verify-fixture-library.sh` and ~45 other
602+files the waves had added). Same recipe, and the same two hazards caught:
603+
604+1. patch each of my files against my own base — `t.patch` EMPTY again, so I
605+ make no change to `transform.rs`;
606+2. `git checkout -B lane-ibc444c-r4 f33b9d41` — whole tree becomes current
607+ main, fixtures included (70 -> **85** committed pins), `aomdec_available`
608+ present;
609+3. `git apply --3way` the **decode.rs** patch only. **The stream.rs patch was
610+ not applied**: last round the 3-way silently restored what other lanes had
611+ removed (167 lines of `gate_coverage.rs`, 83 lines of
612+ `lanes/av1oracleSkip.report.md`), showing up as 489 deletions for a one-test
613+ change. stream.rs was rebuilt from `f33b9d41`'s copy with only the gate
614+ appended — the reliable form, and the gate guard calls main's shared
615+ `aomdec_available(NAME)`, so the crate keeps ONE presence-check shape.
616+
617+## Item 3 and item 4, verified before anything ran
618+
619+```text
620+$ git diff main --stat
621+ crates/ec-av1/src/decode.rs | 106 ++++++++++++++++++++-----
622+ crates/ec-av1/src/stream.rs | 185 ++++++++++++++++++++++++++++++++++++++++++++
623+ 2 files changed, 271 insertions(+), 20 deletions(-)
624+
625+$ git diff main -- crates/ec-av1/src/decode.rs | grep -cE 'mu_chunk_order|read_intra_chroma_lossless'
626+0
627+
628+$ git diff main --stat -- scripts/ | wc -l
629+0
630+```
631+
632+Two files, no deletions outside them, zero rustfmt churn, no `scripts/` touched.
633+
634+## The straggler twins — NAMED, not merged
635+
636+The class sweep for a second hardcoded halving inside the `decode.rs` this
637+patch touches finds two survivors, and I am reporting them rather than folding
638+them in silently (they are not on this lane's witness, so merging them would be
639+an unmeasured change to another path):
640+
641+| line | function | note |
642+| --- | --- | --- |
643+| `decode.rs:16758` | `decode_intrabc_owned_rect` | the SAME hardcoded `let (cw, ch) = (bw / 2, bh / 2);`. Unreachable on this lane's witness (the `EC_IBCBLOCK` rung shows it is never entered there), but the same latent defect on the same class of 4:4:4 stream. This is the one I would fix first. |
644+| `decode.rs:19846` | `cfl_ac_q3_at` | the same expression, in a different caller family. |
645+
646+The 3-way apply reported **no** conflict in either region and
647+`decode_intrabc_rect` took the patch cleanly; no `Reach::of` twin of the shape
648+fixed elsewhere surfaced in it.
649+
650+## The A/B, on the real tree
651+
652+Both halves rebuilt in the lane-private target dir with `touch` before each
653+run (the shared one has served other worktrees' binaries repeatedly today).
654+
655+```text
656+ MAIN ONLY (f33b9d41) MAIN + THIS LANE
657+-- list 753 tests 754 tests (+1 = my gate)
658+444 ok. 36 passed; 0 failed ok. 37 passed; 0 failed
659+lossless ok. 25 passed; 0 failed ok. 25 passed; 0 failed
660+intrabc_rect ok. 6 passed; 0 failed ok. 7 passed; 0 failed
661+gate_coverage ok. 13 passed; 0 failed ok. 13 passed; 0 failed
662+refusal_inventory ok. 19 passed; 0 failed ok. 19 passed; 0 failed
663+```
664+
665+**Zero failures on either half. No test green on main is red here.** The +1 in
666+`444` and `intrabc_rect` is this lane's gate.
667+
668+Full batch on the committed tree, release, files touched before the build:
669+
670+```text
671+a_444_intrabc_rect_chroma_plane_block ok. 1 passed
672+ 14 rect intra-BC block(s) sized at 4:4:4; 4:2:0 twin byte-exact;
673+ 4:4:4 luma byte-exact (307200/307200), U and V byte-exact to sample 51360
674+a_444_intrabc_rect4 ok. 1 passed
675+lossless_tx_tests ok. 5 passed
676+cargo check -p ec-av1 --all-targets 0 errors, 0 warnings
677+```
678+
679+Red-before unchanged: reverting only the two arithmetic lines makes the gate's
680+luma floor bite at sample **205264** — the exact ceiling
681+`lanes/av1444rect.report.md` rounds 3-4 documented.
682+
683+## CORRECTION (carried forward, unchanged)
684+
685+The relayed **"1910 units matching 1:1 with 486 vs 486 non-zero-bit reads"**
686+figure (source: the review's brief, via Main) does not reproduce. Measured on
687+this branch with the 0-bit filter applied to BOTH sides:
688+
689+```text
690+oracle all_zero reads 2395 (2359 with a real position)
691+our all_zero lines 3999
692+our lines that consumed bits 1326
693+1:1 entry-bit matches, monotone merge 71
694+```
695+
696+**I measure 1326 real reads and 71 interval matches.** Neither figure should be
697+quoted without re-running the measurement; writing an unverified figure as fact
698+is the exact mistake r2 retracted, and this correction stays in the report so it
699+does not survive as a quotable number.
700+
701+## Still open, unchanged
702+
703+The chroma tail is a second ENTROPY fork: ~1069 real `txb_skip` reads are
704+missing versus the oracle, first visible in U and V at **(x=160, y=80) =
705+mi (20, 40)**, spreading to the whole x[320,640) y[160,480) quadrant. The gate
706+pins a measured per-plane exact prefix and says so. The unblock is the one line
707+of oracle instrumentation outside the repo — print `aom_reader_tell(r)` after
708+the `aom_read_symbol` at
709+`~/.cache/aom-oracle/src/av1/decoder/decodetxb.c:158` — then pair on the
710+`(entry, post)` bit INTERVAL, which is exact and collision-free. Coordinate the
711+rebuild; every lane's oracle binary moves. `lane-av1oraclepost` already holds
712+that instrumentation, which is the cheapest route to it.
713+
714+## Provenance
715+
716+`lane-av1oraclepost` independently localised the same fork (the U `txb_skip` at
717+mi (92, 104), from the same hardcoded halving) and has agreed to drop its
718+duplicate hunk in favour of this one. **This branch is the canonical fix for
719+that route**; that branch keeps its oracle instrumentation and its class sweep
720+— and its sweep should pick up the two straggler twins named above.