media/libvpx/splitmv-bounds.patch
author Ryan VanderMeulen <ryanvm@gmail.com>
Wed, 09 Jun 2010 08:06:40 +0200
changeset 43385 c5b3d7beca8c664f4855c0e4a2ad9c01ec6c2c3a
parent 43343 1a95c30ec47b296a732041a9a5bff2c0d49f5eeb
permissions -rw-r--r--
Bug 564608 - Update Hunspell to 1.2.11. r=smaug

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);