diff options
author | Christophe GISQUET <christophe.gisquet@gmail.com> | 2012-01-01 18:33:22 +0100 |
---|---|---|
committer | Kostya Shishkov <kostya.shishkov@gmail.com> | 2012-01-12 09:52:33 +0100 |
commit | 3faa303a47e0c3b59a53988e0f76018930c6cb1a (patch) | |
tree | 7e1f4192c2d6ddab81cb80c71deb1586b11e16cf /libavcodec/rv34dsp.c | |
parent | b2ce3b998b90c9ec8dcefe4b2c45fcf5b2f0a903 (diff) | |
download | ffmpeg-3faa303a47e0c3b59a53988e0f76018930c6cb1a.tar.gz |
rv34: DC-only inverse transform
When decoding coefficients, detect whether the block is DC-only, and take
advantage of this knowledge to perform DC-only inverse transform.
This is achieved by:
- first, changing the 108x4 element modulo_three_table into a 108 element
table (kind of base4), and accessing each value using mask and shifts.
- then, checking low bits for 0 (as they represent the presence of higher
frequency coefficients)
Also provide x86 SIMD code for the DC-only inverse transform.
Signed-off-by: Kostya Shishkov <kostya.shishkov@gmail.com>
Diffstat (limited to 'libavcodec/rv34dsp.c')
-rw-r--r-- | libavcodec/rv34dsp.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/libavcodec/rv34dsp.c b/libavcodec/rv34dsp.c index 1f4cea8544..1767be4173 100644 --- a/libavcodec/rv34dsp.c +++ b/libavcodec/rv34dsp.c @@ -97,13 +97,37 @@ static void rv34_inv_transform_noround_c(DCTELEM *block){ } } +static void rv34_inv_transform_dc_c(DCTELEM *block) +{ + DCTELEM dc = (13 * 13 * block[0] + 0x200) >> 10; + int i, j; + + for (i = 0; i < 4; i++, block += 8) + for (j = 0; j < 4; j++) + block[j] = dc; +} + +static void rv34_inv_transform_dc_noround_c(DCTELEM *block) +{ + DCTELEM dc = (13 * 13 * 3 * block[0]) >> 11; + int i, j; + + for (i = 0; i < 4; i++, block += 8) + for (j = 0; j < 4; j++) + block[j] = dc; +} + /** @} */ // transform av_cold void ff_rv34dsp_init(RV34DSPContext *c, DSPContext* dsp) { c->rv34_inv_transform_tab[0] = rv34_inv_transform_c; c->rv34_inv_transform_tab[1] = rv34_inv_transform_noround_c; + c->rv34_inv_transform_dc_tab[0] = rv34_inv_transform_dc_c; + c->rv34_inv_transform_dc_tab[1] = rv34_inv_transform_dc_noround_c; if (HAVE_NEON) ff_rv34dsp_init_neon(c, dsp); + if (HAVE_MMX) + ff_rv34dsp_init_x86(c, dsp); } |