[FFmpeg-cvslog] r11288 - trunk/libavcodec/dsputil.c

michael subversion
Fri Dec 21 11:01:04 CET 2007


Author: michael
Date: Fri Dec 21 11:01:04 2007
New Revision: 11288

Log:
30% faster h264_chroma_mc8_c(), this also prevents a possible out of
array read.


Modified:
   trunk/libavcodec/dsputil.c

Modified: trunk/libavcodec/dsputil.c
==============================================================================
--- trunk/libavcodec/dsputil.c	(original)
+++ trunk/libavcodec/dsputil.c	Fri Dec 21 11:01:04 2007
@@ -1478,6 +1478,7 @@ static void OPNAME ## h264_chroma_mc8_c(
     \
     assert(x<8 && y<8 && x>=0 && y>=0);\
 \
+    if(D){\
     for(i=0; i<h; i++)\
     {\
         OP(dst[0], (A*src[0] + B*src[1] + C*src[stride+0] + D*src[stride+1]));\
@@ -1491,6 +1492,23 @@ static void OPNAME ## h264_chroma_mc8_c(
         dst+= stride;\
         src+= stride;\
     }\
+    }else{\
+        const int E= B+C;\
+        const int step= C ? stride : 1;\
+        for(i=0; i<h; i++)\
+        {\
+            OP(dst[0], (A*src[0] + E*src[step+0]));\
+            OP(dst[1], (A*src[1] + E*src[step+1]));\
+            OP(dst[2], (A*src[2] + E*src[step+2]));\
+            OP(dst[3], (A*src[3] + E*src[step+3]));\
+            OP(dst[4], (A*src[4] + E*src[step+4]));\
+            OP(dst[5], (A*src[5] + E*src[step+5]));\
+            OP(dst[6], (A*src[6] + E*src[step+6]));\
+            OP(dst[7], (A*src[7] + E*src[step+7]));\
+            dst+= stride;\
+            src+= stride;\
+        }\
+    }\
 }
 
 #define op_avg(a, b) a = (((a)+(((b) + 32)>>6)+1)>>1)




More information about the ffmpeg-cvslog mailing list