From: Kostya Shishkov Date: Fri, 3 Apr 2020 09:56:20 +0000 (+0200) Subject: codec_support/h263: fix DC clipping function X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=acf6187c1717166984d7783e2b5bde26733c8b56;p=nihav.git codec_support/h263: fix DC clipping function --- 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]