comparison vp8dsp.c @ 12342:b4c63ffd959b libavcodec

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.
author darkshikari
date Mon, 02 Aug 2010 20:57:03 +0000
parents 2d15f62f4f8a
children
comparison
equal deleted inserted replaced
12341:ad24cca213ae 12342:b4c63ffd959b
49 dc[i*4+0] = 0; 49 dc[i*4+0] = 0;
50 dc[i*4+1] = 0; 50 dc[i*4+1] = 0;
51 dc[i*4+2] = 0; 51 dc[i*4+2] = 0;
52 dc[i*4+3] = 0; 52 dc[i*4+3] = 0;
53 53
54 *block[i][0] = (t0 + t1) >> 3; 54 block[i][0][0] = (t0 + t1) >> 3;
55 *block[i][1] = (t3 + t2) >> 3; 55 block[i][1][0] = (t3 + t2) >> 3;
56 *block[i][2] = (t0 - t1) >> 3; 56 block[i][2][0] = (t0 - t1) >> 3;
57 *block[i][3] = (t3 - t2) >> 3; 57 block[i][3][0] = (t3 - t2) >> 3;
58 } 58 }
59 } 59 }
60 60
61 static void vp8_luma_dc_wht_dc_c(DCTELEM block[4][4][16], DCTELEM dc[16])
62 {
63 int i, val = (dc[0] + 3) >> 3;
64 dc[0] = 0;
65
66 for (i = 0; i < 4; i++) {
67 block[i][0][0] = val;
68 block[i][1][0] = val;
69 block[i][2][0] = val;
70 block[i][3][0] = val;
71 }
72 }
61 73
62 #define MUL_20091(a) ((((a)*20091) >> 16) + (a)) 74 #define MUL_20091(a) ((((a)*20091) >> 16) + (a))
63 #define MUL_35468(a) (((a)*35468) >> 16) 75 #define MUL_35468(a) (((a)*35468) >> 16)
64 76
65 static void vp8_idct_add_c(uint8_t *dst, DCTELEM block[16], int stride) 77 static void vp8_idct_add_c(uint8_t *dst, DCTELEM block[16], int stride)
478 dsp->put_vp8_bilinear_pixels_tab[IDX][2][2] = put_vp8_bilinear ## SIZE ## _hv_c 490 dsp->put_vp8_bilinear_pixels_tab[IDX][2][2] = put_vp8_bilinear ## SIZE ## _hv_c
479 491
480 av_cold void ff_vp8dsp_init(VP8DSPContext *dsp) 492 av_cold void ff_vp8dsp_init(VP8DSPContext *dsp)
481 { 493 {
482 dsp->vp8_luma_dc_wht = vp8_luma_dc_wht_c; 494 dsp->vp8_luma_dc_wht = vp8_luma_dc_wht_c;
495 dsp->vp8_luma_dc_wht_dc = vp8_luma_dc_wht_dc_c;
483 dsp->vp8_idct_add = vp8_idct_add_c; 496 dsp->vp8_idct_add = vp8_idct_add_c;
484 dsp->vp8_idct_dc_add = vp8_idct_dc_add_c; 497 dsp->vp8_idct_dc_add = vp8_idct_dc_add_c;
485 dsp->vp8_idct_dc_add4y = vp8_idct_dc_add4y_c; 498 dsp->vp8_idct_dc_add4y = vp8_idct_dc_add4y_c;
486 dsp->vp8_idct_dc_add4uv = vp8_idct_dc_add4uv_c; 499 dsp->vp8_idct_dc_add4uv = vp8_idct_dc_add4uv_c;
487 500