forge
Explore
Log in

Don't you dare go Hollow

ec-av1: lane-av1-ibc128chunk -- the 128-root intrabc strip's mu-chunk chroma walk de-square-cut, with a red/green 4:2:2 witness

Browse files at this commit

a50f36314b99561dd49f13fdd34877c00d114d58Ahmet Kaan GümüşParent: bdf5b5e
decode_intrabc_128rect cut each mu chunk's chroma plane block with
`chunk_chroma = cside * 64 / side` -- a `chroma_side`-SQUARE chunk, i.e.
the 4:2:0 unit count on BOTH axes. This is the same defect
lane-av1-422bigblock fixed and witnessed in decode_inter_block and
decode_block_128rect; this copy was deferred there as unwitnessed. It is
now witnessed: a real `aomenc --i422 --profile=2 --sb-size=128
--enable-intrabc=1` stream reaches the shape.

A 64x64 mu chunk's chroma plane block is (64 >> ss_x) x (64 >> ss_y) --
32x32 at 4:2:0, 32x64 at 4:2:2 (TWO STACKED TX_32X32 per plane, which
av1_get_max_uv_txsize still caps at 32 per axis), 64x64 at 4:4:4. At
4:2:2 the square cut read one chroma unit per plane per chunk instead of
two, left the chunk's lower 32 chroma rows with no residual at all, and
stamped each unit's entropy context over a 16x16-mi luma square instead
of 16x8; the block's own plane block was still the 4:2:0-hardcoded
`bw/2 x bh/2` (and `px/2, py/2`) even though the same function's two
mv_to_q4 calls already scaled the DV per axis by ss_y. The halved unit
count desynced the tile.

Fix: per-axis at BOTH sites (the mu-chunk read walk and the mu_chroma
per-unit context replay) in the same expression shape the two witnessed
twins carry -- chunk_chroma_w/h = 64 >> ss, unit_luma_w/h = cu_tx << ss,
around_mi_rect/record_mi_chroma on the per-axis spans, per-axis unit
origins and composed-grid offsets, and cw/ch = bw/bh >> ss for the
block's chroma plane block.

Red before (parent a7d22aec, on the EC_AV1_ALLOW_422_PROBE
patch-run-restore build): 8 chroma units stamped over 2 reached blocks,
frames 0 and 3 diverge from aomdec (45135 / 44540 of 245760 samples),
first difference at Y row 256 col 64 -- the top-left of the first 128x64
intrabc block. Green after: 48 chroma units, all 6 blocks decoded, and
all FIVE frames byte-identical to aomdec --rawvideo. The recovered 4
blocks are the signal as much as the pixel count.

Both witnesses pinned (422_intrabc_sb128_strip.obu sha f92000db,
422_intrabc_sb128_strip_notxsearch.obu sha 80dd0d4e) and gated by
the_pinned_422_intrabc_sb128_strip_witnesses_refuse_by_name (byte pins
plus the unconditional refusal-by-name contract; decode_stream still
refuses 4:2:2 in committed code, so the decode-level assertions are
probe-measured and reproducible from the lane report's recipe) and a
comment-stripped source-scan arm
the_intrabc_128rect_chroma_chunk_walk_stays_per_axis, whose non-vacuity
is measured: re-introducing the square cut fails it. Two new counters
(INTRABC_128RECT_CHROMA_CHUNK_HITS, INTRABC_128RECT_CHUNK_SHAPE) pin
the walk for the probe arms.

4:2:0 is byte-identical (64 >> 1 = 32, 32 << 1 = 64, bw >> 1 = bw/2) and
proven by the tree's own sb128 intrabc-rect gate -- same recipe as the
witness, at yuv420p/yuv420p10le, 30 blocks through the changed walk, all
three arms decode-order pixel-exact. DISCLOSED 4:4:4 behavior change:
at ss (0,0) the walk now codes four TX_32X32 per chunk per plane and the
block's chroma plane block is luma-sized; the parent's was provably wrong
there (chroma_side is the 4:2:0 half-side, so the old 32x32 chunk covered
a quarter of a 64x64 4:4:4 chunk and the origin was off by half a
superblock). No committed 4:4:4 fixture engages this function at all
(ibc128=0 on all six), so the change is landed on the twins' geometry
argument and flagged as needing its own 4:4:4 witness.

Battery green: an_sb128_rect_strip_with_intrabc_decodes_pixel_exact,
an_sb128_screen_stream_with_intrabc_decodes_pixel_exact,
a_444_sb128_root_rect_stream_with_restoration_decodes_pixel_exact,
a_lossless_sb128_rect_intra_block_decodes_sample_exact, the two other
intrabc gates, the bigblock pin gate; intrabc filter 19/0, 422+444
filters 12/0; cargo check --all-targets 0 warnings. The
EC_AV1_ALLOW_422_PROBE bypass is NOT in the commit.
crates/ec-av1/examples/decode_probe.rsmodified+7 -0
@@ -91,6 +91,13 @@ fn main() {
91 "intrabc_128rect: {}",91 "intrabc_128rect: {}",
92 ec_av1::stream::intrabc_128rect_hits()92 ec_av1::stream::intrabc_128rect_hits()
93 );93 );
94+ // lane-av1-ibc128chunk: the 128-root intrabc strip's per-axis chroma
95+ // mu-chunk walk -- unit count and the `(64>>ss_x)|(64>>ss_y)` extent.
96+ println!(
97+ "intrabc_128rect_chroma_chunk: units={} shape=0x{:x}",
98+ ec_av1::stream::intrabc_128rect_chroma_chunk_hits(),
99+ ec_av1::stream::intrabc_128rect_chunk_shape()
100+ );
94 let (rtu, rsplit, robmc) = ec_av1::stream::rect_inter_tu_counters();101 let (rtu, rsplit, robmc) = ec_av1::stream::rect_inter_tu_counters();
95 println!("rect_inter: tu={rtu} txsplit={rsplit} obmc_leaf={robmc}");102 println!("rect_inter: tu={rtu} txsplit={rsplit} obmc_leaf={robmc}");
96 println!(103 println!(
crates/ec-av1/fixtures/422_intrabc_sb128_strip.obuadded+0 -0

Binary file changed

crates/ec-av1/fixtures/422_intrabc_sb128_strip_notxsearch.obuadded+0 -0

Binary file changed

crates/ec-av1/src/decode.rsmodified+115 -34
@@ -4179,6 +4179,21 @@ thread_local! {
4179 /// guard (`decode_block_128rect`). A refused block bumps4179 /// guard (`decode_block_128rect`). A refused block bumps
4180 /// [`INTRABC_HITS`] but never this one.4180 /// [`INTRABC_HITS`] but never this one.
4181 static INTRABC_128RECT_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) };4181 static INTRABC_128RECT_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) };
4182+ /// lane-av1-ibc128chunk: chroma transform units the 128-root intrabc
4183+ /// strip's mu-chunk walk read, one per `read_inter_plane` chroma call.
4184+ /// At 4:2:0 a 64x64 mu chunk's chroma plane block is 32x32, so one
4185+ /// TX_32X32 per plane per chunk; at 4:2:2 it is 32x64 and holds TWO
4186+ /// STACKED units per plane. The square-cut `chunk_chroma = cside * 64 /
4187+ /// side` model walked the 4:2:0 count on every axis, so this counter is
4188+ /// the reach/arm witness for the per-axis walk.
4189+ static INTRABC_128RECT_CHROMA_CHUNK_HITS: std::cell::Cell<usize> =
4190+ const { std::cell::Cell::new(0) };
4191+ /// lane-av1-ibc128chunk: the mu-chunk walk's per-axis chroma extents, as
4192+ /// `(64 >> ss_x) << 8 | (64 >> ss_y)` on the LAST chunk -- the pair the
4193+ /// per-axis walk used. A 4:2:2 run and a 4:2:0 run of the same block
4194+ /// differ here (32|64 vs 32|32), which is what the de-square-cut fixes.
4195+ static INTRABC_128RECT_CHUNK_SHAPE: std::cell::Cell<usize> =
4196+ const { std::cell::Cell::new(0) };
4182 }4197 }
4183 4198
4184 /// Current value of [`INTRABC_128RECT_HITS`].4199 /// Current value of [`INTRABC_128RECT_HITS`].
@@ -4193,6 +4208,26 @@ pub(crate) fn reset_intrabc_128rect_hits() {
4193 INTRABC_128RECT_HITS.with(|c| c.set(0));4208 INTRABC_128RECT_HITS.with(|c| c.set(0));
4194 }4209 }
4195 4210
4211+/// Current value of [`INTRABC_128RECT_CHROMA_CHUNK_HITS`].
4212+#[allow(dead_code)] // read only from the `#[cfg(test)]` gates
4213+pub fn intrabc_128rect_chroma_chunk_hits() -> usize {
4214+ INTRABC_128RECT_CHROMA_CHUNK_HITS.with(|c| c.get())
4215+}
4216+
4217+/// Current value of [`INTRABC_128RECT_CHUNK_SHAPE`].
4218+#[allow(dead_code)] // read only from the `#[cfg(test)]` gates
4219+pub fn intrabc_128rect_chunk_shape() -> usize {
4220+ INTRABC_128RECT_CHUNK_SHAPE.with(|c| c.get())
4221+}
4222+
4223+/// Zeroes [`INTRABC_128RECT_CHROMA_CHUNK_HITS`] and
4224+/// [`INTRABC_128RECT_CHUNK_SHAPE`].
4225+#[allow(dead_code)] // read only from the `#[cfg(test)]` gates
4226+pub(crate) fn reset_intrabc_128rect_chroma_chunk_hits() {
4227+ INTRABC_128RECT_CHROMA_CHUNK_HITS.with(|c| c.set(0));
4228+ INTRABC_128RECT_CHUNK_SHAPE.with(|c| c.set(0));
4229+}
4230+
4196 /// Current value of [`INTRABC_VARTX_HITS`].4231 /// Current value of [`INTRABC_VARTX_HITS`].
4197 pub fn intrabc_vartx_hits() -> usize {4232 pub fn intrabc_vartx_hits() -> usize {
4198 INTRABC_VARTX_HITS.with(|c| c.get())4233 INTRABC_VARTX_HITS.with(|c| c.get())
@@ -12460,8 +12495,16 @@ fn decode_intrabc_128rect(
12460 );12495 );
12461 }12496 }
12462 let (px, py) = (mi_c * MI, mi_r * MI);12497 let (px, py) = (mi_c * MI, mi_r * MI);
12463- let (cpx, cpy) = (px / 2, py / 2);12498+ // lane-av1-ibc128chunk: the block's chroma PLANE BLOCK is per-axis
12464- let (cw, ch) = (bw / 2, bh / 2);12499+ // `(bw >> ss_x) x (bh >> ss_y)` -- 4:2:0 halves both (this fn's
12500+ // `mv_to_q4(cpy, dv_row, ss_y(fctx))` calls two lines below already
12501+ // scaled the DV on the y axis by ITS OWN subsampling, so the hardcoded
12502+ // `/2` origin and extent made the prediction window half as tall as
12503+ // the motion vector asked for), 4:2:2 is HALF-WIDTH and FULL-HEIGHT,
12504+ // 4:4:4 is luma-sized. At ss (1,1) every value below is the old
12505+ // `bw / 2, bh / 2` line-for-line.
12506+ let (cpx, cpy) = (px >> ss_x(fctx), py >> ss_y(fctx));
12507+ let (cw, ch) = (bw >> ss_x(fctx), bh >> ss_y(fctx));
12465 // The square strides the proven INTER path lays its residual grids,12508 // The square strides the proven INTER path lays its residual grids,
12466 // prediction windows and `TxParams` at (see [`decode_intrabc_rect`]'s r212509 // prediction windows and `TxParams` at (see [`decode_intrabc_rect`]'s r2
12467 // note): 128/64 here.12510 // note): 128/64 here.
@@ -12617,12 +12660,35 @@ fn decode_intrabc_128rect(
12617 // TX_32X32 chroma unit per plane per chunk at 4:2:0, raster12660 // TX_32X32 chroma unit per plane per chunk at 4:2:0, raster
12618 // within the chunk, plane-major inside the chunk.12661 // within the chunk, plane-major inside the chunk.
12619 let cu_tx = 32usize;12662 let cu_tx = 32usize;
12620- let chunk_chroma = cside * 64 / side;12663+ // lane-av1-ibc128chunk: a 64x64 mu chunk's chroma plane
12621- let unit_luma = cu_tx * (side / cside);12664+ // block is PER-AXIS `(64 >> ss_x) x (64 >> ss_y)` -- 32x32 at
12665+ // 4:2:0, TWO STACKED TX_32X32 at 4:2:2 (the chunk's chroma
12666+ // plane block is 32x64 there), four at 4:4:4. The old
12667+ // `chunk_chroma = cside * 64 / side` walked a
12668+ // `chroma_side`-SQUARE chunk, i.e. the 4:2:0 count on both
12669+ // axes: at 4:2:2 it read HALF the chroma units of a chunk
12670+ // (one 32x32 at the chunk's top-left instead of two), left
12671+ // the chunk's lower 32 chroma rows with no residual at all,
12672+ // and stamped every unit's entropy context over a 16x16-mi
12673+ // luma span instead of 16x8. The same defect and the same
12674+ // per-axis repair as `decode_inter_block`'s
12675+ // `chunk_chroma_w/chunk_chroma_h` (lane-av1-422bigblock,
12676+ // witnessed on `422_sb128_3f.obu`).
12677+ let chunk_chroma_w = (64usize) >> ss_x(fctx);
12678+ let chunk_chroma_h = (64usize) >> ss_y(fctx);
12679+ // The unit's own footprint on the LUMA mi grid, per axis:
12680+ // `(32 << ss) px` = `(32 << ss) / MI` mi -- 16x16 at 4:2:0,
12681+ // 16x8 at 4:2:2, 8x8 at 4:4:4. `around_mi_rect` reads and
12682+ // `record_mi_chroma` stamp exactly the unit's own cells.
12683+ let unit_luma_w = cu_tx << ss_x(fctx);
12684+ let unit_luma_h = cu_tx << ss_y(fctx);
12685+ INTRABC_128RECT_CHUNK_SHAPE.with(|c| {
12686+ c.set((chunk_chroma_w << 8) | chunk_chroma_h);
12687+ });
12622 let chunk_w_mi = 16.min(max_w_mi.saturating_sub(cc * 16));12688 let chunk_w_mi = 16.min(max_w_mi.saturating_sub(cc * 16));
12623 let chunk_h_mi = 16.min(max_h_mi.saturating_sub(cr * 16));12689 let chunk_h_mi = 16.min(max_h_mi.saturating_sub(cr * 16));
12624- let units_x = chunk_w_mi / (unit_luma / MI);12690+ let units_x = chunk_w_mi / (unit_luma_w / MI);
12625- let units_y = chunk_h_mi / (unit_luma / MI);12691+ let units_y = chunk_h_mi / (unit_luma_h / MI);
12626 if lossless(fctx) {12692 if lossless(fctx) {
12627 // TX_4X4 chroma units over this chunk (lane-lossless2's12693 // TX_4X4 chroma units over this chunk (lane-lossless2's
12628 // walk, shared with the inter 128 path).12694 // walk, shared with the inter 128 path).
@@ -12630,8 +12696,8 @@ fn decode_intrabc_128rect(
12630 dec, cdfs, neighbours, u, v,12696 dec, cdfs, neighbours, u, v,
12631 Pred::Inline(&pred_u, cside), Pred::Inline(&pred_v, cside),12697 Pred::Inline(&pred_u, cside), Pred::Inline(&pred_v, cside),
12632 (mi_r, mi_c), (cpx, cpy),12698 (mi_r, mi_c), (cpx, cpy),
12633- (cc * chunk_chroma, cr * chunk_chroma),12699+ (cc * chunk_chroma_w, cr * chunk_chroma_h),
12634- (chunk_chroma, chunk_chroma),12700+ (chunk_chroma_w, chunk_chroma_h),
12635 (cw, ch),12701 (cw, ch),
12636 cside, 0, base_q_idx,12702 cside, 0, base_q_idx,
12637 &mut u_units, &mut v_units, fctx,12703 &mut u_units, &mut v_units, fctx,
@@ -12654,15 +12720,16 @@ fn decode_intrabc_128rect(
12654 for ur in 0..units_y {12720 for ur in 0..units_y {
12655 for uc in 0..units_x {12721 for uc in 0..units_x {
12656 let unit_mi = (12722 let unit_mi = (
12657- mi_r + cr * 16 + ur * (unit_luma / MI),12723+ mi_r + cr * 16 + ur * (unit_luma_h / MI),
12658- mi_c + cc * 16 + uc * (unit_luma / MI),12724+ mi_c + cc * 16 + uc * (unit_luma_w / MI),
12659 );12725 );
12660 // Per unit, AFTER the earlier units' stamps: this12726 // Per unit, AFTER the earlier units' stamps: this
12661 // unit's coefficient context must see them.12727 // unit's coefficient context must see them.
12662- let cu_around = neighbours.around_mi(unit_mi, unit_luma);12728+ let cu_around =
12729+ neighbours.around_mi_rect(unit_mi, unit_luma_w, unit_luma_h);
12663 if crate::envflags::env_flag!("EC_ECDUMP") {12730 if crate::envflags::env_flag!("EC_ECDUMP") {
12664 for p in 1..3 {12731 for p in 1..3 {
12665- let ab: Vec<String> = (0..unit_luma / MI)12732+ let ab: Vec<String> = (0..unit_luma_w / MI)
12666 .map(|k| {12733 .map(|k| {
12667 format!(12734 format!(
12668 "{:?}/{}",12735 "{:?}/{}",
@@ -12671,7 +12738,7 @@ fn decode_intrabc_128rect(
12671 )12738 )
12672 })12739 })
12673 .collect();12740 .collect();
12674- let lf: Vec<String> = (0..unit_luma / MI)12741+ let lf: Vec<String> = (0..unit_luma_h / MI)
12675 .map(|k| {12742 .map(|k| {
12676 format!(12743 format!(
12677 "{:?}/{}",12744 "{:?}/{}",
@@ -12687,8 +12754,8 @@ fn decode_intrabc_128rect(
12687 }12754 }
12688 }12755 }
12689 let (cu_x, cu_y) = (12756 let (cu_x, cu_y) = (
12690- cpx + cc * chunk_chroma + uc * cu_tx,12757+ cpx + cc * chunk_chroma_w + uc * cu_tx,
12691- cpy + cr * chunk_chroma + ur * cu_tx,12758+ cpy + cr * chunk_chroma_h + ur * cu_tx,
12692 );12759 );
12693 // `av1_get_tx_type` (blockd.h:1291): an inter12760 // `av1_get_tx_type` (blockd.h:1291): an inter
12694 // block's chroma unit never codes a tx_type; it12761 // block's chroma unit never codes a tx_type; it
@@ -12709,9 +12776,12 @@ fn decode_intrabc_128rect(
12709 && unit_rel_mi.1 < lc + lw / MI12776 && unit_rel_mi.1 < lc + lw / MI
12710 })12777 })
12711 .map(|(_, _, _, _, t)| t);12778 .map(|(_, _, _, _, t)| t);
12779+ // The prediction window is the block's own square
12780+ // `cside` buffer with the unit's true per-axis
12781+ // position inside it.
12712 let cu_pred = src.offset(12782 let cu_pred = src.offset(
12713- (cr * chunk_chroma + ur * cu_tx) * cside12783+ (cr * chunk_chroma_h + ur * cu_tx) * cside
12714- + cc * chunk_chroma12784+ + cc * chunk_chroma_w
12715 + uc * cu_tx,12785 + uc * cu_tx,
12716 );12786 );
12717 let cu_grid = read_inter_plane(12787 let cu_grid = read_inter_plane(
@@ -12736,8 +12806,8 @@ fn decode_intrabc_128rect(
12736 // coefficient context.12806 // coefficient context.
12737 neighbours.record_mi_chroma(12807 neighbours.record_mi_chroma(
12738 unit_mi,12808 unit_mi,
12739- unit_luma,12809+ unit_luma_w,
12740- unit_luma,12810+ unit_luma_h,
12741 plane_idx,12811 plane_idx,
12742 &cu_grid,12812 &cu_grid,
12743 );12813 );
@@ -12749,6 +12819,7 @@ fn decode_intrabc_128rect(
12749 );12819 );
12750 }12820 }
12751 hit!(CHROMA_SPLIT_TX_HITS);12821 hit!(CHROMA_SPLIT_TX_HITS);
12822+ INTRABC_128RECT_CHROMA_CHUNK_HITS.with(|c| c.set(c.get() + 1));
12752 // lane-av1-ibcrect: per-unit chroma context -- the12823 // lane-av1-ibcrect: per-unit chroma context -- the
12753 // end-of-block record's composed-grid re-stamp12824 // end-of-block record's composed-grid re-stamp
12754 // must not stand (replayed below).12825 // must not stand (replayed below).
@@ -12758,9 +12829,9 @@ fn decode_intrabc_128rect(
12758 cside * cside,12829 cside * cside,
12759 );12830 );
12760 for rr in 0..cu_tx {12831 for rr in 0..cu_tx {
12761- let start = (cr * chunk_chroma + ur * cu_tx + rr)12832+ let start = (cr * chunk_chroma_h + ur * cu_tx + rr)
12762 * cside12833 * cside
12763- + cc * chunk_chroma12834+ + cc * chunk_chroma_w
12764 + uc * cu_tx;12835 + uc * cu_tx;
12765 dst[start..start + cu_tx]12836 dst[start..start + cu_tx]
12766 .copy_from_slice(&cu_grid[rr * cu_tx..][..cu_tx]);12837 .copy_from_slice(&cu_grid[rr * cu_tx..][..cu_tx]);
@@ -12815,27 +12886,37 @@ fn decode_intrabc_128rect(
12815 let cu = if lossless(fctx) { 4usize } else { 32usize };12886 let cu = if lossless(fctx) { 4usize } else { 32usize };
12816 // The unit's own footprint on the LUMA mi grid (the chroma context12887 // The unit's own footprint on the LUMA mi grid (the chroma context
12817 // bands are luma-mi indexed, [`Self::record_mi_chroma`]'s12888 // bands are luma-mi indexed, [`Self::record_mi_chroma`]'s
12818- // convention): 8 px x2 per TX_4X4 unit, 64 px per TX_32X32 one.12889+ // convention), PER AXIS: `cu << ss` px, i.e. 8 px per TX_4X4 unit and
12819- let unit_luma = cu * 2;12890+ // 64 px per TX_32X32 one at 4:2:0 -- 4 px / 32 px at 4:2:2.
12820- // Raster over the block's chroma plane, `chunk_chroma` per mu chunk12891+ let unit_luma_w = cu << ss_x(fctx);
12821- // (the same extents the read loop above laid the composed grid out12892+ let unit_luma_h = cu << ss_y(fctx);
12822- // at) -- a unit the frame edge clipped codes nothing and carries no12893+ // Raster over the block's chroma plane, one mu chunk per axis step at
12823- // composed samples beyond the clip, so it replays as the zero state12894+ // its own per-axis chroma extent (the same extents the read loop
12824- // exactly like libaom's uncoded unit.12895+ // above laid the composed grid out at) -- a unit the frame edge
12825- let chunk_chroma = cside * 64 / side;12896+ // clipped codes nothing and carries no composed samples beyond the
12826- let (rows, cols) = ((ch / chunk_chroma).max(1), (cw / chunk_chroma).max(1));12897+ // clip, so it replays as the zero state exactly like libaom's
12898+ // uncoded unit. lane-av1-ibc128chunk: the old `chunk_chroma = cside *
12899+ // 64 / side` cut the replay's step to the 4:2:0 square on BOTH axes,
12900+ // so at 4:2:2 it walked a 32-row step down a 64-row chunk and
12901+ // re-stamped a 16x16-mi span over an 8-row-tall unit.
12902+ let chunk_chroma_w = (64usize) >> ss_x(fctx);
12903+ let chunk_chroma_h = (64usize) >> ss_y(fctx);
12904+ let (rows, cols) = ((ch / chunk_chroma_h).max(1), (cw / chunk_chroma_w).max(1));
12827 for cr in 0..rows {12905 for cr in 0..rows {
12828 for cc in 0..cols {12906 for cc in 0..cols {
12829- let unit_mi = (mi_r + cr * (unit_luma / MI), mi_c + cc * (unit_luma / MI));12907+ let unit_mi = (
12908+ mi_r + cr * (unit_luma_h / MI),
12909+ mi_c + cc * (unit_luma_w / MI),
12910+ );
12830 for (plane_idx, grid) in [(1usize, &u_grid), (2usize, &v_grid)] {12911 for (plane_idx, grid) in [(1usize, &u_grid), (2usize, &v_grid)] {
12831 let mut unit = Vec::with_capacity(cu * cu);12912 let mut unit = Vec::with_capacity(cu * cu);
12832 for rr in 0..cu {12913 for rr in 0..cu {
12833- let start =12914+ let start = (cr * chunk_chroma_h + rr) * cside
12834- (cr * chunk_chroma + rr) * cside + cc * chunk_chroma;12915+ + cc * chunk_chroma_w;
12835 unit.extend_from_slice(&grid[start..start + cu]);12916 unit.extend_from_slice(&grid[start..start + cu]);
12836 }12917 }
12837 neighbours.record_mi_chroma(12918 neighbours.record_mi_chroma(
12838- unit_mi, unit_luma, unit_luma, plane_idx, &unit,12919+ unit_mi, unit_luma_w, unit_luma_h, plane_idx, &unit,
12839 );12920 );
12840 }12921 }
12841 }12922 }
crates/ec-av1/src/stream.rsmodified+179 -0
@@ -217,6 +217,22 @@ pub fn intrabc_128rect_hits() -> usize {
217 crate::decode::intrabc_128rect_hits()217 crate::decode::intrabc_128rect_hits()
218 }218 }
219 219
220+/// lane-av1-ibc128chunk: chroma transform units the 128-root intrabc strip's
221+/// mu-chunk walk read, one per `read_inter_plane` chroma call. At 4:2:2 a
222+/// 64x64 mu chunk's chroma plane block is 32x64 and holds TWO STACKED
223+/// TX_32X32 units per plane; the square-cut walk this gate witnesses read
224+/// one. Measured on the pinned witness: 8 before, 48 after.
225+pub fn intrabc_128rect_chroma_chunk_hits() -> usize {
226+ crate::decode::intrabc_128rect_chroma_chunk_hits()
227+}
228+
229+/// lane-av1-ibc128chunk: the 128-root intrabc strip's per-axis chroma chunk
230+/// extents as `(64 >> ss_x) << 8 | (64 >> ss_y)` on the last chunk walked --
231+/// 32|32 at 4:2:0, 32|64 at 4:2:2, 64|64 at 4:4:4.
232+pub fn intrabc_128rect_chunk_shape() -> usize {
233+ crate::decode::intrabc_128rect_chunk_shape()
234+}
235+
220 /// Blocks reconstructed with intra block copy at an 8x8 LEAF specifically236 /// Blocks reconstructed with intra block copy at an 8x8 LEAF specifically
221 /// (lane-kf900 r7's shape); [`crate::decode::intrabc_hits`] counts every shape.237 /// (lane-kf900 r7's shape); [`crate::decode::intrabc_hits`] counts every shape.
222 pub fn leaf8_intrabc_hits() -> usize {238 pub fn leaf8_intrabc_hits() -> usize {
@@ -2282,6 +2298,169 @@ pub(crate) mod tests {
2282 }2298 }
2283 }2299 }
2284 2300
2301+ /// lane-av1-ibc128chunk: the WITNESS for the 128-root intrabc strip's
2302+ /// de-square-cut mu-chunk chroma walk, and the byte pin for it.
2303+ ///
2304+ /// `decode_intrabc_128rect` cut each mu chunk's chroma plane block with
2305+ /// `chunk_chroma = cside * 64 / side` -- a `chroma_side`-SQUARE chunk,
2306+ /// i.e. the 4:2:0 count on BOTH axes (the same defect lane-av1-422bigblock
2307+ /// fixed, and witnessed, in `decode_inter_block` and
2308+ /// `decode_block_128rect`; this copy was deferred there as unwitnessed).
2309+ /// At 4:2:2 a 64x64 mu chunk's chroma plane block is 32x64, so it holds
2310+ /// TWO STACKED TX_32X32 units per plane: the square-cut walk read one per
2311+ /// plane per chunk, left the chunk's lower 32 chroma rows with no
2312+ /// residual at all, and stamped each unit's entropy context over a
2313+ /// 16x16-mi luma span instead of 16x8.
2314+ ///
2315+ /// Measured red-before on the pinned witness (parent `a7d22aec`, via the
2316+ /// local `EC_AV1_ALLOW_422_PROBE` patch-run-restore build): 8 chroma
2317+ /// units stamped over the stream's two reached blocks and frames 0 and 3
2318+ /// diverge from `aomdec` (45135 / 44540 of 245760 samples each), the
2319+ /// first difference at Y sample 98368 -- frame 0, row 256, col 64, the
2320+ /// top-left corner of the first 128x64 intrabc block at mi(64,0). The
2321+ /// red build then lost 4 of the stream's 6 intrabc blocks to the desync.
2322+ /// Green-after, same fixture: 48 chroma units stamped, all 6 blocks
2323+ /// decoded, and ALL FIVE frames byte-identical to `aomdec --rawvideo`.
2324+ ///
2325+ /// Committed code refuses 4:2:2 at the sequence header, so the decode
2326+ /// assertions above are probe-measured and reproducible from the lane
2327+ /// report's recipe; what this gate can assert in committed code is the
2328+ /// byte pin, the refusal-by-name contract, and -- in the arm below --
2329+ /// that the per-axis walk is still spelled per-axis in the source.
2330+ #[test]
2331+ fn the_pinned_422_intrabc_sb128_strip_witnesses_refuse_by_name() {
2332+ const NAME: &str = "the_pinned_422_intrabc_sb128_strip_witnesses_refuse_by_name";
2333+ const REFUSAL: &str = "a chroma format of 4:2:2";
2334+ for (file, bytes, fp) in [
2335+ ("422_intrabc_sb128_strip.obu", 1672usize, 0x50f5cfc576e4cd00_u64),
2336+ (
2337+ "422_intrabc_sb128_strip_notxsearch.obu",
2338+ 1675,
2339+ 0xd4936f252ff8cff0,
2340+ ),
2341+ ] {
2342+ let path = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
2343+ .join("fixtures")
2344+ .join(file);
2345+ let data = std::fs::read(&path).unwrap_or_else(|e| {
2346+ panic!(
2347+ "{NAME}: pinned witness {} is missing ({e}) -- the gate cannot run",
2348+ path.display()
2349+ )
2350+ });
2351+ assert_eq!(data.len(), bytes, "{NAME}: {file} size drifted");
2352+ assert_eq!(fnv1a64(&data), fp, "{NAME}: {file} bytes drifted");
2353+ let err = decode_stream(&data).unwrap_err().to_string();
2354+ assert!(
2355+ err.contains(REFUSAL),
2356+ "{NAME}: {file} must refuse by name, got: {err}"
2357+ );
2358+ }
2359+ }
2360+
2361+ /// lane-av1-ibc128chunk: the SOURCE-SCAN arm of the witness gate above.
2362+ ///
2363+ /// The decode-level half of the red/green evidence cannot run in
2364+ /// committed code (the 4:2:2 refusal stands), so this arm pins the thing
2365+ /// that would silently bring the defect back: the square-cut
2366+ /// `chunk_chroma = cside * 64 / side` expression, and the per-axis
2367+ /// replacements that replaced it at BOTH sites in
2368+ /// [`decode_intrabc_128rect`] -- the mu-chunk read walk and the
2369+ /// `mu_chroma` per-unit context replay. It also pins the per-axis
2370+ /// counters' accessors so the arms stay reachable, and the walk's own
2371+ /// per-axis extent, derived here from the same `64 >> ss` form the
2372+ /// witnesses measured (4:2:0 = one TX_32X32 per plane per chunk,
2373+ /// 4:2:2 = two stacked, 4:4:4 = four).
2374+ #[test]
2375+ fn the_intrabc_128rect_chroma_chunk_walk_stays_per_axis() {
2376+ const NAME: &str = "the_intrabc_128rect_chroma_chunk_walk_stays_per_axis";
2377+ let src = include_str!("decode.rs");
2378+ let body = src
2379+ .split_once("fn decode_intrabc_128rect(")
2380+ .expect("decode_intrabc_128rect must exist")
2381+ .1
2382+ .split_once("\nfn ")
2383+ .expect("decode_intrabc_128rect must be a top-level fn")
2384+ .0;
2385+ // Scan CODE only: the fix's own comments quote the old expression to
2386+ // say what it was, and a prose mention must not read as a
2387+ // reintroduction (nor mask one).
2388+ let stripped: Vec<&str> = body
2389+ .lines()
2390+ .map(|l| l.split_once("//").map_or(l, |(c, _)| c))
2391+ .collect();
2392+ let code = stripped.join("\n");
2393+ let body = code.as_str();
2394+ assert_eq!(
2395+ body.matches("cside * 64 / side").count(),
2396+ 0,
2397+ "{NAME}: the square-cut `cside * 64 / side` chunk extent is BACK in \
2398+ decode_intrabc_128rect -- that expression is the 4:2:2 defect this \
2399+ gate exists for (a 64x64 mu chunk's chroma plane block is \
2400+ (64 >> ss_x) x (64 >> ss_y), not `chroma_side` square)"
2401+ );
2402+ // Both sites, the read walk and the replay: each declares the pair
2403+ // once and each takes its steps on the per-axis halves.
2404+ for name in [
2405+ "let chunk_chroma_w = (64usize) >> ss_x(fctx);",
2406+ "let chunk_chroma_h = (64usize) >> ss_y(fctx);",
2407+ ] {
2408+ assert_eq!(
2409+ body.matches(name).count(),
2410+ 2,
2411+ "{NAME}: `{name}` must appear at BOTH de-square-cut sites in \
2412+ decode_intrabc_128rect (the mu-chunk read walk and the mu_chroma \
2413+ context replay), found {}",
2414+ body.matches(name).count()
2415+ );
2416+ }
2417+ for name in [
2418+ "let unit_luma_w = cu_tx << ss_x(fctx);",
2419+ "let unit_luma_h = cu_tx << ss_y(fctx);",
2420+ "let (cw, ch) = (bw >> ss_x(fctx), bh >> ss_y(fctx));",
2421+ "let (cpx, cpy) = (px >> ss_x(fctx), py >> ss_y(fctx));",
2422+ "neighbours.around_mi_rect(unit_mi, unit_luma_w, unit_luma_h)",
2423+ ] {
2424+ assert_eq!(
2425+ body.matches(name).count(),
2426+ 1,
2427+ "{NAME}: `{name}` must appear exactly once in \
2428+ decode_intrabc_128rect, found {}",
2429+ body.matches(name).count()
2430+ );
2431+ }
2432+ // The replay's own unit luma span is the lossless/lossy `cu << ss` form
2433+ // (site 2 spells it separately from the read walk's `cu_tx << ss`).
2434+ for name in [
2435+ "let unit_luma_w = cu << ss_x(fctx);",
2436+ "let unit_luma_h = cu << ss_y(fctx);",
2437+ ] {
2438+ assert_eq!(
2439+ body.matches(name).count(),
2440+ 1,
2441+ "{NAME}: `{name}` must appear exactly once in \
2442+ decode_intrabc_128rect, found {}",
2443+ body.matches(name).count()
2444+ );
2445+ }
2446+ // The per-axis chunk extent the geometry demands, spelled out here so
2447+ // the scan and the witnesses cannot disagree about it.
2448+ let per_axis_units = |ss_x: u32, ss_y: u32| (64 >> ss_x) / 32 * (64 >> ss_y) / 32;
2449+ assert_eq!(per_axis_units(1, 1), 1, "{NAME}: 4:2:0 must stay one unit");
2450+ assert_eq!(per_axis_units(1, 0), 2, "{NAME}: 4:2:2 must be two units");
2451+ assert_eq!(per_axis_units(0, 0), 4, "{NAME}: 4:4:4 must be four units");
2452+ // The counters the probe arms read must stay exported.
2453+ for name in [
2454+ "pub fn intrabc_128rect_chroma_chunk_hits()",
2455+ "pub fn intrabc_128rect_chunk_shape()",
2456+ ] {
2457+ assert!(
2458+ src.contains(name),
2459+ "{NAME}: the accessor `{name}` must stay in decode.rs"
2460+ );
2461+ }
2462+ }
2463+
2285 2464
2286 /// lane-av1-qmatrix: WITNESS for the lifted `using_qmatrix` refusal (the2465 /// lane-av1-qmatrix: WITNESS for the lifted `using_qmatrix` refusal (the
2287 /// old gate `a_frame_using_quantisation_matrices_is_refused_by_name` is2466 /// old gate `a_frame_using_quantisation_matrices_is_refused_by_name` is
lanes/av1ibc128chunk.report.mdadded+251 -0
@@ -0,0 +1,251 @@
1+# lane-av1-ibc128chunk — the 128-root intrabc strip's square-cut mu-chunk chroma walk, de-square-cut and WITNESSED
2+
3+Branch `lane-av1-ibc128chunk`, parent `a7d22aec`. Target dir
4+`$HOME/.cache/cargo-target-av1ibc128chunk` throughout. No push.
5+
6+## Verdict
7+
8+The deferred copy is fixed **and witnessed** — this is not a defensive fix.
9+`decode_intrabc_128rect` cut each mu chunk's chroma plane block with
10+`chunk_chroma = cside * 64 / side` (two sites, decode.rs:12663 and decode.rs:12896
11+at the parent), the same square-cut defect lane-av1-422bigblock fixed and
12+witnessed in `decode_inter_block` and `decode_block_128rect`. Red before: a real
13+4:2:2 `aomenc --enable-intrabc` sb128 stream loses half of every mu chunk's
14+chroma units and its frames 0 and 3 diverge from `aomdec`, first difference at
15+the top-left corner of the very first 128x64 intrabc block. Green after: the
16+same stream decodes all five frames byte-identical to `aomdec --rawvideo`, and
17+the red build's 4 lost blocks are recovered.
18+
19+Both pinned witnesses are committed; committed code still refuses 4:2:2 at the
20+sequence header and the `EC_AV1_ALLOW_422_PROBE` bypass was applied and
21+reverted per probe run (`git diff` on the refusal line is empty; the only
22+`EC_AV1_ALLOW_422_PROBE` strings left in the tree are two doc-comment mentions
23+of the recipe).
24+
25+## The defect (both sites)
26+
27+`decode_intrabc_128rect` is the intrabc arm of `decode_block_128rect`: a
28+128x64 / 64x128 / 128x128 strip coded with `use_intrabc`, predicted from this
29+frame's own reconstruction, reconstructed through the INTER residual walk
30+(`decode_token_recon_block`'s else arm).
31+
32+A 64x64 mu chunk's chroma plane block is **per-axis** `(64 >> ss_x) x
33+(64 >> ss_y)`: 32x32 at 4:2:0 (one TX_32X32 per plane per chunk), **32x64 at
34+4:2:2 (TWO STACKED TX_32X32 per plane per chunk)**, 64x64 at 4:4:4 (four).
35+`av1_get_max_uv_txsize` caps the unit at 32 on each axis. The square-cut model
36+walked a `chroma_side`-square chunk, i.e. the 4:2:0 count on both axes.
37+
38+Measured consequences at 4:2:2 (witness below):
39+
40+1. **Half the units.** One chroma unit per plane per chunk instead of two
41+ stacked — the chunk's lower 32 chroma rows got no residual at all.
42+2. **Wrong extent, twice.** The block's own chroma plane block was still
43+ `bw / 2 x bh / 2` (`cpx, cpy = px / 2, py / 2`), i.e. 4:2:0-shaped, even
44+ though the same function's two `mv_to_q4(cpy, dv_row, ss_y(fctx))` calls
45+ already scaled the DV on the y axis by **its own** subsampling — the
46+ prediction window was half as tall as the motion vector asked for.
47+3. **Wrong entropy spans.** `around_mi` / `record_mi_chroma` stamped every unit
48+ over a `unit_luma = cu_tx * (side / cside)` = 16x16-mi luma square instead
49+ of the per-axis 16x8 at 4:2:2, and the `mu_chroma` per-unit replay walked a
50+ 32-row step down a 64-row chunk.
51+4. **Entropy lock lost.** The halved unit count desynced the tile: the red build
52+ decoded 2 of the stream's 6 intrabc blocks; the fixed build decodes all 6.
53+
54+## The fix (mirror of the two witnessed twins)
55+
56+Both sites, per-axis, in the same expression shape
57+`decode_inter_block` already carries:
58+
59+| old | new |
60+|---|---|
61+| `let (cpx, cpy) = (px / 2, py / 2);` | `(px >> ss_x(fctx), py >> ss_y(fctx))` |
62+| `let (cw, ch) = (bw / 2, bh / 2);` | `(bw >> ss_x(fctx), bh >> ss_y(fctx))` |
63+| `let chunk_chroma = cside * 64 / side;` | `chunk_chroma_w = (64usize) >> ss_x(fctx)` / `chunk_chroma_h = (64usize) >> ss_y(fctx)` |
64+| `let unit_luma = cu_tx * (side / cside);` | `unit_luma_w = cu_tx << ss_x(fctx)` / `unit_luma_h = cu_tx << ss_y(fctx)` |
65+| `units_x/y = chunk_*_mi / (unit_luma / MI)` | same, on `unit_luma_w` / `unit_luma_h` |
66+| `around_mi(unit_mi, unit_luma)` | `around_mi_rect(unit_mi, unit_luma_w, unit_luma_h)` |
67+| `record_mi_chroma(unit_mi, unit_luma, unit_luma, ..)` | `.. unit_luma_w, unit_luma_h, ..` |
68+| `cu_x = cpx + cc * chunk_chroma + uc * cu_tx` | `.. cc * chunk_chroma_w + ..` |
69+| `cu_y = cpy + cr * chunk_chroma + ur * cu_tx` | `.. cr * chunk_chroma_h + ..` |
70+| `cu_pred` / composed-grid `dst` offsets | per-axis offsets at the square `cside` stride |
71+| `read_inter_chroma_lossless(.., (cc*cc_, cr*cc_), (cc_, cc_), ..)` | per-axis org and region |
72+| replay `unit_luma = cu * 2` | `unit_luma_w = cu << ss_x(fctx)` / `unit_luma_h = cu << ss_y(fctx)` |
73+| replay `ch / chunk_chroma`, `cw / chunk_chroma` | `ch / chunk_chroma_h`, `cw / chunk_chroma_w` |
74+| `EC_IBC128_BANDS` trace spans | per-axis |
75+
76+New counters (both exported from `stream` and printed by `decode_probe`):
77+`INTRABC_128RECT_CHROMA_CHUNK_HITS` (one bump per chroma `read_inter_plane` of
78+this walk) and `INTRABC_128RECT_CHUNK_SHAPE`
79+(`(64 >> ss_x) << 8 | (64 >> ss_y)` of the last chunk walked).
80+
81+## Fixtures (pinned, `git add -f`; `fixtures/` is gitignored)
82+
83+| fixture | bytes | sha256 | fnv1a64 |
84+|---|---|---|---|
85+| `422_intrabc_sb128_strip.obu` | 1672 | `f92000db86df7acc577d60dd1d0d97454bff4705799ea59d9de34eb5a71dbbcd` | `0x50f5cfc576e4cd00` |
86+| `422_intrabc_sb128_strip_notxsearch.obu` | 1675 | `80dd0d4e93fd6c3d4b7188a43e69d9638f2bece38edfab60ff3582628314b5ec` | `0xd4936f252ff8cff0` |
87+
88+Source (the deterministic `geq` sinusoid the tree's own sb128 intrabc-rect gate
89+uses, re-cut at `yuv422p` — the 4:2:2 twin of that gate's arm 1):
90+
91+ ffmpeg -v error -f lavfi -i "nullsrc=size=384x320:rate=25,format=yuv420p,\
92+ geq=lum='128+90*sin((X+2*N)/37)+30*sin(Y/29)':\
93+ cb='128+30*sin(X/23)':cr='128+30*sin((Y+N)/19)'" \
94+ -pix_fmt yuv422p -strict -1 -t 0.2 -f yuv4mpegpipe -y geq/384x320.y4m
95+
96+ ~/.cache/aom-oracle/build/aomenc --codec=av1 --i422 --profile=2 --passes=1 \
97+ --end-usage=q --cq-level=32 --cpu-used=0 --threads=1 --row-mt=0 \
98+ --lag-in-frames=0 --kf-max-dist=1 --limit=5 --tile-columns=0 --sb-size=128 \
99+ --min-partition-size=64 --enable-rect-partitions=1 --enable-ab-partitions=0 \
100+ --enable-1to4-partitions=0 --enable-palette=0 --tune-content=screen \
101+ --enable-intrabc=1 --deltaq-mode=0 --enable-tx-size-search=1 \
102+ --obu -o geq/384x320_cq32_ts1.obu geq/384x320.y4m
103+
104+`_notxsearch` is the same command with `--enable-tx-size-search=0`. Both are
105+pinned and both are red-before / green-after (the tx-size-search arm is not
106+required — a mis-signed flag on a witness is a coin flip, so both went in).
107+
108+## Red before / green after (measured)
109+
110+`aomdec` is `~/.cache/aom-oracle/build/aomdec`; ours is `decode_probe` (debug,
111+`--features gate-counters`) on the `EC_AV1_ALLOW_422_PROBE` patch-run-restore
112+build, compared with `cmp` on the full raw output.
113+
114+| fixture | build | 128-root blocks | chroma units stamped | vs `aomdec` |
115+|---|---|---|---|---|
116+| `422_intrabc_sb128_strip.obu` | parent `a7d22aec` | **2** | **8** | **DIFF** |
117+| `422_intrabc_sb128_strip.obu` | this lane | **6** | **48** | **EXACT** (5/5 frames) |
118+| `422_intrabc_sb128_strip_notxsearch.obu` | parent `a7d22aec` | **2** | **8** | **DIFF** |
119+| `422_intrabc_sb128_strip_notxsearch.obu` | this lane | **6** | **48** | **EXACT** |
120+
121+Frame-level detail on the primary witness (245760 samples/frame: 384x320 Y +
122+2 x 192x320 chroma):
123+
124+- **red**, frame 0: 45135 samples differ, first at byte 98368 = Y **row 256,
125+ col 64** — the top-left of the first 128x64 intrabc block (traced at
126+ `mi_row=64 mi_col=0`, `py = 64*4 = 256`). Frame 3 the same shape (44540
127+ samples, same first offset). Frames 1, 2, 4 exact (no intrabc block).
128+- **fixed**: `cmp` identical on all 245760 x 5 bytes; 5 frames decoded, 0 hidden.
129+
130+The red build reached only 2 of the 6 blocks: reading 4 chroma units where
131+libaom codes 8 desynced the tile, and the remaining 4 blocks were misparsed.
132+Recovering them is the green signal, not just the pixel count.
133+
134+`EC_ECDUMP` per-unit stamps on the primary witness, red vs fixed, same entropy
135+position (`rng=49296` at the first block in both):
136+
137+ red 4 stamps (1 per plane per chunk, 2 chunks)
138+ fixed 8 stamps (2 per plane per chunk, 2 chunks)
139+
140+## Reproduce (patch-run-restore, local only)
141+
142+ python3 - <<'EOF'
143+ p='crates/ec-av1/src/stream.rs'; s=open(p).read()
144+ s=s.replace(" if seq.subsampling_x != seq.subsampling_y {",
145+ " if seq.subsampling_x != seq.subsampling_y && !crate::envflags::env_flag!(\"EC_AV1_ALLOW_422_PROBE\") {",1)
146+ open(p,'w').write(s)
147+ EOF
148+ CARGO_TARGET_DIR=$HOME/.cache/cargo-target-av1ibc128chunk \
149+ cargo build -p ec-av1 --example decode_probe --features gate-counters
150+ EC_AV1_ALLOW_422_PROBE=1 EC_ECDUMP=1 \
151+ $HOME/.cache/cargo-target-av1ibc128chunk/debug/examples/decode_probe \
152+ crates/ec-av1/fixtures/422_intrabc_sb128_strip.obu 2>&1 | grep -c EC_IBC128_STAMP
153+ -> 48 (parent: 8)
154+ EC_AV1_ALLOW_422_PROBE=1 EC_PROBE_OUT=/tmp/ours.raw \
155+ $HOME/.cache/cargo-target-av1ibc128chunk/debug/examples/decode_probe \
156+ crates/ec-av1/fixtures/422_intrabc_sb128_strip.obu
157+ ~/.cache/aom-oracle/build/aomdec --rawvideo -o /tmp/oracle.raw \
158+ crates/ec-av1/fixtures/422_intrabc_sb128_strip.obu
159+ cmp /tmp/ours.raw /tmp/oracle.raw # identical
160+ git checkout -- crates/ec-av1/src/stream.rs
161+
162+## Gates
163+
164+- `the_pinned_422_intrabc_sb128_strip_witnesses_refuse_by_name` (stream.rs) —
165+ both fixtures' byte pins (`len` + `fnv1a64`) and the unconditional
166+ refusal-by-name contract. The decode-level assertions above cannot run in
167+ committed code (the 4:2:2 refusal stands), so they are probe-measured and
168+ reproducible from the recipe; this is the same split
169+ `the_pinned_422_bigblock_witnesses_are_present_and_refuse_by_name` uses.
170+- `the_intrabc_128rect_chroma_chunk_walk_stays_per_axis` (stream.rs) — the
171+ source-scan arm. Scans `decode_intrabc_128rect`'s body **with comments
172+ stripped** (the fix's own comments quote the old expression to say what it
173+ was) and pins: zero `cside * 64 / side`; the `chunk_chroma_w/h` pair at
174+ **both** de-square-cut sites (read walk and `mu_chroma` replay); the
175+ `unit_luma_w/h`, `cw/ch`, `cpx/cpy` and `around_mi_rect` forms once each; the
176+ replay's own `cu << ss` pair; the per-axis unit arithmetic
177+ (`(64>>ss_x)/32 * (64>>ss_y)/32` = 1 / 2 / 4 at 4:2:0 / 4:2:2 / 4:4:4); and
178+ both new counter accessors. **Non-vacuity measured**: re-introducing
179+ `let chunk_chroma_w = cside * 64 / side;` at the read-walk site makes it fail
180+ with `left: 1, right: 0`; restored, it passes.
181+
182+## Byte-identity outside 4:2:2
183+
184+- `an_sb128_rect_strip_with_intrabc_decodes_pixel_exact` — **green**, and it
185+ is the right gate: same deterministic `geq` recipe as the witness, at
186+ `yuv420p` / `yuv420p10le`, all three arms decode-order pixel-exact vs the
187+ oracle with `intrabc_128rect_hits=+14 / +1 / +15` (30 blocks through the
188+ changed walk, `skip=false`, real residual reads). At ss (1,1) every new
189+ expression reduces to the old constant: `64 >> 1 = 32`, `32 << 1 = 64`,
190+ `bw >> 1 = bw / 2`, 16x16-mi spans.
191+- `an_sb128_screen_stream_with_intrabc_decodes_pixel_exact` — green (8 arms,
192+ 4-6 intrabc blocks each).
193+- `a_444_sb128_root_rect_stream_with_restoration_decodes_pixel_exact` — green.
194+- `a_lossless_sb128_rect_intra_block_decodes_sample_exact` — green.
195+- `a_real_aomenc_intrabc_mixed_vartx_tree_decodes_without_the_mixed_leaf_refusal`
196+ and `a_real_aomenc_screen_key_frame_reads_use_intrabc_on_rect_strips` — green.
197+- `the_pinned_422_bigblock_witnesses_are_present_and_refuse_by_name` — green
198+ (the twin lane's fixtures are untouched).
199+- Scoped battery: `intrabc` filter 19 passed / 0 failed / 1 ignored;
200+ `422` + `444` filters 12 passed / 0 failed. `cargo check -p ec-av1
201+ --all-targets`: 0 warnings.
202+
203+**DISCLOSED 4:4:4 behavior change.** At ss (0,0) the walk now codes FOUR
204+TX_32X32 units per mu chunk per plane (1x1 -> 2x2) where the parent coded one,
205+and the block's chroma plane block is now luma-sized (`bw x bh`) instead of
206+`bw/2 x bh/2`. This is the same disclosure lane-av1-422bigblock made for
207+`decode_block_128rect`: the parent's walk was **provably wrong** at ss (0,0) —
208+`cside = (side/2).max(...)` is the 4:2:0 half-side, so the old 32x32 chunk
209+covered a quarter of a 64x64 4:4:4 chroma chunk and the origin `px/2` was off by
210+half a superblock. Unlike that lane, this one also changes the *block* shape at
211+4:4:4 (`cw/ch`, `cpx/cpy`), so the ticket's "spans are equal at (0,0)"
212+premise does not hold for this function, whose extents were 4:2:0-hardcoded
213+throughout. Measured unreachability: **no committed 4:4:4 fixture engages
214+`decode_intrabc_128rect` at all** (`ibc128=0` on all six 4:4:4 fixtures
215+including `444_sb128rect_lr_witness.obu` and `ll444_ibc_rect.obu`), so no
216+green gate covers or contradicts the change; it is landed on the same geometry
217+argument that the two reviewed twins landed on, and the 4:4:4 route needs its
218+own witness (`aomenc --i444 --profile=1 --sb-size=128 --enable-rect-partitions=1
219+--enable-intrabc=1` over content that makes aomenc take a 128-root PARTITION_NONE
220+or HORZ/VERT strip — no committed 4:4:4 fixture does).
221+
222+## Hunt recipe sweep (what was tried before the hit)
223+
224+`--profile=2 --sb-size=128 --enable-intrabc=1` at 4:2:2, all with
225+`--i422`, `--tune-content=screen`, `--enable-palette=0`, `--passes=1`,
226+`--lag-in-frames=0`, `--kf-max-dist=1`, `--min-partition-size=8`,
227+`--max-partition-size=128`, `--enable-rect-partitions=1`,
228+`--enable-1to4-partitions=1`:
229+
230+- **lavfi `testsrc2 / smptebars / mandelbrot / life / rgbtestsrc /
231+ smptehdbars`, 128x128 and 256x256/384x256/512x256/128x128, `cpu-used` 0/2/3/4,
232+ `cq-level` 15-60, 2x2/3x2/4x4 `tile=`** (24 encodes + 24 x 2 x 8 = ~400
233+ encodes): 9 streams reached `decode_intrabc_128rect`; **all 9 reached it with
234+ a frame that was ALREADY desynced** before the block. The blocker is
235+ pre-existing and unrelated: at 4:2:2 a chroma tx unit goes non-square
236+ (TX_16X8 etc.) and the merged tree does not read the `tx_type` the oracle
237+ codes for it — first divergence on `c_testsrc2_cq40.obu` at coefficient unit
238+ **4** (plane 1, `mi_row=0 mi_col=0`, `tx_size=5` = TX_16X8: the oracle emits
239+ `tx_type` after `all_zero` where ours goes straight to `eob`, rng 55680 /
240+ 34568 identical up to that point). **Named for its owning lane, not chased
241+ here.**
242+- **the tree's own gate recipe re-cut at `yuv422p`** (the `geq` sinusoid
243+ sources, 384x320 cq32 and 512x512 cq45, `enable-tx-size-search` 0/1): the
244+ smooth-chroma `geq` content avoids the non-square-chroma-tx defect, and both
245+ cq32 arms are the red/green witnesses above. cq20/45/55 code no 128-root
246+ intrabc block at all (`ibc128=0`), so the hit is a cq32 window, not a
247+ content accident.
248+
249+Control that clean 4:2:2 witnesses do exist on this tree (so the "already
250+desynced" arms above were a content choice, not a tree-wide wall):
251+`422_sb128_3f.obu` decodes byte-exact vs `aomdec` here.