From acf6187c1717166984d7783e2b5bde26733c8b56 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Fri, 3 Apr 2020 11:56:20 +0200 Subject: [PATCH] codec_support/h263: fix DC clipping function --- nihav-codec-support/src/codecs/h263/decoder.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nihav-codec-support/src/codecs/h263/decoder.rs b/nihav-codec-support/src/codecs/h263/decoder.rs index 929854a..2707e76 100644 --- a/nihav-codec-support/src/codecs/h263/decoder.rs +++ b/nihav-codec-support/src/codecs/h263/decoder.rs @@ -141,9 +141,9 @@ pub struct H263BaseDecoder { #[inline] fn clip_dc(dc: i16) -> i16 { - if dc < 0 { 0 } - else if dc > 2046 { 2046 } - else { (dc + 1) & !1 } + if dc <= 0 { 0 } + else if dc > 2046 { 2047 } + else { dc | 1 } } #[inline] -- 2.30.2