]> git.videolan.org Git - x264.git/commitdiff
Don't use uninitialize MVs in x264_mb_predict_mv_ref16x16.
authorLoren Merritt <pengvado@videolan.org>
Thu, 24 Feb 2005 13:01:21 +0000 (13:01 +0000)
committerLoren Merritt <pengvado@videolan.org>
Thu, 24 Feb 2005 13:01:21 +0000 (13:01 +0000)
git-svn-id: svn://svn.videolan.org/x264/trunk@141 df754926-b1dd-0310-bc7b-ec298dee348c

common/macroblock.c

index 46b051b572f9c201c4c4f6f54c1dbb6f6924796d..b5481537f842654c1665424cec2ea6501381c52f 100644 (file)
@@ -505,6 +505,7 @@ void x264_mb_predict_mv_ref16x16( x264_t *h, int i_list, int i_ref, int mvc[5][2
     {
         if( h->mb.cache.ref[i_list][x264_scan8[12]] == i_ref )
         {
+            /* FIXME: use direct_mv to be clearer? */
             int16_t *mvp = h->mb.cache.mv[i_list][x264_scan8[12]];
             mvc[i][0] = mvp[0];
             mvc[i][1] = mvp[1];
@@ -516,24 +517,31 @@ void x264_mb_predict_mv_ref16x16( x264_t *h, int i_list, int i_ref, int mvc[5][2
     if( h->mb.i_mb_x > 0 )
     {
         int i_mb_l = h->mb.i_mb_xy - 1;
-        mvc[i][0] = mvr[i_mb_l][0];
-        mvc[i][1] = mvr[i_mb_l][1];
-        i++;
+        /* skip MBs didn't go through the whole search process, so mvr is undefined */
+        if( !IS_SKIP( h->mb.type[i_mb_l] ) )
+        {
+            mvc[i][0] = mvr[i_mb_l][0];
+            mvc[i][1] = mvr[i_mb_l][1];
+            i++;
+        }
     }
     if( h->mb.i_mb_y > 0 )
     {
         int i_mb_t = h->mb.i_mb_xy - h->mb.i_mb_stride;
-        mvc[i][0] = mvr[i_mb_t][0];
-        mvc[i][1] = mvr[i_mb_t][1];
-        i++;
+        if( !IS_SKIP( h->mb.type[i_mb_t] ) )
+        {
+            mvc[i][0] = mvr[i_mb_t][0];
+            mvc[i][1] = mvr[i_mb_t][1];
+            i++;
+        }
 
-        if( h->mb.i_mb_x > 0 )
+        if( h->mb.i_mb_x > 0 && !IS_SKIP( h->mb.type[i_mb_t - 1] ) )
         {
             mvc[i][0] = mvr[i_mb_t - 1][0];
             mvc[i][1] = mvr[i_mb_t - 1][1];
             i++;
         }
-        if( h->mb.i_mb_x < h->mb.i_mb_stride - 1 )
+        if( h->mb.i_mb_x < h->mb.i_mb_stride - 1 && !IS_SKIP( h->mb.type[i_mb_t + 1] ) )
         {
             mvc[i][0] = mvr[i_mb_t + 1][0];
             mvc[i][1] = mvr[i_mb_t + 1][1];