[x264-devel] commit: Move mv/ref prefetch code to the correct location ( Jason Garrett-Glaser )

git at videolan.org git at videolan.org
Wed Nov 10 10:12:32 CET 2010


x264 | branch: master | Jason Garrett-Glaser <darkshikari at gmail.com> | Mon Nov  1 19:19:23 2010 -0700| [6541afc22aa8f1bac57299561eb59237802930ec] | committer: Jason Garrett-Glaser 

Move mv/ref prefetch code to the correct location
Prefetching of top blocks should be done under if(top), not if(left).

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

 common/macroblock.c |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/common/macroblock.c b/common/macroblock.c
index 7f0348e..1a28418 100644
--- a/common/macroblock.c
+++ b/common/macroblock.c
@@ -674,6 +674,17 @@ void x264_macroblock_cache_load( x264_t *h, int mb_x, int mb_y )
         /* shift because x264_scan8[16] is misaligned */
         M32( &h->mb.cache.non_zero_count[x264_scan8[16+0] - 9] ) = M16( &nnz[top][18] ) << 8;
         M32( &h->mb.cache.non_zero_count[x264_scan8[16+4] - 9] ) = M16( &nnz[top][22] ) << 8;
+
+        /* Finish the prefetching */
+        for( int l = 0; l < lists; l++ )
+        {
+            x264_prefetch( &h->mb.mv[l][top_4x4-1] );
+            /* Top right being not in the same cacheline as top left will happen
+             * once every 4 MBs, so one extra prefetch is worthwhile */
+            x264_prefetch( &h->mb.mv[l][top_4x4+4] );
+            x264_prefetch( &h->mb.ref[l][top_8x8-1] );
+            x264_prefetch( &h->mb.mvd[l][top] );
+        }
     }
     else
     {
@@ -709,17 +720,6 @@ void x264_macroblock_cache_load( x264_t *h, int mb_x, int mb_y )
 
         h->mb.cache.non_zero_count[x264_scan8[16+4+0] - 1] = nnz[left][16+4+1];
         h->mb.cache.non_zero_count[x264_scan8[16+4+2] - 1] = nnz[left][16+4+3];
-
-        /* Finish the prefetching */
-        for( int l = 0; l < lists; l++ )
-        {
-            x264_prefetch( &h->mb.mv[l][top_4x4-1] );
-            /* Top right being not in the same cacheline as top left will happen
-             * once every 4 MBs, so one extra prefetch is worthwhile */
-            x264_prefetch( &h->mb.mv[l][top_4x4+4] );
-            x264_prefetch( &h->mb.ref[l][top_8x8-1] );
-            x264_prefetch( &h->mb.mvd[l][top] );
-        }
     }
     else
     {



More information about the x264-devel mailing list