From: Kostya Shishkov Date: Sat, 25 Jan 2020 17:24:37 +0000 (+0100) Subject: vp5: fix motion compensation part X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=ab5baaf1d26574e979aa248dd31b1d912c01fe84;p=nihav.git vp5: fix motion compensation part --- diff --git a/nihav-duck/src/codecs/vp5.rs b/nihav-duck/src/codecs/vp5.rs index 0c901be..1cd6531 100644 --- a/nihav-duck/src/codecs/vp5.rs +++ b/nihav-duck/src/codecs/vp5.rs @@ -219,11 +219,16 @@ impl VP56Parser for VP5BR { } fn mc_block(&self, dst: &mut NASimpleVideoFrame, mc_buf: NAVideoBufferRef, src: NAVideoBufferRef, plane: usize, x: usize, y: usize, mv: MV, loop_str: i16) { let (sx, sy, mx, my) = if (plane != 1) && (plane != 2) { - (mv.x / 2, mv.y / 2, mv.x & 1, mv.y & 1) + (mv.x >> 1, mv.y >> 1, mv.x & 1, mv.y & 1) } else { - (mv.x / 4, mv.y / 4, (mv.x >> 1) & 1, (mv.y >> 1) & 1) + (mv.x >> 2, mv.y >> 2, (mv.x / 2) & 1, (mv.y / 2) & 1) + }; + let mode1 = (mx as usize) + (my as usize) * 2; + let mode = if (mode1 == 3) && (mv.x ^ mv.y < 0) { + 4 + } else { + mode1 }; - let mode = (mx as usize) + (my as usize) * 2; vp_copy_block(dst, src, plane, x, y, sx, sy, 0, 1, loop_str, mode, VP3_INTERP_FUNCS, mc_buf); }