comparison dsputil.c @ 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 f4859c13426b
children c90798ac28ee
comparison
equal deleted inserted replaced
6050:aeea94d21156 6051:1e3b5597505a
1476 const int D=( x)*( y);\ 1476 const int D=( x)*( y);\
1477 int i;\ 1477 int i;\
1478 \ 1478 \
1479 assert(x<8 && y<8 && x>=0 && y>=0);\ 1479 assert(x<8 && y<8 && x>=0 && y>=0);\
1480 \ 1480 \
1481 if(D){\
1481 for(i=0; i<h; i++)\ 1482 for(i=0; i<h; i++)\
1482 {\ 1483 {\
1483 OP(dst[0], (A*src[0] + B*src[1] + C*src[stride+0] + D*src[stride+1]));\ 1484 OP(dst[0], (A*src[0] + B*src[1] + C*src[stride+0] + D*src[stride+1]));\
1484 OP(dst[1], (A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2]));\ 1485 OP(dst[1], (A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2]));\
1485 OP(dst[2], (A*src[2] + B*src[3] + C*src[stride+2] + D*src[stride+3]));\ 1486 OP(dst[2], (A*src[2] + B*src[3] + C*src[stride+2] + D*src[stride+3]));\
1488 OP(dst[5], (A*src[5] + B*src[6] + C*src[stride+5] + D*src[stride+6]));\ 1489 OP(dst[5], (A*src[5] + B*src[6] + C*src[stride+5] + D*src[stride+6]));\
1489 OP(dst[6], (A*src[6] + B*src[7] + C*src[stride+6] + D*src[stride+7]));\ 1490 OP(dst[6], (A*src[6] + B*src[7] + C*src[stride+6] + D*src[stride+7]));\
1490 OP(dst[7], (A*src[7] + B*src[8] + C*src[stride+7] + D*src[stride+8]));\ 1491 OP(dst[7], (A*src[7] + B*src[8] + C*src[stride+7] + D*src[stride+8]));\
1491 dst+= stride;\ 1492 dst+= stride;\
1492 src+= stride;\ 1493 src+= stride;\
1494 }\
1495 }else{\
1496 const int E= B+C;\
1497 const int step= C ? stride : 1;\
1498 for(i=0; i<h; i++)\
1499 {\
1500 OP(dst[0], (A*src[0] + E*src[step+0]));\
1501 OP(dst[1], (A*src[1] + E*src[step+1]));\
1502 OP(dst[2], (A*src[2] + E*src[step+2]));\
1503 OP(dst[3], (A*src[3] + E*src[step+3]));\
1504 OP(dst[4], (A*src[4] + E*src[step+4]));\
1505 OP(dst[5], (A*src[5] + E*src[step+5]));\
1506 OP(dst[6], (A*src[6] + E*src[step+6]));\
1507 OP(dst[7], (A*src[7] + E*src[step+7]));\
1508 dst+= stride;\
1509 src+= stride;\
1510 }\
1493 }\ 1511 }\
1494 } 1512 }
1495 1513
1496 #define op_avg(a, b) a = (((a)+(((b) + 32)>>6)+1)>>1) 1514 #define op_avg(a, b) a = (((a)+(((b) + 32)>>6)+1)>>1)
1497 #define op_put(a, b) a = (((b) + 32)>>6) 1515 #define op_put(a, b) a = (((b) + 32)>>6)