From f5c61879b56145c3fe371edeb58fb3b7abd94851 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Wed, 15 Feb 2023 19:46:12 +0100 Subject: [PATCH] indeo3enc: fix mode10 interpolation --- nihav-indeo/src/codecs/indeo3enc/cell.rs | 12 +++++------- nihav-indeo/src/codecs/indeo3enc/mod.rs | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/nihav-indeo/src/codecs/indeo3enc/cell.rs b/nihav-indeo/src/codecs/indeo3enc/cell.rs index 6f641eb..e5ad44c 100644 --- a/nihav-indeo/src/codecs/indeo3enc/cell.rs +++ b/nihav-indeo/src/codecs/indeo3enc/cell.rs @@ -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; } diff --git a/nihav-indeo/src/codecs/indeo3enc/mod.rs b/nihav-indeo/src/codecs/indeo3enc/mod.rs index 84764ec..1c6bf77 100644 --- a/nihav-indeo/src/codecs/indeo3enc/mod.rs +++ b/nihav-indeo/src/codecs/indeo3enc/mod.rs @@ -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() { -- 2.39.5