]> git.nihav.org Git - nihav.git/blobdiff - nihav-codec-support/src/codecs/h263/code.rs
add README.md and license
[nihav.git] / nihav-codec-support / src / codecs / h263 / code.rs
index 1f00beb77881d0b978f8413233d1c67d27efa617..51aa1e743145fe88f69811d81a8961b8fecb5937 100644 (file)
@@ -339,6 +339,7 @@ fn h263_interp11_avg(dst: &mut [u8], dstride: usize, src: &[u8], sstride: usize,
 pub const H263_INTERP_AVG_FUNCS: &[blockdsp::BlkInterpFunc] = &[
         h263_interp00_avg, h263_interp01_avg, h263_interp10_avg, h263_interp11_avg ];
 
+#[derive(Default)]
 pub struct H263BlockDSP { }
 
 impl H263BlockDSP {
@@ -360,7 +361,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 +385,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);