From: Fiona Glaser Date: Fri, 18 Jul 2008 00:17:22 +0000 (-0600) Subject: Faster temporal predictor calculation X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=502baa8a5f4271b99a35e79f0604f4bf6f541d22;p=libx264 Faster temporal predictor calculation Split into a separate commit because this changes rounding, and thus changes output slightly. --- diff --git a/common/macroblock.c b/common/macroblock.c index b512b08e..f2715f29 100644 --- a/common/macroblock.c +++ b/common/macroblock.c @@ -480,8 +480,6 @@ void x264_mb_load_mv_direct8x8( x264_t *h, int idx ) *(uint64_t*)h->mb.cache.direct_mv[1][x264_scan8[idx*4]+8]; } -#define FIXED_SCALE 256 - /* This just improves encoder performance, it's not part of the spec */ void x264_mb_predict_mv_ref16x16( x264_t *h, int i_list, int i_ref, int16_t mvc[8][2], int *i_mvc ) { @@ -534,8 +532,8 @@ void x264_mb_predict_mv_ref16x16( x264_t *h, int i_list, int i_ref, int16_t mvc[ if( ref_col >= 0 ) \ { \ int scale = (h->fdec->i_poc - h->fdec->ref_poc[0][i_ref]) * l0->inv_ref_poc[ref_col];\ - mvc[i][0] = l0->mv[0][i_b4][0] * scale / FIXED_SCALE; \ - mvc[i][1] = l0->mv[0][i_b4][1] * scale / FIXED_SCALE; \ + mvc[i][0] = (l0->mv[0][i_b4][0]*scale + 128) >> 8;\ + mvc[i][1] = (l0->mv[0][i_b4][1]*scale + 128) >> 8;\ i++; \ } \ } @@ -561,7 +559,7 @@ static void setup_inverse_delta_pocs( x264_t *h ) for( i = 0; i < h->i_ref0; i++ ) { int delta = h->fdec->i_poc - h->fref0[i]->i_poc; - h->fdec->inv_ref_poc[i] = (FIXED_SCALE + delta/2) / delta; + h->fdec->inv_ref_poc[i] = (256 + delta/2) / delta; } }