forge
Explore
Log in

Don't you dare go Hollow

Merge lane-r14 (b86eb38) into lane-intersub8: general (tx_w,tx_h) read_var_tx_size with the full sub_tx_size_map and rectangular inter leaf coding

Browse files at this commit

df7900d09c5e1622fd1335cba85a69a6ba41e361Ahmet Kaan GümüşParent: af9f9b05677085
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(
@@ -11417,6 +11434,46 @@ const TXFM_CTX_INIT: u8 = 64;
1141711434 /// twice below its own largest transform.
1141811435 const MAX_VARTX_DEPTH: usize = 2;
1141911436
11437+/// libaom `sub_tx_size_map[TX_SIZES_ALL]` (`common_data.c`): the transform
11438+/// one `txfm_split` step below `tx_size`. RECTANGULAR for the 1:4 shapes
11439+/// (`[TX_64X16] == TX_32X16`, `[TX_16X64] == TX_16X32`) and for the 4:1
11440+/// small ones, square everywhere else.
11441+fn sub_tx_size_map(tx_w: usize, tx_h: usize) -> (usize, usize) {
11442+ match (tx_w, tx_h) {
11443+ (4, 4) => (4, 4),
11444+ (8, 8) => (4, 4),
11445+ (16, 16) => (8, 8),
11446+ (32, 32) => (16, 16),
11447+ (64, 64) => (32, 32),
11448+ (4, 8) | (8, 4) => (4, 4),
11449+ (8, 16) | (16, 8) => (8, 8),
11450+ (16, 32) | (32, 16) => (16, 16),
11451+ (32, 64) | (64, 32) => (32, 32),
11452+ (4, 16) => (4, 8),
11453+ (16, 4) => (8, 4),
11454+ (8, 32) => (8, 16),
11455+ (32, 8) => (16, 8),
11456+ (16, 64) => (16, 32),
11457+ (64, 16) => (32, 16),
11458+ _ => unreachable!("not a TX_SIZES_ALL shape: {tx_w}x{tx_h}"),
11459+ }
11460+}
11461+
11462+#[test]
11463+fn sub_tx_size_map_matches_libaom() {
11464+ // libaom `common_data.c` `sub_tx_size_map`, in TX_SIZES_ALL order.
11465+ const TABLE: [((usize, usize), (usize, usize)); 19] = [
11466+ ((4, 4), (4, 4)), ((8, 8), (4, 4)), ((16, 16), (8, 8)), ((32, 32), (16, 16)),
11467+ ((64, 64), (32, 32)), ((4, 8), (4, 4)), ((8, 4), (4, 4)), ((8, 16), (8, 8)),
11468+ ((16, 8), (8, 8)), ((16, 32), (16, 16)), ((32, 16), (16, 16)), ((32, 64), (32, 32)),
11469+ ((64, 32), (32, 32)), ((4, 16), (4, 8)), ((16, 4), (8, 4)), ((8, 32), (8, 16)),
11470+ ((32, 8), (16, 8)), ((16, 64), (16, 32)), ((64, 16), (32, 16)),
11471+ ];
11472+ for (tx, want) in TABLE {
11473+ assert_eq!(sub_tx_size_map(tx.0, tx.1), want, "sub_tx_size_map({tx:?})");
11474+ }
11475+}
11476+
1142011477 /// `read_var_tx_size` (spec 5.11.17, libaom `decodeframe.c`
1142111478 /// `read_tx_size_vartx`): the recursive `txfm_split` tree of one
1142211479 /// max-transform-sized unit of an inter block, collecting the resolved leaf
@@ -11433,22 +11490,28 @@ fn read_var_tx_size(
1143311490 at_mi: (usize, usize),
1143411491 blk_max_px: usize,
1143511492 (max_w_mi, max_h_mi): (usize, usize),
11436- tx_px: usize,
11493+ (tx_w, tx_h): (usize, usize),
1143711494 depth: usize,
1143811495 blk_row: usize,
1143911496 blk_col: usize,
11440- out: &mut Vec<(usize, usize, usize)>,
11497+ out: &mut Vec<(usize, usize, usize, usize)>,
1144111498 ) {
1144211499 if blk_row >= max_h_mi || blk_col >= max_w_mi {
1144311500 return;
1144411501 }
1144511502 let unit = (at_mi.0 + blk_row, at_mi.1 + blk_col);
1144611503 if depth == MAX_VARTX_DEPTH {
11447- out.push((blk_row, blk_col, tx_px));
11448- txfm_partition_update(n, unit, tx_px, tx_px);
11504+ out.push((blk_row, blk_col, tx_w, tx_h));
11505+ txfm_partition_update_rect(n, unit, (tx_w, tx_h), (tx_w, tx_h));
1144911506 return;
1145011507 }
11451- let ctx = txfm_partition_ctx(n.above_txfm[unit.1], n.left_txfm[unit.0], blk_max_px, tx_px);
11508+ let ctx = txfm_partition_ctx_rect(
11509+ n.above_txfm[unit.1],
11510+ n.left_txfm[unit.0],
11511+ blk_max_px,
11512+ tx_w,
11513+ tx_h,
11514+ );
1145211515 let split = dec.symbol(&mut cdfs.txfm_partition[ctx]) == 1;
1145311516 TXFM_SPLIT_READS.with(|c| c.set(c.get() + 1));
1145411517 if std::env::var_os("EC_TRACE_MODE_STEP").is_some() {
@@ -11461,27 +11524,27 @@ fn read_var_tx_size(
1146111524 );
1146211525 }
1146311526 if !split {
11464- out.push((blk_row, blk_col, tx_px));
11465- txfm_partition_update(n, unit, tx_px, tx_px);
11527+ out.push((blk_row, blk_col, tx_w, tx_h));
11528+ txfm_partition_update_rect(n, unit, (tx_w, tx_h), (tx_w, tx_h));
1146611529 return;
1146711530 }
1146811531 TXFM_SPLIT_HITS.with(|c| c.set(c.get() + 1));
11469- let sub = tx_px / 2;
11470- if sub == 4 {
11471- // libaom's `sub_txs == TX_4X4` early return: the whole 8x8 unit is
11472- // marked 4x4 (four transform units, raster order) without recursing.
11473- for row in 0..2 {
11474- for col in 0..2 {
11532+ let (sub_w, sub_h) = sub_tx_size_map(tx_w, tx_h);
11533+ if (sub_w, sub_h) == (4, 4) {
11534+ // libaom's `sub_txs == TX_4X4` early return: every mi cell of the
11535+ // unit is marked 4x4 (raster order) without recursing.
11536+ for row in 0..tx_h / MI {
11537+ for col in 0..tx_w / MI {
1147511538 if blk_row + row < max_h_mi && blk_col + col < max_w_mi {
11476- out.push((blk_row + row, blk_col + col, 4));
11539+ out.push((blk_row + row, blk_col + col, 4, 4));
1147711540 }
1147811541 }
1147911542 }
11480- txfm_partition_update(n, unit, 4, tx_px);
11543+ txfm_partition_update_rect(n, unit, (4, 4), (tx_w, tx_h));
1148111544 return;
1148211545 }
11483- for row in (0..tx_px / MI).step_by(sub / MI) {
11484- for col in (0..tx_px / MI).step_by(sub / MI) {
11546+ for row in (0..tx_h / MI).step_by(sub_h / MI) {
11547+ for col in (0..tx_w / MI).step_by(sub_w / MI) {
1148511548 read_var_tx_size(
1148611549 dec,
1148711550 cdfs,
@@ -11489,7 +11552,7 @@ fn read_var_tx_size(
1148911552 at_mi,
1149011553 blk_max_px,
1149111554 (max_w_mi, max_h_mi),
11492- sub,
11555+ (sub_w, sub_h),
1149311556 depth + 1,
1149411557 blk_row + row,
1149511558 blk_col + col,
@@ -11517,7 +11580,7 @@ fn read_block_tx_size(
1151711580 (mi_cols, mi_rows): (usize, usize),
1151811581 is_inter: bool,
1151911582 skip: bool,
11520-) -> Result<(usize, Option<Vec<(usize, usize, usize)>>)> {
11583+) -> Result<(usize, Option<Vec<(usize, usize, usize, usize)>>)> {
1152111584 if !TX_SELECT_INTER.with(std::cell::Cell::get) {
1152211585 return Ok((side, None));
1152311586 }
@@ -11537,7 +11600,7 @@ fn read_block_tx_size(
1153711600 at_mi,
1153811601 side,
1153911602 (max_w_mi, max_h_mi),
11540- max_tx,
11603+ (max_tx, max_tx),
1154111604 0,
1154211605 row,
1154311606 col,
@@ -11545,8 +11608,8 @@ fn read_block_tx_size(
1154511608 );
1154611609 }
1154711610 }
11548- let single = leaves.len() == 1 && leaves[0].2 == side;
11549- if !single && leaves.iter().any(|leaf| leaf.2 > 32) {
11611+ let single = leaves.len() == 1 && leaves[0].2 == side && leaves[0].3 == side;
11612+ if !single && leaves.iter().any(|leaf| leaf.2.max(leaf.3) > 32) {
1155011613 // Only a block wider than a superblock's own 64x64 max transform
1155111614 // reaches here; this crate has no 64-point *inter* coefficient
1155211615 // table set ([`inter_txbset_for`] stops at 32).
@@ -11584,7 +11647,7 @@ fn read_block_tx_size(
1158411647 let mut leaves = Vec::new();
1158511648 for row in (0..side_mi).step_by(step) {
1158611649 for col in (0..side_mi).step_by(step) {
11587- leaves.push((row, col, tx));
11650+ leaves.push((row, col, tx, tx));
1158811651 }
1158911652 }
1159011653 INTRA_IN_INTER_SPLIT_TX_HITS.with(|c| {
@@ -11736,7 +11799,7 @@ fn read_block_tx_size_rect(
1173611799 (bw, bh): (usize, usize),
1173711800 (mi_cols, mi_rows): (usize, usize),
1173811801 skip: bool,
11739-) -> Result<Option<Vec<(usize, usize, usize)>>> {
11802+) -> Result<Option<Vec<(usize, usize, usize, usize)>>> {
1174011803 if skip {
1174111804 // `set_txfm_ctxs(.., skip && is_inter)`: a skipped inter block records
1174211805 // its own BLOCK size -- width above, height left -- not a transform.
@@ -11779,22 +11842,16 @@ fn read_block_tx_size_rect(
1177911842 }
1178011843 TXFM_SPLIT_HITS.with(|c| c.set(c.get() + 1));
1178111844 RECT_INTER_TXSPLIT_HITS.with(|c| c.set(c.get() + 1));
11782- // lane-r14 r2: `sub_tx_size_map` is square for every shape this decoder
11783- // splits (TX_32X16 -> TX_16X16, TX_64X32 -> TX_32X32) EXCEPT the 1:4
11784- // strips with a 64-px axis, where it stays rectangular
11785- // (TX_64X16 -> TX_32X16, TX_16X64 -> TX_16X32) and the square recursion
11786- // below would code the wrong tree.
11787- if tx_w.max(tx_h) == 64 && tx_w.min(tx_h) == 16 {
11788- return Err(unsupported(
11789- "a split transform on a 1:4 inter strip with a 64-px axis",
11790- ));
11791- }
11792- let sub = tx_w.min(tx_h);
11845+ // lane-r14 r3: `sub_tx_size_map` (libaom `common_data.c`) stays
11846+ // RECTANGULAR under a 1:4 strip -- `[TX_64X16] == TX_32X16`,
11847+ // `[TX_16X64] == TX_16X32` -- so the recursion below is the general
11848+ // rect one and its leaves carry their own width and height.
11849+ let (sub_w, sub_h) = sub_tx_size_map(tx_w, tx_h);
1179311850 let max_w_mi = (bw / MI).min(mi_cols.saturating_sub(at_mi.1));
1179411851 let max_h_mi = (bh / MI).min(mi_rows.saturating_sub(at_mi.0));
1179511852 let mut leaves = Vec::new();
11796- for row in (0..bh / MI).step_by(sub / MI) {
11797- for col in (0..bw / MI).step_by(sub / MI) {
11853+ for row in (0..bh / MI).step_by(sub_h / MI) {
11854+ for col in (0..bw / MI).step_by(sub_w / MI) {
1179811855 read_var_tx_size(
1179911856 dec,
1180011857 cdfs,
@@ -11802,7 +11859,7 @@ fn read_block_tx_size_rect(
1180211859 at_mi,
1180311860 bw.max(bh),
1180411861 (max_w_mi, max_h_mi),
11805- sub,
11862+ (sub_w, sub_h),
1180611863 1,
1180711864 row,
1180811865 col,
@@ -11839,9 +11896,12 @@ fn read_inter_plane_rect(
1183911896 y: usize,
1184011897 prediction: &[u16],
1184111898 inherited_luma_tx_type: Option<TxType>,
11899+ luma_skip_ctx: Option<usize>,
1184211900 ) -> Result<(Vec<i32>, TxType)> {
1184311901 let skip_ctx = if plane_idx == 0 {
11844- 0
11902+ // `get_txb_ctx_general`: 0 only when this unit IS the whole plane
11903+ // block; a var-tx leaf passes its own neighbour-table context.
11904+ luma_skip_ctx.unwrap_or(0)
1184511905 } else {
1184611906 usize::from(around.0) + usize::from(around.1)
1184711907 };
@@ -16458,7 +16518,7 @@ fn decode_inter_block(
1645816518 // 5.11.17), `Some` only when this block's var-tx tree resolved to more
1645916519 // than one luma transform -- read back by the residual loop, the
1646016520 // coefficient-context write-back and the loop-filter grid fill below.
16461- let mut vartx_leaves: Option<Vec<(usize, usize, usize)>> = None;
16521+ let mut vartx_leaves: Option<Vec<(usize, usize, usize, usize)>> = None;
1646216522 let at_mi = at;
1646316523 if is_inter {
1646416524 let above_nbr = has_above.then(|| NeighbourRef {
@@ -17313,37 +17373,68 @@ fn decode_inter_block(
1731317373 // own slice of the block's motion-compensated predictor.
1731417374 let reduced = REDUCED_TX_SET_INTER.with(std::cell::Cell::get);
1731517375 let mut first_tx_type = TxType::DctDct;
17316- for (idx, &(row, col, tx_px)) in leaves.iter().enumerate() {
17376+ for (idx, &(row, col, tw, th)) in leaves.iter().enumerate() {
1731717377 let tu_mi = (at_mi.0 + row, at_mi.1 + col);
1731817378 let (tu_px, tu_py) = (px + col * MI, py + row * MI);
17319- let mut tu_pred = Vec::with_capacity(tx_px * tx_px);
17320- for rr in 0..tx_px {
17321- let start = (row * MI + rr) * side + col * MI;
17322- tu_pred.extend_from_slice(&pred_y[start..start + tx_px]);
17323- }
17324- let scan = default_scan(tx_px);
17325- let tu_skip_ctx = neighbours.luma_skip_ctx(tu_mi, tx_px / MI);
17326- let (tu_grid, tu_tx_type) = read_inter_plane(
17327- dec,
17328- cdfs,
17329- inter_txbset_for(tx_px, reduced),
17330- &scan,
17331- 0,
17332- neighbours.around_mi(tu_mi, tx_px)[0],
17333- mode_for_tx,
17334- y,
17335- tu_px,
17336- tu_py,
17337- tx_px,
17338- base_q_idx,
17339- &tu_pred,
17340- None,
17341- Some(tu_skip_ctx),
17342- )?;
17379+ let (tu_grid, tu_tx_type) = if tw == th {
17380+ let tx_px = tw;
17381+ let mut tu_pred = Vec::with_capacity(tx_px * tx_px);
17382+ for rr in 0..tx_px {
17383+ let start = (row * MI + rr) * side + col * MI;
17384+ tu_pred.extend_from_slice(&pred_y[start..start + tx_px]);
17385+ }
17386+ let scan = default_scan(tx_px);
17387+ let tu_skip_ctx = neighbours.luma_skip_ctx(tu_mi, tx_px / MI);
17388+ read_inter_plane(
17389+ dec,
17390+ cdfs,
17391+ inter_txbset_for(tx_px, reduced),
17392+ &scan,
17393+ 0,
17394+ neighbours.around_mi(tu_mi, tx_px)[0],
17395+ mode_for_tx,
17396+ y,
17397+ tu_px,
17398+ tu_py,
17399+ tx_px,
17400+ base_q_idx,
17401+ &tu_pred,
17402+ None,
17403+ Some(tu_skip_ctx),
17404+ )?
17405+ } else {
17406+ // lane-r14 r3: a 1:4 strip's `sub_tx_size_map`
17407+ // sub-transform is RECTANGULAR (TX_64X16 ->
17408+ // TX_32X16, TX_16X64 -> TX_16X32), so this leaf is
17409+ // read with the rect coefficient machinery, at its
17410+ // own `txb_skip_ctx`/neighbour spans -- the unit is
17411+ // smaller than its block, so `get_txb_ctx_general`'s
17412+ // neighbour table applies, not the lone-TU 0.
17413+ vartx_rect_leaf_hit(tw, th);
17414+ let tu_skip_ctx =
17415+ neighbours.luma_skip_ctx_rect(tu_mi, tw / MI, th / MI);
17416+ let start = row * MI * side + col * MI;
17417+ read_inter_plane_rect(
17418+ dec,
17419+ cdfs,
17420+ rect_inter_luma_set(tw, th),
17421+ (tw, th),
17422+ side,
17423+ 0,
17424+ neighbours.around_mi_rect(tu_mi, tw, th)[0],
17425+ mode_for_tx,
17426+ y,
17427+ tu_px,
17428+ tu_py,
17429+ &pred_y[start..],
17430+ None,
17431+ Some(tu_skip_ctx),
17432+ )?
17433+ };
1734317434 if idx == 0 {
1734417435 first_tx_type = tu_tx_type;
1734517436 }
17346- neighbours.record_mi_luma(tu_mi, tx_px, &tu_grid);
17437+ neighbours.record_mi_luma_rect(tu_mi, tw, th, &tu_grid);
1734717438 }
1734817439 // `av1_get_tx_type`'s chroma lookup scales the chroma
1734917440 // position back to luma, so an inter block's chroma
@@ -17367,6 +17458,7 @@ fn decode_inter_block(
1736717458 py,
1736817459 &pred_y,
1736917460 None,
17461+ None,
1737017462 )?;
1737117463 luma_tx_type = tx_type;
1737217464 luma_grid = embed_rect_grid(&grid, write_w, write_h, side);
@@ -17410,6 +17502,7 @@ fn decode_inter_block(
1741017502 cpy,
1741117503 &pred_u,
1741217504 Some(luma_tx_type),
17505+ None,
1741317506 )?
1741417507 .0,
1741517508 uw,
@@ -17431,6 +17524,7 @@ fn decode_inter_block(
1743117524 cpy,
1743217525 &pred_v,
1743317526 Some(luma_tx_type),
17527+ None,
1743417528 )?
1743517529 .0,
1743617530 uw,
@@ -18291,37 +18385,68 @@ fn decode_inter_block(
1829118385 // own slice of the block's motion-compensated predictor.
1829218386 let reduced = REDUCED_TX_SET_INTER.with(std::cell::Cell::get);
1829318387 let mut first_tx_type = TxType::DctDct;
18294- for (idx, &(row, col, tx_px)) in leaves.iter().enumerate() {
18388+ for (idx, &(row, col, tw, th)) in leaves.iter().enumerate() {
1829518389 let tu_mi = (at_mi.0 + row, at_mi.1 + col);
1829618390 let (tu_px, tu_py) = (px + col * MI, py + row * MI);
18297- let mut tu_pred = Vec::with_capacity(tx_px * tx_px);
18298- for rr in 0..tx_px {
18299- let start = (row * MI + rr) * side + col * MI;
18300- tu_pred.extend_from_slice(&pred_y[start..start + tx_px]);
18301- }
18302- let scan = default_scan(tx_px);
18303- let tu_skip_ctx = neighbours.luma_skip_ctx(tu_mi, tx_px / MI);
18304- let (tu_grid, tu_tx_type) = read_inter_plane(
18305- dec,
18306- cdfs,
18307- inter_txbset_for(tx_px, reduced),
18308- &scan,
18309- 0,
18310- neighbours.around_mi(tu_mi, tx_px)[0],
18311- mode_for_tx,
18312- y,
18313- tu_px,
18314- tu_py,
18315- tx_px,
18316- base_q_idx,
18317- &tu_pred,
18318- None,
18319- Some(tu_skip_ctx),
18320- )?;
18391+ let (tu_grid, tu_tx_type) = if tw == th {
18392+ let tx_px = tw;
18393+ let mut tu_pred = Vec::with_capacity(tx_px * tx_px);
18394+ for rr in 0..tx_px {
18395+ let start = (row * MI + rr) * side + col * MI;
18396+ tu_pred.extend_from_slice(&pred_y[start..start + tx_px]);
18397+ }
18398+ let scan = default_scan(tx_px);
18399+ let tu_skip_ctx = neighbours.luma_skip_ctx(tu_mi, tx_px / MI);
18400+ read_inter_plane(
18401+ dec,
18402+ cdfs,
18403+ inter_txbset_for(tx_px, reduced),
18404+ &scan,
18405+ 0,
18406+ neighbours.around_mi(tu_mi, tx_px)[0],
18407+ mode_for_tx,
18408+ y,
18409+ tu_px,
18410+ tu_py,
18411+ tx_px,
18412+ base_q_idx,
18413+ &tu_pred,
18414+ None,
18415+ Some(tu_skip_ctx),
18416+ )?
18417+ } else {
18418+ // lane-r14 r3: a 1:4 strip's `sub_tx_size_map`
18419+ // sub-transform is RECTANGULAR (TX_64X16 ->
18420+ // TX_32X16, TX_16X64 -> TX_16X32), so this leaf is
18421+ // read with the rect coefficient machinery, at its
18422+ // own `txb_skip_ctx`/neighbour spans -- the unit is
18423+ // smaller than its block, so `get_txb_ctx_general`'s
18424+ // neighbour table applies, not the lone-TU 0.
18425+ vartx_rect_leaf_hit(tw, th);
18426+ let tu_skip_ctx =
18427+ neighbours.luma_skip_ctx_rect(tu_mi, tw / MI, th / MI);
18428+ let start = row * MI * side + col * MI;
18429+ read_inter_plane_rect(
18430+ dec,
18431+ cdfs,
18432+ rect_inter_luma_set(tw, th),
18433+ (tw, th),
18434+ side,
18435+ 0,
18436+ neighbours.around_mi_rect(tu_mi, tw, th)[0],
18437+ mode_for_tx,
18438+ y,
18439+ tu_px,
18440+ tu_py,
18441+ &pred_y[start..],
18442+ None,
18443+ Some(tu_skip_ctx),
18444+ )?
18445+ };
1832118446 if idx == 0 {
1832218447 first_tx_type = tu_tx_type;
1832318448 }
18324- neighbours.record_mi_luma(tu_mi, tx_px, &tu_grid);
18449+ neighbours.record_mi_luma_rect(tu_mi, tw, th, &tu_grid);
1832518450 }
1832618451 // `av1_get_tx_type`'s chroma lookup scales the chroma
1832718452 // position back to luma, so an inter block's chroma
@@ -18345,6 +18470,7 @@ fn decode_inter_block(
1834518470 py,
1834618471 &pred_y,
1834718472 None,
18473+ None,
1834818474 )?;
1834918475 luma_tx_type = tx_type;
1835018476 luma_grid = embed_rect_grid(&grid, write_w, write_h, side);
@@ -18388,6 +18514,7 @@ fn decode_inter_block(
1838818514 cpy,
1838918515 &pred_u,
1839018516 Some(luma_tx_type),
18517+ None,
1839118518 )?
1839218519 .0,
1839318520 uw,
@@ -18409,6 +18536,7 @@ fn decode_inter_block(
1840918536 cpy,
1841018537 &pred_v,
1841118538 Some(luma_tx_type),
18539+ None,
1841218540 )?
1841318541 .0,
1841418542 uw,
@@ -18672,7 +18800,7 @@ fn decode_inter_block(
1867218800 let split_luma = vartx_leaves.is_some();
1867318801 if let Some(leaves) = vartx_leaves.clone() {
1867418802 let reduced = REDUCED_TX_SET_INTER.with(std::cell::Cell::get);
18675- for &(row, col, tx_px) in &leaves {
18803+ for &(row, col, tx_px, _) in &leaves {
1867618804 let tu_mi = (at_mi.0 + row, at_mi.1 + col);
1867718805 let (tu_px, tu_py) = (px + col * MI, py + row * MI);
1867818806 // A transform unit inside a block is not a block at that
@@ -18914,13 +19042,13 @@ fn decode_inter_block(
1891419042 // units, not the block. Chroma still reads `tx_h_grid / 2` (the block's
1891519043 // uv transform is not split) -- a known corner-cut of this round.
1891619044 if let Some(leaves) = &vartx_leaves {
18917- for &(row, col, tx_px) in leaves {
19045+ for &(row, col, tw, th) in leaves {
1891819046 neighbours.fill_lf_grid_rect(
1891919047 (at_mi.0 + row, at_mi.1 + col),
18920- tx_px / MI,
18921- tx_px / MI,
18922- tx_px as u8,
18923- tx_px as u8,
19048+ tw / MI,
19049+ th / MI,
19050+ tw as u8,
19051+ th as u8,
1892419052 if globalmv_for_lf {
1892519053 -ref_frame_for_lf
1892619054 } 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
@@ -84,10 +84,6 @@ const REFUSALS: &[&str] = &[
8484 "warp prediction with a scaled reference (superres, unimplemented)",
8585 "an 8x8 partition leaf under a scaled reference (superres, unimplemented)",
8686 "a motion_mode symbol for a block shape with no CDF row here",
87- // lane-r14 r2: the whole-transform case of every 64-axis inter strip is
88- // coded; only the SPLIT of a 1:4 strip with a 64-px axis is left, whose
89- // `sub_tx_size_map` entry is rectangular (TX_64X16 -> TX_32X16).
90- "a split transform on a 1:4 inter strip with a 64-px axis",
9187 ];
9288
9389 /// 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(),
@@ -6782,6 +6789,240 @@ mod tests {
67826789 }
67836790 }
67846791
6792+ /// lane-r14 r3: a 1:4 inter strip with a 64-px axis (64x16 / 16x64) whose
6793+ /// transform SPLITS -- the arm r2 left refused by name ("a split transform
6794+ /// on a 1:4 inter strip with a 64-px axis"). libaom's
6795+ /// `sub_tx_size_map[TX_64X16] == TX_32X16` (and `[TX_16X64] == TX_16X32`)
6796+ /// keeps the sub-transform RECTANGULAR, so the var-tx tree's leaves are
6797+ /// 32x16/16x32 units read through [`TxbSet::LumaRect32x16Inter`], each with
6798+ /// its own `get_txb_ctx_general` neighbour context (the unit is smaller
6799+ /// than its block, so `txb_skip_ctx` is NOT the lone-TU 0).
6800+ ///
6801+ /// `--enable-1to4-partitions=1 --min-partition-size=16
6802+ /// --max-partition-size=64 --enable-tx64=1` (each spelled once, last
6803+ /// occurrence wins) is what lets aomenc pick a superblock-level HORZ_4 /
6804+ /// VERT_4; the textured translating source is what keeps the strips
6805+ /// non-skip so the residual is actually coded. 8-bit AND 10-bit, every
6806+ /// decoded frame compared to ffmpeg on Y/U/V, refusals counted (never
6807+ /// SKIPped), attempts that carried no rectangular var-tx leaf counted
6808+ /// separately and still required pixel-exact.
6809+ #[test]
6810+ fn real_aomenc_1to4_streams_decode_pixel_exact_and_rect_vartx_leaves_fire_before_a_named_refusal() {
6811+ const NAME: &str =
6812+ "real_aomenc_1to4_streams_decode_pixel_exact_and_rect_vartx_leaves_fire_before_a_named_refusal";
6813+ let _gate_lock = lock_gate_counters();
6814+ if !have_ffmpeg() {
6815+ eprintln!("SKIP {NAME}: no ffmpeg");
6816+ return;
6817+ }
6818+ if !have_aomenc() {
6819+ eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display());
6820+ return;
6821+ }
6822+ let frame_count = 6usize;
6823+ for bit_depth in [8u32, 10u32] {
6824+ let (mut named_refusals, mut compared, mut out_of_scope, mut oos_mismatch) =
6825+ (0u32, 0u32, 0u32, 0u32);
6826+ let (mut leaf_32x16, mut leaf_16x32) = (0usize, 0usize);
6827+ // Leaves decoded on ANY attempt, including one whose stream hits a
6828+ // later named refusal: the firing half of this gate, kept apart
6829+ // from `leaf_32x16`/`leaf_16x32` (pixel-compared attempts only) so
6830+ // a refused stream is never counted as a pixel proof
6831+ // (class counter-from-refused-stream).
6832+ let (mut fired_32x16, mut fired_16x32) = (0usize, 0usize);
6833+ for attempt in 0..18u32 {
6834+ // Two orientations (the transposed pair a one-sided gate could
6835+ // never separate) x four quantisers x two motion steps.
6836+ // lane-r14 r4 recipe hunt (~70 aomenc runs on the merged
6837+ // tree: testsrc2 / life / mandelbrot / banded motion, 64x64 up
6838+ // to 384x256, cq 20..58): attempts 16-17 carry the only recipe
6839+ // found that makes aomenc code a 64-axis 1:4 strip whose
6840+ // transform SPLITS -- 384x256, per-16-column band motion,
6841+ // cq 32 (16x32 leaves) and cq 38 (32x16 leaves).
6842+ let firing = attempt >= 16;
6843+ let (width, height) =
6844+ if firing { (384usize, 256usize) } else { (192usize, 128usize) };
6845+ let vertical = attempt % 2 == 1;
6846+ let cq = if firing {
6847+ [32, 38][(attempt - 16) as usize]
6848+ } else {
6849+ [30, 36, 44, 52][(attempt / 2 % 4) as usize]
6850+ };
6851+ let sp = 3 + (attempt / 8) * 3;
6852+ // 16-pixel bands, each band translating at its OWN speed
6853+ // across the other axis: that is what makes aomenc's RD split
6854+ // a 64x64 superblock into four 1:4 strips (`PARTITION_HORZ_4`
6855+ // / `VERT_4`) with distinct motion vectors, and the texture
6856+ // inside a band is what keeps the strip non-skip and its
6857+ // transform split.
6858+ let geq = if firing {
6859+ "128+60*sin((Y-N*(1+0.37*mod(floor(X/16),4)))/3)+45*sin(Y/17+X/23)"
6860+ .to_string()
6861+ } else if vertical {
6862+ format!(
6863+ "128+60*sin((Y+N*({sp}+9*mod(floor(X/16),2)))/7)+25*sin(X/11)"
6864+ )
6865+ } else {
6866+ format!(
6867+ "128+60*sin((X+N*({sp}+9*mod(floor(Y/16),2)))/7)+25*sin(Y/11)"
6868+ )
6869+ };
6870+ let duration = frame_count as f64 / 25.0;
6871+ let source = format!(
6872+ "color=c=gray:s={width}x{height}:d={duration}:r=25,format=gray,\
6873+ geq=lum='{geq}',format=yuv420p"
6874+ );
6875+ let pix_fmt = if bit_depth == 10 { "yuv420p10le" } else { "yuv420p" };
6876+ let y4m = Command::new("ffmpeg")
6877+ .args([
6878+ "-v", "error", "-f", "lavfi", "-i", &source, "-t", &duration.to_string(),
6879+ "-pix_fmt", pix_fmt, "-strict", "-1", "-f", "yuv4mpegpipe", "-",
6880+ ])
6881+ .stdin(Stdio::null())
6882+ .stdout(Stdio::piped())
6883+ .stderr(Stdio::piped())
6884+ .output()
6885+ .expect("ffmpeg failed to run");
6886+ assert!(
6887+ y4m.status.success(),
6888+ "{NAME}: ffmpeg refused the {bit_depth}-bit fixture: {}",
6889+ String::from_utf8_lossy(&y4m.stderr)
6890+ );
6891+ let cq_arg = format!("--cq-level={cq}");
6892+ let depth_arg = format!("--bit-depth={bit_depth}");
6893+ let input_depth_arg = format!("--input-bit-depth={bit_depth}");
6894+ let args: Vec<&str> = vec![
6895+ "--codec=av1", "--passes=1", "--end-usage=q", &cq_arg, "--cpu-used=0",
6896+ "--threads=1", "--row-mt=0", "--sb-size=64", &depth_arg, &input_depth_arg,
6897+ "--enable-restoration=0", "--enable-palette=0", "--deltaq-mode=0",
6898+ "--enable-filter-intra=0", "--enable-cfl-intra=0", "--enable-intrabc=0",
6899+ "--lag-in-frames=0",
6900+ // Per-arm overrides go LAST: aomenc keeps the last
6901+ // occurrence of a repeated --enable-* flag.
6902+ "--enable-tx64=1", "--enable-rect-partitions=1",
6903+ "--enable-ab-partitions=0", "--enable-1to4-partitions=1",
6904+ "--enable-dual-filter=0", "--enable-obmc=0",
6905+ "--min-partition-size=16", "--max-partition-size=64",
6906+ "--obu", "-o", "-", "-",
6907+ ];
6908+ let mut child = Command::new(aomenc_path())
6909+ .args(&args)
6910+ .stdin(Stdio::piped())
6911+ .stdout(Stdio::piped())
6912+ .stderr(Stdio::piped())
6913+ .spawn()
6914+ .expect("aomenc failed to start");
6915+ child
6916+ .stdin
6917+ .take()
6918+ .expect("aomenc stdin")
6919+ .write_all(&y4m.stdout)
6920+ .expect("writing y4m to aomenc");
6921+ let out = child.wait_with_output().expect("aomenc failed to run");
6922+ assert!(
6923+ out.status.success(),
6924+ "aomenc refused the fixture: {}",
6925+ String::from_utf8_lossy(&out.stderr)
6926+ );
6927+ let stream = out.stdout;
6928+ let before = crate::stream::vartx_rect_leaf_hits();
6929+ let frames = match decode_stream(&stream) {
6930+ Err(e) => {
6931+ let msg = e.to_string();
6932+ assert!(
6933+ msg.contains("unsupported"),
6934+ "{NAME} failed outright, not a named refusal ({bit_depth}-bit, \
6935+ attempt {attempt}): {msg}"
6936+ );
6937+ let after = crate::stream::vartx_rect_leaf_hits();
6938+ fired_32x16 += after[0] - before[0];
6939+ fired_16x32 += after[1] - before[1];
6940+ named_refusals += 1;
6941+ eprintln!(
6942+ "{bit_depth}-bit attempt {attempt} refusal (rect var-tx leaves \
6943+ decoded before it: 32x16={}, 16x32={}): {msg}",
6944+ after[0] - before[0],
6945+ after[1] - before[1]
6946+ );
6947+ continue;
6948+ }
6949+ Ok(frames) => frames,
6950+ };
6951+ let after = crate::stream::vartx_rect_leaf_hits();
6952+ let (h32, v32) = (after[0] - before[0], after[1] - before[1]);
6953+ fired_32x16 += h32;
6954+ fired_16x32 += v32;
6955+ let ffmpeg_frames = if bit_depth == 10 {
6956+ ffmpeg_decode_sequence_10bit(&stream, width, height, frame_count)
6957+ } else {
6958+ ffmpeg_decode_sequence(&stream, width, height, frame_count)
6959+ };
6960+ assert_eq!(frames.len(), frame_count);
6961+ let mismatched = frames
6962+ .iter()
6963+ .zip(&ffmpeg_frames)
6964+ .any(|(got, want)| got.y != want.y || got.u != want.u || got.v != want.v);
6965+ if h32 + v32 == 0 {
6966+ // Counted per ATTEMPT, on a decoded+compared attempt only
6967+ // (class counter-from-refused-stream).
6968+ out_of_scope += 1;
6969+ if mismatched {
6970+ oos_mismatch += 1;
6971+ eprintln!(
6972+ "{NAME}: {bit_depth}-bit attempt {attempt} MISMATCHES with zero \
6973+ rectangular var-tx leaves -- another shape's defect"
6974+ );
6975+ }
6976+ continue;
6977+ }
6978+ for (i, (got, want)) in frames.iter().zip(&ffmpeg_frames).enumerate() {
6979+ assert_eq!(got.y, want.y, "{NAME} frame {i} luma vs ffmpeg (attempt {attempt}, {bit_depth}-bit)");
6980+ assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (attempt {attempt}, {bit_depth}-bit)");
6981+ assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (attempt {attempt}, {bit_depth}-bit)");
6982+ }
6983+ leaf_32x16 += h32;
6984+ leaf_16x32 += v32;
6985+ compared += 1;
6986+ }
6987+ eprintln!(
6988+ "{NAME} ({bit_depth}-bit): {named_refusals} named refusals, {compared} \
6989+ pixel-exact attempts carrying the arm, pixel-compared rect var-tx leaves \
6990+ 32x16={leaf_32x16} 16x32={leaf_16x32}, leaves decoded anywhere in the sweep \
6991+ 32x16={fired_32x16} 16x32={fired_16x32}, {out_of_scope} attempts carried none \
6992+ ({oos_mismatch} of them mismatched)"
6993+ );
6994+ assert_eq!(
6995+ oos_mismatch, 0,
6996+ "{NAME}: {oos_mismatch} attempt(s) with no rectangular var-tx leaf decoded \
6997+ but mismatched ffmpeg -- a defect of another shape, not a pass"
6998+ );
6999+ assert!(
7000+ compared + out_of_scope > 0,
7001+ "{NAME} ({bit_depth}-bit): every attempt refused -- the gate compared no pixels"
7002+ );
7003+ // The firing half. MEASURED on the merged tree (lane-r14 r4, ~70
7004+ // aomenc runs): the 8-bit 384x256 banded recipe codes BOTH
7005+ // orientations of the split -- cq 38 gives four 32x16 leaves (out
7006+ // of four 64x16 strips), cq 32 one 16x32 leaf (out of four 16x64
7007+ // strips). Those two streams stop LATER on another lane's live
7008+ // refusal ("an inter 16x16-level AB or 1:4 partition", "a non-skip
7009+ // rectangular (HORZ/VERT/HORZ_B) strip needs rectangular residual
7010+ // coding"), so the leaves are proved DECODED, not proved
7011+ // pixel-exact; every attempt that ran to the end is compared
7012+ // frame by frame above. At 10 bits the same sweep fires nothing
7013+ // (aomenc picks other shapes), so the firing assert is 8-bit only
7014+ // -- and it is a hard assert, never a print.
7015+ if bit_depth == 8 {
7016+ assert!(
7017+ fired_32x16 > 0 && fired_16x32 > 0,
7018+ "{NAME}: the rectangular var-tx leaf arm never fired (32x16={fired_32x16}, \
7019+ 16x32={fired_16x32}, {named_refusals} refusals, {compared} compared) -- \
7020+ `sub_tx_size_map[TX_64X16] == TX_32X16` is unproved by this gate"
7021+ );
7022+ }
7023+ }
7024+ }
7025+
67857026 /// lane-inter4 r2: the 32x32-level inter `PARTITION_HORZ`/`PARTITION_VERT`
67867027 /// strips (32x16 / 16x32) carrying a REAL residual -- the capability r1
67877028 /// 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.