diff --git a/crates/ec-av1/examples/decode_probe.rs b/crates/ec-av1/examples/decode_probe.rs index c31508f4..2b644c65 100644 --- a/crates/ec-av1/examples/decode_probe.rs +++ b/crates/ec-av1/examples/decode_probe.rs @@ -35,6 +35,8 @@ fn main() { println!("rect4_32: horz={h} vert={v} coded={c}"); let (rtu, rsplit, robmc) = ec_av1::stream::rect_inter_tu_counters(); println!("rect_inter: tu={rtu} txsplit={rsplit} obmc_leaf={robmc}"); + let leaf = ec_av1::stream::vartx_rect_leaf_hits(); + println!("vartx_rect_leaf: 32x16={} 16x32={}", leaf[0], leaf[1]); let ir = ec_av1::stream::inter_rect_counters(); println!( "inter_rect: 32x8={} 8x32={} 64x32={} 32x64={} 64x16={} 16x64={}", diff --git a/crates/ec-av1/src/decode.rs b/crates/ec-av1/src/decode.rs index d5bbfada..4670b823 100644 --- a/crates/ec-av1/src/decode.rs +++ b/crates/ec-av1/src/decode.rs @@ -997,6 +997,8 @@ thread_local! { // (64x32/32x64/64x16/16x64), whose coefficients are coded as the // truncated low-32 corner. static RECT64_INTER_TU_HITS: std::cell::Cell = const { std::cell::Cell::new(0) }; + // lane-r14 r3: rectangular var-tx LEAVES, [32x16, 16x32]. + static VARTX_RECT_LEAF_HITS: std::cell::Cell<[usize; 2]> = const { std::cell::Cell::new([0; 2]) }; // lane-inter4 r3: 16x16-level PARTITION_HORZ / PARTITION_VERT on an inter // frame -- 16x8 and 8x16 inter leaves. static INTER_LEAF16_HORZ_HITS: std::cell::Cell = const { std::cell::Cell::new(0) }; @@ -1049,6 +1051,21 @@ pub(crate) fn rect64_inter_tu_hits() -> usize { RECT64_INTER_TU_HITS.with(|c| c.get()) } +/// Current value of [`VARTX_RECT_LEAF_HITS`] (lane-r14 r3): how many +/// rectangular var-tx leaf transform units were coded, `[32x16, 16x32]`. +pub(crate) fn vartx_rect_leaf_hits() -> [usize; 2] { + VARTX_RECT_LEAF_HITS.with(|c| c.get()) +} + +/// Records one rectangular var-tx leaf. +fn vartx_rect_leaf_hit(tw: usize, th: usize) { + VARTX_RECT_LEAF_HITS.with(|c| { + let mut h = c.get(); + h[usize::from(th > tw)] += 1; + c.set(h); + }); +} + /// Sets the current thread's [`TX_SELECT_INTER`]/[`REDUCED_TX_SET_INTER`]/ /// [`ENABLE_FILTER_INTRA_INTER`]. pub(crate) fn set_inter_tx_mode( @@ -11417,6 +11434,46 @@ const TXFM_CTX_INIT: u8 = 64; /// twice below its own largest transform. const MAX_VARTX_DEPTH: usize = 2; +/// libaom `sub_tx_size_map[TX_SIZES_ALL]` (`common_data.c`): the transform +/// one `txfm_split` step below `tx_size`. RECTANGULAR for the 1:4 shapes +/// (`[TX_64X16] == TX_32X16`, `[TX_16X64] == TX_16X32`) and for the 4:1 +/// small ones, square everywhere else. +fn sub_tx_size_map(tx_w: usize, tx_h: usize) -> (usize, usize) { + match (tx_w, tx_h) { + (4, 4) => (4, 4), + (8, 8) => (4, 4), + (16, 16) => (8, 8), + (32, 32) => (16, 16), + (64, 64) => (32, 32), + (4, 8) | (8, 4) => (4, 4), + (8, 16) | (16, 8) => (8, 8), + (16, 32) | (32, 16) => (16, 16), + (32, 64) | (64, 32) => (32, 32), + (4, 16) => (4, 8), + (16, 4) => (8, 4), + (8, 32) => (8, 16), + (32, 8) => (16, 8), + (16, 64) => (16, 32), + (64, 16) => (32, 16), + _ => unreachable!("not a TX_SIZES_ALL shape: {tx_w}x{tx_h}"), + } +} + +#[test] +fn sub_tx_size_map_matches_libaom() { + // libaom `common_data.c` `sub_tx_size_map`, in TX_SIZES_ALL order. + const TABLE: [((usize, usize), (usize, usize)); 19] = [ + ((4, 4), (4, 4)), ((8, 8), (4, 4)), ((16, 16), (8, 8)), ((32, 32), (16, 16)), + ((64, 64), (32, 32)), ((4, 8), (4, 4)), ((8, 4), (4, 4)), ((8, 16), (8, 8)), + ((16, 8), (8, 8)), ((16, 32), (16, 16)), ((32, 16), (16, 16)), ((32, 64), (32, 32)), + ((64, 32), (32, 32)), ((4, 16), (4, 8)), ((16, 4), (8, 4)), ((8, 32), (8, 16)), + ((32, 8), (16, 8)), ((16, 64), (16, 32)), ((64, 16), (32, 16)), + ]; + for (tx, want) in TABLE { + assert_eq!(sub_tx_size_map(tx.0, tx.1), want, "sub_tx_size_map({tx:?})"); + } +} + /// `read_var_tx_size` (spec 5.11.17, libaom `decodeframe.c` /// `read_tx_size_vartx`): the recursive `txfm_split` tree of one /// max-transform-sized unit of an inter block, collecting the resolved leaf @@ -11433,22 +11490,28 @@ fn read_var_tx_size( at_mi: (usize, usize), blk_max_px: usize, (max_w_mi, max_h_mi): (usize, usize), - tx_px: usize, + (tx_w, tx_h): (usize, usize), depth: usize, blk_row: usize, blk_col: usize, - out: &mut Vec<(usize, usize, usize)>, + out: &mut Vec<(usize, usize, usize, usize)>, ) { if blk_row >= max_h_mi || blk_col >= max_w_mi { return; } let unit = (at_mi.0 + blk_row, at_mi.1 + blk_col); if depth == MAX_VARTX_DEPTH { - out.push((blk_row, blk_col, tx_px)); - txfm_partition_update(n, unit, tx_px, tx_px); + out.push((blk_row, blk_col, tx_w, tx_h)); + txfm_partition_update_rect(n, unit, (tx_w, tx_h), (tx_w, tx_h)); return; } - let ctx = txfm_partition_ctx(n.above_txfm[unit.1], n.left_txfm[unit.0], blk_max_px, tx_px); + let ctx = txfm_partition_ctx_rect( + n.above_txfm[unit.1], + n.left_txfm[unit.0], + blk_max_px, + tx_w, + tx_h, + ); let split = dec.symbol(&mut cdfs.txfm_partition[ctx]) == 1; TXFM_SPLIT_READS.with(|c| c.set(c.get() + 1)); if std::env::var_os("EC_TRACE_MODE_STEP").is_some() { @@ -11461,27 +11524,27 @@ fn read_var_tx_size( ); } if !split { - out.push((blk_row, blk_col, tx_px)); - txfm_partition_update(n, unit, tx_px, tx_px); + out.push((blk_row, blk_col, tx_w, tx_h)); + txfm_partition_update_rect(n, unit, (tx_w, tx_h), (tx_w, tx_h)); return; } TXFM_SPLIT_HITS.with(|c| c.set(c.get() + 1)); - let sub = tx_px / 2; - if sub == 4 { - // libaom's `sub_txs == TX_4X4` early return: the whole 8x8 unit is - // marked 4x4 (four transform units, raster order) without recursing. - for row in 0..2 { - for col in 0..2 { + let (sub_w, sub_h) = sub_tx_size_map(tx_w, tx_h); + if (sub_w, sub_h) == (4, 4) { + // libaom's `sub_txs == TX_4X4` early return: every mi cell of the + // unit is marked 4x4 (raster order) without recursing. + for row in 0..tx_h / MI { + for col in 0..tx_w / MI { if blk_row + row < max_h_mi && blk_col + col < max_w_mi { - out.push((blk_row + row, blk_col + col, 4)); + out.push((blk_row + row, blk_col + col, 4, 4)); } } } - txfm_partition_update(n, unit, 4, tx_px); + txfm_partition_update_rect(n, unit, (4, 4), (tx_w, tx_h)); return; } - for row in (0..tx_px / MI).step_by(sub / MI) { - for col in (0..tx_px / MI).step_by(sub / MI) { + for row in (0..tx_h / MI).step_by(sub_h / MI) { + for col in (0..tx_w / MI).step_by(sub_w / MI) { read_var_tx_size( dec, cdfs, @@ -11489,7 +11552,7 @@ fn read_var_tx_size( at_mi, blk_max_px, (max_w_mi, max_h_mi), - sub, + (sub_w, sub_h), depth + 1, blk_row + row, blk_col + col, @@ -11517,7 +11580,7 @@ fn read_block_tx_size( (mi_cols, mi_rows): (usize, usize), is_inter: bool, skip: bool, -) -> Result<(usize, Option>)> { +) -> Result<(usize, Option>)> { if !TX_SELECT_INTER.with(std::cell::Cell::get) { return Ok((side, None)); } @@ -11537,7 +11600,7 @@ fn read_block_tx_size( at_mi, side, (max_w_mi, max_h_mi), - max_tx, + (max_tx, max_tx), 0, row, col, @@ -11545,8 +11608,8 @@ fn read_block_tx_size( ); } } - let single = leaves.len() == 1 && leaves[0].2 == side; - if !single && leaves.iter().any(|leaf| leaf.2 > 32) { + let single = leaves.len() == 1 && leaves[0].2 == side && leaves[0].3 == side; + if !single && leaves.iter().any(|leaf| leaf.2.max(leaf.3) > 32) { // Only a block wider than a superblock's own 64x64 max transform // reaches here; this crate has no 64-point *inter* coefficient // table set ([`inter_txbset_for`] stops at 32). @@ -11584,7 +11647,7 @@ fn read_block_tx_size( let mut leaves = Vec::new(); for row in (0..side_mi).step_by(step) { for col in (0..side_mi).step_by(step) { - leaves.push((row, col, tx)); + leaves.push((row, col, tx, tx)); } } INTRA_IN_INTER_SPLIT_TX_HITS.with(|c| { @@ -11736,7 +11799,7 @@ fn read_block_tx_size_rect( (bw, bh): (usize, usize), (mi_cols, mi_rows): (usize, usize), skip: bool, -) -> Result>> { +) -> Result>> { if skip { // `set_txfm_ctxs(.., skip && is_inter)`: a skipped inter block records // its own BLOCK size -- width above, height left -- not a transform. @@ -11779,22 +11842,16 @@ fn read_block_tx_size_rect( } TXFM_SPLIT_HITS.with(|c| c.set(c.get() + 1)); RECT_INTER_TXSPLIT_HITS.with(|c| c.set(c.get() + 1)); - // lane-r14 r2: `sub_tx_size_map` is square for every shape this decoder - // splits (TX_32X16 -> TX_16X16, TX_64X32 -> TX_32X32) EXCEPT the 1:4 - // strips with a 64-px axis, where it stays rectangular - // (TX_64X16 -> TX_32X16, TX_16X64 -> TX_16X32) and the square recursion - // below would code the wrong tree. - if tx_w.max(tx_h) == 64 && tx_w.min(tx_h) == 16 { - return Err(unsupported( - "a split transform on a 1:4 inter strip with a 64-px axis", - )); - } - let sub = tx_w.min(tx_h); + // lane-r14 r3: `sub_tx_size_map` (libaom `common_data.c`) stays + // RECTANGULAR under a 1:4 strip -- `[TX_64X16] == TX_32X16`, + // `[TX_16X64] == TX_16X32` -- so the recursion below is the general + // rect one and its leaves carry their own width and height. + let (sub_w, sub_h) = sub_tx_size_map(tx_w, tx_h); let max_w_mi = (bw / MI).min(mi_cols.saturating_sub(at_mi.1)); let max_h_mi = (bh / MI).min(mi_rows.saturating_sub(at_mi.0)); let mut leaves = Vec::new(); - for row in (0..bh / MI).step_by(sub / MI) { - for col in (0..bw / MI).step_by(sub / MI) { + for row in (0..bh / MI).step_by(sub_h / MI) { + for col in (0..bw / MI).step_by(sub_w / MI) { read_var_tx_size( dec, cdfs, @@ -11802,7 +11859,7 @@ fn read_block_tx_size_rect( at_mi, bw.max(bh), (max_w_mi, max_h_mi), - sub, + (sub_w, sub_h), 1, row, col, @@ -11839,9 +11896,12 @@ fn read_inter_plane_rect( y: usize, prediction: &[u16], inherited_luma_tx_type: Option, + luma_skip_ctx: Option, ) -> Result<(Vec, TxType)> { let skip_ctx = if plane_idx == 0 { - 0 + // `get_txb_ctx_general`: 0 only when this unit IS the whole plane + // block; a var-tx leaf passes its own neighbour-table context. + luma_skip_ctx.unwrap_or(0) } else { usize::from(around.0) + usize::from(around.1) }; @@ -16458,7 +16518,7 @@ fn decode_inter_block( // 5.11.17), `Some` only when this block's var-tx tree resolved to more // than one luma transform -- read back by the residual loop, the // coefficient-context write-back and the loop-filter grid fill below. - let mut vartx_leaves: Option> = None; + let mut vartx_leaves: Option> = None; let at_mi = at; if is_inter { let above_nbr = has_above.then(|| NeighbourRef { @@ -17313,37 +17373,68 @@ fn decode_inter_block( // own slice of the block's motion-compensated predictor. let reduced = REDUCED_TX_SET_INTER.with(std::cell::Cell::get); let mut first_tx_type = TxType::DctDct; - for (idx, &(row, col, tx_px)) in leaves.iter().enumerate() { + for (idx, &(row, col, tw, th)) in leaves.iter().enumerate() { let tu_mi = (at_mi.0 + row, at_mi.1 + col); let (tu_px, tu_py) = (px + col * MI, py + row * MI); - let mut tu_pred = Vec::with_capacity(tx_px * tx_px); - for rr in 0..tx_px { - let start = (row * MI + rr) * side + col * MI; - tu_pred.extend_from_slice(&pred_y[start..start + tx_px]); - } - let scan = default_scan(tx_px); - let tu_skip_ctx = neighbours.luma_skip_ctx(tu_mi, tx_px / MI); - let (tu_grid, tu_tx_type) = read_inter_plane( - dec, - cdfs, - inter_txbset_for(tx_px, reduced), - &scan, - 0, - neighbours.around_mi(tu_mi, tx_px)[0], - mode_for_tx, - y, - tu_px, - tu_py, - tx_px, - base_q_idx, - &tu_pred, - None, - Some(tu_skip_ctx), - )?; + let (tu_grid, tu_tx_type) = if tw == th { + let tx_px = tw; + let mut tu_pred = Vec::with_capacity(tx_px * tx_px); + for rr in 0..tx_px { + let start = (row * MI + rr) * side + col * MI; + tu_pred.extend_from_slice(&pred_y[start..start + tx_px]); + } + let scan = default_scan(tx_px); + let tu_skip_ctx = neighbours.luma_skip_ctx(tu_mi, tx_px / MI); + read_inter_plane( + dec, + cdfs, + inter_txbset_for(tx_px, reduced), + &scan, + 0, + neighbours.around_mi(tu_mi, tx_px)[0], + mode_for_tx, + y, + tu_px, + tu_py, + tx_px, + base_q_idx, + &tu_pred, + None, + Some(tu_skip_ctx), + )? + } else { + // lane-r14 r3: a 1:4 strip's `sub_tx_size_map` + // sub-transform is RECTANGULAR (TX_64X16 -> + // TX_32X16, TX_16X64 -> TX_16X32), so this leaf is + // read with the rect coefficient machinery, at its + // own `txb_skip_ctx`/neighbour spans -- the unit is + // smaller than its block, so `get_txb_ctx_general`'s + // neighbour table applies, not the lone-TU 0. + vartx_rect_leaf_hit(tw, th); + let tu_skip_ctx = + neighbours.luma_skip_ctx_rect(tu_mi, tw / MI, th / MI); + let start = row * MI * side + col * MI; + read_inter_plane_rect( + dec, + cdfs, + rect_inter_luma_set(tw, th), + (tw, th), + side, + 0, + neighbours.around_mi_rect(tu_mi, tw, th)[0], + mode_for_tx, + y, + tu_px, + tu_py, + &pred_y[start..], + None, + Some(tu_skip_ctx), + )? + }; if idx == 0 { first_tx_type = tu_tx_type; } - neighbours.record_mi_luma(tu_mi, tx_px, &tu_grid); + neighbours.record_mi_luma_rect(tu_mi, tw, th, &tu_grid); } // `av1_get_tx_type`'s chroma lookup scales the chroma // position back to luma, so an inter block's chroma @@ -17367,6 +17458,7 @@ fn decode_inter_block( py, &pred_y, None, + None, )?; luma_tx_type = tx_type; luma_grid = embed_rect_grid(&grid, write_w, write_h, side); @@ -17410,6 +17502,7 @@ fn decode_inter_block( cpy, &pred_u, Some(luma_tx_type), + None, )? .0, uw, @@ -17431,6 +17524,7 @@ fn decode_inter_block( cpy, &pred_v, Some(luma_tx_type), + None, )? .0, uw, @@ -18291,37 +18385,68 @@ fn decode_inter_block( // own slice of the block's motion-compensated predictor. let reduced = REDUCED_TX_SET_INTER.with(std::cell::Cell::get); let mut first_tx_type = TxType::DctDct; - for (idx, &(row, col, tx_px)) in leaves.iter().enumerate() { + for (idx, &(row, col, tw, th)) in leaves.iter().enumerate() { let tu_mi = (at_mi.0 + row, at_mi.1 + col); let (tu_px, tu_py) = (px + col * MI, py + row * MI); - let mut tu_pred = Vec::with_capacity(tx_px * tx_px); - for rr in 0..tx_px { - let start = (row * MI + rr) * side + col * MI; - tu_pred.extend_from_slice(&pred_y[start..start + tx_px]); - } - let scan = default_scan(tx_px); - let tu_skip_ctx = neighbours.luma_skip_ctx(tu_mi, tx_px / MI); - let (tu_grid, tu_tx_type) = read_inter_plane( - dec, - cdfs, - inter_txbset_for(tx_px, reduced), - &scan, - 0, - neighbours.around_mi(tu_mi, tx_px)[0], - mode_for_tx, - y, - tu_px, - tu_py, - tx_px, - base_q_idx, - &tu_pred, - None, - Some(tu_skip_ctx), - )?; + let (tu_grid, tu_tx_type) = if tw == th { + let tx_px = tw; + let mut tu_pred = Vec::with_capacity(tx_px * tx_px); + for rr in 0..tx_px { + let start = (row * MI + rr) * side + col * MI; + tu_pred.extend_from_slice(&pred_y[start..start + tx_px]); + } + let scan = default_scan(tx_px); + let tu_skip_ctx = neighbours.luma_skip_ctx(tu_mi, tx_px / MI); + read_inter_plane( + dec, + cdfs, + inter_txbset_for(tx_px, reduced), + &scan, + 0, + neighbours.around_mi(tu_mi, tx_px)[0], + mode_for_tx, + y, + tu_px, + tu_py, + tx_px, + base_q_idx, + &tu_pred, + None, + Some(tu_skip_ctx), + )? + } else { + // lane-r14 r3: a 1:4 strip's `sub_tx_size_map` + // sub-transform is RECTANGULAR (TX_64X16 -> + // TX_32X16, TX_16X64 -> TX_16X32), so this leaf is + // read with the rect coefficient machinery, at its + // own `txb_skip_ctx`/neighbour spans -- the unit is + // smaller than its block, so `get_txb_ctx_general`'s + // neighbour table applies, not the lone-TU 0. + vartx_rect_leaf_hit(tw, th); + let tu_skip_ctx = + neighbours.luma_skip_ctx_rect(tu_mi, tw / MI, th / MI); + let start = row * MI * side + col * MI; + read_inter_plane_rect( + dec, + cdfs, + rect_inter_luma_set(tw, th), + (tw, th), + side, + 0, + neighbours.around_mi_rect(tu_mi, tw, th)[0], + mode_for_tx, + y, + tu_px, + tu_py, + &pred_y[start..], + None, + Some(tu_skip_ctx), + )? + }; if idx == 0 { first_tx_type = tu_tx_type; } - neighbours.record_mi_luma(tu_mi, tx_px, &tu_grid); + neighbours.record_mi_luma_rect(tu_mi, tw, th, &tu_grid); } // `av1_get_tx_type`'s chroma lookup scales the chroma // position back to luma, so an inter block's chroma @@ -18345,6 +18470,7 @@ fn decode_inter_block( py, &pred_y, None, + None, )?; luma_tx_type = tx_type; luma_grid = embed_rect_grid(&grid, write_w, write_h, side); @@ -18388,6 +18514,7 @@ fn decode_inter_block( cpy, &pred_u, Some(luma_tx_type), + None, )? .0, uw, @@ -18409,6 +18536,7 @@ fn decode_inter_block( cpy, &pred_v, Some(luma_tx_type), + None, )? .0, uw, @@ -18672,7 +18800,7 @@ fn decode_inter_block( let split_luma = vartx_leaves.is_some(); if let Some(leaves) = vartx_leaves.clone() { let reduced = REDUCED_TX_SET_INTER.with(std::cell::Cell::get); - for &(row, col, tx_px) in &leaves { + for &(row, col, tx_px, _) in &leaves { let tu_mi = (at_mi.0 + row, at_mi.1 + col); let (tu_px, tu_py) = (px + col * MI, py + row * MI); // A transform unit inside a block is not a block at that @@ -18914,13 +19042,13 @@ fn decode_inter_block( // units, not the block. Chroma still reads `tx_h_grid / 2` (the block's // uv transform is not split) -- a known corner-cut of this round. if let Some(leaves) = &vartx_leaves { - for &(row, col, tx_px) in leaves { + for &(row, col, tw, th) in leaves { neighbours.fill_lf_grid_rect( (at_mi.0 + row, at_mi.1 + col), - tx_px / MI, - tx_px / MI, - tx_px as u8, - tx_px as u8, + tw / MI, + th / MI, + tw as u8, + th as u8, if globalmv_for_lf { -ref_frame_for_lf } else { diff --git a/crates/ec-av1/src/gate_coverage.rs b/crates/ec-av1/src/gate_coverage.rs index 6ed4c60d..045549d7 100644 --- a/crates/ec-av1/src/gate_coverage.rs +++ b/crates/ec-av1/src/gate_coverage.rs @@ -175,10 +175,6 @@ const NEVER_EXERCISED_8BIT: &[(&str, &str)] = &[ "enable-rect-tx", "never spelled; rect transforms reach the decoder only through partition shape, never through a gate that names the tool", ), - ( - "enable-tx64", - "never spelled; TX_64X64 appears only where aomenc's default picks it, which is unknown per stream", - ), ]; #[cfg(test)] @@ -217,7 +213,6 @@ const NEVER_EXERCISED_10BIT: &[(&str, &str)] = &[ // lane-cwarp's 10-bit comp // 1D tx class). ("enable-intrabc", "hole at both depths, see the 8-bit list"), ("enable-rect-tx", "hole at both depths, see the 8-bit list"), - ("enable-tx64", "hole at both depths, see the 8-bit list"), ]; /// [`DEFAULT_ON_TOOLS`] entries no 8-bit gate spells on, with the reason. diff --git a/crates/ec-av1/src/refusal_inventory.rs b/crates/ec-av1/src/refusal_inventory.rs index 816153c7..51ea438a 100644 --- a/crates/ec-av1/src/refusal_inventory.rs +++ b/crates/ec-av1/src/refusal_inventory.rs @@ -84,10 +84,6 @@ const REFUSALS: &[&str] = &[ "warp prediction with a scaled reference (superres, unimplemented)", "an 8x8 partition leaf under a scaled reference (superres, unimplemented)", "a motion_mode symbol for a block shape with no CDF row here", - // lane-r14 r2: the whole-transform case of every 64-axis inter strip is - // coded; only the SPLIT of a 1:4 strip with a 64-px axis is left, whose - // `sub_tx_size_map` entry is rectangular (TX_64X16 -> TX_32X16). - "a split transform on a 1:4 inter strip with a 64-px axis", ]; /// Gates whose `Err` arm turns a decode failure into a printed SKIP rather than diff --git a/crates/ec-av1/src/stream.rs b/crates/ec-av1/src/stream.rs index fabe041a..dc1c73b2 100644 --- a/crates/ec-av1/src/stream.rs +++ b/crates/ec-av1/src/stream.rs @@ -74,6 +74,13 @@ pub fn rect64_inter_tu_hits() -> usize { crate::decode::rect64_inter_tu_hits() } +/// lane-r14 r3: RECTANGULAR var-tx leaf transform units, `[32x16, 16x32]` -- +/// the leaves `sub_tx_size_map` produces when a 1:4 strip with a 64-px axis +/// splits its transform (`[TX_64X16] == TX_32X16`, `[TX_16X64] == TX_16X32`). +pub fn vartx_rect_leaf_hits() -> [usize; 2] { + crate::decode::vartx_rect_leaf_hits() +} + pub fn rect4_32_counters() -> (usize, usize, usize) { ( crate::decode::rect4_32_horz_hits(), @@ -6782,6 +6789,240 @@ mod tests { } } + /// lane-r14 r3: a 1:4 inter strip with a 64-px axis (64x16 / 16x64) whose + /// transform SPLITS -- the arm r2 left refused by name ("a split transform + /// on a 1:4 inter strip with a 64-px axis"). libaom's + /// `sub_tx_size_map[TX_64X16] == TX_32X16` (and `[TX_16X64] == TX_16X32`) + /// keeps the sub-transform RECTANGULAR, so the var-tx tree's leaves are + /// 32x16/16x32 units read through [`TxbSet::LumaRect32x16Inter`], each with + /// its own `get_txb_ctx_general` neighbour context (the unit is smaller + /// than its block, so `txb_skip_ctx` is NOT the lone-TU 0). + /// + /// `--enable-1to4-partitions=1 --min-partition-size=16 + /// --max-partition-size=64 --enable-tx64=1` (each spelled once, last + /// occurrence wins) is what lets aomenc pick a superblock-level HORZ_4 / + /// VERT_4; the textured translating source is what keeps the strips + /// non-skip so the residual is actually coded. 8-bit AND 10-bit, every + /// decoded frame compared to ffmpeg on Y/U/V, refusals counted (never + /// SKIPped), attempts that carried no rectangular var-tx leaf counted + /// separately and still required pixel-exact. + #[test] + fn real_aomenc_1to4_streams_decode_pixel_exact_and_rect_vartx_leaves_fire_before_a_named_refusal() { + const NAME: &str = + "real_aomenc_1to4_streams_decode_pixel_exact_and_rect_vartx_leaves_fire_before_a_named_refusal"; + let _gate_lock = lock_gate_counters(); + if !have_ffmpeg() { + eprintln!("SKIP {NAME}: no ffmpeg"); + return; + } + if !have_aomenc() { + eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display()); + return; + } + let frame_count = 6usize; + for bit_depth in [8u32, 10u32] { + let (mut named_refusals, mut compared, mut out_of_scope, mut oos_mismatch) = + (0u32, 0u32, 0u32, 0u32); + let (mut leaf_32x16, mut leaf_16x32) = (0usize, 0usize); + // Leaves decoded on ANY attempt, including one whose stream hits a + // later named refusal: the firing half of this gate, kept apart + // from `leaf_32x16`/`leaf_16x32` (pixel-compared attempts only) so + // a refused stream is never counted as a pixel proof + // (class counter-from-refused-stream). + let (mut fired_32x16, mut fired_16x32) = (0usize, 0usize); + for attempt in 0..18u32 { + // Two orientations (the transposed pair a one-sided gate could + // never separate) x four quantisers x two motion steps. + // lane-r14 r4 recipe hunt (~70 aomenc runs on the merged + // tree: testsrc2 / life / mandelbrot / banded motion, 64x64 up + // to 384x256, cq 20..58): attempts 16-17 carry the only recipe + // found that makes aomenc code a 64-axis 1:4 strip whose + // transform SPLITS -- 384x256, per-16-column band motion, + // cq 32 (16x32 leaves) and cq 38 (32x16 leaves). + let firing = attempt >= 16; + let (width, height) = + if firing { (384usize, 256usize) } else { (192usize, 128usize) }; + let vertical = attempt % 2 == 1; + let cq = if firing { + [32, 38][(attempt - 16) as usize] + } else { + [30, 36, 44, 52][(attempt / 2 % 4) as usize] + }; + let sp = 3 + (attempt / 8) * 3; + // 16-pixel bands, each band translating at its OWN speed + // across the other axis: that is what makes aomenc's RD split + // a 64x64 superblock into four 1:4 strips (`PARTITION_HORZ_4` + // / `VERT_4`) with distinct motion vectors, and the texture + // inside a band is what keeps the strip non-skip and its + // transform split. + let geq = if firing { + "128+60*sin((Y-N*(1+0.37*mod(floor(X/16),4)))/3)+45*sin(Y/17+X/23)" + .to_string() + } else if vertical { + format!( + "128+60*sin((Y+N*({sp}+9*mod(floor(X/16),2)))/7)+25*sin(X/11)" + ) + } else { + format!( + "128+60*sin((X+N*({sp}+9*mod(floor(Y/16),2)))/7)+25*sin(Y/11)" + ) + }; + let duration = frame_count as f64 / 25.0; + let source = format!( + "color=c=gray:s={width}x{height}:d={duration}:r=25,format=gray,\ + geq=lum='{geq}',format=yuv420p" + ); + let pix_fmt = if bit_depth == 10 { "yuv420p10le" } else { "yuv420p" }; + let y4m = Command::new("ffmpeg") + .args([ + "-v", "error", "-f", "lavfi", "-i", &source, "-t", &duration.to_string(), + "-pix_fmt", pix_fmt, "-strict", "-1", "-f", "yuv4mpegpipe", "-", + ]) + .stdin(Stdio::null()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .output() + .expect("ffmpeg failed to run"); + assert!( + y4m.status.success(), + "{NAME}: ffmpeg refused the {bit_depth}-bit fixture: {}", + String::from_utf8_lossy(&y4m.stderr) + ); + let cq_arg = format!("--cq-level={cq}"); + let depth_arg = format!("--bit-depth={bit_depth}"); + let input_depth_arg = format!("--input-bit-depth={bit_depth}"); + let args: Vec<&str> = vec![ + "--codec=av1", "--passes=1", "--end-usage=q", &cq_arg, "--cpu-used=0", + "--threads=1", "--row-mt=0", "--sb-size=64", &depth_arg, &input_depth_arg, + "--enable-restoration=0", "--enable-palette=0", "--deltaq-mode=0", + "--enable-filter-intra=0", "--enable-cfl-intra=0", "--enable-intrabc=0", + "--lag-in-frames=0", + // Per-arm overrides go LAST: aomenc keeps the last + // occurrence of a repeated --enable-* flag. + "--enable-tx64=1", "--enable-rect-partitions=1", + "--enable-ab-partitions=0", "--enable-1to4-partitions=1", + "--enable-dual-filter=0", "--enable-obmc=0", + "--min-partition-size=16", "--max-partition-size=64", + "--obu", "-o", "-", "-", + ]; + let mut child = Command::new(aomenc_path()) + .args(&args) + .stdin(Stdio::piped()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .spawn() + .expect("aomenc failed to start"); + child + .stdin + .take() + .expect("aomenc stdin") + .write_all(&y4m.stdout) + .expect("writing y4m to aomenc"); + let out = child.wait_with_output().expect("aomenc failed to run"); + assert!( + out.status.success(), + "aomenc refused the fixture: {}", + String::from_utf8_lossy(&out.stderr) + ); + let stream = out.stdout; + let before = crate::stream::vartx_rect_leaf_hits(); + let frames = match decode_stream(&stream) { + Err(e) => { + let msg = e.to_string(); + assert!( + msg.contains("unsupported"), + "{NAME} failed outright, not a named refusal ({bit_depth}-bit, \ + attempt {attempt}): {msg}" + ); + let after = crate::stream::vartx_rect_leaf_hits(); + fired_32x16 += after[0] - before[0]; + fired_16x32 += after[1] - before[1]; + named_refusals += 1; + eprintln!( + "{bit_depth}-bit attempt {attempt} refusal (rect var-tx leaves \ + decoded before it: 32x16={}, 16x32={}): {msg}", + after[0] - before[0], + after[1] - before[1] + ); + continue; + } + Ok(frames) => frames, + }; + let after = crate::stream::vartx_rect_leaf_hits(); + let (h32, v32) = (after[0] - before[0], after[1] - before[1]); + fired_32x16 += h32; + fired_16x32 += v32; + let ffmpeg_frames = if bit_depth == 10 { + ffmpeg_decode_sequence_10bit(&stream, width, height, frame_count) + } else { + ffmpeg_decode_sequence(&stream, width, height, frame_count) + }; + assert_eq!(frames.len(), frame_count); + let mismatched = frames + .iter() + .zip(&ffmpeg_frames) + .any(|(got, want)| got.y != want.y || got.u != want.u || got.v != want.v); + if h32 + v32 == 0 { + // Counted per ATTEMPT, on a decoded+compared attempt only + // (class counter-from-refused-stream). + out_of_scope += 1; + if mismatched { + oos_mismatch += 1; + eprintln!( + "{NAME}: {bit_depth}-bit attempt {attempt} MISMATCHES with zero \ + rectangular var-tx leaves -- another shape's defect" + ); + } + continue; + } + for (i, (got, want)) in frames.iter().zip(&ffmpeg_frames).enumerate() { + assert_eq!(got.y, want.y, "{NAME} frame {i} luma vs ffmpeg (attempt {attempt}, {bit_depth}-bit)"); + assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (attempt {attempt}, {bit_depth}-bit)"); + assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (attempt {attempt}, {bit_depth}-bit)"); + } + leaf_32x16 += h32; + leaf_16x32 += v32; + compared += 1; + } + eprintln!( + "{NAME} ({bit_depth}-bit): {named_refusals} named refusals, {compared} \ + pixel-exact attempts carrying the arm, pixel-compared rect var-tx leaves \ + 32x16={leaf_32x16} 16x32={leaf_16x32}, leaves decoded anywhere in the sweep \ + 32x16={fired_32x16} 16x32={fired_16x32}, {out_of_scope} attempts carried none \ + ({oos_mismatch} of them mismatched)" + ); + assert_eq!( + oos_mismatch, 0, + "{NAME}: {oos_mismatch} attempt(s) with no rectangular var-tx leaf decoded \ + but mismatched ffmpeg -- a defect of another shape, not a pass" + ); + assert!( + compared + out_of_scope > 0, + "{NAME} ({bit_depth}-bit): every attempt refused -- the gate compared no pixels" + ); + // The firing half. MEASURED on the merged tree (lane-r14 r4, ~70 + // aomenc runs): the 8-bit 384x256 banded recipe codes BOTH + // orientations of the split -- cq 38 gives four 32x16 leaves (out + // of four 64x16 strips), cq 32 one 16x32 leaf (out of four 16x64 + // strips). Those two streams stop LATER on another lane's live + // refusal ("an inter 16x16-level AB or 1:4 partition", "a non-skip + // rectangular (HORZ/VERT/HORZ_B) strip needs rectangular residual + // coding"), so the leaves are proved DECODED, not proved + // pixel-exact; every attempt that ran to the end is compared + // frame by frame above. At 10 bits the same sweep fires nothing + // (aomenc picks other shapes), so the firing assert is 8-bit only + // -- and it is a hard assert, never a print. + if bit_depth == 8 { + assert!( + fired_32x16 > 0 && fired_16x32 > 0, + "{NAME}: the rectangular var-tx leaf arm never fired (32x16={fired_32x16}, \ + 16x32={fired_16x32}, {named_refusals} refusals, {compared} compared) -- \ + `sub_tx_size_map[TX_64X16] == TX_32X16` is unproved by this gate" + ); + } + } + } + /// lane-inter4 r2: the 32x32-level inter `PARTITION_HORZ`/`PARTITION_VERT` /// strips (32x16 / 16x32) carrying a REAL residual -- the capability r1 /// found missing ("a non-skip rectangular (HORZ/VERT/HORZ_B) strip needs diff --git a/lanes/r14-r3.report.md b/lanes/r14-r3.report.md new file mode 100644 index 00000000..eb7de225 --- /dev/null +++ b/lanes/r14-r3.report.md @@ -0,0 +1,104 @@ +# lane-r14 round 3 — the SPLIT transform of a 1:4 inter strip with a 64-px axis + +## What changed + +- `crates/ec-av1/src/decode.rs sub_tx_size_map(tx_w, tx_h)` — NEW, the full libaom + `sub_tx_size_map[TX_SIZES_ALL]` (`common_data.c`) transcribed, with a unit test + (`sub_tx_size_map_matches_libaom`) enumerating all 19 entries. The load-bearing rows are the + ones r2 refused on: `[TX_64X16] == TX_32X16`, `[TX_16X64] == TX_16X32` — RECTANGULAR. +- `crates/ec-av1/src/decode.rs read_var_tx_size` — now takes `(tx_w, tx_h)` and recurses exactly + as libaom `read_tx_size_vartx` (`decodeframe.c`) does: `ctx` from `txfm_partition_context` + (already rect-general here — above vs `tx_size_wide`, left vs `tx_size_high`, category from + `txsize_sqr_up_map`), `sub_txs = sub_tx_size_map[tx_size]`, loop + `for row in (0..tx_size_high_unit[tx_size]).step_by(bsh) { for col in (0..tx_size_wide_unit).step_by(bsw) }`, + and libaom's `sub_txs == TX_4X4` early return generalised to `tx_h/4 x tx_w/4` cells. + Leaves are now `(row, col, tw, th)` instead of the square `(row, col, tx_px)`. +- `crates/ec-av1/src/decode.rs read_block_tx_size_rect` — the refusal + `"a split transform on a 1:4 inter strip with a 64-px axis"` is GONE; the depth-1 recursion + starts from `sub_tx_size_map(bw, bh)` and can therefore hand back rectangular leaves. +- `crates/ec-av1/src/decode.rs` — both duplicated inter var-tx leaf loops (the two the r2 report + named, `decode_inter_block`'s compound and non-compound arms) now branch on `tw != th`: a + rectangular leaf reads through `read_inter_plane_rect` with `rect_inter_luma_set(tw, th)` + (`LumaRect32x16Inter`, the 2-symbol `EXT_TX_SET_DCT_IDTX` inter row — `av1_get_ext_tx_set_type` + at `tx_size_sqr_up == TX_32X32`), its own `luma_skip_ctx_rect` / `around_mi_rect` / + `record_mi_luma_rect` spans, and the block's own square prediction stride offset at the leaf. +- `crates/ec-av1/src/decode.rs read_inter_plane_rect` — gains `luma_skip_ctx: Option`: + `get_txb_ctx_general`'s `txb_skip_ctx` is 0 only when the unit IS the whole plane block, which + a var-tx leaf is not. The 6 whole-block call sites pass `None` (unchanged behaviour). +- `crates/ec-av1/src/decode.rs` + `stream.rs` — `vartx_rect_leaf_hits() -> [usize; 2]` + (`[32x16, 16x32]`), and `examples/decode_probe.rs` prints it. +- `crates/ec-av1/src/refusal_inventory.rs` — the refusal line dropped. +- `crates/ec-av1/src/gate_coverage.rs` — `enable-tx64` removed from `NEVER_EXERCISED_8BIT` and + `NEVER_EXERCISED_10BIT` (the new gate spells `--enable-tx64=1` at both depths); its own tests + are what dictated the edit. +- `crates/ec-av1/src/stream.rs` — new gate + `a_real_aomenc_inter_1to4_recipe_decodes_pixel_exact_or_refuses_by_name` (see the honest + scoping below). + +## Firing proof: his real film + +EVIDENCE: `decode_probe` on `seg4500.obu` (`ffmpeg -ss 4500 -t 2 -i -c:v copy -f obu`, 213 frame headers) | run under `systemd-run --user --scope -p MemoryMax=6G` on the r3 tip | `vartx_rect_leaf: 32x16=0 16x32=14`, `inter_rect: 64x32=24 32x64=24 64x16=0 16x64=16` — **14 rectangular var-tx leaves decoded**, and the stop moved from `a split transform on a 1:4 inter strip with a 64-px axis` to `an intra-coded HORZ/VERT strip needs rectangular intra prediction this decoder does not code yet` (lane-intrarect's wall) + +EVIDENCE: same command on `seg3000.obu` (288 frame headers) | before r3 it stopped at this round's refusal (r2 report) | now `REFUSED: an intra-coded HORZ/VERT strip needs rectangular intra prediction this decoder does not code yet` — this round's wall is off both mid-film segments + +EVIDENCE: same command on `seg300.obu` (206 frame headers) | unchanged wall (`intra-coded HORZ/VERT strip`) | but it now decodes 4 `16x64` strips and `vartx_rect_leaf 16x32=1` on the way there + +## Gate — and what it can NOT assert (measured, not assumed) + +`EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib -- --test-threads=1 1to4 superblock_level_rect_partition refusal_inventory gate_coverage sub_tx_size_map` → 17 passed / 0 failed (log `$HOME/.cache/r14-r3-g5.log`, plus `-g6` after the gate_coverage edit). + +The new gate sweeps 16 attempts x 2 bit depths of the chartered recipe +(`--enable-tx64=1 --enable-rect-partitions=1 --enable-ab-partitions=0 --enable-1to4-partitions=1 +--min-partition-size=16 --max-partition-size=64 --sb-size=64 --cpu-used=0`, each flag spelled +once, per-arm overrides last), compares EVERY decoded frame to ffmpeg on Y/U/V, counts named +refusals, and hard-asserts `oos_mismatch == 0`. It does **not** assert the arm fired, and that is +a measured limitation of this branch, written at the assert site: + +> 5 recipe sweeps, 60+ real aomenc runs (lavfi banded-motion at 16-px band granularity, +> `testsrc2`, `life`, `mandelbrot`, `smptebars`; 192x128 and 384x256; cq 26..58; both +> `--min-partition-size` arms; `--enable-dual-filter=0 --enable-obmc=0` to clear an unrelated +> `switchable_interp` desync panic): aomenc only picks a superblock-level 1:4 partition on +> content that ALSO contains at least one of {an intra HORZ/VERT strip, a 16x16-level AB or 1:4 +> partition, an SB-level AB partition, an inter partition below 8x8, a 32x8/8x32 rect residual}. +> Every one of those is another live refusal in this tree and stops the decode before the frame +> completes. With `--min-partition-size=32` aomenc emits no 1:4 partition at all (measured: the +> 64x16/16x64 counters read 0 across 12 recipes), so the 64-axis 1:4 shape is unreachable there. + +So the round's firing proof is the film, and the pixel-exactness proof is the sibling gates plus +this gate's `oos_mismatch == 0` sweep. That is a **deviation from the charter's gate clause**, +stated rather than papered over: the charter's "counters proving >=1 rectangular var-tx leaf of +each of 32x16/16x32 coded, decoded+compared" is not achievable on this branch's refusal set. + +## Sibling gates (COMMON's SIBLING GATES rule) + +`superblock_level_rect_partition`, `16_level_1to4`, `32x32_level_1to4`, `superblock_level_1to4`, +`filter_intra_on_a_32_level_1to4_strip`, `refusal_inventory`, `gate_coverage` — all green on the +r3 tip (`$HOME/.cache/r14-r3-g5.log` / `-g6.log`); they share `read_var_tx_size`, +`txfm_partition_*` and the leaf loops this round rewrote. + +## Residue + +- **deferred**(needs any one of lane-intrarect / SB-AB / 16-level-AB-1:4 / sub8 to merge — then + flip the parked assert back on): a pixel-exact aomenc gate that hard-asserts a rectangular + var-tx leaf. The assert and its restore instruction are in the gate body. +- **deferred**(needs grain synthesis in the dump path): the chartered per-frame 16-bit dump-before- + refusal diff on `seg3000`. `EC_AV1_FINAL_DUMP` already dumps every decoded frame (no new env + needed — reuse, not a new mode), but the ledger records the measurement it produces on this + film: the dump is the PRE-grain reference copy, so a compare against `ffmpeg -pix_fmt + yuv420p10le` reads as a whole-frame mismatch whose delta histogram is zero-mean +-5 film grain. + Dumping a 2 s 2160p 10-bit segment is also multi-GB. Not run. +- **flagged, not mine**: `--enable-ab-partitions=0` streams still hit + `an inter SB-level AB partition` in this decoder (memory class `refusal-from-own-desync`: a + refusal naming a DISABLED tool is usually our own desync). Seen on `mandelbrot` cq50 and on + several banded-motion recipes. Worth its own lane. +- **flagged, not mine**: a `switchable_interp's alphabet is exactly 3 symbols` PANIC (not a named + refusal) on an aomenc stream with dual filter + OBMC enabled, 192x128 cq30. Reproduced with the + new capability ABLATED, so it is pre-existing and unrelated to this round. + +## Suite + +`systemd-run --user --unit=r14-r3-suite-... -p MemoryMax=10G ... cargo test -p ec-av1 --lib -j3` +-> log `$HOME/.cache/r14-suite-r3.log`; totals appended below. + +**Suite result (r3 tip `81b6f9e`): 367 passed; 0 failed; 31 ignored, 622.33s** — up from r2's +365/0/31 by the two tests this round adds (`sub_tx_size_map_matches_libaom` and the new gate). diff --git a/lanes/r14-r4.report.md b/lanes/r14-r4.report.md new file mode 100644 index 00000000..a7c88fd7 --- /dev/null +++ b/lanes/r14-r4.report.md @@ -0,0 +1,87 @@ +# lane-r14 round 4 — merge main, and the parked firing assert turned back on + +## 1. Merge `main` (18bf7dc) — commit `523c17d` + +`git merge --no-commit main` auto-merged with NO conflicts (diffstat: decode.rs +1117, +stream.rs +1100, mvstack.rs +114, encode.rs +47, refusal_inventory.rs, cdf.rs, cdf_state.rs, +decode_probe.rs, 9 lane reports). Checks run before committing: + +- `git diff main -- crates/ec-av1/src/cdf.rs` → **0 lines**: cdf.rs (NZ_MAP / FILTER_INTRA rows + included) is byte-identical to main on the merged tree, so no table was rebound by the merge. +- `git diff main -- crates/ec-av1/src/refusal_inventory.rs` shows only THIS lane's deletion + ("a split transform on a 1:4 inter strip with a 64-px axis"); every refusal main deleted + (lane-oddh's 128x128 line, lane-intrarect's) stays deleted. +- `grep -rn '<<<<<<<|>>>>>>>' crates/` → nothing. No hand-resolved function, so no rebound-name + re-read was needed (class merge-resolution-shadows-a-name did not apply this round). + +## 2. The firing assert is back on — and it is a hard assert + +Gate renamed +`a_real_aomenc_inter_1to4_recipe_decodes_pixel_exact_or_refuses_by_name` → +**`real_aomenc_1to4_streams_decode_pixel_exact_and_rect_vartx_leaves_fire_before_a_named_refusal`** +(`crates/ec-av1/src/stream.rs:6752`), which is what it now asserts. + +r4 recipe hunt on the merged tree, ~70 real aomenc runs (`testsrc2`, `life`, `mandelbrot`, +banded-motion lavfi with per-band and per-column speeds, 64x64 / 128x64 / 64x128 / 256x64 / +384x64 / 64x384 / 192x128 / 384x256, cq 20..58, `--min-partition-size` 16 and 32, 8- and +10-bit) found the recipe r3 could not: **384x256, per-16-column band motion**, at +`cq=38` and `cq=32`. + +EVIDENCE: `$HOME/.cache/r14-r4-gate.log` (gate run, quoted below) | `cargo test -p ec-av1 --lib -- --test-threads=1 --nocapture real_aomenc_1to4_streams` on `0b49322` | 8-bit: `attempt 17 refusal (rect var-tx leaves decoded before it: 32x16=4, 16x32=0)`, `attempt 16 ... (32x16=0, 16x32=1)`, summary `2 named refusals, leaves decoded anywhere in the sweep 32x16=4 16x32=1, 16 attempts carried none (0 of them mismatched)` — **test result: ok, 1 passed** + +What the gate asserts now: +- `oos_mismatch == 0` — every attempt that decodes to the end is compared to ffmpeg on Y/U/V, + 8- AND 10-bit, and a mismatch is a failure, never a SKIP (16/16 banded attempts per depth + decode fully and match; the recipe's `--min-partition-size` moved 32 → 16, so those 16 + attempts now also exercise the 16-level path). +- `compared + out_of_scope > 0` — the gate is not vacuous. +- **8-bit: `fired_32x16 > 0 && fired_16x32 > 0`** — both orientations of + `sub_tx_size_map[TX_64X16] == TX_32X16` / `[TX_16X64] == TX_16X32` decoded out of a real + aomenc stream. These two streams stop LATER on another lane's refusal + (`a non-skip rectangular (HORZ/VERT/HORZ_B) strip needs rectangular residual coding` at cq 32, + `an inter 16x16-level AB or 1:4 partition` at cq 38 — decode.rs:21305, genuinely unimplemented + on the inter path), so the leaves are proved **decoded**, not proved pixel-exact. The counters + are per-attempt deltas kept in a separate pair of variables from the pixel-compared ones + (class counter-from-refused-stream), and the distinction is printed and commented. +- 10-bit: the same sweep fires ZERO leaves (measured: cq 32/35/38 pick other shapes), so the + firing assert is 8-bit-only, with the measurement written at the assert. + +## 3. Suite + +`systemd-run --user --unit=r14-suite-r4-1788325638 -p MemoryMax=10G ... cargo test -p ec-av1 --lib -j3` +→ `$HOME/.cache/r14-suite-r4.log`. **Suite result (r4 tip `0b49322`): 372 passed; 0 failed; 32 ignored, 1487.04s** — GREEN. +(r3 tip was 367/0/31; +5 passed and +1 ignored come from main's three merged lanes.) + +## 4. Film probes on the merged tree — and a regression that is main's, not this lane's + +EVIDENCE: `/tmp/.../scratchpad/r14/seg{300,3000,4500}.obu` (2 s HG 2160p10 extracts, reused from r3) | `decode_probe` under `systemd-run --user --scope -p MemoryMax=6G`, `EC_AV1_FINAL_DUMP` file count = frames completed | merged tree `0b49322`: + +| segment | stop string | frames completed | +|---|---|---| +| `-ss 300` | `a split intra strip whose transform unit is 32x64 (no luma coefficient tables for that shape here)` | 1 | +| `-ss 3000` | same | 1 | +| `-ss 4500` | `an intra-coded 1:4 (or other non-2:1) rect strip on the inter block path` | 1 | + +That is **shallower than the r3 tip**, where `seg4500` decoded 14 rectangular var-tx leaves and +16 `16x64` strips before stopping. Attribution measured, not guessed: + +EVIDENCE: same three segments | `decode_probe` built from a detached worktree at **main 18bf7dc** (`CARGO_TARGET_DIR=$HOME/.cache/cargo-target-r14-main`, worktree + target dir removed after) | main alone gives the IDENTICAL stop strings and `frames=1` on all three + +So the films now stop in decode-order frame 2 on lane-intrarect's two NARROWER successor +refusals; the merge with lane-r14 changes nothing about it. **flagged, not mine**: main +18bf7dc is a film-depth regression against this lane's r3 tip — a broad refusal was replaced +by narrower ones that fire EARLIER in the stream (or our decode desyncs into them; class +refusal-from-own-desync is untested here). Owner: lane-intrarect / a fresh lane. + +## Residue + +- deferred(needs the 16x16-level inter 1:4 lane, or the non-skip HORZ_B rect residual lane) — + a PIXEL-EXACT aomenc stream carrying a rectangular var-tx leaf. Both firing streams are one + refusal short of running to the end; the assert to strengthen is the `if bit_depth == 8` block. +- deferred(needs an aomenc recipe that fires the arm at 10 bits) — the 10-bit firing assert. + Measured absent over the 18-attempt sweep at cq 32/35/38. +- flagged, not mine — the film-depth regression above. +- accepted — `--enable-ab-partitions=0` streams still reach `an inter SB-level AB partition` + and `--min-partition-size=16` streams reach `an inter partition below 8x8` (both re-observed + this round, r3 flagged them first): a refusal naming a disabled tool is usually our own + desync, and deserves its own lane.