Rectangular inter residual coding for 32x16/16x32 strips (gate red, refusal kept for every other shape)
Browse files at this commitb59491989442e517ac86b246883c726433fda61eParent: 968076f- feat
- rectangular inter residual coding for 32x16/16x32 strips (gate red, refusal kept for every other shape)
5 changed files +827 -35
- crates/ec-av1/src/cdf_state.rs +22 -0
- crates/ec-av1/src/decode.rs +483 -35
- crates/ec-av1/src/stream.rs +198 -0
- lanes/COMMON-20260901.md +11 -0
- lanes/inter4-r2.report.md +113 -0
crates/ec-av1/src/cdf_state.rsmodified+22 -0
| @@ -119,6 +119,16 @@ pub(crate) enum TxbSet { | |||
| 119 | /// [`LumaRect32x16`](TxbSet::LumaRect32x16) has none). | 119 | /// [`LumaRect32x16`](TxbSet::LumaRect32x16) has none). |
| 120 | LumaRect32x8, | 120 | LumaRect32x8, |
| 121 | LumaRect32x16, | 121 | LumaRect32x16, |
| 122 | + /// lane-inter4 r2: [`LumaRect32x16`](TxbSet::LumaRect32x16)'s INTER twin -- | ||
| 123 | + /// same coefficient tables (`get_txsize_entropy_ctx` reduces TX_32X16 and | ||
| 124 | + /// TX_16X32 alike to the 32x32 set, 512-coefficient `eob_pt`), but an | ||
| 125 | + /// inter block DOES code a `tx_type` symbol here: `av1_get_ext_tx_set_type` | ||
| 126 | + /// with `tx_size_sqr_up == TX_32X32` and `is_inter` returns | ||
| 127 | + /// `EXT_TX_SET_DCT_IDTX` (2 symbols), whose CDF is | ||
| 128 | + /// `default_inter_ext_tx_cdf[3][txsize_sqr_map[TX_32X16] == TX_16X16]`, | ||
| 129 | + /// i.e. exactly [`INTER_TX_TYPE_SET3_16`](crate::cdf::INTER_TX_TYPE_SET3_16) | ||
| 130 | + /// -- the same table the square `Luma16Inter` set reads. | ||
| 131 | + LumaRect32x16Inter, | ||
| 122 | /// The chroma 16x8/8x16 transform under the same strip (lane-rectwire): | 132 | /// The chroma 16x8/8x16 transform under the same strip (lane-rectwire): |
| 123 | /// [`Chroma16`](TxbSet::Chroma16)'s tables except `eob_pt`, which reads | 133 | /// [`Chroma16`](TxbSet::Chroma16)'s tables except `eob_pt`, which reads |
| 124 | /// the true 128-position [`crate::cdf::EOB_PT_128_CHROMA`] instead of | 134 | /// the true 128-position [`crate::cdf::EOB_PT_128_CHROMA`] instead of |
| @@ -1663,6 +1673,18 @@ impl Cdfs { | |||
| 1663 | tx_type: None, | 1673 | tx_type: None, |
| 1664 | eob_pt_class1: Some(&mut self.eob_pt_256_luma_class1), | 1674 | eob_pt_class1: Some(&mut self.eob_pt_256_luma_class1), |
| 1665 | }, | 1675 | }, |
| 1676 | + TxbSet::LumaRect32x16Inter => TxbTables { | ||
| 1677 | + side: 32, | ||
| 1678 | + txb_skip: &mut self.txb_skip_luma_32, | ||
| 1679 | + eob_pt: &mut self.eob_pt_512_luma, | ||
| 1680 | + eob_extra: &mut self.eob_extra_luma_32, | ||
| 1681 | + base: &mut self.base_luma_32, | ||
| 1682 | + base_eob: &mut self.base_eob_luma_32, | ||
| 1683 | + br: &mut self.br_luma_32, | ||
| 1684 | + dc_sign: &mut self.dc_sign_luma, | ||
| 1685 | + tx_type: Some(self.inter_tx_type_16.as_mut_slice()), | ||
| 1686 | + eob_pt_class1: Some(&mut self.eob_pt_512_luma_class1), | ||
| 1687 | + }, | ||
| 1666 | TxbSet::LumaRect32x16 => TxbTables { | 1688 | TxbSet::LumaRect32x16 => TxbTables { |
| 1667 | side: 32, | 1689 | side: 32, |
| 1668 | txb_skip: &mut self.txb_skip_luma_32, | 1690 | txb_skip: &mut self.txb_skip_luma_32, |
crates/ec-av1/src/decode.rsmodified+483 -35
| @@ -769,6 +769,11 @@ pub(crate) fn tx_depth_hits() -> usize { | |||
| 769 | thread_local! { | 769 | thread_local! { |
| 770 | static TXFM_SPLIT_READS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | 770 | static TXFM_SPLIT_READS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; |
| 771 | static TXFM_SPLIT_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | 771 | static TXFM_SPLIT_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; |
| 772 | + // lane-inter4 r2: rectangular INTER residual coding -- how many rect | ||
| 773 | + // strips coded one whole-block rect transform unit, and how many split | ||
| 774 | + // their rect max transform into square sub-transforms. | ||
| 775 | + static RECT_INTER_TU_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | ||
| 776 | + static RECT_INTER_TXSPLIT_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | ||
| 772 | // This frame's own `tx_mode == TxMode::Select` and `reduced_tx_set` bits, | 777 | // This frame's own `tx_mode == TxMode::Select` and `reduced_tx_set` bits, |
| 773 | // set once per inter tile by [`decode_inter_frame_tile_with_cdfs`] -- | 778 | // set once per inter tile by [`decode_inter_frame_tile_with_cdfs`] -- |
| 774 | // `decode_inter_block` already carries forty parameters and both are | 779 | // `decode_inter_block` already carries forty parameters and both are |
| @@ -787,6 +792,16 @@ pub(crate) fn txfm_split_hits() -> usize { | |||
| 787 | TXFM_SPLIT_HITS.with(|c| c.get()) | 792 | TXFM_SPLIT_HITS.with(|c| c.get()) |
| 788 | } | 793 | } |
| 789 | 794 | ||
| 795 | +/// Current value of [`RECT_INTER_TU_HITS`] (lane-inter4 r2). | ||
| 796 | +pub(crate) fn rect_inter_tu_hits() -> usize { | ||
| 797 | + RECT_INTER_TU_HITS.with(|c| c.get()) | ||
| 798 | +} | ||
| 799 | + | ||
| 800 | +/// Current value of [`RECT_INTER_TXSPLIT_HITS`] (lane-inter4 r2). | ||
| 801 | +pub(crate) fn rect_inter_txsplit_hits() -> usize { | ||
| 802 | + RECT_INTER_TXSPLIT_HITS.with(|c| c.get()) | ||
| 803 | +} | ||
| 804 | + | ||
| 790 | /// Sets the current thread's [`TX_SELECT_INTER`]/[`REDUCED_TX_SET_INTER`]. | 805 | /// Sets the current thread's [`TX_SELECT_INTER`]/[`REDUCED_TX_SET_INTER`]. |
| 791 | pub(crate) fn set_inter_tx_mode(tx_select: bool, reduced_tx_set: bool) { | 806 | pub(crate) fn set_inter_tx_mode(tx_select: bool, reduced_tx_set: bool) { |
| 792 | TX_SELECT_INTER.with(|c| c.set(tx_select)); | 807 | TX_SELECT_INTER.with(|c| c.set(tx_select)); |
| @@ -3874,12 +3889,21 @@ impl Neighbours { | |||
| 3874 | grids: &[Vec<i32>; 3], | 3889 | grids: &[Vec<i32>; 3], |
| 3875 | ) { | 3890 | ) { |
| 3876 | let (r, c) = (at_mi.0 / (SUB / MI), at_mi.1 / (SUB / MI)); | 3891 | let (r, c) = (at_mi.0 / (SUB / MI), at_mi.1 / (SUB / MI)); |
| 3892 | + // lane-inter4 r2: a strip whose own footprint runs past the frame's | ||
| 3893 | + // last 16-px column/row stamps only the cells that exist (libaom's | ||
| 3894 | + // arrays are padded past the frame and those cells are never read). | ||
| 3877 | for cell in 0..w / SUB { | 3895 | for cell in 0..w / SUB { |
| 3896 | + if c + cell >= self.above_mode.len() { | ||
| 3897 | + break; | ||
| 3898 | + } | ||
| 3878 | self.above_mode[c + cell] = mode; | 3899 | self.above_mode[c + cell] = mode; |
| 3879 | self.above_uv_mode[c + cell] = uv_mode; | 3900 | self.above_uv_mode[c + cell] = uv_mode; |
| 3880 | self.above_side[c + cell] = w; | 3901 | self.above_side[c + cell] = w; |
| 3881 | } | 3902 | } |
| 3882 | for cell in 0..h / SUB { | 3903 | for cell in 0..h / SUB { |
| 3904 | + if r + cell >= self.left_mode.len() { | ||
| 3905 | + break; | ||
| 3906 | + } | ||
| 3883 | self.left_mode[r + cell] = mode; | 3907 | self.left_mode[r + cell] = mode; |
| 3884 | self.left_uv_mode[r + cell] = uv_mode; | 3908 | self.left_uv_mode[r + cell] = uv_mode; |
| 3885 | self.left_side[r + cell] = h; | 3909 | self.left_side[r + cell] = h; |
| @@ -3910,10 +3934,14 @@ impl Neighbours { | |||
| 3910 | let states: [Neighbour; 3] = std::array::from_fn(|plane| neighbour_state(&grids[plane])); | 3934 | let states: [Neighbour; 3] = std::array::from_fn(|plane| neighbour_state(&grids[plane])); |
| 3911 | let (w_mi, h_mi) = (w / MI, h / MI); | 3935 | let (w_mi, h_mi) = (w / MI, h / MI); |
| 3912 | for cell in 0..h_mi { | 3936 | for cell in 0..h_mi { |
| 3913 | - self.left_side_mi[mi_r + cell] = h; | 3937 | + if let Some(slot) = self.left_side_mi.get_mut(mi_r + cell) { |
| 3938 | + *slot = h; | ||
| 3939 | + } | ||
| 3914 | } | 3940 | } |
| 3915 | for cell in 0..w_mi { | 3941 | for cell in 0..w_mi { |
| 3916 | - self.above_side_mi[mi_c + cell] = w; | 3942 | + if let Some(slot) = self.above_side_mi.get_mut(mi_c + cell) { |
| 3943 | + *slot = w; | ||
| 3944 | + } | ||
| 3917 | } | 3945 | } |
| 3918 | // A chroma 4x4 unit straddling the true luma edge is still whole in | 3946 | // A chroma 4x4 unit straddling the true luma edge is still whole in |
| 3919 | // chroma's own halved grid, so libaom rounds the luma bound up to the | 3947 | // chroma's own halved grid, so libaom rounds the luma bound up to the |
| @@ -4018,11 +4046,17 @@ impl Neighbours { | |||
| 4018 | ) { | 4046 | ) { |
| 4019 | let (r, c) = (at_mi.0 / (SUB / MI), at_mi.1 / (SUB / MI)); | 4047 | let (r, c) = (at_mi.0 / (SUB / MI), at_mi.1 / (SUB / MI)); |
| 4020 | for cell in 0..w / SUB { | 4048 | for cell in 0..w / SUB { |
| 4049 | + if c + cell >= self.above_mode.len() { | ||
| 4050 | + break; | ||
| 4051 | + } | ||
| 4021 | self.above_mode[c + cell] = mode; | 4052 | self.above_mode[c + cell] = mode; |
| 4022 | self.above_uv_mode[c + cell] = uv_mode; | 4053 | self.above_uv_mode[c + cell] = uv_mode; |
| 4023 | self.above_side[c + cell] = w; | 4054 | self.above_side[c + cell] = w; |
| 4024 | } | 4055 | } |
| 4025 | for cell in 0..h / SUB { | 4056 | for cell in 0..h / SUB { |
| 4057 | + if r + cell >= self.left_mode.len() { | ||
| 4058 | + break; | ||
| 4059 | + } | ||
| 4026 | self.left_mode[r + cell] = mode; | 4060 | self.left_mode[r + cell] = mode; |
| 4027 | self.left_uv_mode[r + cell] = uv_mode; | 4061 | self.left_uv_mode[r + cell] = uv_mode; |
| 4028 | self.left_side[r + cell] = h; | 4062 | self.left_side[r + cell] = h; |
| @@ -4032,10 +4066,14 @@ impl Neighbours { | |||
| 4032 | self.record_mode_mi(mi_r, mi_c, w_mi, h_mi, mode); | 4066 | self.record_mode_mi(mi_r, mi_c, w_mi, h_mi, mode); |
| 4033 | self.record_uv_mode_mi(mi_r, mi_c, w_mi, h_mi, uv_mode); | 4067 | self.record_uv_mode_mi(mi_r, mi_c, w_mi, h_mi, uv_mode); |
| 4034 | for cell in 0..h_mi { | 4068 | for cell in 0..h_mi { |
| 4035 | - self.left_side_mi[mi_r + cell] = h; | 4069 | + if let Some(slot) = self.left_side_mi.get_mut(mi_r + cell) { |
| 4070 | + *slot = h; | ||
| 4071 | + } | ||
| 4036 | } | 4072 | } |
| 4037 | for cell in 0..w_mi { | 4073 | for cell in 0..w_mi { |
| 4038 | - self.above_side_mi[mi_c + cell] = w; | 4074 | + if let Some(slot) = self.above_side_mi.get_mut(mi_c + cell) { |
| 4075 | + *slot = w; | ||
| 4076 | + } | ||
| 4039 | } | 4077 | } |
| 4040 | let round_up_even = |n: usize| n.div_ceil(2) * 2; | 4078 | let round_up_even = |n: usize| n.div_ceil(2) * 2; |
| 4041 | let (bound_h, bound_w) = (round_up_even(self.mi_rows), round_up_even(self.mi_cols)); | 4079 | let (bound_h, bound_w) = (round_up_even(self.mi_rows), round_up_even(self.mi_cols)); |
| @@ -8705,8 +8743,25 @@ fn read_tx_size( | |||
| 8705 | /// the two neighbour terms (whether the transform last written above/left of | 8743 | /// the two neighbour terms (whether the transform last written above/left of |
| 8706 | /// this unit is narrower/shorter than the unit itself). | 8744 | /// this unit is narrower/shorter than the unit itself). |
| 8707 | fn txfm_partition_ctx(above_px: u8, left_px: u8, blk_max_px: usize, tx_px: usize) -> usize { | 8745 | fn txfm_partition_ctx(above_px: u8, left_px: u8, blk_max_px: usize, tx_px: usize) -> usize { |
| 8708 | - let above = usize::from(usize::from(above_px) < tx_px); | 8746 | + txfm_partition_ctx_rect(above_px, left_px, blk_max_px, tx_px, tx_px) |
| 8709 | - let left = usize::from(usize::from(left_px) < tx_px); | 8747 | +} |
| 8748 | + | ||
| 8749 | +/// [`txfm_partition_ctx`] for a *rectangular* transform (lane-inter4 r2): | ||
| 8750 | +/// libaom's `txfm_partition_context` compares the above context against | ||
| 8751 | +/// `tx_size_wide` and the left one against `tx_size_high`, and takes its | ||
| 8752 | +/// category from `txsize_sqr_up_map[tx_size]` -- all three collapse to one | ||
| 8753 | +/// side for a square transform, which is why the square form above is a | ||
| 8754 | +/// special case of this one. | ||
| 8755 | +fn txfm_partition_ctx_rect( | ||
| 8756 | + above_px: u8, | ||
| 8757 | + left_px: u8, | ||
| 8758 | + blk_max_px: usize, | ||
| 8759 | + tx_w: usize, | ||
| 8760 | + tx_h: usize, | ||
| 8761 | +) -> usize { | ||
| 8762 | + let above = usize::from(usize::from(above_px) < tx_w); | ||
| 8763 | + let left = usize::from(usize::from(left_px) < tx_h); | ||
| 8764 | + let tx_px = tx_w.max(tx_h); | ||
| 8710 | // `get_sqr_tx_size(max(block_size_wide, block_size_high))`, capped at the | 8765 | // `get_sqr_tx_size(max(block_size_wide, block_size_high))`, capped at the |
| 8711 | // largest transform (`TX_64X64`); `TX_4X4`..`TX_64X64` index as | 8766 | // largest transform (`TX_64X64`); `TX_4X4`..`TX_64X64` index as |
| 8712 | // `log2(px) - 2`. | 8767 | // `log2(px) - 2`. |
| @@ -8721,16 +8776,30 @@ fn txfm_partition_ctx(above_px: u8, left_px: u8, blk_max_px: usize, tx_px: usize | |||
| 8721 | /// resolved transform's own size. | 8776 | /// resolved transform's own size. |
| 8722 | fn txfm_partition_update( | 8777 | fn txfm_partition_update( |
| 8723 | n: &mut Neighbours, | 8778 | n: &mut Neighbours, |
| 8724 | - (mi_r, mi_c): (usize, usize), | 8779 | + at_mi: (usize, usize), |
| 8725 | tx_px: usize, | 8780 | tx_px: usize, |
| 8726 | txb_px: usize, | 8781 | txb_px: usize, |
| 8727 | ) { | 8782 | ) { |
| 8728 | - for i in 0..txb_px / MI { | 8783 | + txfm_partition_update_rect(n, at_mi, (tx_px, tx_px), (txb_px, txb_px)); |
| 8784 | +} | ||
| 8785 | + | ||
| 8786 | +/// [`txfm_partition_update`] for a rectangular transform (lane-inter4 r2): | ||
| 8787 | +/// the left column records `tx_size_high` over the parent's own height and | ||
| 8788 | +/// the above row records `tx_size_wide` over its width. | ||
| 8789 | +fn txfm_partition_update_rect( | ||
| 8790 | + n: &mut Neighbours, | ||
| 8791 | + (mi_r, mi_c): (usize, usize), | ||
| 8792 | + (tx_w, tx_h): (usize, usize), | ||
| 8793 | + (txb_w, txb_h): (usize, usize), | ||
| 8794 | +) { | ||
| 8795 | + for i in 0..txb_h / MI { | ||
| 8729 | if let Some(cell) = n.left_txfm.get_mut(mi_r + i) { | 8796 | if let Some(cell) = n.left_txfm.get_mut(mi_r + i) { |
| 8730 | - *cell = tx_px as u8; | 8797 | + *cell = tx_h as u8; |
| 8731 | } | 8798 | } |
| 8799 | + } | ||
| 8800 | + for i in 0..txb_w / MI { | ||
| 8732 | if let Some(cell) = n.above_txfm.get_mut(mi_c + i) { | 8801 | if let Some(cell) = n.above_txfm.get_mut(mi_c + i) { |
| 8733 | - *cell = tx_px as u8; | 8802 | + *cell = tx_w as u8; |
| 8734 | } | 8803 | } |
| 8735 | } | 8804 | } |
| 8736 | } | 8805 | } |
| @@ -8939,6 +9008,198 @@ fn read_block_tx_size( | |||
| 8939 | Ok((tx, None)) | 9008 | Ok((tx, None)) |
| 8940 | } | 9009 | } |
| 8941 | 9010 | ||
| 9011 | +/// lane-inter4 r2: the shapes whose *rectangular inter* residual this | ||
| 9012 | +/// decoder codes -- a 2:1 strip whose own max rect transform | ||
| 9013 | +/// (`max_txsize_rect_lookup[BLOCK_32X16] == TX_32X16`) has both a | ||
| 9014 | +/// coefficient table set ([`TxbSet::LumaRect32x16Inter`], 512-coefficient | ||
| 9015 | +/// `eob_pt`) and a `tx_type` alphabet here. 64x32/64x16 strips would need a | ||
| 9016 | +/// 64-point rect transform, and 16x8/8x16 needs | ||
| 9017 | +/// `default_inter_ext_tx_cdf[2][TX_8X8]` (the 12-symbol | ||
| 9018 | +/// `DTT9_IDTX_1DDCT` row at `tx_size_sqr == TX_8X8`, only reachable through a | ||
| 9019 | +/// rect transform), neither of which exists yet -- both stay refused by name. | ||
| 9020 | +fn rect_inter_residual_supported(w: usize, h: usize) -> bool { | ||
| 9021 | + matches!((w, h), (32, 16) | (16, 32)) | ||
| 9022 | +} | ||
| 9023 | + | ||
| 9024 | +/// The default (2D) coefficient scan of a rectangular transform. | ||
| 9025 | +fn rect_scan(w: usize, h: usize) -> &'static [u16] { | ||
| 9026 | + match (w, h) { | ||
| 9027 | + (32, 16) => &SCAN_32X16, | ||
| 9028 | + (16, 32) => &SCAN_16X32, | ||
| 9029 | + (16, 8) => &SCAN_16X8, | ||
| 9030 | + (8, 16) => &SCAN_8X16, | ||
| 9031 | + (8, 4) => &SCAN_8X4, | ||
| 9032 | + (4, 8) => &SCAN_4X8, | ||
| 9033 | + _ => unreachable!("rect_inter_residual_supported gates every shape that reaches here"), | ||
| 9034 | + } | ||
| 9035 | +} | ||
| 9036 | + | ||
| 9037 | +/// [`read_block_tx_size`] for a rectangular inter block (lane-inter4 r2): | ||
| 9038 | +/// spec 5.11.17 / libaom `read_tx_size_vartx` starting from the block's own | ||
| 9039 | +/// `max_txsize_rect_lookup` entry, which for a 2:1 strip IS rectangular. The | ||
| 9040 | +/// depth-0 `txfm_partition` symbol reads its context off the rect transform's | ||
| 9041 | +/// own width/height; a `0` leaves one whole-block rect transform unit | ||
| 9042 | +/// (`None`), and a `1` splits it into `sub_tx_size_map`'s two SQUARE | ||
| 9043 | +/// sub-transforms (`sub_tx_size_map[TX_32X16] == TX_16X16`), from which the | ||
| 9044 | +/// ordinary square [`read_var_tx_size`] recursion continues at depth 1 -- so | ||
| 9045 | +/// every leaf of a split rect block is square and the existing square leaf | ||
| 9046 | +/// loop reconstructs it unchanged. | ||
| 9047 | +#[allow(clippy::too_many_arguments)] | ||
| 9048 | +fn read_block_tx_size_rect( | ||
| 9049 | + dec: &mut SymbolDecoder, | ||
| 9050 | + cdfs: &mut Cdfs, | ||
| 9051 | + n: &mut Neighbours, | ||
| 9052 | + at_mi: (usize, usize), | ||
| 9053 | + (bw, bh): (usize, usize), | ||
| 9054 | + (mi_cols, mi_rows): (usize, usize), | ||
| 9055 | + skip: bool, | ||
| 9056 | +) -> Result<Option<Vec<(usize, usize, usize)>>> { | ||
| 9057 | + if skip { | ||
| 9058 | + // `set_txfm_ctxs(.., skip && is_inter)`: a skipped inter block records | ||
| 9059 | + // its own BLOCK size -- width above, height left -- not a transform. | ||
| 9060 | + txfm_partition_update_rect(n, at_mi, (bw, bh), (bw, bh)); | ||
| 9061 | + return Ok(None); | ||
| 9062 | + } | ||
| 9063 | + // `max_txsize_rect_lookup` is the block's own size, capped at 64 -- and | ||
| 9064 | + // `rect_inter_residual_supported` has already excluded everything above 32. | ||
| 9065 | + let (tx_w, tx_h) = (bw, bh); | ||
| 9066 | + if !TX_SELECT_INTER.with(std::cell::Cell::get) { | ||
| 9067 | + // `TX_MODE_LARGEST`: no symbol at all, the whole block is one | ||
| 9068 | + // transform, and `set_txfm_ctxs` records exactly what | ||
| 9069 | + // `txfm_partition_update` would for that same unit. | ||
| 9070 | + txfm_partition_update_rect(n, at_mi, (tx_w, tx_h), (bw, bh)); | ||
| 9071 | + RECT_INTER_TU_HITS.with(|c| c.set(c.get() + 1)); | ||
| 9072 | + return Ok(None); | ||
| 9073 | + } | ||
| 9074 | + let ctx = txfm_partition_ctx_rect( | ||
| 9075 | + n.above_txfm[at_mi.1], | ||
| 9076 | + n.left_txfm[at_mi.0], | ||
| 9077 | + bw.max(bh), | ||
| 9078 | + tx_w, | ||
| 9079 | + tx_h, | ||
| 9080 | + ); | ||
| 9081 | + let split = dec.symbol(&mut cdfs.txfm_partition[ctx]) == 1; | ||
| 9082 | + TXFM_SPLIT_READS.with(|c| c.set(c.get() + 1)); | ||
| 9083 | + if std::env::var_os("EC_TRACE_MODE_STEP").is_some() { | ||
| 9084 | + let (rng, _) = dec.debug_state(); | ||
| 9085 | + eprintln!( | ||
| 9086 | + "EC_ISTEP mi_row={} mi_col={} name=txfm_split_rect val={} ctx={ctx} rng={rng}", | ||
| 9087 | + at_mi.0, | ||
| 9088 | + at_mi.1, | ||
| 9089 | + u8::from(split) | ||
| 9090 | + ); | ||
| 9091 | + } | ||
| 9092 | + if !split { | ||
| 9093 | + txfm_partition_update_rect(n, at_mi, (tx_w, tx_h), (bw, bh)); | ||
| 9094 | + RECT_INTER_TU_HITS.with(|c| c.set(c.get() + 1)); | ||
| 9095 | + return Ok(None); | ||
| 9096 | + } | ||
| 9097 | + TXFM_SPLIT_HITS.with(|c| c.set(c.get() + 1)); | ||
| 9098 | + RECT_INTER_TXSPLIT_HITS.with(|c| c.set(c.get() + 1)); | ||
| 9099 | + let sub = tx_w.min(tx_h); | ||
| 9100 | + let max_w_mi = (bw / MI).min(mi_cols.saturating_sub(at_mi.1)); | ||
| 9101 | + let max_h_mi = (bh / MI).min(mi_rows.saturating_sub(at_mi.0)); | ||
| 9102 | + let mut leaves = Vec::new(); | ||
| 9103 | + for row in (0..bh / MI).step_by(sub / MI) { | ||
| 9104 | + for col in (0..bw / MI).step_by(sub / MI) { | ||
| 9105 | + read_var_tx_size( | ||
| 9106 | + dec, | ||
| 9107 | + cdfs, | ||
| 9108 | + n, | ||
| 9109 | + at_mi, | ||
| 9110 | + bw.max(bh), | ||
| 9111 | + (max_w_mi, max_h_mi), | ||
| 9112 | + sub, | ||
| 9113 | + 1, | ||
| 9114 | + row, | ||
| 9115 | + col, | ||
| 9116 | + &mut leaves, | ||
| 9117 | + ); | ||
| 9118 | + } | ||
| 9119 | + } | ||
| 9120 | + Ok(Some(leaves)) | ||
| 9121 | +} | ||
| 9122 | + | ||
| 9123 | +/// [`read_inter_plane`] for a rectangular transform unit (lane-inter4 r2): | ||
| 9124 | +/// the coefficients are read with the rect coefficient machinery | ||
| 9125 | +/// ([`read_coeffs_rect`], whose `TxClass` handling covers the 1D `V_*`/`H_*` | ||
| 9126 | +/// types), inverted with the rect inverse transform | ||
| 9127 | +/// ([`dequant_and_inverse_typed_wh`], which carries the 2:1 `sqrt2` scale), | ||
| 9128 | +/// and added onto the top-left `w x h` of the block's own square-strided | ||
| 9129 | +/// motion-compensated prediction buffer. Returns the *rect* coefficient grid | ||
| 9130 | +/// and the coded `tx_type`. | ||
| 9131 | +/// | ||
| 9132 | +/// `txb_skip_ctx` is 0 for luma: this unit covers the whole block, i.e. | ||
| 9133 | +/// `get_txb_ctx`'s `plane_bsize == txsize_to_bsize[tx_size]` branch. | ||
| 9134 | +#[allow(clippy::too_many_arguments)] | ||
| 9135 | +fn read_inter_plane_rect( | ||
| 9136 | + dec: &mut SymbolDecoder, | ||
| 9137 | + cdfs: &mut Cdfs, | ||
| 9138 | + set: TxbSet, | ||
| 9139 | + (w, h): (usize, usize), | ||
| 9140 | + stride: usize, | ||
| 9141 | + plane_idx: usize, | ||
| 9142 | + around: (bool, bool, i32), | ||
| 9143 | + tx_mode: usize, | ||
| 9144 | + plane: &mut PlaneBuf, | ||
| 9145 | + x: usize, | ||
| 9146 | + y: usize, | ||
| 9147 | + prediction: &[u16], | ||
| 9148 | + inherited_luma_tx_type: Option<TxType>, | ||
| 9149 | +) -> Result<(Vec<i32>, TxType)> { | ||
| 9150 | + let skip_ctx = if plane_idx == 0 { | ||
| 9151 | + 0 | ||
| 9152 | + } else { | ||
| 9153 | + usize::from(around.0) + usize::from(around.1) | ||
| 9154 | + }; | ||
| 9155 | + let mut coding = cdfs.txb(set, tx_mode); | ||
| 9156 | + // `av1_get_ext_tx_set_type`'s DCT-only clamp is on `tx_size_sqr_up`, i.e. | ||
| 9157 | + // the *longer* side of this rect transform. | ||
| 9158 | + let default_tx_type = match inherited_luma_tx_type { | ||
| 9159 | + Some(t) if w.max(h) < 32 => t, | ||
| 9160 | + _ => TxType::DctDct, | ||
| 9161 | + }; | ||
| 9162 | + let (grid, tx_type) = read_coeffs_rect( | ||
| 9163 | + dec, | ||
| 9164 | + &mut coding, | ||
| 9165 | + rect_scan(w, h), | ||
| 9166 | + w, | ||
| 9167 | + h, | ||
| 9168 | + skip_ctx, | ||
| 9169 | + dc_sign_ctx(around.2), | ||
| 9170 | + default_tx_type, | ||
| 9171 | + )?; | ||
| 9172 | + let (dc_delta, ac_delta) = plane_q_delta(plane_idx); | ||
| 9173 | + let residual = dequant_and_inverse_typed_wh( | ||
| 9174 | + &grid, | ||
| 9175 | + w, | ||
| 9176 | + h, | ||
| 9177 | + bit_depth(), | ||
| 9178 | + block_q_idx(), | ||
| 9179 | + dc_delta, | ||
| 9180 | + ac_delta, | ||
| 9181 | + tx_type, | ||
| 9182 | + ); | ||
| 9183 | + // `reconstruct_mc_rect` reads both buffers at the square prediction | ||
| 9184 | + // stride, so the dense `w x h` residual is re-laid at that stride first. | ||
| 9185 | + let mut strided = vec![0i32; stride * stride]; | ||
| 9186 | + for row in 0..h { | ||
| 9187 | + strided[row * stride..][..w].copy_from_slice(&residual[row * w..][..w]); | ||
| 9188 | + } | ||
| 9189 | + plane.reconstruct_mc_rect(x, y, stride, w, h, prediction, &strided); | ||
| 9190 | + Ok((grid, tx_type)) | ||
| 9191 | +} | ||
| 9192 | + | ||
| 9193 | +/// A rect coefficient grid re-laid into the square `stride x stride` grid the | ||
| 9194 | +/// neighbour/deblock stamps downstream of the residual expect. | ||
| 9195 | +fn embed_rect_grid(grid: &[i32], w: usize, h: usize, stride: usize) -> Vec<i32> { | ||
| 9196 | + let mut full = vec![0i32; stride * stride]; | ||
| 9197 | + for row in 0..h { | ||
| 9198 | + full[row * stride..][..w].copy_from_slice(&grid[row * w..][..w]); | ||
| 9199 | + } | ||
| 9200 | + full | ||
| 9201 | +} | ||
| 9202 | + | ||
| 8942 | /// One 8x8 inter leaf's luma residual (lane-txselect): either the whole-8x8 | 9203 | /// One 8x8 inter leaf's luma residual (lane-txselect): either the whole-8x8 |
| 8943 | /// transform, or -- when [`read_block_tx_size`]'s var-tx tree took the single | 9204 | /// transform, or -- when [`read_block_tx_size`]'s var-tx tree took the single |
| 8944 | /// split a `BLOCK_8X8` can take (`split`) -- the four 4x4 transform units in | 9205 | /// split a `BLOCK_8X8` can take (`split`) -- the four 4x4 transform units in |
| @@ -13019,7 +13280,10 @@ fn decode_inter_block( | |||
| 13019 | // lane-warp r5: see `reject_residual` -- a square-block decode of a | 13280 | // lane-warp r5: see `reject_residual` -- a square-block decode of a |
| 13020 | // HORZ_B strip is symbol-exact only for `skip` (no residual, no | 13281 | // HORZ_B strip is symbol-exact only for `skip` (no residual, no |
| 13021 | // motion_mode/warp symbol), so gate here before any further read. | 13282 | // motion_mode/warp symbol), so gate here before any further read. |
| 13022 | - if reject_residual && !skip { | 13283 | + if reject_residual && !skip && !rect_inter_residual_supported(write_w, write_h) { |
| 13284 | + if std::env::var_os("EC_AV1_RECT_DUMP").is_some() { | ||
| 13285 | + eprintln!("EC_RECT_REFUSE mi_row={rmi} mi_col={cmi} w={write_w} h={write_h} side={side}"); | ||
| 13286 | + } | ||
| 13023 | return Err(unsupported( | 13287 | return Err(unsupported( |
| 13024 | "a non-skip rectangular (HORZ/VERT/HORZ_B) strip needs rectangular residual coding", | 13288 | "a non-skip rectangular (HORZ/VERT/HORZ_B) strip needs rectangular residual coding", |
| 13025 | )); | 13289 | )); |
| @@ -13823,17 +14087,32 @@ fn decode_inter_block( | |||
| 13823 | mc::combine_compound(&inter0_v, &inter1_v, fwd_offset, bck_offset, &mut pred_v); | 14087 | mc::combine_compound(&inter0_v, &inter1_v, fwd_offset, bck_offset, &mut pred_v); |
| 13824 | } | 14088 | } |
| 13825 | 14089 | ||
| 13826 | - vartx_leaves = read_block_tx_size( | 14090 | + // lane-inter4 r2: a rectangular strip's transform tree starts from |
| 13827 | - dec, | 14091 | + // its own rect `max_txsize_rect_lookup` entry, not a square one. |
| 13828 | - cdfs, | 14092 | + let rect_tu = (write_w, write_h) != (side, side); |
| 13829 | - neighbours, | 14093 | + vartx_leaves = if rect_tu { |
| 13830 | - at_mi, | 14094 | + read_block_tx_size_rect( |
| 13831 | - side, | 14095 | + dec, |
| 13832 | - (mi_cols as usize, mi_rows as usize), | 14096 | + cdfs, |
| 13833 | - true, | 14097 | + neighbours, |
| 13834 | - skip, | 14098 | + at_mi, |
| 13835 | - )? | 14099 | + (write_w, write_h), |
| 13836 | - .1; | 14100 | + (mi_cols as usize, mi_rows as usize), |
| 14101 | + skip, | ||
| 14102 | + )? | ||
| 14103 | + } else { | ||
| 14104 | + read_block_tx_size( | ||
| 14105 | + dec, | ||
| 14106 | + cdfs, | ||
| 14107 | + neighbours, | ||
| 14108 | + at_mi, | ||
| 14109 | + side, | ||
| 14110 | + (mi_cols as usize, mi_rows as usize), | ||
| 14111 | + true, | ||
| 14112 | + skip, | ||
| 14113 | + )? | ||
| 14114 | + .1 | ||
| 14115 | + }; | ||
| 13837 | if skip { | 14116 | if skip { |
| 13838 | y.reconstruct_mc_rect( | 14117 | y.reconstruct_mc_rect( |
| 13839 | px, | 14118 | px, |
| @@ -13866,7 +14145,14 @@ fn decode_inter_block( | |||
| 13866 | u_grid = vec![0i32; chroma_side * chroma_side]; | 14145 | u_grid = vec![0i32; chroma_side * chroma_side]; |
| 13867 | v_grid = vec![0i32; chroma_side * chroma_side]; | 14146 | v_grid = vec![0i32; chroma_side * chroma_side]; |
| 13868 | } else { | 14147 | } else { |
| 13869 | - let around = neighbours.around_mi(at, side); | 14148 | + // lane-inter4 r2: a rect strip's coefficient context spans its |
| 14149 | + // OWN width above and height left -- reading `side` cells both | ||
| 14150 | + // ways indexes past the tile's last mi row for a bottom strip. | ||
| 14151 | + let around = if rect_tu { | ||
| 14152 | + neighbours.around_mi_rect(at_mi, write_w, write_h) | ||
| 14153 | + } else { | ||
| 14154 | + neighbours.around_mi(at, side) | ||
| 14155 | + }; | ||
| 13870 | let luma_tx_type; | 14156 | let luma_tx_type; |
| 13871 | if let Some(leaves) = vartx_leaves.clone() { | 14157 | if let Some(leaves) = vartx_leaves.clone() { |
| 13872 | // spec 5.11.17's transform tree, leaf by leaf in the order | 14158 | // spec 5.11.17's transform tree, leaf by leaf in the order |
| @@ -13913,6 +14199,26 @@ fn decode_inter_block( | |||
| 13913 | // inherits the *first* (top-left) luma unit's coded type. | 14199 | // inherits the *first* (top-left) luma unit's coded type. |
| 13914 | luma_tx_type = first_tx_type; | 14200 | luma_tx_type = first_tx_type; |
| 13915 | luma_grid = vec![0i32; side * side]; | 14201 | luma_grid = vec![0i32; side * side]; |
| 14202 | + } else if rect_tu { | ||
| 14203 | + // The whole-block rectangular transform unit | ||
| 14204 | + // (`txfm_partition` said 0 at depth 0). | ||
| 14205 | + let (grid, tx_type) = read_inter_plane_rect( | ||
| 14206 | + dec, | ||
| 14207 | + cdfs, | ||
| 14208 | + TxbSet::LumaRect32x16Inter, | ||
| 14209 | + (write_w, write_h), | ||
| 14210 | + side, | ||
| 14211 | + 0, | ||
| 14212 | + around[0], | ||
| 14213 | + mode_for_tx, | ||
| 14214 | + y, | ||
| 14215 | + px, | ||
| 14216 | + py, | ||
| 14217 | + &pred_y, | ||
| 14218 | + None, | ||
| 14219 | + )?; | ||
| 14220 | + luma_tx_type = tx_type; | ||
| 14221 | + luma_grid = embed_rect_grid(&grid, write_w, write_h, side); | ||
| 13916 | } else { | 14222 | } else { |
| 13917 | (luma_grid, luma_tx_type) = read_inter_plane( | 14223 | (luma_grid, luma_tx_type) = read_inter_plane( |
| 13918 | dec, | 14224 | dec, |
| @@ -13932,6 +14238,55 @@ fn decode_inter_block( | |||
| 13932 | None, | 14238 | None, |
| 13933 | )?; | 14239 | )?; |
| 13934 | } | 14240 | } |
| 14241 | + if rect_tu { | ||
| 14242 | + // `av1_get_max_uv_txsize(bsize)`: the chroma transform of a | ||
| 14243 | + // 2:1 strip is the strip's own rect chroma size (16x8 / | ||
| 14244 | + // 8x16), one unit for the whole block, and it codes no | ||
| 14245 | + // `tx_type` symbol -- it inherits the luma unit's. | ||
| 14246 | + let (uw, uh) = (write_chroma_w, write_chroma_h); | ||
| 14247 | + u_grid = embed_rect_grid( | ||
| 14248 | + &read_inter_plane_rect( | ||
| 14249 | + dec, | ||
| 14250 | + cdfs, | ||
| 14251 | + TxbSet::ChromaRect16x8, | ||
| 14252 | + (uw, uh), | ||
| 14253 | + chroma_side, | ||
| 14254 | + 1, | ||
| 14255 | + around[1], | ||
| 14256 | + mode_for_tx, | ||
| 14257 | + u, | ||
| 14258 | + cpx, | ||
| 14259 | + cpy, | ||
| 14260 | + &pred_u, | ||
| 14261 | + Some(luma_tx_type), | ||
| 14262 | + )? | ||
| 14263 | + .0, | ||
| 14264 | + uw, | ||
| 14265 | + uh, | ||
| 14266 | + chroma_side, | ||
| 14267 | + ); | ||
| 14268 | + v_grid = embed_rect_grid( | ||
| 14269 | + &read_inter_plane_rect( | ||
| 14270 | + dec, | ||
| 14271 | + cdfs, | ||
| 14272 | + TxbSet::ChromaRect16x8, | ||
| 14273 | + (uw, uh), | ||
| 14274 | + chroma_side, | ||
| 14275 | + 2, | ||
| 14276 | + around[2], | ||
| 14277 | + mode_for_tx, | ||
| 14278 | + v, | ||
| 14279 | + cpx, | ||
| 14280 | + cpy, | ||
| 14281 | + &pred_v, | ||
| 14282 | + Some(luma_tx_type), | ||
| 14283 | + )? | ||
| 14284 | + .0, | ||
| 14285 | + uw, | ||
| 14286 | + uh, | ||
| 14287 | + chroma_side, | ||
| 14288 | + ); | ||
| 14289 | + } else { | ||
| 13935 | u_grid = read_inter_plane( | 14290 | u_grid = read_inter_plane( |
| 13936 | dec, | 14291 | dec, |
| 13937 | cdfs, | 14292 | cdfs, |
| @@ -13968,6 +14323,7 @@ fn decode_inter_block( | |||
| 13968 | None, | 14323 | None, |
| 13969 | )? | 14324 | )? |
| 13970 | .0; | 14325 | .0; |
| 14326 | + } | ||
| 13971 | } | 14327 | } |
| 13972 | } else { | 14328 | } else { |
| 13973 | let ref_frame = | 14329 | let ref_frame = |
| @@ -14663,17 +15019,32 @@ fn decode_inter_block( | |||
| 14663 | interintra_blend(v, cpx, cpy, chroma_side, ii, wedge_mask, &mut pred_v); | 15019 | interintra_blend(v, cpx, cpy, chroma_side, ii, wedge_mask, &mut pred_v); |
| 14664 | } | 15020 | } |
| 14665 | 15021 | ||
| 14666 | - vartx_leaves = read_block_tx_size( | 15022 | + // lane-inter4 r2: a rectangular strip's transform tree starts from |
| 14667 | - dec, | 15023 | + // its own rect `max_txsize_rect_lookup` entry, not a square one. |
| 14668 | - cdfs, | 15024 | + let rect_tu = (write_w, write_h) != (side, side); |
| 14669 | - neighbours, | 15025 | + vartx_leaves = if rect_tu { |
| 14670 | - at_mi, | 15026 | + read_block_tx_size_rect( |
| 14671 | - side, | 15027 | + dec, |
| 14672 | - (mi_cols as usize, mi_rows as usize), | 15028 | + cdfs, |
| 14673 | - true, | 15029 | + neighbours, |
| 14674 | - skip, | 15030 | + at_mi, |
| 14675 | - )? | 15031 | + (write_w, write_h), |
| 14676 | - .1; | 15032 | + (mi_cols as usize, mi_rows as usize), |
| 15033 | + skip, | ||
| 15034 | + )? | ||
| 15035 | + } else { | ||
| 15036 | + read_block_tx_size( | ||
| 15037 | + dec, | ||
| 15038 | + cdfs, | ||
| 15039 | + neighbours, | ||
| 15040 | + at_mi, | ||
| 15041 | + side, | ||
| 15042 | + (mi_cols as usize, mi_rows as usize), | ||
| 15043 | + true, | ||
| 15044 | + skip, | ||
| 15045 | + )? | ||
| 15046 | + .1 | ||
| 15047 | + }; | ||
| 14677 | if skip { | 15048 | if skip { |
| 14678 | y.reconstruct_mc_rect( | 15049 | y.reconstruct_mc_rect( |
| 14679 | px, | 15050 | px, |
| @@ -14706,7 +15077,14 @@ fn decode_inter_block( | |||
| 14706 | u_grid = vec![0i32; chroma_side * chroma_side]; | 15077 | u_grid = vec![0i32; chroma_side * chroma_side]; |
| 14707 | v_grid = vec![0i32; chroma_side * chroma_side]; | 15078 | v_grid = vec![0i32; chroma_side * chroma_side]; |
| 14708 | } else { | 15079 | } else { |
| 14709 | - let around = neighbours.around_mi(at, side); | 15080 | + // lane-inter4 r2: a rect strip's coefficient context spans its |
| 15081 | + // OWN width above and height left -- reading `side` cells both | ||
| 15082 | + // ways indexes past the tile's last mi row for a bottom strip. | ||
| 15083 | + let around = if rect_tu { | ||
| 15084 | + neighbours.around_mi_rect(at_mi, write_w, write_h) | ||
| 15085 | + } else { | ||
| 15086 | + neighbours.around_mi(at, side) | ||
| 15087 | + }; | ||
| 14710 | let luma_tx_type; | 15088 | let luma_tx_type; |
| 14711 | if let Some(leaves) = vartx_leaves.clone() { | 15089 | if let Some(leaves) = vartx_leaves.clone() { |
| 14712 | // spec 5.11.17's transform tree, leaf by leaf in the order | 15090 | // spec 5.11.17's transform tree, leaf by leaf in the order |
| @@ -14753,6 +15131,26 @@ fn decode_inter_block( | |||
| 14753 | // inherits the *first* (top-left) luma unit's coded type. | 15131 | // inherits the *first* (top-left) luma unit's coded type. |
| 14754 | luma_tx_type = first_tx_type; | 15132 | luma_tx_type = first_tx_type; |
| 14755 | luma_grid = vec![0i32; side * side]; | 15133 | luma_grid = vec![0i32; side * side]; |
| 15134 | + } else if rect_tu { | ||
| 15135 | + // The whole-block rectangular transform unit | ||
| 15136 | + // (`txfm_partition` said 0 at depth 0). | ||
| 15137 | + let (grid, tx_type) = read_inter_plane_rect( | ||
| 15138 | + dec, | ||
| 15139 | + cdfs, | ||
| 15140 | + TxbSet::LumaRect32x16Inter, | ||
| 15141 | + (write_w, write_h), | ||
| 15142 | + side, | ||
| 15143 | + 0, | ||
| 15144 | + around[0], | ||
| 15145 | + mode_for_tx, | ||
| 15146 | + y, | ||
| 15147 | + px, | ||
| 15148 | + py, | ||
| 15149 | + &pred_y, | ||
| 15150 | + None, | ||
| 15151 | + )?; | ||
| 15152 | + luma_tx_type = tx_type; | ||
| 15153 | + luma_grid = embed_rect_grid(&grid, write_w, write_h, side); | ||
| 14756 | } else { | 15154 | } else { |
| 14757 | (luma_grid, luma_tx_type) = read_inter_plane( | 15155 | (luma_grid, luma_tx_type) = read_inter_plane( |
| 14758 | dec, | 15156 | dec, |
| @@ -14772,6 +15170,55 @@ fn decode_inter_block( | |||
| 14772 | None, | 15170 | None, |
| 14773 | )?; | 15171 | )?; |
| 14774 | } | 15172 | } |
| 15173 | + if rect_tu { | ||
| 15174 | + // `av1_get_max_uv_txsize(bsize)`: the chroma transform of a | ||
| 15175 | + // 2:1 strip is the strip's own rect chroma size (16x8 / | ||
| 15176 | + // 8x16), one unit for the whole block, and it codes no | ||
| 15177 | + // `tx_type` symbol -- it inherits the luma unit's. | ||
| 15178 | + let (uw, uh) = (write_chroma_w, write_chroma_h); | ||
| 15179 | + u_grid = embed_rect_grid( | ||
| 15180 | + &read_inter_plane_rect( | ||
| 15181 | + dec, | ||
| 15182 | + cdfs, | ||
| 15183 | + TxbSet::ChromaRect16x8, | ||
| 15184 | + (uw, uh), | ||
| 15185 | + chroma_side, | ||
| 15186 | + 1, | ||
| 15187 | + around[1], | ||
| 15188 | + mode_for_tx, | ||
| 15189 | + u, | ||
| 15190 | + cpx, | ||
| 15191 | + cpy, | ||
| 15192 | + &pred_u, | ||
| 15193 | + Some(luma_tx_type), | ||
| 15194 | + )? | ||
| 15195 | + .0, | ||
| 15196 | + uw, | ||
| 15197 | + uh, | ||
| 15198 | + chroma_side, | ||
| 15199 | + ); | ||
| 15200 | + v_grid = embed_rect_grid( | ||
| 15201 | + &read_inter_plane_rect( | ||
| 15202 | + dec, | ||
| 15203 | + cdfs, | ||
| 15204 | + TxbSet::ChromaRect16x8, | ||
| 15205 | + (uw, uh), | ||
| 15206 | + chroma_side, | ||
| 15207 | + 2, | ||
| 15208 | + around[2], | ||
| 15209 | + mode_for_tx, | ||
| 15210 | + v, | ||
| 15211 | + cpx, | ||
| 15212 | + cpy, | ||
| 15213 | + &pred_v, | ||
| 15214 | + Some(luma_tx_type), | ||
| 15215 | + )? | ||
| 15216 | + .0, | ||
| 15217 | + uw, | ||
| 15218 | + uh, | ||
| 15219 | + chroma_side, | ||
| 15220 | + ); | ||
| 15221 | + } else { | ||
| 14775 | u_grid = read_inter_plane( | 15222 | u_grid = read_inter_plane( |
| 14776 | dec, | 15223 | dec, |
| 14777 | cdfs, | 15224 | cdfs, |
| @@ -14808,6 +15255,7 @@ fn decode_inter_block( | |||
| 14808 | None, | 15255 | None, |
| 14809 | )? | 15256 | )? |
| 14810 | .0; | 15257 | .0; |
| 15258 | + } | ||
| 14811 | } | 15259 | } |
| 14812 | } | 15260 | } |
| 14813 | } else { | 15261 | } else { |
crates/ec-av1/src/stream.rsmodified+198 -0
| @@ -4717,6 +4717,204 @@ mod tests { | |||
| 4717 | } | 4717 | } |
| 4718 | } | 4718 | } |
| 4719 | 4719 | ||
| 4720 | + /// lane-inter4 r2: the 32x32-level inter `PARTITION_HORZ`/`PARTITION_VERT` | ||
| 4721 | + /// strips (32x16 / 16x32) carrying a REAL residual -- the capability r1 | ||
| 4722 | + /// found missing ("a non-skip rectangular (HORZ/VERT/HORZ_B) strip needs | ||
| 4723 | + /// rectangular residual coding"). The strip's own rectangular max | ||
| 4724 | + /// transform (`TX_32X16`/`TX_16X32`) is read through the rect var-tx tree, | ||
| 4725 | + /// its coefficients through [`TxbSet::LumaRect32x16Inter`] / | ||
| 4726 | + /// `ChromaRect16x8`, and inverted with the rect (sqrt2-scaled) inverse | ||
| 4727 | + /// transform. | ||
| 4728 | + /// | ||
| 4729 | + /// `--min-partition-size=16 --max-partition-size=32` keeps the superblock | ||
| 4730 | + /// level (64x32, still refused -- no 64-point rect transform) out, so | ||
| 4731 | + /// every counted hit is a 32-level strip. The source is textured and | ||
| 4732 | + /// translating precisely so the strips are NOT skip: a flat source (r1's) | ||
| 4733 | + /// makes aomenc code them skip and proves nothing about the residual. | ||
| 4734 | + /// Both `--enable-tx-size-search` arms run: `=0` exercises the | ||
| 4735 | + /// whole-block rect transform with no `txfm_partition` symbol at all, | ||
| 4736 | + /// `=1` the rect var-tx tree (no-split rect unit, or the split into square | ||
| 4737 | + /// sub-transforms). | ||
| 4738 | + /// | ||
| 4739 | + /// 8-bit AND 10-bit. Every decoded frame is compared to ffmpeg on Y, U and | ||
| 4740 | + /// V; a refusal is counted, never SKIPped; an attempt that carried no rect | ||
| 4741 | + /// inter residual is counted separately and still required pixel-exact. | ||
| 4742 | + #[test] | ||
| 4743 | + // lane-inter4 r2: RED, kept (not weakened, not deleted) -- the rect inter | ||
| 4744 | + // residual path IS implemented and reached, but no aomenc recipe swept | ||
| 4745 | + // this round produced a stream whose FIRST rect inter block is a 32x16 / | ||
| 4746 | + // 16x32 one: real motion content always codes a 16x8/8x16 inter leaf (or | ||
| 4747 | + // an intra rect strip) earlier in the tile, and both of those still refuse | ||
| 4748 | + // by name, so the decode stops before any 32-level 2:1 strip. The 16x8 | ||
| 4749 | + // shape additionally needs `default_inter_ext_tx_cdf[2][TX_8X8]` (the | ||
| 4750 | + // 12-symbol DTT9_IDTX_1DDCT row, only reachable through a rect | ||
| 4751 | + // transform), which this round did not add. See lanes/inter4-r2.report.md. | ||
| 4752 | + #[ignore = "lane-inter4 r2: every real-content attempt stops at the 16x8/8x16 inter leaf or intra-rect-strip refusal before reaching a 32x16/16x32 strip; the rect residual path itself is unproven, not claimed"] | ||
| 4753 | + fn a_real_aomenc_inter_sequence_with_a_coded_rectangular_residual_decodes_pixel_exact() { | ||
| 4754 | + const NAME: &str = | ||
| 4755 | + "a_real_aomenc_inter_sequence_with_a_coded_rectangular_residual_decodes_pixel_exact"; | ||
| 4756 | + let _gate_lock = lock_gate_counters(); | ||
| 4757 | + if !have_ffmpeg() { | ||
| 4758 | + eprintln!("SKIP {NAME}: no ffmpeg"); | ||
| 4759 | + return; | ||
| 4760 | + } | ||
| 4761 | + if !have_aomenc() { | ||
| 4762 | + eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display()); | ||
| 4763 | + return; | ||
| 4764 | + } | ||
| 4765 | + let (width, height, frame_count) = (192usize, 128usize, 6usize); | ||
| 4766 | + for bit_depth in [8u32, 10u32] { | ||
| 4767 | + let (mut named_refusals, mut matched, mut out_of_scope, mut oos_mismatch) = | ||
| 4768 | + (0u32, 0u32, 0u32, 0u32); | ||
| 4769 | + let (mut tu_proved, mut split_proved) = (0usize, 0usize); | ||
| 4770 | + for attempt in 0..16u32 { | ||
| 4771 | + // Two sources (a translating textured ramp, and testsrc2's | ||
| 4772 | + // natural motion) x two quantisers x two tx-size-search arms x | ||
| 4773 | + // two motion steps. | ||
| 4774 | + let tx_search = if attempt % 2 == 0 { "0" } else { "1" }; | ||
| 4775 | + let cq = [34, 22][(attempt / 2 % 2) as usize]; | ||
| 4776 | + let natural = attempt / 4 % 2 == 1; | ||
| 4777 | + let sp = 3 + (attempt / 8) * 5; | ||
| 4778 | + let duration = frame_count as f64 / 25.0; | ||
| 4779 | + // Continuous-tone, mid-frequency, translating: a flat or | ||
| 4780 | + // banded source makes aomenc code the strips `skip` (r1's | ||
| 4781 | + // gate) and its screen-content detector fires on the | ||
| 4782 | + // synthetic ramps, stopping the decode at an unrelated intra | ||
| 4783 | + // refusal long before any inter strip. | ||
| 4784 | + // Structure ALONG one axis is what makes aomenc's RD pick a | ||
| 4785 | + // 2:1 rect partition on that axis: horizontal bands drifting | ||
| 4786 | + // vertically favour PARTITION_HORZ (32x16 strips), the | ||
| 4787 | + // transposed source PARTITION_VERT (16x32). | ||
| 4788 | + let lum = if natural { | ||
| 4789 | + format!("128+58*sin((Y+N*{sp})/6)+18*sin(X/23)") | ||
| 4790 | + } else { | ||
| 4791 | + format!("128+58*sin((X+N*{sp})/6)+18*sin(Y/23)") | ||
| 4792 | + }; | ||
| 4793 | + let source = format!( | ||
| 4794 | + "color=c=gray:s={width}x{height}:d={duration}:r=25,format=gray,\ | ||
| 4795 | + geq=lum='{lum}',format=yuv420p" | ||
| 4796 | + ); | ||
| 4797 | + let pix_fmt = if bit_depth == 10 { "yuv420p10le" } else { "yuv420p" }; | ||
| 4798 | + let y4m = Command::new("ffmpeg") | ||
| 4799 | + .args([ | ||
| 4800 | + "-v", "error", "-f", "lavfi", "-i", &source, "-t", &duration.to_string(), | ||
| 4801 | + "-pix_fmt", pix_fmt, "-strict", "-1", "-f", "yuv4mpegpipe", "-", | ||
| 4802 | + ]) | ||
| 4803 | + .stdin(Stdio::null()) | ||
| 4804 | + .stdout(Stdio::piped()) | ||
| 4805 | + .stderr(Stdio::piped()) | ||
| 4806 | + .output() | ||
| 4807 | + .expect("ffmpeg failed to run"); | ||
| 4808 | + assert!( | ||
| 4809 | + y4m.status.success(), | ||
| 4810 | + "{NAME}: ffmpeg refused the {bit_depth}-bit fixture: {}", | ||
| 4811 | + String::from_utf8_lossy(&y4m.stderr) | ||
| 4812 | + ); | ||
| 4813 | + let cq_arg = format!("--cq-level={cq}"); | ||
| 4814 | + let depth_arg = format!("--bit-depth={bit_depth}"); | ||
| 4815 | + let input_depth_arg = format!("--input-bit-depth={bit_depth}"); | ||
| 4816 | + let tx_arg = format!("--enable-tx-size-search={tx_search}"); | ||
| 4817 | + let args: Vec<&str> = vec![ | ||
| 4818 | + "--codec=av1", "--passes=1", "--end-usage=q", &cq_arg, "--cpu-used=0", | ||
| 4819 | + "--threads=1", "--row-mt=0", "--sb-size=64", &depth_arg, &input_depth_arg, | ||
| 4820 | + "--enable-restoration=0", "--enable-palette=0", "--deltaq-mode=0", | ||
| 4821 | + "--enable-filter-intra=0", "--enable-cfl-intra=0", "--enable-intrabc=0", | ||
| 4822 | + "--lag-in-frames=0", | ||
| 4823 | + // Per-arm overrides go LAST: aomenc keeps the last | ||
| 4824 | + // occurrence of a repeated --enable-* flag. | ||
| 4825 | + &tx_arg, | ||
| 4826 | + "--enable-rect-partitions=1", "--enable-ab-partitions=0", | ||
| 4827 | + "--enable-1to4-partitions=0", "--min-partition-size=16", | ||
| 4828 | + "--max-partition-size=32", | ||
| 4829 | + "--obu", "-o", "-", "-", | ||
| 4830 | + ]; | ||
| 4831 | + let mut child = Command::new(aomenc_path()) | ||
| 4832 | + .args(&args) | ||
| 4833 | + .stdin(Stdio::piped()) | ||
| 4834 | + .stdout(Stdio::piped()) | ||
| 4835 | + .stderr(Stdio::piped()) | ||
| 4836 | + .spawn() | ||
| 4837 | + .expect("aomenc failed to start"); | ||
| 4838 | + child | ||
| 4839 | + .stdin | ||
| 4840 | + .take() | ||
| 4841 | + .expect("aomenc stdin") | ||
| 4842 | + .write_all(&y4m.stdout) | ||
| 4843 | + .expect("writing y4m to aomenc"); | ||
| 4844 | + let out = child.wait_with_output().expect("aomenc failed to run"); | ||
| 4845 | + assert!( | ||
| 4846 | + out.status.success(), | ||
| 4847 | + "aomenc refused the fixture: {}", | ||
| 4848 | + String::from_utf8_lossy(&out.stderr) | ||
| 4849 | + ); | ||
| 4850 | + let stream = out.stdout; | ||
| 4851 | + let before = (decode::rect_inter_tu_hits(), decode::rect_inter_txsplit_hits()); | ||
| 4852 | + let frames = match decode_stream(&stream) { | ||
| 4853 | + Err(e) => { | ||
| 4854 | + let msg = e.to_string(); | ||
| 4855 | + assert!( | ||
| 4856 | + msg.contains("unsupported"), | ||
| 4857 | + "{NAME} failed outright, not a named refusal ({bit_depth}-bit, \ | ||
| 4858 | + attempt {attempt}): {msg}" | ||
| 4859 | + ); | ||
| 4860 | + named_refusals += 1; | ||
| 4861 | + eprintln!("{bit_depth}-bit attempt {attempt} refusal: {msg}"); | ||
| 4862 | + continue; | ||
| 4863 | + } | ||
| 4864 | + Ok(frames) => frames, | ||
| 4865 | + }; | ||
| 4866 | + let after = (decode::rect_inter_tu_hits(), decode::rect_inter_txsplit_hits()); | ||
| 4867 | + let (tu, split) = (after.0 - before.0, after.1 - before.1); | ||
| 4868 | + let ffmpeg_frames = if bit_depth == 10 { | ||
| 4869 | + ffmpeg_decode_sequence_10bit(&stream, width, height, frame_count) | ||
| 4870 | + } else { | ||
| 4871 | + ffmpeg_decode_sequence(&stream, width, height, frame_count) | ||
| 4872 | + }; | ||
| 4873 | + assert_eq!(frames.len(), frame_count); | ||
| 4874 | + let mismatched = frames | ||
| 4875 | + .iter() | ||
| 4876 | + .zip(&ffmpeg_frames) | ||
| 4877 | + .any(|(got, want)| got.y != want.y || got.u != want.u || got.v != want.v); | ||
| 4878 | + if tu + split == 0 { | ||
| 4879 | + out_of_scope += 1; | ||
| 4880 | + if mismatched { | ||
| 4881 | + oos_mismatch += 1; | ||
| 4882 | + eprintln!( | ||
| 4883 | + "{NAME}: {bit_depth}-bit attempt {attempt} MISMATCHES with zero \ | ||
| 4884 | + coded rect inter transform units -- another shape's defect" | ||
| 4885 | + ); | ||
| 4886 | + } | ||
| 4887 | + continue; | ||
| 4888 | + } | ||
| 4889 | + for (i, (got, want)) in frames.iter().zip(&ffmpeg_frames).enumerate() { | ||
| 4890 | + assert_eq!(got.y, want.y, "{NAME} frame {i} luma vs ffmpeg (attempt {attempt}, {bit_depth}-bit, tx_search={tx_search})"); | ||
| 4891 | + assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (attempt {attempt}, {bit_depth}-bit, tx_search={tx_search})"); | ||
| 4892 | + assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (attempt {attempt}, {bit_depth}-bit, tx_search={tx_search})"); | ||
| 4893 | + } | ||
| 4894 | + tu_proved += tu; | ||
| 4895 | + split_proved += split; | ||
| 4896 | + matched += 1; | ||
| 4897 | + } | ||
| 4898 | + eprintln!( | ||
| 4899 | + "{NAME} ({bit_depth}-bit): {named_refusals} named refusals, {matched} pixel-exact \ | ||
| 4900 | + attempts carrying a coded rect inter residual, whole-block rect TUs={tu_proved}, \ | ||
| 4901 | + rect trees that split={split_proved}, {out_of_scope} attempts carried none \ | ||
| 4902 | + ({oos_mismatch} of them mismatched)" | ||
| 4903 | + ); | ||
| 4904 | + assert_eq!( | ||
| 4905 | + oos_mismatch, 0, | ||
| 4906 | + "{NAME}: {oos_mismatch} attempt(s) with no coded rect inter residual decoded but \ | ||
| 4907 | + mismatched ffmpeg -- a defect of another shape, not a pass" | ||
| 4908 | + ); | ||
| 4909 | + assert!( | ||
| 4910 | + tu_proved > 0, | ||
| 4911 | + "{NAME} ({bit_depth}-bit): no pixel-exact attempt ever coded a rectangular inter \ | ||
| 4912 | + residual (tu={tu_proved}, split={split_proved}, {named_refusals} refusals, \ | ||
| 4913 | + {out_of_scope} out of scope) -- gate proved nothing" | ||
| 4914 | + ); | ||
| 4915 | + } | ||
| 4916 | + } | ||
| 4917 | + | ||
| 4720 | #[test] | 4918 | #[test] |
| 4721 | fn a_real_aomenc_inter_sequence_with_deblocking_decodes_pixel_exact() { | 4919 | fn a_real_aomenc_inter_sequence_with_deblocking_decodes_pixel_exact() { |
| 4722 | if !have_ffmpeg() { | 4920 | if !have_ffmpeg() { |
lanes/COMMON-20260901.mdmodified+11 -0
| @@ -89,3 +89,14 @@ NEVER wait with a foreground `until/while ... sleep` loop or `tail --pid`. | |||
| 89 | ## NEVER pkill BY BINARY NAME (2026-09-02: one lane's `pkill -f ec_av1-<hash>` killed another lane's suite) | 89 | ## NEVER pkill BY BINARY NAME (2026-09-02: one lane's `pkill -f ec_av1-<hash>` killed another lane's suite) |
| 90 | The test binary hash is identical across worktrees. Kill only by PID you own (`$!`, or the systemd unit | 90 | The test binary hash is identical across worktrees. Kill only by PID you own (`$!`, or the systemd unit |
| 91 | name you started). `pkill -f`/`killall` on cargo/ec_av1 patterns is forbidden. | 91 | name you started). `pkill -f`/`killall` on cargo/ec_av1 patterns is forbidden. |
| 92 | + | ||
| 93 | +## NEVER `cargo fmt` IN A LANE (3 lanes lost their diffs to it on 2026-09-02) | ||
| 94 | +main is not rustfmt-clean (~6000 lines of churn). Hand-indent; `cargo test --no-run` is the check. | ||
| 95 | +If you ran it: extract your own hunks, `git checkout -- crates/`, re-apply. | ||
| 96 | + | ||
| 97 | +## MEMORY (user order 2026-09-02: an unsteady box fails the job) | ||
| 98 | +30 GB box shared by ~10 agents. Every decode/encode/probe invocation runs under | ||
| 99 | +`systemd-run --user --scope -q -p MemoryMax=6G <cmd>`; suites under a unit with `-p MemoryMax=10G`; | ||
| 100 | +never two suites per lane; film extracts ≤2 s; a watchdog (`ec-memwatch` user unit, log | ||
| 101 | +`$HOME/.cache/ec-memwatch.log`) SIGKILLs any codec/test process above 6 GiB RSS or the largest one | ||
| 102 | +when MemAvailable < 3 GiB — a killed run means YOUR command exceeded the budget: bound it, do not retry as-is. | ||
lanes/inter4-r2.report.mdadded+113 -0
| @@ -0,0 +1,113 @@ | |||
| 1 | +# lane-inter4 r2 — rectangular INTER residual coding | ||
| 2 | + | ||
| 3 | +Branch `lane-inter4`, worktree `/home/user/Documents/Code/Rust/edith_codecs-inter4`, | ||
| 4 | +off r1's `59ccb01` (main `146896f`). No rebase this round (main unchanged since). | ||
| 5 | + | ||
| 6 | +## Owed from r1: the full suite at 59ccb01 | ||
| 7 | + | ||
| 8 | + $HOME/.cache/inter4-suite-r2a.log | ||
| 9 | + test result: ok. 323 passed; 0 failed; 30 ignored; finished in 458.10s | ||
| 10 | + | ||
| 11 | +r1's two self-failures were indeed fixed by `59ccb01`. | ||
| 12 | + | ||
| 13 | +EVIDENCE: $HOME/.cache/inter4-suite-r2a.log | ec-av1 --lib under systemd-run at 59ccb01 | 323 passed / 0 failed / 30 ignored | ||
| 14 | + | ||
| 15 | +## What this round built (capability present, NOT claimed proven) | ||
| 16 | + | ||
| 17 | +Rectangular inter residual coding for the 2:1 shapes whose tables exist — | ||
| 18 | +32x16 / 16x32 (`crates/ec-av1/src/decode.rs`): | ||
| 19 | + | ||
| 20 | +- `rect_inter_residual_supported` (decode.rs) — the shape gate. The r1 refusal | ||
| 21 | + string ("a non-skip rectangular (HORZ/VERT/HORZ_B) strip needs rectangular | ||
| 22 | + residual coding") is now conditional on it, so `refusal_inventory` is | ||
| 23 | + unchanged and 64x32/64x16/32x8/8x32/16x8 keep refusing by name. | ||
| 24 | +- `read_block_tx_size_rect` — spec 5.11.17 from the block's own *rect* | ||
| 25 | + `max_txsize_rect_lookup` entry. `TX_MODE_LARGEST`: no symbol, one rect TU. | ||
| 26 | + `TX_MODE_SELECT`: one depth-0 `txfm_partition` symbol whose context comes | ||
| 27 | + from the new `txfm_partition_ctx_rect` (above compares `tx_size_wide`, left | ||
| 28 | + `tx_size_high`, category from `txsize_sqr_up_map`); `0` leaves one rect TU, | ||
| 29 | + `1` splits into `sub_tx_size_map`'s two SQUARE sub-transforms from which the | ||
| 30 | + existing square `read_var_tx_size` continues at depth 1 — so every leaf of a | ||
| 31 | + split rect block is square and the existing square leaf loop reconstructs it. | ||
| 32 | +- `txfm_partition_update_rect` / the skipped-inter case — a skipped rect inter | ||
| 33 | + block records its own BLOCK width above and height left (libaom | ||
| 34 | + `set_txfm_ctxs(.., skip && is_inter)`), where r1 recorded a square `side` | ||
| 35 | + both ways. | ||
| 36 | +- `read_inter_plane_rect` + `embed_rect_grid` — rect coefficients via | ||
| 37 | + `read_coeffs_rect` (TxClass-aware scans/contexts), rect inverse via | ||
| 38 | + `dequant_and_inverse_typed_wh`, added onto the top-left `w x h` of the | ||
| 39 | + square-strided MC predictor. `txb_skip_ctx` 0 for luma (this unit IS the | ||
| 40 | + block: `get_txb_ctx`'s `plane_bsize == txsize_to_bsize[tx_size]` branch); | ||
| 41 | + chroma at `av1_get_max_uv_txsize` (16x8 / 8x16, `TxbSet::ChromaRect16x8`), | ||
| 42 | + inheriting the luma unit's `tx_type`. | ||
| 43 | +- `cdf_state.rs`: new `TxbSet::LumaRect32x16Inter` — `LumaRect32x16`'s | ||
| 44 | + coefficient tables (512-coefficient `eob_pt`) plus the inter `tx_type` | ||
| 45 | + alphabet `default_inter_ext_tx_cdf[3][TX_16X16]` (`EXT_TX_SET_DCT_IDTX`, | ||
| 46 | + which is what `av1_get_ext_tx_set_type` returns for an inter TU with | ||
| 47 | + `tx_size_sqr_up == TX_32X32`) — i.e. the existing `INTER_TX_TYPE_SET3_16`. | ||
| 48 | +- Two out-of-bounds fixes found by the new content (both in r1 code, both hit | ||
| 49 | + before any of this round's residual code runs): `around_mi(at, side)` read | ||
| 50 | + `side` cells left for a rect strip and indexed past the tile's last mi row | ||
| 51 | + (now `around_mi_rect(at_mi, write_w, write_h)` for a rect strip); and | ||
| 52 | + `record_rect_mi`/`record_split_luma_rect_mi` stamped past the frame's last | ||
| 53 | + 16-px column for an edge strip (now bounds-checked). | ||
| 54 | +- `EC_AV1_RECT_DUMP=1` prints the shape of every refused rect strip. | ||
| 55 | +- New counters `rect_inter_tu_hits` / `rect_inter_txsplit_hits` + accessors. | ||
| 56 | + | ||
| 57 | +## Gate — RED, kept and `#[ignore]`d with its exact reason | ||
| 58 | + | ||
| 59 | +`a_real_aomenc_inter_sequence_with_a_coded_rectangular_residual_decodes_pixel_exact` | ||
| 60 | +(stream.rs): 16 attempts x {2 axis-structured sources, 2 quantisers, 2 | ||
| 61 | +`--enable-tx-size-search` arms, 2 motion steps} x {8-bit, 10-bit}, 192x128, | ||
| 62 | +6 frames, `--enable-rect-partitions=1 --enable-ab-partitions=0 | ||
| 63 | +--enable-1to4-partitions=0 --min-partition-size=16 --max-partition-size=32`, | ||
| 64 | +overrides last; every decoded frame compared Y/U/V to ffmpeg, refusals counted | ||
| 65 | +never SKIPped, out-of-scope attempts still required pixel-exact. | ||
| 66 | + | ||
| 67 | +It never fires, and the reason is NOT the residual code: on real motion content | ||
| 68 | +the decode stops earlier, every attempt, at one of | ||
| 69 | + | ||
| 70 | + an inter partition below 16x16 other than SPLIT (16x8/8x16 rect inter leaves are not coded yet) | ||
| 71 | + an intra-coded HORZ/VERT strip needs rectangular intra prediction this decoder does not code yet | ||
| 72 | + an inter partition below 8x8 ... | ||
| 73 | + | ||
| 74 | +so no stream ever reached a 32x16/16x32 inter strip. Content sweep this round | ||
| 75 | +(4 source families x cq 22..61): flat/banded sources make the strips `skip` | ||
| 76 | +(r1's case) or trip aomenc's screen-content detector into an intra-strip | ||
| 77 | +refusal; textured/natural ones reach 16-level rect leaves first. `EC_AV1_RECT_DUMP` | ||
| 78 | +on the earlier recipe showed the only rect shapes actually refused were 32x8 / | ||
| 79 | +8x32 (the 32-level 1:4 arms), never 32x16. | ||
| 80 | + | ||
| 81 | +EVIDENCE: `cargo test -p ec-av1 --lib coded_rectangular_residual -- --nocapture` | 16 aomenc encodes x 8-bit, decode + ffmpeg Y/U/V compare | 15 named refusals, 0 attempts carrying a rect inter residual, whole-block rect TUs=0 -- gate proved nothing, so it is `#[ignore]`d with that sentence, not weakened | ||
| 82 | + | ||
| 83 | +EVIDENCE: `cargo test -p ec-av1 --lib superblock_level_rect_partition -- --nocapture` | r1's skip-strip gate re-run on this round's tree | 4 named refusals, 2 pixel-exact attempts carrying the arm, 64x32 strips=4, 0 mismatches -- the rect skip-context change did not regress it | ||
| 84 | + | ||
| 85 | +## Suite | ||
| 86 | + | ||
| 87 | + $HOME/.cache/inter4-suite-r2.log (systemd-run, unit inter4-suite-r2) | ||
| 88 | + | ||
| 89 | +## Residue | ||
| 90 | + | ||
| 91 | +- **fix-now (r3): 16x8/8x16 inter rect leaves.** They are the real reach | ||
| 92 | + blocker: real content codes one before any 32-level 2:1 strip. Needs (a) the | ||
| 93 | + 16-level rect inter partition arm, (b) `default_inter_ext_tx_cdf[2][TX_8X8]` | ||
| 94 | + (12-symbol `DTT9_IDTX_1DDCT` at `tx_size_sqr == TX_8X8`, reachable only | ||
| 95 | + through a rect transform) as a new CDF + adaptation field, (c) a | ||
| 96 | + `TxbSet::LumaRect16x8Inter`. The residual machinery this round added then | ||
| 97 | + covers them unchanged. | ||
| 98 | +- **deferred: the 32x16/16x32 gate** — unblocked by the item above (or by a | ||
| 99 | + recipe that reaches a 32-level strip first; four source families did not). | ||
| 100 | +- **deferred: 64x32/32x64/64x16/16x64 and 32x8/8x32 rect residual** — 64-point | ||
| 101 | + and 1:4 rect transforms have no coefficient tables here; still refused by name. | ||
| 102 | +- **deferred: film probe** — not re-run: r1 measured both ReelC extracts stopping | ||
| 103 | + at lane-rectchroma's INTRA refusal ("a coded HORZ/VERT strip whose chroma | ||
| 104 | + transform has no rect coefficient tables here"), which nothing in this diff | ||
| 105 | + touches. | ||
| 106 | +- **accepted: a rect block's luma/chroma coefficient grid is embedded in the | ||
| 107 | + square grid** the downstream neighbour/deblock stamps expect (top-left | ||
| 108 | + placement). The split-leaf path already hands those stamps an all-zero square | ||
| 109 | + grid, so this is strictly more information than the shipping behaviour. | ||
| 110 | +- **DO NOT MERGE as a capability claim**: rectangular inter residual coding is | ||
| 111 | + implemented and compiles, and is exercised by no green gate (class | ||
| 112 | + refusal-lifted-without-a-gate). The refusal itself is still in place for every | ||
| 113 | + shape but 32x16/16x32. | ||