From: Kostya Shishkov Date: Wed, 8 Apr 2020 10:41:14 +0000 (+0200) Subject: codec_support/h263: fix delta calculation in the deblocking filter X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=4a100c25e8b1507469d3bf7ec908b8096ec26f70;p=nihav.git codec_support/h263: fix delta calculation in the deblocking filter --- diff --git a/nihav-codec-support/src/codecs/h263/code.rs b/nihav-codec-support/src/codecs/h263/code.rs index 1f00beb..0577991 100644 --- a/nihav-codec-support/src/codecs/h263/code.rs +++ b/nihav-codec-support/src/codecs/h263/code.rs @@ -360,7 +360,7 @@ fn deblock_hor(buf: &mut NAVideoBuffer, comp: usize, strength: u8, off: usiz let diff = ((a - d) + (c - b) * 4) / 8; if (diff != 0) && (diff > -24) && (diff < 24) { let d1a = (diff.abs() - 2 * (diff.abs() - (strength as i16)).max(0)).max(0); - let d1 = if d1a < 0 { 0 } else { d1a }; + let d1 = if diff < 0 { -d1a } else { d1a }; let hd1 = d1a / 2; let d2 = ((a - d) / 4).max(-hd1).min(hd1); @@ -384,7 +384,7 @@ fn deblock_ver(buf: &mut NAVideoBuffer, comp: usize, strength: u8, off: usiz let diff = (a - d + (c - b) * 4) / 8; if (diff != 0) && (diff > -24) && (diff < 24) { let d1a = (diff.abs() - 2 * (diff.abs() - (strength as i16)).max(0)).max(0); - let d1 = if d1a < 0 { 0 } else { d1a }; + let d1 = if diff < 0 { -d1a } else { d1a }; let hd1 = d1a / 2; let d2 = ((a - d) / 4).max(-hd1).min(hd1);