forge
Explore
Log in

Don't you dare go Hollow

Cdef pri-tap index must undo coeff_shift before parity bit (10-bit gate now pixel-exact)

Browse files at this commit

d8be07649a329939605c357ab1a6efcf5b8b759aAhmet Kaan GümüşParent: 50d59cc
  • fix
    • cdef pri-tap index must undo coeff_shift before parity bit (10-bit gate now pixel-exact)
Show full message
fix(av1): cdef pri-tap index must undo coeff_shift before parity bit (10-bit gate now pixel-exact)
crates/ec-av1/src/decode.rsmodified+8 -1
@@ -5194,9 +5194,14 @@ fn cdef_filter_block(
5194 sec_damping: i32,5194 sec_damping: i32,
5195 enable_primary: bool,5195 enable_primary: bool,
5196 enable_secondary: bool,5196 enable_secondary: bool,
5197+ coeff_shift: i32,
5197 ) {5198 ) {
5198 let clipping_required = enable_primary && enable_secondary;5199 let clipping_required = enable_primary && enable_secondary;
5199- let pri_taps = CDEF_PRI_TAPS[(pri_strength & 1) as usize];5200+ // libaom `cdef_filter_block_internal`: `cdef_pri_taps[(pri_strength >>
5201+ // coeff_shift) & 1]` -- `pri_strength` (and its `adjust_strength`
5202+ // derivative) carries the bit-depth shift, so the tap-set parity bit
5203+ // must be read back above that shift, not off the raw low bit.
5204+ let pri_taps = CDEF_PRI_TAPS[((pri_strength >> coeff_shift) & 1) as usize];
5200 for i in 0..bh {5205 for i in 0..bh {
5201 for j in 0..bw {5206 for j in 0..bw {
5202 let x = sample(i as i32, j as i32);5207 let x = sample(i as i32, j as i32);
@@ -5960,6 +5965,7 @@ fn apply_cdef(
5960 damping,5965 damping,
5961 enable_primary,5966 enable_primary,
5962 enable_secondary,5967 enable_secondary,
5968+ coeff_shift,
5963 );5969 );
5964 }5970 }
5965 5971
@@ -5995,6 +6001,7 @@ fn apply_cdef(
5995 damping_uv,6001 damping_uv,
5996 enable_primary_uv,6002 enable_primary_uv,
5997 enable_secondary_uv,6003 enable_secondary_uv,
6004+ coeff_shift,
5998 );6005 );
5999 }6006 }
6000 }6007 }