diff options
author | Jason Garrett-Glaser <darkshikari@gmail.com> | 2009-06-16 09:00:55 +0000 |
---|---|---|
committer | Jason Garrett-Glaser <darkshikari@gmail.com> | 2009-06-16 09:00:55 +0000 |
commit | 4f717c69ed25a701f8b6613ca00e5e632a6382a6 (patch) | |
tree | 0c82c716bd1f4f88d7645499692f3e213f4ffe68 /libavcodec/vc1dsp.c | |
parent | 41faa87886e6fc54f159da6940b9edbfcd194714 (diff) | |
download | ffmpeg-4f717c69ed25a701f8b6613ca00e5e632a6382a6.tar.gz |
idct_dc for VC-1/WMV3 decoder; ~11% faster decoding overall.
Includes mmx2 asm for the various functions.
Note that the actual idct still does not have an x86 SIMD implemtation.
For wmv3 files using regular idct, the decoder just falls back to simple_idct,
since simple_idct_dc doesn't exist (yet).
Originally committed as revision 19204 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/vc1dsp.c')
-rw-r--r-- | libavcodec/vc1dsp.c | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/libavcodec/vc1dsp.c b/libavcodec/vc1dsp.c index 5773ab1e3c..5e79736a50 100644 --- a/libavcodec/vc1dsp.c +++ b/libavcodec/vc1dsp.c @@ -178,6 +178,26 @@ static void vc1_h_loop_filter16_c(uint8_t *src, int stride, int pq) /** Do inverse transform on 8x8 block */ +static void vc1_inv_trans_8x8_dc_c(uint8_t *dest, int linesize, DCTELEM *block) +{ + int i; + int dc = block[0]; + const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; + dc = (3 * dc + 1) >> 1; + dc = (3 * dc + 16) >> 5; + for(i = 0; i < 8; i++){ + dest[0] = cm[dest[0]+dc]; + dest[1] = cm[dest[1]+dc]; + dest[2] = cm[dest[2]+dc]; + dest[3] = cm[dest[3]+dc]; + dest[4] = cm[dest[4]+dc]; + dest[5] = cm[dest[5]+dc]; + dest[6] = cm[dest[6]+dc]; + dest[7] = cm[dest[7]+dc]; + dest += linesize; + } +} + static void vc1_inv_trans_8x8_c(DCTELEM block[64]) { int i; @@ -249,6 +269,26 @@ static void vc1_inv_trans_8x8_c(DCTELEM block[64]) /** Do inverse transform on 8x4 part of block */ +static void vc1_inv_trans_8x4_dc_c(uint8_t *dest, int linesize, DCTELEM *block) +{ + int i; + int dc = block[0]; + const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; + dc = ( 3 * dc + 1) >> 1; + dc = (17 * dc + 64) >> 7; + for(i = 0; i < 4; i++){ + dest[0] = cm[dest[0]+dc]; + dest[1] = cm[dest[1]+dc]; + dest[2] = cm[dest[2]+dc]; + dest[3] = cm[dest[3]+dc]; + dest[4] = cm[dest[4]+dc]; + dest[5] = cm[dest[5]+dc]; + dest[6] = cm[dest[6]+dc]; + dest[7] = cm[dest[7]+dc]; + dest += linesize; + } +} + static void vc1_inv_trans_8x4_c(uint8_t *dest, int linesize, DCTELEM *block) { int i; @@ -306,6 +346,22 @@ static void vc1_inv_trans_8x4_c(uint8_t *dest, int linesize, DCTELEM *block) /** Do inverse transform on 4x8 parts of block */ +static void vc1_inv_trans_4x8_dc_c(uint8_t *dest, int linesize, DCTELEM *block) +{ + int i; + int dc = block[0]; + const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; + dc = (17 * dc + 4) >> 3; + dc = (12 * dc + 64) >> 7; + for(i = 0; i < 8; i++){ + dest[0] = cm[dest[0]+dc]; + dest[1] = cm[dest[1]+dc]; + dest[2] = cm[dest[2]+dc]; + dest[3] = cm[dest[3]+dc]; + dest += linesize; + } +} + static void vc1_inv_trans_4x8_c(uint8_t *dest, int linesize, DCTELEM *block) { int i; @@ -363,6 +419,22 @@ static void vc1_inv_trans_4x8_c(uint8_t *dest, int linesize, DCTELEM *block) /** Do inverse transform on 4x4 part of block */ +static void vc1_inv_trans_4x4_dc_c(uint8_t *dest, int linesize, DCTELEM *block) +{ + int i; + int dc = block[0]; + const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; + dc = (17 * dc + 4) >> 3; + dc = (17 * dc + 64) >> 7; + for(i = 0; i < 4; i++){ + dest[0] = cm[dest[0]+dc]; + dest[1] = cm[dest[1]+dc]; + dest[2] = cm[dest[2]+dc]; + dest[3] = cm[dest[3]+dc]; + dest += linesize; + } +} + static void vc1_inv_trans_4x4_c(uint8_t *dest, int linesize, DCTELEM *block) { int i; @@ -545,6 +617,10 @@ void ff_vc1dsp_init(DSPContext* dsp, AVCodecContext *avctx) { dsp->vc1_inv_trans_4x8 = vc1_inv_trans_4x8_c; dsp->vc1_inv_trans_8x4 = vc1_inv_trans_8x4_c; dsp->vc1_inv_trans_4x4 = vc1_inv_trans_4x4_c; + dsp->vc1_inv_trans_8x8_dc = vc1_inv_trans_8x8_dc_c; + dsp->vc1_inv_trans_4x8_dc = vc1_inv_trans_4x8_dc_c; + dsp->vc1_inv_trans_8x4_dc = vc1_inv_trans_8x4_dc_c; + dsp->vc1_inv_trans_4x4_dc = vc1_inv_trans_4x4_dc_c; dsp->vc1_h_overlap = vc1_h_overlap_c; dsp->vc1_v_overlap = vc1_v_overlap_c; dsp->vc1_v_loop_filter4 = vc1_v_loop_filter4_c; |