summaryrefslogtreecommitdiff
path: root/libavcodec/dsputil.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2007-12-21 10:01:04 +0000
committerMichael Niedermayer <michaelni@gmx.at>2007-12-21 10:01:04 +0000
commit815c81c0a732c38675733dbb501d7a5c5fce556e (patch)
treef68840341d8d929212cbcbd9c6b0a66b916f7be6 /libavcodec/dsputil.c
parent91fd7398f4c9802b9c7188fc908a8f31acef5932 (diff)
30% faster h264_chroma_mc8_c(), this also prevents a possible out of
array read. Originally committed as revision 11288 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/dsputil.c')
-rw-r--r--libavcodec/dsputil.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c
index 6104eb9b7a..e3b5db7479 100644
--- a/libavcodec/dsputil.c
+++ b/libavcodec/dsputil.c
@@ -1478,6 +1478,7 @@ static void OPNAME ## h264_chroma_mc8_c(uint8_t *dst/*align 8*/, uint8_t *src/*a
\
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(uint8_t *dst/*align 8*/, uint8_t *src/*a
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)