From: Loren Merritt Date: Thu, 3 Feb 2005 11:03:17 +0000 (+0000) Subject: Another MV clipping fix. X-Git-Url: http://www.zmx.ovh/git.videolan.org/?a=commitdiff_plain;h=33140d0984c7415ed0441858022e777794934550;p=x264.git Another MV clipping fix. git-svn-id: svn://svn.videolan.org/x264/trunk@114 df754926-b1dd-0310-bc7b-ec298dee348c --- diff --git a/encoder/me.c b/encoder/me.c index 369c5142..99703cdd 100644 --- a/encoder/me.c +++ b/encoder/me.c @@ -76,8 +76,8 @@ void x264_me_search_ref( x264_t *h, x264_me_t *m, int (*mvc)[2], int i_mvc, int * with componant magnitude greater. * XXX: if some vector can go outside, (accelerator, ....) you need to clip * them yourself */ - bmx = x264_clip3( ( m->mvp[0] + 2 ) >> 2, mv_x_min, mv_x_max ); - bmy = x264_clip3( ( m->mvp[1] + 2 ) >> 2, mv_y_min, mv_y_max ); + bmx = ( x264_clip3( m->mvp[0], mv_x_min, mv_x_max ) + 2 ) >> 2; + bmy = ( x264_clip3( m->mvp[1], mv_y_min, mv_y_max ) + 2 ) >> 2; bcost = h->pixf.sad[i_pixel]( m->p_fenc, m->i_stride, &p_fref[bmy * m->i_stride + bmx], m->i_stride ); @@ -85,8 +85,8 @@ void x264_me_search_ref( x264_t *h, x264_me_t *m, int (*mvc)[2], int i_mvc, int /* try extra predictors if provided */ for( i_iter = 0; i_iter < i_mvc; i_iter++ ) { - const int mx = x264_clip3( ( mvc[i_iter][0] + 2 ) >> 2, mv_x_min, mv_x_max ); - const int my = x264_clip3( ( mvc[i_iter][1] + 2 ) >> 2, mv_y_min, mv_y_max ); + const int mx = ( x264_clip3( mvc[i_iter][0], mv_x_min, mv_x_max ) + 2 ) >> 2; + const int my = ( x264_clip3( mvc[i_iter][1], mv_y_min, mv_y_max ) + 2 ) >> 2; if( mx != bmx || my != bmy ) COST_MV( mx, my ); }