Merge branch 'lane-r14' (b86eb38) into lane-intrasplit: general rect read_var_tx_size + the 64-axis 1:4 split-transform gate, kept alongside the no-CFL uv_mode gates
Browse files at this commit7 changed files +660 -107
- crates/ec-av1/examples/decode_probe.rs +2 -0
- crates/ec-av1/src/decode.rs +226 -98
- crates/ec-av1/src/gate_coverage.rs +0 -5
- crates/ec-av1/src/refusal_inventory.rs +0 -4
- crates/ec-av1/src/stream.rs +241 -0
- lanes/r14-r3.report.md +104 -0
- lanes/r14-r4.report.md +87 -0
crates/ec-av1/examples/decode_probe.rsmodified+2 -0
| @@ -35,6 +35,8 @@ fn main() { | |||
| 35 | println!("rect4_32: horz={h} vert={v} coded={c}"); | 35 | println!("rect4_32: horz={h} vert={v} coded={c}"); |
| 36 | let (rtu, rsplit, robmc) = ec_av1::stream::rect_inter_tu_counters(); | 36 | let (rtu, rsplit, robmc) = ec_av1::stream::rect_inter_tu_counters(); |
| 37 | println!("rect_inter: tu={rtu} txsplit={rsplit} obmc_leaf={robmc}"); | 37 | 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]); | ||
| 38 | let ir = ec_av1::stream::inter_rect_counters(); | 40 | let ir = ec_av1::stream::inter_rect_counters(); |
| 39 | println!( | 41 | println!( |
| 40 | "inter_rect: 32x8={} 8x32={} 64x32={} 32x64={} 64x16={} 16x64={}", | 42 | "inter_rect: 32x8={} 8x32={} 64x32={} 32x64={} 64x16={} 16x64={}", |
crates/ec-av1/src/decode.rsmodified+226 -98
| @@ -997,6 +997,8 @@ thread_local! { | |||
| 997 | // (64x32/32x64/64x16/16x64), whose coefficients are coded as the | 997 | // (64x32/32x64/64x16/16x64), whose coefficients are coded as the |
| 998 | // truncated low-32 corner. | 998 | // truncated low-32 corner. |
| 999 | static RECT64_INTER_TU_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | 999 | 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]) }; | ||
| 1000 | // lane-inter4 r3: 16x16-level PARTITION_HORZ / PARTITION_VERT on an inter | 1002 | // lane-inter4 r3: 16x16-level PARTITION_HORZ / PARTITION_VERT on an inter |
| 1001 | // frame -- 16x8 and 8x16 inter leaves. | 1003 | // frame -- 16x8 and 8x16 inter leaves. |
| 1002 | static INTER_LEAF16_HORZ_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | 1004 | 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 { | |||
| 1049 | RECT64_INTER_TU_HITS.with(|c| c.get()) | 1051 | RECT64_INTER_TU_HITS.with(|c| c.get()) |
| 1050 | } | 1052 | } |
| 1051 | 1053 | ||
| 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 | + | ||
| 1052 | /// Sets the current thread's [`TX_SELECT_INTER`]/[`REDUCED_TX_SET_INTER`]/ | 1069 | /// Sets the current thread's [`TX_SELECT_INTER`]/[`REDUCED_TX_SET_INTER`]/ |
| 1053 | /// [`ENABLE_FILTER_INTRA_INTER`]. | 1070 | /// [`ENABLE_FILTER_INTRA_INTER`]. |
| 1054 | pub(crate) fn set_inter_tx_mode( | 1071 | pub(crate) fn set_inter_tx_mode( |
| @@ -11551,6 +11568,46 @@ const TXFM_CTX_INIT: u8 = 64; | |||
| 11551 | /// twice below its own largest transform. | 11568 | /// twice below its own largest transform. |
| 11552 | const MAX_VARTX_DEPTH: usize = 2; | 11569 | const MAX_VARTX_DEPTH: usize = 2; |
| 11553 | 11570 | ||
| 11571 | +/// libaom `sub_tx_size_map[TX_SIZES_ALL]` (`common_data.c`): the transform | ||
| 11572 | +/// one `txfm_split` step below `tx_size`. RECTANGULAR for the 1:4 shapes | ||
| 11573 | +/// (`[TX_64X16] == TX_32X16`, `[TX_16X64] == TX_16X32`) and for the 4:1 | ||
| 11574 | +/// small ones, square everywhere else. | ||
| 11575 | +fn sub_tx_size_map(tx_w: usize, tx_h: usize) -> (usize, usize) { | ||
| 11576 | + match (tx_w, tx_h) { | ||
| 11577 | + (4, 4) => (4, 4), | ||
| 11578 | + (8, 8) => (4, 4), | ||
| 11579 | + (16, 16) => (8, 8), | ||
| 11580 | + (32, 32) => (16, 16), | ||
| 11581 | + (64, 64) => (32, 32), | ||
| 11582 | + (4, 8) | (8, 4) => (4, 4), | ||
| 11583 | + (8, 16) | (16, 8) => (8, 8), | ||
| 11584 | + (16, 32) | (32, 16) => (16, 16), | ||
| 11585 | + (32, 64) | (64, 32) => (32, 32), | ||
| 11586 | + (4, 16) => (4, 8), | ||
| 11587 | + (16, 4) => (8, 4), | ||
| 11588 | + (8, 32) => (8, 16), | ||
| 11589 | + (32, 8) => (16, 8), | ||
| 11590 | + (16, 64) => (16, 32), | ||
| 11591 | + (64, 16) => (32, 16), | ||
| 11592 | + _ => unreachable!("not a TX_SIZES_ALL shape: {tx_w}x{tx_h}"), | ||
| 11593 | + } | ||
| 11594 | +} | ||
| 11595 | + | ||
| 11596 | +#[test] | ||
| 11597 | +fn sub_tx_size_map_matches_libaom() { | ||
| 11598 | + // libaom `common_data.c` `sub_tx_size_map`, in TX_SIZES_ALL order. | ||
| 11599 | + const TABLE: [((usize, usize), (usize, usize)); 19] = [ | ||
| 11600 | + ((4, 4), (4, 4)), ((8, 8), (4, 4)), ((16, 16), (8, 8)), ((32, 32), (16, 16)), | ||
| 11601 | + ((64, 64), (32, 32)), ((4, 8), (4, 4)), ((8, 4), (4, 4)), ((8, 16), (8, 8)), | ||
| 11602 | + ((16, 8), (8, 8)), ((16, 32), (16, 16)), ((32, 16), (16, 16)), ((32, 64), (32, 32)), | ||
| 11603 | + ((64, 32), (32, 32)), ((4, 16), (4, 8)), ((16, 4), (8, 4)), ((8, 32), (8, 16)), | ||
| 11604 | + ((32, 8), (16, 8)), ((16, 64), (16, 32)), ((64, 16), (32, 16)), | ||
| 11605 | + ]; | ||
| 11606 | + for (tx, want) in TABLE { | ||
| 11607 | + assert_eq!(sub_tx_size_map(tx.0, tx.1), want, "sub_tx_size_map({tx:?})"); | ||
| 11608 | + } | ||
| 11609 | +} | ||
| 11610 | + | ||
| 11554 | /// `read_var_tx_size` (spec 5.11.17, libaom `decodeframe.c` | 11611 | /// `read_var_tx_size` (spec 5.11.17, libaom `decodeframe.c` |
| 11555 | /// `read_tx_size_vartx`): the recursive `txfm_split` tree of one | 11612 | /// `read_tx_size_vartx`): the recursive `txfm_split` tree of one |
| 11556 | /// max-transform-sized unit of an inter block, collecting the resolved leaf | 11613 | /// max-transform-sized unit of an inter block, collecting the resolved leaf |
| @@ -11567,22 +11624,28 @@ fn read_var_tx_size( | |||
| 11567 | at_mi: (usize, usize), | 11624 | at_mi: (usize, usize), |
| 11568 | blk_max_px: usize, | 11625 | blk_max_px: usize, |
| 11569 | (max_w_mi, max_h_mi): (usize, usize), | 11626 | (max_w_mi, max_h_mi): (usize, usize), |
| 11570 | - tx_px: usize, | 11627 | + (tx_w, tx_h): (usize, usize), |
| 11571 | depth: usize, | 11628 | depth: usize, |
| 11572 | blk_row: usize, | 11629 | blk_row: usize, |
| 11573 | blk_col: usize, | 11630 | blk_col: usize, |
| 11574 | - out: &mut Vec<(usize, usize, usize)>, | 11631 | + out: &mut Vec<(usize, usize, usize, usize)>, |
| 11575 | ) { | 11632 | ) { |
| 11576 | if blk_row >= max_h_mi || blk_col >= max_w_mi { | 11633 | if blk_row >= max_h_mi || blk_col >= max_w_mi { |
| 11577 | return; | 11634 | return; |
| 11578 | } | 11635 | } |
| 11579 | let unit = (at_mi.0 + blk_row, at_mi.1 + blk_col); | 11636 | let unit = (at_mi.0 + blk_row, at_mi.1 + blk_col); |
| 11580 | if depth == MAX_VARTX_DEPTH { | 11637 | if depth == MAX_VARTX_DEPTH { |
| 11581 | - out.push((blk_row, blk_col, tx_px)); | 11638 | + out.push((blk_row, blk_col, tx_w, tx_h)); |
| 11582 | - txfm_partition_update(n, unit, tx_px, tx_px); | 11639 | + txfm_partition_update_rect(n, unit, (tx_w, tx_h), (tx_w, tx_h)); |
| 11583 | return; | 11640 | return; |
| 11584 | } | 11641 | } |
| 11585 | - let ctx = txfm_partition_ctx(n.above_txfm[unit.1], n.left_txfm[unit.0], blk_max_px, tx_px); | 11642 | + let ctx = txfm_partition_ctx_rect( |
| 11643 | + n.above_txfm[unit.1], | ||
| 11644 | + n.left_txfm[unit.0], | ||
| 11645 | + blk_max_px, | ||
| 11646 | + tx_w, | ||
| 11647 | + tx_h, | ||
| 11648 | + ); | ||
| 11586 | let split = dec.symbol(&mut cdfs.txfm_partition[ctx]) == 1; | 11649 | let split = dec.symbol(&mut cdfs.txfm_partition[ctx]) == 1; |
| 11587 | TXFM_SPLIT_READS.with(|c| c.set(c.get() + 1)); | 11650 | TXFM_SPLIT_READS.with(|c| c.set(c.get() + 1)); |
| 11588 | if std::env::var_os("EC_TRACE_MODE_STEP").is_some() { | 11651 | if std::env::var_os("EC_TRACE_MODE_STEP").is_some() { |
| @@ -11595,27 +11658,27 @@ fn read_var_tx_size( | |||
| 11595 | ); | 11658 | ); |
| 11596 | } | 11659 | } |
| 11597 | if !split { | 11660 | if !split { |
| 11598 | - out.push((blk_row, blk_col, tx_px)); | 11661 | + out.push((blk_row, blk_col, tx_w, tx_h)); |
| 11599 | - txfm_partition_update(n, unit, tx_px, tx_px); | 11662 | + txfm_partition_update_rect(n, unit, (tx_w, tx_h), (tx_w, tx_h)); |
| 11600 | return; | 11663 | return; |
| 11601 | } | 11664 | } |
| 11602 | TXFM_SPLIT_HITS.with(|c| c.set(c.get() + 1)); | 11665 | TXFM_SPLIT_HITS.with(|c| c.set(c.get() + 1)); |
| 11603 | - let sub = tx_px / 2; | 11666 | + let (sub_w, sub_h) = sub_tx_size_map(tx_w, tx_h); |
| 11604 | - if sub == 4 { | 11667 | + if (sub_w, sub_h) == (4, 4) { |
| 11605 | - // libaom's `sub_txs == TX_4X4` early return: the whole 8x8 unit is | 11668 | + // libaom's `sub_txs == TX_4X4` early return: every mi cell of the |
| 11606 | - // marked 4x4 (four transform units, raster order) without recursing. | 11669 | + // unit is marked 4x4 (raster order) without recursing. |
| 11607 | - for row in 0..2 { | 11670 | + for row in 0..tx_h / MI { |
| 11608 | - for col in 0..2 { | 11671 | + for col in 0..tx_w / MI { |
| 11609 | if blk_row + row < max_h_mi && blk_col + col < max_w_mi { | 11672 | if blk_row + row < max_h_mi && blk_col + col < max_w_mi { |
| 11610 | - out.push((blk_row + row, blk_col + col, 4)); | 11673 | + out.push((blk_row + row, blk_col + col, 4, 4)); |
| 11611 | } | 11674 | } |
| 11612 | } | 11675 | } |
| 11613 | } | 11676 | } |
| 11614 | - txfm_partition_update(n, unit, 4, tx_px); | 11677 | + txfm_partition_update_rect(n, unit, (4, 4), (tx_w, tx_h)); |
| 11615 | return; | 11678 | return; |
| 11616 | } | 11679 | } |
| 11617 | - for row in (0..tx_px / MI).step_by(sub / MI) { | 11680 | + for row in (0..tx_h / MI).step_by(sub_h / MI) { |
| 11618 | - for col in (0..tx_px / MI).step_by(sub / MI) { | 11681 | + for col in (0..tx_w / MI).step_by(sub_w / MI) { |
| 11619 | read_var_tx_size( | 11682 | read_var_tx_size( |
| 11620 | dec, | 11683 | dec, |
| 11621 | cdfs, | 11684 | cdfs, |
| @@ -11623,7 +11686,7 @@ fn read_var_tx_size( | |||
| 11623 | at_mi, | 11686 | at_mi, |
| 11624 | blk_max_px, | 11687 | blk_max_px, |
| 11625 | (max_w_mi, max_h_mi), | 11688 | (max_w_mi, max_h_mi), |
| 11626 | - sub, | 11689 | + (sub_w, sub_h), |
| 11627 | depth + 1, | 11690 | depth + 1, |
| 11628 | blk_row + row, | 11691 | blk_row + row, |
| 11629 | blk_col + col, | 11692 | blk_col + col, |
| @@ -11651,7 +11714,7 @@ fn read_block_tx_size( | |||
| 11651 | (mi_cols, mi_rows): (usize, usize), | 11714 | (mi_cols, mi_rows): (usize, usize), |
| 11652 | is_inter: bool, | 11715 | is_inter: bool, |
| 11653 | skip: bool, | 11716 | skip: bool, |
| 11654 | -) -> Result<(usize, Option<Vec<(usize, usize, usize)>>)> { | 11717 | +) -> Result<(usize, Option<Vec<(usize, usize, usize, usize)>>)> { |
| 11655 | if !TX_SELECT_INTER.with(std::cell::Cell::get) { | 11718 | if !TX_SELECT_INTER.with(std::cell::Cell::get) { |
| 11656 | return Ok((side, None)); | 11719 | return Ok((side, None)); |
| 11657 | } | 11720 | } |
| @@ -11671,7 +11734,7 @@ fn read_block_tx_size( | |||
| 11671 | at_mi, | 11734 | at_mi, |
| 11672 | side, | 11735 | side, |
| 11673 | (max_w_mi, max_h_mi), | 11736 | (max_w_mi, max_h_mi), |
| 11674 | - max_tx, | 11737 | + (max_tx, max_tx), |
| 11675 | 0, | 11738 | 0, |
| 11676 | row, | 11739 | row, |
| 11677 | col, | 11740 | col, |
| @@ -11679,8 +11742,8 @@ fn read_block_tx_size( | |||
| 11679 | ); | 11742 | ); |
| 11680 | } | 11743 | } |
| 11681 | } | 11744 | } |
| 11682 | - let single = leaves.len() == 1 && leaves[0].2 == side; | 11745 | + let single = leaves.len() == 1 && leaves[0].2 == side && leaves[0].3 == side; |
| 11683 | - if !single && leaves.iter().any(|leaf| leaf.2 > 32) { | 11746 | + if !single && leaves.iter().any(|leaf| leaf.2.max(leaf.3) > 32) { |
| 11684 | // Only a block wider than a superblock's own 64x64 max transform | 11747 | // Only a block wider than a superblock's own 64x64 max transform |
| 11685 | // reaches here; this crate has no 64-point *inter* coefficient | 11748 | // reaches here; this crate has no 64-point *inter* coefficient |
| 11686 | // table set ([`inter_txbset_for`] stops at 32). | 11749 | // table set ([`inter_txbset_for`] stops at 32). |
| @@ -11718,7 +11781,7 @@ fn read_block_tx_size( | |||
| 11718 | let mut leaves = Vec::new(); | 11781 | let mut leaves = Vec::new(); |
| 11719 | for row in (0..side_mi).step_by(step) { | 11782 | for row in (0..side_mi).step_by(step) { |
| 11720 | for col in (0..side_mi).step_by(step) { | 11783 | for col in (0..side_mi).step_by(step) { |
| 11721 | - leaves.push((row, col, tx)); | 11784 | + leaves.push((row, col, tx, tx)); |
| 11722 | } | 11785 | } |
| 11723 | } | 11786 | } |
| 11724 | INTRA_IN_INTER_SPLIT_TX_HITS.with(|c| { | 11787 | INTRA_IN_INTER_SPLIT_TX_HITS.with(|c| { |
| @@ -11870,7 +11933,7 @@ fn read_block_tx_size_rect( | |||
| 11870 | (bw, bh): (usize, usize), | 11933 | (bw, bh): (usize, usize), |
| 11871 | (mi_cols, mi_rows): (usize, usize), | 11934 | (mi_cols, mi_rows): (usize, usize), |
| 11872 | skip: bool, | 11935 | skip: bool, |
| 11873 | -) -> Result<Option<Vec<(usize, usize, usize)>>> { | 11936 | +) -> Result<Option<Vec<(usize, usize, usize, usize)>>> { |
| 11874 | if skip { | 11937 | if skip { |
| 11875 | // `set_txfm_ctxs(.., skip && is_inter)`: a skipped inter block records | 11938 | // `set_txfm_ctxs(.., skip && is_inter)`: a skipped inter block records |
| 11876 | // its own BLOCK size -- width above, height left -- not a transform. | 11939 | // its own BLOCK size -- width above, height left -- not a transform. |
| @@ -11913,22 +11976,16 @@ fn read_block_tx_size_rect( | |||
| 11913 | } | 11976 | } |
| 11914 | TXFM_SPLIT_HITS.with(|c| c.set(c.get() + 1)); | 11977 | TXFM_SPLIT_HITS.with(|c| c.set(c.get() + 1)); |
| 11915 | RECT_INTER_TXSPLIT_HITS.with(|c| c.set(c.get() + 1)); | 11978 | RECT_INTER_TXSPLIT_HITS.with(|c| c.set(c.get() + 1)); |
| 11916 | - // lane-r14 r2: `sub_tx_size_map` is square for every shape this decoder | 11979 | + // lane-r14 r3: `sub_tx_size_map` (libaom `common_data.c`) stays |
| 11917 | - // splits (TX_32X16 -> TX_16X16, TX_64X32 -> TX_32X32) EXCEPT the 1:4 | 11980 | + // RECTANGULAR under a 1:4 strip -- `[TX_64X16] == TX_32X16`, |
| 11918 | - // strips with a 64-px axis, where it stays rectangular | 11981 | + // `[TX_16X64] == TX_16X32` -- so the recursion below is the general |
| 11919 | - // (TX_64X16 -> TX_32X16, TX_16X64 -> TX_16X32) and the square recursion | 11982 | + // rect one and its leaves carry their own width and height. |
| 11920 | - // below would code the wrong tree. | 11983 | + let (sub_w, sub_h) = sub_tx_size_map(tx_w, tx_h); |
| 11921 | - if tx_w.max(tx_h) == 64 && tx_w.min(tx_h) == 16 { | ||
| 11922 | - return Err(unsupported( | ||
| 11923 | - "a split transform on a 1:4 inter strip with a 64-px axis", | ||
| 11924 | - )); | ||
| 11925 | - } | ||
| 11926 | - let sub = tx_w.min(tx_h); | ||
| 11927 | let max_w_mi = (bw / MI).min(mi_cols.saturating_sub(at_mi.1)); | 11984 | let max_w_mi = (bw / MI).min(mi_cols.saturating_sub(at_mi.1)); |
| 11928 | let max_h_mi = (bh / MI).min(mi_rows.saturating_sub(at_mi.0)); | 11985 | let max_h_mi = (bh / MI).min(mi_rows.saturating_sub(at_mi.0)); |
| 11929 | let mut leaves = Vec::new(); | 11986 | let mut leaves = Vec::new(); |
| 11930 | - for row in (0..bh / MI).step_by(sub / MI) { | 11987 | + for row in (0..bh / MI).step_by(sub_h / MI) { |
| 11931 | - for col in (0..bw / MI).step_by(sub / MI) { | 11988 | + for col in (0..bw / MI).step_by(sub_w / MI) { |
| 11932 | read_var_tx_size( | 11989 | read_var_tx_size( |
| 11933 | dec, | 11990 | dec, |
| 11934 | cdfs, | 11991 | cdfs, |
| @@ -11936,7 +11993,7 @@ fn read_block_tx_size_rect( | |||
| 11936 | at_mi, | 11993 | at_mi, |
| 11937 | bw.max(bh), | 11994 | bw.max(bh), |
| 11938 | (max_w_mi, max_h_mi), | 11995 | (max_w_mi, max_h_mi), |
| 11939 | - sub, | 11996 | + (sub_w, sub_h), |
| 11940 | 1, | 11997 | 1, |
| 11941 | row, | 11998 | row, |
| 11942 | col, | 11999 | col, |
| @@ -11973,9 +12030,12 @@ fn read_inter_plane_rect( | |||
| 11973 | y: usize, | 12030 | y: usize, |
| 11974 | prediction: &[u16], | 12031 | prediction: &[u16], |
| 11975 | inherited_luma_tx_type: Option<TxType>, | 12032 | inherited_luma_tx_type: Option<TxType>, |
| 12033 | + luma_skip_ctx: Option<usize>, | ||
| 11976 | ) -> Result<(Vec<i32>, TxType)> { | 12034 | ) -> Result<(Vec<i32>, TxType)> { |
| 11977 | let skip_ctx = if plane_idx == 0 { | 12035 | let skip_ctx = if plane_idx == 0 { |
| 11978 | - 0 | 12036 | + // `get_txb_ctx_general`: 0 only when this unit IS the whole plane |
| 12037 | + // block; a var-tx leaf passes its own neighbour-table context. | ||
| 12038 | + luma_skip_ctx.unwrap_or(0) | ||
| 11979 | } else { | 12039 | } else { |
| 11980 | usize::from(around.0) + usize::from(around.1) | 12040 | usize::from(around.0) + usize::from(around.1) |
| 11981 | }; | 12041 | }; |
| @@ -16592,7 +16652,7 @@ fn decode_inter_block( | |||
| 16592 | // 5.11.17), `Some` only when this block's var-tx tree resolved to more | 16652 | // 5.11.17), `Some` only when this block's var-tx tree resolved to more |
| 16593 | // than one luma transform -- read back by the residual loop, the | 16653 | // than one luma transform -- read back by the residual loop, the |
| 16594 | // coefficient-context write-back and the loop-filter grid fill below. | 16654 | // coefficient-context write-back and the loop-filter grid fill below. |
| 16595 | - let mut vartx_leaves: Option<Vec<(usize, usize, usize)>> = None; | 16655 | + let mut vartx_leaves: Option<Vec<(usize, usize, usize, usize)>> = None; |
| 16596 | let at_mi = at; | 16656 | let at_mi = at; |
| 16597 | if is_inter { | 16657 | if is_inter { |
| 16598 | let above_nbr = has_above.then(|| NeighbourRef { | 16658 | let above_nbr = has_above.then(|| NeighbourRef { |
| @@ -17447,37 +17507,68 @@ fn decode_inter_block( | |||
| 17447 | // own slice of the block's motion-compensated predictor. | 17507 | // own slice of the block's motion-compensated predictor. |
| 17448 | let reduced = REDUCED_TX_SET_INTER.with(std::cell::Cell::get); | 17508 | let reduced = REDUCED_TX_SET_INTER.with(std::cell::Cell::get); |
| 17449 | let mut first_tx_type = TxType::DctDct; | 17509 | let mut first_tx_type = TxType::DctDct; |
| 17450 | - for (idx, &(row, col, tx_px)) in leaves.iter().enumerate() { | 17510 | + for (idx, &(row, col, tw, th)) in leaves.iter().enumerate() { |
| 17451 | let tu_mi = (at_mi.0 + row, at_mi.1 + col); | 17511 | let tu_mi = (at_mi.0 + row, at_mi.1 + col); |
| 17452 | let (tu_px, tu_py) = (px + col * MI, py + row * MI); | 17512 | let (tu_px, tu_py) = (px + col * MI, py + row * MI); |
| 17453 | - let mut tu_pred = Vec::with_capacity(tx_px * tx_px); | 17513 | + let (tu_grid, tu_tx_type) = if tw == th { |
| 17454 | - for rr in 0..tx_px { | 17514 | + let tx_px = tw; |
| 17455 | - let start = (row * MI + rr) * side + col * MI; | 17515 | + let mut tu_pred = Vec::with_capacity(tx_px * tx_px); |
| 17456 | - tu_pred.extend_from_slice(&pred_y[start..start + tx_px]); | 17516 | + for rr in 0..tx_px { |
| 17457 | - } | 17517 | + let start = (row * MI + rr) * side + col * MI; |
| 17458 | - let scan = default_scan(tx_px); | 17518 | + tu_pred.extend_from_slice(&pred_y[start..start + tx_px]); |
| 17459 | - let tu_skip_ctx = neighbours.luma_skip_ctx(tu_mi, tx_px / MI); | 17519 | + } |
| 17460 | - let (tu_grid, tu_tx_type) = read_inter_plane( | 17520 | + let scan = default_scan(tx_px); |
| 17461 | - dec, | 17521 | + let tu_skip_ctx = neighbours.luma_skip_ctx(tu_mi, tx_px / MI); |
| 17462 | - cdfs, | 17522 | + read_inter_plane( |
| 17463 | - inter_txbset_for(tx_px, reduced), | 17523 | + dec, |
| 17464 | - &scan, | 17524 | + cdfs, |
| 17465 | - 0, | 17525 | + inter_txbset_for(tx_px, reduced), |
| 17466 | - neighbours.around_mi(tu_mi, tx_px)[0], | 17526 | + &scan, |
| 17467 | - mode_for_tx, | 17527 | + 0, |
| 17468 | - y, | 17528 | + neighbours.around_mi(tu_mi, tx_px)[0], |
| 17469 | - tu_px, | 17529 | + mode_for_tx, |
| 17470 | - tu_py, | 17530 | + y, |
| 17471 | - tx_px, | 17531 | + tu_px, |
| 17472 | - base_q_idx, | 17532 | + tu_py, |
| 17473 | - &tu_pred, | 17533 | + tx_px, |
| 17474 | - None, | 17534 | + base_q_idx, |
| 17475 | - Some(tu_skip_ctx), | 17535 | + &tu_pred, |
| 17476 | - )?; | 17536 | + None, |
| 17537 | + Some(tu_skip_ctx), | ||
| 17538 | + )? | ||
| 17539 | + } else { | ||
| 17540 | + // lane-r14 r3: a 1:4 strip's `sub_tx_size_map` | ||
| 17541 | + // sub-transform is RECTANGULAR (TX_64X16 -> | ||
| 17542 | + // TX_32X16, TX_16X64 -> TX_16X32), so this leaf is | ||
| 17543 | + // read with the rect coefficient machinery, at its | ||
| 17544 | + // own `txb_skip_ctx`/neighbour spans -- the unit is | ||
| 17545 | + // smaller than its block, so `get_txb_ctx_general`'s | ||
| 17546 | + // neighbour table applies, not the lone-TU 0. | ||
| 17547 | + vartx_rect_leaf_hit(tw, th); | ||
| 17548 | + let tu_skip_ctx = | ||
| 17549 | + neighbours.luma_skip_ctx_rect(tu_mi, tw / MI, th / MI); | ||
| 17550 | + let start = row * MI * side + col * MI; | ||
| 17551 | + read_inter_plane_rect( | ||
| 17552 | + dec, | ||
| 17553 | + cdfs, | ||
| 17554 | + rect_inter_luma_set(tw, th), | ||
| 17555 | + (tw, th), | ||
| 17556 | + side, | ||
| 17557 | + 0, | ||
| 17558 | + neighbours.around_mi_rect(tu_mi, tw, th)[0], | ||
| 17559 | + mode_for_tx, | ||
| 17560 | + y, | ||
| 17561 | + tu_px, | ||
| 17562 | + tu_py, | ||
| 17563 | + &pred_y[start..], | ||
| 17564 | + None, | ||
| 17565 | + Some(tu_skip_ctx), | ||
| 17566 | + )? | ||
| 17567 | + }; | ||
| 17477 | if idx == 0 { | 17568 | if idx == 0 { |
| 17478 | first_tx_type = tu_tx_type; | 17569 | first_tx_type = tu_tx_type; |
| 17479 | } | 17570 | } |
| 17480 | - neighbours.record_mi_luma(tu_mi, tx_px, &tu_grid); | 17571 | + neighbours.record_mi_luma_rect(tu_mi, tw, th, &tu_grid); |
| 17481 | } | 17572 | } |
| 17482 | // `av1_get_tx_type`'s chroma lookup scales the chroma | 17573 | // `av1_get_tx_type`'s chroma lookup scales the chroma |
| 17483 | // position back to luma, so an inter block's chroma | 17574 | // position back to luma, so an inter block's chroma |
| @@ -17501,6 +17592,7 @@ fn decode_inter_block( | |||
| 17501 | py, | 17592 | py, |
| 17502 | &pred_y, | 17593 | &pred_y, |
| 17503 | None, | 17594 | None, |
| 17595 | + None, | ||
| 17504 | )?; | 17596 | )?; |
| 17505 | luma_tx_type = tx_type; | 17597 | luma_tx_type = tx_type; |
| 17506 | luma_grid = embed_rect_grid(&grid, write_w, write_h, side); | 17598 | luma_grid = embed_rect_grid(&grid, write_w, write_h, side); |
| @@ -17544,6 +17636,7 @@ fn decode_inter_block( | |||
| 17544 | cpy, | 17636 | cpy, |
| 17545 | &pred_u, | 17637 | &pred_u, |
| 17546 | Some(luma_tx_type), | 17638 | Some(luma_tx_type), |
| 17639 | + None, | ||
| 17547 | )? | 17640 | )? |
| 17548 | .0, | 17641 | .0, |
| 17549 | uw, | 17642 | uw, |
| @@ -17565,6 +17658,7 @@ fn decode_inter_block( | |||
| 17565 | cpy, | 17658 | cpy, |
| 17566 | &pred_v, | 17659 | &pred_v, |
| 17567 | Some(luma_tx_type), | 17660 | Some(luma_tx_type), |
| 17661 | + None, | ||
| 17568 | )? | 17662 | )? |
| 17569 | .0, | 17663 | .0, |
| 17570 | uw, | 17664 | uw, |
| @@ -18425,37 +18519,68 @@ fn decode_inter_block( | |||
| 18425 | // own slice of the block's motion-compensated predictor. | 18519 | // own slice of the block's motion-compensated predictor. |
| 18426 | let reduced = REDUCED_TX_SET_INTER.with(std::cell::Cell::get); | 18520 | let reduced = REDUCED_TX_SET_INTER.with(std::cell::Cell::get); |
| 18427 | let mut first_tx_type = TxType::DctDct; | 18521 | let mut first_tx_type = TxType::DctDct; |
| 18428 | - for (idx, &(row, col, tx_px)) in leaves.iter().enumerate() { | 18522 | + for (idx, &(row, col, tw, th)) in leaves.iter().enumerate() { |
| 18429 | let tu_mi = (at_mi.0 + row, at_mi.1 + col); | 18523 | let tu_mi = (at_mi.0 + row, at_mi.1 + col); |
| 18430 | let (tu_px, tu_py) = (px + col * MI, py + row * MI); | 18524 | let (tu_px, tu_py) = (px + col * MI, py + row * MI); |
| 18431 | - let mut tu_pred = Vec::with_capacity(tx_px * tx_px); | 18525 | + let (tu_grid, tu_tx_type) = if tw == th { |
| 18432 | - for rr in 0..tx_px { | 18526 | + let tx_px = tw; |
| 18433 | - let start = (row * MI + rr) * side + col * MI; | 18527 | + let mut tu_pred = Vec::with_capacity(tx_px * tx_px); |
| 18434 | - tu_pred.extend_from_slice(&pred_y[start..start + tx_px]); | 18528 | + for rr in 0..tx_px { |
| 18435 | - } | 18529 | + let start = (row * MI + rr) * side + col * MI; |
| 18436 | - let scan = default_scan(tx_px); | 18530 | + tu_pred.extend_from_slice(&pred_y[start..start + tx_px]); |
| 18437 | - let tu_skip_ctx = neighbours.luma_skip_ctx(tu_mi, tx_px / MI); | 18531 | + } |
| 18438 | - let (tu_grid, tu_tx_type) = read_inter_plane( | 18532 | + let scan = default_scan(tx_px); |
| 18439 | - dec, | 18533 | + let tu_skip_ctx = neighbours.luma_skip_ctx(tu_mi, tx_px / MI); |
| 18440 | - cdfs, | 18534 | + read_inter_plane( |
| 18441 | - inter_txbset_for(tx_px, reduced), | 18535 | + dec, |
| 18442 | - &scan, | 18536 | + cdfs, |
| 18443 | - 0, | 18537 | + inter_txbset_for(tx_px, reduced), |
| 18444 | - neighbours.around_mi(tu_mi, tx_px)[0], | 18538 | + &scan, |
| 18445 | - mode_for_tx, | 18539 | + 0, |
| 18446 | - y, | 18540 | + neighbours.around_mi(tu_mi, tx_px)[0], |
| 18447 | - tu_px, | 18541 | + mode_for_tx, |
| 18448 | - tu_py, | 18542 | + y, |
| 18449 | - tx_px, | 18543 | + tu_px, |
| 18450 | - base_q_idx, | 18544 | + tu_py, |
| 18451 | - &tu_pred, | 18545 | + tx_px, |
| 18452 | - None, | 18546 | + base_q_idx, |
| 18453 | - Some(tu_skip_ctx), | 18547 | + &tu_pred, |
| 18454 | - )?; | 18548 | + None, |
| 18549 | + Some(tu_skip_ctx), | ||
| 18550 | + )? | ||
| 18551 | + } else { | ||
| 18552 | + // lane-r14 r3: a 1:4 strip's `sub_tx_size_map` | ||
| 18553 | + // sub-transform is RECTANGULAR (TX_64X16 -> | ||
| 18554 | + // TX_32X16, TX_16X64 -> TX_16X32), so this leaf is | ||
| 18555 | + // read with the rect coefficient machinery, at its | ||
| 18556 | + // own `txb_skip_ctx`/neighbour spans -- the unit is | ||
| 18557 | + // smaller than its block, so `get_txb_ctx_general`'s | ||
| 18558 | + // neighbour table applies, not the lone-TU 0. | ||
| 18559 | + vartx_rect_leaf_hit(tw, th); | ||
| 18560 | + let tu_skip_ctx = | ||
| 18561 | + neighbours.luma_skip_ctx_rect(tu_mi, tw / MI, th / MI); | ||
| 18562 | + let start = row * MI * side + col * MI; | ||
| 18563 | + read_inter_plane_rect( | ||
| 18564 | + dec, | ||
| 18565 | + cdfs, | ||
| 18566 | + rect_inter_luma_set(tw, th), | ||
| 18567 | + (tw, th), | ||
| 18568 | + side, | ||
| 18569 | + 0, | ||
| 18570 | + neighbours.around_mi_rect(tu_mi, tw, th)[0], | ||
| 18571 | + mode_for_tx, | ||
| 18572 | + y, | ||
| 18573 | + tu_px, | ||
| 18574 | + tu_py, | ||
| 18575 | + &pred_y[start..], | ||
| 18576 | + None, | ||
| 18577 | + Some(tu_skip_ctx), | ||
| 18578 | + )? | ||
| 18579 | + }; | ||
| 18455 | if idx == 0 { | 18580 | if idx == 0 { |
| 18456 | first_tx_type = tu_tx_type; | 18581 | first_tx_type = tu_tx_type; |
| 18457 | } | 18582 | } |
| 18458 | - neighbours.record_mi_luma(tu_mi, tx_px, &tu_grid); | 18583 | + neighbours.record_mi_luma_rect(tu_mi, tw, th, &tu_grid); |
| 18459 | } | 18584 | } |
| 18460 | // `av1_get_tx_type`'s chroma lookup scales the chroma | 18585 | // `av1_get_tx_type`'s chroma lookup scales the chroma |
| 18461 | // position back to luma, so an inter block's chroma | 18586 | // position back to luma, so an inter block's chroma |
| @@ -18479,6 +18604,7 @@ fn decode_inter_block( | |||
| 18479 | py, | 18604 | py, |
| 18480 | &pred_y, | 18605 | &pred_y, |
| 18481 | None, | 18606 | None, |
| 18607 | + None, | ||
| 18482 | )?; | 18608 | )?; |
| 18483 | luma_tx_type = tx_type; | 18609 | luma_tx_type = tx_type; |
| 18484 | luma_grid = embed_rect_grid(&grid, write_w, write_h, side); | 18610 | luma_grid = embed_rect_grid(&grid, write_w, write_h, side); |
| @@ -18522,6 +18648,7 @@ fn decode_inter_block( | |||
| 18522 | cpy, | 18648 | cpy, |
| 18523 | &pred_u, | 18649 | &pred_u, |
| 18524 | Some(luma_tx_type), | 18650 | Some(luma_tx_type), |
| 18651 | + None, | ||
| 18525 | )? | 18652 | )? |
| 18526 | .0, | 18653 | .0, |
| 18527 | uw, | 18654 | uw, |
| @@ -18543,6 +18670,7 @@ fn decode_inter_block( | |||
| 18543 | cpy, | 18670 | cpy, |
| 18544 | &pred_v, | 18671 | &pred_v, |
| 18545 | Some(luma_tx_type), | 18672 | Some(luma_tx_type), |
| 18673 | + None, | ||
| 18546 | )? | 18674 | )? |
| 18547 | .0, | 18675 | .0, |
| 18548 | uw, | 18676 | uw, |
| @@ -18826,7 +18954,7 @@ fn decode_inter_block( | |||
| 18826 | let split_luma = vartx_leaves.is_some(); | 18954 | let split_luma = vartx_leaves.is_some(); |
| 18827 | if let Some(leaves) = vartx_leaves.clone() { | 18955 | if let Some(leaves) = vartx_leaves.clone() { |
| 18828 | let reduced = REDUCED_TX_SET_INTER.with(std::cell::Cell::get); | 18956 | let reduced = REDUCED_TX_SET_INTER.with(std::cell::Cell::get); |
| 18829 | - for &(row, col, tx_px) in &leaves { | 18957 | + for &(row, col, tx_px, _) in &leaves { |
| 18830 | let tu_mi = (at_mi.0 + row, at_mi.1 + col); | 18958 | let tu_mi = (at_mi.0 + row, at_mi.1 + col); |
| 18831 | let (tu_px, tu_py) = (px + col * MI, py + row * MI); | 18959 | let (tu_px, tu_py) = (px + col * MI, py + row * MI); |
| 18832 | // A transform unit inside a block is not a block at that | 18960 | // A transform unit inside a block is not a block at that |
| @@ -19068,13 +19196,13 @@ fn decode_inter_block( | |||
| 19068 | // units, not the block. Chroma still reads `tx_h_grid / 2` (the block's | 19196 | // units, not the block. Chroma still reads `tx_h_grid / 2` (the block's |
| 19069 | // uv transform is not split) -- a known corner-cut of this round. | 19197 | // uv transform is not split) -- a known corner-cut of this round. |
| 19070 | if let Some(leaves) = &vartx_leaves { | 19198 | if let Some(leaves) = &vartx_leaves { |
| 19071 | - for &(row, col, tx_px) in leaves { | 19199 | + for &(row, col, tw, th) in leaves { |
| 19072 | neighbours.fill_lf_grid_rect( | 19200 | neighbours.fill_lf_grid_rect( |
| 19073 | (at_mi.0 + row, at_mi.1 + col), | 19201 | (at_mi.0 + row, at_mi.1 + col), |
| 19074 | - tx_px / MI, | 19202 | + tw / MI, |
| 19075 | - tx_px / MI, | 19203 | + th / MI, |
| 19076 | - tx_px as u8, | 19204 | + tw as u8, |
| 19077 | - tx_px as u8, | 19205 | + th as u8, |
| 19078 | if globalmv_for_lf { | 19206 | if globalmv_for_lf { |
| 19079 | -ref_frame_for_lf | 19207 | -ref_frame_for_lf |
| 19080 | } else { | 19208 | } else { |
crates/ec-av1/src/gate_coverage.rsmodified+0 -5
| @@ -175,10 +175,6 @@ const NEVER_EXERCISED_8BIT: &[(&str, &str)] = &[ | |||
| 175 | "enable-rect-tx", | 175 | "enable-rect-tx", |
| 176 | "never spelled; rect transforms reach the decoder only through partition shape, never through a gate that names the tool", | 176 | "never spelled; rect transforms reach the decoder only through partition shape, never through a gate that names the tool", |
| 177 | ), | 177 | ), |
| 178 | - ( | ||
| 179 | - "enable-tx64", | ||
| 180 | - "never spelled; TX_64X64 appears only where aomenc's default picks it, which is unknown per stream", | ||
| 181 | - ), | ||
| 182 | ]; | 178 | ]; |
| 183 | 179 | ||
| 184 | #[cfg(test)] | 180 | #[cfg(test)] |
| @@ -217,7 +213,6 @@ const NEVER_EXERCISED_10BIT: &[(&str, &str)] = &[ // lane-cwarp's 10-bit comp | |||
| 217 | // 1D tx class). | 213 | // 1D tx class). |
| 218 | ("enable-intrabc", "hole at both depths, see the 8-bit list"), | 214 | ("enable-intrabc", "hole at both depths, see the 8-bit list"), |
| 219 | ("enable-rect-tx", "hole at both depths, see the 8-bit list"), | 215 | ("enable-rect-tx", "hole at both depths, see the 8-bit list"), |
| 220 | - ("enable-tx64", "hole at both depths, see the 8-bit list"), | ||
| 221 | ]; | 216 | ]; |
| 222 | 217 | ||
| 223 | /// [`DEFAULT_ON_TOOLS`] entries no 8-bit gate spells on, with the reason. | 218 | /// [`DEFAULT_ON_TOOLS`] entries no 8-bit gate spells on, with the reason. |
crates/ec-av1/src/refusal_inventory.rsmodified+0 -4
| @@ -81,10 +81,6 @@ const REFUSALS: &[&str] = &[ | |||
| 81 | "warp prediction with a scaled reference (superres, unimplemented)", | 81 | "warp prediction with a scaled reference (superres, unimplemented)", |
| 82 | "an 8x8 partition leaf under a scaled reference (superres, unimplemented)", | 82 | "an 8x8 partition leaf under a scaled reference (superres, unimplemented)", |
| 83 | "a motion_mode symbol for a block shape with no CDF row here", | 83 | "a motion_mode symbol for a block shape with no CDF row here", |
| 84 | - // lane-r14 r2: the whole-transform case of every 64-axis inter strip is | ||
| 85 | - // coded; only the SPLIT of a 1:4 strip with a 64-px axis is left, whose | ||
| 86 | - // `sub_tx_size_map` entry is rectangular (TX_64X16 -> TX_32X16). | ||
| 87 | - "a split transform on a 1:4 inter strip with a 64-px axis", | ||
| 88 | ]; | 84 | ]; |
| 89 | 85 | ||
| 90 | /// Gates whose `Err` arm turns a decode failure into a printed SKIP rather than | 86 | /// 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 { | |||
| 74 | crate::decode::rect64_inter_tu_hits() | 74 | crate::decode::rect64_inter_tu_hits() |
| 75 | } | 75 | } |
| 76 | 76 | ||
| 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 | + | ||
| 77 | pub fn rect4_32_counters() -> (usize, usize, usize) { | 84 | pub fn rect4_32_counters() -> (usize, usize, usize) { |
| 78 | ( | 85 | ( |
| 79 | crate::decode::rect4_32_horz_hits(), | 86 | crate::decode::rect4_32_horz_hits(), |
| @@ -7420,6 +7427,240 @@ mod tests { | |||
| 7420 | } | 7427 | } |
| 7421 | } | 7428 | } |
| 7422 | 7429 | ||
| 7430 | + /// lane-r14 r3: a 1:4 inter strip with a 64-px axis (64x16 / 16x64) whose | ||
| 7431 | + /// transform SPLITS -- the arm r2 left refused by name ("a split transform | ||
| 7432 | + /// on a 1:4 inter strip with a 64-px axis"). libaom's | ||
| 7433 | + /// `sub_tx_size_map[TX_64X16] == TX_32X16` (and `[TX_16X64] == TX_16X32`) | ||
| 7434 | + /// keeps the sub-transform RECTANGULAR, so the var-tx tree's leaves are | ||
| 7435 | + /// 32x16/16x32 units read through [`TxbSet::LumaRect32x16Inter`], each with | ||
| 7436 | + /// its own `get_txb_ctx_general` neighbour context (the unit is smaller | ||
| 7437 | + /// than its block, so `txb_skip_ctx` is NOT the lone-TU 0). | ||
| 7438 | + /// | ||
| 7439 | + /// `--enable-1to4-partitions=1 --min-partition-size=16 | ||
| 7440 | + /// --max-partition-size=64 --enable-tx64=1` (each spelled once, last | ||
| 7441 | + /// occurrence wins) is what lets aomenc pick a superblock-level HORZ_4 / | ||
| 7442 | + /// VERT_4; the textured translating source is what keeps the strips | ||
| 7443 | + /// non-skip so the residual is actually coded. 8-bit AND 10-bit, every | ||
| 7444 | + /// decoded frame compared to ffmpeg on Y/U/V, refusals counted (never | ||
| 7445 | + /// SKIPped), attempts that carried no rectangular var-tx leaf counted | ||
| 7446 | + /// separately and still required pixel-exact. | ||
| 7447 | + #[test] | ||
| 7448 | + fn real_aomenc_1to4_streams_decode_pixel_exact_and_rect_vartx_leaves_fire_before_a_named_refusal() { | ||
| 7449 | + const NAME: &str = | ||
| 7450 | + "real_aomenc_1to4_streams_decode_pixel_exact_and_rect_vartx_leaves_fire_before_a_named_refusal"; | ||
| 7451 | + let _gate_lock = lock_gate_counters(); | ||
| 7452 | + if !have_ffmpeg() { | ||
| 7453 | + eprintln!("SKIP {NAME}: no ffmpeg"); | ||
| 7454 | + return; | ||
| 7455 | + } | ||
| 7456 | + if !have_aomenc() { | ||
| 7457 | + eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display()); | ||
| 7458 | + return; | ||
| 7459 | + } | ||
| 7460 | + let frame_count = 6usize; | ||
| 7461 | + for bit_depth in [8u32, 10u32] { | ||
| 7462 | + let (mut named_refusals, mut compared, mut out_of_scope, mut oos_mismatch) = | ||
| 7463 | + (0u32, 0u32, 0u32, 0u32); | ||
| 7464 | + let (mut leaf_32x16, mut leaf_16x32) = (0usize, 0usize); | ||
| 7465 | + // Leaves decoded on ANY attempt, including one whose stream hits a | ||
| 7466 | + // later named refusal: the firing half of this gate, kept apart | ||
| 7467 | + // from `leaf_32x16`/`leaf_16x32` (pixel-compared attempts only) so | ||
| 7468 | + // a refused stream is never counted as a pixel proof | ||
| 7469 | + // (class counter-from-refused-stream). | ||
| 7470 | + let (mut fired_32x16, mut fired_16x32) = (0usize, 0usize); | ||
| 7471 | + for attempt in 0..18u32 { | ||
| 7472 | + // Two orientations (the transposed pair a one-sided gate could | ||
| 7473 | + // never separate) x four quantisers x two motion steps. | ||
| 7474 | + // lane-r14 r4 recipe hunt (~70 aomenc runs on the merged | ||
| 7475 | + // tree: testsrc2 / life / mandelbrot / banded motion, 64x64 up | ||
| 7476 | + // to 384x256, cq 20..58): attempts 16-17 carry the only recipe | ||
| 7477 | + // found that makes aomenc code a 64-axis 1:4 strip whose | ||
| 7478 | + // transform SPLITS -- 384x256, per-16-column band motion, | ||
| 7479 | + // cq 32 (16x32 leaves) and cq 38 (32x16 leaves). | ||
| 7480 | + let firing = attempt >= 16; | ||
| 7481 | + let (width, height) = | ||
| 7482 | + if firing { (384usize, 256usize) } else { (192usize, 128usize) }; | ||
| 7483 | + let vertical = attempt % 2 == 1; | ||
| 7484 | + let cq = if firing { | ||
| 7485 | + [32, 38][(attempt - 16) as usize] | ||
| 7486 | + } else { | ||
| 7487 | + [30, 36, 44, 52][(attempt / 2 % 4) as usize] | ||
| 7488 | + }; | ||
| 7489 | + let sp = 3 + (attempt / 8) * 3; | ||
| 7490 | + // 16-pixel bands, each band translating at its OWN speed | ||
| 7491 | + // across the other axis: that is what makes aomenc's RD split | ||
| 7492 | + // a 64x64 superblock into four 1:4 strips (`PARTITION_HORZ_4` | ||
| 7493 | + // / `VERT_4`) with distinct motion vectors, and the texture | ||
| 7494 | + // inside a band is what keeps the strip non-skip and its | ||
| 7495 | + // transform split. | ||
| 7496 | + let geq = if firing { | ||
| 7497 | + "128+60*sin((Y-N*(1+0.37*mod(floor(X/16),4)))/3)+45*sin(Y/17+X/23)" | ||
| 7498 | + .to_string() | ||
| 7499 | + } else if vertical { | ||
| 7500 | + format!( | ||
| 7501 | + "128+60*sin((Y+N*({sp}+9*mod(floor(X/16),2)))/7)+25*sin(X/11)" | ||
| 7502 | + ) | ||
| 7503 | + } else { | ||
| 7504 | + format!( | ||
| 7505 | + "128+60*sin((X+N*({sp}+9*mod(floor(Y/16),2)))/7)+25*sin(Y/11)" | ||
| 7506 | + ) | ||
| 7507 | + }; | ||
| 7508 | + let duration = frame_count as f64 / 25.0; | ||
| 7509 | + let source = format!( | ||
| 7510 | + "color=c=gray:s={width}x{height}:d={duration}:r=25,format=gray,\ | ||
| 7511 | + geq=lum='{geq}',format=yuv420p" | ||
| 7512 | + ); | ||
| 7513 | + let pix_fmt = if bit_depth == 10 { "yuv420p10le" } else { "yuv420p" }; | ||
| 7514 | + let y4m = Command::new("ffmpeg") | ||
| 7515 | + .args([ | ||
| 7516 | + "-v", "error", "-f", "lavfi", "-i", &source, "-t", &duration.to_string(), | ||
| 7517 | + "-pix_fmt", pix_fmt, "-strict", "-1", "-f", "yuv4mpegpipe", "-", | ||
| 7518 | + ]) | ||
| 7519 | + .stdin(Stdio::null()) | ||
| 7520 | + .stdout(Stdio::piped()) | ||
| 7521 | + .stderr(Stdio::piped()) | ||
| 7522 | + .output() | ||
| 7523 | + .expect("ffmpeg failed to run"); | ||
| 7524 | + assert!( | ||
| 7525 | + y4m.status.success(), | ||
| 7526 | + "{NAME}: ffmpeg refused the {bit_depth}-bit fixture: {}", | ||
| 7527 | + String::from_utf8_lossy(&y4m.stderr) | ||
| 7528 | + ); | ||
| 7529 | + let cq_arg = format!("--cq-level={cq}"); | ||
| 7530 | + let depth_arg = format!("--bit-depth={bit_depth}"); | ||
| 7531 | + let input_depth_arg = format!("--input-bit-depth={bit_depth}"); | ||
| 7532 | + let args: Vec<&str> = vec![ | ||
| 7533 | + "--codec=av1", "--passes=1", "--end-usage=q", &cq_arg, "--cpu-used=0", | ||
| 7534 | + "--threads=1", "--row-mt=0", "--sb-size=64", &depth_arg, &input_depth_arg, | ||
| 7535 | + "--enable-restoration=0", "--enable-palette=0", "--deltaq-mode=0", | ||
| 7536 | + "--enable-filter-intra=0", "--enable-cfl-intra=0", "--enable-intrabc=0", | ||
| 7537 | + "--lag-in-frames=0", | ||
| 7538 | + // Per-arm overrides go LAST: aomenc keeps the last | ||
| 7539 | + // occurrence of a repeated --enable-* flag. | ||
| 7540 | + "--enable-tx64=1", "--enable-rect-partitions=1", | ||
| 7541 | + "--enable-ab-partitions=0", "--enable-1to4-partitions=1", | ||
| 7542 | + "--enable-dual-filter=0", "--enable-obmc=0", | ||
| 7543 | + "--min-partition-size=16", "--max-partition-size=64", | ||
| 7544 | + "--obu", "-o", "-", "-", | ||
| 7545 | + ]; | ||
| 7546 | + let mut child = Command::new(aomenc_path()) | ||
| 7547 | + .args(&args) | ||
| 7548 | + .stdin(Stdio::piped()) | ||
| 7549 | + .stdout(Stdio::piped()) | ||
| 7550 | + .stderr(Stdio::piped()) | ||
| 7551 | + .spawn() | ||
| 7552 | + .expect("aomenc failed to start"); | ||
| 7553 | + child | ||
| 7554 | + .stdin | ||
| 7555 | + .take() | ||
| 7556 | + .expect("aomenc stdin") | ||
| 7557 | + .write_all(&y4m.stdout) | ||
| 7558 | + .expect("writing y4m to aomenc"); | ||
| 7559 | + let out = child.wait_with_output().expect("aomenc failed to run"); | ||
| 7560 | + assert!( | ||
| 7561 | + out.status.success(), | ||
| 7562 | + "aomenc refused the fixture: {}", | ||
| 7563 | + String::from_utf8_lossy(&out.stderr) | ||
| 7564 | + ); | ||
| 7565 | + let stream = out.stdout; | ||
| 7566 | + let before = crate::stream::vartx_rect_leaf_hits(); | ||
| 7567 | + let frames = match decode_stream(&stream) { | ||
| 7568 | + Err(e) => { | ||
| 7569 | + let msg = e.to_string(); | ||
| 7570 | + assert!( | ||
| 7571 | + msg.contains("unsupported"), | ||
| 7572 | + "{NAME} failed outright, not a named refusal ({bit_depth}-bit, \ | ||
| 7573 | + attempt {attempt}): {msg}" | ||
| 7574 | + ); | ||
| 7575 | + let after = crate::stream::vartx_rect_leaf_hits(); | ||
| 7576 | + fired_32x16 += after[0] - before[0]; | ||
| 7577 | + fired_16x32 += after[1] - before[1]; | ||
| 7578 | + named_refusals += 1; | ||
| 7579 | + eprintln!( | ||
| 7580 | + "{bit_depth}-bit attempt {attempt} refusal (rect var-tx leaves \ | ||
| 7581 | + decoded before it: 32x16={}, 16x32={}): {msg}", | ||
| 7582 | + after[0] - before[0], | ||
| 7583 | + after[1] - before[1] | ||
| 7584 | + ); | ||
| 7585 | + continue; | ||
| 7586 | + } | ||
| 7587 | + Ok(frames) => frames, | ||
| 7588 | + }; | ||
| 7589 | + let after = crate::stream::vartx_rect_leaf_hits(); | ||
| 7590 | + let (h32, v32) = (after[0] - before[0], after[1] - before[1]); | ||
| 7591 | + fired_32x16 += h32; | ||
| 7592 | + fired_16x32 += v32; | ||
| 7593 | + let ffmpeg_frames = if bit_depth == 10 { | ||
| 7594 | + ffmpeg_decode_sequence_10bit(&stream, width, height, frame_count) | ||
| 7595 | + } else { | ||
| 7596 | + ffmpeg_decode_sequence(&stream, width, height, frame_count) | ||
| 7597 | + }; | ||
| 7598 | + assert_eq!(frames.len(), frame_count); | ||
| 7599 | + let mismatched = frames | ||
| 7600 | + .iter() | ||
| 7601 | + .zip(&ffmpeg_frames) | ||
| 7602 | + .any(|(got, want)| got.y != want.y || got.u != want.u || got.v != want.v); | ||
| 7603 | + if h32 + v32 == 0 { | ||
| 7604 | + // Counted per ATTEMPT, on a decoded+compared attempt only | ||
| 7605 | + // (class counter-from-refused-stream). | ||
| 7606 | + out_of_scope += 1; | ||
| 7607 | + if mismatched { | ||
| 7608 | + oos_mismatch += 1; | ||
| 7609 | + eprintln!( | ||
| 7610 | + "{NAME}: {bit_depth}-bit attempt {attempt} MISMATCHES with zero \ | ||
| 7611 | + rectangular var-tx leaves -- another shape's defect" | ||
| 7612 | + ); | ||
| 7613 | + } | ||
| 7614 | + continue; | ||
| 7615 | + } | ||
| 7616 | + for (i, (got, want)) in frames.iter().zip(&ffmpeg_frames).enumerate() { | ||
| 7617 | + assert_eq!(got.y, want.y, "{NAME} frame {i} luma vs ffmpeg (attempt {attempt}, {bit_depth}-bit)"); | ||
| 7618 | + assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (attempt {attempt}, {bit_depth}-bit)"); | ||
| 7619 | + assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (attempt {attempt}, {bit_depth}-bit)"); | ||
| 7620 | + } | ||
| 7621 | + leaf_32x16 += h32; | ||
| 7622 | + leaf_16x32 += v32; | ||
| 7623 | + compared += 1; | ||
| 7624 | + } | ||
| 7625 | + eprintln!( | ||
| 7626 | + "{NAME} ({bit_depth}-bit): {named_refusals} named refusals, {compared} \ | ||
| 7627 | + pixel-exact attempts carrying the arm, pixel-compared rect var-tx leaves \ | ||
| 7628 | + 32x16={leaf_32x16} 16x32={leaf_16x32}, leaves decoded anywhere in the sweep \ | ||
| 7629 | + 32x16={fired_32x16} 16x32={fired_16x32}, {out_of_scope} attempts carried none \ | ||
| 7630 | + ({oos_mismatch} of them mismatched)" | ||
| 7631 | + ); | ||
| 7632 | + assert_eq!( | ||
| 7633 | + oos_mismatch, 0, | ||
| 7634 | + "{NAME}: {oos_mismatch} attempt(s) with no rectangular var-tx leaf decoded \ | ||
| 7635 | + but mismatched ffmpeg -- a defect of another shape, not a pass" | ||
| 7636 | + ); | ||
| 7637 | + assert!( | ||
| 7638 | + compared + out_of_scope > 0, | ||
| 7639 | + "{NAME} ({bit_depth}-bit): every attempt refused -- the gate compared no pixels" | ||
| 7640 | + ); | ||
| 7641 | + // The firing half. MEASURED on the merged tree (lane-r14 r4, ~70 | ||
| 7642 | + // aomenc runs): the 8-bit 384x256 banded recipe codes BOTH | ||
| 7643 | + // orientations of the split -- cq 38 gives four 32x16 leaves (out | ||
| 7644 | + // of four 64x16 strips), cq 32 one 16x32 leaf (out of four 16x64 | ||
| 7645 | + // strips). Those two streams stop LATER on another lane's live | ||
| 7646 | + // refusal ("an inter 16x16-level AB or 1:4 partition", "a non-skip | ||
| 7647 | + // rectangular (HORZ/VERT/HORZ_B) strip needs rectangular residual | ||
| 7648 | + // coding"), so the leaves are proved DECODED, not proved | ||
| 7649 | + // pixel-exact; every attempt that ran to the end is compared | ||
| 7650 | + // frame by frame above. At 10 bits the same sweep fires nothing | ||
| 7651 | + // (aomenc picks other shapes), so the firing assert is 8-bit only | ||
| 7652 | + // -- and it is a hard assert, never a print. | ||
| 7653 | + if bit_depth == 8 { | ||
| 7654 | + assert!( | ||
| 7655 | + fired_32x16 > 0 && fired_16x32 > 0, | ||
| 7656 | + "{NAME}: the rectangular var-tx leaf arm never fired (32x16={fired_32x16}, \ | ||
| 7657 | + 16x32={fired_16x32}, {named_refusals} refusals, {compared} compared) -- \ | ||
| 7658 | + `sub_tx_size_map[TX_64X16] == TX_32X16` is unproved by this gate" | ||
| 7659 | + ); | ||
| 7660 | + } | ||
| 7661 | + } | ||
| 7662 | + } | ||
| 7663 | + | ||
| 7423 | /// lane-inter4 r2: the 32x32-level inter `PARTITION_HORZ`/`PARTITION_VERT` | 7664 | /// lane-inter4 r2: the 32x32-level inter `PARTITION_HORZ`/`PARTITION_VERT` |
| 7424 | /// strips (32x16 / 16x32) carrying a REAL residual -- the capability r1 | 7665 | /// strips (32x16 / 16x32) carrying a REAL residual -- the capability r1 |
| 7425 | /// found missing ("a non-skip rectangular (HORZ/VERT/HORZ_B) strip needs | 7666 | /// 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. | ||