changeset 6051:1e3b5597505a libavcodec

30% faster h264_chroma_mc8_c(), this also prevents a possible out of array read.
author michael
date Fri, 21 Dec 2007 10:01:04 +0000
parents aeea94d21156
children c90798ac28ee
files dsputil.c
diffstat 1 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/dsputil.c	Fri Dec 21 00:22:40 2007 +0000
+++ b/dsputil.c	Fri Dec 21 10:01:04 2007 +0000
@@ -1478,6 +1478,7 @@
     \
     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 @@
         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)