From: Jason Garrett-Glaser Date: Thu, 14 May 2009 11:11:15 +0000 (-0700) Subject: Faster spatial direct MV prediction X-Git-Url: http://www.zmx.ovh/git.videolan.org/?a=commitdiff_plain;h=3b80f2321937ed4962c6e2fcc679765bbf729723;p=x264.git Faster spatial direct MV prediction unroll/tweak col_zero_flag --- diff --git a/common/macroblock.c b/common/macroblock.c index 71b09061..792d40a5 100644 --- a/common/macroblock.c +++ b/common/macroblock.c @@ -293,16 +293,21 @@ static int x264_mb_predict_mv_direct16x16_spatial( x264_t *h ) const int x8 = i8%2; const int y8 = i8/2; const int o8 = x8 + y8 * h->mb.i_b8_stride; - if( l1ref0[o8] == 0 || ( l1ref0[o8] < 0 && l1ref1[o8] == 0 ) ) + const int o4 = 3*(x8 + y8 * h->mb.i_b4_stride); + if( l1ref0[o8] == 0 ) { - const int16_t (*l1mv)[2] = (l1ref0[o8] == 0) ? l1mv0 : l1mv1; - const int16_t *mvcol = l1mv[3*x8 + 3*y8 * h->mb.i_b4_stride]; - if( abs( mvcol[0] ) <= 1 && abs( mvcol[1] ) <= 1 ) + if( abs( l1mv0[o4][0] ) <= 1 && abs( l1mv0[o4][1] ) <= 1 ) { - if( ref[0] == 0 ) - x264_macroblock_cache_mv( h, 2*x8, 2*y8, 2, 2, 0, 0 ); - if( ref[1] == 0 ) - x264_macroblock_cache_mv( h, 2*x8, 2*y8, 2, 2, 1, 0 ); + if( ref[0] == 0 ) x264_macroblock_cache_mv( h, 2*x8, 2*y8, 2, 2, 0, 0 ); + if( ref[1] == 0 ) x264_macroblock_cache_mv( h, 2*x8, 2*y8, 2, 2, 1, 0 ); + } + } + else if( l1ref0[o8] < 0 && l1ref1[o8] == 0 ) + { + if( abs( l1mv1[o4][0] ) <= 1 && abs( l1mv1[o4][1] ) <= 1 ) + { + if( ref[0] == 0 ) x264_macroblock_cache_mv( h, 2*x8, 2*y8, 2, 2, 0, 0 ); + if( ref[1] == 0 ) x264_macroblock_cache_mv( h, 2*x8, 2*y8, 2, 2, 1, 0 ); } } }