The per-plane warp bail-out was gated on the square side, not the plane block's own width/height
Browse files at this commit9385d73315fb0e11524a947e982449f9ea1e3d6fParent: e3f5bae- fix
- the per-plane warp bail-out was gated on the square side, not the plane block's own width/height
1 changed file +24 -15
- crates/ec-av1/src/decode.rs +24 -15
crates/ec-av1/src/decode.rsmodified+24 -15
| @@ -20563,7 +20563,7 @@ fn decode_inter_block( | |||
| 20563 | // lane-cwarp r1: this reference's own GLOBAL warp replaces the | 20563 | // lane-cwarp r1: this reference's own GLOBAL warp replaces the |
| 20564 | // translational tap (libaom `av1_warp_plane` with | 20564 | // translational tap (libaom `av1_warp_plane` with |
| 20565 | // `conv_params->is_compound`); the blend below is unchanged. | 20565 | // `conv_params->is_compound`); the blend below is unchanged. |
| 20566 | - if let Some(wp) = &warp0 { | 20566 | + if let Some(wp) = warp0.as_ref().filter(|_| write_w >= 8 && write_h >= 8) { |
| 20567 | crate::warp::warp_affine_compound( | 20567 | crate::warp::warp_affine_compound( |
| 20568 | wp, &py0.data, py0.true_width as i32, py0.true_height as i32, | 20568 | wp, &py0.data, py0.true_width as i32, py0.true_height as i32, |
| 20569 | py0.width as i32, &mut inter0_y, px as i32, py as i32, side as i32, | 20569 | py0.width as i32, &mut inter0_y, px as i32, py as i32, side as i32, |
| @@ -20590,7 +20590,7 @@ fn decode_inter_block( | |||
| 20590 | // lane-cwarp r1: this reference's own GLOBAL warp replaces the | 20590 | // lane-cwarp r1: this reference's own GLOBAL warp replaces the |
| 20591 | // translational tap (libaom `av1_warp_plane` with | 20591 | // translational tap (libaom `av1_warp_plane` with |
| 20592 | // `conv_params->is_compound`); the blend below is unchanged. | 20592 | // `conv_params->is_compound`); the blend below is unchanged. |
| 20593 | - if let Some(wp) = &warp1 { | 20593 | + if let Some(wp) = warp1.as_ref().filter(|_| write_w >= 8 && write_h >= 8) { |
| 20594 | crate::warp::warp_affine_compound( | 20594 | crate::warp::warp_affine_compound( |
| 20595 | wp, &py1.data, py1.true_width as i32, py1.true_height as i32, | 20595 | wp, &py1.data, py1.true_width as i32, py1.true_height as i32, |
| 20596 | py1.width as i32, &mut inter1_y, px as i32, py as i32, side as i32, | 20596 | py1.width as i32, &mut inter1_y, px as i32, py as i32, side as i32, |
| @@ -20640,7 +20640,7 @@ fn decode_inter_block( | |||
| 20640 | // narrower/shorter than 8 (`block_width < 8`), so a 4x4 chroma | 20640 | // narrower/shorter than 8 (`block_width < 8`), so a 4x4 chroma |
| 20641 | // block of an 8x8 luma block stays translational. | 20641 | // block of an 8x8 luma block stays translational. |
| 20642 | if let Some(wp) = &warp0 { | 20642 | if let Some(wp) = &warp0 { |
| 20643 | - if chroma_side >= 8 { | 20643 | + if write_chroma_w >= 8 && write_chroma_h >= 8 { |
| 20644 | crate::warp::warp_affine_compound( | 20644 | crate::warp::warp_affine_compound( |
| 20645 | wp, &pu0.data, pu0.true_width as i32, pu0.true_height as i32, | 20645 | wp, &pu0.data, pu0.true_width as i32, pu0.true_height as i32, |
| 20646 | pu0.width as i32, &mut inter0_u, cpx as i32, cpy as i32, | 20646 | pu0.width as i32, &mut inter0_u, cpx as i32, cpy as i32, |
| @@ -20669,7 +20669,7 @@ fn decode_inter_block( | |||
| 20669 | // narrower/shorter than 8 (`block_width < 8`), so a 4x4 chroma | 20669 | // narrower/shorter than 8 (`block_width < 8`), so a 4x4 chroma |
| 20670 | // block of an 8x8 luma block stays translational. | 20670 | // block of an 8x8 luma block stays translational. |
| 20671 | if let Some(wp) = &warp1 { | 20671 | if let Some(wp) = &warp1 { |
| 20672 | - if chroma_side >= 8 { | 20672 | + if write_chroma_w >= 8 && write_chroma_h >= 8 { |
| 20673 | crate::warp::warp_affine_compound( | 20673 | crate::warp::warp_affine_compound( |
| 20674 | wp, &pu1.data, pu1.true_width as i32, pu1.true_height as i32, | 20674 | wp, &pu1.data, pu1.true_width as i32, pu1.true_height as i32, |
| 20675 | pu1.width as i32, &mut inter1_u, cpx as i32, cpy as i32, | 20675 | pu1.width as i32, &mut inter1_u, cpx as i32, cpy as i32, |
| @@ -20714,7 +20714,7 @@ fn decode_inter_block( | |||
| 20714 | // narrower/shorter than 8 (`block_width < 8`), so a 4x4 chroma | 20714 | // narrower/shorter than 8 (`block_width < 8`), so a 4x4 chroma |
| 20715 | // block of an 8x8 luma block stays translational. | 20715 | // block of an 8x8 luma block stays translational. |
| 20716 | if let Some(wp) = &warp0 { | 20716 | if let Some(wp) = &warp0 { |
| 20717 | - if chroma_side >= 8 { | 20717 | + if write_chroma_w >= 8 && write_chroma_h >= 8 { |
| 20718 | crate::warp::warp_affine_compound( | 20718 | crate::warp::warp_affine_compound( |
| 20719 | wp, &pv0.data, pv0.true_width as i32, pv0.true_height as i32, | 20719 | wp, &pv0.data, pv0.true_width as i32, pv0.true_height as i32, |
| 20720 | pv0.width as i32, &mut inter0_v, cpx as i32, cpy as i32, | 20720 | pv0.width as i32, &mut inter0_v, cpx as i32, cpy as i32, |
| @@ -20743,7 +20743,7 @@ fn decode_inter_block( | |||
| 20743 | // narrower/shorter than 8 (`block_width < 8`), so a 4x4 chroma | 20743 | // narrower/shorter than 8 (`block_width < 8`), so a 4x4 chroma |
| 20744 | // block of an 8x8 luma block stays translational. | 20744 | // block of an 8x8 luma block stays translational. |
| 20745 | if let Some(wp) = &warp1 { | 20745 | if let Some(wp) = &warp1 { |
| 20746 | - if chroma_side >= 8 { | 20746 | + if write_chroma_w >= 8 && write_chroma_h >= 8 { |
| 20747 | crate::warp::warp_affine_compound( | 20747 | crate::warp::warp_affine_compound( |
| 20748 | wp, &pv1.data, pv1.true_width as i32, pv1.true_height as i32, | 20748 | wp, &pv1.data, pv1.true_width as i32, pv1.true_height as i32, |
| 20749 | pv1.width as i32, &mut inter1_v, cpx as i32, cpy as i32, | 20749 | pv1.width as i32, &mut inter1_v, cpx as i32, cpy as i32, |
| @@ -21839,19 +21839,28 @@ fn decode_inter_block( | |||
| 21839 | // motion_mode symbol was still read and warp_params still | 21839 | // motion_mode symbol was still read and warp_params still |
| 21840 | // resolved. Suppress the warp, keep every symbol read. | 21840 | // resolved. Suppress the warp, keep every symbol read. |
| 21841 | if let Some(params) = warp_params.as_ref().filter(|_| luma_scale == mc::REF_NO_SCALE) { | 21841 | if let Some(params) = warp_params.as_ref().filter(|_| luma_scale == mc::REF_NO_SCALE) { |
| 21842 | - crate::warp::warp_affine( | 21842 | + // `av1_init_warp_params` is per PLANE: the luma plane's |
| 21843 | - params, &py_ref.data, py_ref.true_width as i32, py_ref.true_height as i32, | 21843 | + // own block is `write_w`x`write_h` (a PARTITION_HORZ/VERT |
| 21844 | - py_ref.width as i32, &mut pred_y, px as i32, py as i32, side as i32, | 21844 | + // strip is not `side`x`side`), so a strip under 8 px in |
| 21845 | - side as i32, side as i32, 0, 0, | 21845 | + // either direction keeps the translational prediction too. |
| 21846 | - ); | 21846 | + if write_w >= 8 && write_h >= 8 { |
| 21847 | + crate::warp::warp_affine( | ||
| 21848 | + params, &py_ref.data, py_ref.true_width as i32, py_ref.true_height as i32, | ||
| 21849 | + py_ref.width as i32, &mut pred_y, px as i32, py as i32, side as i32, | ||
| 21850 | + side as i32, side as i32, 0, 0, | ||
| 21851 | + ); | ||
| 21852 | + } | ||
| 21847 | // libaom `av1_init_warp_params` (reconinter.c): warp is | 21853 | // libaom `av1_init_warp_params` (reconinter.c): warp is |
| 21848 | // per PLANE and bails out at `block_width < 8 || | 21854 | // per PLANE and bails out at `block_width < 8 || |
| 21849 | // block_height < 8`, so a plane whose own block is under | 21855 | // block_height < 8`, so a plane whose own block is under |
| 21850 | // 8x8 keeps the translational prediction built above -- | 21856 | // 8x8 keeps the translational prediction built above -- |
| 21851 | - // in 420 that is every chroma plane of a luma block below | 21857 | + // in 420 that is every chroma plane whose own width or |
| 21852 | - // 16x16 (lane-gmaffine r4: chroma-only mismatch of a few | 21858 | + // height is under 8 -- `write_chroma_w`/`write_chroma_h`, |
| 21853 | - // levels on both 8x8-leaf motion gates). | 21859 | + // NOT the square `chroma_side` (lane-t900 r5: an 8x16 luma |
| 21854 | - if chroma_side >= 8 { | 21860 | + // block has `chroma_side == 8` but a 4x8 chroma block, so |
| 21861 | + // the square side warped chroma libaom predicts | ||
| 21862 | + // translationally; lane-gmaffine r4 for the 8x8 leaf). | ||
| 21863 | + if write_chroma_w >= 8 && write_chroma_h >= 8 { | ||
| 21855 | crate::warp::warp_affine( | 21864 | crate::warp::warp_affine( |
| 21856 | params, &pu_ref.data, pu_ref.true_width as i32, pu_ref.true_height as i32, | 21865 | params, &pu_ref.data, pu_ref.true_width as i32, pu_ref.true_height as i32, |
| 21857 | pu_ref.width as i32, &mut pred_u, cpx as i32, cpy as i32, chroma_side as i32, | 21866 | pu_ref.width as i32, &mut pred_u, cpx as i32, cpy as i32, chroma_side as i32, |