]> granicus.if.org Git - libx264/commitdiff
Fix clipping of mvs in probe_pskip. (Previously it mixed up fullpel with qpel.) This...
authorLoren Merritt <pengvado@videolan.org>
Thu, 27 Jan 2005 11:33:14 +0000 (11:33 +0000)
committerLoren Merritt <pengvado@videolan.org>
Thu, 27 Jan 2005 11:33:14 +0000 (11:33 +0000)
git-svn-id: svn://svn.videolan.org/x264/trunk@108 df754926-b1dd-0310-bc7b-ec298dee348c

common/macroblock.c
encoder/macroblock.c

index a2f176fc154c48f68392d5a85999df93b527f90c..44a4f5f7d06db708d12bb51994531fd42f9bd180 100644 (file)
@@ -347,6 +347,10 @@ void x264_mb_predict_mv_pskip( x264_t *h, int mv[2] )
     {
         x264_mb_predict_mv_16x16( h, 0, 0, mv );
     }
+
+    /* FIXME: ensure that mvp doesn't extend past picture edge + padding.
+     * we can't just clip the mv here, since the original value may be
+     * needed for predicting other mvs. */
 }
 
 static int x264_mb_predict_mv_direct16x16_temporal( x264_t *h )
index d07f04029fca062cac8cf5f14434a4ee043ebd29..2aec1eb700ef1819aa9432280f0338b1b1c6445e 100644 (file)
@@ -799,19 +799,12 @@ int x264_macroblock_probe_skip( x264_t *h, int b_bidir )
         /* Get the MV */
         x264_mb_predict_mv_pskip( h, mvp );
 
-        /* Special case, need to clip the vector */
-        n = 16 * h->mb.i_mb_x + mvp[0];
-        if( n < -24 )
-            mvp[0] = -24 - 16*h->mb.i_mb_x;
-        else if( n > 16 * h->sps->i_mb_width + 24 )
-            mvp[0] = 16 * ( h->sps->i_mb_width - h->mb.i_mb_x ) + 24;
-
-        n = 16 * h->mb.i_mb_y + mvp[1];
-        if( n < -24 )
-            mvp[1] = -24 - 16*h->mb.i_mb_y;
-        else if( n > 16 * h->sps->i_mb_height + 8 )
-            mvp[1] = 16 * ( h->sps->i_mb_height - h->mb.i_mb_y ) + 8;
-
+        mvp[0] = x264_clip3( mvp[0],
+                             4*( -16*h->mb.i_mb_x - 24 ),
+                             4*( 16*( h->sps->i_mb_width - h->mb.i_mb_x ) + 8 ) );
+        mvp[1] = x264_clip3( mvp[1],
+                             4*( -16*h->mb.i_mb_y - 24 ),
+                             4*( 16*( h->sps->i_mb_height - h->mb.i_mb_y ) + 8 ) );
 
         /* Motion compensation */
         h->mc[MC_LUMA]( h->mb.pic.p_fref[0][0][0], h->mb.pic.i_stride[0],