forge
Explore
Log in

Don't you dare go Hollow

Merge commit 'c0727d64'

Browse files at this commit

a1b35a546aaf5a0ba0fee768c757274eefaf24ebAhmet Kaan GümüşParent: 46d35714e9b008
crates/ec-av1/examples/decode_probe.rsmodified+5 -0
@@ -36,6 +36,11 @@ fn main() {
3636 }
3737 let (sc, dp) = ec_av1::decode::reelc_chroma_counters();
3838 println!("reelc_chroma: skip_cfl={sc} dir_1to4_pairs={dp}");
39+ println!(
40+ "ibc128: mu_chroma={} intra128={}",
41+ ec_av1::decode::intra_128_in_inter_mu_chroma_hits(),
42+ ec_av1::decode::intra_128_in_inter_hits()
43+ );
3944 println!(
4045 "chroma422_square: {}",
4146 ec_av1::decode::chroma422_square_hits()
crates/ec-av1/src/decode.rsmodified+208 -97
@@ -5559,6 +5559,23 @@ pub fn intra_128_in_inter_hits() -> usize {
55595559 INTRA_128_IN_INTER_HITS.with(std::cell::Cell::get)
55605560 }
55615561
5562+thread_local! {
5563+ /// lane-av1ibc128arm: how many 64x64 mu-chunk CHROMA units the
5564+ /// intra-in-inter 128x128 root read (`decode_inter_block`'s
5565+ /// `side > 64` mu-chunk arm, the INTRA half of the inter pair). Every
5566+ /// unit is one `read_plane` on U and one on V, so the counter is the
5567+ /// gate's proof the arm ran at all -- no committed 4:4:4 fixture
5568+ /// reached it before this lane.
5569+ pub(crate) static INTRA_128_IN_INTER_MU_CHROMA_HITS: std::cell::Cell<usize> =
5570+ const { std::cell::Cell::new(0) };
5571+}
5572+
5573+/// Current value of [`INTRA_128_IN_INTER_MU_CHROMA_HITS`], for a gate's
5574+/// before/after delta.
5575+pub fn intra_128_in_inter_mu_chroma_hits() -> usize {
5576+ INTRA_128_IN_INTER_MU_CHROMA_HITS.with(std::cell::Cell::get)
5577+}
5578+
55625579 thread_local! {
55635580 static INTER_SB_NONE_HITS: std::cell::Cell<usize> =
55645581 const { std::cell::Cell::new(0) };
@@ -9227,13 +9244,39 @@ impl Neighbours {
92279244 /// `curr_skipped = mbmi->skip_txfm && is_inter_block(mbmi)`. Widening this
92289245 /// block's published transform extent to its own size is exactly that
92299246 /// suppression for the deblocker's `x0 % tx != 0` test -- the only shape
9230- /// that needs it is the 128 root, whose chroma extent (64) is the one
9247+ /// that needs it is the 128 root, whose chroma extent is the one
92319248 /// [`Self::fill_lf_grid_rect`]'s TX_32X32 cap narrows. An INTRA block is
92329249 /// never suppressed (libaom's `is_inter_block` term), so this is called
92339250 /// only from the skipped-inter branch.
9234- fn suppress_internal_lf_edges(&mut self, at_mi: (usize, usize), w_mi: usize, h_mi: usize) {
9251+ ///
9252+ /// The extent is the block's own CHROMA footprint, `w_mi * MI >> ss_x` per
9253+ /// axis -- `av1_setup_dst_planes`'s `get_plane_block_size(bsize, ss_x,
9254+ /// ss_y)` (`common_data.c:38`, which at ss (0,0) is BLOCK_128X128
9255+ /// itself, so 128 and not 64). This used to be a hardcoded `w_mi * MI / 2`,
9256+ /// correct at 4:2:0 by the `>> 1 == / 2` identity and half the truth at
9257+ /// 4:4:4; lane-av1txsizeaudit r2 replaced it with the per-axis shift, the
9258+ /// form its sibling `fill_lf_grid_rect` already used. The `fctx` is
9259+ /// threaded in for it: `Neighbours` carries no subsampling of its own, so
9260+ /// no format guard was possible inside this method until now.
9261+ ///
9262+ /// **MEASURED INERT, and do not go looking for a pixel regression.** The
9263+ /// widening defeats the deblocker's alignment gate (`x0 & (tx - 1)`), but
9264+ /// every edge it lets through then meets the SAME libaom rule applied at
9265+ /// the correct place, `edge_params_body`'s spec-7.14.2 / libaom
9266+ /// `set_lpf_parameters` term `!pu_edge && cur_ref != 0 && pv_ref != 0 &&
9267+ /// skip_at && skip_at`. Inside one skipped block both cells are that same
9268+ /// block, so all four terms hold and the edge dies there too. The masking
9269+ /// is TOTAL, not incidental: this method is only ever called for a block
9270+ /// that is itself skipped, so no input exists on which one side of an
9271+ /// internal edge is not skipped. Measured over 26 frames / 2 555 904
9272+ /// samples across five 4:4:4 `--sb-size=128` streams that fire this arm
9273+ /// 30 times: `64` and `128` both decode pixel-exact against aomdec, and
9274+ /// differ from each other in not one sample. The gate for this value is
9275+ /// therefore a source scan, not a pixel gate --
9276+ /// `refusal_inventory::the_skipped_128_root_chroma_suppression_publishes_the_blocks_own_per_axis_chroma_extent`.
9277+ fn suppress_internal_lf_edges(&mut self, at_mi: (usize, usize), w_mi: usize, h_mi: usize, fctx: &FrameCtx) {
92359278 let (mi_r, mi_c) = at_mi;
9236- let (uv_w, uv_h) = ((w_mi * MI / 2).max(4) as u8, (h_mi * MI / 2).max(4) as u8);
9279+ let (uv_w, uv_h) = (((w_mi * MI) >> ss_x(fctx)).max(4) as u8, ((h_mi * MI) >> ss_y(fctx)).max(4) as u8);
92379280 for rr in 0..h_mi {
92389281 let start = (mi_r + rr) * self.skip_grid_cols_mi + mi_c;
92399282 fill_span(&mut self.uv_tx_grid, start, w_mi, uv_w);
@@ -43178,30 +43221,51 @@ fn decode_inter_block(
4317843221 continue;
4317943222 }
4318043223 let (cr, cc) = chunk;
43181- // `av1_get_max_uv_txsize(BLOCK_128X128)` =
43182- // `av1_get_adjusted_tx_size(TX_64X64)` = TX_32X32.
43224+ hit!(INTRA_128_IN_INTER_MU_CHROMA_HITS);
43225+ // The unit's CHROMA size, its LUMA footprint, the
43226+ // CHUNK's chroma extent and the unit's ORIGIN inside the
43227+ // chunk are four different quantities; this arm had the
43228+ // last three as one 4:2:0 literal and read ONE unit per
43229+ // mu chunk at every subsampling.
43230+ //
43231+ // `cu_tx` is TX_32X32 at EVERY subsampling.
43232+ // `av1_get_max_uv_txsize` (blockd.h:1371) is
43233+ // `av1_get_adjusted_tx_size(max_txsize_rect_lookup[
43234+ // get_plane_block_size(bsize, ss_x, ss_y)])`, and
43235+ // `av1_get_adjusted_tx_size` (blockd.h:1361) takes NO
43236+ // subsampling argument: it maps TX_64X64 / TX_64X32 /
43237+ // TX_32X64 to TX_32X32 UNCONDITIONALLY, so even at ss (0,0)
43238+ // (where `get_plane_block_size` returns BLOCK_128X128 and
43239+ // the lookup entry is TX_64X64) the answer is TX_32X32.
4318343240 let cu_tx = 32usize;
43184- let luma_span = cu_tx * 2;
43185- let cu_mi = (at_mi.0 + cr * 16, at_mi.1 + cc * 16);
43186- let cu_around = neighbours.around_mi(cu_mi, luma_span);
43187- let (cu_x, cu_y) = (cpx + cc * cu_tx, cpy + cr * cu_tx);
43188- let cu_reach = crate::decode::tu_reach(
43189- side,
43190- side,
43191- cc * luma_span,
43192- cr * luma_span,
43193- luma_span,
43194- reach,
43195- px,
43196- py,
43197- y.width,
43198- y.height,
43199- fctx,
43200- );
43241+ // The unit's own footprint on the LUMA grid, per axis
43242+ // (`cu_tx << ss`): 64 luma px (16 mi) at 4:2:0, 32 luma px
43243+ // (8 mi) at 4:4:4. This is the ss-aware form the repaired
43244+ // siblings at decode.rs:17598 / 17685 use (`ox <<
43245+ // ss_x(fctx)`, never `ox * 2`), and it is the size
43246+ // `around_mi` / `record_mi_chroma` want.
43247+ let unit_luma_w = cu_tx << ss_x(fctx);
43248+ let unit_luma_h = cu_tx << ss_y(fctx);
43249+ // The CHUNK's own extent, per axis: a mu chunk is a
43250+ // 64x64 LUMA region at every subsampling, so on the luma
43251+ // grid this is a literal 64, and its CHROMA plane block is
43252+ // `64 >> ss` square. At 4:2:0 that is 32x32 = the one unit
43253+ // this arm always coded; at 4:4:4 it is 64x64 = FOUR
43254+ // TX_32X32 units. Measured on the gate's own 4:4:4 stream
43255+ // against the oracle's `EC_TRACE_COEFF`: every chroma read
43256+ // of a 128x128 intra-in-inter root is `tx_size=3`
43257+ // (TX_32X32), and each 64x64 mu chunk contributes FOUR per
43258+ // plane at (row,col) (0,0) (0,8) (8,0) (8,8) -- never a
43259+ // TX_64X64 chroma unit.
43260+ let chunk_luma = 64usize;
43261+ let chunk_chroma_w = chunk_luma >> ss_x(fctx);
43262+ let chunk_chroma_h = chunk_luma >> ss_y(fctx);
43263+ let units_w = chunk_chroma_w / cu_tx;
43264+ let units_h = chunk_chroma_h / cu_tx;
4320143265 let cu_scan = default_scan(cu_tx);
4320243266 if lossless(fctx) {
43203- // lane-lossless2: 8x8 TX_4X4 units per plane in this
43204- // chunk, not one TX_32X32 unit.
43267+ // lane-lossless2: TX_4x4 units over this chunk's
43268+ // chroma, not TX_32X32 ones.
4320543269 read_intra_chroma_lossless(
4320643270 dec,
4320743271 cdfs,
@@ -43213,8 +43277,8 @@ fn decode_inter_block(
4321343277 (cpx, cpy),
4321443278 side,
4321543279 (chroma_side, chroma_side),
43216- (cc * cu_tx, cr * cu_tx),
43217- (cu_tx, cu_tx),
43280+ (cc * chunk_chroma_w, cr * chunk_chroma_h),
43281+ (chunk_chroma_w, chunk_chroma_h),
4321843282 chroma_side,
4321943283 reach,
4322043284 (y.width, y.height),
@@ -43231,79 +43295,126 @@ fn decode_inter_block(
4323143295 mu_chroma = true;
4323243296 continue;
4323343297 }
43298+ // Plane-major per chunk (libaom's plane loop is outermost
43299+ // inside the mu walk); within a plane the units walk raster.
4323443300 for plane_idx in 1..3 {
4323543301 let buf: &mut PlaneBuf<'static> =
4323643302 if plane_idx == 1 { &mut *u } else { &mut *v };
43237- let cu_grid = if skip {
43238- push_intra(
43239- plane_idx,
43240- cu_x,
43241- cu_y,
43242- cu_tx,
43243- uv_predict_mode,
43244- angle_delta_uv,
43245- cu_reach,
43246- &ZERO_RESIDUAL[..cu_tx * cu_tx],
43247- None,
43248- None,
43249- smooth_neighbor_uv,
43250- fctx,
43251- );
43252- Grid::Zero(cu_tx * cu_tx)
43253- } else {
43254- read_plane(
43255- dec,
43256- cdfs,
43257- chroma_set,
43258- &cu_scan,
43259- plane_idx,
43260- cu_around[plane_idx],
43261- mode,
43262- uv_predict_mode,
43263- angle_delta_uv,
43264- cu_reach,
43265- buf,
43266- cu_x,
43267- cu_y,
43268- cu_tx,
43269- cu_tx,
43270- base_q_idx,
43271- // CfL is refused above 32x32
43272- // (`is_cfl_allowed`), so never here.
43273- None,
43274- None,
43275- // The uv plane block (64x64) is larger than
43276- // the unit (32x32): `get_txb_ctx`'s offset-10
43277- // rows, +3 on the `txb_skip_chroma_32` table
43278- // (lane-sb128b r3).
43279- Some(3),
43280- smooth_neighbor_uv,
43281- fctx,
43282- )?
43283- };
43284- // Immediately, so the NEXT chunk's unit reads this
43285- // one's coefficient context.
43286- neighbours
43287- .record_mi_chroma(cu_mi, luma_span, luma_span, plane_idx, &cu_grid);
43288- hit!(CHROMA_SPLIT_TX_HITS);
43289- // lane-dpm1: the two INTER mu-chunk sites set this and this
43290- // INTRA-in-inter one did not, so the whole-block chroma
43291- // record below re-stamped all four 32x32 units with the
43292- // TOP-LEFT unit's level and the next block read a txb_skip
43293- // row libaom never selects (class `override-slot-on-one-arm`).
43294- mu_chroma = true;
43295- let dst = mu_units(
43296- if plane_idx == 1 {
43297- &mut u_units
43298- } else {
43299- &mut v_units
43300- },
43301- chroma_side * chroma_side,
43302- );
43303- for rr in 0..cu_tx {
43304- let start = (cr * cu_tx + rr) * chroma_side + cc * cu_tx;
43305- dst[start..start + cu_tx]
43306- .copy_from_slice(&cu_grid[rr * cu_tx..][..cu_tx]);
43303+ for ur in 0..units_h {
43304+ for uc in 0..units_w {
43305+ // The unit's own mi origin: the chunk's
43306+ // (16x16 mi) plus the unit's offset inside it.
43307+ let unit_mi = (
43308+ at_mi.0 + cr * 16 + ur * (unit_luma_h / MI),
43309+ at_mi.1 + cc * 16 + uc * (unit_luma_w / MI),
43310+ );
43311+ // The unit's own entropy-cell span, so the
43312+ // NEXT unit of this chunk reads THIS one's
43313+ // state and the next chunk reads the last.
43314+ let cu_around = neighbours.around_mi(unit_mi, unit_luma_w);
43315+ let (cu_x, cu_y) = (
43316+ cpx + cc * chunk_chroma_w + uc * cu_tx,
43317+ cpy + cr * chunk_chroma_h + ur * cu_tx,
43318+ );
43319+ let cu_reach = crate::decode::tu_reach(
43320+ side,
43321+ side,
43322+ cc * chunk_luma + uc * unit_luma_w,
43323+ cr * chunk_luma + ur * unit_luma_h,
43324+ unit_luma_w,
43325+ reach,
43326+ px,
43327+ py,
43328+ y.width,
43329+ y.height,
43330+ fctx,
43331+ );
43332+ let cu_grid = if skip {
43333+ push_intra(
43334+ plane_idx,
43335+ cu_x,
43336+ cu_y,
43337+ cu_tx,
43338+ uv_predict_mode,
43339+ angle_delta_uv,
43340+ cu_reach,
43341+ &ZERO_RESIDUAL[..cu_tx * cu_tx],
43342+ None,
43343+ None,
43344+ smooth_neighbor_uv,
43345+ fctx,
43346+ );
43347+ Grid::Zero(cu_tx * cu_tx)
43348+ } else {
43349+ read_plane(
43350+ dec,
43351+ cdfs,
43352+ chroma_set,
43353+ &cu_scan,
43354+ plane_idx,
43355+ cu_around[plane_idx],
43356+ mode,
43357+ uv_predict_mode,
43358+ angle_delta_uv,
43359+ cu_reach,
43360+ buf,
43361+ cu_x,
43362+ cu_y,
43363+ cu_tx,
43364+ cu_tx,
43365+ base_q_idx,
43366+ // CfL is refused above 32x32
43367+ // (`is_cfl_allowed`), so never here.
43368+ None,
43369+ None,
43370+ // The uv plane block is larger than
43371+ // the unit: `get_txb_ctx`'s offset-10
43372+ // rows, +3 on the `txb_skip_chroma_32`
43373+ // table (lane-sb128b r3).
43374+ Some(3),
43375+ smooth_neighbor_uv,
43376+ fctx,
43377+ )?
43378+ };
43379+ // Immediately, so the NEXT unit reads this
43380+ // one's coefficient context.
43381+ neighbours.record_mi_chroma(
43382+ unit_mi,
43383+ unit_luma_w,
43384+ unit_luma_h,
43385+ plane_idx,
43386+ &cu_grid,
43387+ );
43388+ hit!(CHROMA_SPLIT_TX_HITS);
43389+ // lane-dpm1: the two INTER mu-chunk sites set
43390+ // this and this INTRA-in-inter one did not, so
43391+ // the whole-block chroma record below re-stamped
43392+ // all four 32x32 units with the TOP-LEFT unit's
43393+ // level and the next block read a txb_skip row
43394+ // libaom never selects (class
43395+ // `override-slot-on-one-arm`).
43396+ mu_chroma = true;
43397+ let dst = mu_units(
43398+ if plane_idx == 1 {
43399+ &mut u_units
43400+ } else {
43401+ &mut v_units
43402+ },
43403+ chroma_side * chroma_side,
43404+ );
43405+ // The ASSEMBLED grid stays at the square
43406+ // `chroma_side` stride the block tail's
43407+ // re-stamp indexes; the unit's true per-axis
43408+ // position inside its chunk is what changes.
43409+ for rr in 0..cu_tx {
43410+ let start = (cr * chunk_chroma_h + ur * cu_tx + rr)
43411+ * chroma_side
43412+ + cc * chunk_chroma_w
43413+ + uc * cu_tx;
43414+ dst[start..start + cu_tx]
43415+ .copy_from_slice(&cu_grid[rr * cu_tx..][..cu_tx]);
43416+ }
43417+ }
4330743418 }
4330843419 }
4330943420 }
@@ -44182,7 +44293,7 @@ fn decode_inter_block(
4418244293 // way; only the 128 root gets four TX_64X64 leaves regardless of `skip`.
4418344294 let skip_inter_128 = skip && is_inter && write_w.max(write_h) > 64;
4418444295 if skip_inter_128 {
44185- neighbours.suppress_internal_lf_edges((rmi, cmi), write_w / MI, write_h / MI);
44296+ neighbours.suppress_internal_lf_edges((rmi, cmi), write_w / MI, write_h / MI, fctx);
4418644297 }
4418744298 if let Some(leaves) = (!skip_inter_128).then_some(()).and(vartx_leaves.as_ref()) {
4418844299 for &(row, col, tw, th) in leaves {
crates/ec-av1/src/refusal_inventory.rsmodified+66 -0
@@ -1826,6 +1826,72 @@ mod tests {
18261826 );
18271827 }
18281828
1829+ /// lane-av1txsizeaudit r2 -- the one value in `ec-av1` whose correct form
1830+ /// is provable against libaom but whose *observable effect* is nil, so a
1831+ /// pixel gate is impossible and this source scan is the only instrument
1832+ /// that can catch a regression.
1833+ ///
1834+ /// `decode.rs`'s `suppress_internal_lf_edges` publishes the skipped 128
1835+ /// root's own chroma extent into `uv_tx_grid`, so the deblocker's
1836+ /// alignment gate (`x0 & (tx - 1)`) sees no internal transform edge. The
1837+ /// correct extent is the block's own CHROMA footprint,
1838+ /// `w_mi * MI >> ss_x` per axis -- `av1_setup_dst_planes`'s
1839+ /// `get_plane_block_size(bsize, ss_x, ss_y)`, which at ss (0,0) is the
1840+ /// block itself, so **128 and not 64** for a 128x128 root at 4:4:4. The
1841+ /// site carried a hardcoded `w_mi * MI / 2`, which is right at 4:2:0 by
1842+ /// the `>> 1 == / 2` identity and half the truth everywhere else; its
1843+ /// sibling `fill_lf_grid_rect` had already been repaired to
1844+ /// `(w_mi * MI) >> ss_x(fctx)`.
1845+ ///
1846+ /// **No pixel gate can exist for this, and that is measured, not assumed.**
1847+ /// The widening defeats the alignment gate, but every edge it lets
1848+ /// through then meets the SAME libaom rule applied at the correct place --
1849+ /// `edge_params_body`'s spec-7.14.2 / `set_lpf_parameters` term
1850+ /// `!pu_edge && cur_ref != 0 && pv_ref != 0 && skip_at && skip_at`, which
1851+ /// holds for every internal edge because both cells are the same skipped
1852+ /// block. Over 26 frames / 2 555 904 samples of five 4:4:4
1853+ /// `--sb-size=128` streams that fire the arm 30 times, `64` and `128` both
1854+ /// decode pixel-exact against `aomdec` and differ from each other in not
1855+ /// one sample. The masking is TOTAL: the method is only ever called for a
1856+ /// block that is itself skipped, so no input exists on which one side of
1857+ /// an internal edge is not skipped. Hence: source scan, not pixels.
1858+ ///
1859+ /// This also pins the `fctx` threading, because `Neighbours` carries no
1860+ /// subsampling of its own -- a sibling lane reached the same site and
1861+ /// recorded it as unfixable for exactly that reason.
1862+ #[test]
1863+ fn the_skipped_128_root_chroma_suppression_publishes_the_blocks_own_per_axis_chroma_extent() {
1864+ let src = include_str!("decode.rs");
1865+ let start = src
1866+ .find("fn suppress_internal_lf_edges(")
1867+ .expect("suppress_internal_lf_edges is gone");
1868+ let body_start = start + src[start..].find('{').expect("no body");
1869+ let body = &src[body_start..body_start + src[body_start..].find("\n }").expect("no end")];
1870+
1871+ assert!(
1872+ body.contains("((w_mi * MI) >> ss_x(fctx))") && body.contains("((h_mi * MI) >> ss_y(fctx))"),
1873+ "suppress_internal_lf_edges must publish the block's own chroma extent per axis \
1874+ -- `w_mi * MI >> ss_x(fctx)`, not a hardcoded `/2`"
1875+ );
1876+ for stale in ["w_mi * MI / 2", "h_mi * MI / 2"] {
1877+ assert!(
1878+ !body.contains(stale),
1879+ "suppress_internal_lf_edges grew `{stale}` again: correct at 4:2:0 by the \
1880+ `>> 1 == / 2` identity, half the truth at 4:4:4"
1881+ );
1882+ }
1883+ // The subsampling is not reachable from `self` -- `Neighbours` has no
1884+ // `fctx` field -- so the per-axis shift needs a threaded parameter.
1885+ // Without this the body cannot compile, which is how a future edit
1886+ // would try to reintroduce a literal.
1887+ let sig_end = src[start..body_start].to_string();
1888+ assert!(
1889+ sig_end.contains("fctx: &FrameCtx"),
1890+ "suppress_internal_lf_edges takes no fctx, so the per-axis shift has nothing to read \
1891+ -- `Neighbours` carries no subsampling of its own; thread the frame context in"
1892+ );
1893+ }
1894+
18291895 /// lane-av1-refusalaudit, ENUMERATION for "a 64-axis strip whose chroma
18301896 /// unit has no coefficient table" -- [`decode_block_rect64`]'s `_` arm,
18311897 /// reached only for depth-0, non-skip, non-lossless superblock-level
crates/ec-av1/src/stream.rsmodified+192 -0
@@ -37566,6 +37566,198 @@ pub(crate) mod tests {
3756637566 );
3756737567 }
3756837568
37569+ /// lane-av1ibc128arm: the INTRA-in-inter 128x128 root's mu-chunk chroma
37570+ /// arm (`decode_inter_block`'s `side > 64` arm, the intra half of the
37571+ /// inter pair the sibling gate above names) must code the mu chunk's
37572+ /// chroma as a PER-UNIT walk at every subsampling, and at 4:4:4 each
37573+ /// 64x64 mu chunk is FOUR TX_32X32 units per plane, not one.
37574+ ///
37575+ /// **The defect.** The arm hardcoded `cu_tx = 32`, `luma_span = cu_tx *
37576+ /// 2` and the chroma origin `cc * cu_tx` -- the 4:2:0 arithmetic, where a
37577+ /// mu chunk's chroma plane block is `64 >> 1 == 32` square and the whole
37578+ /// chunk IS one TX_32X32 unit. At 4:4:4 the chunk's chroma is 64x64, so
37579+ /// the arm (a) read one 32x32 unit where libaom codes four, (b) stamped
37580+ /// the unit's entropy context over the 4:2:0 64x64 luma span rather than
37581+ /// the unit's own 32x32, and (c) placed chunk 1's unit at `cpx + 32`
37582+ /// instead of `cpx + 64`, i.e. back inside chunk 0's samples.
37583+ ///
37584+ /// **`av1_get_max_uv_txsize` is NOT the source of a 64x64 chroma unit.**
37585+ /// `blockd.h:1371` is `av1_get_adjusted_tx_size(max_txsize_rect_lookup[
37586+ /// get_plane_block_size(bsize, ss_x, ss_y)])`, and `av1_get_adjusted_tx_size`
37587+ /// (`blockd.h:1361`) takes NO subsampling argument -- it maps TX_64X64 /
37588+ /// TX_64X32 / TX_32X64 to TX_32X32 UNCONDITIONALLY, so even at ss (0,0)
37589+ /// (where `get_plane_block_size` returns BLOCK_128X128 and the lookup
37590+ /// entry is TX_64X64) the answer is TX_32X32. Measured on this gate's own
37591+ /// stream against the oracle's `EC_TRACE_COEFF`: every chroma read of the
37592+ /// 128x128 intra-in-inter root is `tx_size=3` (TX_32X32), four per plane
37593+ /// per mu chunk at (row,col) (0,0) (0,8) (8,0) (8,8).
37594+ ///
37595+ /// **The recipe** (128x256, 3 frames). `--sb-size=128` with
37596+ /// `--min-partition-size=64 --max-partition-size=128` keeps the
37597+ /// superblock root resolvable to `PARTITION_NONE`, and the noise-on-
37598+ /// gradient content is what makes the encoder's RD pick INTRA over inter
37599+ /// for a whole 128 root on an inter frame (a clean `testsrc2` stream
37600+ /// never does -- measured over 24 recipe/cell combinations, three of
37601+ /// which fired and none of them `testsrc2`):
37602+ /// ```text
37603+ /// ffmpeg -f lavfi -i "gradients=size=128x256:c0=..:c1=..:c2=..:c3=..:\
37604+ /// seed=63:duration=0.12:rate=25,noise=all_seed=63:alls=6:allf=t" \
37605+ /// -pix_fmt yuv444p -t 0.12 -f yuv4mpegpipe - | \
37606+ /// aomenc --codec=av1 --profile=1 --passes=1 --end-usage=q --cq-level=62 \
37607+ /// --cpu-used=0 --threads=1 --row-mt=0 --sb-size=128 --limit=3 \
37608+ /// --max-partition-size=128 --min-partition-size=64 \
37609+ /// --enable-rect-partitions=0 --enable-ab-partitions=0 \
37610+ /// --enable-1to4-partitions=0 --enable-palette=0 \
37611+ /// --enable-intrabc=0 --deltaq-mode=0 --enable-tx-size-search=0 \
37612+ /// --obu -o out.obu -
37613+ /// ```
37614+ /// Both `rate=25` and the frame limit are load-bearing: `gradients`' and
37615+ /// `noise`' patterns are time-parameterised, so a different rate or a
37616+ /// different `--limit` emits a different stream (and at `--limit=2` this
37617+ /// recipe stops choosing the shape at all -- measured, 0 fires).
37618+ ///
37619+ /// Non-vacuity, three ways: the sequence header is asserted really to be
37620+ /// 4:4:4 (`subsampling_x == subsampling_y == 0`) and 128-superblock;
37621+ /// `intra_128_in_inter_mu_chroma_hits()` must be non-zero, so the arm
37622+ /// really ran; and every decode-order frame is compared byte-for-byte
37623+ /// against the oracle by [`decode_all_frames_vs_oracle`], which panics on
37624+ /// a refusal or any differing byte. Red before the fix (the ss-aware
37625+ /// arithmetic and the per-unit walk reverted, the counter kept): decode-
37626+ /// order frame 2 differs in 44649 of 98304 bytes while the counter still
37627+ /// reads 4 -- the red is on PIXELS, not on the counter.
37628+ #[test]
37629+ fn a_real_aomenc_444_intra_in_inter_128_root_codes_chroma_per_mu_chunk_unit_pixel_exact() {
37630+ const NAME: &str =
37631+ "a_real_aomenc_444_intra_in_inter_128_root_codes_chroma_per_mu_chunk_unit_pixel_exact";
37632+ let _gate_lock = lock_gate_counters();
37633+ if !have_ffmpeg() || !have_aomenc() {
37634+ eprintln!("SKIP {NAME}: no ffmpeg/aomenc/aomdec");
37635+ return;
37636+ }
37637+ let (width, height) = (128usize, 256usize);
37638+ let source = format!(
37639+ "{},noise=all_seed=63:alls=6:allf=t",
37640+ gradients_source(63, width, height, "duration=0.12:rate=25")
37641+ );
37642+ let y4m = Command::new("ffmpeg")
37643+ .args([
37644+ "-v",
37645+ "error",
37646+ "-f",
37647+ "lavfi",
37648+ "-i",
37649+ &source,
37650+ "-pix_fmt",
37651+ "yuv444p",
37652+ "-t",
37653+ "0.12",
37654+ "-f",
37655+ "yuv4mpegpipe",
37656+ "-",
37657+ ])
37658+ .stdin(Stdio::null())
37659+ .stdout(Stdio::piped())
37660+ .stderr(Stdio::piped())
37661+ .output()
37662+ .expect("ffmpeg failed to run");
37663+ assert!(
37664+ y4m.status.success(),
37665+ "{NAME}: ffmpeg fixture: {}",
37666+ String::from_utf8_lossy(&y4m.stderr)
37667+ );
37668+ let args: Vec<&str> = vec![
37669+ "--codec=av1",
37670+ "--profile=1",
37671+ "--passes=1",
37672+ "--end-usage=q",
37673+ "--cq-level=62",
37674+ "--cpu-used=0",
37675+ "--threads=1",
37676+ "--row-mt=0",
37677+ "--sb-size=128",
37678+ "--limit=3",
37679+ "--max-partition-size=128",
37680+ "--min-partition-size=64",
37681+ "--enable-rect-partitions=0",
37682+ "--enable-ab-partitions=0",
37683+ "--enable-1to4-partitions=0",
37684+ "--enable-palette=0",
37685+ "--enable-intrabc=0",
37686+ "--deltaq-mode=0",
37687+ "--enable-tx-size-search=0",
37688+ "--obu",
37689+ "-o",
37690+ "-",
37691+ "-",
37692+ ];
37693+ let out = run_with_stdin(Command::new(aomenc_path()).args(&args), &y4m.stdout);
37694+ assert!(
37695+ out.status.success(),
37696+ "{NAME}: aomenc refused the fixture: {}",
37697+ String::from_utf8_lossy(&out.stderr)
37698+ );
37699+ let stream = out.stdout;
37700+ // The gate is only about 4:4:4 at a 128 superblock, so assert the
37701+ // parsed sequence header really is that before anything else: a
37702+ // stream that silently came back 4:2:0 would leave this arm
37703+ // unexercised while every other assert below still passed.
37704+ let header = {
37705+ let mut parser = ec_av1_syntax::Av1Parser::new();
37706+ let mut pos = 0usize;
37707+ while let Ok(obu) = parser.parse_obu(&stream[pos..]) {
37708+ pos += obu.total_size;
37709+ if pos >= stream.len() {
37710+ break;
37711+ }
37712+ }
37713+ parser.sequence_header().map(|q| {
37714+ (
37715+ q.use_128x128_superblock,
37716+ q.color_config.subsampling_x,
37717+ q.color_config.subsampling_y,
37718+ q.color_config.mono_chrome,
37719+ )
37720+ })
37721+ };
37722+ assert_eq!(
37723+ header,
37724+ Some((true, 0, 0, false)),
37725+ "{NAME}: the encoder did not write a 4:4:4 (ss 0/0, non-mono) 128x128-superblock \
37726+ sequence header -- the flags never arrived, so the arm this gate names is not \
37727+ the one under test"
37728+ );
37729+ let before = (
37730+ crate::decode::intra_128_in_inter_hits(),
37731+ crate::decode::intra_128_in_inter_mu_chroma_hits(),
37732+ );
37733+ let (frames, hidden) = decode_all_frames_vs_oracle(&stream, NAME);
37734+ let (roots, units) = (
37735+ crate::decode::intra_128_in_inter_hits() - before.0,
37736+ crate::decode::intra_128_in_inter_mu_chroma_hits() - before.1,
37737+ );
37738+ assert!(
37739+ frames >= 3,
37740+ "{NAME}: only {frames} decode-order frames ({hidden} hidden), the recipe asks for 3"
37741+ );
37742+ assert!(
37743+ roots >= 1,
37744+ "{NAME}: no INTRA-coded 128x128 root inside an inter frame -- the recipe stopped \
37745+ exercising the shape this gate names"
37746+ );
37747+ // One mu chunk per arm firing, and at 4:4:4 FOUR units per plane per
37748+ // chunk (two 64x64 mu chunks per 128 root, two planes each).
37749+ assert!(
37750+ units >= 4,
37751+ "{NAME}: only {units} mu-chunk chroma reads across {roots} intra-in-inter 128 \
37752+ root(s) -- the per-unit walk this gate names never fired (a 4:4:4 64x64 mu chunk \
37753+ is FOUR TX_32X32 units per plane, not one)"
37754+ );
37755+ eprintln!(
37756+ "{NAME}: {frames} decode-order frames pixel-exact ({hidden} hidden), \
37757+ intra_128_in_inter={roots} mu_chunk_chroma_reads={units}"
37758+ );
37759+ }
37760+
3756937761 /// lane-sbpart r2: a real `aomenc` stream whose superblock-level
3757037762 /// partition decision is genuinely HORZ/VERT (not NONE/SPLIT) must
3757137763 /// decode pixel-exact through [`crate::decode::decode_block_rect64`] --
lanes/av1ibc128arm.report.mdadded+196 -0
@@ -0,0 +1,196 @@
1+# Lane av1ibc128arm: 4:4:4 intra-in-inter 128-root mu-chunk chroma unit walk
2+
3+Base: main `a21f3680`. Branch `lane-av1ibc128arm`, worktree
4+`/home/user/.cache/wt/av1ibc128arm`. Oracle: `~/.cache/aom-oracle/build/{aomenc,aomdec}`
5+(aom `v3.13.3-7-g9bb526a`).
6+
7+## Verdict: the ticket's part (1) is REFUTED by the oracle; parts (2) and the
8+## per-unit walk are the real defect, and the fix is green
9+
10+The ticket said "`cu_tx` must be `32 << ss_x` ... per `blockd.h:1372`,
11+`av1_get_max_uv_txsize(BLOCK_128X128, 0, 0)` is TX_64X64, so at 4:4:4 `cu_tx` is
12+64, not 32". **That is wrong for this aom.** `blockd.h:1371` is
13+
14+```c
15+static inline TX_SIZE av1_get_max_uv_txsize(BLOCK_SIZE bsize, int subsampling_x,
16+ int subsampling_y) {
17+ const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, subsampling_x, subsampling_y);
18+ const TX_SIZE uv_tx = max_txsize_rect_lookup[plane_bsize];
19+ return av1_get_adjusted_tx_size(uv_tx);
20+}
21+```
22+
23+and `av1_get_adjusted_tx_size` (`blockd.h:1361`, read in the oracle tree at
24+`~/.cache/aom-oracle/src/av1/common/blockd.h:1361`) takes **no subsampling
25+argument** — it maps `TX_64X64 / TX_64X32 / TX_32X64` to `TX_32X32`
26+**unconditionally**. So even at ss (0,0), where `get_plane_block_size` returns
27+`BLOCK_128X128` and `max_txsize_rect_lookup[BLOCK_128X128]` is `TX_64X64`, the
28+answer is **TX_32X32**. The chroma unit is 32 at every subsampling.
29+
30+**Oracle measurement** (`EC_TRACE_COEFF=1 aomdec` on the gate's own 4:4:4
31+stream, `h_min_128x256_n3.obu`): every chroma read of the 128x128
32+intra-in-inter root is `tx_size=3` (TX_32X32) — four per plane per mu chunk, at
33+`(row,col) (0,0) (0,8) (8,0) (8,8)`, interleaved plane-major per chunk after
34+the chunk's single `tx_size=4` (TX_64X64) luma unit. Never a TX_64X64 chroma
35+unit. The ticket's part (1) would have read a 64x64 transform where libaom
36+reads four 32x32 ones.
37+
38+## The real defect (`decode_inter_block`, the `side > 64` intra-in-inter arm)
39+
40+The arm had three 4:2:0 literals standing in for four different quantities:
41+
42+| quantity | old (4:2:0 only) | correct |
43+| --- | --- | --- |
44+| chroma unit side `cu_tx` | `32` | `32` at every ss (correct already) |
45+| unit's LUMA span | `luma_span = cu_tx * 2` (64) | `cu_tx << ss_x` → 64 at 4:2:0, **32** at 4:4:4 |
46+| unit's CHROMA origin | `cpx + cc * cu_tx` | `cpx + cc * (64 >> ss_x)` → **+64** per chunk at 4:4:4 |
47+| units per mu chunk per plane | 1 | `chunk_chroma / cu_tx` → 1 at 4:2:0, **4** at 4:4:4 |
48+
49+At 4:4:4 the old arm therefore (a) read one 32x32 unit where libaom codes four,
50+(b) stamped the unit's entropy context over the 4:2:0 64x64 luma span instead of
51+the unit's own 32x32, and (c) placed chunk 1's unit at `cpx + 32` — back inside
52+chunk 0's samples.
53+
54+The fix is the per-unit walk the **inter** sibling already got
55+(`decode.rs:41347`, `chunk_chroma_w = 64 >> ss_x`, `units_w = chunk_chroma_w /
56+cu_tx`, `unit_luma_w = cu_tx << ss_x`), applied to the intra arm. The repaired
57+4x4-chroma siblings at `decode.rs:17598` / `17685` and the block-walk reference
58+give the same ss-aware form (`ox << ss_x(fctx)`, never `ox * 2`). No third shape
59+was invented. The lossless sub-arm's `(cc * cu_tx, cr * cu_tx)` / `(cu_tx, cu_tx)`
60+region args and the `mu_units` write-back offset were generalized the same way
61+(`chunk_chroma_w/h`), matching the inter arm's lossless sub-arm at 41409.
62+
63+## Counter table
64+
65+New counter `intra_128_in_inter_mu_chroma_hits()` (one bump per mu-chunk arm
66+firing), measured on the gate's 128x256 3-frame 4:4:4 stream and on a 256x256
67+8-frame 4:4:4 stream, both freshly encoded live:
68+
69+| build | 128x256 (1 intra-128 root) | 256x256 (2 intra-128 roots) |
70+| --- | --- | --- |
71+| before fix (arm reverted, counter kept) | `mu_chroma=4`, `intra128=1` | `mu_chroma=24`, `intra128=6` |
72+| after fix | `mu_chroma=4`, `intra128=1` | `mu_chroma=8`, `intra128=2` |
73+
74+The counter **fires in both builds** — the red is on pixels, not on the counter.
75+On the 256x256 witness the pre-fix count is *higher* (24 vs 8) because the
76+one-unit-per-chunk arm desyncs and the subsequent frames take different paths;
77+the minimal 128x256 witness is the clean one-unit-per-chunk case (4 = 1 root ×
78+2 mu chunks × 2 planes on the last frame, 8 on the 256x256 = 2 roots × 2 chunks
79+× 2 planes).
80+
81+## Recipe (128x256, 3 frames — the gate encodes it live)
82+
83+`rate=25`, `--limit=3`, `--cpu-used=0`, `--cq-level=62` and
84+`--min-partition-size=64 --max-partition-size=128` are all load-bearing.
85+Measured over 24 recipe/cell combinations: a clean `testsrc2` source never
86+produces an intra-coded 128 root on an inter frame; noise-on-`gradients` does,
87+and only at this seed/cq/geometry. At `--limit=2` the same recipe stops choosing
88+the shape entirely (0 fires).
89+
90+```text
91+ffmpeg -f lavfi -i "gradients=size=128x256:c0=..:c1=..:c2=..:c3=..:seed=63:\
92+duration=0.12:rate=25,noise=all_seed=63:alls=6:allf=t" \
93+ -pix_fmt yuv444p -t 0.12 -f yuv4mpegpipe - | \
94+aomenc --codec=av1 --profile=1 --passes=1 --end-usage=q --cq-level=62 \
95+ --cpu-used=0 --threads=1 --row-mt=0 --sb-size=128 --limit=3 \
96+ --max-partition-size=128 --min-partition-size=64 \
97+ --enable-rect-partitions=0 --enable-ab-partitions=0 \
98+ --enable-1to4-partitions=0 --enable-palette=0 --enable-intrabc=0 \
99+ --deltaq-mode=0 --enable-tx-size-search=0 --obu -o out.obu -
100+```
101+
102+## Header-parse evidence
103+
104+The gate parses the encoded stream's own sequence header and asserts
105+`(use_128x128_superblock, subsampling_x, subsampling_y, mono_chrome) ==
106+(true, 0, 0, false)` **before** anything else, so a stream that silently came
107+back 4:2:0 cannot leave the arm unexercised while the rest passes.
108+`decode_probe` on the same stream: `SEQ: use_128x128_superblock=true bit_depth=8
109+mono_chrome=false max_frame=128x256`.
110+
111+## Gate
112+
113+`stream.rs::a_real_aomenc_444_intra_in_inter_128_root_codes_chroma_per_mu_chunk_unit_pixel_exact`
114+
115+- encodes live with the oracle aomenc (no pinned fixture — the recipe is the
116+ witness, and a recipe that stops firing fails rather than passing vacuously),
117+- asserts the 4:4:4 + 128-superblock sequence header,
118+- `intra_128_in_inter_hits() >= 1` (a real intra-coded 128 root on an inter
119+ frame) and `intra_128_in_inter_mu_chroma_hits() >= 4` (the per-unit walk ran),
120+- `decode_all_frames_vs_oracle` — every decode-order frame compared
121+ byte-for-byte against the oracle, panicking on a refusal or any differing byte.
122+
123+**Green:** `3 decode-order frames pixel-exact (0 hidden), intra_128_in_inter=1
124+mu_chunk_chroma_reads=4`.
125+
126+On the 256x256 8-frame 4:4:4 witness all **9** decode-order frames are
127+byte-exact (`EC_AV1_FINAL_DUMP` ours vs oracle `aomdec`, 196608 B each, 0
128+differing bytes per frame).
129+
130+## Red-before
131+
132+Reverted **only** the arm body (the per-unit walk and the ss-aware arithmetic)
133+back to the pristine `a21f3680` text, keeping the counter and the new gate.
134+Restored afterwards with `cp` from a saved copy and verified with `diff -q`
135+(`RESTORED byte-identical`) — never `git checkout --`.
136+
137+Gate-level, fresh run of the new gate on the reverted arm:
138+
139+```
140+a_real_aomenc_444_intra_in_inter_128_root_..._pixel_exact: decode-order frame 2
141+of 3 (3 shown, 0 hidden) differs from the oracle at byte 15450 (ours 142 vs
142+141), 44649 bytes differ
143+test result: FAILED. 0 passed; 1 failed
144+```
145+
146+It fails on **pixels**, with the counter still reading 4 — so the red is not
147+merely the counter. Direct dump comparison on the same reverted build:
148+
149+| stream | decode-order frames | differing bytes |
150+| --- | --- | --- |
151+| 128x256 (red-before) | 3 | 0, 0, **44649** (frame 2) |
152+| 256x256 (red-before) | 9 | 0, 0, 0, 0, **167832**, **152747**, **193206**, **182687**, **190186** |
153+
154+## 4:2:0 byte-identity (invariant)
155+
156+The arm is unchanged in behaviour at ss (1,1) by construction: `cu_tx` is
157+unchanged (32), `cu_tx << ss_x == cu_tx * 2` at ss (1,1), and
158+`chunk_chroma == chunk_luma >> ss_x == 32 == cu_tx` so `units_w == units_h == 1`
159+— the walk degenerates to exactly the one unit per mu chunk the arm always
160+coded. Proven by running two existing 4:2:0 128-root gates unchanged on this
161+tree:
162+
163+| gate | result |
164+| --- | --- |
165+| `a_real_aomenc_inter_128x128_none_root_decodes_pixel_exact` | **ok** — 3 arms pixel-exact; 8-bit `intra_128_in_inter=0`, **10-bit `intra_128_in_inter=1`** (the arm really runs at 4:2:0 on that arm and stays exact), `chroma_units` 32/40/40; 3rd arm `intra_128_in_inter=0` |
166+| `a_real_aomenc_128x128_none_inter_blocks_coded_chroma_per_mu_chunk_decodes_pixel_exact` | **ok** — 12 decode-order frames pixel-exact, `inter_sb128_none_hits=11 chroma_units=88` |
167+
168+The 10-bit arm of the first gate is the direct proof: it fires the
169+intra-in-inter 128 arm at ss (1,1) (`intra_128_in_inter=1`) and every frame is
170+byte-exact, so the 4:2:0 path through the rewritten walk is unchanged.
171+
172+A targeted extra control: the same 128x256 recipe at `--profile=0` / `yuv420p`
173+produced 3 frames decoding cleanly (`SEQ: use_128x128_superblock=true
174+max_frame=128x256`, no refusal) with `ibc128: mu_chroma=0 intra128=0` — the
175+encoder picks no intra 128 root there, which is why the two existing gates above
176+are the 4:2:0 evidence rather than this stream.
177+
178+## Files changed
179+
180+- `crates/ec-av1/src/decode.rs` — new counter
181+ `INTRA_128_IN_INTER_MU_CHROMA_HITS` + accessor
182+ `intra_128_in_inter_mu_chroma_hits()`; the arm's per-unit walk.
183+- `crates/ec-av1/examples/decode_probe.rs` — prints the counter (scratch
184+ instrument, left in so the arm's engagement is inspectable from the probe).
185+- `crates/ec-av1/src/stream.rs` — the new gate.
186+
187+`cargo build --release -p ec-av1 --tests --features gate-counters`: 0 errors,
188+0 warnings.
189+
190+## Note for the next reader
191+
192+The ticket's part (1) should not be re-applied anywhere: a TX_64X64 chroma unit
193+at 4:4:4 is not what libaom 3.13.3 codes, on this or any other arm. The
194+already-landed inter arm got this right; the intra arm is now the second
195+instance carrying the per-unit walk, and the ss-aware `cu_tx << ss` /
196+`chunk_luma >> ss` forms are the house pattern.
lanes/av1tilerows.report.mdmodified+32 -6
@@ -273,12 +273,38 @@ unvalidated change into a path with zero coverage:
273273 the reach answer in an arm whose unit geometry is still 4:2:0-shaped, with
274274 no gate able to catch the difference.
275275
276-**Recommendation.** Fix H1 first; this site then becomes witnessable and
277-should be repaired as a unit (`cu_tx = 32 << ss_x(fctx)`, `luma_span =
278-cu_tx << ss_x(fctx)`, and the per-chunk chroma origin with it), with the same
279-`<< 1 == * 2` 4:2:0 identity argument. The 4:2:0 identity is not in question —
280-`32 << 1 == 64` — so the repair is provably a no-op for the only format with
281-committed coverage on this path.
276+ > **RETRACTED by `lanes/av1txsizeaudit.report.md` §3.1. DO NOT ACT ON
277+ > ITEM 3 OR THE RECOMMENDATION BELOW.** `blockd.h:1371` is the *body* of
278+ > `av1_get_max_uv_txsize`, and its last line is
279+ > `return av1_get_adjusted_tx_size(uv_tx);`.
280+ > `av1_get_adjusted_tx_size` (`blockd.h:1361`) takes **no subsampling
281+ > argument** and maps `TX_64X64`/`TX_64X32`/`TX_32X64` to `TX_32X32`
282+ > **unconditionally** — the parenthetical "(adjusted → itself)" above is
283+ > the error: it stopped one line short of the adjustment it annotated.
284+ > Measured against libaom's own code (a C probe linked against
285+ > `~/.cache/aom-oracle/build/libaom.a`),
286+ > `av1_get_max_uv_txsize(BLOCK_128X128, 0, 0) == TX_32X32`, and the
287+ > oracle's `EC_TRACE_COEFF` on a 4:4:4 `--sb-size=128` stream shows every
288+ > TX_64X64 luma unit followed by **four** TX_32X32 chroma units per plane
289+ > per 64x64 mu chunk (`cu_tx` stays 32; the unit *count* is what changes,
290+ > 1 → 4 at 4:4:4). The site was repaired correctly by `4bfe8d8e`.
291+ > The generalisation: `max_txsize_rect_lookup` is only half the rule; the
292+ > `av1_get_adjusted_tx_size` call on its result is the other half and it is
293+ > unconditional.
294+
295+**Recommendation (RETRACTED — see the note above).** Fix H1 first; this site
296+then becomes witnessable and should be repaired as a unit (`cu_tx = 32 <<
297+ss_x(fctx)`, `luma_span = cu_tx << ss_x(fctx)`, and the per-chunk chroma origin
298+with it), with the same `<< 1 == * 2` 4:2:0 identity argument. The 4:2:0
299+identity is not in question — `32 << 1 == 64` — so the repair is provably a
300+no-op for the only format with committed coverage on this path.
301+
302+> **The 4:2:0 identity argument does not licence the repair.** `32 << 1 == 64`
303+> is true, and the 4:2:0 adjusted step is inert — but that is an argument about
304+> the one format where the change does nothing, and says nothing about 4:4:4,
305+> where it is wrong. **A subsampling-parameterised expression can only be
306+> certified by the measured value at every subsampling, never by an identity
307+> at one of them.**
282308
283309 **Net class status: the class is closed except for this one site, which is
284310 proven reachable and documented rather than silently changed.**
lanes/av1txsizeaudit.report.mdadded+1097 -0
@@ -0,0 +1,1097 @@
1+# lane-av1txsizeaudit — every transform-size derivation in `crates/ec-av1/src/**`, against libaom's actual rule
2+
3+Base: `main` `9b2f6c9d` (the tip `main` had when this lane started) **plus** the
4+`lane-av1ibc128arm` fix `4bfe8d8e` replayed on top (rebased clean as
5+`2fcc577a`), because the audit subject must be the tree the fix will land on and
6+the invariant gate must be runnable. Branch `lane-av1txsizeaudit`, worktree
7+`/home/user/.cache/wt/av1txsizeaudit`. Oracle `~/.cache/aom-oracle`
8+(aom `v3.13.3-7-g9bb526a`), read-only.
9+
10+**Verdict: 0 transform-size MISMATCH. 2 non-transform-size MISMATCH (context /
11+plane-extent geometry, one of them a sibling of the fixed arm). 3 UNVERIFIED
12+open cells, all already named in `lanes/av1444rect.report.md`. ~100 MATCHES.**
13+The `cu_tx = 32 << ss_x` rule is refuted twice over — by a C probe linked
14+against the oracle's own `libaom.a`, and by the oracle's `EC_TRACE_COEFF` on a
15+4:4:4 `--sb-size=128` stream.
16+
17+---
18+
19+## 0. The rule, restated with citations
20+
21+libaom's chroma transform size is a **three-step table chain**, not arithmetic
22+on the subsampling:
23+
24+```c
25+/* av1/common/blockd.h:1372-1379 (read in the oracle tree) */
26+static inline TX_SIZE av1_get_max_uv_txsize(BLOCK_SIZE bsize, int subsampling_x,
27+ int subsampling_y) {
28+ const BLOCK_SIZE plane_bsize =
29+ get_plane_block_size(bsize, subsampling_x, subsampling_y);
30+ assert(plane_bsize < BLOCK_SIZES_ALL);
31+ const TX_SIZE uv_tx = max_txsize_rect_lookup[plane_bsize];
32+ return av1_get_adjusted_tx_size(uv_tx);
33+}
34+```
35+
36+```c
37+/* av1/common/blockd.h:1361-1370 */
38+static inline TX_SIZE av1_get_adjusted_tx_size(TX_SIZE tx_size) {
39+ switch (tx_size) {
40+ case TX_64X64:
41+ case TX_64X32:
42+ case TX_32X64: return TX_32X32;
43+ case TX_64X16: return TX_32X16;
44+ case TX_16X64: return TX_16X32;
45+ default: return tx_size;
46+ }
47+}
48+```
49+
50+`av1_get_adjusted_tx_size` takes **no subsampling argument**. The 64→32 step is
51+unconditional whenever the plane block's `max_txsize_rect_lookup` entry has a
52+64 axis. Tables: `av1_ss_size_lookup` at `av1/common/common_data.c:19-43`,
53+`max_txsize_rect_lookup` at `av1/common/common_data.h:126-147`.
54+
55+**The two structural facts that decide every row below:**
56+
57+1. `plane_bsize = get_plane_block_size(bsize, ss_x, ss_y)` halves the width by
58+ `ss_x` and the height by `ss_y` **independently**. So the "chroma extent" is
59+ a per-axis `>> ss`, never a `/2` and never a `<< ss`.
60+2. Because the adjustment is per-axis and fires on *any* 64 axis, **a
61+ per-axis `.min(32)` on an already-subsampled chroma extent is an exact
62+ transcription of `av1_get_adjusted_tx_size` over the entire `TX_SIZE`
63+ domain** — not a blanket clamp. Check: `(64,64)|(64,32)|(32,64) → (32,32)`,
64+ `(64,16) → (32,16)`, `(16,64) → (16,32)`, and every other shape is already
65+ ≤ 32 on both axes. This is why the `.min(32)` sites in this crate are right
66+ and why the two rect rows that *preserve* a 16 (`TX_64X16 → TX_32X16`) are
67+ right too.
68+
69+### 0.1 Measured ground truth (not reconstructed from memory)
70+
71+`~/.cache/txaudit/probe.c` linked against `~/.cache/aom-oracle/build/libaom.a`,
72+calling `get_plane_block_size` → `max_txsize_rect_lookup` →
73+`av1_get_adjusted_tx_size` for all 22 block sizes × 4 `(ss_x, ss_y)`. Output in
74+`~/.cache/txaudit/out.txt`; table rendered in §1.0 below. Highlights:
75+
76+```
77+DIRECT bsize=BLOCK_128X128 ss=00 plane_bsize=BLOCK_128X128 max_rect=64x64 adjusted=3 (32x32)
78+DIRECT bsize=BLOCK_128X128 ss=11 plane_bsize=BLOCK_64X64 max_rect=64x64 adjusted=3 (32x32)
79+DIRECT bsize=BLOCK_64X64 ss=00 plane_bsize=BLOCK_64X64 max_rect=64x64 adjusted=3 (32x32)
80+```
81+
82+`av1_get_max_uv_txsize(BLOCK_128X128, 0, 0) == TX_32X32`, i.e. **`32` at every
83+subsampling, never `64` at 4:4:4.**
84+
85+### 0.2 Oracle runtime confirmation (independent of this crate's counters)
86+
87+4:4:4, `--sb-size=128`, `--limit=3`, `--cq-level=62`, gradient y4m
88+(`~/.cache/txaudit/grad444.obu`). Full `EC_TRACE_COEFF` histogram over all
89+3 frames:
90+
91+| plane | tx=0 (4x4) | tx=1 (8x8) | tx=2 (16x16) | **tx=3 (32x32)** | **tx=4 (64x64)** | tx=5 (4x8) | tx=6 (8x4) | tx=7 (8x16) | tx=12 (64x32) | tx=13 (4x16) | tx=14 (16x4) | tx=17 (16x64) | tx=18 (64x16) |
92+|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
93+| luma | 420 | 186 | 75 | 13 | **8** | 130 | 74 | 14 | **2** | 31 | 0 | 0 | 0 |
94+| chroma| 240 | 179 | 80 | 49 | **0** | 134 | 88 | 25 | **0** | 32 | 0 | **0** | **0** |
95+
96+**Luma reads TX_64X64 (8) and TX_64X32 (2). Chroma reads neither, and no
97+64-axis chroma shape at all.** That is the refutation as a runtime artifact.
98+
99+And the mu-chunk structure, verbatim from the trace:
100+
101+```
102+EC_COEFF plane=0 row=0 col=0 tx_size=4 <- luma TX_64X64
103+EC_COEFF plane=1 row=0 col=0 tx_size=3 <- U TX_32X32
104+EC_COEFF plane=1 row=0 col=8 tx_size=3 <- U TX_32X32
105+EC_COEFF plane=1 row=8 col=0 tx_size=3 <- U TX_32X32
106+EC_COEFF plane=1 row=8 col=8 tx_size=3 <- U TX_32X32
107+EC_COEFF plane=2 row=0 col=0 tx_size=3 <- V TX_32X32
108+EC_COEFF plane=2 row=0 col=8 tx_size=3
109+EC_COEFF plane=2 row=8 col=0 tx_size=3
110+EC_COEFF plane=2 row=8 col=8 tx_size=3
111+EC_COEFF plane=0 row=0 col=16 tx_size=4 <- next 64x64 mu chunk
112+```
113+
114+One TX_64X64 luma unit, then **FOUR** TX_32X32 chroma units per plane per
115+64x64 mu chunk, plane-major (all U, then all V), at `(row,col)` step 8 mi
116+(= 32 px / `MI`). The luma step is 16 mi (= 64 px). Under the ticket's rule
117+`cu_tx = 32 << ss_x`, the 4:4:4 chroma unit would have been 64 and each chunk
118+would have held **one** unit; libaom's trace says four of 32.
119+
120+---
121+
122+## 1. The table
123+
124+Line numbers are the current worktree (`decode.rs` = 55960 lines). "adj step"
125+= does the site carry `av1_get_adjusted_tx_size`'s unconditional 64→32? `n-a`
126+= luma, plane dimension, mi coordinate, buffer stride, or scan/eob corner —
127+i.e. not a chroma transform size at all.
128+
129+### 1.0 Ground truth `av1_get_max_uv_txsize` (measured, §0.1)
130+
131+| block | ss_x ss_y | plane bsize | `max_txsize_rect_lookup` | after `av1_get_adjusted_tx_size` |
132+| --- | --- | --- | --- | --- |
133+| 4x4 | 00 / 01 / 10 / 11 | 4x4 | 4x4 | 4x4 |
134+| 4x8 | 00 | 4x8 | 4x8 | 4x8 |
135+| 4x8 | 01 / 11 | 4x4 | 4x4 | 4x4 |
136+| 4x8 | 10 | INVALID | (OOB) | (OOB) |
137+| 8x4 | 00 | 8x4 | 8x4 | 8x4 |
138+| 8x4 | 10 / 11 | 4x4 | 4x4 | 4x4 |
139+| 8x4 | 01 | INVALID | (OOB) | (OOB) |
140+| 8x8 | 00 | 8x8 | 8x8 | 8x8 |
141+| 8x8 | 01 | 8x4 | 8x4 | 8x4 |
142+| 8x8 | 10 | 4x8 | 4x8 | 4x8 |
143+| 8x8 | 11 | 4x4 | 4x4 | 4x4 |
144+| 8x16 | 00 | 8x16 | 8x16 | 8x16 |
145+| 8x16 | 01 | 8x8 | 8x8 | 8x8 |
146+| 8x16 | 11 | 4x8 | 4x8 | 4x8 |
147+| 8x16 | 10 | INVALID | (OOB) | (OOB) |
148+| 16x8 | 00 | 16x8 | 16x8 | 16x8 |
149+| 16x8 | 10 | 8x8 | 8x8 | 8x8 |
150+| 16x8 | 11 | 8x4 | 8x4 | 8x4 |
151+| 16x8 | 01 | INVALID | (OOB) | (OOB) |
152+| 16x16 | 00 | 16x16 | 16x16 | 16x16 |
153+| 16x16 | 01 | 16x8 | 16x8 | 16x8 |
154+| 16x16 | 10 | 8x16 | 8x16 | 8x16 |
155+| 16x16 | 11 | 8x8 | 8x8 | 8x8 |
156+| 16x32 | 00 | 16x32 | 16x32 | 16x32 |
157+| 16x32 | 01 | 16x16 | 16x16 | 16x16 |
158+| 16x32 | 11 | 8x16 | 8x16 | 8x16 |
159+| 16x32 | 10 | INVALID | (OOB) | (OOB) |
160+| 32x16 | 00 | 32x16 | 32x16 | 32x16 |
161+| 32x16 | 10 | 16x16 | 16x16 | 16x16 |
162+| 32x16 | 11 | 16x8 | 16x8 | 16x8 |
163+| 32x16 | 01 | INVALID | (OOB) | (OOB) |
164+| 32x32 | 00 | 32x32 | 32x32 | 32x32 |
165+| 32x32 | 01 | 32x16 | 32x16 | 32x16 |
166+| 32x32 | 10 | 16x32 | 16x32 | 16x32 |
167+| 32x32 | 11 | 16x16 | 16x16 | 16x16 |
168+| 32x64 | 00 | 32x64 | 32x64 | **32x32 (ADJ)** |
169+| 32x64 | 01 | 32x32 | 32x32 | 32x32 |
170+| 32x64 | 11 | 16x32 | 16x32 | 16x32 |
171+| 32x64 | 10 | INVALID | (OOB) | (OOB) |
172+| 64x32 | 00 | 64x32 | 64x32 | **32x32 (ADJ)** |
173+| 64x32 | 10 | 32x32 | 32x32 | 32x32 |
174+| 64x32 | 11 | 32x16 | 32x16 | 32x16 |
175+| 64x32 | 01 | INVALID | (OOB) | (OOB) |
176+| 64x64 | 00 | 64x64 | 64x64 | **32x32 (ADJ)** |
177+| 64x64 | 01 | 64x32 | 64x32 | **32x32 (ADJ)** |
178+| 64x64 | 10 | 32x64 | 32x64 | **32x32 (ADJ)** |
179+| 64x64 | 11 | 32x32 | 32x32 | 32x32 |
180+| 64x128 | 00 | 64x128 | 64x64 | **32x32 (ADJ)** |
181+| 64x128 | 01 | 64x64 | 64x64 | **32x32 (ADJ)** |
182+| 64x128 | 11 | 32x64 | 32x64 | **32x32 (ADJ)** |
183+| 64x128 | 10 | INVALID | (OOB) | (OOB) |
184+| 128x64 | 00 | 128x64 | 64x64 | **32x32 (ADJ)** |
185+| 128x64 | 10 | 64x64 | 64x64 | **32x32 (ADJ)** |
186+| 128x64 | 11 | 64x32 | 64x32 | **32x32 (ADJ)** |
187+| 128x64 | 01 | INVALID | (OOB) | (OOB) |
188+| 128x128 | 00 | 128x128 | 64x64 | **32x32 (ADJ)** |
189+| 128x128 | 01 | 128x64 | 64x64 | **32x32 (ADJ)** |
190+| 128x128 | 10 | 64x128 | 64x64 | **32x32 (ADJ)** |
191+| 128x128 | 11 | 64x64 | 64x64 | **32x32 (ADJ)** |
192+| 4x16 | 00 | 4x16 | 4x16 | 4x16 |
193+| 4x16 | 01 | 4x8 | 4x8 | 4x8 |
194+| 4x16 | 11 | 4x8 | 4x8 | 4x8 |
195+| 4x16 | 10 | INVALID | (OOB) | (OOB) |
196+| 16x4 | 00 | 16x4 | 16x4 | 16x4 |
197+| 16x4 | 10 | 8x4 | 8x4 | 8x4 |
198+| 16x4 | 11 | 8x4 | 8x4 | 8x4 |
199+| 16x4 | 01 | INVALID | (OOB) | (OOB) |
200+| 8x32 | 00 | 8x32 | 8x32 | 8x32 |
201+| 8x32 | 01 | 8x16 | 8x16 | 8x16 |
202+| 8x32 | 11 | 4x16 | 4x16 | 4x16 |
203+| 8x32 | 10 | INVALID | (OOB) | (OOB) |
204+| 32x8 | 00 | 32x8 | 32x8 | 32x8 |
205+| 32x8 | 10 | 16x8 | 16x8 | 16x8 |
206+| 32x8 | 11 | 16x4 | 16x4 | 16x4 |
207+| 32x8 | 01 | INVALID | (OOB) | (OOB) |
208+| 16x64 | 00 | 16x64 | 16x64 | **16x32 (ADJ)** |
209+| 16x64 | 01 | 16x32 | 16x32 | 16x32 |
210+| 16x64 | 11 | 8x32 | 8x32 | 8x32 |
211+| 16x64 | 10 | INVALID | (OOB) | (OOB) |
212+| 64x16 | 00 | 64x16 | 64x16 | **32x16 (ADJ)** |
213+| 64x16 | 10 | 32x16 | 32x16 | 32x16 |
214+| 64x16 | 11 | 32x8 | 32x8 | 32x8 |
215+| 64x16 | 01 | INVALID | (OOB) | (OOB) |
216+
217+Two facts fall out and are used repeatedly below:
218+
219+* **At 4:2:0 the chroma tx is ≤ 32 on both axes for every block size** — so a
220+ `.min(32)` there is a no-op and any *hardcoded 32* is a 4:2:0 accident that
221+ happens to be right.
222+* **At 4:2:0 the adjusted step DOES fire** for the 64x128 / 128x64 / 128x128
223+ roots (their plane block is BLOCK_64X64 / BLOCK_32X64 / BLOCK_64X32) — and it
224+ fires to the same 32x32 a per-axis `.min(32)` produces. That is precisely why
225+ the 4:2:0 path is byte-identical across every `.min(32)` vs `.min(64)` choice.
226+* `INVALID` = `av1_ss_size_lookup` maps that (shape, ss) to `BLOCK_INVALID`,
227+ which libaom indexes **out of bounds** in `max_txsize_rect_lookup`. That is
228+ libaom's own quirk, already modelled in this crate by the
229+ `chroma_422_oob` / `ChromaRect8x4` arms and measured at TX_4X8. Not this
230+ audit's rule; 4:2:2 is refused by name at the sequence header anyway.
231+
232+### 1.1 `crates/ec-av1/src/decode.rs` — chroma transform sizes (the real audit)
233+
234+| file:line | what it computes | libaom rule | adj step | evidence | verdict |
235+|---|---|---|---|---|---|
236+| `decode.rs:12100-12102` | `(64,32)\|(32,64)\|(32,32) => (32,32)`; `(64,16) => (32,16)`; `(16,64) => (16,32)` — the tiled chroma unit of `decode_rect_split` | `av1_get_adjusted_tx_size`, blockd.h:1361 | **yes** | measured table §1.0: 4:4:4 `64X32`→32x32, `64X16`→32x16, `16X64`→16x32. The rect rows *keep* a 16, so this is a genuine per-axis transcription, not `min(32)` on both | MATCHES — the reference transcription |
237+| `decode.rs:18907` | `(uw,uh) = (chroma_w.min(32), chroma_h.min(32))` + `nw,nh = chroma/uw` | same | **yes** | input is already chroma (`11492: chroma_w = bw >> ss_x`) — clamp AFTER subsample, correct order. 4:4:4 `64x32`→(32,32)/2 units, `64x16`→(32,16), `16x64`→(16,32). 4:2:0: inert (already ≤32) | MATCHES |
238+| `decode.rs:28702` | `(uw,uh) = (write_chroma_w.min(32), write_chroma_h.min(32))` in `read_inter_rect_chroma` | same | **yes** | same order; `side > 64` is consumed by the mu-chunk arm at `40357` first, so every reachable footprint ≤64 per axis | MATCHES |
239+| `decode.rs:9126-9127` | `uv_tx_w/h = ((w_mi*MI) >> ss).max(4).min(32)` — chroma tx published to the deblocker's `uv_tx_grid` | `av1_get_max_uv_txsize`; libaom reads `block_size_wide[plane_bsize]` at `reconintra.c:1936-1944` | **yes** | 4:2:0 128 root: `128>>1=64`→32 = libaom 32x32. 4:4:4 128 root: `128>>0=128`→32 = libaom `adjusted(TX_64X64)`=32x32. 4:4:4 `64x16`: →(32,16) = libaom TX_32X16. 4:4:4 `16x64`: →(16,32) | MATCHES (comment says "under 4:2:0" — **stale prose**, the code is ss-generic and right at 4:4:4) |
240+| `decode.rs:20632` | `let tx = if side >= 64 { 32 } else { side }` → `chroma_tx`/`chroma_tx_h` in `decode_block` | `av1_get_max_uv_txsize` | **yes, this IS the step** | arm is `else if ss_x==0 && ss_y==0` → 4:4:4 only, where `plane_bsize == bsize`. `decode_block` is only called with square 8/16/32/64/128; substitute: 8→8, 16→16, 32→32, 64→32, 128→32 — every one equals the measured 4:4:4 column | MATCHES |
241+| `decode.rs:38686` | same expression → `chroma_tx`/`chroma_set`/`scan` in `decode_inter_block` | same | **yes** | guard `ss_x==0 && ss_y==0 && strip_chroma.is_none()`. A rect strip is diverted at `40409` to `read_inter_rect_chroma`, which recomputes per-axis, so the square is never applied to a rect | MATCHES |
242+| `decode.rs:22086` | `chroma_tx = if lossless_frame { 4 } else { 32 }` in `decode_block_128rect` | same | **yes (hardcoded)** | block sizes are **only** `(128,64)` and `(64,128)` (callers `33214/33220/33337`; 128x128 goes to `decode_block`). Measured: both are **32x32 at all four (ss_x,ss_y)**. Not merely inert-correct: the per-axis consumer at `22113-22114` is `(64>>ss_x)/chroma_tx × (64>>ss_y)/chroma_tx` = 2×2 = four units at 4:4:4, 1×1 at 4:2:0 | MATCHES |
243+| `decode.rs:14115`, `40136`, `41923`, `42900` | `let cu_tx = 32usize;` — the chroma unit of one 64x64 mu chunk (intra-BC 128 root / single-ref / compound / **the fixed intra-in-inter arm**) | `av1_get_max_uv_txsize` | **yes** | `side > 64` guard ⇒ BLOCK_128X128/128X64/64X128 only. Measured: 32x32 at every subsampling. The step is carried in the *division* below, not the literal | MATCHES (4 sites) |
244+| `decode.rs:14130-14131`, `14365-14366`, `40149-40150`, `41936-41937`, `42921-42922` | `chunk_chroma_w/h = (64usize) >> ss_x/ss_y` | `block_size_wide[plane_bsize]`, reconintra.c:1943 | n-a (plane block) | per-axis: 4:2:0 32x32, 4:2:2 32x64, 4:4:4 64x64 | MATCHES |
245+| `decode.rs:14136-14137`, `14359-14360`, `40164-40165`, `41951-41952`, `42907-42908` | `unit_luma_w/h = cu_tx << ss_x/ss_y` — the unit's LUMA footprint in px | `mi_size_wide[plane_bsize] >> ss_x` inverted | n-a (coord) | `32<<0=32` (8 mi) at 4:4:4, `32<<1=64` (16 mi) at 4:2:0. **This is a `<< ss` on a LUMA span, not on a tx size** — the ticket conflated the two | MATCHES |
246+| `decode.rs:40151-40152`, `41938-41939`, `42923-42924`, `22113-22114`, `22214-22215` | `units_w/h = chunk_chroma_w/h / cu_tx`, `(64 >> ss)/chroma_tx` — units per plane per mu chunk | `decode_token_recon_block`'s chroma loop | **yes (in the division)** | 4:2:0 `32/32`=1 → one unit; 4:4:4 `64/32`=2 → **2×2 = FOUR units**; matches the oracle trace in §0.2 exactly. Under the ticket's rule this would be 1 | MATCHES |
247+| `decode.rs:40450-40451`, `42243-42244` | `cu_tx = chroma_tx; mu_units_n = chroma_side / cu_tx` — the 4:4:4 `chroma_side > chroma_tx` arm | `av1_get_max_uv_txsize(BLOCK_64X64, 0, 0)` = `adjusted(TX_64X64)` = TX_32X32 | **yes (inherited)** | guard `ss_x==0 && ss_y==0 && chroma_side > chroma_tx` with `side > 64` already consumed ⇒ `side == 64`; `64/32 = 2` → four units per plane, plane-major | MATCHES |
248+| `decode.rs:14354`, `43652` | `cu = if lossless { 4 } else { 32 }` — the mu-chroma re-stamp's unit size | TX_32X32 / lossless TX_4X4 | **yes** | reachable only when `mu_chroma`, set exclusively by the TX_32X32 and lossless arms | MATCHES |
249+| `decode.rs:22072` | `logical_tx = if lossless_frame { 4 } else { 64 >> depth }` | `read_tx_size`, decodeframe.c:1117 | n-a (luma) | lossless returns TX_4X4 before the tree is consulted | MATCHES |
250+| `decode.rs:22077` | `coeff_tx_side = logical_tx.min(32)` | `av1_get_max_eob`, spec 5.11.40 — a 64-length axis codes only its low 32 coefficients | n-a (luma eob corner) | paired with `default_scan(coeff_tx_side)` at `22083` | MATCHES |
251+| `decode.rs:18794` | `(luma_cw, luma_ch) = (bw.min(32), bh.min(32))` — the LUMA corner of a 64-axis strip | `av1_get_adjusted_tx_size` applied to luma `max_txsize_rect_lookup` | n-a (luma) | `64x32 → 32x32`, `64x16 → 32x16` — same per-axis law. The chroma twin is `18907` and is computed independently from `11492`; the two are never conflated | MATCHES |
252+| `decode.rs:45693` | `uv_tx = default_intra_tx_type(uv_predict_mode)` — a `TxType`, **not a size** | — | n-a | the *size* is the `bw,bh` handed to `read_coeffs_rect`; guard `chroma_444 && bw != bh` ⇒ plane block BLOCK_8X4/BLOCK_4X8, `max_txsize_rect_lookup` identity, one rect unit fills the plane block | MATCHES (not a site) |
253+| `decode.rs:47200` | `chroma_tx = if chroma_w == 8 { TX8 } else { TX4 }` in `decode_inter_block8` (`SIDE = 8` const) | `av1_get_max_uv_txsize(BLOCK_8X8, ss)` | n-a (no 64 axis reachable) | 4:2:0 plane block BLOCK_4X4 → TX4 ✓; 4:4:4 BLOCK_8X8 → TX8 ✓; 4:2:2 BLOCK_4X8 → `ChromaRect8x4`/`SCAN_4X8` via `read_inter_plane_rect` ✓. No 16-wide leaf exists in this fn | MATCHES |
254+| `decode.rs:14697` + `14805-14819` | `decode_block_rect` chroma: plane block → `TxbSet`/scan table | `av1_get_max_uv_txsize` | vacuous | called only with 32x16/16x32 strips (all 8 call sites); at 4:4:4 the largest plane block is BLOCK_32X16 = TX_32X16, identity under the adjustment. The `_ =>` arm **refuses** any other shape, so a future 64-axis caller cannot fall through | MATCHES |
255+| `decode.rs:15340` + `15414-15437` | `decode_leaf_rect` chroma (16x8/8x16 leaves) | same | vacuous | largest 16x8; 4:4:4 → 16x8 identity, 4:2:2 → 8x8 identity | MATCHES |
256+| `decode.rs:15932` + `15942-15972` | `decode_block_rect4` chroma (32x8/8x32 strips) | same | vacuous | 4:4:4 → BLOCK_32X8 = TX_32X8 identity, the `(32,8)` row at `15945`. The 4:2:2 `(4,32)` row is the BLOCK_INVALID OOB case (different rule). `_ =>` `unreachable!`s | MATCHES |
257+| `decode.rs:11541-11542` | `(8,4)/(4,8) => ChromaRect8x4` | `max_txsize_rect_lookup[BLOCK_8X4/4X8]` = TX_8X4/TX_4X8, identity | n-a | one rect unit fills the plane block | MATCHES |
258+| `decode.rs:44799-44811`, `46792-46809` | the 4:2:0 group-unit chroma arm (`B4`/`Chroma4`) in `decode_inter_sub8_split4` and `decode_inter_sub8_rect2` | `av1_get_max_uv_txsize(BLOCK_8X8, 1, 1)` = `max_txsize_rect_lookup[BLOCK_4X4]` = TX_4X4 | n-a | guarded `!chroma_444 && !chroma_422 && !intra_chroma` ⇒ **4:2:0 only**; at 4:4:4 the per-piece arm runs instead. Checked specifically because `B4` looks like a possible 4:4:4 miss — it is not | MATCHES |
259+| `decode.rs:11261`, `13124` | palette colour-index map extent `(bw>>ss_x).max(4), (bh>>ss_y).max(4)` | `av1_get_plane_block_size(bsize,1,1)`, common_data.c:19-43 — the PLANE BLOCK, not the transform | n-a | a palette block codes one colour-index sample per plane-block pixel regardless of how its coefficients are transformed. `.max(4)` is required: `BLOCK_16X4 → BLOCK_8X4` at 4:2:0, a plain halving read half the symbols | MATCHES (plane block) |
260+| `decode.rs:22673` | `(cw,ch) = (8>>ss_x, 8>>ss_y)` | plane block | n-a | per-axis plane extent | MATCHES (plane) |
261+| `decode.rs:21604-21606` | `plane_px = ((span_mi*MI)>>ss_x).max(4)`, `over_w_px/over_h_px` | `max_block_wide/high` in chroma px | n-a | frame-edge clip, not a transform | MATCHES (plane) |
262+| `decode.rs:29572` | `plane_dim = ((dim_mi*MI)>>ss).max(4)` | plane dimension | n-a | boundary test, not a transform | MATCHES (plane) |
263+
264+### 1.2 `crates/ec-av1/src/decode.rs` — luma sites (in the taxonomy, not chroma sizes)
265+
266+| file:line | what | libaom rule | adj step | verdict |
267+|---|---|---|---|---|
268+| `11404` | `depth_to_tx_wh`: `(bw.min(64), bh.min(64))` | `depth_to_tx_size`, blockd.h:1354-1359 (`max_txsize_rect_lookup[bsize]` then `sub_tx_size_map` × depth) | n-a (luma) | MATCHES — `min(64)` is the table's TX_64X64 ceiling; every caller's block is ≤64 so it is a no-op on the whole reachable set |
269+| `13166`, `22057`, `27463` | `tx_size_context_txfm_rect(..., bw.min(64), bh.min(64))` and the callee's re-clamp | `get_tx_size_context` compares `tx_size_wide[max_txsize_rect_lookup[bsize]]` | n-a (luma) | MATCHES — the clamp is inside the helper so all 7 callers inherit it; a 128-axis block is diverted to `decode_block_128rect` before reaching here |
270+| `20723`, `20787`, `27578`, `28070`, `28109-28110` | `max_tx = side.min(64)` (var-tx tree entry, `read_tx_size`, `read_block_tx_size`) | `max_txsize_rect_lookup` ceiling | n-a (luma) | MATCHES — 128 enters at 64 = `max_txsize_rect_lookup[BLOCK_128X128]`, sharing BLOCK_64X64's `tx_size_cat3` row |
271+| `27629` | `max_tx = blk_max_px.min(64)` in `txfm_partition_ctx_rect` | `txfm_partition_context`, `get_sqr_tx_size` | n-a (luma) | MATCHES — `max_idx = log2(max_tx)-2`; 128→4→idx 0, same as BLOCK_64X64 |
272+| `28563` | `tx = 64usize` under `bw.max(bh) > 64` in `read_block_tx_size_rect` | `max_txsize_rect_lookup[BLOCK_128X64/64X128]` = TX_64X64 | n-a (luma) | MATCHES |
273+| `13836-13837`, `14464-14465`, `16859-16860` | `bw.min(64) as u8, bh.min(64) as u8` — luma transform published to `tx_grid` | `set_txfm_ctxs(mbmi->tx_size)` | n-a (luma grid) | MATCHES — a 128 root's `mbmi->tx_size` is TX_64X64; `128.min(64)=64` |
274+| `13632`, `14081`, `40049`, `41789`, `42701` | `default_scan(tw.min(32))` / `default_scan(tx_px.min(32))` | `av1_scan_orders`, scan.c:1744-1762 — TX_64X64/64X32/32X64 **alias to `default_scan_32x32`** | n/a — table-boundary guard, *not* the adjusted step | MATCHES — load-bearing (a 128 root's luma leaf really is TX_64X64, asserted at `13706`) and correct, sourced independently. `default_scan` only builds 4/8/16/32 |
275+| `28925` | `(cw,ch) = (w.min(32), h.min(32))` in `read_inter_plane_rect` | `av1_get_max_eob` | n-a (eob corner) | MATCHES — `w,h` are the true rect transform dims; `rect_shape` preserves the nominal |
276+| `36015` | `tx_side = side.min(32)` in `read_inter_plane` | `av1_get_max_eob` | n-a (eob corner) | MATCHES — inert below 64, `extend_corner` re-widens |
277+| `494` | `cfl_allowed_px`: `(bw>>ss_x).max(4)==4 && (bh>>ss_y).max(4)==4` | `is_chroma_sub8_x/y` shape (blockd.h:1533) — a plane-block `== 4` test | n-a | MATCHES — 4:2:0 8x8 → 4x4 true; 4:4:4 8x8 → 8x8 false, which is the documented `wrong-alphabet-same-value` case |
278+| `37601-37602` | `overlap_above/left = write_{h,w}.min(64)/2` | `av1_build_obmc_inter_prediction`, reconinter.c 860/899 | n-a | MATCHES (prediction overlap, not a transform) |
279+| `19636` | `cfl_ac_q3_at`'s `(bw/2, bh/2)` | 2x2 luma average | n-a | MATCHES (per-sample CfL AC; the 4:4:4/4:2:2 forms are separate branches at `19585`/`19599`, so this arm is 4:2:0-only) |
280+
281+### 1.3 `crates/ec-av1/src/decode.rs` — mi coordinates, plane origins, strides (listed, all n-a)
282+
283+`9915-9916` `snap_x/snap_y = (1<<ss)-1` (a mi-coordinate de-offset mask, libaom
284+`set_mi_row_col`'s `& ss`; correctly 0 at 4:4:4) · `11490-11492`,
285+`13890-13899`, `14696-14697`, `15339-15340`, `15931-15932`, `18699-18700`,
286+`20804`, `22093-22094`, `22623`, `24568`, `25200`, `26340`, `33111-33112`,
287+`33230-33239` — plane origins and plane extents, all per-axis `>> ss` ·
288+`20805`+`20808` `chroma_side`/`chroma_height` (per-axis, the sibling pair
289+libaom's rect chroma needs) · `38655` `chroma_side = (side>>ss_x).max(side>>ss_y)`
290+(a **buffer stride**, the enclosing square; documented at `38645-38654`) ·
291+`12023-12024` `span = 4 << ss`, `12137-12138` `luma_span = uw << ss`,
292+`22236-22240`, `28762`, `36103-36105`, `36145-36146`, `36265-36306`,
293+`18007-18106`, `42982-42984` — the LUMA footprint of a chroma unit, and the
294+`ox << ss_x` / `oy << ss_y` pair-extent form. All MATCHES: plane/coord, not a
295+transform size. `30510-30511` is a frame dimension. `27357-27358`, `27371-27372`,
296+`31627-31628`, `31848` are plane/loop-filter spans. `29452` is an OBMC step.
297+`33111-33239` is plane bookkeeping. None of these is a transform size.
298+
299+### 1.4 `crates/ec-av1/src/decode.rs` — the two non-transform MISMATCHes + the open cells
300+
301+| file:line | what it computes | libaom rule | adj step | evidence | verdict |
302+|---|---|---|---|---|---|
303+| `decode.rs:9103` | `suppress_internal_lf_edges`: `(uv_w, uv_h) = ((w_mi*MI/2).max(4), (h_mi*MI/2).max(4))` — the chroma extent the deblocker is told the skipped block has, so no internal edge reads as a TU edge | libaom's analogue is `set_one_param_for_line_luma/_chroma` (`mbmi->skip_txfm && is_inter_block` ⇒ the block's own mode_lf_lut row 0, no internal TU edge); the port emulates it by publishing the block's own chroma extent | **no** — hardcoded `/2`, not `>> ss` | Its **sibling `fill_lf_grid_rect` at `9126-9127` was already repaired to `>> ss_x(fctx)`; this one was not.** Reachability: sole caller `43954-43956`, guard `skip_inter_128 = skip && is_inter && write_w.max(write_h) > 64` — a SKIP inter 128x128/128x64/64x128 block, fully reachable at **4:4:4** (only 4:2:2 is refused). At 4:2:0 `128/2 = 64` = `128>>1` ✓; at 4:4:4 the code yields **64** where the block's chroma extent is **128** | **MISMATCH** — charter C1 |
304+| `decode.rs:42974` | `let cu_around = neighbours.around_mi(unit_mi, unit_luma_w);` — the coefficient-context gather inside the **fixed** intra-in-inter mu walk | `get_txb_ctx_general`, txb_common.h:293-309: `txb_w_unit = tx_size_wide_unit[tx_size]` and `txb_h_unit = tx_size_high_unit[tx_size]` — **per axis** | n/a (context geometry, not a size) | `around_mi` (`9553`) takes ONE `side` and gathers `side/MI` cells in **both** axes. `around_mi_rect` (`9662`) is the same loop with the two extents split; with `w == h` it is byte-identical. The inter twin at `14191-14192` already calls `around_mi_rect(unit_mi, unit_luma_w, unit_luma_h)`, and the record at `42996+` is per-axis. `unit_luma_w != unit_luma_h` only at 4:2:2, where it over-gathers 8 mi of LEFT (or ABOVE) context libaom does not read. At 4:2:0 and 4:4:4 `unit_luma_w == unit_luma_h` ⇒ inert | **MISMATCH (4:2:2 only)** — charter C2 |
305+| `decode.rs:13361-13373` | `decode_intrabc_rect`: the LOSSY arm's `(px/2, py/2)` and `(bw/2, bh/2)` chroma origin/extent (the lossless arm beside it uses `>> ss_x/ss_y`) | `block_size_wide[plane_bsize]`, reconintra.c:1943 | n/a (plane extent) | At 4:2:0 the `/2` is exactly `>> ss` for both axes ✓. At **4:4:4** a lossy intrabc rect strip reads **half** the chroma plane block. The `/2` is guarded only by `lossless(fctx)` — the `>> ss` path is the *lossless* one, so the defect is on the lossy side, i.e. 4:2:0-shaped arithmetic on the arm 4:4:4 actually uses. Already a declared open cell (`lanes/av1444rect.report.md:258,343,373`) | **UNVERIFIED** — missing: a 4:4:4 **lossy** `use_intrabc` rect-strip fixture (0 of the pinned fixtures decode one) |
306+| `decode.rs:16558` | `decode_intrabc_owned_rect`: `(cw, ch) = (bw/2, bh/2)` — **no** `lossless` branch at all | same | n/a (plane extent) | Same defect with no scoping guard. Sole caller `18525`, reached only when `intrabc.is_some()` — a 4:4:4 screen-content key frame with a 64-axis intrabc strip | **UNVERIFIED** — same open cell, reached through a 64-axis rather than a 32-axis strip |
307+| `decode.rs:28453` | `(cw,ch) = (w.min(32), h.min(32))` in the `corner_scan` closure of a `#[test]` | `av1_get_max_eob` | n-a (test) | production twin is `28925`; the test asserts every rect shape the census lists has a table | MATCHES (test) |
308+
309+### 1.5 `crates/ec-av1/src/qm.rs`
310+
311+| file:line | what | libaom rule | adj step | evidence | verdict |
312+|---|---|---|---|---|---|
313+| `qm.rs:57` | `fn adjusted(w,h) -> (usize,usize)` — the qmatrix shape reuse | `av1_get_adjusted_tx_size`, blockd.h:1361-1370 | **yes — this IS it** | Exact five-arm transcription: `(64,64)\|(64,32)\|(32,64) → (32,32)`, `(64,16) → (32,16)`, `(16,64) → (16,32)`, else identity. Matches blockd.h arm for arm | MATCHES |
314+| `qm.rs` `shape_range` | the shapes `adjusted` is asked about | `av1_get_max_eob` 1024 cap | **yes** | covers the 14 own-storage shapes, so `adjusted` never misses a shape the encoder can produce | MATCHES |
315+| `qm.rs` `iwt_matrix` | column-major stride fed through the adjusted height | — | **yes** | the adjusted height is the stride, matching libaom's coefficient buffer | MATCHES |
316+
317+### 1.6 `crates/ec-av1/src/transform.rs`
318+
319+| file:line | what | libaom rule | adj step | evidence | verdict |
320+|---|---|---|---|---|---|
321+| `transform.rs` (4 decode-side sites) | `cols = w.min(32)`; the `i < 32` row gate; `t[cols..w].fill(0)`; `get_rect_tx_log_ratio` | `av1_get_max_eob`, spec 5.11.40 — a 64-axis transform codes only its 32x32 corner | **yes, per axis** | The per-axis `min(32)` is the adjusted step, applied unconditionally per axis, and is exact for all 19 shapes | MATCHES |
322+| `transform.rs` `Transform_Row_Shift` | the row-shift table, including every 64-axis row | `av1_scan_orders`, scan.c:1744-1762 | **yes** | 64x64/64x32/32x64 rows all shift as 32x32, matching libaom's alias | MATCHES |
323+| `transform.rs:1644`, `2088`, `2165` | encoder-side coded-corner clamps | same | **yes** | same rule on the write side | MATCHES |
324+
325+### 1.7 `crates/ec-av1/src/quant.rs`
326+
327+| file:line | what | libaom rule | adj step | evidence | verdict |
328+|---|---|---|---|---|---|
329+| `quant.rs` (4 sites) | `dq_denom` / `dq_denom_area`, keyed on the TRUE tx area `w*h` | `av1_get_tx_scale`, quant_common.c — keyed on `tx_size_2d` | **no, and correctly so** | 64x64 must give 4096→4, **not** 1024→2. libaom's `av1_get_tx_scale` uses the nominal size; the adjusted step is a *coefficient-buffer* concept, not a quantiser one | MATCHES |
330+
331+### 1.8 `crates/ec-av1/src/tile.rs`
332+
333+| file:line | what | libaom rule | adj step | evidence | verdict |
334+|---|---|---|---|---|---|
335+| `tile.rs:5490`, `5537`, `5504`, `5559`, `5593` | luma var-tx roots: `max_tx = side.min(64)`, `>> depth`, `/2` | `max_txsize_rect_lookup` + `sub_tx_size_map` | n-a (luma) | pure luma, no adjustment | MATCHES |
336+| `tile.rs:5380` | `coeff_side = tx.min(32)` | `av1_get_max_eob` | **yes** | the coded-position count, carrying the step | MATCHES |
337+| `tile.rs` `TxbSet::Luma64` | side 32, eob 1024 | `av1_get_max_eob` 1024 cap | **yes** | the 32x32 corner | MATCHES |
338+| `tile.rs` `TxbSet::Chroma4/8/16/32` | the chroma side = luma side / 2 | `av1_get_max_uv_txsize` at 4:2:0 | **yes, implicit** | reproduces the 4:2:0 column exactly including the 32 cap; the encoder writes 4:2:0 only (`encode.rs:2191-2192`, `encoder.rs:77`), so the `/2` is exact by construction | MATCHES |
339+| `tile.rs:5000-5004` | `palette_uv_side(side) = av1_get_plane_block_size(bsize,1,1)` floored at 4 | common_data.c:19-43 | n-a (plane block) | not a transform size; the `4 << ss`-free floor is the 4-px minimum | MATCHES (plane) |
340+| `tile.rs:3355-3359` | `tx_size_ctx(..., max_tx)` | `get_tx_size_context` | n-a (luma) | neighbour transform bookkeeping | MATCHES (luma) |
341+
342+### 1.9 `crates/ec-av1/src/encode.rs` (ENCODER — a mismatch here is a rate/bitstream defect, not a decode defect)
343+
344+| file:line | what | libaom rule | adj step | evidence | verdict |
345+|---|---|---|---|---|---|
346+| `encode.rs:5302-5304` | `c = side / 2; c.min(32)` — the only real chroma-tx derivation | `av1_get_max_uv_txsize` at 4:2:0 | **yes** — `.min(32)` IS the step | 4:2:0 only (`encode.rs:2191-2192` constrains the encoder to 4:2:0), so no site is reachable with a 64 chroma axis | MATCHES |
347+| `encode.rs:4777-4780` | `max_tx_depth(side)` | `MAX_VARTX_DEPTH` = 2 | n/a | `max_tx_depth(64) = 0` sits *below* libaom's 2 — a search restriction with no bitstream consequence (it costs bits, it does not desync) | MATCHES (encoder search) |
348+| `encode.rs:5256-5270` | `txfm_split_bits`: `max_tx = side.min(64)`, `max_tx/2` | `read_block_tx_size` | n/a (luma) | rate model | MATCHES (encoder) |
349+| `encode.rs:4777`, `5532-5543`, `5612-5613`, `6241-6256`, `6759-6762`, `6804-6808`, `7281-7285` | remaining luma var-tx / chroma-extent derivations | as above | n/a / vacuous | zero `<< ss` sites in the whole file; every chroma transform side is `side/2` at 4:2:0 | MATCHES |
350+
351+### 1.10 `crates/ec-av1/src/cdf_state.rs`
352+
353+| file:line | what | libaom rule | adj step | evidence | verdict |
354+|---|---|---|---|---|---|
355+| `cdf_state.rs` `TxbTables.side` | the entropy-context shape | `get_txsize_entropy_ctx`, entropy.h:172 — squares UP, **no** adjustment | **no, correctly** | `LumaRect32x8` gets side 16, not 32 | MATCHES |
356+| `cdf_state.rs` `eob_pt` table length | the CODED-position count | `av1_get_max_eob` | **yes** | `Luma64 → 1024` = the 32x32 corner | MATCHES |
357+
358+Two different libaom rules, both transcribed correctly.
359+
360+### 1.11 `crates/ec-av1/src/stream.rs`, `refusal_inventory.rs`, `gate_coverage.rs`, `census.rs`, `restoration.rs`, `examples/`
361+
362+| file:line | what | verdict |
363+|---|---|---|
364+| `stream.rs:2458-2492` | source-scan test pinning `"let unit_luma_w = cu_tx << ss_x(fctx);"`, `"let (cw, ch) = (bw >> ss_x(fctx), bh >> ss_y(fctx));"`, and a `per_axis_units` closure `(64>>ss_x)/32 * (64>>ss_y)/32` asserting 1 / 2 / 4 | MATCHES — and it pins the rule **correctly**. All six pinned strings assert either a luma-grid conversion of a chroma unit or a plane extent; **none** asserts a subsampling-dependent chroma *transform* size. `per_axis_units` agrees with libaom. (Its `ss(1,0)` arm is dead — 4:2:2 is refused.) |
365+| `refusal_inventory.rs:1533-1668` | the single most direct pin of the rule in the crate: `chroma_w = bw >> ss_x` **then** `unit = (chroma_w.min(32), chroma_h.min(32))` | MATCHES — it pins the **correct composition order** (halve first, then cap per axis), the opposite of the wrong rule. Its 8-case walk is checked against the five-arm table. |
366+| `refusal_inventory.rs:1577` | source-scan pin of `"(bw >> ss_x(fctx), bh >> ss_y(fctx))"` | MATCHES (plane extent) |
367+| `refusal_inventory.rs:1654-1656` | a doc citing `av1_ss_size_lookup[BLOCK_8X16][1][1] = BLOCK_4X8 → max_txsize_rect_lookup[BLOCK_4X8] = TX_4X8` via `av1_get_max_uv_txsize` | MATCHES — measured: `BLOCK_8X16` at 4:2:0 → plane BLOCK_4X8 → TX_4X8 ✓ |
368+| `restoration.rs:439-440`, `531-542`, `1504` | `>> ss` on a plane dimension, an LR mi step, an LR stripe height | MATCHES (plane/coord — the charter's explicit non-sites) |
369+| `gate_coverage.rs`, `census.rs` | census of aomenc tool-FLAG **spellings** (`enable-tx64`, `enable-tx-size-search`, `enable-rect-tx`); `census.rs:198` lists the four `tx_size_cat*` symbol names | MATCHES — no transform-size site. **`enable-tx64` is an encoder switch, not a transform size, and carries no 64→32 step**; nothing here pins the wrong rule |
370+| `examples/decode_probe.rs:105-111`, `examples/syntax_census.rs:56-72`, `enc_probe.rs`, `dump_yuv.rs`, `alloc_probe.rs` | print counters / classify symbol names | MATCHES (no site) |
371+| `mc.rs`, `intra.rs`, `warp.rs`, `sequence.rs`, `superres.rs`, `bits.rs`, `msac.rs`, `compound.rs`, `motion.rs`, `motion_field.rs`, `speed.rs`, `par.rs`, `film_grain.rs`, `filter_search.rs`, `encoder.rs`, `frame.rs` | `frame.rs`'s two near-hits are the `tx_mode_select` header bit and `using_qmatrix`/`qm_y`/`qm_u` (a frame flag and matrix **levels**) | MATCHES — no transform-size site in any of them |
372+
373+---
374+
375+## 2. Verdicts
376+
377+### 2.1 Transform sizes: 0 MISMATCH
378+
379+Every site that can reach a 64 axis at 4:4:4 either carries
380+`av1_get_adjusted_tx_size` (as a `.min(32)` per axis, an explicit five-arm
381+table, a `if side >= 64 { 32 }`, or — in the mu-chunk walks — as a division
382+`chunk_chroma / cu_tx` that reads 2×2 = four units) or is provably never
383+reachable with one. The rule's central case — a 4:4:4 128x128 block coding
384+**four** 32x32 chroma units per 64x64 mu chunk — is implemented at four
385+independent sites (`14115`, `40136`, `41923`, `42900`) and confirmed against
386+the oracle's own trace (§0.2).
387+
388+The luma `min(64)` and `min(32)` clamps are a **different** libaom rule
389+(`max_txsize_rect_lookup`'s ceiling and `av1_get_max_eob`'s 1024 cap, with
390+`av1_scan_orders` aliasing every 64-axis scan to `default_scan_32x32`) and are
391+all correct; the audit keeps them separate from the chroma rule so the two are
392+never conflated.
393+
394+### 2.2 Two MISMATCHes, both non-transform — chartered, not fixed here
395+
396+**C1 — `decode.rs:9103`, `suppress_internal_lf_edges`'s hardcoded `/2`.**
397+Ship a 4:4:4 + `--sb-size=128` **skipped inter 128 root** fixture. With it:
398+replace `(w_mi * MI / 2)` with `(w_mi * MI) >> ss_x(fctx)` and
399+`(h_mi * MI / 2)` with `(h_mi * MI) >> ss_y(fctx)` — the identical two-line
400+form its sibling `fill_lf_grid_rect` (`9126-9127`) already uses — then
401+red-before by reverting only the two shifts. The missing witness is the whole
402+blocker: a deblocker difference is not observable on any pinned 4:2:0 or
403+4:4:4 intra fixture, and per `lanes/av1tilerows.report.md:254-256` ("I could
404+not build a witness, and I will not ship an unvalidated change into a path with
405+zero coverage") an unproven change here would be the same mistake in reverse.
406+Consequence if shipped unfixed: at 4:4:4 a SKIP inter 128 root publishes a
407+chroma extent of 64 where libaom's block has 128, so the deblocker filters an
408+internal chroma edge at 64 that libaom's `set_one_param_for_line_*` suppresses.
409+
410+**C2 — `decode.rs:42974`, `around_mi` where the arm's own twin uses
411+`around_mi_rect`.** This one *is* a one-line change and it is provably inert at
412+4:2:0 and 4:4:4 (`around_mi_rect(m, w, h)` with `w == h` is the same loop over
413+the same arrays — compare `9553-9579` with `9662-9686`; the identity set below
414+is the empirical check). It is still chartered rather than fixed, for two
415+reasons that the brief's own rule demands: (a) it is **4:2:2-only**, and 4:2:2
416+is refused by name at the sequence header, so no gate in the repo can be made
417+red — a fix I cannot prove red-before is exactly what the brief says not to
418+ship; (b) it is a *context-geometry* defect, not a transform size, so it is
419+outside the class this lane was chartered to fix. A 4:2:2 lane with
420+`EC_AV1_ALLOW_422_PROBE` (never committed) can land it in one line.
421+
422+### 2.3 Three UNVERIFIED open cells (all pre-existing, all already named)
423+
424+`decode.rs:13361-13373` and `decode.rs:16558`: the intra-BC rect-strip chroma
425+footprint is hardcoded `bw/2, bh/2` on the lossy side, where libaom's plane
426+block at 4:4:4 is the block itself. Both belong to the open cell recorded at
427+`lanes/av1444rect.report.md:258,343,373`; the 64-axis path (`16558`) has no
428+`lossless` scoping, which the report should be amended to say. **Missing for
429+both: a 4:4:4 lossy `use_intrabc` rect-strip fixture** — zero of the pinned
430+fixtures decode one. Decodes wrong if reached: half the chroma plane block of a
431+4:4:4 lossy intrabc strip.
432+
433+### 2.4 Stale prose (not a defect)
434+
435+`decode.rs:9123-9125` says `uv_tx_w`'s derivation is "under 4:2:0". The code is
436+subsampling-generic and **correct at 4:4:4**, where the adjusted step is the
437+load-bearing part. Worth a comment edit in the next lane that touches the file;
438+it is the kind of stale qualifier that is how the wrong rule got reintroduced
439+once already.
440+
441+---
442+
443+## 3. Refuted rules
444+
445+### 3.1 The rule that was wrong
446+
447+> **"`cu_tx` must be `32 << ss_x(fctx)`; at 4:4:4 `av1_get_max_uv_txsize`
448+> returns TX_64X64, so `cu_tx` is 64."**
449+
450+**REFUTED.** `blockd.h:1371` (the ticket's own citation) is the *body* of
451+`av1_get_max_uv_txsize`, and its last line is
452+`return av1_get_adjusted_tx_size(uv_tx);`. `av1_get_adjusted_tx_size`
453+(`blockd.h:1361`) takes **no subsampling argument** and maps `TX_64X64`,
454+`TX_64X32`, `TX_32X64` to `TX_32X32` **unconditionally**. Measured against
455+libaom's own code, `av1_get_max_uv_txsize(BLOCK_128X128, 0, 0) == TX_32X32`.
456+The ticket read `max_txsize_rect_lookup[BLOCK_128X128] = TX_64X64` and stopped
457+one line short, annotating the adjustment as "adjusted → itself".
458+
459+The refutation has two independent witnesses, both reproduced in this lane:
460+
461+1. A C probe linked against `~/.cache/aom-oracle/build/libaom.a` calling the
462+ real three functions over all 22 block sizes × 4 `(ss_x, ss_y)`
463+ (`~/.cache/txaudit/probe.c`, output `out.txt`).
464+2. The oracle's own `EC_TRACE_COEFF` on a 4:4:4 `--sb-size=128` stream: luma
465+ reads `tx_size=4` (TX_64X64) eight times, chroma reads it **zero** times and
466+ reads **zero** 64-axis chroma shapes; every 64x64 luma unit is followed by
467+ exactly **four** `tx_size=3` (TX_32X32) chroma units per plane.
468+
469+### 3.2 Where the wrong rule spread
470+
471+| where | what | state |
472+|---|---|---|
473+| `lanes/av1tilerows.report.md:265-281` | the **origin**. §8 "Recommendation" states "`av1_get_max_uv_txsize(BLOCK_128X128, 0, 0)` is `max_txsize_rect_lookup[BLOCK_128X128]` = `TX_64X64` (adjusted → itself)" and recommends repairing the site to `cu_tx = 32 << ss_x(fctx)`, `luma_span = cu_tx << ss_x(fctx)` | **RETRACTED in place by this lane** — a `RETRACTED by lanes/av1txsizeaudit.report.md §3.1` blockquote now sits on item 3 and on the Recommendation, quoting the correction and the oracle measurement, so the claim cannot be lifted out of context again |
474+| a census item, and a charter I wrote from it | the same claim, propagated | never committed to `crates/ec-av1/src/**` |
475+| `crates/ec-av1/src/**` | `git log --all -S"cu_tx = 32 << ss" -- crates/ec-av1/src` → **no commits**; `-S"cu_tx = 32usize << ss"` → **no commits** | **never implemented.** The wrong rule never reached code. |
476+| the four live `cu_tx` sites (`decode.rs:14115`, `40136`, `41923`, `42900`) | all `let cu_tx = 32usize;` with the per-axis walk around them | **correct** |
477+| `crates/ec-av1/src/stream.rs:2458-2492` and `refusal_inventory.rs:1533-1668` | the two source-scan tests that pin chroma-size shape | both pin the rule **correctly** |
478+
479+The wrong rule's most seductive property is that its 4:2:0 identity argument is
480+true: `32 << 1 == 64`, and at 4:2:0 the adjusted step is a no-op on a
481+`.min(32)`-shaped result. So the "no-op for the only format with committed
482+coverage" argument in `av1tilerows.report.md:279-281` is *sound* and still
483+licenses a change that is wrong at 4:4:4 — the one format the identity argument
484+says nothing about. **The 4:2:0 identity argument cannot certify a change to a
485+subsampling-parameterised expression; only the measured 4:4:4 value can.**
486+
487+### 3.3 A second wrong table, in this lane's own charter
488+
489+The ground-truth table I put in the four scouts' briefs was reconstructed from
490+memory rather than measured, and **23 of its 66 rows were wrong** (15 real
491+errors + 8 `(shape, ss)` pairs that map to `BLOCK_INVALID`, which I had noted
492+but did not tabulate). Seven errors were in the **4:2:0** column — `8X8`,
493+`16X8`, `32X16`, `64X32`, `16X4`, `32X8`, `64X16` — and eight in the 4:2:2
494+column, which I had written as a verbatim copy of 4:4:4. The measured table in
495+§1.0 is authoritative. No verdict in this report was decided against the bad
496+table: every scout re-derived the rule from the cited functions, which is how
497+the discrepancy surfaced (they flagged the charter's table, not the code). The
498+concrete lesson: **a ground-truth table handed to a subagent must be produced
499+by running the reference, not by transcribing it.** The `av1tilerows` report
500+made the same class of error with `max_txsize_rect_lookup` — it read the table
501+correctly and misread the *function that consumes it*.
502+
503+### 3.4 Rules confirmed, for the record
504+
505+* `cu_tx == 32` at **every** subsampling; the 4:4:4 unit count is
506+ `((64 >> ss_x) / 32) × ((64 >> ss_y) / 32)` = **1 / 2 / 4** at 4:2:0 / 4:2:2 /
507+ 4:4:4.
508+* A per-axis `.min(32)` on an **already-subsampled** chroma extent is an exact
509+ transcription of `av1_get_adjusted_tx_size` over the whole `TX_SIZE` domain.
510+* A per-axis `<< ss` on a chroma unit is the unit's **LUMA** footprint, not its
511+ transform size. The two must not be conflated — that conflation is the
512+ ticket's core error.
513+* At 4:2:0 the chroma transform is ≤ 32 on **both** axes for **every** block
514+ size, so a hardcoded 32 that is right at 4:2:0 proves nothing at 4:4:4.
515+* 4:2:2 is refused by name at the sequence header, so the 4:2:2 column — the
516+ only one where the per-axis walks are actually *distinguishable* — is
517+ unreachable in committed code. Every 4:2:2-only defect in this report
518+ therefore needs the env-gated probe to witness, and the probe must never be
519+ committed.
520+
521+---
522+
523+## 4. Invariants
524+
525+All run in `/home/user/.cache/wt/av1txsizeaudit` at `2fcc577a`
526+(main `9b2f6c9d` + the `4bfe8d8e` fix rebased), `CARGO_TARGET_DIR=$HOME/.cache/cargo-target`.
527+
528+| gate | result |
529+|---|---|
530+| `a_real_aomenc_444_intra_in_inter_128_root_codes_chroma_per_mu_chunk_unit_pixel_exact` | **ok** — `3 decode-order frames pixel-exact (0 hidden), intra_128_in_inter=1 mu_chunk_chroma_reads=4` |
531+| `a_real_aomenc_inter_128x128_none_root_decodes_pixel_exact` | ok |
532+| `a_real_aomenc_128x128_none_inter_blocks_coded_chroma_per_mu_chunk_decodes_pixel_exact` | ok |
533+| `a_real_aomenc_lossless_444_key_frame_decodes_sample_exact` | ok |
534+| `a_lossless_444_min_partition64_inter_stream_decodes_pixel_exact` | ok |
535+| `a_lossless_444_128_root_lossless_stream_reads_chunks_chunk_major` | ok |
536+| `a_lossless_444_intrabc_rect_leaf_walks_per_4x4_units` | ok |
537+| `a_lossless_444_rect16x4_chroma_reach_is_ss_aware` | ok |
538+| `a_444_lossless_sb64_intrabc_rect_chroma_walks_4x4_units` | ok |
539+| `a_lossless_444_10bit_inter_stream_decodes_pixel_exact` | ok |
540+| `a_lossless_444_min_partition8_inter_stream_decodes_sample_exact` | ok |
541+| `a_lossless_444_defaultp_inter_strip_stream_decodes_byte_exact` | ok |
542+| `a_lossless_444_8bit_untiled_control_and_its_two_tile_column_sibling_decode_pixel_exact` | ok |
543+
544+13 passed / 0 failed. The 4:2:0 identity (`>> ss == /2` there) and the new 4:4:4
545+gate both hold. No production file was edited by this lane; the tree is
546+`9b2f6c9d` + the replayed fix, so every row above is a statement about the
547+tree the fix will land on.
548+
549+Artifacts: `~/.cache/txaudit/probe.c`, `~/.cache/txaudit/out.txt`,
550+`~/.cache/txaudit/table.md`, `~/.cache/txaudit/grad444.obu`,
551+`~/.cache/txaudit/coeffs.txt`, `~/.cache/txaudit/gate444.log`,
552+`~/.cache/txaudit/idset.log`.
553+
554+---
555+
556+## 5. Follow-up: C1 and C2 chased to a decision
557+
558+This section answers the follow-up: C1 gets the witness it was chartered
559+without, the answer is **not** the one the charter assumed, and — after a
560+reconciliation with `Agent12-2`'s independent sweep of the same site — C1 is
561+**LANDED** with a red-before-proven source-scan gate. C2 gets its one-line
562+fix, a measurement plan, and a 50-site sweep of its class; C2 is **not**
563+landed, and the reason is given in §5.2.
564+
565+### 5.0 Reconciliation with `Agent12-2` — was `fctx` in scope?
566+
567+`Agent12-2` swept hardcoded chroma halvings independently, reached this same
568+function, and recorded it as **unfixable without threading `fctx` into
569+`Neighbours`**, because the method is a `Neighbours` method with no `fctx`
570+parameter and its single caller passes no format test. **That structural
571+finding is correct and I confirm it.** `Neighbours` (decode.rs:8444) has no
572+`fctx` field — its fields are the neighbour bands (`above`, `left`,
573+`above_mode`, `left_mode`, `above_uv_mode`, `left_uv_mode`, `above_side`,
574+`left_side`, `above_side_mi`, `left_side_mi`, …) and nothing that carries a
575+subsampling.
576+
577+And to answer the question directly, because it changes what the measurement
578+in §5.1.2 was worth: **`fctx` was NOT in scope, and my first attempt did not
579+compile.**
580+
581+```text
582+error[E0609]: no field `fctx` on type `&mut decode::Neighbours`
583+ --> (the line I had written as `ss_x(self.fctx)`)
584+```
585+
586+I then threaded it — one parameter on the method signature, one argument at
587+the single call site — and it built clean. **So the `uv_w 64 -> 128`
588+measurement in §5.1.2 was a real change with real threading, not a temporary
589+hardcode and not a probe hack.** Had it been a hardcode, §5.1.2's zero-pixel
590+result would have been meaningless; it is not.
591+
592+The minimal threading, stated as shipped:
593+
594+| what | change |
595+|---|---|
596+| `suppress_internal_lf_edges` signature | `+ fctx: &FrameCtx` — one parameter |
597+| its single caller (was `43956`) | `+ fctx` — one argument |
598+| `struct Neighbours` | **unchanged** — no new field |
599+| call sites total | **1** |
600+
601+Arithmetic first, then measurement, for the 4:2:0 no-op claim: `w_mi * MI` is
602+a multiple of `MI = 4`, hence even, hence at `ss_x == 1`
603+`(w_mi * MI) / 2 == (w_mi * MI) >> 1` for **every** reachable `w_mi`. Exact
604+identity, not an approximation. Then measured: 13/13 identity gates green on
605+the landed tree (§4 / §5.5), including the two 4:2:0 128-root gates
606+`a_real_aomenc_inter_128x128_none_root_decodes_pixel_exact` and
607+`a_real_aomenc_128x128_none_inter_blocks_coded_chroma_per_mu_chunk_decodes_pixel_exact`.
608+
609+**Line numbers, as of the rebase onto `08f8ffb3`.** §1's tables were measured on
610+the audit base (`2fcc577a`) and §5's against the pre-rebase tree. The branch is
611+now rebased onto current main, and **every decode.rs reference in this report
612+carries the old base's numbering**. The mapping for the sites this report
613+cites most (decode.rs is 56 316 lines on the new base):
614+
615+| site | old base | on `08f8ffb3` |
616+|---|---|---|
617+| `suppress_internal_lf_edges` (C1) | 9102 | **9277** |
618+| its caller (C1) | 43956 | **44297** |
619+| C2's `around_mi(unit_mi, unit_luma_w)` | 42974 | **43315** |
620+| `around_mi(lmi, B4)` (`decode_inter_sub8_split4`) | 44401 | **44742** |
621+| `around_mi(group_mi, 8)` (`decode_intra_sub8_leaf`) | 44913 | **45254** |
622+| `decode_intra_sub8_leaf` (fn) | 44999 | **45340** |
623+| `decode_intrabc_owned_rect`'s `bw / 2, bh / 2` (open cell) | 16558 | **16832** |
624+| `cfl_ac_q3_at`'s `/ 2` (non-site) | 19636 | **19920** |
625+
626+Two independent causes, and they compose: the landed C1 change adds a 26-line
627+doc comment, and main's wave-3 merges added ~693 lines to decode.rs between
628+the audit base and `08f8ffb3`. `git diff 08f8ffb3 --stat` is **byte-identical
629+in shape** to `git diff 9b2f6c9d a5737713 --stat` — same 7 files, same
630+1511 insertions / 103 deletions — which is the signal that main's waves did not
631+collide with any of my hunks (§5.5).
632+
633+The 50-site `around_mi` sweep in §5.3 is unaffected in substance: the
634+decode.rs diff touches **zero** gather call sites
635+(`git show HEAD -- crates/ | grep -cE '^[+-].*around_mi\('` = 0), so every
636+verdict stands and only the line numbers move.
637+
638+### 5.1 C1 — the witness EXISTS, and it proves the defect is LATENT
639+
640+`lanes/av1txsizeaudit.report.md` §2.2 chartered C1 with "no fixture exists".
641+**That was wrong, and the correction matters more than the charter.** The
642+arm is reachable, the recipe is trivial, and the guard fires on the first
643+try. The pixels still match libaom — and that is not a failure to find the
644+witness, it is a proof that no witness can exist.
645+
646+#### 5.1.1 The recipe (2 commands, no probe, no knob hunting)
647+
648+```sh
649+# a STATIC 128x256 4:4:4 y4m. Static is the operative ingredient: identical
650+# frames give zero MV and zero residual, so the RD picks a whole-block skip.
651+# Moving content never reaches the arm.
652+python3 -c "
653+w,h,n=128,256,4
654+Y=[[((x//8+y//8)*60+30)%256 for x in range(w)] for y in range(h)]
655+U=[[((x//16)*60+30)%256 for x in range(w)] for y in range(h)]
656+V=[[((y//16)*60+30)%256 for x in range(w)] for y in range(h)]
657+f=open('static.y4m','wb'); f.write(b'YUV4MPEG2 W%d H%d F25:1 Ip A1:1 C444\n'%(w,h))
658+for k in range(n):
659+ f.write(b'FRAME\n')
660+ for P in (Y,U,V): f.write(bytes(v for row in P for v in row))
661+f.close()"
662+
663+~/.cache/aom-oracle/build/aomenc --codec=av1 --profile=1 --sb-size=128 \
664+ --limit=4 --cq-level=60 -o c1_static.obu static.y4m
665+```
666+
667+`--profile=1` (4:4:4) and `--sb-size=128` are the two load-bearing knobs.
668+`--cq-level` is **not** load-bearing — it produced byte-identical streams at
669+20/40/60, because the residual is already zero. The SB is 128x128 so a
670+`--limit=4` encode gives 2 roots per frame.
671+
672+| stream | sha256 | guard fires | frames |
673+|---|---|---|---|
674+| `c1_static.obu` | `363672a2db670e08d70ee9e6c4ab40d8fc1f6b1bb1276cd5d88bbcb6925f57c8` | 6 | 4 |
675+| `c1_step.obu` (hard vertical step at x=64) | `07b2783811d1ea209dacc18f06bb166cbfe635d3c7c40ec5d967795c9d2cd9d8` | 6 | 4 |
676+| `bars_20.obu` (16-px bars, static) | `1c5b144c47eb5b858c722e87b4ed2d69a470ad94b8b8f507452736b0bac9fca0` | 10 | 6 |
677+| `grad6_20.obu` (moving gradient) | `5facd9355482cada137870e5c94c7410b97bdd27ca96c436afa13371ac9d5bd0` | 2 | 6 |
678+| `noise444_20.obu` (static noise) | `c9c1b48205da19d12a061c44a04f90baefc91362b28667c996d7064415b75ed7` | 6 | 6 |
679+
680+**30 guard fires across 26 frames / 2 555 904 samples**, all at ss (0, 0), all
681+`w_mi = h_mi = 32` (a 128x128 luma root). The oracle agrees independently —
682+`aomdec`'s own `AOMMB` rung prints `mi=(0,0) mode=13 rf=(1,-1) mv0=(0,0)
683+mv1=(0,0) skip=1`: skip mode, compound, zero MV, `skip=1`.
684+
685+#### 5.1.2 The red-before that cannot exist
686+
687+The fix is one expression, and it is the sibling's exact form:
688+
689+```rust
690+- let (uv_w, uv_h) = ((w_mi * MI / 2).max(4) as u8, (h_mi * MI / 2).max(4) as u8);
691++ let (uv_w, uv_h) = (
692++ ((w_mi * MI) >> ss_x(fctx)).max(4) as u8,
693++ ((h_mi * MI) >> ss_y(fctx)).max(4) as u8,
694++ );
695+```
696+
697+(this also threads `fctx` into `suppress_internal_lf_edges` and its one
698+caller at `43956`.) Measured, on the corpus above:
699+
700+| build | published extent at 4:4:4 | vs oracle | vs the other build |
701+|---|---|---|---|
702+| base (`/2`) | `uv_w=64 uv_h=64` | **0** differing of 2 555 904 | — |
703+| fixed (`>> ss`) | `uv_w=128 uv_h=128` | **0** differing of 2 555 904 | **0** differing |
704+
705+**The fix changes the published value from 64 to 128 and changes not one
706+sample.** So there is no red-before to produce, on this corpus or any other.
707+
708+#### 5.1.3 Why — the masking mechanism, named
709+
710+The widening exists to defeat the deblocker's alignment gate at
711+`decode.rs:29514`:
712+
713+```rust
714+if cur_tx == 0 || (if c.dir == 0 { x0 } else { y0 }) & (cur_tx as usize - 1) != 0 {
715+ return None;
716+}
717+```
718+
719+With `cur_tx = 64` a chroma edge at `x0 = 64` survives (`64 & 63 == 0`); with
720+`cur_tx = 128` it dies (`64 & 127 = 64`). So the widening *does* do what it
721+was written to do. But the survivor then meets, 68 lines later, the **same
722+libaom rule applied at the correct place** — `decode.rs:29582-29589`:
723+
724+```rust
725+// spec 7.14.2 / libaom `set_lpf_parameters`: a transform edge between two
726+// SKIPPED INTER blocks is filtered only when it is also a prediction
727+// (coded-block) edge ...
728+if !pu_edge
729+ && cur_ref != 0
730+ && pv_ref != 0
731+ && n.skip_at(mi_r, mi_c)
732+ && n.skip_at(pv_mi_r, pv_mi_c)
733+{
734+ return None;
735+}
736+```
737+
738+Inside a single skipped 128 root, **every** internal edge satisfies all four
739+terms: `pu_edge` is false because the chroma `plane_dim` is
740+`((32 * 4) >> 0) = 128` and `64 % 128 != 0` (`decode.rs:29577-29578`), and
741+both `skip_at` are true and both refs nonzero because both cells are the same
742+compound skip-mode block. At the block's own boundary (`x0 = 128`) both the
743+buggy and the fixed value pass the alignment gate identically, and there the
744+edge *is* a `pu_edge`, so both builds filter it the same way. Hence zero
745+observable difference, for every stream.
746+
747+**This is total, not incidental.** `suppress_internal_lf_edges` is only ever
748+called for a block that is itself skipped (`43954`: `skip_inter_128 = skip &&
749+is_inter && write_w.max(write_h) > 64`), so there is no input on which one
750+side of an internal edge is not skipped. The defect cannot be unmasked by any
751+fixture, at any `--cq-level`, on any content.
752+
753+#### 5.1.4 Disposition — C1 LANDED, for spec fidelity, with no observable effect
754+
755+The original charter said "no fixture exists". Both halves of that were wrong
756+in different ways, and the corrections matter more than the charter:
757+
758+* **The fixture exists** (§5.1.1): two commands, arm fires on the first try,
759+ 30 fires over 26 frames across five streams. `Agent12-2`'s independent rung
760+ (5 hits over the 444 gate set) reached the same reachability conclusion by a
761+ different route; the two agree.
762+* **C1 is a real mismatch against libaom.** `get_plane_block_size(BLOCK_128X128,
763+ 0, 0)` is `BLOCK_128X128` (`common_data.c:38`), so a 128 root's own chroma
764+ extent at 4:4:4 is **128**, not the 64 the `/2` published. Measured, not
765+ argued (§1.0, §0.2).
766+* **C1 is provably unobservable**, by the mechanism in §5.1.3 and the 26-frame
767+ measurement in §5.1.2 — and **total, not incidental**, because the method
768+ is only ever called for a block that is itself skipped.
769+* **LANDED**, in this lane, on Main's authority, with the disposition sentence
770+ that was missing: **fix for spec fidelity, no observable effect on any
771+ current format.** The masking mechanism is recorded in the method's own doc
772+ comment so no future reader hunts for a pixel regression that cannot exist.
773+* **And one of my own claims is retracted here.** My first version of this
774+ disposition said "*no gate can be written for it*" because no *pixel* gate
775+ can exist. That was overreaching: a **source-scan gate can**, and it is
776+ landed and **red-before proven** (§5.1.5). The precise claim is: *no pixel
777+ gate can exist; the source scan is the only instrument, and it works.*
778+* **What is NOT an unblock condition:** fixture engineering. The recipe is
779+ above; it works. The old blocker was structural, and it has been discharged.
780+
781+#### 5.1.5 The gate, and the red-before
782+
783+New gate
784+`refusal_inventory::tests::the_skipped_128_root_chroma_suppression_publishes_the_blocks_own_per_axis_chroma_extent`
785+(`refusal_inventory.rs:1765-1829`). It reads `suppress_internal_lf_edges`'s own
786+body out of `decode.rs` — the same class-and-reader-move-together instrument
787+this file already uses at `1573` and `1577` — and asserts three things:
788+
789+1. the body contains `((w_mi * MI) >> ss_x(fctx))` and
790+ `((h_mi * MI) >> ss_y(fctx))`;
791+2. the body contains **neither** `w_mi * MI / 2` nor `h_mi * MI / 2`;
792+3. the signature carries `fctx: &FrameCtx` — pinning the threading itself, so
793+ a future edit that drops the parameter (and with it the only route to the
794+ subsampling) fails loudly instead of reintroducing a literal.
795+
796+**Red-before, produced by reverting ONLY the arithmetic** (the gate, the
797+threaded parameter, the caller argument and the doc comment all kept):
798+
799+```text
800+line 9130 -> let (uv_w, uv_h) = ((w_mi * MI / 2).max(4) as u8, (h_mi * MI / 2).max(4) as u8);
801+
802+thread '...the_skipped_128_root_chroma_suppression...' panicked at
803+ crates/ec-av1/src/refusal_inventory.rs:1807:9:
804+suppress_internal_lf_edges must publish the block's own chroma extent per axis
805+-- `w_mi * MI >> ss_x(fctx)`, not a hardcoded `/2`
806+test result: FAILED. 0 passed; 1 failed
807+```
808+
809+Restored -> `ok`. **This is the red-before §5.1.2 said could not exist.** It
810+cannot exist on *pixels*; it exists on the source scan, which is the correct
811+instrument for a value that is provably correct and provably unobservable.
812+
813+Identity set on the landed tree: **13 passed / 0 failed** (§5.5).
814+
815+### 5.2 C2 — the one-line fix, and why it is not landed
816+
817+`decode.rs:42974`:
818+
819+```rust
820+- let cu_around = neighbours.around_mi(unit_mi, unit_luma_w);
821++ let cu_around =
822++ neighbours.around_mi_rect(unit_mi, unit_luma_w, unit_luma_h);
823+```
824+
825+`unit_luma_w`/`unit_luma_h` are the per-axis pair computed at `42907-42908`;
826+the arm's own doc comment at `42904-42906` even says the size is "the size
827+`around_mi` / `record_mi_chroma` want", and `record_mi_chroma` at `42996` is
828+per axis — so `around_mi` at `42974` is the leftover of the same collapse the
829+lane's fix repaired everywhere else in the arm. The inter twin is
830+`14191-14192`, with the same pair at `40212` and `41999`.
831+
832+**Measured:** applied and reverted. Five gates re-run on the patched tree
833+(`a_real_aomenc_444_intra_in_inter_128_root_...`, `..._inter_128x128_none_root_...`,
834+`..._128x128_none_inter_blocks_coded_chroma_per_mu_chunk_...`,
835+`a_lossless_444_10bit_inter_...`, `a_lossless_444_rect16x4_chroma_reach_is_ss_aware`)
836+— **5/5 ok**, byte-identical, exactly as §5.3's reachability predicts.
837+
838+**Not landed**, per instruction and on the merits: the arm is `side > 64`
839+(`42871`) and 4:2:2 is refused by name at the sequence header
840+(`stream.rs:1749-1754`, gate `a_non_420_subsampled_sequence_header_is_refused_by_name`),
841+so there is no committed stream — and no committable one — on which this line
842+can be red. A change that cannot be made red cannot be gated, and an ungated
843+change to a 4:2:2 path is the exact hazard `lanes/av1ibc128arm.report.md`'s
844+`EC_AV1_ALLOW_422_PROBE` note exists to prevent.
845+
846+**Measurement plan for whenever 4:2:2 is unblocked** (a 4:2:2 lift lane, probe
847+never committed):
848+
849+1. Encode `aomenc --codec=av1 --profile=2 --sb-size=128 --limit=4` over a
850+ static 128x256 `C422` y4m (profile 2 = 4:2:2), static for the same
851+ reason as C1: zero MV + zero residual keeps the 128 root on the arm.
852+2. Decode with `EC_AV1_ALLOW_422_PROBE=1` and `EC_DCDUMP=1`. `around_mi_rect`
853+ already dumps `EC_DCDUMP ... wh=(w,h) above=[..] left=[..]` (`9707-9711`);
854+ the square `around_mi` does not dump at all, which is itself the
855+ observable: at `ss (1,0)` the fixed build prints `wh=(64,32)` and a left
856+ band of 8 mi, the unfixed build a left band of 16.
857+3. Red-before: revert the one line, re-run, the `EC_DCDUMP` left band doubles
858+ and `dc_sign_ctx` diverges on the first chroma unit of the 128 root — an
859+ arithmetic-coder fork, visible as an `EC_COEFF_STEP ... dcctx=` mismatch
860+ against the oracle's own `EC_TRACE_COEFF`.
861+4. Green: re-apply, the fork is gone. The 4:2:0 and 4:4:4 identity sets must
862+ not move (they provably cannot; `unit_luma_w == unit_luma_h` at both).
863+
864+### 5.3 The C2 class sweep — 50 `around_mi(` sites, 1 instance, 0 new
865+
866+The question the class asks: *is the size passed to the square gather provably
867+equal to the height libaom would use at that same point?* All 50 sites were
868+resolved by reading each one's enclosing guard. **49 correct, 1 instance (the
869+known `42974`), 0 unresolved.** Critically, **no luma rect-transform leaf
870+passes one axis unguarded** — so there is no 4:2:0-reachable instance, which
871+is what would have made this a live defect rather than a 4:2:2 lift-blocker.
872+
873+| pattern | sites | why correct |
874+|---|---|---|
875+| explicit `if tw == th` guard | 13640, 16691, 17240, 40057, 41838, 46336 | each has its `around_mi_rect(tu_mi, tw, th)` sibling in the same `else` (13661, 16711, 17260, 40088, 41869, 46363) |
876+| precomputed `rect_unit` flag | 17740 | this is the `else` of `rect_unit = tx_w != tx_h`; twin 17689 |
877+| `(tw, th) == (4, 4)` guard | 25748 | twin 25759 |
878+| structurally square, no assert | 14089, 21463, 42857, 49421 | the leaf list is square by construction (a square tree root + `sub_tx_size_map`, which maps only 1:4 shapes to rect; or `read_block_tx_size`'s `is_inter=false` path pushing `(row, col, tx, tx)` from a scalar `read_tx_size`), **and** the coefficient reader is square-only, so a rect leaf would break the read before the gather mattered. 14089 documents the invariant with `debug_assert_eq!`; the other three rest on the construction argument alone — see the caveat below |
879+| `!rect_tu` block guard | 40008, 40014, 41726, 41732, 43169 | on the non-rect arm, where the block's luma plane is provably `side × side`; the 4:2:2 case is rerouted to `around_mi_422_chroma` or a `chroma_w == chroma_h` test |
880+| sub-8x8 4:2:0 group tails | 25300, 25353, 26478 | under an explicit `else` of the `chroma_444` / `chroma_422` arms |
881+| provably square by arm analysis | 11848 | the final `else` of a four-arm `skip` / `luma_64corner` / `Some(luma_rect)` chain: `luma_rect == None ∧ ¬luma_64corner` implies `tx_w == tx_h`; the read at 11867-11868 also passes `tx_w, tx_w` |
882+| scalar literals / provably-square scalars | 17214, 18057, 22180, 22962, 23135, 23234, 24961, 25080, 26011, 29066, 29095, 36097, 36275, 40463, 42256, 43273, 44401, 44517, 45203, 45255, 45629, 46920, 47955, 48912, 49508 | `4`, `8`, `MI`, `B4`, or a `chroma_tx`/`logical_tx`/`cu_tx` scalar on an `ss_x == 0 && ss_y == 0` arm. `23234`'s `8` covers 4:2:0 (chroma 4x4 → luma span 8x8 = 2x2 mi) and 4:4:4 lossy (chroma 8x8 → luma 8x8 = 2x2 mi), and 4:2:2 is intercepted at 23242 |
883+| **INSTANCE** | **42974** | **no `unit_luma_w == unit_luma_h` guard; differs at 4:2:2 only; correct twin `14192`/`40212`/`41999`** |
884+
885+The multi-line call at `45744` — `around_mi(if chroma_444 { lmi } else { group_mi },
886+if chroma_444 { 4 } else { 8 })` — is **not** an instance: both arms are
887+scalars, and it sits in the `else` of `chroma_444 && bw != bh` (`45603`),
888+whose own correct per-axis twin is `around_mi_rect(lmi, bw, bh)` at `45691`.
889+
890+**Caveat worth carrying forward (low value today, a trap tomorrow).** Four
891+sites — `21463`, `42857`, `49421`, `14089` — consume a var-tx or intra leaf
892+list while **discarding the leaf's height field** (`for &(lr, lc, tw, _th) in
893+leaves`). They are correct only because the reader is also square-only and
894+the list is square by construction. If a future change lets any of these arms
895+see a rect leaf, the gather AND the reader must be split to
896+`around_mi_rect` in the same step, or the first rect leaf that arrives forks
897+the coder.
898+
899+### 5.4 One adjacent finding, not in the C2 class
900+
901+`decode_intra_sub8_leaf` (44999-45827) has **no `chroma_422` branch at all** —
902+only `chroma_444` (`45488`). At 4:2:2 its 8x8 group's chroma plane block is
903+4x8, and the gather at `45744` would need `around_mi_422_chroma`'s
904+every-second-above-cell resampling (`9594`), not the plain per-mi sum. This is
905+a **missing-422-guard** finding, not a per-axis one, so it is outside C2's
906+class; it is unreachable while 4:2:2 is refused, and it belongs to the 4:2:2
907+lift as a fourth item beside C2. Every sibling 8x8 path does carry the 422
908+branch: `decode_leaf8` (`23231`), `decode_inter_block8` (`47962`/`48919`),
909+`decode_inter_sub8_rect2` (`44811`, `46809`).
910+
911+### 5.5 State of the tree — rebased onto `08f8ffb3`
912+
913+**C1 is landed; C2 is not.** The C2 one-liner and its `EC_C1_PROBE`
914+scaffolding were reverted with `git checkout` after measuring, exactly as
915+§5.2 states.
916+
917+This branch was rebased onto current main (`08f8ffb3`) and **one near-miss is
918+worth recording**, because it is the same trap as the stale-base diff, one
919+level deeper. The first rebase attempt saved a patch of
920+`2fcc577a..HEAD` — that range contains only *my* r2/r3 work, because
921+`2fcc577a` is itself the fix commit replayed on the old main. Applying it to
922+`08f8ffb3` produced a tree that built, passed `cargo check --all-targets`, and
923+passed 12 of 13 identity gates — because the intra-in-inter fix and its
924+`a_real_aomenc_444_intra_in_inter_128_root_codes_chroma_per_mu_chunk_unit_pixel_exact`
925+gate were **silently absent**: they live in commit `4bfe8d8e`, which is on this
926+branch and has never been on main. The tell was a green run in which one
927+named test produced no output line at all. The fix was to diff the whole
928+branch against the old main, `git diff 9b2f6c9d a5737713`, since
929+`9b2f6c9d` is an ancestor of `08f8ffb3`; that patch restores all 7 files.
930+
931+Scope, checked by shape rather than by the apply's clean status:
932+
933+```text
934+git diff 08f8ffb3 --stat
935+ crates/ec-av1/examples/decode_probe.rs | 5 +
936+ crates/ec-av1/src/decode.rs | 305 +++++++++----
937+ crates/ec-av1/src/refusal_inventory.rs | 66 +++
938+ crates/ec-av1/src/stream.rs | 192 ++++++++
939+ lanes/av1ibc128arm.report.md | 196 ++++++++++++
940+ lanes/av1tilerows.report.md | 38 +-
941+ lanes/av1txsizeaudit.report.md | 812 +++++++++++++++++++++++++++++++++
942+ 7 files changed, 1511 insertions(+), 103 deletions(-)
943+```
944+
945+**Byte-identical in shape to `git diff 9b2f6c9d a5737713 --stat`** — same 7
946+files, same 1511/103 — which is the signal that main's wave-3 merges
947+(+693 lines to decode.rs alone) did not collide with any of my hunks.
948+
949+Silent-restore check, the one Main flagged: for each source file, the set of
950+lines main **deleted** between `9b2f6c9d` and `08f8ffb3` was intersected with
951+the set of lines my tree **adds**, restricted to distinctive lines
952+(`length >= 45`, so `} else {` and `assert!(` do not generate noise):
953+
954+```text
955+crates/ec-av1/src/decode.rs : 0
956+crates/ec-av1/src/stream.rs : 0
957+crates/ec-av1/src/refusal_inventory.rs : 0
958+```
959+
960+**Zero.** Nothing another lane removed has been restored. In `decode.rs` the
961+only removed lines are the three I meant to change plus the one stale doc line
962+whose "chroma extent (64)" claim is exactly what C1 corrects.
963+
964+Re-run on the rebased tree, after `touch`ing both touched sources:
965+
966+```text
967+cargo check -p ec-av1 --all-targets Finished, clean
968+the new source-scan gate 1 passed / 0 failed
969+gate_coverage:: 13 passed / 0 failed
970+refusal_inventory:: 20 passed / 0 failed
971+the 13-gate identity set 13 passed / 0 failed
972+```
973+
974+47 tests, 0 failures, including `a_real_aomenc_444_intra_in_inter_128_root_codes_chroma_per_mu_chunk_unit_pixel_exact`
975+— present and green, which is the check the first rebase attempt silently
976+failed to run. `~/.cache/txaudit/r4.log`.
977+
978+New artifacts: `~/.cache/txaudit/c1/{static,step,bars,grad6,noise444}.y4m`,
979+`~/.cache/txaudit/c1/*.obu`, `~/.cache/txaudit/c1/sweep.sh`,
980+`~/.cache/txaudit/full_branch.patch`, `~/.cache/txaudit/r4.log`.
981+
982+#### 5.5.1 PROVENANCE — this branch is not only C1
983+
984+Declared, because it is better found here than at merge time.
985+
986+**`lanes/av1txsizeaudit` carries TWO lanes' work, not one.**
987+
988+| what | produced by | on main? | declared here |
989+|---|---|---|---|
990+| the tx-size audit, the C1 fix + gate, the `av1tilerows` retraction | **`lane-av1txsizeaudit`** (this lane; commits `1dbe80d3`, `3b44339c`, `a5737713`, `dc80b6fa`, plus the rebase commits) | no | §1-§5 of this report |
991+| the 4:4:4 intra-in-inter 128-root per-unit chroma walk (279 lines of `decode.rs`, 192 of `stream.rs`, 5 of `examples/decode_probe.rs`, 196 of `lanes/av1ibc128arm.report.md`) | **`lane-av1ibc128arm`**, commit **`4bfe8d8e`** "av1: 4:4:4 intra-in-inter 128-root mu-chunk chroma as a per-unit walk" | **NEVER MERGED — confirmed** | this table |
992+
993+The three checks that establish it, run against `main` directly:
994+
995+```text
996+git merge-base --is-ancestor 4bfe8d8e main -> NO
997+git grep -c 'a_real_aomenc_444_intra_in_inter_128_root_codes_chroma_per_mu_chunk' main
998+ -- crates/ec-av1/src/stream.rs -> 0
999+git grep -n 'luma_span = cu_tx * 2' main -- crates/ec-av1/src/decode.rs
1000+ -> main:…:43185
1001+```
1002+
1003+That last line is the proof of *non*-merge rather than a re-implementation:
1004+**main still carries the collapsed 4:2:0 arm verbatim** — `let luma_span =
1005+cu_tx * 2;` at `main:crates/ec-av1/src/decode.rs:43185` — which is exactly the
1006+line `4bfe8d8e` deletes. The same string appears 0 times on this branch. So
1007+`4bfe8d8e` is not a duplicate of something already landed; it is unmerged work
1008+riding here, and it is the only copy.
1009+
1010+* **Has it been merged under another name?** No. `git log --all -S"luma_span =
1011+ cu_tx * 2"` finds only the two lanes that *created* the class
1012+ (`2050a065` lane-av1-ibc128chunk, `29550383` lane-av1-422bigblock) and the
1013+ commit that removed it (`4bfe8d8e`). Nothing re-landed it.
1014+* **Does another lane's report claim it?** No. `git grep -ln
1015+ "intra_in_inter_128_root" main -- lanes/` returns nothing;
1016+ `lanes/av1ibc128arm.report.md` does not exist on main at all
1017+ (`git cat-file -e main:lanes/av1ibc128arm.report.md` fails). It exists only
1018+ on the unmerged `lane-av1ibc128arm`, whose tip is `4bfe8d8e`.
1019+* **Branch `lane-av1ibc128arm` still exists**, tip `4bfe8d8e`, so this is not an
1020+ orphan whose only home is here.
1021+
1022+**The two foreign report files, declared individually:**
1023+
1024+* `lanes/av1ibc128arm.report.md` (+196) — **deliberately kept, and it belongs
1025+ to `lane-av1ibc128arm`, not to this lane.** It is the only provenance record
1026+ for the 279-line `decode.rs` change and the 4:4:4 gate, and a report that
1027+ does not ship with its code is exactly how evidence is lost. It is not
1028+ cherry-pick residue: it arrived with `4bfe8d8e`, whole, as part of that
1029+ commit. **Merge owner:** if `lane-av1ibc128arm` is also going to be merged,
1030+ take the code and this report from whichever branch lands first and drop the
1031+ duplicate; do not let both branches add the same path. If it is not going
1032+ to be merged separately, this branch must carry it — there is no other copy.
1033+* `lanes/av1tilerows.report.md` (38 changed) — **mine, and deliberately
1034+ so.** It is the retraction of the `cu_tx = 32 << ss_x` rule at that report's
1035+ own origin (`lanes/av1tilerows.report.md:265-281`, the §8 "Recommendation"),
1036+ which is the one committed instance of the refuted rule in the repository.
1037+ Zero code, zero gate; a `RETRACTED by lanes/av1txsizeaudit.report.md §3.1`
1038+ blockquote plus the correction and the oracle measurement. It must land
1039+ whenever this branch lands, or the rule stays re-derivable.
1040+
1041+**Contention to hand to the merge owner, NOT pre-resolved here:**
1042+`decode_intrabc_owned_rect`'s `let (cw, ch) = (bw / 2, bh / 2);` — the open
1043+cell this report lists at §2.3 and §5.0 (line 16558 on the audit base, **16832
1044+on the current base**) — is being fixed by another lane right now. This
1045+branch does **not** touch that line: `git diff ec4e9528 -- crates/ec-av1/src/decode.rs`
1046+contains no hunk near it, and it appears in this report only as a *finding*.
1047+Expect the region to contend at merge and resolve it there; do not pre-empt it
1048+from here, because the other lane holds the witness and this one holds only
1049+the observation.
1050+
1051+#### 5.5.2 Re-rebase onto `ec4e9528` — a second patch-base trap, same family
1052+
1053+`main` advanced from `08f8ffb3` to `ec4e9528` (one append to
1054+`lanes/av1merge-wave3d.report.md`). The re-rebase repeated r4's error in the
1055+opposite direction, and it is worth recording because the two together are the
1056+whole rule:
1057+
1058+* r4's near-miss: patch from **"my base"** `2fcc577a` — which is itself the
1059+ unmerged fix commit — and silently drop that commit's work.
1060+* r5's near-miss: patch from **"the old main"** `9b2f6c9d` — but by then this
1061+ branch's tip sat on the *new* chain, so `git diff 9b2f6c9d HEAD` swept in
1062+ **all** of main's wave-3 changes: 18 041 patch lines touching `crates/ec-aac`
1063+ and binary fixtures, which failed to apply and left an empty diff.
1064+
1065+**The rule both times: the patch's left-hand side must be the commit this
1066+branch's base actually is (`git merge-base HEAD main`), never a remembered
1067+ancestor and never a self-descriptive "my base".** Verify with
1068+`git apply --stat` BEFORE applying — the wrong base is obvious there (it names
1069+files you have never touched) and is invisible in `--3way`'s exit status.
1070+
1071+Correct patch, `git diff 08f8ffb3 99f25b1f`, 1 894 lines, 7 files. After
1072+`git apply --3way` onto `ec4e9528`:
1073+
1074+```text
1075+git diff ec4e9528 --shortstat
1076+ 7 files changed, 1679 insertions(+), 103 deletions(-)
1077+```
1078+
1079+**Identical to the pre-rebase shape**, and the removed-line counts are
1080+identical per file (decode.rs 97, av1tilerows 6, all others 0). Main's move
1081+touched **nothing** under `crates/ec-av1/`
1082+(`git diff 08f8ffb3 ec4e9528 --stat -- crates/ec-av1/` is empty), so
1083+`decode.rs` is 56 316 lines with `suppress_internal_lf_edges` at 9277 and C2 at
1084+43315 — **§5.0's line-shift table is valid verbatim on this base, with no
1085+adjustment.** Silent-restore check against this move: 0/0/0.
1086+
1087+Re-run after `touch`ing both touched sources:
1088+
1089+```text
1090+cargo check -p ec-av1 --all-targets Finished, clean
1091+the new source-scan gate 1 passed / 0 failed
1092+gate_coverage:: 13 passed / 0 failed
1093+refusal_inventory:: 20 passed / 0 failed
1094+the 13-gate identity set 13 passed / 0 failed
1095+```
1096+
1097+47 tests, 0 failures, 4:4:4 gate present and green. `~/.cache/txaudit/r5.log`.