diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2006-07-04 22:43:35 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2006-07-04 22:43:35 +0000 |
commit | 05e7e64d1ad9c0e5f4d2d9fbf11ab952960b9aef (patch) | |
tree | 22884cfd7b76876345878fe5bcf028fef00e8a6c /libavcodec | |
parent | 959e63c9ba5fe51dcf3e622bb1c8a74bb8761dde (diff) | |
download | ffmpeg-05e7e64d1ad9c0e5f4d2d9fbf11ab952960b9aef.tar.gz |
add rounding bias earlier in the idct, avoids many adds
Originally committed as revision 5618 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/cavsdsp.c | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/libavcodec/cavsdsp.c b/libavcodec/cavsdsp.c index 6a1a4b4a46..27586b60dc 100644 --- a/libavcodec/cavsdsp.c +++ b/libavcodec/cavsdsp.c @@ -184,6 +184,8 @@ static void cavs_idct8_add_c(uint8_t *dst, DCTELEM *block, int stride) { DCTELEM (*src)[8] = (DCTELEM(*)[8])block; uint8_t *cm = cropTbl + MAX_NEG_CROP; + src[0][0] += 8; + for( i = 0; i < 8; i++ ) { const int a0 = 3*src[i][1] - (src[i][7]<<1); const int a1 = 3*src[i][3] + (src[i][5]<<1); @@ -197,22 +199,22 @@ static void cavs_idct8_add_c(uint8_t *dst, DCTELEM *block, int stride) { const int a7 = (src[i][2]<<2) - 10*src[i][6]; const int a6 = (src[i][6]<<2) + 10*src[i][2]; - const int a5 = (src[i][0] - src[i][4]) << 3; - const int a4 = (src[i][0] + src[i][4]) << 3; + const int a5 = ((src[i][0] - src[i][4]) << 3) + 4; + const int a4 = ((src[i][0] + src[i][4]) << 3) + 4; const int b0 = a4 + a6; const int b1 = a5 + a7; const int b2 = a5 - a7; const int b3 = a4 - a6; - src[i][0] = (b0 + b4 + 4) >> 3; - src[i][1] = (b1 + b5 + 4) >> 3; - src[i][2] = (b2 + b6 + 4) >> 3; - src[i][3] = (b3 + b7 + 4) >> 3; - src[i][4] = (b3 - b7 + 4) >> 3; - src[i][5] = (b2 - b6 + 4) >> 3; - src[i][6] = (b1 - b5 + 4) >> 3; - src[i][7] = (b0 - b4 + 4) >> 3; + src[i][0] = (b0 + b4) >> 3; + src[i][1] = (b1 + b5) >> 3; + src[i][2] = (b2 + b6) >> 3; + src[i][3] = (b3 + b7) >> 3; + src[i][4] = (b3 - b7) >> 3; + src[i][5] = (b2 - b6) >> 3; + src[i][6] = (b1 - b5) >> 3; + src[i][7] = (b0 - b4) >> 3; } for( i = 0; i < 8; i++ ) { const int a0 = 3*src[1][i] - (src[7][i]<<1); @@ -235,14 +237,14 @@ static void cavs_idct8_add_c(uint8_t *dst, DCTELEM *block, int stride) { const int b2 = a5 - a7; const int b3 = a4 - a6; - dst[i + 0*stride] = cm[ dst[i + 0*stride] + ((b0 + b4 + 64) >> 7)]; - dst[i + 1*stride] = cm[ dst[i + 1*stride] + ((b1 + b5 + 64) >> 7)]; - dst[i + 2*stride] = cm[ dst[i + 2*stride] + ((b2 + b6 + 64) >> 7)]; - dst[i + 3*stride] = cm[ dst[i + 3*stride] + ((b3 + b7 + 64) >> 7)]; - dst[i + 4*stride] = cm[ dst[i + 4*stride] + ((b3 - b7 + 64) >> 7)]; - dst[i + 5*stride] = cm[ dst[i + 5*stride] + ((b2 - b6 + 64) >> 7)]; - dst[i + 6*stride] = cm[ dst[i + 6*stride] + ((b1 - b5 + 64) >> 7)]; - dst[i + 7*stride] = cm[ dst[i + 7*stride] + ((b0 - b4 + 64) >> 7)]; + dst[i + 0*stride] = cm[ dst[i + 0*stride] + ((b0 + b4) >> 7)]; + dst[i + 1*stride] = cm[ dst[i + 1*stride] + ((b1 + b5) >> 7)]; + dst[i + 2*stride] = cm[ dst[i + 2*stride] + ((b2 + b6) >> 7)]; + dst[i + 3*stride] = cm[ dst[i + 3*stride] + ((b3 + b7) >> 7)]; + dst[i + 4*stride] = cm[ dst[i + 4*stride] + ((b3 - b7) >> 7)]; + dst[i + 5*stride] = cm[ dst[i + 5*stride] + ((b2 - b6) >> 7)]; + dst[i + 6*stride] = cm[ dst[i + 6*stride] + ((b1 - b5) >> 7)]; + dst[i + 7*stride] = cm[ dst[i + 7*stride] + ((b0 - b4) >> 7)]; } } |