From 5d00209dc3ffb2f57aa2f44629254ea6b26c4a3c Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Mon, 30 Dec 2019 15:56:28 +0100 Subject: [PATCH] vp3: fix fourmv block positions --- nihav-duck/src/codecs/vp3.rs | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/nihav-duck/src/codecs/vp3.rs b/nihav-duck/src/codecs/vp3.rs index 8165e7f..8612831 100644 --- a/nihav-duck/src/codecs/vp3.rs +++ b/nihav-duck/src/codecs/vp3.rs @@ -960,15 +960,19 @@ println!("intra, ver {} (self {})", version, self.version); let mut cur_blk = 0; for _ in 0..self.y_blocks/4 { if self.blocks[self.blk_addr[cur_blk] >> 2].btype == VPMBType::InterFourMV { - for _ in 0..4 { - let blk = &mut self.blocks[self.blk_addr[cur_blk] >> 2]; - if blk.coded { - blk.mv = (read_mv)(br)?; - last2_mv = last_mv; - last_mv = blk.mv; - } - cur_blk += 1; - } + let a0 = self.blk_addr[cur_blk + 0] >> 2; + let a1 = self.blk_addr[cur_blk + 1] >> 2; + let a2 = self.blk_addr[cur_blk + 2] >> 2; + let a3 = self.blk_addr[cur_blk + 3] >> 2; + let first = a0.min(a1).min(a2).min(a3); + let last = a0.max(a1).max(a2).max(a3); + self.blocks[first + 0].mv = (read_mv)(br)?; + self.blocks[first + 1].mv = (read_mv)(br)?; + self.blocks[last - 1].mv = (read_mv)(br)?; + self.blocks[last + 0].mv = (read_mv)(br)?; + last2_mv = last_mv; + last_mv = self.blocks[last].mv; + cur_blk += 4; } else { let cur_mv; match self.blocks[self.blk_addr[cur_blk] >> 2].btype { -- 2.39.5