[x264-devel] Avoid some unneccesary memory loads in macroblock_encode

Henrik Gramner git at videolan.org
Tue Jan 21 22:51:26 CET 2014


x264 | branch: master | Henrik Gramner <henrik at gramner.com> | Wed Jan  8 01:06:56 2014 +0100| [96ca8e6629c2944e662f626695f801106ba46c7b] | committer: Jason Garrett-Glaser

Avoid some unneccesary memory loads in macroblock_encode

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

 encoder/macroblock.c |    5 +----
 encoder/macroblock.h |    8 ++++----
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/encoder/macroblock.c b/encoder/macroblock.c
index 0407130..2b739e9 100644
--- a/encoder/macroblock.c
+++ b/encoder/macroblock.c
@@ -157,10 +157,7 @@ static void x264_mb_encode_i16x16( x264_t *h, int p, int i_qp )
         return;
     }
 
-    M32( &h->mb.cache.non_zero_count[x264_scan8[ 0+p*16]] ) = 0;
-    M32( &h->mb.cache.non_zero_count[x264_scan8[ 2+p*16]] ) = 0;
-    M32( &h->mb.cache.non_zero_count[x264_scan8[ 8+p*16]] ) = 0;
-    M32( &h->mb.cache.non_zero_count[x264_scan8[10+p*16]] ) = 0;
+    CLEAR_16x16_NNZ( p );
 
     h->dctf.sub16x16_dct( dct4x4, p_src, p_dst );
 
diff --git a/encoder/macroblock.h b/encoder/macroblock.h
index d0ba11a..9ca3f3d 100644
--- a/encoder/macroblock.h
+++ b/encoder/macroblock.h
@@ -98,10 +98,10 @@ do\
 #define CLEAR_16x16_NNZ( p ) \
 do\
 {\
-    M32( &h->mb.cache.non_zero_count[x264_scan8[16*p+ 0]] ) = 0;\
-    M32( &h->mb.cache.non_zero_count[x264_scan8[16*p+ 2]] ) = 0;\
-    M32( &h->mb.cache.non_zero_count[x264_scan8[16*p+ 8]] ) = 0;\
-    M32( &h->mb.cache.non_zero_count[x264_scan8[16*p+10]] ) = 0;\
+    M32( &h->mb.cache.non_zero_count[x264_scan8[16*p] + 0*8] ) = 0;\
+    M32( &h->mb.cache.non_zero_count[x264_scan8[16*p] + 1*8] ) = 0;\
+    M32( &h->mb.cache.non_zero_count[x264_scan8[16*p] + 2*8] ) = 0;\
+    M32( &h->mb.cache.non_zero_count[x264_scan8[16*p] + 3*8] ) = 0;\
 } while(0)
 
 /* A special for loop that iterates branchlessly over each set



More information about the x264-devel mailing list