From: Kostya Shishkov Date: Thu, 6 Feb 2020 17:47:41 +0000 (+0100) Subject: vp7: fix split block chroma motion compensation X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=7589c13a496fca9a3b5de112f7597993a6f7ccc6;p=nihav.git vp7: fix split block chroma motion compensation --- diff --git a/nihav-duck/src/codecs/vp7.rs b/nihav-duck/src/codecs/vp7.rs index 59b1c22..a4a0d1b 100644 --- a/nihav-duck/src/codecs/vp7.rs +++ b/nihav-duck/src/codecs/vp7.rs @@ -1017,22 +1017,32 @@ impl VP7Decoder { } else { for y in 0..2 { for x in 0..2 { - let mut chroma_mv = self.mvs[iidx] + self.mvs[iidx + 1] - + self.mvs[iidx + self.mv_stride] - + self.mvs[iidx + self.mv_stride + 1]; - chroma_mv.x /= 4; - chroma_mv.y /= 4; + let mut chroma_mv = self.mvs[iidx + x * 2] + self.mvs[iidx + x * 2 + 1] + + self.mvs[iidx + x * 2 + self.mv_stride] + + self.mvs[iidx + x * 2 + self.mv_stride + 1]; + if chroma_mv.x < 0 { + chroma_mv.x += 1; + } else { + chroma_mv.x += 2; + } + if chroma_mv.y < 0 { + chroma_mv.y += 1; + } else { + chroma_mv.y += 2; + } + chroma_mv.x >>= 2; + chroma_mv.y >>= 2; if pitch_smode == 0 { - mc_block4x4(dst, uoff, ustride, mb_x * 8 + x * 4, mb_y * 8 + y * 4, + mc_block4x4(dst, uoff + x * 4, ustride, mb_x * 8 + x * 4, mb_y * 8 + y * 4, chroma_mv.x, chroma_mv.y, refframe.clone(), 1, &mut mc_buf); - mc_block4x4(dst, voff, vstride, mb_x * 8 + x * 4, mb_y * 8 + y * 4, + mc_block4x4(dst, voff + x * 4, vstride, mb_x * 8 + x * 4, mb_y * 8 + y * 4, chroma_mv.x, chroma_mv.y, refframe.clone(), 2, &mut mc_buf); } else { - mc_block_special(dst, uoff, ustride, mb_x * 8 + x * 4, mb_y * 8 + y * 4, + mc_block_special(dst, uoff + x * 4, ustride, mb_x * 8 + x * 4, mb_y * 8 + y * 4, chroma_mv.x, chroma_mv.y, refframe.clone(), 1, &mut mc_buf, 4, pitch_smode); - mc_block_special(dst, voff, vstride, mb_x * 8 + x * 4, mb_y * 8 + y * 4, + mc_block_special(dst, voff + x * 4, vstride, mb_x * 8 + x * 4, mb_y * 8 + y * 4, chroma_mv.x, chroma_mv.y, refframe.clone(), 2, &mut mc_buf, 4, pitch_smode); }