indeo3enc: fix mode10 interpolation
authorKostya Shishkov <kostya.shishkov@gmail.com>
Wed, 15 Feb 2023 18:46:12 +0000 (19:46 +0100)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Wed, 15 Feb 2023 18:46:12 +0000 (19:46 +0100)
nihav-indeo/src/codecs/indeo3enc/cell.rs
nihav-indeo/src/codecs/indeo3enc/mod.rs

index 6f641eb3c87355a8f6db9f98552b5e79365463c9..e5ad44c13110885458d29b0744c4c5f3af0f8e4e 100644 (file)
@@ -619,13 +619,11 @@ impl CellEncoder {
         let dst = &mut data[x + y * stride..];
         let mut dst_idx = stride;
         for line in 0..4 {
-            for x in 0..4 {
-                let top = dst[dst_idx - stride + x * 2];
-                let cur = cell[(line + 1) * 4 + x];
-                dst[dst_idx + x * 2]     = (top + cur) >> 1;
-                dst[dst_idx + x * 2 + 1] = (top + cur) >> 1;
-                dst[dst_idx + stride + x * 2]     = cur;
-                dst[dst_idx + stride + x * 2 + 1] = cur;
+            for x in 0..8 {
+                let top = dst[dst_idx - stride + x];
+                let cur = cell[(line + 1) * 4 + x / 2];
+                dst[dst_idx + x]            = (top + cur) >> 1;
+                dst[dst_idx + stride + x]   = cur;
             }
             dst_idx += stride * 2;
         }
index 84764eca64cb10e44d4baefcb4b66f69bba49ec5..1c6bf77bc1972fe2cc10c6ee42bacd53d3a1bbc0 100644 (file)
@@ -590,7 +590,7 @@ mod test {
         let enc_options = &[
                 NAOption { name: super::TRY_AGAIN_OPTION, value: NAValue::Bool(true) },
             ];
-        encode_test("indeo3.avi", enc_options, Some(4), &[0xc23464a1, 0xd319a38f, 0x7421165e, 0x42786e50]);
+        encode_test("indeo3.avi", enc_options, Some(4), &[0x17d742bc, 0x6f4c1200, 0x79422bac, 0xc46b5dd0]);
     }
     /*#[test]
     fn test_indeo3_roundtrip() {