gecko-dev/media/libvpx/splitmv-bounds.patch

33 строки
1.6 KiB
Diff

diff --git a/media/libvpx/vp8/decoder/decodemv.c b/media/libvpx/vp8/decoder/decodemv.c
--- a/media/libvpx/vp8/decoder/decodemv.c
+++ b/media/libvpx/vp8/decoder/decodemv.c
@@ -264,16 +264,28 @@ void vp8_decode_mode_mvs(VP8D_COMP *pbi)
#ifdef VPX_MODE_COUNT
vp8_mv_cont_count[mv_contz][2]++;
#endif
break;
default:
break;
}
+ /* Clip the MV for this partition so that it does
+ not extend to far out of image. */
+ if (mv->col < (xd->mb_to_left_edge - LEFT_TOP_MARGIN))
+ mv->col = xd->mb_to_left_edge - LEFT_TOP_MARGIN;
+ else if (mv->col > xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN + 7)
+ mv->col = xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN + 7;
+
+ if (mv->row < (xd->mb_to_top_edge - LEFT_TOP_MARGIN))
+ mv->row = xd->mb_to_top_edge - LEFT_TOP_MARGIN;
+ else if (mv->row > xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN + 7)
+ mv->row = xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN + 7;
+
/* Fill (uniform) modes, mvs of jth subset.
Must do it here because ensuing subsets can
refer back to us via "left" or "above". */
do
if (j == L[k])
mi->bmi[k] = *bmi;
while (++k < 16);