From 3b80f2321937ed4962c6e2fcc679765bbf729723 Mon Sep 17 00:00:00 2001 From: Jason Garrett-Glaser Date: Thu, 14 May 2009 04:11:15 -0700 Subject: [PATCH] Faster spatial direct MV prediction unroll/tweak col_zero_flag --- common/macroblock.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) 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 ); } } } -- 2.47.3