diff options
author | Loren Merritt | 2005-06-02 21:15:20 +0000 |
---|---|---|
committer | Loren Merritt | 2005-06-02 21:15:20 +0000 |
commit | 43efd19a88bee63d50f568be5ede9d8c1f1dc091 (patch) | |
tree | 99e1880bf2fd4fe75a2d0ba3d478a073d3be3f64 /libavcodec/h264idct.c | |
parent | 20ffdcf9c09f6b9cb4265735ea8a323439b66a8f (diff) |
decode H.264 with 8x8 transform.
deblocking is still incorrect with 8x8+cavlc
Originally committed as revision 4339 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/h264idct.c')
-rw-r--r-- | libavcodec/h264idct.c | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/libavcodec/h264idct.c b/libavcodec/h264idct.c index 551197d37e..e59324d58f 100644 --- a/libavcodec/h264idct.c +++ b/libavcodec/h264idct.c @@ -68,3 +68,74 @@ void ff_h264_lowres_idct_add_c(uint8_t *dst, int stride, DCTELEM *block){ void ff_h264_lowres_idct_put_c(uint8_t *dst, int stride, DCTELEM *block){ idct_internal(dst, block, stride, 8, 3, 0); } + +void ff_h264_idct8_add_c(uint8_t *dst, DCTELEM *block, int stride){ + int i; + DCTELEM (*src)[8] = (DCTELEM(*)[8])block; + uint8_t *cm = cropTbl + MAX_NEG_CROP; + + block[0] += 32; + + for( i = 0; i < 8; i++ ) + { + const int a0 = src[i][0] + src[i][4]; + const int a2 = src[i][0] - src[i][4]; + const int a4 = (src[i][2]>>1) - src[i][6]; + const int a6 = (src[i][6]>>1) + src[i][2]; + + const int b0 = a0 + a6; + const int b2 = a2 + a4; + const int b4 = a2 - a4; + const int b6 = a0 - a6; + + const int a1 = -src[i][3] + src[i][5] - src[i][7] - (src[i][7]>>1); + const int a3 = src[i][1] + src[i][7] - src[i][3] - (src[i][3]>>1); + const int a5 = -src[i][1] + src[i][7] + src[i][5] + (src[i][5]>>1); + const int a7 = src[i][3] + src[i][5] + src[i][1] + (src[i][1]>>1); + + const int b1 = (a7>>2) + a1; + const int b3 = a3 + (a5>>2); + const int b5 = (a3>>2) - a5; + const int b7 = a7 - (a1>>2); + + src[i][0] = b0 + b7; + src[i][7] = b0 - b7; + src[i][1] = b2 + b5; + src[i][6] = b2 - b5; + src[i][2] = b4 + b3; + src[i][5] = b4 - b3; + src[i][3] = b6 + b1; + src[i][4] = b6 - b1; + } + for( i = 0; i < 8; i++ ) + { + const int a0 = src[0][i] + src[4][i]; + const int a2 = src[0][i] - src[4][i]; + const int a4 = (src[2][i]>>1) - src[6][i]; + const int a6 = (src[6][i]>>1) + src[2][i]; + + const int b0 = a0 + a6; + const int b2 = a2 + a4; + const int b4 = a2 - a4; + const int b6 = a0 - a6; + + const int a1 = -src[3][i] + src[5][i] - src[7][i] - (src[7][i]>>1); + const int a3 = src[1][i] + src[7][i] - src[3][i] - (src[3][i]>>1); + const int a5 = -src[1][i] + src[7][i] + src[5][i] + (src[5][i]>>1); + const int a7 = src[3][i] + src[5][i] + src[1][i] + (src[1][i]>>1); + + const int b1 = (a7>>2) + a1; + const int b3 = a3 + (a5>>2); + const int b5 = (a3>>2) - a5; + const int b7 = a7 - (a1>>2); + + dst[i + 0*stride] = cm[ dst[i + 0*stride] + ((b0 + b7) >> 6) ]; + dst[i + 1*stride] = cm[ dst[i + 1*stride] + ((b2 + b5) >> 6) ]; + dst[i + 2*stride] = cm[ dst[i + 2*stride] + ((b4 + b3) >> 6) ]; + dst[i + 3*stride] = cm[ dst[i + 3*stride] + ((b6 + b1) >> 6) ]; + dst[i + 4*stride] = cm[ dst[i + 4*stride] + ((b6 - b1) >> 6) ]; + dst[i + 5*stride] = cm[ dst[i + 5*stride] + ((b4 - b3) >> 6) ]; + dst[i + 6*stride] = cm[ dst[i + 6*stride] + ((b2 - b5) >> 6) ]; + dst[i + 7*stride] = cm[ dst[i + 7*stride] + ((b0 - b7) >> 6) ]; + } +} |