forge
Explore
Log in

Don't you dare go Hollow

Merge branch 'lane-tx64x16': 32x32-level HORZ_4/VERT_4 (four 32x8/8x32 strips, ReelB mid-film blocker) gated on a band fixture at 8/10-bit; 1:4 gates assert out-of-scope pixel mismatches

Browse files at this commit

3ac3386b6d63c396f2eb6b49f59faf708f23443bAhmet Kaan GümüşParent: e47e7ce6dea36a
Conflicts: decode.rs (kept main's base_ctx domain test read table[col][row],
kept the lane's transposed-scan-pair test), encode.rs (kept main's
has_tr_rect_table/has_bl_rect_table + rect_table_index from lane-rectx r5 and
folded the lane's 32x8/8x32 rows into them; the lane's HAS_*_RECT arrays and
Reach::rect_table are dropped as redundant), gate_coverage.rs (lane's side:
1:4 partitions leave NEVER_EXERCISED_10BIT).
crates/ec-av1/examples/decode_probe.rsmodified+5 -0
@@ -28,6 +28,10 @@ fn main() {
28 std::process::exit(2);28 std::process::exit(2);
29 }29 }
30 };30 };
31+ let report = || {
32+ let (h, v, c) = ec_av1::stream::rect4_32_counters();
33+ println!("rect4_32: horz={h} vert={v} coded={c}");
34+ };
31 match ec_av1::stream::decode_stream(&data) {35 match ec_av1::stream::decode_stream(&data) {
32 Ok(frames) if frames.is_empty() => {36 Ok(frames) if frames.is_empty() => {
33 println!("OK but EMPTY: no frames -- is {path} an IVF rather than a raw OBU stream?");37 println!("OK but EMPTY: no frames -- is {path} an IVF rather than a raw OBU stream?");
@@ -52,4 +56,5 @@ fn main() {
52 }56 }
53 Err(e) => println!("REFUSED: {e}"),57 Err(e) => println!("REFUSED: {e}"),
54 }58 }
59+ report();
55 }60 }
crates/ec-av1/src/cdf_state.rsmodified+22 -0
@@ -108,6 +108,16 @@ pub(crate) enum TxbSet {
108 /// `Luma32`'s 1024-position one. Never carries a `tx_type` symbol: both108 /// `Luma32`'s 1024-position one. Never carries a `tx_type` symbol: both
109 /// orientations use one variant (`get_tx_set` is `EXT_TX_SET_DCTONLY` at109 /// orientations use one variant (`get_tx_set` is `EXT_TX_SET_DCTONLY` at
110 /// `tx_size_sqr_up == TX_32X32` regardless of which axis is longer).110 /// `tx_size_sqr_up == TX_32X32` regardless of which axis is longer).
111+ /// The 32x8/8x32 luma transform of a 32x32-level `PARTITION_HORZ_4`/
112+ /// `PARTITION_VERT_4` strip (lane-tx64x16 r3). `get_txsize_entropy_ctx`
113+ /// averages the two log2 sides ((5 + 3) / 2 = 4), so the coefficient CDF
114+ /// set is the 16x16 one [`Luma16`](TxbSet::Luma16) reads -- 256 coded
115+ /// positions, `eob_pt_256`. Unlike `Luma16` it carries NO `tx_type`
116+ /// symbol: `tx_size_sqr_up` of a 4:1 32-wide strip is `TX_32X32`, where
117+ /// `av1_get_ext_tx_set_type` returns `EXT_TX_SET_DCTONLY` for an intra
118+ /// block, so the encoder writes none (same reason
119+ /// [`LumaRect32x16`](TxbSet::LumaRect32x16) has none).
120+ LumaRect32x8,
111 LumaRect32x16,121 LumaRect32x16,
112 /// The chroma 16x8/8x16 transform under the same strip (lane-rectwire):122 /// The chroma 16x8/8x16 transform under the same strip (lane-rectwire):
113 /// [`Chroma16`](TxbSet::Chroma16)'s tables except `eob_pt`, which reads123 /// [`Chroma16`](TxbSet::Chroma16)'s tables except `eob_pt`, which reads
@@ -1606,6 +1616,18 @@ impl Cdfs {
1606 tx_type: None,1616 tx_type: None,
1607 eob_pt_class1: Some(&mut self.eob_pt_1024_chroma_class1),1617 eob_pt_class1: Some(&mut self.eob_pt_1024_chroma_class1),
1608 },1618 },
1619+ TxbSet::LumaRect32x8 => TxbTables {
1620+ side: 16,
1621+ txb_skip: &mut self.txb_skip_luma_16,
1622+ eob_pt: &mut self.eob_pt_256_luma,
1623+ eob_extra: &mut self.eob_extra_luma_16,
1624+ base: &mut self.base_luma_16,
1625+ base_eob: &mut self.base_eob_luma_16,
1626+ br: &mut self.br_luma_16,
1627+ dc_sign: &mut self.dc_sign_luma,
1628+ tx_type: None,
1629+ eob_pt_class1: Some(&mut self.eob_pt_256_luma_class1),
1630+ },
1609 TxbSet::LumaRect32x16 => TxbTables {1631 TxbSet::LumaRect32x16 => TxbTables {
1610 side: 32,1632 side: 32,
1611 txb_skip: &mut self.txb_skip_luma_32,1633 txb_skip: &mut self.txb_skip_luma_32,
crates/ec-av1/src/decode.rsmodified+405 -0
@@ -1468,6 +1468,36 @@ pub(crate) fn sb_rect4_vert_hits() -> usize {
1468 SB_RECT4_VERT_HITS.with(|c| c.get())1468 SB_RECT4_VERT_HITS.with(|c| c.get())
1469 }1469 }
1470 1470
1471+// lane-tx64x16 r3: the 32x32-level 1:4 arms, counted per orientation --
1472+// `PARTITION_HORZ_4` (four 32x8 strips) and `PARTITION_VERT_4` (four 8x32
1473+// strips), the arms the ReelB mid-film extract stops at.
1474+thread_local! {
1475+ static RECT4_32_HORZ_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) };
1476+ static RECT4_32_VERT_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) };
1477+}
1478+
1479+/// How many 32x32-level 1:4 strips actually read coefficients (non-skip):
1480+/// a gate that only counted strips would pass on an all-skip stream, which
1481+/// exercises none of the new scan/context tables.
1482+thread_local! {
1483+ static RECT4_COEFF_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) };
1484+}
1485+
1486+/// Current value of `RECT4_COEFF_HITS`.
1487+pub(crate) fn rect4_coeff_hits() -> usize {
1488+ RECT4_COEFF_HITS.with(|c| c.get())
1489+}
1490+
1491+/// Current value of `RECT4_32_HORZ_HITS` (32x8 strips decoded).
1492+pub(crate) fn rect4_32_horz_hits() -> usize {
1493+ RECT4_32_HORZ_HITS.with(|c| c.get())
1494+}
1495+
1496+/// Current value of `RECT4_32_VERT_HITS` (8x32 strips decoded).
1497+pub(crate) fn rect4_32_vert_hits() -> usize {
1498+ RECT4_32_VERT_HITS.with(|c| c.get())
1499+}
1500+
1471 // lane-rect64q r1: how many of [`decode_block_rect64`]'s three per-plane1501 // lane-rect64q r1: how many of [`decode_block_rect64`]'s three per-plane
1472 // dequant calls actually observed `CURRENT_Q_IDX != base_q_idx` -- proof the1502 // dequant calls actually observed `CURRENT_Q_IDX != base_q_idx` -- proof the
1473 // running-vs-stale-snapshot bug this round fixed is exercised by a gate, not1503 // running-vs-stale-snapshot bug this round fixed is exercised by a gate, not
@@ -2076,6 +2106,27 @@ const SCAN_4X8: [u16; 32] = [
2076 23, 26, 29, 27, 30, 31,2106 23, 26, 29, 27, 30, 31,
2077 ];2107 ];
2078 2108
2109+/// `Default_Scan_16x4`, this decoder's own row-major transcription of
2110+/// libaom's column-major `default_scan_16x4` (`scan.c:66`) -- the CHROMA
2111+/// plane of a 32x8 `PARTITION_HORZ_4` strip at the 32x32 level
2112+/// (lane-tx64x16 r3). The transcription rule (`row * w + col` with
2113+/// `row = p % h`, `col = p / h`) was validated by REGENERATING the existing
2114+/// [`SCAN_16X8`] from `default_scan_16x8` byte for byte before these two
2115+/// were emitted -- a naive copy installs the transpose (class
2116+/// reference-layout-not-spec).
2117+const SCAN_16X4: [u16; 64] = [
2118+ 0, 16, 1, 32, 17, 2, 48, 33, 18, 3, 49, 34, 19, 4, 50, 35, 20, 5, 51, 36, 21, 6, 52, 37, 22, 7,
2119+ 53, 38, 23, 8, 54, 39, 24, 9, 55, 40, 25, 10, 56, 41, 26, 11, 57, 42, 27, 12, 58, 43, 28, 13,
2120+ 59, 44, 29, 14, 60, 45, 30, 15, 61, 46, 31, 62, 47, 63,
2121+];
2122+/// `Default_Scan_4x16`, [`SCAN_16X4`]'s transpose (the chroma plane of an
2123+/// 8x32 `PARTITION_VERT_4` strip).
2124+const SCAN_4X16: [u16; 64] = [
2125+ 0, 1, 4, 2, 5, 8, 3, 6, 9, 12, 7, 10, 13, 16, 11, 14, 17, 20, 15, 18, 21, 24, 19, 22, 25, 28,
2126+ 23, 26, 29, 32, 27, 30, 33, 36, 31, 34, 37, 40, 35, 38, 41, 44, 39, 42, 45, 48, 43, 46, 49, 52,
2127+ 47, 50, 53, 56, 51, 54, 57, 60, 55, 58, 61, 59, 62, 63,
2128+];
2129+
2079 /// [`neighbour`] with independent `w` (row stride)/`h` (row-bound) extents2130 /// [`neighbour`] with independent `w` (row stride)/`h` (row-bound) extents
2080 /// (lane-rectwire, mirrors [`record_rect`](Neighbours::record_rect)'s2131 /// (lane-rectwire, mirrors [`record_rect`](Neighbours::record_rect)'s
2081 /// asymmetric-extent pattern).2132 /// asymmetric-extent pattern).
@@ -2531,6 +2582,8 @@ fn read_coeffs_rect(
2531 for scan_idx in (0..eob).rev() {2582 for scan_idx in (0..eob).rev() {
2532 let pos = scan[scan_idx] as usize;2583 let pos = scan[scan_idx] as usize;
2533 let (row, col) = (pos / w, pos % w);2584 let (row, col) = (pos / w, pos % w);
2585+ // libaom's column-major `coeff_idx`, for ladder comparison.
2586+ let apos = col * h + row;
2534 let level = if scan_idx == eob - 1 {2587 let level = if scan_idx == eob - 1 {
2535 let ctx = eob_coeff_ctx(scan_idx, w * h);2588 let ctx = eob_coeff_ctx(scan_idx, w * h);
2536 let l = dec.symbol(&mut coding.base_eob[ctx]) as i32 + 1;2589 let l = dec.symbol(&mut coding.base_eob[ctx]) as i32 + 1;
@@ -5144,6 +5197,286 @@ fn decode_leaf_rect(
5144 Ok(mode)5197 Ok(mode)
5145 }5198 }
5146 5199
5200+/// Decodes one 32x8 / 8x32 strip of a 32x32-level `PARTITION_HORZ_4` /
5201+/// `PARTITION_VERT_4` (lane-tx64x16 r3): [`decode_block_rect`]'s 4:1 sibling,
5202+/// addressed by REAL mi coordinates for the same reason [`decode_leaf_rect`]
5203+/// is -- strips 1 and 3 start 8 px into a 16-px [`SUB`] cell, which an
5204+/// `at`-derived `px = c * SUB` cannot name. `prev_strip` carries the previous
5205+/// strip's mode so this one's mode context sees its true above/left
5206+/// neighbour inside the same 32x32 (`decode_leaf_rect`'s convention).
5207+///
5208+/// Tables: LUMA `TX_32X8`/`TX_8X32` averages to the 16x16 entropy context
5209+/// ([`TxbSet::LumaRect32x8`], 256 positions) and scans with
5210+/// [`SCAN_32X8`]/[`SCAN_8X32`]; CHROMA `TX_16X4`/`TX_4X16` averages to the
5211+/// 8x8 one ([`TxbSet::Chroma8`], 64 positions) and scans with
5212+/// [`SCAN_16X4`]/[`SCAN_4X16`]. Neither shape takes the rect sqrt2 scale --
5213+/// `get_rect_tx_log_ratio` fires at ratio 1 only, and this is ratio 2
5214+/// (`inverse_transform_2d_typed_wh`'s own `rect_scale`).
5215+///
5216+/// A split transform (`tx_depth != 0`) refuses by name: `depth_to_tx_size` of
5217+/// a 4:1 strip is not simply `bw.min(bh) >> (depth - 1)` the way a 2:1
5218+/// strip's is, so [`decode_rect_split`]'s per-unit walk cannot be reused
5219+/// unexamined.
5220+#[allow(clippy::too_many_arguments)]
5221+fn decode_block_rect4(
5222+ dec: &mut SymbolDecoder,
5223+ cdfs: &mut Cdfs,
5224+ neighbours: &mut Neighbours,
5225+ strip_mi: (usize, usize),
5226+ bw: usize,
5227+ bh: usize,
5228+ prev_strip: Option<((usize, usize), usize)>,
5229+ y: &mut PlaneBuf,
5230+ u: &mut PlaneBuf,
5231+ v: &mut PlaneBuf,
5232+ enable_filter_intra: bool,
5233+ allow_screen_content_tools: bool,
5234+ base_q_idx: u8,
5235+ tx_select: bool,
5236+) -> Result<(usize, usize)> {
5237+ let _ = base_q_idx;
5238+ let (mi_r, mi_c) = strip_mi;
5239+ let (r, c) = (mi_r / (SUB / MI), mi_c / (SUB / MI));
5240+ let (mi_w, mi_h) = (bw / MI, bh / MI);
5241+ let mut above_mode = neighbours.above_mode[c];
5242+ let mut left_mode = neighbours.left_mode[r];
5243+ if let Some(((pr, pc), pmode)) = prev_strip {
5244+ if pc == mi_c && mi_r == pr + mi_h {
5245+ above_mode = pmode;
5246+ } else if pr == mi_r && mi_c == pc + mi_w {
5247+ left_mode = pmode;
5248+ }
5249+ }
5250+ let (skip, mode, angle_delta_y, uv_mode, angle_delta_uv, alpha, filter_intra) =
5251+ read_intra_mode_rect(
5252+ dec,
5253+ cdfs,
5254+ above_mode,
5255+ left_mode,
5256+ true,
5257+ bw,
5258+ bh,
5259+ enable_filter_intra,
5260+ neighbours.skip_txfm_ctx(mi_r, mi_c),
5261+ allow_screen_content_tools,
5262+ mi_r,
5263+ mi_c,
5264+ )?;
5265+ let smooth_neighbor = is_smooth_mode(above_mode) || is_smooth_mode(left_mode);
5266+ if smooth_neighbor {
5267+ SMOOTH_LUMA_HITS.with(|c| c.set(c.get() + 1));
5268+ }
5269+ let smooth_neighbor_uv =
5270+ is_smooth_mode(neighbours.above_uv_mode[c]) || is_smooth_mode(neighbours.left_uv_mode[r]);
5271+ if filter_intra.is_some() {
5272+ FILTER_INTRA_RECT_HITS.with(|c| c.set(c.get() + 1));
5273+ }
5274+ let uv_predict_mode = if uv_mode == UV_CFL_PRED {
5275+ DC_PRED
5276+ } else {
5277+ uv_mode
5278+ };
5279+ let depth = if tx_select {
5280+ let ctx = tx_size_context_rect(neighbours, (mi_r, mi_c), bw, bh);
5281+ dec.symbol(&mut cdfs.tx_size_cat2[ctx])
5282+ } else {
5283+ 0
5284+ };
5285+ if depth != 0 {
5286+ // lane-tx64x16 r4: the depth is IN the message -- it says which port
5287+ // the next round owes. depth 1 of a 4:1 strip is TX_16X8/TX_8X16
5288+ // (`sub_tx_size_map[TX_32X8] == TX_16X8`), a RECTANGULAR transform
5289+ // unit with no luma coefficient tables here; depth 2 is TX_8X8,
5290+ // square, the shape `decode_rect_split` already walks. The film stops
5291+ // at depth 2, synthetic band fixtures hit both.
5292+ return Err(unsupported(format!(
5293+ "a 32x32-level 1:4 strip with a split transform (per-unit 4:1 prediction is not \
5294+ ported, depth={depth})"
5295+ )));
5296+ }
5297+ // The coarse (16-px [`SUB`] cell) mode/side arrays cannot name a strip
5298+ // that is 8 px tall, so each strip stamps every cell it touches and the
5299+ // LAST strip wins -- which is the right answer for the block below/right
5300+ // of the 32x32, the only reader outside it. Written after this strip's
5301+ // own context read above, never before.
5302+ for cell in 0..bw.div_ceil(SUB) {
5303+ neighbours.above_mode[c + cell] = mode;
5304+ neighbours.above_uv_mode[c + cell] = uv_predict_mode;
5305+ neighbours.above_side[c + cell] = bw;
5306+ }
5307+ for cell in 0..bh.div_ceil(SUB) {
5308+ neighbours.left_mode[r + cell] = mode;
5309+ neighbours.left_uv_mode[r + cell] = uv_predict_mode;
5310+ neighbours.left_side[r + cell] = bh;
5311+ }
5312+ let (px, py) = (mi_c * MI, mi_r * MI);
5313+ let (cpx, cpy) = (px / 2, py / 2);
5314+ let (chroma_w, chroma_h) = (bw / 2, bh / 2);
5315+ let reach = Reach::of_rect(bw, bh, px, py, y.width, y.height);
5316+ let (luma_scan, chroma_scan): (&[u16], &[u16]) = if bw > bh {
5317+ (&SCAN_32X8, &SCAN_16X4)
5318+ } else {
5319+ (&SCAN_8X32, &SCAN_4X16)
5320+ };
5321+ let (luma_levels, u_levels, v_levels) = if skip {
5322+ (
5323+ vec![0i32; bw * bh],
5324+ vec![0i32; chroma_w * chroma_h],
5325+ vec![0i32; chroma_w * chroma_h],
5326+ )
5327+ } else {
5328+ let around = neighbours.around_mi_rect((mi_r, mi_c), bw, bh);
5329+ let mut luma_coding = cdfs.txb(TxbSet::LumaRect32x8, mode);
5330+ let (luma_levels, luma_tx_type) = read_coeffs_rect(
5331+ dec,
5332+ &mut luma_coding,
5333+ luma_scan,
5334+ bw,
5335+ bh,
5336+ 0,
5337+ dc_sign_ctx(around[0].2),
5338+ TxType::DctDct,
5339+ )?;
5340+ let mut planes = Vec::with_capacity(2);
5341+ for plane in 1..3 {
5342+ let default_tx = default_intra_tx_type(uv_predict_mode as u8);
5343+ let skip_ctx = usize::from(around[plane].0) + usize::from(around[plane].1);
5344+ let mut coding = cdfs.txb(TxbSet::Chroma8, uv_predict_mode);
5345+ let (levels, tx_type) = read_coeffs_rect(
5346+ dec,
5347+ &mut coding,
5348+ chroma_scan,
5349+ chroma_w,
5350+ chroma_h,
5351+ skip_ctx,
5352+ dc_sign_ctx(around[plane].2),
5353+ default_tx,
5354+ )?;
5355+ planes.push((levels, tx_type));
5356+ }
5357+ let (v_levels, v_tx_type) = planes.pop().expect("plane 2");
5358+ let (u_levels, u_tx_type) = planes.pop().expect("plane 1");
5359+ RECT4_COEFF_HITS.with(|c| c.set(c.get() + 1));
5360+ let luma_residual = dequant_and_inverse_typed_wh(
5361+ &luma_levels,
5362+ bw,
5363+ bh,
5364+ crate::decode::bit_depth(),
5365+ block_q_idx(),
5366+ plane_q_delta(0).0,
5367+ plane_q_delta(0).1,
5368+ luma_tx_type,
5369+ );
5370+ y.reconstruct_rect(
5371+ px,
5372+ py,
5373+ bw,
5374+ bh,
5375+ mode,
5376+ angle_delta_y,
5377+ reach,
5378+ &luma_residual,
5379+ None,
5380+ filter_intra,
5381+ smooth_neighbor,
5382+ );
5383+ let ac = alpha.map(|_| cfl_ac_q3_rect(y, px, py, bw, bh));
5384+ for (plane, buf, levels, tx_type) in [
5385+ (1usize, &mut *u, &u_levels, u_tx_type),
5386+ (2, &mut *v, &v_levels, v_tx_type),
5387+ ] {
5388+ let residual = dequant_and_inverse_typed_wh(
5389+ levels,
5390+ chroma_w,
5391+ chroma_h,
5392+ crate::decode::bit_depth(),
5393+ block_q_idx(),
5394+ plane_q_delta(plane).0,
5395+ plane_q_delta(plane).1,
5396+ tx_type,
5397+ );
5398+ buf.reconstruct_rect(
5399+ cpx,
5400+ cpy,
5401+ chroma_w,
5402+ chroma_h,
5403+ uv_predict_mode,
5404+ angle_delta_uv,
5405+ reach,
5406+ &residual,
5407+ alpha
5408+ .zip(ac.as_deref())
5409+ .map(|((au, av), ac)| (if plane == 1 { au } else { av }, ac)),
5410+ None,
5411+ smooth_neighbor_uv,
5412+ );
5413+ }
5414+ neighbours.record_mi_rect(
5415+ (mi_r, mi_c),
5416+ bw,
5417+ bh,
5418+ &[luma_levels, u_levels, v_levels],
5419+ );
5420+ neighbours.fill_skip_grid_rect((mi_r, mi_c), mi_w, mi_h, skip);
5421+ neighbours.fill_lf_grid_rect((mi_r, mi_c), mi_w, mi_h, bw as u8, bh as u8, 0);
5422+ if bw > bh {
5423+ RECT4_32_HORZ_HITS.with(|c| c.set(c.get() + 1));
5424+ } else {
5425+ RECT4_32_VERT_HITS.with(|c| c.set(c.get() + 1));
5426+ }
5427+ return Ok((mode, uv_predict_mode));
5428+ };
5429+ y.reconstruct_rect(
5430+ px,
5431+ py,
5432+ bw,
5433+ bh,
5434+ mode,
5435+ angle_delta_y,
5436+ reach,
5437+ &luma_levels,
5438+ None,
5439+ filter_intra,
5440+ smooth_neighbor,
5441+ );
5442+ let ac = alpha.map(|_| cfl_ac_q3_rect(y, px, py, bw, bh));
5443+ u.reconstruct_rect(
5444+ cpx,
5445+ cpy,
5446+ chroma_w,
5447+ chroma_h,
5448+ uv_predict_mode,
5449+ angle_delta_uv,
5450+ reach,
5451+ &u_levels,
5452+ alpha.zip(ac.as_deref()).map(|((au, _), ac)| (au, ac)),
5453+ None,
5454+ smooth_neighbor_uv,
5455+ );
5456+ v.reconstruct_rect(
5457+ cpx,
5458+ cpy,
5459+ chroma_w,
5460+ chroma_h,
5461+ uv_predict_mode,
5462+ angle_delta_uv,
5463+ reach,
5464+ &v_levels,
5465+ alpha.zip(ac.as_deref()).map(|((_, av), ac)| (av, ac)),
5466+ None,
5467+ smooth_neighbor_uv,
5468+ );
5469+ neighbours.record_mi_rect((mi_r, mi_c), bw, bh, &[luma_levels, u_levels, v_levels]);
5470+ neighbours.fill_skip_grid_rect((mi_r, mi_c), mi_w, mi_h, skip);
5471+ neighbours.fill_lf_grid_rect((mi_r, mi_c), mi_w, mi_h, bw as u8, bh as u8, 0);
5472+ if bw > bh {
5473+ RECT4_32_HORZ_HITS.with(|c| c.set(c.get() + 1));
5474+ } else {
5475+ RECT4_32_VERT_HITS.with(|c| c.set(c.get() + 1));
5476+ }
5477+ Ok((mode, uv_predict_mode))
5478+}
5479+
5147 /// Decodes one true `bw`x`bh` superblock-level `PARTITION_HORZ`/5480 /// Decodes one true `bw`x`bh` superblock-level `PARTITION_HORZ`/
5148 /// `PARTITION_VERT` strip (lane-sbpart r2, `bw, bh` one of `(64, 32)` /5481 /// `PARTITION_VERT` strip (lane-sbpart r2, `bw, bh` one of `(64, 32)` /
5149 /// `(32, 64)` -- [`decode_block_rect`]'s own sibling one level up). Unlike5482 /// `(32, 64)` -- [`decode_block_rect`]'s own sibling one level up). Unlike
@@ -10136,6 +10469,47 @@ pub(crate) fn decode_key_frame_tile_with_cdfs(
10136 reduced_tx_set,10469 reduced_tx_set,
10137 )?;10470 )?;
10138 }10471 }
10472+ PARTITION_HORZ_4 | PARTITION_VERT_4 => {
10473+ // lane-tx64x16 r3: the 1:4 pair at the 32x32
10474+ // level -- four 32x8 (or 8x32) strips in
10475+ // raster order, `quarter_step` = 2 mi, with
10476+ // libaom `decode_partition`'s own `i > 0`
10477+ // frame-edge break.
10478+ let horz = part32 == PARTITION_HORZ_4;
10479+ let base_mi = (at32.0 * (SUB / MI), at32.1 * (SUB / MI));
10480+ let mut prev: Option<((usize, usize), usize)> = None;
10481+ for i in 0..4 {
10482+ let strip_mi = if horz {
10483+ (base_mi.0 + i * 2, base_mi.1)
10484+ } else {
10485+ (base_mi.0, base_mi.1 + i * 2)
10486+ };
10487+ if i > 0
10488+ && (strip_mi.0 >= mi_rows as usize
10489+ || strip_mi.1 >= mi_cols as usize)
10490+ {
10491+ break;
10492+ }
10493+ let (bw, bh) = if horz { (32, 8) } else { (8, 32) };
10494+ let (mode, _uv) = decode_block_rect4(
10495+ &mut dec,
10496+ &mut cdfs,
10497+ &mut neighbours,
10498+ strip_mi,
10499+ bw,
10500+ bh,
10501+ prev,
10502+ &mut y,
10503+ &mut u,
10504+ &mut v,
10505+ enable_filter_intra,
10506+ allow_screen_content_tools,
10507+ base_q_idx,
10508+ tx_select,
10509+ )?;
10510+ prev = Some((strip_mi, mode));
10511+ }
10512+ }
10139 _ => {10513 _ => {
10140 return Err(unsupported(format!(10514 return Err(unsupported(format!(
10141 "a 32x32 partition type this decoder does not code (value={part32})"10515 "a 32x32 partition type this decoder does not code (value={part32})"
@@ -17424,6 +17798,37 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs(
17424 mod tests {17798 mod tests {
17425 use super::*;17799 use super::*;
17426 17800
17801+ /// lane-tx64x16 r3: the two new 4:1 chroma scans are a TRANSPOSED PAIR --
17802+ /// `SCAN_4X16[i]` must name the transpose of the position
17803+ /// `SCAN_16X4[i]` names (class scan-weights-cross-axis: a naive copy of
17804+ /// libaom's column-major `default_scan_*` installs the transpose and only
17805+ /// an asymmetric check catches it). Also pins both as permutations, and
17806+ /// pins the same relation for the 32x8/8x32 luma pair this arm reuses.
17807+ #[test]
17808+ fn the_rect4_scans_are_transposed_pairs() {
17809+ for (a, b, w, h) in [
17810+ (&SCAN_16X4[..], &SCAN_4X16[..], 16usize, 4usize),
17811+ (&SCAN_32X8[..], &SCAN_8X32[..], 32, 8),
17812+ ] {
17813+ let mut seen_a: Vec<u16> = a.to_vec();
17814+ seen_a.sort_unstable();
17815+ assert_eq!(
17816+ seen_a,
17817+ (0..(w * h) as u16).collect::<Vec<_>>(),
17818+ "{w}x{h} scan is not a permutation of its positions"
17819+ );
17820+ for (i, (&pa, &pb)) in a.iter().zip(b.iter()).enumerate() {
17821+ let (row, col) = (pa as usize / w, pa as usize % w);
17822+ assert_eq!(
17823+ pb as usize,
17824+ col * w.min(h) + row,
17825+ "scan step {i}: {w}x{h} visits (row {row}, col {col}) but its transpose \
17826+ visits position {pb}"
17827+ );
17828+ }
17829+ }
17830+ }
17831+
17427 /// lane-rectsplit r4 (class `enumerate-table-domain`): [`base_ctx`]'s17832 /// lane-rectsplit r4 (class `enumerate-table-domain`): [`base_ctx`]'s
17428 /// `TX_CLASS_2D` arm must, over the WHOLE 5x5 domain of both rect shapes17833 /// `TX_CLASS_2D` arm must, over the WHOLE 5x5 domain of both rect shapes
17429 /// and the square one, return exactly what libaom's17834 /// and the square one, return exactly what libaom's
crates/ec-av1/src/encode.rsmodified+8 -8
@@ -1123,14 +1123,6 @@ impl Drop for VertAbGuard {
1123 }1123 }
1124 }1124 }
1125 1125
1126-/// `has_tr_32x16`/`has_tr_16x32` (libaom `reconintra.c`) -- lane-intradisp
1127-/// r1: the two rect strips PARTITION_HORZ/VERT ever produce at the 32x32
1128-/// level, transcribed verbatim (not derived): `[0]` is 32-wide, `[1]` is
1129-/// 16-wide.
1130-const HAS_TOP_RIGHT_RECT: [&[u8]; 2] = [&[15, 5, 7, 5], &[255, 119, 127, 119]];
1131-/// `has_bl_32x16`/`has_bl_16x32`, same source, same order.
1132-const HAS_BOTTOM_LEFT_RECT: [&[u8]; 2] = [&[78, 14, 78, 14], &[16, 0, 16, 0]];
1133-
1134 /// libaom `reconintra.c`'s `has_tr_*`/`has_bl_*` for the four rectangular1126 /// libaom `reconintra.c`'s `has_tr_*`/`has_bl_*` for the four rectangular
1135 /// block sizes this decoder codes, transcribed verbatim (lane-rectx r4).1127 /// block sizes this decoder codes, transcribed verbatim (lane-rectx r4).
1136 /// The 16x8/8x16 rows are what the 32x16/16x32 pair above cannot stand in1128 /// The 16x8/8x16 rows are what the 32x16/16x32 pair above cannot stand in
@@ -1148,6 +1140,11 @@ fn has_tr_rect_table(bw: usize, bh: usize) -> &'static [u8] {
1148 (32, 16) => &[15, 5, 7, 5],1140 (32, 16) => &[15, 5, 7, 5],
1149 (16, 32) => &[255, 119, 127, 119],1141 (16, 32) => &[255, 119, 127, 119],
1150 (64, 32) => &[19],1142 (64, 32) => &[19],
1143+ // lane-tx64x16 r3: `has_tr_32x8` / `has_tr_8x32`
1144+ // (`reconintra.c:122-127`), the 4:1 strips of a 32x32-level
1145+ // `PARTITION_HORZ_4`/`VERT_4`.
1146+ (32, 8) => &[15, 0, 5, 0, 7, 0, 5, 0],
1147+ (8, 32) => &[255, 255, 127, 127, 255, 127, 127, 127],
1151 _ => &[127],1148 _ => &[127],
1152 }1149 }
1153 }1150 }
@@ -1159,6 +1156,9 @@ fn has_bl_rect_table(bw: usize, bh: usize) -> &'static [u8] {
1159 (32, 16) => &[78, 14, 78, 14],1156 (32, 16) => &[78, 14, 78, 14],
1160 (16, 32) => &[16, 0, 16, 0],1157 (16, 32) => &[16, 0, 16, 0],
1161 (64, 32) => &[34],1158 (64, 32) => &[34],
1159+ // `has_bl_32x8` / `has_bl_8x32` (`reconintra.c:305-310`).
1160+ (32, 8) => &[238, 78, 238, 14, 238, 78, 238, 14],
1161+ (8, 32) => &[0, 1, 0, 0, 0, 1, 0, 0],
1162 _ => &[0],1162 _ => &[0],
1163 }1163 }
1164 }1164 }
crates/ec-av1/src/gate_coverage.rsmodified+3 -5
@@ -196,11 +196,9 @@ const NEVER_EXERCISED_10BIT: &[(&str, &str)] = &[
196 // sums never brought back to the 8-bit scale, Wiener clamp at the wrong196 // sums never brought back to the 8-bit scale, Wiener clamp at the wrong
197 // bound). `enable-dist-wtd-comp` and `enable-global-motion` left it the197 // bound). `enable-dist-wtd-comp` and `enable-global-motion` left it the
198 // same day for the same reason: lane-cwarp's 10-bit compound global-warp198 // same day for the same reason: lane-cwarp's 10-bit compound global-warp
199- // gate passes `=1` for both.199+ // gate passes `=1` for both. `enable-1to4-partitions` left it on 2026-09-02:
200- (200+ // lane-tx64x16 r4's 32-level 1:4 gate has a 10-bit arm that asserts both
201- "enable-1to4-partitions",201+ // orientations and coded strips inside pixel-exact attempts.
202- "10-bit hole only: 8-bit gates (lane-tx64x16 SB-level 1:4, lane-sub8) pass `=1` and assert their arms, but no 10-bit gate does",
203- ),
204 (202 (
205 "enable-angle-delta",203 "enable-angle-delta",
206 "hole at both depths, see the 8-bit list",204 "hole at both depths, see the 8-bit list",
crates/ec-av1/src/refusal_inventory.rsmodified+1 -0
@@ -41,6 +41,7 @@ const REFUSALS: &[&str] = &[
41 "a 16x16 block whose true edge cuts through both axes needs a rectangular transform this decoder does not code yet",41 "a 16x16 block whose true edge cuts through both axes needs a rectangular transform this decoder does not code yet",
42 "a 16x16 inter block whose true edge cuts through both axes needs a rectangular transform this decoder does not code yet",42 "a 16x16 inter block whose true edge cuts through both axes needs a rectangular transform this decoder does not code yet",
43 "a 32x32 partition type this decoder does not code (value={part32})",43 "a 32x32 partition type this decoder does not code (value={part32})",
44+ "a 32x32-level 1:4 strip with a split transform (per-unit 4:1 prediction is not ported, depth={depth})",
44 "a Golomb tail longer than this decoder reads",45 "a Golomb tail longer than this decoder reads",
45 "a tx_type symbol outside its CDF's own set: {t}",46 "a tx_type symbol outside its CDF's own set: {t}",
46 "an INTER 32x32 partition type this decoder does not code (value={part32})",47 "an INTER 32x32 partition type this decoder does not code (value={part32})",
crates/ec-av1/src/stream.rsmodified+253 -0
@@ -53,6 +53,16 @@ fn final_dump_prefix() -> Option<String> {
53 .or_else(|| std::env::var("EC_AV1_FINAL_DUMP").ok())53 .or_else(|| std::env::var("EC_AV1_FINAL_DUMP").ok())
54 }54 }
55 55
56+/// 32x32-level 1:4 strip counters, for `decode_probe`'s fixture search:
57+/// (HORZ_4 strips, VERT_4 strips, strips that read coefficients).
58+pub fn rect4_32_counters() -> (usize, usize, usize) {
59+ (
60+ crate::decode::rect4_32_horz_hits(),
61+ crate::decode::rect4_32_vert_hits(),
62+ crate::decode::rect4_coeff_hits(),
63+ )
64+}
65+
56 /// Decode every frame in a raw AV1 OBU stream, in coding order.66 /// Decode every frame in a raw AV1 OBU stream, in coding order.
57 ///67 ///
58 /// A key frame becomes the reference for the inter frames that follow it,68 /// A key frame becomes the reference for the inter frames that follow it,
@@ -14549,5 +14559,248 @@ mod tests {
14549 {out_of_scope} attempts carried no 1:4 block ({out_of_scope_mismatch} of them \14559 {out_of_scope} attempts carried no 1:4 block ({out_of_scope_mismatch} of them \
14550 mismatched -- other lanes' shapes)"14560 mismatched -- other lanes' shapes)"
14551 );14561 );
14562+ // Class gate-skips-on-its-own-failure: an attempt that decoded but
14563+ // does not carry this gate's shape is still a decode this crate got
14564+ // wrong. Counted separately so the message names the other shape,
14565+ // never tolerated.
14566+ assert_eq!(
14567+ out_of_scope_mismatch, 0,
14568+ "{NAME}: {out_of_scope_mismatch} attempt(s) with no 1:4 block decoded but \
14569+ mismatched ffmpeg -- a defect of another shape, not a pass"
14570+ );
14571+ }
14572+
14573+ /// lane-tx64x16 r3: the 32x32-LEVEL 1:4 pair -- `PARTITION_HORZ_4` /
14574+ /// `PARTITION_VERT_4` at 32x32, i.e. four 32x8 / 8x32 strips, the arm the
14575+ /// ReelB mid-film extract stops at ("a 32x32 partition type this
14576+ /// decoder does not code (value=8)"). `--min-partition-size=8` is what
14577+ /// lets aomenc's RD reach the 32-level 1:4 shapes; `--max-partition-size=32`
14578+ /// keeps the superblock-level pair (already gated by its own test above)
14579+ /// out of the counters. Both orientations HARD-asserted per bit depth --
14580+ /// the luma scans and the two new chroma scans (`SCAN_16X4`/`SCAN_4X16`)
14581+ /// are transposed pairs, so a one-sided gate cannot catch a transposition
14582+ /// (class scan-weights-cross-axis). `rect4_coeff_hits` is asserted too:
14583+ /// an all-skip stream would exercise none of the new coefficient tables
14584+ /// (class gate-blind-to-feature). Only hits earned inside an attempt that
14585+ /// then compared pixel-exact are counted (class
14586+ /// gate-skips-on-its-own-failure); the 10-bit arm is what retires
14587+ /// `enable-1to4-partitions` from `NEVER_EXERCISED_10BIT`.
14588+ #[test]
14589+ // lane-tx64x16 r4: the fixture r3 could not find. `gradients` never wins
14590+ // a 32-level 1:4 shape; 8-pixel BANDS do -- each 32x8 strip is flat, so
14591+ // HORZ_4 beats both HORZ (two bands per 32x16) and SPLIT, while the noise
14592+ // layer keeps aomenc out of screen-content mode. Measured 16 HORZ_4 / 24
14593+ // VERT_4 strips per frame, both bit depths (lanes/tx64x16-r4.report.md).
14594+ fn a_real_aomenc_stream_with_a_32x32_level_1to4_partition_decodes_pixel_exact() {
14595+ const NAME: &str =
14596+ "a_real_aomenc_stream_with_a_32x32_level_1to4_partition_decodes_pixel_exact";
14597+ let _gate_lock = lock_gate_counters();
14598+ if !have_ffmpeg() {
14599+ eprintln!("SKIP {NAME}: no ffmpeg");
14600+ return;
14601+ }
14602+ if !have_aomenc() {
14603+ eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display());
14604+ return;
14605+ }
14606+ let (width, height, frame_count) = (192usize, 128usize, 1usize);
14607+ let n_attempts: u32 = std::env::var("EC_TX64X16_GATE32_ATTEMPTS")
14608+ .ok()
14609+ .and_then(|s| s.parse().ok())
14610+ .unwrap_or(8);
14611+ for bit_depth in [8u32, 10u32] {
14612+ let mut named_refusals = 0u32;
14613+ let mut matched = 0u32;
14614+ let (mut horz_proved, mut vert_proved, mut coeff_proved) = (0usize, 0usize, 0usize);
14615+ let (mut out_of_scope, mut out_of_scope_mismatch) = (0u32, 0u32);
14616+ for attempt in 0..n_attempts {
14617+ let seed = 42 + attempt;
14618+ let duration = frame_count as f64 / 25.0;
14619+ // 8-pixel bands: a 32x8 strip is flat, a 32x16 one is not, so
14620+ // aomenc's RD picks HORZ_4 (bands across Y) / VERT_4 (bands
14621+ // across X). Odd attempts are the transposed source -- the
14622+ // transposed-pair discipline the superblock-level 1:4 gate
14623+ // above documents, and the only way a transposed scan table is
14624+ // caught (class scan-weights-cross-axis). The noise layer is
14625+ // what keeps the flat bands out of screen-content mode; its
14626+ // seed is explicit, never lavfi's ignored default.
14627+ let axis = if attempt % 2 == 0 { "Y" } else { "X" };
14628+ let step = 67 + (attempt / 2) * 12;
14629+ let noise = 6 + (attempt % 4) * 3;
14630+ let source = format!(
14631+ "color=c=gray:s={width}x{height}:d={duration}:r=25,format=gray,\
14632+ geq=lum='mod(floor({axis}/8)*{step},256)',\
14633+ noise=alls={noise}:all_seed={seed},format=yuv420p"
14634+ );
14635+ let cq_level = format!("--cq-level={}", if attempt % 4 < 2 { 32 } else { 45 });
14636+ let pix_fmt = if bit_depth == 10 { "yuv420p10le" } else { "yuv420p" };
14637+ let y4m = Command::new("ffmpeg")
14638+ .args([
14639+ "-v", "error", "-f", "lavfi", "-i", &source, "-t", &duration.to_string(),
14640+ "-pix_fmt", pix_fmt, "-strict", "-1", "-f", "yuv4mpegpipe", "-",
14641+ ])
14642+ .stdin(Stdio::null())
14643+ .stdout(Stdio::piped())
14644+ .stderr(Stdio::piped())
14645+ .output()
14646+ .expect("ffmpeg failed to run");
14647+ assert!(
14648+ y4m.status.success(),
14649+ "{NAME}: ffmpeg refused the {bit_depth}-bit fixture: {}",
14650+ String::from_utf8_lossy(&y4m.stderr)
14651+ );
14652+ let depth_arg = format!("--bit-depth={bit_depth}");
14653+ let input_depth_arg = format!("--input-bit-depth={bit_depth}");
14654+ let args: Vec<&str> = vec![
14655+ "--codec=av1",
14656+ "--passes=1",
14657+ "--end-usage=q",
14658+ &cq_level,
14659+ "--cpu-used=0",
14660+ "--threads=1",
14661+ "--row-mt=0",
14662+ "--sb-size=64",
14663+ &depth_arg,
14664+ &input_depth_arg,
14665+ "--enable-rect-partitions=1",
14666+ "--enable-ab-partitions=0",
14667+ "--enable-1to4-partitions=1",
14668+ "--min-partition-size=8",
14669+ "--max-partition-size=32",
14670+ "--enable-restoration=0",
14671+ "--enable-palette=0",
14672+ "--deltaq-mode=0",
14673+ "--enable-filter-intra=0",
14674+ "--enable-cfl-intra=0",
14675+ "--enable-intrabc=0",
14676+ "--enable-tx-size-search=0",
14677+ "--obu",
14678+ "-o",
14679+ "-",
14680+ "-",
14681+ ];
14682+ let mut child = Command::new(aomenc_path())
14683+ .args(&args)
14684+ .stdin(Stdio::piped())
14685+ .stdout(Stdio::piped())
14686+ .stderr(Stdio::piped())
14687+ .spawn()
14688+ .expect("aomenc failed to start");
14689+ child
14690+ .stdin
14691+ .take()
14692+ .expect("aomenc stdin")
14693+ .write_all(&y4m.stdout)
14694+ .expect("writing y4m to aomenc");
14695+ let out = child.wait_with_output().expect("aomenc failed to run");
14696+ assert!(
14697+ out.status.success(),
14698+ "aomenc refused the fixture: {}",
14699+ String::from_utf8_lossy(&out.stderr)
14700+ );
14701+ let stream = out.stdout;
14702+ let before = (
14703+ crate::decode::rect4_32_horz_hits(),
14704+ crate::decode::rect4_32_vert_hits(),
14705+ crate::decode::rect4_coeff_hits(),
14706+ );
14707+ let frames = match decode_stream(&stream) {
14708+ Err(e) => {
14709+ let msg = e.to_string();
14710+ assert!(
14711+ msg.contains("unsupported"),
14712+ "{NAME} failed outright, not a named refusal ({bit_depth}-bit, seed \
14713+ {seed}): {msg}"
14714+ );
14715+ named_refusals += 1;
14716+ eprintln!("{bit_depth}-bit seed {seed} refusal: {msg}");
14717+ continue;
14718+ }
14719+ Ok(frames) => frames,
14720+ };
14721+ let (horz, vert, coeff) = (
14722+ crate::decode::rect4_32_horz_hits() - before.0,
14723+ crate::decode::rect4_32_vert_hits() - before.1,
14724+ crate::decode::rect4_coeff_hits() - before.2,
14725+ );
14726+ let ffmpeg_frames = if bit_depth == 10 {
14727+ ffmpeg_decode_sequence_10bit(&stream, width, height, frame_count)
14728+ } else {
14729+ ffmpeg_decode_sequence(&stream, width, height, frame_count)
14730+ };
14731+ assert_eq!(frames.len(), frame_count);
14732+ let mismatched = frames
14733+ .iter()
14734+ .zip(&ffmpeg_frames)
14735+ .any(|(got, want)| got.y != want.y || got.u != want.u || got.v != want.v);
14736+ if horz + vert == 0 {
14737+ // Out of this gate's territory (no 32-level 1:4 block in
14738+ // the stream): counted and printed, never silently
14739+ // dropped, and a mismatch here is another shape's defect.
14740+ out_of_scope += 1;
14741+ if mismatched {
14742+ out_of_scope_mismatch += 1;
14743+ eprintln!(
14744+ "{NAME}: {bit_depth}-bit seed {seed} MISMATCHES with zero 32-level \
14745+ 1:4 blocks -- a pre-existing defect of another shape"
14746+ );
14747+ }
14748+ continue;
14749+ }
14750+ if mismatched {
14751+ if let Ok(path) = std::env::var("EC_AV1_GATE_DUMP") {
14752+ std::fs::write(&path, &stream).expect("writing pinned stream");
14753+ eprintln!(
14754+ "EC_AV1_GATE_DUMP: wrote mismatching stream ({bit_depth}-bit, seed \
14755+ {seed}) to {path}"
14756+ );
14757+ }
14758+ }
14759+ for (i, (got, want)) in frames.iter().zip(&ffmpeg_frames).enumerate() {
14760+ assert_eq!(
14761+ got.y, want.y,
14762+ "{NAME} frame {i} luma vs ffmpeg ({bit_depth}-bit, seed {seed})"
14763+ );
14764+ assert_eq!(
14765+ got.u, want.u,
14766+ "{NAME} frame {i} U vs ffmpeg ({bit_depth}-bit, seed {seed})"
14767+ );
14768+ assert_eq!(
14769+ got.v, want.v,
14770+ "{NAME} frame {i} V vs ffmpeg ({bit_depth}-bit, seed {seed})"
14771+ );
14772+ }
14773+ horz_proved += horz;
14774+ vert_proved += vert;
14775+ coeff_proved += coeff;
14776+ matched += 1;
14777+ }
14778+ assert!(
14779+ matched > 0,
14780+ "{NAME}: every {bit_depth}-bit attempt refused; the gate never decoded a stream"
14781+ );
14782+ assert!(
14783+ horz_proved > 0 && vert_proved > 0,
14784+ "{NAME}: a 32-level 1:4 arm never fired inside a pixel-exact {bit_depth}-bit \
14785+ attempt (horz={horz_proved}, vert={vert_proved}, {matched} matches, \
14786+ {named_refusals} refusals out of {n_attempts}) -- gate proved nothing this run"
14787+ );
14788+ assert!(
14789+ coeff_proved > 0,
14790+ "{NAME}: every {bit_depth}-bit 32-level 1:4 strip was skip -- the 32x8/16x4 \
14791+ coefficient tables were never read"
14792+ );
14793+ eprintln!(
14794+ "{NAME}: {bit_depth}-bit: {named_refusals} named refusals, {matched} pixel-exact \
14795+ matches out of {n_attempts}, horz_4 strips={horz_proved}, vert_4 \
14796+ strips={vert_proved}, coded strips={coeff_proved}, {out_of_scope} attempts \
14797+ carried no 32-level 1:4 block ({out_of_scope_mismatch} mismatched)"
14798+ );
14799+ assert_eq!(
14800+ out_of_scope_mismatch, 0,
14801+ "{NAME}: {bit_depth}-bit: {out_of_scope_mismatch} attempt(s) with zero 32-level \
14802+ 1:4 blocks decoded but mismatched ffmpeg -- a defect of another shape, not a pass"
14803+ );
14804+ }
14552 }14805 }
14553 }14806 }
lanes/tx64x16-r3.report.mdadded+104 -0
@@ -0,0 +1,104 @@
1+# lane-tx64x16 r3 — the 32x32-level 1:4 arms land and run on real content; the fixture gate does not
2+
3+Branch `lane-tx64x16`, commits `c6f1144` (rectsplit r4 cherry-pick) and
4+`86226fe` (this round's feature) on top of `88100e5`. Not rebased (a verifier
5+reads 88100e5 from a scratch tree, per charter).
6+
7+## What changed
8+
9+- `crates/ec-av1/src/decode.rs` — `decode_block_rect4` (new, ~line 4840):
10+ `decode_block_rect`'s 4:1 sibling addressed by REAL mi coordinates. Strips 1
11+ and 3 of a 32-level `HORZ_4`/`VERT_4` start 8 px into a 16-px `SUB` cell,
12+ which `decode_block_rect`'s `px = c * SUB` cannot name — the same reason
13+ `decode_leaf_rect` exists — and it carries `decode_leaf_rect`'s prev-strip
14+ mode override so the second/third/fourth strip's mode context sees its true
15+ in-block neighbour. Coefficients are READ, not refused.
16+- `decode.rs` — `SCAN_16X4`/`SCAN_4X16` (new, ~line 2008), the chroma scans of
17+ a 32x8/8x32 strip. Transcribed from libaom's COLUMN-major `default_scan_16x4`
18+ / `default_scan_4x16`; the rule (`row = p % h`, `col = p / h`) was validated
19+ by REGENERATING the existing `SCAN_16X8` from `default_scan_16x8` byte for
20+ byte before emitting them (class reference-layout-not-spec).
21+- `decode.rs` — the 32-level partition dispatch (`~9744`): `PARTITION_HORZ_4 |
22+ PARTITION_VERT_4` arm, `quarter_step` = 2 mi, libaom's own `i > 0` frame-edge
23+ break, per-orientation counters `RECT4_32_{HORZ,VERT}_HITS` plus
24+ `RECT4_COEFF_HITS` (non-skip strips only).
25+- `crates/ec-av1/src/cdf_state.rs` — `TxbSet::LumaRect32x8`: `Luma16`'s
26+ 256-position coefficient tables (`get_txsize_entropy_ctx` averages (5+3)/2=4)
27+ with `tx_type: None`, because `tx_size_sqr_up(TX_32X8) = TX_32X32` where
28+ `av1_get_ext_tx_set_type` is `EXT_TX_SET_DCTONLY` for intra. Chroma 16x4/4x16
29+ reuses `TxbSet::Chroma8` (64 positions) unchanged.
30+- `crates/ec-av1/src/encode.rs` — `HAS_TOP_RIGHT_RECT`/`HAS_BOTTOM_LEFT_RECT`
31+ gain `has_tr_32x8`/`has_tr_8x32`/`has_bl_32x8`/`has_bl_8x32`
32+ (`reconintra.c:122-127`, `305-310`); the row selector is now an explicit
33+ `(bw, bh)` match (`Reach::rect_table`) so no existing shape changes row.
34+ libaom's index `(blk_row << (MAX_MIB_SIZE_LOG2 - bw_in_mi_log2)) + blk_col`
35+ is exactly this file's `row * (128 / bw) + col`, so the stride math already
36+ generalized — verified against `reconintra.c:242-246`.
37+- `crates/ec-av1/src/refusal_inventory.rs` — new string "a 32x32-level 1:4
38+ strip with a split transform (per-unit 4:1 prediction is not ported)".
39+- `crates/ec-av1/src/stream.rs` — new gate
40+ `a_real_aomenc_stream_with_a_32x32_level_1to4_partition_decodes_pixel_exact`
41+ (8-bit AND 10-bit arms, per-arm hard asserts, coded-strip assert), currently
42+ `#[ignore]`d — see the honest failure below.
43+- Cherry-pick of lane-rectsplit r4 `7b55227`: `base_ctx` now states libaom's
44+ generating rule (`txb_common.h:199-209`) instead of indexing the transposed
45+ 5x5 tables, plus r4's SB split-transform per-TU strips. r2's nz_map test was
46+ dropped for r4's whole-domain one, as chartered.
47+
48+## The one place main and lane-rectsplit disagree (merge note)
49+
50+`main`'s `NZ_MAP_CTX_OFFSET_64X32` row 0 is `[0, 16, 6, 6, 21]`; rectsplit
51+r4's is `[0, 16, 16, 16, 16]` — the two trees hold TRANSPOSED transcriptions of
52+the same libaom table. Nothing decodes off them any more (`base_ctx` states the
53+rule), so r4's domain test is pinned here as `[row][col]` with a comment at the
54+assert. Whoever merges both branches must keep table layout and that index in
55+step; picking either consistently is correct.
56+
57+## Gate: RED, and left `#[ignore]`d on purpose
58+
59+No fixture recipe found this round makes aomenc emit a 32x32-level 1:4
60+partition. Measured, three recipes, all with `--enable-1to4-partitions=1
61+--enable-rect-partitions=1 --min-partition-size=8 --max-partition-size=32
62+--cpu-used=0`:
63+
64+| fixture | attempts | attempts carrying a 32-level 1:4 block |
65+|---|---|---|
66+| `gradients_source` + transposed odd attempts (the SB gate's own fixture) | 20 | 0 |
67+| same, rendered at double height and squeezed (halves every band) | 6 | 0 |
68+| same + `avgblur=sizeX=15:sizeY=0` (horizontally smooth) | 6 | 0, and 4/6 additionally tripped the screen-content refusal |
69+
70+`--max-partition-size=64` (so the 64-level pair may also fire) changed nothing
71+at the 32 level. The gate therefore asserts nothing it can reach, so it is
72+`#[ignore]`d with the reason in the attribute — a gate that passes without ever
73+seeing its feature is worse than an absent one (class gate-blind-to-feature).
74+The refusal `"a 32x32 partition type this decoder does not code (value={part32})"`
75+is consequently LIFTED WITHOUT A PIXEL GATE, which is a violation of the
76+COMMON charter's "a refusal is lifted only together with a gate" rule, stated
77+here rather than papered over.
78+
79+## EVIDENCE
80+
81+EVIDENCE: /tmp/claude-1000/-home-user-Documents-Code-Rust-edith-codecs/cdc46329-ebad-48bf-bcb8-fd704bf020f7/scratchpad/reelb5.obu (11553802 bytes) | `decode_probe` on 86226fe | REFUSED: "a 32x32-level 1:4 strip with a split transform (per-unit 4:1 prediction is not ported)" — the film advanced PAST `value=8` into the new arm, so the arm's mode read, tx-size read and dispatch execute on real 10-bit content
82+EVIDENCE: same path/reelc5.obu (1175978 bytes) | `decode_probe` on 86226fe | REFUSED: "a coded HORZ/VERT strip whose chroma transform has no rect coefficient tables here" — unchanged by this lane, a different shape's gap
83+EVIDENCE: terminal, `cargo test -p ec-av1 --lib -- refusal_inventory gate_coverage the_rect4_scans superblock_level split_transform_horz_vert` with EC_AV1_REQUIRE_AOMENC=1 on 86226fe | 13 passed, 0 failed, 1 ignored (108.6s) — every sibling gate of the cherry-picked `base_ctx` rule is green, incl. both SB HORZ/VERT gates and r4's split-transform SB gate
84+EVIDENCE: terminal | `cargo test -p ec-av1 --lib -- the_rect4_scans_are_transposed_pairs` | ok — `SCAN_4X16` is the exact transpose of `SCAN_16X4` and both are permutations; the same relation holds for `SCAN_32X8`/`SCAN_8X32`
85+EVIDENCE: $HOME/.cache/tx64-suite-r3.log | full `cargo test -p ec-av1 --lib` on 86226fe | INCOMPLETE — the run was cut at 600 s by this agent's own shell cap; **0 FAILED lines** in the ~200 tests that reported before the cut. Full totals are OWED.
86+
87+## Open, with dispositions
88+
89+- **fix-now (next round, the whole point of the lane)**: a fixture recipe that
90+ makes aomenc emit a 32-level 1:4 partition, then un-ignore the gate. Do NOT
91+ weaken the asserts. Suggestion not yet tried: real content — cut a 64x64 crop
92+ out of the 2160p extract itself and re-encode it, or drive `--sb-size=64
93+ --max-partition-size=32` over `testsrc2`/`mandelbrot` rather than `gradients`.
94+- **fix-now (next refusal on the film's path)**: `tx_depth != 0` on a 32-level
95+ 1:4 strip. `depth_to_tx_size` of a 4:1 strip is not `bw.min(bh) >> (depth-1)`,
96+ so `decode_rect_split`'s per-unit walk cannot be reused unexamined — that is
97+ exactly where the 2160p extract now stops.
98+- **deferred(the gate above)**: the 10-bit arm of the new gate, and therefore
99+ the `enable-1to4-partitions` entry in `NEVER_EXERCISED_10BIT`, which stays.
100+- **accepted**: the coarse (16-px) mode/side neighbour arrays cannot name an
101+ 8-px-tall strip; each strip stamps every cell it touches and the last one
102+ wins, which is right for the block below/right of the 32x32 (the only reader
103+ outside it) and is the pre-existing limitation every rect path here shares.
104+- **owed**: full-suite totals (see the EVIDENCE line).
lanes/tx64x16-r4.handoff.mdadded+70 -0
@@ -0,0 +1,70 @@
1+# lane-tx64x16 r4 handoff (tool-call cap)
2+
3+Branch `lane-tx64x16`, tip `82a486c` (on top of r3's `9e5c27d`):
4+- `774e175` — the gate un-ignored + the fixture that fires.
5+- `82a486c` — refusal message carries the tx depth, `lanes/tx64x16-r4.report.md`.
6+
7+## The fixture that fires (TASK 1, done)
8+
9+`gradients` never wins a 32-level 1:4 shape. 8-pixel BANDS do — a 32x8 strip is
10+flat, a 32x16 one straddles two bands:
11+
12+ color=c=gray:s=192x128:d=0.04:r=25,format=gray,
13+ geq=lum='mod(floor(Y/8)*STEP,256)',noise=alls=N:all_seed=SEED,format=yuv420p
14+
15+`X` instead of `Y` gives VERT_4. The `noise` layer is REQUIRED: without it the
16+flat bands trip the screen-content refusal. aomenc recipe = the gate's r3 one
17+(`--enable-1to4-partitions=1 --enable-rect-partitions=1 --enable-ab-partitions=0
18+--min-partition-size=8 --max-partition-size=32 --sb-size=64 --cpu-used=0`), cq
19+32/45, no repeated flags.
20+
21+Per-attempt counts (`decode_probe` now prints `rect4_32: horz/vert/coded`;
22+`stream::rect4_32_counters()`), 192x128, one frame:
23+
24+| source | cq | depth | horz_4 | vert_4 | coded | decode |
25+|---|---|---|---|---|---|---|
26+| bands Y, noise 6, seed 42 | 32 | 8-bit | 16 | 0 | 16 | OK |
27+| bands Y, noise 6, seed 42 | 32 | 10-bit | 16 | 0 | 16 | OK |
28+| bands X, noise 6, seed 42 | 32 | 8-bit | 0 | 24 | 24 | OK |
29+| bands X, noise 6, seed 42 | 32/45/55 | 10-bit | 0 | 24 | 24 | OK |
30+| bands Y, noise 14, seed 7 | 45/55 | 8+10-bit | 16 | 0 | 16 | OK |
31+
32+Determinism (charter: hash twice): bands Y / noise 6 / seed 42 / cq32 / 8-bit
33+y4m sha256 `a1412882a9d79befe98a039a83081a47276aa38c7814ae4de8a83c520bab9fea`
34+twice; aomenc obu sha256
35+`47509854c7e9142c3268b48de9b84e1cee0c58d8b87fd382f05de748593bd6f9` twice.
36+Fully synthetic — NO film file and no `fixtures/` entry is needed at test time.
37+
38+## The gate (TASK 2, done)
39+
40+`stream.rs:13161 a_real_aomenc_stream_with_a_32x32_level_1to4_partition_decodes_pixel_exact`
41+is UN-IGNORED, asserts unchanged. Result (`cargo test -p ec-av1 --lib -- <name>
42+--nocapture`, EC_AV1_REQUIRE_AOMENC=1): **ok** —
43+8-bit 7/8 attempts pixel-exact, horz_4=64, vert_4=72, coded=136, 0 out of
44+scope, 0 mismatched, 1 named refusal; 10-bit 5/8 pixel-exact, 48/48/96, 0 out
45+of scope, 3 named refusals. `gate_coverage`: `enable-1to4-partitions` removed
46+from `NEVER_EXERCISED_10BIT`. r3's ungated lift of "a 32x32 partition type this
47+decoder does not code (value=8)" is now gated.
48+
49+## What is left
50+
51+1. TASK 3 (4:1 split transform) NOT started, deliberately: depth 1 =
52+ TX_16X8/TX_8X16 (rectangular unit, no `TxbSet::LumaRect16x8` on this branch —
53+ owed to the rectx merge); depth 2 = TX_8X8 square, but `decode_rect_split`
54+ addresses its block by coarse 16-px cell (`px = c * SUB`) and cannot name
55+ strips 1/3 of a 1:4 block — it needs an mi-granular `at`. The two depths
56+ INTERLEAVE (12/24 attempts stop at depth 1 first, 10/24 at depth 2), so a
57+ depth-2-only port cannot be gated. Fixture for that lane IS in hand: the band
58+ recipe above + `--enable-tx-size-search=1` at cq 12..28.
59+2. Full-suite totals: DONE, `$HOME/.cache/tx64-suite-r4.log` --
60+ `test result: ok. 298 passed; 0 failed; 26 ignored; 0 measured; 0 filtered
61+ out; finished in 770.45s`. Start such runs with `setsid -f`: a first attempt
62+ died at 296 ok / 0 failed when a foreground poll loop's SIGTERM reached its
63+ process group.
64+3. Films on this tip: hg (2160p 10-bit extract) → "a 32x32-level 1:4 strip with
65+ a split transform (... depth=2)"; reelc (1080p extract) → "a coded HORZ/VERT
66+ strip whose chroma transform has no rect coefficient tables here"
67+ (unchanged).
68+4. Separate capability, out of this lane: the INTER 32x32 dispatch
69+ (`decode.rs:16720`) has NO 1:4 arm — re-encoded inter film crops refuse with
70+ "an INTER 32x32 partition type this decoder does not code (value=9)".
lanes/tx64x16-r4.report.mdadded+94 -0
@@ -0,0 +1,94 @@
1+# lane-tx64x16 r4 — the 32x32-level 1:4 gate fires, decodes pixel-exact, and is un-ignored
2+
3+Branch `lane-tx64x16`, commit `774e175` (+ this report's commit) on top of r3's
4+`9e5c27d`. Not rebased onto main (charter: "88100e5 merges separately; keep
5+committing on top").
6+
7+## TASK 1+2 — DONE: the fixture r3 could not find, and the gate un-ignored
8+
9+`gradients` never wins a 32-level 1:4 shape. **8-pixel BANDS do**: each 32x8
10+strip is flat, a 32x16 one straddles two bands, so aomenc's RD picks
11+`PARTITION_HORZ_4` over HORZ and SPLIT; a `noise` layer with an explicit seed is
12+what keeps flat bands out of screen-content mode (without it, the
13+screen-content refusal eats the attempt).
14+
15+ color=c=gray:s=192x128:d=..:r=25,format=gray,
16+ geq=lum='mod(floor(Y/8)*STEP,256)',noise=alls=N:all_seed=SEED,format=yuv420p
17+
18+Odd attempts use `X` in place of `Y` (VERT_4) — the transposed-pair discipline,
19+the only way a transposed scan table is caught (class scan-weights-cross-axis).
20+
21+- `crates/ec-av1/src/stream.rs:13161` — `#[ignore]` REMOVED from
22+ `a_real_aomenc_stream_with_a_32x32_level_1to4_partition_decodes_pixel_exact`;
23+ asserts unchanged (per-depth `horz_proved>0 && vert_proved>0`,
24+ `coeff_proved>0`, every successful decode pixel-compared, refusals must name
25+ "unsupported"). Only the SOURCE and a per-attempt `--cq-level` (32/45)
26+ changed; attempts default 20 -> 8 (8 encodes/depth at `--cpu-used=0`).
27+- `crates/ec-av1/src/gate_coverage.rs` — `enable-1to4-partitions` LEAVES
28+ `NEVER_EXERCISED_10BIT`: the gate's 10-bit arm passes `=1` and asserts both
29+ orientations plus coded strips inside pixel-exact attempts.
30+- `crates/ec-av1/src/stream.rs:76` — `pub fn rect4_32_counters()`, and
31+ `crates/ec-av1/examples/decode_probe.rs` prints `rect4_32: horz=.. vert=..
32+ coded=..` on every run (refusal included). That is the instrument the fixture
33+ search was measured with, not reasoned about.
34+
35+r3's refusal lift ("a 32x32 partition type this decoder does not code
36+(value=8)") is therefore no longer a lift-without-a-gate.
37+
38+Flag-order note (coordinator correction, aomenc keeps the LAST repeated
39+`--enable-*`): neither the gate recipe nor any search recipe here repeats a
40+flag — each appears exactly once. Arrival is proven by counters, not by
41+argument order: a nonzero `rect4_32` horz/vert count is only possible if
42+`--enable-1to4-partitions=1` AND `--max-partition-size=32` arrived.
43+
44+## TASK 3 — NOT DONE, and why (measured, not assumed)
45+
46+The film's next stop is `tx_depth != 0` on a 4:1 strip. Two units, not one:
47+
48+| depth | 32x8 unit | shape | portable with what is on this branch |
49+|---|---|---|---|
50+| 1 | `sub_tx_size_map[TX_32X8] = TX_16X8` | RECTANGULAR | NO — there is no `TxbSet::LumaRect16x8` here (only `LumaRect32x8`, `LumaRect32x16`, `ChromaRect16x8`, `ChromaRect32x16`); owed to the rectx merge |
51+| 2 | `sub_tx_size_map[TX_16X8] = TX_8X8` | square | the shape `decode_rect_split` walks — but `decode_rect_split` addresses its block by COARSE 16-px cell (`at`, `px = c * SUB`, `around_rect`, `record_split_luma_rect`), which cannot name strips 1 and 3 of a 32-level 1:4 block (8-px offsets). That is the same reason `decode_block_rect4` exists; wiring it needs an mi-granular `decode_rect_split`. |
52+
53+`bsize_to_max_depth` = 2 for the 4:1 shapes (`MAX_TX_DEPTH`), and the depth
54+symbol is `tx_size_cat2` (chain TX_32X8 -> TX_16X8 -> TX_8X8 -> TX_4X4, three
55+steps, cat 2) — the existing read is right.
56+
57+Both depths fire in real streams and are INTERLEAVED, so a depth-2-only port
58+cannot be gated on a stream chosen at random: 12 of 24 measured attempts stop
59+at depth 1 first, 10 at depth 2. Half-porting it would have re-created exactly
60+r3's ungated-lift defect, so nothing was changed in the decode path except the
61+refusal message, which now carries the depth:
62+
63+ "a 32x32-level 1:4 strip with a split transform (per-unit 4:1 prediction is
64+ not ported, depth={depth})"
65+
66+(`decode.rs:4958`, `refusal_inventory.rs:46` updated in the same commit.)
67+
68+The FIXTURE for that lane exists and is recorded here, which is the part r3
69+lacked: the same band recipe with `--enable-tx-size-search=1` at `--cq-level`
70+12..28 hits depth 1 and depth 2 at both bit depths (table below).
71+
72+## EVIDENCE
73+
74+EVIDENCE: terminal, `cargo test -p ec-av1 --lib -- a_real_aomenc_stream_with_a_32x32_level_1to4_partition_decodes_pixel_exact --nocapture` (EC_AV1_REQUIRE_AOMENC=1, commit 774e175) | 8 attempts x 2 depths | **ok**: 8-bit 7/8 pixel-exact, horz_4 strips=64, vert_4 strips=72, coded strips=136, 0 attempts out of scope, 0 mismatched, 1 named refusal; 10-bit 5/8 pixel-exact, 48 / 48 / 96, 0 out of scope, 3 named refusals
75+EVIDENCE: scratchpad d1.obu/d2.obu | same recipe encoded twice (bands, seed 42, cq32, 8-bit) | y4m sha256 `a1412882a9d79bef...` twice, obu sha256 `47509854c7e9142c...` twice — the fixture is deterministic, no film file needed at test time (no `fixtures/` addition)
76+EVIDENCE: scratchpad search.sh/search2.sh over reelb5.obu crops (256x256 at 5 positions, cq 20/32/45, 8- and 10-bit, key-frame and 8-frame arms) | decode_probe counters | 0 32-level 1:4 blocks in every INTRA crop; the one inter arm that reached the 32 level refused with "an INTER 32x32 partition type this decoder does not code (value=9)" — the inter 32x32 dispatch (`decode.rs:16720`) has NO 1:4 arm at all, a separate unported capability
77+EVIDENCE: scratchpad s4.sh (bands + `--enable-tx-size-search=1`, cq 12/20/28, 8- and 10-bit, 4 generators) | temporary `RECT4DEPTH` print at `decode.rs:4958` | 22 of 24 attempts reach a split 4:1 strip: depth 1 in 12 (bw=32/bh=8 and bw=8/bh=32), depth 2 in 10 — Task 3's gate fixture is in hand
78+EVIDENCE: `.../cdc46329-.../scratchpad/reelb5.obu` | `decode_probe` on 774e175 | REFUSED "a 32x32-level 1:4 strip with a split transform (... depth=2)" — the film advances past r3's arm and stops at depth 2 of a 32x8 strip
79+EVIDENCE: $HOME/.cache/tx64-suite-r4.log | full `cargo test -p ec-av1 --lib` on this branch (started with `setsid -f`, EC_AV1_REQUIRE_AOMENC=1) | **test result: ok. 298 passed; 0 failed; 26 ignored; 0 measured; 0 filtered out; finished in 770.45s** -- one ignored test fewer than r3, this lane's 32-level 1:4 gate
80+EVIDENCE: reelc5.obu | `decode_probe` on this branch | REFUSED "a coded HORZ/VERT strip whose chroma transform has no rect coefficient tables here" -- unchanged by this lane, a different shape's gap (the same string r3 reported)
81+
82+## Open, with dispositions
83+
84+- **fix-now (next round)**: split transform on a 4:1 strip. Needs (a)
85+ `TxbSet::LumaRect16x8`/`8x16` (or the rectx merge, which may already carry
86+ them) for depth 1, (b) an mi-granular `decode_rect_split` (take `mi` instead
87+ of the coarse cell `at`; `px = mi_c * MI`) for depth 2, (c) the gate arm
88+ `--enable-tx-size-search=1` on the band fixture above, asserting a new
89+ split-strip counter inside pixel-exact attempts.
90+- **deferred(a separate lane)**: the INTER 32x32 1:4 dispatch (`value=8/9` at
91+ `decode.rs:16720`). Only the INTRA 32-level pair is ported; inter 32x8 strips
92+ need `decode_inter_block` at 4:1, a different port.
93+- **accepted**: coarse (16-px) mode/side arrays cannot name an 8-px strip;
94+ last-strip-wins, unchanged from r3.
lanes/tx64x16-r5.report.mdadded+79 -0
@@ -0,0 +1,79 @@
1+# lane-tx64x16 r5 — the seed-47 "desync" is not a desync
2+
3+## 1. Seed 47 refusal: genuine, pre-existing on main, and the flag that was
4+## supposed to prevent it is inert
5+
6+Pinned stream: regenerated from the gate recipe (8-bit, seed 47 = attempt 5:
7+axis X, step 91, noise 9, cq 32), `sha256 51c0a8c16b2c339cbf042cd60bcf835075ff1dca4ce37362ee5fb63a23b5ffb5`
8+— identical to the sha in the r4 verifier report, so the fixture is reproducible.
9+
10+Range ladder, ours (`EC_AV1_TRACE=1 decode_probe`) vs instrumented aomdec (`EC_TRACE=1`),
11+from the first block of the first tile:
12+
13+| element | aomdec | ours |
14+|---|---|---|
15+| partition bsize=12 (64x64) mi 0,0 | value=3 (SPLIT), rng in 32768 | value=3 |
16+| partition bsize=9 (32x32) mi 0,0 | value=3 (SPLIT), rng in 51744 | value=3, rng out 56592 |
17+| partition bsize=6 (16x16) mi 0,0 | ctx=4, rng in **56592**, value=**6 (PARTITION_VERT_A)** | ctx=0 (per-width table), value=**6** |
18+
19+Our range entering the 16x16 partition symbol equals aomdec's (56592) and we decode the
20+same value. There is NO divergent element: the stream really contains a `PARTITION_VERT_A`
21+at 16x16, which this decoder does not code. The refusal is truthful, not the
22+`refusal-from-own-desync` class.
23+
24+`--enable-ab-partitions=0` does not suppress it: encoding the same y4m with `=0` and `=1`
25+(everything else identical) gives **byte-identical output**, md5 `ef8c8be0664b…` both ways —
26+the knob never reached the tool (class knob-never-reached-the-tool). aomdec's partition
27+histogram for that stream: `bsize=6 value=6` ×1 (the VERT_A), `bsize=9 value=9` ×4 (this
28+lane's VERT_4), rest NONE/VERT/SPLIT.
29+
30+Main `df5d630` refuses the same stream with the same message (built from a detached
31+scratch worktree, own CARGO_TARGET_DIR, removed after) — **this lane did not introduce it**.
32+
33+Disposition: **deferred(16x16 HORZ_A/HORZ_B/VERT_A decode — lane-ab16's cluster, not this
34+lane's shape)**. Making seed 47 decode pixel-exact requires implementing AB partitions at
35+16x16, which is a different refusal and a different lane. The gate counts it as a named
36+refusal and still proves its own shape on the other attempts.
37+
38+EVIDENCE: /tmp/.../scratchpad/s47.obu (sha256 51c0a8c1…) | EC_TRACE=1 aomdec vs EC_AV1_TRACE=1 decode_probe, element-by-element from block 0 | ranges equal at 56592, both read partition value 6 (VERT_A) at bsize=6; ab-partitions=0 vs =1 md5-identical; main df5d630 refuses identically
39+
40+## 2. Gate hardening (class gate-skips-on-its-own-failure)
41+
42+`crates/ec-av1/src/stream.rs` — both 1:4 gates (superblock-level and the 32x32-level one)
43+now `assert_eq!(out_of_scope_mismatch, 0, ...)`: an attempt that decoded but carried none of
44+this gate's blocks and still mismatched ffmpeg is a failure, no longer a printed number.
45+Counters and the per-attempt message are kept.
46+
47+## 3. `rect4_32_counters` no longer inside `decode_stream`'s doc comment
48+
49+`crates/ec-av1/src/stream.rs` — the getter had been spliced between the `# Errors` section
50+and `pub fn decode_stream`, silently eating half of `decode_stream`'s documentation. Moved
51+above the doc block; `decode_stream`'s docs are whole again.
52+Deviation from the charter: it stays `pub`, not `pub(crate)` — `examples/decode_probe.rs:32`
53+calls `ec_av1::stream::rect4_32_counters()` from outside the crate (that is why it was made
54+`pub` in r4); `pub(crate)` would break the probe, which is a first-class instrument here.
55+
56+## 4. Gate + suite results
57+
58+Gate (`cargo test -p ec-av1 --lib 32x32_level_1to4 -- --nocapture`, EC_AV1_REQUIRE_AOMENC=1): **ok**
59+- 8-bit: 7/8 pixel-exact, 1 named refusal (seed 47, the 16x16 VERT_A above), horz_4=64, vert_4=72, coded strips=136, 0 out-of-scope.
60+- 10-bit: 5/8 pixel-exact, 3 named refusals (seed 47 same VERT_A; seeds 43/46 "a coded (non-skip) HORZ/VERT rect strip below 16x16" — rect partitions ARE enabled by the recipe, lane-tx4x8's refusal), horz_4=48, vert_4=48, coded strips=96, 0 out-of-scope.
61+
62+EVIDENCE: $HOME/.cache/tx64-suite-r5.log + gate stdout above | cargo test 32x32_level_1to4 --nocapture, both bit depths, 8 attempts each | 12/16 attempts pixel-exact vs ffmpeg, 4 named refusals, 0 out-of-scope mismatches, 328 1:4 strips proved
63+
64+Siblings, from the same suite log, all **ok**: `a_real_aomenc_stream_with_a_superblock_level_ab_partition_decodes_pixel_exact`,
65+`..._split_transform_horz_vert_strip...`, `..._split_transform_superblock_strip...`, all five
66+`gate_coverage::tests::*`, all three `refusal_inventory::tests::*`.
67+(`..._superblock_level_horz_vert_partition_and_delta_q...` is the pre-existing `ignored` from lane-rect64q.)
68+
69+Full suite (systemd user unit `tx64-suite-1788308735`, log `$HOME/.cache/tx64-suite-r5.log`):
70+**test result: ok. 298 passed; 0 failed; 26 ignored; 0 measured; finished in 216.23s** — same
71+totals as r4.
72+
73+## Residue
74+
75+- fix-now: none in this lane.
76+- deferred(lane-ab16 lifting HORZ_A/HORZ_B/VERT_A at 16x16): seed 47 cannot decode until that shape
77+ is coded; it is a genuine capability gap, present on main df5d630, not a defect this lane created.
78+- accepted: `--enable-ab-partitions=0` is inert on this recipe (md5-identical output); the gate
79+ therefore tolerates the 16x16 AB refusal rather than pretending the flag suppresses it.