forge
Explore
Log in

Don't you dare go Hollow

Merge main 727f29a (lane-r14, lane-kf1200, lane-reelckf) into lane-cdef

Browse files at this commit

9c201726fdcd906a942a6de9da997e23ad7e20c4Ahmet Kaan GümüşParent: e7460a0fcf808d
No conflicts; cdf.rs untouched by either side.
crates/ec-av1/examples/decode_probe.rsmodified+2 -0
@@ -35,6 +35,8 @@ fn main() {
3535 println!("rect4_32: horz={h} vert={v} coded={c}");
3636 let (rtu, rsplit, robmc) = ec_av1::stream::rect_inter_tu_counters();
3737 println!("rect_inter: tu={rtu} txsplit={rsplit} obmc_leaf={robmc}");
38+ let leaf = ec_av1::stream::vartx_rect_leaf_hits();
39+ println!("vartx_rect_leaf: 32x16={} 16x32={}", leaf[0], leaf[1]);
3840 let ir = ec_av1::stream::inter_rect_counters();
3941 println!(
4042 "inter_rect: 32x8={} 8x32={} 64x32={} 32x64={} 64x16={} 16x64={}",
crates/ec-av1/src/decode.rsmodified+226 -98
@@ -997,6 +997,8 @@ thread_local! {
997997 // (64x32/32x64/64x16/16x64), whose coefficients are coded as the
998998 // truncated low-32 corner.
999999 static RECT64_INTER_TU_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) };
1000+ // lane-r14 r3: rectangular var-tx LEAVES, [32x16, 16x32].
1001+ static VARTX_RECT_LEAF_HITS: std::cell::Cell<[usize; 2]> = const { std::cell::Cell::new([0; 2]) };
10001002 // lane-inter4 r3: 16x16-level PARTITION_HORZ / PARTITION_VERT on an inter
10011003 // frame -- 16x8 and 8x16 inter leaves.
10021004 static INTER_LEAF16_HORZ_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) };
@@ -1049,6 +1051,21 @@ pub(crate) fn rect64_inter_tu_hits() -> usize {
10491051 RECT64_INTER_TU_HITS.with(|c| c.get())
10501052 }
10511053
1054+/// Current value of [`VARTX_RECT_LEAF_HITS`] (lane-r14 r3): how many
1055+/// rectangular var-tx leaf transform units were coded, `[32x16, 16x32]`.
1056+pub(crate) fn vartx_rect_leaf_hits() -> [usize; 2] {
1057+ VARTX_RECT_LEAF_HITS.with(|c| c.get())
1058+}
1059+
1060+/// Records one rectangular var-tx leaf.
1061+fn vartx_rect_leaf_hit(tw: usize, th: usize) {
1062+ VARTX_RECT_LEAF_HITS.with(|c| {
1063+ let mut h = c.get();
1064+ h[usize::from(th > tw)] += 1;
1065+ c.set(h);
1066+ });
1067+}
1068+
10521069 /// Sets the current thread's [`TX_SELECT_INTER`]/[`REDUCED_TX_SET_INTER`]/
10531070 /// [`ENABLE_FILTER_INTRA_INTER`].
10541071 pub(crate) fn set_inter_tx_mode(
@@ -11489,6 +11506,46 @@ const TXFM_CTX_INIT: u8 = 64;
1148911506 /// twice below its own largest transform.
1149011507 const MAX_VARTX_DEPTH: usize = 2;
1149111508
11509+/// libaom `sub_tx_size_map[TX_SIZES_ALL]` (`common_data.c`): the transform
11510+/// one `txfm_split` step below `tx_size`. RECTANGULAR for the 1:4 shapes
11511+/// (`[TX_64X16] == TX_32X16`, `[TX_16X64] == TX_16X32`) and for the 4:1
11512+/// small ones, square everywhere else.
11513+fn sub_tx_size_map(tx_w: usize, tx_h: usize) -> (usize, usize) {
11514+ match (tx_w, tx_h) {
11515+ (4, 4) => (4, 4),
11516+ (8, 8) => (4, 4),
11517+ (16, 16) => (8, 8),
11518+ (32, 32) => (16, 16),
11519+ (64, 64) => (32, 32),
11520+ (4, 8) | (8, 4) => (4, 4),
11521+ (8, 16) | (16, 8) => (8, 8),
11522+ (16, 32) | (32, 16) => (16, 16),
11523+ (32, 64) | (64, 32) => (32, 32),
11524+ (4, 16) => (4, 8),
11525+ (16, 4) => (8, 4),
11526+ (8, 32) => (8, 16),
11527+ (32, 8) => (16, 8),
11528+ (16, 64) => (16, 32),
11529+ (64, 16) => (32, 16),
11530+ _ => unreachable!("not a TX_SIZES_ALL shape: {tx_w}x{tx_h}"),
11531+ }
11532+}
11533+
11534+#[test]
11535+fn sub_tx_size_map_matches_libaom() {
11536+ // libaom `common_data.c` `sub_tx_size_map`, in TX_SIZES_ALL order.
11537+ const TABLE: [((usize, usize), (usize, usize)); 19] = [
11538+ ((4, 4), (4, 4)), ((8, 8), (4, 4)), ((16, 16), (8, 8)), ((32, 32), (16, 16)),
11539+ ((64, 64), (32, 32)), ((4, 8), (4, 4)), ((8, 4), (4, 4)), ((8, 16), (8, 8)),
11540+ ((16, 8), (8, 8)), ((16, 32), (16, 16)), ((32, 16), (16, 16)), ((32, 64), (32, 32)),
11541+ ((64, 32), (32, 32)), ((4, 16), (4, 8)), ((16, 4), (8, 4)), ((8, 32), (8, 16)),
11542+ ((32, 8), (16, 8)), ((16, 64), (16, 32)), ((64, 16), (32, 16)),
11543+ ];
11544+ for (tx, want) in TABLE {
11545+ assert_eq!(sub_tx_size_map(tx.0, tx.1), want, "sub_tx_size_map({tx:?})");
11546+ }
11547+}
11548+
1149211549 /// `read_var_tx_size` (spec 5.11.17, libaom `decodeframe.c`
1149311550 /// `read_tx_size_vartx`): the recursive `txfm_split` tree of one
1149411551 /// max-transform-sized unit of an inter block, collecting the resolved leaf
@@ -11505,22 +11562,28 @@ fn read_var_tx_size(
1150511562 at_mi: (usize, usize),
1150611563 blk_max_px: usize,
1150711564 (max_w_mi, max_h_mi): (usize, usize),
11508- tx_px: usize,
11565+ (tx_w, tx_h): (usize, usize),
1150911566 depth: usize,
1151011567 blk_row: usize,
1151111568 blk_col: usize,
11512- out: &mut Vec<(usize, usize, usize)>,
11569+ out: &mut Vec<(usize, usize, usize, usize)>,
1151311570 ) {
1151411571 if blk_row >= max_h_mi || blk_col >= max_w_mi {
1151511572 return;
1151611573 }
1151711574 let unit = (at_mi.0 + blk_row, at_mi.1 + blk_col);
1151811575 if depth == MAX_VARTX_DEPTH {
11519- out.push((blk_row, blk_col, tx_px));
11520- txfm_partition_update(n, unit, tx_px, tx_px);
11576+ out.push((blk_row, blk_col, tx_w, tx_h));
11577+ txfm_partition_update_rect(n, unit, (tx_w, tx_h), (tx_w, tx_h));
1152111578 return;
1152211579 }
11523- let ctx = txfm_partition_ctx(n.above_txfm[unit.1], n.left_txfm[unit.0], blk_max_px, tx_px);
11580+ let ctx = txfm_partition_ctx_rect(
11581+ n.above_txfm[unit.1],
11582+ n.left_txfm[unit.0],
11583+ blk_max_px,
11584+ tx_w,
11585+ tx_h,
11586+ );
1152411587 let split = dec.symbol(&mut cdfs.txfm_partition[ctx]) == 1;
1152511588 TXFM_SPLIT_READS.with(|c| c.set(c.get() + 1));
1152611589 if std::env::var_os("EC_TRACE_MODE_STEP").is_some() {
@@ -11533,27 +11596,27 @@ fn read_var_tx_size(
1153311596 );
1153411597 }
1153511598 if !split {
11536- out.push((blk_row, blk_col, tx_px));
11537- txfm_partition_update(n, unit, tx_px, tx_px);
11599+ out.push((blk_row, blk_col, tx_w, tx_h));
11600+ txfm_partition_update_rect(n, unit, (tx_w, tx_h), (tx_w, tx_h));
1153811601 return;
1153911602 }
1154011603 TXFM_SPLIT_HITS.with(|c| c.set(c.get() + 1));
11541- let sub = tx_px / 2;
11542- if sub == 4 {
11543- // libaom's `sub_txs == TX_4X4` early return: the whole 8x8 unit is
11544- // marked 4x4 (four transform units, raster order) without recursing.
11545- for row in 0..2 {
11546- for col in 0..2 {
11604+ let (sub_w, sub_h) = sub_tx_size_map(tx_w, tx_h);
11605+ if (sub_w, sub_h) == (4, 4) {
11606+ // libaom's `sub_txs == TX_4X4` early return: every mi cell of the
11607+ // unit is marked 4x4 (raster order) without recursing.
11608+ for row in 0..tx_h / MI {
11609+ for col in 0..tx_w / MI {
1154711610 if blk_row + row < max_h_mi && blk_col + col < max_w_mi {
11548- out.push((blk_row + row, blk_col + col, 4));
11611+ out.push((blk_row + row, blk_col + col, 4, 4));
1154911612 }
1155011613 }
1155111614 }
11552- txfm_partition_update(n, unit, 4, tx_px);
11615+ txfm_partition_update_rect(n, unit, (4, 4), (tx_w, tx_h));
1155311616 return;
1155411617 }
11555- for row in (0..tx_px / MI).step_by(sub / MI) {
11556- for col in (0..tx_px / MI).step_by(sub / MI) {
11618+ for row in (0..tx_h / MI).step_by(sub_h / MI) {
11619+ for col in (0..tx_w / MI).step_by(sub_w / MI) {
1155711620 read_var_tx_size(
1155811621 dec,
1155911622 cdfs,
@@ -11561,7 +11624,7 @@ fn read_var_tx_size(
1156111624 at_mi,
1156211625 blk_max_px,
1156311626 (max_w_mi, max_h_mi),
11564- sub,
11627+ (sub_w, sub_h),
1156511628 depth + 1,
1156611629 blk_row + row,
1156711630 blk_col + col,
@@ -11589,7 +11652,7 @@ fn read_block_tx_size(
1158911652 (mi_cols, mi_rows): (usize, usize),
1159011653 is_inter: bool,
1159111654 skip: bool,
11592-) -> Result<(usize, Option<Vec<(usize, usize, usize)>>)> {
11655+) -> Result<(usize, Option<Vec<(usize, usize, usize, usize)>>)> {
1159311656 if !TX_SELECT_INTER.with(std::cell::Cell::get) {
1159411657 return Ok((side, None));
1159511658 }
@@ -11609,7 +11672,7 @@ fn read_block_tx_size(
1160911672 at_mi,
1161011673 side,
1161111674 (max_w_mi, max_h_mi),
11612- max_tx,
11675+ (max_tx, max_tx),
1161311676 0,
1161411677 row,
1161511678 col,
@@ -11617,8 +11680,8 @@ fn read_block_tx_size(
1161711680 );
1161811681 }
1161911682 }
11620- let single = leaves.len() == 1 && leaves[0].2 == side;
11621- if !single && leaves.iter().any(|leaf| leaf.2 > 32) {
11683+ let single = leaves.len() == 1 && leaves[0].2 == side && leaves[0].3 == side;
11684+ if !single && leaves.iter().any(|leaf| leaf.2.max(leaf.3) > 32) {
1162211685 // Only a block wider than a superblock's own 64x64 max transform
1162311686 // reaches here; this crate has no 64-point *inter* coefficient
1162411687 // table set ([`inter_txbset_for`] stops at 32).
@@ -11656,7 +11719,7 @@ fn read_block_tx_size(
1165611719 let mut leaves = Vec::new();
1165711720 for row in (0..side_mi).step_by(step) {
1165811721 for col in (0..side_mi).step_by(step) {
11659- leaves.push((row, col, tx));
11722+ leaves.push((row, col, tx, tx));
1166011723 }
1166111724 }
1166211725 INTRA_IN_INTER_SPLIT_TX_HITS.with(|c| {
@@ -11808,7 +11871,7 @@ fn read_block_tx_size_rect(
1180811871 (bw, bh): (usize, usize),
1180911872 (mi_cols, mi_rows): (usize, usize),
1181011873 skip: bool,
11811-) -> Result<Option<Vec<(usize, usize, usize)>>> {
11874+) -> Result<Option<Vec<(usize, usize, usize, usize)>>> {
1181211875 if skip {
1181311876 // `set_txfm_ctxs(.., skip && is_inter)`: a skipped inter block records
1181411877 // its own BLOCK size -- width above, height left -- not a transform.
@@ -11851,22 +11914,16 @@ fn read_block_tx_size_rect(
1185111914 }
1185211915 TXFM_SPLIT_HITS.with(|c| c.set(c.get() + 1));
1185311916 RECT_INTER_TXSPLIT_HITS.with(|c| c.set(c.get() + 1));
11854- // lane-r14 r2: `sub_tx_size_map` is square for every shape this decoder
11855- // splits (TX_32X16 -> TX_16X16, TX_64X32 -> TX_32X32) EXCEPT the 1:4
11856- // strips with a 64-px axis, where it stays rectangular
11857- // (TX_64X16 -> TX_32X16, TX_16X64 -> TX_16X32) and the square recursion
11858- // below would code the wrong tree.
11859- if tx_w.max(tx_h) == 64 && tx_w.min(tx_h) == 16 {
11860- return Err(unsupported(
11861- "a split transform on a 1:4 inter strip with a 64-px axis",
11862- ));
11863- }
11864- let sub = tx_w.min(tx_h);
11917+ // lane-r14 r3: `sub_tx_size_map` (libaom `common_data.c`) stays
11918+ // RECTANGULAR under a 1:4 strip -- `[TX_64X16] == TX_32X16`,
11919+ // `[TX_16X64] == TX_16X32` -- so the recursion below is the general
11920+ // rect one and its leaves carry their own width and height.
11921+ let (sub_w, sub_h) = sub_tx_size_map(tx_w, tx_h);
1186511922 let max_w_mi = (bw / MI).min(mi_cols.saturating_sub(at_mi.1));
1186611923 let max_h_mi = (bh / MI).min(mi_rows.saturating_sub(at_mi.0));
1186711924 let mut leaves = Vec::new();
11868- for row in (0..bh / MI).step_by(sub / MI) {
11869- for col in (0..bw / MI).step_by(sub / MI) {
11925+ for row in (0..bh / MI).step_by(sub_h / MI) {
11926+ for col in (0..bw / MI).step_by(sub_w / MI) {
1187011927 read_var_tx_size(
1187111928 dec,
1187211929 cdfs,
@@ -11874,7 +11931,7 @@ fn read_block_tx_size_rect(
1187411931 at_mi,
1187511932 bw.max(bh),
1187611933 (max_w_mi, max_h_mi),
11877- sub,
11934+ (sub_w, sub_h),
1187811935 1,
1187911936 row,
1188011937 col,
@@ -11911,9 +11968,12 @@ fn read_inter_plane_rect(
1191111968 y: usize,
1191211969 prediction: &[u16],
1191311970 inherited_luma_tx_type: Option<TxType>,
11971+ luma_skip_ctx: Option<usize>,
1191411972 ) -> Result<(Vec<i32>, TxType)> {
1191511973 let skip_ctx = if plane_idx == 0 {
11916- 0
11974+ // `get_txb_ctx_general`: 0 only when this unit IS the whole plane
11975+ // block; a var-tx leaf passes its own neighbour-table context.
11976+ luma_skip_ctx.unwrap_or(0)
1191711977 } else {
1191811978 usize::from(around.0) + usize::from(around.1)
1191911979 };
@@ -16544,7 +16604,7 @@ fn decode_inter_block(
1654416604 // 5.11.17), `Some` only when this block's var-tx tree resolved to more
1654516605 // than one luma transform -- read back by the residual loop, the
1654616606 // coefficient-context write-back and the loop-filter grid fill below.
16547- let mut vartx_leaves: Option<Vec<(usize, usize, usize)>> = None;
16607+ let mut vartx_leaves: Option<Vec<(usize, usize, usize, usize)>> = None;
1654816608 let at_mi = at;
1654916609 if is_inter {
1655016610 let above_nbr = has_above.then(|| NeighbourRef {
@@ -17399,37 +17459,68 @@ fn decode_inter_block(
1739917459 // own slice of the block's motion-compensated predictor.
1740017460 let reduced = REDUCED_TX_SET_INTER.with(std::cell::Cell::get);
1740117461 let mut first_tx_type = TxType::DctDct;
17402- for (idx, &(row, col, tx_px)) in leaves.iter().enumerate() {
17462+ for (idx, &(row, col, tw, th)) in leaves.iter().enumerate() {
1740317463 let tu_mi = (at_mi.0 + row, at_mi.1 + col);
1740417464 let (tu_px, tu_py) = (px + col * MI, py + row * MI);
17405- let mut tu_pred = Vec::with_capacity(tx_px * tx_px);
17406- for rr in 0..tx_px {
17407- let start = (row * MI + rr) * side + col * MI;
17408- tu_pred.extend_from_slice(&pred_y[start..start + tx_px]);
17409- }
17410- let scan = default_scan(tx_px);
17411- let tu_skip_ctx = neighbours.luma_skip_ctx(tu_mi, tx_px / MI);
17412- let (tu_grid, tu_tx_type) = read_inter_plane(
17413- dec,
17414- cdfs,
17415- inter_txbset_for(tx_px, reduced),
17416- &scan,
17417- 0,
17418- neighbours.around_mi(tu_mi, tx_px)[0],
17419- mode_for_tx,
17420- y,
17421- tu_px,
17422- tu_py,
17423- tx_px,
17424- base_q_idx,
17425- &tu_pred,
17426- None,
17427- Some(tu_skip_ctx),
17428- )?;
17465+ let (tu_grid, tu_tx_type) = if tw == th {
17466+ let tx_px = tw;
17467+ let mut tu_pred = Vec::with_capacity(tx_px * tx_px);
17468+ for rr in 0..tx_px {
17469+ let start = (row * MI + rr) * side + col * MI;
17470+ tu_pred.extend_from_slice(&pred_y[start..start + tx_px]);
17471+ }
17472+ let scan = default_scan(tx_px);
17473+ let tu_skip_ctx = neighbours.luma_skip_ctx(tu_mi, tx_px / MI);
17474+ read_inter_plane(
17475+ dec,
17476+ cdfs,
17477+ inter_txbset_for(tx_px, reduced),
17478+ &scan,
17479+ 0,
17480+ neighbours.around_mi(tu_mi, tx_px)[0],
17481+ mode_for_tx,
17482+ y,
17483+ tu_px,
17484+ tu_py,
17485+ tx_px,
17486+ base_q_idx,
17487+ &tu_pred,
17488+ None,
17489+ Some(tu_skip_ctx),
17490+ )?
17491+ } else {
17492+ // lane-r14 r3: a 1:4 strip's `sub_tx_size_map`
17493+ // sub-transform is RECTANGULAR (TX_64X16 ->
17494+ // TX_32X16, TX_16X64 -> TX_16X32), so this leaf is
17495+ // read with the rect coefficient machinery, at its
17496+ // own `txb_skip_ctx`/neighbour spans -- the unit is
17497+ // smaller than its block, so `get_txb_ctx_general`'s
17498+ // neighbour table applies, not the lone-TU 0.
17499+ vartx_rect_leaf_hit(tw, th);
17500+ let tu_skip_ctx =
17501+ neighbours.luma_skip_ctx_rect(tu_mi, tw / MI, th / MI);
17502+ let start = row * MI * side + col * MI;
17503+ read_inter_plane_rect(
17504+ dec,
17505+ cdfs,
17506+ rect_inter_luma_set(tw, th),
17507+ (tw, th),
17508+ side,
17509+ 0,
17510+ neighbours.around_mi_rect(tu_mi, tw, th)[0],
17511+ mode_for_tx,
17512+ y,
17513+ tu_px,
17514+ tu_py,
17515+ &pred_y[start..],
17516+ None,
17517+ Some(tu_skip_ctx),
17518+ )?
17519+ };
1742917520 if idx == 0 {
1743017521 first_tx_type = tu_tx_type;
1743117522 }
17432- neighbours.record_mi_luma(tu_mi, tx_px, &tu_grid);
17523+ neighbours.record_mi_luma_rect(tu_mi, tw, th, &tu_grid);
1743317524 }
1743417525 // `av1_get_tx_type`'s chroma lookup scales the chroma
1743517526 // position back to luma, so an inter block's chroma
@@ -17453,6 +17544,7 @@ fn decode_inter_block(
1745317544 py,
1745417545 &pred_y,
1745517546 None,
17547+ None,
1745617548 )?;
1745717549 luma_tx_type = tx_type;
1745817550 luma_grid = embed_rect_grid(&grid, write_w, write_h, side);
@@ -17496,6 +17588,7 @@ fn decode_inter_block(
1749617588 cpy,
1749717589 &pred_u,
1749817590 Some(luma_tx_type),
17591+ None,
1749917592 )?
1750017593 .0,
1750117594 uw,
@@ -17517,6 +17610,7 @@ fn decode_inter_block(
1751717610 cpy,
1751817611 &pred_v,
1751917612 Some(luma_tx_type),
17613+ None,
1752017614 )?
1752117615 .0,
1752217616 uw,
@@ -18377,37 +18471,68 @@ fn decode_inter_block(
1837718471 // own slice of the block's motion-compensated predictor.
1837818472 let reduced = REDUCED_TX_SET_INTER.with(std::cell::Cell::get);
1837918473 let mut first_tx_type = TxType::DctDct;
18380- for (idx, &(row, col, tx_px)) in leaves.iter().enumerate() {
18474+ for (idx, &(row, col, tw, th)) in leaves.iter().enumerate() {
1838118475 let tu_mi = (at_mi.0 + row, at_mi.1 + col);
1838218476 let (tu_px, tu_py) = (px + col * MI, py + row * MI);
18383- let mut tu_pred = Vec::with_capacity(tx_px * tx_px);
18384- for rr in 0..tx_px {
18385- let start = (row * MI + rr) * side + col * MI;
18386- tu_pred.extend_from_slice(&pred_y[start..start + tx_px]);
18387- }
18388- let scan = default_scan(tx_px);
18389- let tu_skip_ctx = neighbours.luma_skip_ctx(tu_mi, tx_px / MI);
18390- let (tu_grid, tu_tx_type) = read_inter_plane(
18391- dec,
18392- cdfs,
18393- inter_txbset_for(tx_px, reduced),
18394- &scan,
18395- 0,
18396- neighbours.around_mi(tu_mi, tx_px)[0],
18397- mode_for_tx,
18398- y,
18399- tu_px,
18400- tu_py,
18401- tx_px,
18402- base_q_idx,
18403- &tu_pred,
18404- None,
18405- Some(tu_skip_ctx),
18406- )?;
18477+ let (tu_grid, tu_tx_type) = if tw == th {
18478+ let tx_px = tw;
18479+ let mut tu_pred = Vec::with_capacity(tx_px * tx_px);
18480+ for rr in 0..tx_px {
18481+ let start = (row * MI + rr) * side + col * MI;
18482+ tu_pred.extend_from_slice(&pred_y[start..start + tx_px]);
18483+ }
18484+ let scan = default_scan(tx_px);
18485+ let tu_skip_ctx = neighbours.luma_skip_ctx(tu_mi, tx_px / MI);
18486+ read_inter_plane(
18487+ dec,
18488+ cdfs,
18489+ inter_txbset_for(tx_px, reduced),
18490+ &scan,
18491+ 0,
18492+ neighbours.around_mi(tu_mi, tx_px)[0],
18493+ mode_for_tx,
18494+ y,
18495+ tu_px,
18496+ tu_py,
18497+ tx_px,
18498+ base_q_idx,
18499+ &tu_pred,
18500+ None,
18501+ Some(tu_skip_ctx),
18502+ )?
18503+ } else {
18504+ // lane-r14 r3: a 1:4 strip's `sub_tx_size_map`
18505+ // sub-transform is RECTANGULAR (TX_64X16 ->
18506+ // TX_32X16, TX_16X64 -> TX_16X32), so this leaf is
18507+ // read with the rect coefficient machinery, at its
18508+ // own `txb_skip_ctx`/neighbour spans -- the unit is
18509+ // smaller than its block, so `get_txb_ctx_general`'s
18510+ // neighbour table applies, not the lone-TU 0.
18511+ vartx_rect_leaf_hit(tw, th);
18512+ let tu_skip_ctx =
18513+ neighbours.luma_skip_ctx_rect(tu_mi, tw / MI, th / MI);
18514+ let start = row * MI * side + col * MI;
18515+ read_inter_plane_rect(
18516+ dec,
18517+ cdfs,
18518+ rect_inter_luma_set(tw, th),
18519+ (tw, th),
18520+ side,
18521+ 0,
18522+ neighbours.around_mi_rect(tu_mi, tw, th)[0],
18523+ mode_for_tx,
18524+ y,
18525+ tu_px,
18526+ tu_py,
18527+ &pred_y[start..],
18528+ None,
18529+ Some(tu_skip_ctx),
18530+ )?
18531+ };
1840718532 if idx == 0 {
1840818533 first_tx_type = tu_tx_type;
1840918534 }
18410- neighbours.record_mi_luma(tu_mi, tx_px, &tu_grid);
18535+ neighbours.record_mi_luma_rect(tu_mi, tw, th, &tu_grid);
1841118536 }
1841218537 // `av1_get_tx_type`'s chroma lookup scales the chroma
1841318538 // position back to luma, so an inter block's chroma
@@ -18431,6 +18556,7 @@ fn decode_inter_block(
1843118556 py,
1843218557 &pred_y,
1843318558 None,
18559+ None,
1843418560 )?;
1843518561 luma_tx_type = tx_type;
1843618562 luma_grid = embed_rect_grid(&grid, write_w, write_h, side);
@@ -18474,6 +18600,7 @@ fn decode_inter_block(
1847418600 cpy,
1847518601 &pred_u,
1847618602 Some(luma_tx_type),
18603+ None,
1847718604 )?
1847818605 .0,
1847918606 uw,
@@ -18495,6 +18622,7 @@ fn decode_inter_block(
1849518622 cpy,
1849618623 &pred_v,
1849718624 Some(luma_tx_type),
18625+ None,
1849818626 )?
1849918627 .0,
1850018628 uw,
@@ -18758,7 +18886,7 @@ fn decode_inter_block(
1875818886 let split_luma = vartx_leaves.is_some();
1875918887 if let Some(leaves) = vartx_leaves.clone() {
1876018888 let reduced = REDUCED_TX_SET_INTER.with(std::cell::Cell::get);
18761- for &(row, col, tx_px) in &leaves {
18889+ for &(row, col, tx_px, _) in &leaves {
1876218890 let tu_mi = (at_mi.0 + row, at_mi.1 + col);
1876318891 let (tu_px, tu_py) = (px + col * MI, py + row * MI);
1876418892 // A transform unit inside a block is not a block at that
@@ -19000,13 +19128,13 @@ fn decode_inter_block(
1900019128 // units, not the block. Chroma still reads `tx_h_grid / 2` (the block's
1900119129 // uv transform is not split) -- a known corner-cut of this round.
1900219130 if let Some(leaves) = &vartx_leaves {
19003- for &(row, col, tx_px) in leaves {
19131+ for &(row, col, tw, th) in leaves {
1900419132 neighbours.fill_lf_grid_rect(
1900519133 (at_mi.0 + row, at_mi.1 + col),
19006- tx_px / MI,
19007- tx_px / MI,
19008- tx_px as u8,
19009- tx_px as u8,
19134+ tw / MI,
19135+ th / MI,
19136+ tw as u8,
19137+ th as u8,
1901019138 if globalmv_for_lf {
1901119139 -ref_frame_for_lf
1901219140 } else {
crates/ec-av1/src/gate_coverage.rsmodified+0 -5
@@ -175,10 +175,6 @@ const NEVER_EXERCISED_8BIT: &[(&str, &str)] = &[
175175 "enable-rect-tx",
176176 "never spelled; rect transforms reach the decoder only through partition shape, never through a gate that names the tool",
177177 ),
178- (
179- "enable-tx64",
180- "never spelled; TX_64X64 appears only where aomenc's default picks it, which is unknown per stream",
181- ),
182178 ];
183179
184180 #[cfg(test)]
@@ -217,7 +213,6 @@ const NEVER_EXERCISED_10BIT: &[(&str, &str)] = &[ // lane-cwarp's 10-bit comp
217213 // 1D tx class).
218214 ("enable-intrabc", "hole at both depths, see the 8-bit list"),
219215 ("enable-rect-tx", "hole at both depths, see the 8-bit list"),
220- ("enable-tx64", "hole at both depths, see the 8-bit list"),
221216 ];
222217
223218 /// [`DEFAULT_ON_TOOLS`] entries no 8-bit gate spells on, with the reason.
crates/ec-av1/src/refusal_inventory.rsmodified+0 -4
@@ -82,10 +82,6 @@ const REFUSALS: &[&str] = &[
8282 "warp prediction with a scaled reference (superres, unimplemented)",
8383 "an 8x8 partition leaf under a scaled reference (superres, unimplemented)",
8484 "a motion_mode symbol for a block shape with no CDF row here",
85- // lane-r14 r2: the whole-transform case of every 64-axis inter strip is
86- // coded; only the SPLIT of a 1:4 strip with a 64-px axis is left, whose
87- // `sub_tx_size_map` entry is rectangular (TX_64X16 -> TX_32X16).
88- "a split transform on a 1:4 inter strip with a 64-px axis",
8985 ];
9086
9187 /// Gates whose `Err` arm turns a decode failure into a printed SKIP rather than
crates/ec-av1/src/stream.rsmodified+241 -0
@@ -74,6 +74,13 @@ pub fn rect64_inter_tu_hits() -> usize {
7474 crate::decode::rect64_inter_tu_hits()
7575 }
7676
77+/// lane-r14 r3: RECTANGULAR var-tx leaf transform units, `[32x16, 16x32]` --
78+/// the leaves `sub_tx_size_map` produces when a 1:4 strip with a 64-px axis
79+/// splits its transform (`[TX_64X16] == TX_32X16`, `[TX_16X64] == TX_16X32`).
80+pub fn vartx_rect_leaf_hits() -> [usize; 2] {
81+ crate::decode::vartx_rect_leaf_hits()
82+}
83+
7784 pub fn rect4_32_counters() -> (usize, usize, usize) {
7885 (
7986 crate::decode::rect4_32_horz_hits(),
@@ -6823,6 +6830,240 @@ mod tests {
68236830 }
68246831 }
68256832
6833+ /// lane-r14 r3: a 1:4 inter strip with a 64-px axis (64x16 / 16x64) whose
6834+ /// transform SPLITS -- the arm r2 left refused by name ("a split transform
6835+ /// on a 1:4 inter strip with a 64-px axis"). libaom's
6836+ /// `sub_tx_size_map[TX_64X16] == TX_32X16` (and `[TX_16X64] == TX_16X32`)
6837+ /// keeps the sub-transform RECTANGULAR, so the var-tx tree's leaves are
6838+ /// 32x16/16x32 units read through [`TxbSet::LumaRect32x16Inter`], each with
6839+ /// its own `get_txb_ctx_general` neighbour context (the unit is smaller
6840+ /// than its block, so `txb_skip_ctx` is NOT the lone-TU 0).
6841+ ///
6842+ /// `--enable-1to4-partitions=1 --min-partition-size=16
6843+ /// --max-partition-size=64 --enable-tx64=1` (each spelled once, last
6844+ /// occurrence wins) is what lets aomenc pick a superblock-level HORZ_4 /
6845+ /// VERT_4; the textured translating source is what keeps the strips
6846+ /// non-skip so the residual is actually coded. 8-bit AND 10-bit, every
6847+ /// decoded frame compared to ffmpeg on Y/U/V, refusals counted (never
6848+ /// SKIPped), attempts that carried no rectangular var-tx leaf counted
6849+ /// separately and still required pixel-exact.
6850+ #[test]
6851+ fn real_aomenc_1to4_streams_decode_pixel_exact_and_rect_vartx_leaves_fire_before_a_named_refusal() {
6852+ const NAME: &str =
6853+ "real_aomenc_1to4_streams_decode_pixel_exact_and_rect_vartx_leaves_fire_before_a_named_refusal";
6854+ let _gate_lock = lock_gate_counters();
6855+ if !have_ffmpeg() {
6856+ eprintln!("SKIP {NAME}: no ffmpeg");
6857+ return;
6858+ }
6859+ if !have_aomenc() {
6860+ eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display());
6861+ return;
6862+ }
6863+ let frame_count = 6usize;
6864+ for bit_depth in [8u32, 10u32] {
6865+ let (mut named_refusals, mut compared, mut out_of_scope, mut oos_mismatch) =
6866+ (0u32, 0u32, 0u32, 0u32);
6867+ let (mut leaf_32x16, mut leaf_16x32) = (0usize, 0usize);
6868+ // Leaves decoded on ANY attempt, including one whose stream hits a
6869+ // later named refusal: the firing half of this gate, kept apart
6870+ // from `leaf_32x16`/`leaf_16x32` (pixel-compared attempts only) so
6871+ // a refused stream is never counted as a pixel proof
6872+ // (class counter-from-refused-stream).
6873+ let (mut fired_32x16, mut fired_16x32) = (0usize, 0usize);
6874+ for attempt in 0..18u32 {
6875+ // Two orientations (the transposed pair a one-sided gate could
6876+ // never separate) x four quantisers x two motion steps.
6877+ // lane-r14 r4 recipe hunt (~70 aomenc runs on the merged
6878+ // tree: testsrc2 / life / mandelbrot / banded motion, 64x64 up
6879+ // to 384x256, cq 20..58): attempts 16-17 carry the only recipe
6880+ // found that makes aomenc code a 64-axis 1:4 strip whose
6881+ // transform SPLITS -- 384x256, per-16-column band motion,
6882+ // cq 32 (16x32 leaves) and cq 38 (32x16 leaves).
6883+ let firing = attempt >= 16;
6884+ let (width, height) =
6885+ if firing { (384usize, 256usize) } else { (192usize, 128usize) };
6886+ let vertical = attempt % 2 == 1;
6887+ let cq = if firing {
6888+ [32, 38][(attempt - 16) as usize]
6889+ } else {
6890+ [30, 36, 44, 52][(attempt / 2 % 4) as usize]
6891+ };
6892+ let sp = 3 + (attempt / 8) * 3;
6893+ // 16-pixel bands, each band translating at its OWN speed
6894+ // across the other axis: that is what makes aomenc's RD split
6895+ // a 64x64 superblock into four 1:4 strips (`PARTITION_HORZ_4`
6896+ // / `VERT_4`) with distinct motion vectors, and the texture
6897+ // inside a band is what keeps the strip non-skip and its
6898+ // transform split.
6899+ let geq = if firing {
6900+ "128+60*sin((Y-N*(1+0.37*mod(floor(X/16),4)))/3)+45*sin(Y/17+X/23)"
6901+ .to_string()
6902+ } else if vertical {
6903+ format!(
6904+ "128+60*sin((Y+N*({sp}+9*mod(floor(X/16),2)))/7)+25*sin(X/11)"
6905+ )
6906+ } else {
6907+ format!(
6908+ "128+60*sin((X+N*({sp}+9*mod(floor(Y/16),2)))/7)+25*sin(Y/11)"
6909+ )
6910+ };
6911+ let duration = frame_count as f64 / 25.0;
6912+ let source = format!(
6913+ "color=c=gray:s={width}x{height}:d={duration}:r=25,format=gray,\
6914+ geq=lum='{geq}',format=yuv420p"
6915+ );
6916+ let pix_fmt = if bit_depth == 10 { "yuv420p10le" } else { "yuv420p" };
6917+ let y4m = Command::new("ffmpeg")
6918+ .args([
6919+ "-v", "error", "-f", "lavfi", "-i", &source, "-t", &duration.to_string(),
6920+ "-pix_fmt", pix_fmt, "-strict", "-1", "-f", "yuv4mpegpipe", "-",
6921+ ])
6922+ .stdin(Stdio::null())
6923+ .stdout(Stdio::piped())
6924+ .stderr(Stdio::piped())
6925+ .output()
6926+ .expect("ffmpeg failed to run");
6927+ assert!(
6928+ y4m.status.success(),
6929+ "{NAME}: ffmpeg refused the {bit_depth}-bit fixture: {}",
6930+ String::from_utf8_lossy(&y4m.stderr)
6931+ );
6932+ let cq_arg = format!("--cq-level={cq}");
6933+ let depth_arg = format!("--bit-depth={bit_depth}");
6934+ let input_depth_arg = format!("--input-bit-depth={bit_depth}");
6935+ let args: Vec<&str> = vec![
6936+ "--codec=av1", "--passes=1", "--end-usage=q", &cq_arg, "--cpu-used=0",
6937+ "--threads=1", "--row-mt=0", "--sb-size=64", &depth_arg, &input_depth_arg,
6938+ "--enable-restoration=0", "--enable-palette=0", "--deltaq-mode=0",
6939+ "--enable-filter-intra=0", "--enable-cfl-intra=0", "--enable-intrabc=0",
6940+ "--lag-in-frames=0",
6941+ // Per-arm overrides go LAST: aomenc keeps the last
6942+ // occurrence of a repeated --enable-* flag.
6943+ "--enable-tx64=1", "--enable-rect-partitions=1",
6944+ "--enable-ab-partitions=0", "--enable-1to4-partitions=1",
6945+ "--enable-dual-filter=0", "--enable-obmc=0",
6946+ "--min-partition-size=16", "--max-partition-size=64",
6947+ "--obu", "-o", "-", "-",
6948+ ];
6949+ let mut child = Command::new(aomenc_path())
6950+ .args(&args)
6951+ .stdin(Stdio::piped())
6952+ .stdout(Stdio::piped())
6953+ .stderr(Stdio::piped())
6954+ .spawn()
6955+ .expect("aomenc failed to start");
6956+ child
6957+ .stdin
6958+ .take()
6959+ .expect("aomenc stdin")
6960+ .write_all(&y4m.stdout)
6961+ .expect("writing y4m to aomenc");
6962+ let out = child.wait_with_output().expect("aomenc failed to run");
6963+ assert!(
6964+ out.status.success(),
6965+ "aomenc refused the fixture: {}",
6966+ String::from_utf8_lossy(&out.stderr)
6967+ );
6968+ let stream = out.stdout;
6969+ let before = crate::stream::vartx_rect_leaf_hits();
6970+ let frames = match decode_stream(&stream) {
6971+ Err(e) => {
6972+ let msg = e.to_string();
6973+ assert!(
6974+ msg.contains("unsupported"),
6975+ "{NAME} failed outright, not a named refusal ({bit_depth}-bit, \
6976+ attempt {attempt}): {msg}"
6977+ );
6978+ let after = crate::stream::vartx_rect_leaf_hits();
6979+ fired_32x16 += after[0] - before[0];
6980+ fired_16x32 += after[1] - before[1];
6981+ named_refusals += 1;
6982+ eprintln!(
6983+ "{bit_depth}-bit attempt {attempt} refusal (rect var-tx leaves \
6984+ decoded before it: 32x16={}, 16x32={}): {msg}",
6985+ after[0] - before[0],
6986+ after[1] - before[1]
6987+ );
6988+ continue;
6989+ }
6990+ Ok(frames) => frames,
6991+ };
6992+ let after = crate::stream::vartx_rect_leaf_hits();
6993+ let (h32, v32) = (after[0] - before[0], after[1] - before[1]);
6994+ fired_32x16 += h32;
6995+ fired_16x32 += v32;
6996+ let ffmpeg_frames = if bit_depth == 10 {
6997+ ffmpeg_decode_sequence_10bit(&stream, width, height, frame_count)
6998+ } else {
6999+ ffmpeg_decode_sequence(&stream, width, height, frame_count)
7000+ };
7001+ assert_eq!(frames.len(), frame_count);
7002+ let mismatched = frames
7003+ .iter()
7004+ .zip(&ffmpeg_frames)
7005+ .any(|(got, want)| got.y != want.y || got.u != want.u || got.v != want.v);
7006+ if h32 + v32 == 0 {
7007+ // Counted per ATTEMPT, on a decoded+compared attempt only
7008+ // (class counter-from-refused-stream).
7009+ out_of_scope += 1;
7010+ if mismatched {
7011+ oos_mismatch += 1;
7012+ eprintln!(
7013+ "{NAME}: {bit_depth}-bit attempt {attempt} MISMATCHES with zero \
7014+ rectangular var-tx leaves -- another shape's defect"
7015+ );
7016+ }
7017+ continue;
7018+ }
7019+ for (i, (got, want)) in frames.iter().zip(&ffmpeg_frames).enumerate() {
7020+ assert_eq!(got.y, want.y, "{NAME} frame {i} luma vs ffmpeg (attempt {attempt}, {bit_depth}-bit)");
7021+ assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (attempt {attempt}, {bit_depth}-bit)");
7022+ assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (attempt {attempt}, {bit_depth}-bit)");
7023+ }
7024+ leaf_32x16 += h32;
7025+ leaf_16x32 += v32;
7026+ compared += 1;
7027+ }
7028+ eprintln!(
7029+ "{NAME} ({bit_depth}-bit): {named_refusals} named refusals, {compared} \
7030+ pixel-exact attempts carrying the arm, pixel-compared rect var-tx leaves \
7031+ 32x16={leaf_32x16} 16x32={leaf_16x32}, leaves decoded anywhere in the sweep \
7032+ 32x16={fired_32x16} 16x32={fired_16x32}, {out_of_scope} attempts carried none \
7033+ ({oos_mismatch} of them mismatched)"
7034+ );
7035+ assert_eq!(
7036+ oos_mismatch, 0,
7037+ "{NAME}: {oos_mismatch} attempt(s) with no rectangular var-tx leaf decoded \
7038+ but mismatched ffmpeg -- a defect of another shape, not a pass"
7039+ );
7040+ assert!(
7041+ compared + out_of_scope > 0,
7042+ "{NAME} ({bit_depth}-bit): every attempt refused -- the gate compared no pixels"
7043+ );
7044+ // The firing half. MEASURED on the merged tree (lane-r14 r4, ~70
7045+ // aomenc runs): the 8-bit 384x256 banded recipe codes BOTH
7046+ // orientations of the split -- cq 38 gives four 32x16 leaves (out
7047+ // of four 64x16 strips), cq 32 one 16x32 leaf (out of four 16x64
7048+ // strips). Those two streams stop LATER on another lane's live
7049+ // refusal ("an inter 16x16-level AB or 1:4 partition", "a non-skip
7050+ // rectangular (HORZ/VERT/HORZ_B) strip needs rectangular residual
7051+ // coding"), so the leaves are proved DECODED, not proved
7052+ // pixel-exact; every attempt that ran to the end is compared
7053+ // frame by frame above. At 10 bits the same sweep fires nothing
7054+ // (aomenc picks other shapes), so the firing assert is 8-bit only
7055+ // -- and it is a hard assert, never a print.
7056+ if bit_depth == 8 {
7057+ assert!(
7058+ fired_32x16 > 0 && fired_16x32 > 0,
7059+ "{NAME}: the rectangular var-tx leaf arm never fired (32x16={fired_32x16}, \
7060+ 16x32={fired_16x32}, {named_refusals} refusals, {compared} compared) -- \
7061+ `sub_tx_size_map[TX_64X16] == TX_32X16` is unproved by this gate"
7062+ );
7063+ }
7064+ }
7065+ }
7066+
68267067 /// lane-inter4 r2: the 32x32-level inter `PARTITION_HORZ`/`PARTITION_VERT`
68277068 /// strips (32x16 / 16x32) carrying a REAL residual -- the capability r1
68287069 /// found missing ("a non-skip rectangular (HORZ/VERT/HORZ_B) strip needs
lanes/r14-r3.report.mdadded+104 -0
@@ -0,0 +1,104 @@
1+# lane-r14 round 3 — the SPLIT transform of a 1:4 inter strip with a 64-px axis
2+
3+## What changed
4+
5+- `crates/ec-av1/src/decode.rs sub_tx_size_map(tx_w, tx_h)` — NEW, the full libaom
6+ `sub_tx_size_map[TX_SIZES_ALL]` (`common_data.c`) transcribed, with a unit test
7+ (`sub_tx_size_map_matches_libaom`) enumerating all 19 entries. The load-bearing rows are the
8+ ones r2 refused on: `[TX_64X16] == TX_32X16`, `[TX_16X64] == TX_16X32` — RECTANGULAR.
9+- `crates/ec-av1/src/decode.rs read_var_tx_size` — now takes `(tx_w, tx_h)` and recurses exactly
10+ as libaom `read_tx_size_vartx` (`decodeframe.c`) does: `ctx` from `txfm_partition_context`
11+ (already rect-general here — above vs `tx_size_wide`, left vs `tx_size_high`, category from
12+ `txsize_sqr_up_map`), `sub_txs = sub_tx_size_map[tx_size]`, loop
13+ `for row in (0..tx_size_high_unit[tx_size]).step_by(bsh) { for col in (0..tx_size_wide_unit).step_by(bsw) }`,
14+ and libaom's `sub_txs == TX_4X4` early return generalised to `tx_h/4 x tx_w/4` cells.
15+ Leaves are now `(row, col, tw, th)` instead of the square `(row, col, tx_px)`.
16+- `crates/ec-av1/src/decode.rs read_block_tx_size_rect` — the refusal
17+ `"a split transform on a 1:4 inter strip with a 64-px axis"` is GONE; the depth-1 recursion
18+ starts from `sub_tx_size_map(bw, bh)` and can therefore hand back rectangular leaves.
19+- `crates/ec-av1/src/decode.rs` — both duplicated inter var-tx leaf loops (the two the r2 report
20+ named, `decode_inter_block`'s compound and non-compound arms) now branch on `tw != th`: a
21+ rectangular leaf reads through `read_inter_plane_rect` with `rect_inter_luma_set(tw, th)`
22+ (`LumaRect32x16Inter`, the 2-symbol `EXT_TX_SET_DCT_IDTX` inter row — `av1_get_ext_tx_set_type`
23+ at `tx_size_sqr_up == TX_32X32`), its own `luma_skip_ctx_rect` / `around_mi_rect` /
24+ `record_mi_luma_rect` spans, and the block's own square prediction stride offset at the leaf.
25+- `crates/ec-av1/src/decode.rs read_inter_plane_rect` — gains `luma_skip_ctx: Option<usize>`:
26+ `get_txb_ctx_general`'s `txb_skip_ctx` is 0 only when the unit IS the whole plane block, which
27+ a var-tx leaf is not. The 6 whole-block call sites pass `None` (unchanged behaviour).
28+- `crates/ec-av1/src/decode.rs` + `stream.rs` — `vartx_rect_leaf_hits() -> [usize; 2]`
29+ (`[32x16, 16x32]`), and `examples/decode_probe.rs` prints it.
30+- `crates/ec-av1/src/refusal_inventory.rs` — the refusal line dropped.
31+- `crates/ec-av1/src/gate_coverage.rs` — `enable-tx64` removed from `NEVER_EXERCISED_8BIT` and
32+ `NEVER_EXERCISED_10BIT` (the new gate spells `--enable-tx64=1` at both depths); its own tests
33+ are what dictated the edit.
34+- `crates/ec-av1/src/stream.rs` — new gate
35+ `a_real_aomenc_inter_1to4_recipe_decodes_pixel_exact_or_refuses_by_name` (see the honest
36+ scoping below).
37+
38+## Firing proof: his real film
39+
40+EVIDENCE: `decode_probe` on `seg4500.obu` (`ffmpeg -ss 4500 -t 2 -i <HG 2160p HDR10> -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)
41+
42+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
43+
44+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
45+
46+## Gate — and what it can NOT assert (measured, not assumed)
47+
48+`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).
49+
50+The new gate sweeps 16 attempts x 2 bit depths of the chartered recipe
51+(`--enable-tx64=1 --enable-rect-partitions=1 --enable-ab-partitions=0 --enable-1to4-partitions=1
52+--min-partition-size=16 --max-partition-size=64 --sb-size=64 --cpu-used=0`, each flag spelled
53+once, per-arm overrides last), compares EVERY decoded frame to ffmpeg on Y/U/V, counts named
54+refusals, and hard-asserts `oos_mismatch == 0`. It does **not** assert the arm fired, and that is
55+a measured limitation of this branch, written at the assert site:
56+
57+> 5 recipe sweeps, 60+ real aomenc runs (lavfi banded-motion at 16-px band granularity,
58+> `testsrc2`, `life`, `mandelbrot`, `smptebars`; 192x128 and 384x256; cq 26..58; both
59+> `--min-partition-size` arms; `--enable-dual-filter=0 --enable-obmc=0` to clear an unrelated
60+> `switchable_interp` desync panic): aomenc only picks a superblock-level 1:4 partition on
61+> content that ALSO contains at least one of {an intra HORZ/VERT strip, a 16x16-level AB or 1:4
62+> partition, an SB-level AB partition, an inter partition below 8x8, a 32x8/8x32 rect residual}.
63+> Every one of those is another live refusal in this tree and stops the decode before the frame
64+> completes. With `--min-partition-size=32` aomenc emits no 1:4 partition at all (measured: the
65+> 64x16/16x64 counters read 0 across 12 recipes), so the 64-axis 1:4 shape is unreachable there.
66+
67+So the round's firing proof is the film, and the pixel-exactness proof is the sibling gates plus
68+this gate's `oos_mismatch == 0` sweep. That is a **deviation from the charter's gate clause**,
69+stated rather than papered over: the charter's "counters proving >=1 rectangular var-tx leaf of
70+each of 32x16/16x32 coded, decoded+compared" is not achievable on this branch's refusal set.
71+
72+## Sibling gates (COMMON's SIBLING GATES rule)
73+
74+`superblock_level_rect_partition`, `16_level_1to4`, `32x32_level_1to4`, `superblock_level_1to4`,
75+`filter_intra_on_a_32_level_1to4_strip`, `refusal_inventory`, `gate_coverage` — all green on the
76+r3 tip (`$HOME/.cache/r14-r3-g5.log` / `-g6.log`); they share `read_var_tx_size`,
77+`txfm_partition_*` and the leaf loops this round rewrote.
78+
79+## Residue
80+
81+- **deferred**(needs any one of lane-intrarect / SB-AB / 16-level-AB-1:4 / sub8 to merge — then
82+ flip the parked assert back on): a pixel-exact aomenc gate that hard-asserts a rectangular
83+ var-tx leaf. The assert and its restore instruction are in the gate body.
84+- **deferred**(needs grain synthesis in the dump path): the chartered per-frame 16-bit dump-before-
85+ refusal diff on `seg3000`. `EC_AV1_FINAL_DUMP` already dumps every decoded frame (no new env
86+ needed — reuse, not a new mode), but the ledger records the measurement it produces on this
87+ film: the dump is the PRE-grain reference copy, so a compare against `ffmpeg -pix_fmt
88+ yuv420p10le` reads as a whole-frame mismatch whose delta histogram is zero-mean +-5 film grain.
89+ Dumping a 2 s 2160p 10-bit segment is also multi-GB. Not run.
90+- **flagged, not mine**: `--enable-ab-partitions=0` streams still hit
91+ `an inter SB-level AB partition` in this decoder (memory class `refusal-from-own-desync`: a
92+ refusal naming a DISABLED tool is usually our own desync). Seen on `mandelbrot` cq50 and on
93+ several banded-motion recipes. Worth its own lane.
94+- **flagged, not mine**: a `switchable_interp's alphabet is exactly 3 symbols` PANIC (not a named
95+ refusal) on an aomenc stream with dual filter + OBMC enabled, 192x128 cq30. Reproduced with the
96+ new capability ABLATED, so it is pre-existing and unrelated to this round.
97+
98+## Suite
99+
100+`systemd-run --user --unit=r14-r3-suite-... -p MemoryMax=10G ... cargo test -p ec-av1 --lib -j3`
101+-> log `$HOME/.cache/r14-suite-r3.log`; totals appended below.
102+
103+**Suite result (r3 tip `81b6f9e`): 367 passed; 0 failed; 31 ignored, 622.33s** — up from r2's
104+365/0/31 by the two tests this round adds (`sub_tx_size_map_matches_libaom` and the new gate).
lanes/r14-r4.report.mdadded+87 -0
@@ -0,0 +1,87 @@
1+# lane-r14 round 4 — merge main, and the parked firing assert turned back on
2+
3+## 1. Merge `main` (18bf7dc) — commit `523c17d`
4+
5+`git merge --no-commit main` auto-merged with NO conflicts (diffstat: decode.rs +1117,
6+stream.rs +1100, mvstack.rs +114, encode.rs +47, refusal_inventory.rs, cdf.rs, cdf_state.rs,
7+decode_probe.rs, 9 lane reports). Checks run before committing:
8+
9+- `git diff main -- crates/ec-av1/src/cdf.rs` → **0 lines**: cdf.rs (NZ_MAP / FILTER_INTRA rows
10+ included) is byte-identical to main on the merged tree, so no table was rebound by the merge.
11+- `git diff main -- crates/ec-av1/src/refusal_inventory.rs` shows only THIS lane's deletion
12+ ("a split transform on a 1:4 inter strip with a 64-px axis"); every refusal main deleted
13+ (lane-oddh's 128x128 line, lane-intrarect's) stays deleted.
14+- `grep -rn '<<<<<<<|>>>>>>>' crates/` → nothing. No hand-resolved function, so no rebound-name
15+ re-read was needed (class merge-resolution-shadows-a-name did not apply this round).
16+
17+## 2. The firing assert is back on — and it is a hard assert
18+
19+Gate renamed
20+`a_real_aomenc_inter_1to4_recipe_decodes_pixel_exact_or_refuses_by_name` →
21+**`real_aomenc_1to4_streams_decode_pixel_exact_and_rect_vartx_leaves_fire_before_a_named_refusal`**
22+(`crates/ec-av1/src/stream.rs:6752`), which is what it now asserts.
23+
24+r4 recipe hunt on the merged tree, ~70 real aomenc runs (`testsrc2`, `life`, `mandelbrot`,
25+banded-motion lavfi with per-band and per-column speeds, 64x64 / 128x64 / 64x128 / 256x64 /
26+384x64 / 64x384 / 192x128 / 384x256, cq 20..58, `--min-partition-size` 16 and 32, 8- and
27+10-bit) found the recipe r3 could not: **384x256, per-16-column band motion**, at
28+`cq=38` and `cq=32`.
29+
30+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**
31+
32+What the gate asserts now:
33+- `oos_mismatch == 0` — every attempt that decodes to the end is compared to ffmpeg on Y/U/V,
34+ 8- AND 10-bit, and a mismatch is a failure, never a SKIP (16/16 banded attempts per depth
35+ decode fully and match; the recipe's `--min-partition-size` moved 32 → 16, so those 16
36+ attempts now also exercise the 16-level path).
37+- `compared + out_of_scope > 0` — the gate is not vacuous.
38+- **8-bit: `fired_32x16 > 0 && fired_16x32 > 0`** — both orientations of
39+ `sub_tx_size_map[TX_64X16] == TX_32X16` / `[TX_16X64] == TX_16X32` decoded out of a real
40+ aomenc stream. These two streams stop LATER on another lane's refusal
41+ (`a non-skip rectangular (HORZ/VERT/HORZ_B) strip needs rectangular residual coding` at cq 32,
42+ `an inter 16x16-level AB or 1:4 partition` at cq 38 — decode.rs:21305, genuinely unimplemented
43+ on the inter path), so the leaves are proved **decoded**, not proved pixel-exact. The counters
44+ are per-attempt deltas kept in a separate pair of variables from the pixel-compared ones
45+ (class counter-from-refused-stream), and the distinction is printed and commented.
46+- 10-bit: the same sweep fires ZERO leaves (measured: cq 32/35/38 pick other shapes), so the
47+ firing assert is 8-bit-only, with the measurement written at the assert.
48+
49+## 3. Suite
50+
51+`systemd-run --user --unit=r14-suite-r4-1788325638 -p MemoryMax=10G ... cargo test -p ec-av1 --lib -j3`
52+→ `$HOME/.cache/r14-suite-r4.log`. **Suite result (r4 tip `0b49322`): 372 passed; 0 failed; 32 ignored, 1487.04s** — GREEN.
53+(r3 tip was 367/0/31; +5 passed and +1 ignored come from main's three merged lanes.)
54+
55+## 4. Film probes on the merged tree — and a regression that is main's, not this lane's
56+
57+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`:
58+
59+| segment | stop string | frames completed |
60+|---|---|---|
61+| `-ss 300` | `a split intra strip whose transform unit is 32x64 (no luma coefficient tables for that shape here)` | 1 |
62+| `-ss 3000` | same | 1 |
63+| `-ss 4500` | `an intra-coded 1:4 (or other non-2:1) rect strip on the inter block path` | 1 |
64+
65+That is **shallower than the r3 tip**, where `seg4500` decoded 14 rectangular var-tx leaves and
66+16 `16x64` strips before stopping. Attribution measured, not guessed:
67+
68+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
69+
70+So the films now stop in decode-order frame 2 on lane-intrarect's two NARROWER successor
71+refusals; the merge with lane-r14 changes nothing about it. **flagged, not mine**: main
72+18bf7dc is a film-depth regression against this lane's r3 tip — a broad refusal was replaced
73+by narrower ones that fire EARLIER in the stream (or our decode desyncs into them; class
74+refusal-from-own-desync is untested here). Owner: lane-intrarect / a fresh lane.
75+
76+## Residue
77+
78+- deferred(needs the 16x16-level inter 1:4 lane, or the non-skip HORZ_B rect residual lane) —
79+ a PIXEL-EXACT aomenc stream carrying a rectangular var-tx leaf. Both firing streams are one
80+ refusal short of running to the end; the assert to strengthen is the `if bit_depth == 8` block.
81+- deferred(needs an aomenc recipe that fires the arm at 10 bits) — the 10-bit firing assert.
82+ Measured absent over the 18-attempt sweep at cq 32/35/38.
83+- flagged, not mine — the film-depth regression above.
84+- accepted — `--enable-ab-partitions=0` streams still reach `an inter SB-level AB partition`
85+ and `--min-partition-size=16` streams reach `an inter partition below 8x8` (both re-observed
86+ this round, r3 flagged them first): a refusal naming a disabled tool is usually our own
87+ desync, and deserves its own lane.