From f311208cf1ebbd74f8a3bd111d9172f41188aa83 Mon Sep 17 00:00:00 2001 From: Jason Garrett-Glaser Date: Mon, 2 Aug 2010 20:57:03 +0000 Subject: VP8: much faster DC transform handling A lot of the time the DC block is empty: don't do the WHT in this case. A lot of the rest of the time, there's only one coefficient: make a special DC-only transform for that case. When the block is empty, don't incorrectly mark luma DCT blocks as having DC coefficients. Originally committed as revision 24670 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/vp8dsp.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'libavcodec/vp8dsp.c') diff --git a/libavcodec/vp8dsp.c b/libavcodec/vp8dsp.c index 5f5124803d..b8cf0b2f6c 100644 --- a/libavcodec/vp8dsp.c +++ b/libavcodec/vp8dsp.c @@ -51,13 +51,25 @@ static void vp8_luma_dc_wht_c(DCTELEM block[4][4][16], DCTELEM dc[16]) dc[i*4+2] = 0; dc[i*4+3] = 0; - *block[i][0] = (t0 + t1) >> 3; - *block[i][1] = (t3 + t2) >> 3; - *block[i][2] = (t0 - t1) >> 3; - *block[i][3] = (t3 - t2) >> 3; + block[i][0][0] = (t0 + t1) >> 3; + block[i][1][0] = (t3 + t2) >> 3; + block[i][2][0] = (t0 - t1) >> 3; + block[i][3][0] = (t3 - t2) >> 3; } } +static void vp8_luma_dc_wht_dc_c(DCTELEM block[4][4][16], DCTELEM dc[16]) +{ + int i, val = (dc[0] + 3) >> 3; + dc[0] = 0; + + for (i = 0; i < 4; i++) { + block[i][0][0] = val; + block[i][1][0] = val; + block[i][2][0] = val; + block[i][3][0] = val; + } +} #define MUL_20091(a) ((((a)*20091) >> 16) + (a)) #define MUL_35468(a) (((a)*35468) >> 16) @@ -480,6 +492,7 @@ VP8_BILINEAR(4) av_cold void ff_vp8dsp_init(VP8DSPContext *dsp) { dsp->vp8_luma_dc_wht = vp8_luma_dc_wht_c; + dsp->vp8_luma_dc_wht_dc = vp8_luma_dc_wht_dc_c; dsp->vp8_idct_add = vp8_idct_add_c; dsp->vp8_idct_dc_add = vp8_idct_dc_add_c; dsp->vp8_idct_dc_add4y = vp8_idct_dc_add4y_c; -- cgit v1.2.3