[x264-devel] commit: Faster temporal predictor calculation (Jason Garrett-Glaser )

git version control git at videolan.org
Thu Jul 24 15:58:45 CEST 2008


x264 | branch: master | Jason Garrett-Glaser <darkshikari at gmail.com> | Thu Jul 17 18:17:22 2008 -0600| [244f9bef20341d230501dbe7e09a80004d0c0dbb]

Faster temporal predictor calculation
Split into a separate commit because this changes rounding, and thus changes output slightly.

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=244f9bef20341d230501dbe7e09a80004d0c0dbb
---

 common/macroblock.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/common/macroblock.c b/common/macroblock.c
index 48cf1cd..1bf995f 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;
     }
 }
 



More information about the x264-devel mailing list