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 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( |
| @@ -11417,6 +11434,46 @@ const TXFM_CTX_INIT: u8 = 64; | |||
| 11417 | /// twice below its own largest transform. | 11434 | /// twice below its own largest transform. |
| 11418 | const MAX_VARTX_DEPTH: usize = 2; | 11435 | const MAX_VARTX_DEPTH: usize = 2; |
| 11419 | 11436 | ||
| 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 | + | ||
| 11420 | /// `read_var_tx_size` (spec 5.11.17, libaom `decodeframe.c` | 11477 | /// `read_var_tx_size` (spec 5.11.17, libaom `decodeframe.c` |
| 11421 | /// `read_tx_size_vartx`): the recursive `txfm_split` tree of one | 11478 | /// `read_tx_size_vartx`): the recursive `txfm_split` tree of one |
| 11422 | /// max-transform-sized unit of an inter block, collecting the resolved leaf | 11479 | /// max-transform-sized unit of an inter block, collecting the resolved leaf |
| @@ -11433,22 +11490,28 @@ fn read_var_tx_size( | |||
| 11433 | at_mi: (usize, usize), | 11490 | at_mi: (usize, usize), |
| 11434 | blk_max_px: usize, | 11491 | blk_max_px: usize, |
| 11435 | (max_w_mi, max_h_mi): (usize, usize), | 11492 | (max_w_mi, max_h_mi): (usize, usize), |
| 11436 | - tx_px: usize, | 11493 | + (tx_w, tx_h): (usize, usize), |
| 11437 | depth: usize, | 11494 | depth: usize, |
| 11438 | blk_row: usize, | 11495 | blk_row: usize, |
| 11439 | blk_col: usize, | 11496 | blk_col: usize, |
| 11440 | - out: &mut Vec<(usize, usize, usize)>, | 11497 | + out: &mut Vec<(usize, usize, usize, usize)>, |
| 11441 | ) { | 11498 | ) { |
| 11442 | if blk_row >= max_h_mi || blk_col >= max_w_mi { | 11499 | if blk_row >= max_h_mi || blk_col >= max_w_mi { |
| 11443 | return; | 11500 | return; |
| 11444 | } | 11501 | } |
| 11445 | let unit = (at_mi.0 + blk_row, at_mi.1 + blk_col); | 11502 | let unit = (at_mi.0 + blk_row, at_mi.1 + blk_col); |
| 11446 | if depth == MAX_VARTX_DEPTH { | 11503 | if depth == MAX_VARTX_DEPTH { |
| 11447 | - out.push((blk_row, blk_col, tx_px)); | 11504 | + out.push((blk_row, blk_col, tx_w, tx_h)); |
| 11448 | - txfm_partition_update(n, unit, tx_px, tx_px); | 11505 | + txfm_partition_update_rect(n, unit, (tx_w, tx_h), (tx_w, tx_h)); |
| 11449 | return; | 11506 | return; |
| 11450 | } | 11507 | } |
| 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 | + ); | ||
| 11452 | let split = dec.symbol(&mut cdfs.txfm_partition[ctx]) == 1; | 11515 | let split = dec.symbol(&mut cdfs.txfm_partition[ctx]) == 1; |
| 11453 | TXFM_SPLIT_READS.with(|c| c.set(c.get() + 1)); | 11516 | TXFM_SPLIT_READS.with(|c| c.set(c.get() + 1)); |
| 11454 | if std::env::var_os("EC_TRACE_MODE_STEP").is_some() { | 11517 | if std::env::var_os("EC_TRACE_MODE_STEP").is_some() { |
| @@ -11461,27 +11524,27 @@ fn read_var_tx_size( | |||
| 11461 | ); | 11524 | ); |
| 11462 | } | 11525 | } |
| 11463 | if !split { | 11526 | if !split { |
| 11464 | - out.push((blk_row, blk_col, tx_px)); | 11527 | + out.push((blk_row, blk_col, tx_w, tx_h)); |
| 11465 | - txfm_partition_update(n, unit, tx_px, tx_px); | 11528 | + txfm_partition_update_rect(n, unit, (tx_w, tx_h), (tx_w, tx_h)); |
| 11466 | return; | 11529 | return; |
| 11467 | } | 11530 | } |
| 11468 | TXFM_SPLIT_HITS.with(|c| c.set(c.get() + 1)); | 11531 | TXFM_SPLIT_HITS.with(|c| c.set(c.get() + 1)); |
| 11469 | - let sub = tx_px / 2; | 11532 | + let (sub_w, sub_h) = sub_tx_size_map(tx_w, tx_h); |
| 11470 | - if sub == 4 { | 11533 | + if (sub_w, sub_h) == (4, 4) { |
| 11471 | - // libaom's `sub_txs == TX_4X4` early return: the whole 8x8 unit is | 11534 | + // libaom's `sub_txs == TX_4X4` early return: every mi cell of the |
| 11472 | - // marked 4x4 (four transform units, raster order) without recursing. | 11535 | + // unit is marked 4x4 (raster order) without recursing. |
| 11473 | - for row in 0..2 { | 11536 | + for row in 0..tx_h / MI { |
| 11474 | - for col in 0..2 { | 11537 | + for col in 0..tx_w / MI { |
| 11475 | if blk_row + row < max_h_mi && blk_col + col < max_w_mi { | 11538 | 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)); |
| 11477 | } | 11540 | } |
| 11478 | } | 11541 | } |
| 11479 | } | 11542 | } |
| 11480 | - txfm_partition_update(n, unit, 4, tx_px); | 11543 | + txfm_partition_update_rect(n, unit, (4, 4), (tx_w, tx_h)); |
| 11481 | return; | 11544 | return; |
| 11482 | } | 11545 | } |
| 11483 | - for row in (0..tx_px / MI).step_by(sub / MI) { | 11546 | + for row in (0..tx_h / MI).step_by(sub_h / MI) { |
| 11484 | - for col in (0..tx_px / MI).step_by(sub / MI) { | 11547 | + for col in (0..tx_w / MI).step_by(sub_w / MI) { |
| 11485 | read_var_tx_size( | 11548 | read_var_tx_size( |
| 11486 | dec, | 11549 | dec, |
| 11487 | cdfs, | 11550 | cdfs, |
| @@ -11489,7 +11552,7 @@ fn read_var_tx_size( | |||
| 11489 | at_mi, | 11552 | at_mi, |
| 11490 | blk_max_px, | 11553 | blk_max_px, |
| 11491 | (max_w_mi, max_h_mi), | 11554 | (max_w_mi, max_h_mi), |
| 11492 | - sub, | 11555 | + (sub_w, sub_h), |
| 11493 | depth + 1, | 11556 | depth + 1, |
| 11494 | blk_row + row, | 11557 | blk_row + row, |
| 11495 | blk_col + col, | 11558 | blk_col + col, |
| @@ -11517,7 +11580,7 @@ fn read_block_tx_size( | |||
| 11517 | (mi_cols, mi_rows): (usize, usize), | 11580 | (mi_cols, mi_rows): (usize, usize), |
| 11518 | is_inter: bool, | 11581 | is_inter: bool, |
| 11519 | skip: bool, | 11582 | skip: bool, |
| 11520 | -) -> Result<(usize, Option<Vec<(usize, usize, usize)>>)> { | 11583 | +) -> Result<(usize, Option<Vec<(usize, usize, usize, usize)>>)> { |
| 11521 | if !TX_SELECT_INTER.with(std::cell::Cell::get) { | 11584 | if !TX_SELECT_INTER.with(std::cell::Cell::get) { |
| 11522 | return Ok((side, None)); | 11585 | return Ok((side, None)); |
| 11523 | } | 11586 | } |
| @@ -11537,7 +11600,7 @@ fn read_block_tx_size( | |||
| 11537 | at_mi, | 11600 | at_mi, |
| 11538 | side, | 11601 | side, |
| 11539 | (max_w_mi, max_h_mi), | 11602 | (max_w_mi, max_h_mi), |
| 11540 | - max_tx, | 11603 | + (max_tx, max_tx), |
| 11541 | 0, | 11604 | 0, |
| 11542 | row, | 11605 | row, |
| 11543 | col, | 11606 | col, |
| @@ -11545,8 +11608,8 @@ fn read_block_tx_size( | |||
| 11545 | ); | 11608 | ); |
| 11546 | } | 11609 | } |
| 11547 | } | 11610 | } |
| 11548 | - let single = leaves.len() == 1 && leaves[0].2 == side; | 11611 | + let single = leaves.len() == 1 && leaves[0].2 == side && leaves[0].3 == side; |
| 11549 | - if !single && leaves.iter().any(|leaf| leaf.2 > 32) { | 11612 | + if !single && leaves.iter().any(|leaf| leaf.2.max(leaf.3) > 32) { |
| 11550 | // Only a block wider than a superblock's own 64x64 max transform | 11613 | // Only a block wider than a superblock's own 64x64 max transform |
| 11551 | // reaches here; this crate has no 64-point *inter* coefficient | 11614 | // reaches here; this crate has no 64-point *inter* coefficient |
| 11552 | // table set ([`inter_txbset_for`] stops at 32). | 11615 | // table set ([`inter_txbset_for`] stops at 32). |
| @@ -11584,7 +11647,7 @@ fn read_block_tx_size( | |||
| 11584 | let mut leaves = Vec::new(); | 11647 | let mut leaves = Vec::new(); |
| 11585 | for row in (0..side_mi).step_by(step) { | 11648 | for row in (0..side_mi).step_by(step) { |
| 11586 | for col in (0..side_mi).step_by(step) { | 11649 | for col in (0..side_mi).step_by(step) { |
| 11587 | - leaves.push((row, col, tx)); | 11650 | + leaves.push((row, col, tx, tx)); |
| 11588 | } | 11651 | } |
| 11589 | } | 11652 | } |
| 11590 | INTRA_IN_INTER_SPLIT_TX_HITS.with(|c| { | 11653 | INTRA_IN_INTER_SPLIT_TX_HITS.with(|c| { |
| @@ -11736,7 +11799,7 @@ fn read_block_tx_size_rect( | |||
| 11736 | (bw, bh): (usize, usize), | 11799 | (bw, bh): (usize, usize), |
| 11737 | (mi_cols, mi_rows): (usize, usize), | 11800 | (mi_cols, mi_rows): (usize, usize), |
| 11738 | skip: bool, | 11801 | skip: bool, |
| 11739 | -) -> Result<Option<Vec<(usize, usize, usize)>>> { | 11802 | +) -> Result<Option<Vec<(usize, usize, usize, usize)>>> { |
| 11740 | if skip { | 11803 | if skip { |
| 11741 | // `set_txfm_ctxs(.., skip && is_inter)`: a skipped inter block records | 11804 | // `set_txfm_ctxs(.., skip && is_inter)`: a skipped inter block records |
| 11742 | // its own BLOCK size -- width above, height left -- not a transform. | 11805 | // its own BLOCK size -- width above, height left -- not a transform. |
| @@ -11779,22 +11842,16 @@ fn read_block_tx_size_rect( | |||
| 11779 | } | 11842 | } |
| 11780 | TXFM_SPLIT_HITS.with(|c| c.set(c.get() + 1)); | 11843 | TXFM_SPLIT_HITS.with(|c| c.set(c.get() + 1)); |
| 11781 | RECT_INTER_TXSPLIT_HITS.with(|c| c.set(c.get() + 1)); | 11844 | 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 | 11845 | + // lane-r14 r3: `sub_tx_size_map` (libaom `common_data.c`) stays |
| 11783 | - // splits (TX_32X16 -> TX_16X16, TX_64X32 -> TX_32X32) EXCEPT the 1:4 | 11846 | + // RECTANGULAR under a 1:4 strip -- `[TX_64X16] == TX_32X16`, |
| 11784 | - // strips with a 64-px axis, where it stays rectangular | 11847 | + // `[TX_16X64] == TX_16X32` -- so the recursion below is the general |
| 11785 | - // (TX_64X16 -> TX_32X16, TX_16X64 -> TX_16X32) and the square recursion | 11848 | + // rect one and its leaves carry their own width and height. |
| 11786 | - // below would code the wrong tree. | 11849 | + let (sub_w, sub_h) = sub_tx_size_map(tx_w, tx_h); |
| 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); | ||
| 11793 | let max_w_mi = (bw / MI).min(mi_cols.saturating_sub(at_mi.1)); | 11850 | let max_w_mi = (bw / MI).min(mi_cols.saturating_sub(at_mi.1)); |
| 11794 | let max_h_mi = (bh / MI).min(mi_rows.saturating_sub(at_mi.0)); | 11851 | let max_h_mi = (bh / MI).min(mi_rows.saturating_sub(at_mi.0)); |
| 11795 | let mut leaves = Vec::new(); | 11852 | let mut leaves = Vec::new(); |
| 11796 | - for row in (0..bh / MI).step_by(sub / MI) { | 11853 | + for row in (0..bh / MI).step_by(sub_h / MI) { |
| 11797 | - for col in (0..bw / MI).step_by(sub / MI) { | 11854 | + for col in (0..bw / MI).step_by(sub_w / MI) { |
| 11798 | read_var_tx_size( | 11855 | read_var_tx_size( |
| 11799 | dec, | 11856 | dec, |
| 11800 | cdfs, | 11857 | cdfs, |
| @@ -11802,7 +11859,7 @@ fn read_block_tx_size_rect( | |||
| 11802 | at_mi, | 11859 | at_mi, |
| 11803 | bw.max(bh), | 11860 | bw.max(bh), |
| 11804 | (max_w_mi, max_h_mi), | 11861 | (max_w_mi, max_h_mi), |
| 11805 | - sub, | 11862 | + (sub_w, sub_h), |
| 11806 | 1, | 11863 | 1, |
| 11807 | row, | 11864 | row, |
| 11808 | col, | 11865 | col, |
| @@ -11839,9 +11896,12 @@ fn read_inter_plane_rect( | |||
| 11839 | y: usize, | 11896 | y: usize, |
| 11840 | prediction: &[u16], | 11897 | prediction: &[u16], |
| 11841 | inherited_luma_tx_type: Option<TxType>, | 11898 | inherited_luma_tx_type: Option<TxType>, |
| 11899 | + luma_skip_ctx: Option<usize>, | ||
| 11842 | ) -> Result<(Vec<i32>, TxType)> { | 11900 | ) -> Result<(Vec<i32>, TxType)> { |
| 11843 | let skip_ctx = if plane_idx == 0 { | 11901 | 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) | ||
| 11845 | } else { | 11905 | } else { |
| 11846 | usize::from(around.0) + usize::from(around.1) | 11906 | usize::from(around.0) + usize::from(around.1) |
| 11847 | }; | 11907 | }; |
| @@ -16458,7 +16518,7 @@ fn decode_inter_block( | |||
| 16458 | // 5.11.17), `Some` only when this block's var-tx tree resolved to more | 16518 | // 5.11.17), `Some` only when this block's var-tx tree resolved to more |
| 16459 | // than one luma transform -- read back by the residual loop, the | 16519 | // than one luma transform -- read back by the residual loop, the |
| 16460 | // coefficient-context write-back and the loop-filter grid fill below. | 16520 | // 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; |
| 16462 | let at_mi = at; | 16522 | let at_mi = at; |
| 16463 | if is_inter { | 16523 | if is_inter { |
| 16464 | let above_nbr = has_above.then(|| NeighbourRef { | 16524 | let above_nbr = has_above.then(|| NeighbourRef { |
| @@ -17313,37 +17373,68 @@ fn decode_inter_block( | |||
| 17313 | // own slice of the block's motion-compensated predictor. | 17373 | // own slice of the block's motion-compensated predictor. |
| 17314 | let reduced = REDUCED_TX_SET_INTER.with(std::cell::Cell::get); | 17374 | let reduced = REDUCED_TX_SET_INTER.with(std::cell::Cell::get); |
| 17315 | let mut first_tx_type = TxType::DctDct; | 17375 | 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() { |
| 17317 | let tu_mi = (at_mi.0 + row, at_mi.1 + col); | 17377 | let tu_mi = (at_mi.0 + row, at_mi.1 + col); |
| 17318 | let (tu_px, tu_py) = (px + col * MI, py + row * MI); | 17378 | let (tu_px, tu_py) = (px + col * MI, py + row * MI); |
| 17319 | - let mut tu_pred = Vec::with_capacity(tx_px * tx_px); | 17379 | + let (tu_grid, tu_tx_type) = if tw == th { |
| 17320 | - for rr in 0..tx_px { | 17380 | + let tx_px = tw; |
| 17321 | - let start = (row * MI + rr) * side + col * MI; | 17381 | + let mut tu_pred = Vec::with_capacity(tx_px * tx_px); |
| 17322 | - tu_pred.extend_from_slice(&pred_y[start..start + tx_px]); | 17382 | + for rr in 0..tx_px { |
| 17323 | - } | 17383 | + let start = (row * MI + rr) * side + col * MI; |
| 17324 | - let scan = default_scan(tx_px); | 17384 | + tu_pred.extend_from_slice(&pred_y[start..start + tx_px]); |
| 17325 | - let tu_skip_ctx = neighbours.luma_skip_ctx(tu_mi, tx_px / MI); | 17385 | + } |
| 17326 | - let (tu_grid, tu_tx_type) = read_inter_plane( | 17386 | + let scan = default_scan(tx_px); |
| 17327 | - dec, | 17387 | + let tu_skip_ctx = neighbours.luma_skip_ctx(tu_mi, tx_px / MI); |
| 17328 | - cdfs, | 17388 | + read_inter_plane( |
| 17329 | - inter_txbset_for(tx_px, reduced), | 17389 | + dec, |
| 17330 | - &scan, | 17390 | + cdfs, |
| 17331 | - 0, | 17391 | + inter_txbset_for(tx_px, reduced), |
| 17332 | - neighbours.around_mi(tu_mi, tx_px)[0], | 17392 | + &scan, |
| 17333 | - mode_for_tx, | 17393 | + 0, |
| 17334 | - y, | 17394 | + neighbours.around_mi(tu_mi, tx_px)[0], |
| 17335 | - tu_px, | 17395 | + mode_for_tx, |
| 17336 | - tu_py, | 17396 | + y, |
| 17337 | - tx_px, | 17397 | + tu_px, |
| 17338 | - base_q_idx, | 17398 | + tu_py, |
| 17339 | - &tu_pred, | 17399 | + tx_px, |
| 17340 | - None, | 17400 | + base_q_idx, |
| 17341 | - Some(tu_skip_ctx), | 17401 | + &tu_pred, |
| 17342 | - )?; | 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 | + }; | ||
| 17343 | if idx == 0 { | 17434 | if idx == 0 { |
| 17344 | first_tx_type = tu_tx_type; | 17435 | first_tx_type = tu_tx_type; |
| 17345 | } | 17436 | } |
| 17346 | - neighbours.record_mi_luma(tu_mi, tx_px, &tu_grid); | 17437 | + neighbours.record_mi_luma_rect(tu_mi, tw, th, &tu_grid); |
| 17347 | } | 17438 | } |
| 17348 | // `av1_get_tx_type`'s chroma lookup scales the chroma | 17439 | // `av1_get_tx_type`'s chroma lookup scales the chroma |
| 17349 | // position back to luma, so an inter block's chroma | 17440 | // position back to luma, so an inter block's chroma |
| @@ -17367,6 +17458,7 @@ fn decode_inter_block( | |||
| 17367 | py, | 17458 | py, |
| 17368 | &pred_y, | 17459 | &pred_y, |
| 17369 | None, | 17460 | None, |
| 17461 | + None, | ||
| 17370 | )?; | 17462 | )?; |
| 17371 | luma_tx_type = tx_type; | 17463 | luma_tx_type = tx_type; |
| 17372 | luma_grid = embed_rect_grid(&grid, write_w, write_h, side); | 17464 | luma_grid = embed_rect_grid(&grid, write_w, write_h, side); |
| @@ -17410,6 +17502,7 @@ fn decode_inter_block( | |||
| 17410 | cpy, | 17502 | cpy, |
| 17411 | &pred_u, | 17503 | &pred_u, |
| 17412 | Some(luma_tx_type), | 17504 | Some(luma_tx_type), |
| 17505 | + None, | ||
| 17413 | )? | 17506 | )? |
| 17414 | .0, | 17507 | .0, |
| 17415 | uw, | 17508 | uw, |
| @@ -17431,6 +17524,7 @@ fn decode_inter_block( | |||
| 17431 | cpy, | 17524 | cpy, |
| 17432 | &pred_v, | 17525 | &pred_v, |
| 17433 | Some(luma_tx_type), | 17526 | Some(luma_tx_type), |
| 17527 | + None, | ||
| 17434 | )? | 17528 | )? |
| 17435 | .0, | 17529 | .0, |
| 17436 | uw, | 17530 | uw, |
| @@ -18291,37 +18385,68 @@ fn decode_inter_block( | |||
| 18291 | // own slice of the block's motion-compensated predictor. | 18385 | // own slice of the block's motion-compensated predictor. |
| 18292 | let reduced = REDUCED_TX_SET_INTER.with(std::cell::Cell::get); | 18386 | let reduced = REDUCED_TX_SET_INTER.with(std::cell::Cell::get); |
| 18293 | let mut first_tx_type = TxType::DctDct; | 18387 | 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() { |
| 18295 | let tu_mi = (at_mi.0 + row, at_mi.1 + col); | 18389 | let tu_mi = (at_mi.0 + row, at_mi.1 + col); |
| 18296 | let (tu_px, tu_py) = (px + col * MI, py + row * MI); | 18390 | let (tu_px, tu_py) = (px + col * MI, py + row * MI); |
| 18297 | - let mut tu_pred = Vec::with_capacity(tx_px * tx_px); | 18391 | + let (tu_grid, tu_tx_type) = if tw == th { |
| 18298 | - for rr in 0..tx_px { | 18392 | + let tx_px = tw; |
| 18299 | - let start = (row * MI + rr) * side + col * MI; | 18393 | + let mut tu_pred = Vec::with_capacity(tx_px * tx_px); |
| 18300 | - tu_pred.extend_from_slice(&pred_y[start..start + tx_px]); | 18394 | + for rr in 0..tx_px { |
| 18301 | - } | 18395 | + let start = (row * MI + rr) * side + col * MI; |
| 18302 | - let scan = default_scan(tx_px); | 18396 | + tu_pred.extend_from_slice(&pred_y[start..start + tx_px]); |
| 18303 | - let tu_skip_ctx = neighbours.luma_skip_ctx(tu_mi, tx_px / MI); | 18397 | + } |
| 18304 | - let (tu_grid, tu_tx_type) = read_inter_plane( | 18398 | + let scan = default_scan(tx_px); |
| 18305 | - dec, | 18399 | + let tu_skip_ctx = neighbours.luma_skip_ctx(tu_mi, tx_px / MI); |
| 18306 | - cdfs, | 18400 | + read_inter_plane( |
| 18307 | - inter_txbset_for(tx_px, reduced), | 18401 | + dec, |
| 18308 | - &scan, | 18402 | + cdfs, |
| 18309 | - 0, | 18403 | + inter_txbset_for(tx_px, reduced), |
| 18310 | - neighbours.around_mi(tu_mi, tx_px)[0], | 18404 | + &scan, |
| 18311 | - mode_for_tx, | 18405 | + 0, |
| 18312 | - y, | 18406 | + neighbours.around_mi(tu_mi, tx_px)[0], |
| 18313 | - tu_px, | 18407 | + mode_for_tx, |
| 18314 | - tu_py, | 18408 | + y, |
| 18315 | - tx_px, | 18409 | + tu_px, |
| 18316 | - base_q_idx, | 18410 | + tu_py, |
| 18317 | - &tu_pred, | 18411 | + tx_px, |
| 18318 | - None, | 18412 | + base_q_idx, |
| 18319 | - Some(tu_skip_ctx), | 18413 | + &tu_pred, |
| 18320 | - )?; | 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 | + }; | ||
| 18321 | if idx == 0 { | 18446 | if idx == 0 { |
| 18322 | first_tx_type = tu_tx_type; | 18447 | first_tx_type = tu_tx_type; |
| 18323 | } | 18448 | } |
| 18324 | - neighbours.record_mi_luma(tu_mi, tx_px, &tu_grid); | 18449 | + neighbours.record_mi_luma_rect(tu_mi, tw, th, &tu_grid); |
| 18325 | } | 18450 | } |
| 18326 | // `av1_get_tx_type`'s chroma lookup scales the chroma | 18451 | // `av1_get_tx_type`'s chroma lookup scales the chroma |
| 18327 | // position back to luma, so an inter block's chroma | 18452 | // position back to luma, so an inter block's chroma |
| @@ -18345,6 +18470,7 @@ fn decode_inter_block( | |||
| 18345 | py, | 18470 | py, |
| 18346 | &pred_y, | 18471 | &pred_y, |
| 18347 | None, | 18472 | None, |
| 18473 | + None, | ||
| 18348 | )?; | 18474 | )?; |
| 18349 | luma_tx_type = tx_type; | 18475 | luma_tx_type = tx_type; |
| 18350 | luma_grid = embed_rect_grid(&grid, write_w, write_h, side); | 18476 | luma_grid = embed_rect_grid(&grid, write_w, write_h, side); |
| @@ -18388,6 +18514,7 @@ fn decode_inter_block( | |||
| 18388 | cpy, | 18514 | cpy, |
| 18389 | &pred_u, | 18515 | &pred_u, |
| 18390 | Some(luma_tx_type), | 18516 | Some(luma_tx_type), |
| 18517 | + None, | ||
| 18391 | )? | 18518 | )? |
| 18392 | .0, | 18519 | .0, |
| 18393 | uw, | 18520 | uw, |
| @@ -18409,6 +18536,7 @@ fn decode_inter_block( | |||
| 18409 | cpy, | 18536 | cpy, |
| 18410 | &pred_v, | 18537 | &pred_v, |
| 18411 | Some(luma_tx_type), | 18538 | Some(luma_tx_type), |
| 18539 | + None, | ||
| 18412 | )? | 18540 | )? |
| 18413 | .0, | 18541 | .0, |
| 18414 | uw, | 18542 | uw, |
| @@ -18672,7 +18800,7 @@ fn decode_inter_block( | |||
| 18672 | let split_luma = vartx_leaves.is_some(); | 18800 | let split_luma = vartx_leaves.is_some(); |
| 18673 | if let Some(leaves) = vartx_leaves.clone() { | 18801 | if let Some(leaves) = vartx_leaves.clone() { |
| 18674 | let reduced = REDUCED_TX_SET_INTER.with(std::cell::Cell::get); | 18802 | 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 { |
| 18676 | let tu_mi = (at_mi.0 + row, at_mi.1 + col); | 18804 | let tu_mi = (at_mi.0 + row, at_mi.1 + col); |
| 18677 | let (tu_px, tu_py) = (px + col * MI, py + row * MI); | 18805 | let (tu_px, tu_py) = (px + col * MI, py + row * MI); |
| 18678 | // A transform unit inside a block is not a block at that | 18806 | // A transform unit inside a block is not a block at that |
| @@ -18914,13 +19042,13 @@ fn decode_inter_block( | |||
| 18914 | // units, not the block. Chroma still reads `tx_h_grid / 2` (the block's | 19042 | // units, not the block. Chroma still reads `tx_h_grid / 2` (the block's |
| 18915 | // uv transform is not split) -- a known corner-cut of this round. | 19043 | // uv transform is not split) -- a known corner-cut of this round. |
| 18916 | if let Some(leaves) = &vartx_leaves { | 19044 | if let Some(leaves) = &vartx_leaves { |
| 18917 | - for &(row, col, tx_px) in leaves { | 19045 | + for &(row, col, tw, th) in leaves { |
| 18918 | neighbours.fill_lf_grid_rect( | 19046 | neighbours.fill_lf_grid_rect( |
| 18919 | (at_mi.0 + row, at_mi.1 + col), | 19047 | (at_mi.0 + row, at_mi.1 + col), |
| 18920 | - tx_px / MI, | 19048 | + tw / MI, |
| 18921 | - tx_px / MI, | 19049 | + th / MI, |
| 18922 | - tx_px as u8, | 19050 | + tw as u8, |
| 18923 | - tx_px as u8, | 19051 | + th as u8, |
| 18924 | if globalmv_for_lf { | 19052 | if globalmv_for_lf { |
| 18925 | -ref_frame_for_lf | 19053 | -ref_frame_for_lf |
| 18926 | } else { | 19054 | } 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
| @@ -84,10 +84,6 @@ const REFUSALS: &[&str] = &[ | |||
| 84 | "warp prediction with a scaled reference (superres, unimplemented)", | 84 | "warp prediction with a scaled reference (superres, unimplemented)", |
| 85 | "an 8x8 partition leaf under a scaled reference (superres, unimplemented)", | 85 | "an 8x8 partition leaf under a scaled reference (superres, unimplemented)", |
| 86 | "a motion_mode symbol for a block shape with no CDF row here", | 86 | "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", | ||
| 91 | ]; | 87 | ]; |
| 92 | 88 | ||
| 93 | /// Gates whose `Err` arm turns a decode failure into a printed SKIP rather than | 89 | /// 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(), |
| @@ -6782,6 +6789,240 @@ mod tests { | |||
| 6782 | } | 6789 | } |
| 6783 | } | 6790 | } |
| 6784 | 6791 | ||
| 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 | + | ||
| 6785 | /// lane-inter4 r2: the 32x32-level inter `PARTITION_HORZ`/`PARTITION_VERT` | 7026 | /// lane-inter4 r2: the 32x32-level inter `PARTITION_HORZ`/`PARTITION_VERT` |
| 6786 | /// strips (32x16 / 16x32) carrying a REAL residual -- the capability r1 | 7027 | /// strips (32x16 / 16x32) carrying a REAL residual -- the capability r1 |
| 6787 | /// found missing ("a non-skip rectangular (HORZ/VERT/HORZ_B) strip needs | 7028 | /// 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. | ||