From 4a100c25e8b1507469d3bf7ec908b8096ec26f70 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Wed, 8 Apr 2020 12:41:14 +0200 Subject: [PATCH] codec_support/h263: fix delta calculation in the deblocking filter --- nihav-codec-support/src/codecs/h263/code.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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); -- 2.30.2