codec_support/h263: fix DC clipping function
[nihav.git] / nihav-codec-support / src / codecs / h263 / decoder.rs
index 929854af4929608baf96cd43b0d471d1760d0be3..2707e76ee4561be7764a8c4ccf86b1ca0151d797 100644 (file)
@@ -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]