aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2020-04-08 12:41:14 +0200
committerKostya Shishkov <kostya.shishkov@gmail.com>2020-04-08 12:41:14 +0200
commit4a100c25e8b1507469d3bf7ec908b8096ec26f70 (patch)
tree744fa57da16b15f29ce67a188a94520a253617d1
parent4c5fa4928a2ac8118a2dd93fb42ced92430fb7ec (diff)
downloadnihav-4a100c25e8b1507469d3bf7ec908b8096ec26f70.tar.gz
codec_support/h263: fix delta calculation in the deblocking filter
-rw-r--r--nihav-codec-support/src/codecs/h263/code.rs4
1 files 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<u8>, 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<u8>, 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);