summaryrefslogtreecommitdiff
path: root/libavcodec/h264.c
diff options
context:
space:
mode:
authorJason Garrett-Glaser <darkshikari@gmail.com>2011-01-15 01:10:46 +0000
committerJason Garrett-Glaser <darkshikari@gmail.com>2011-01-15 01:10:46 +0000
commit2a1f431d38ea9c05abb215d70c7dc09cdb6888ab (patch)
treec6e5f1d0b7a3fd2eee950dbb915ef27625644232 /libavcodec/h264.c
parent290fabc684244b86d47527008020b0b2eb62f836 (diff)
H.264/SVQ3: make chroma DC work the same way as luma DC
No speed improvement, but necessary for some future stuff. Also opens up the possibility of asm chroma dc idct/dequant. Originally committed as revision 26349 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r--libavcodec/h264.c97
1 files changed, 6 insertions, 91 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 40dc276dd6..d0ee4744c8 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -246,93 +246,6 @@ int ff_h264_decode_rbsp_trailing(H264Context *h, const uint8_t *src){
return 0;
}
-#if 0
-/**
- * DCT transforms the 16 dc values.
- * @param qp quantization parameter ??? FIXME
- */
-static void h264_luma_dc_dct_c(DCTELEM *block/*, int qp*/){
-// const int qmul= dequant_coeff[qp][0];
- int i;
- int temp[16]; //FIXME check if this is a good idea
- static const int x_offset[4]={0, 1*stride, 4* stride, 5*stride};
- static const int y_offset[4]={0, 2*stride, 8* stride, 10*stride};
-
- for(i=0; i<4; i++){
- const int offset= y_offset[i];
- const int z0= block[offset+stride*0] + block[offset+stride*4];
- const int z1= block[offset+stride*0] - block[offset+stride*4];
- const int z2= block[offset+stride*1] - block[offset+stride*5];
- const int z3= block[offset+stride*1] + block[offset+stride*5];
-
- temp[4*i+0]= z0+z3;
- temp[4*i+1]= z1+z2;
- temp[4*i+2]= z1-z2;
- temp[4*i+3]= z0-z3;
- }
-
- for(i=0; i<4; i++){
- const int offset= x_offset[i];
- const int z0= temp[4*0+i] + temp[4*2+i];
- const int z1= temp[4*0+i] - temp[4*2+i];
- const int z2= temp[4*1+i] - temp[4*3+i];
- const int z3= temp[4*1+i] + temp[4*3+i];
-
- block[stride*0 +offset]= (z0 + z3)>>1;
- block[stride*2 +offset]= (z1 + z2)>>1;
- block[stride*8 +offset]= (z1 - z2)>>1;
- block[stride*10+offset]= (z0 - z3)>>1;
- }
-}
-#endif
-
-#undef xStride
-#undef stride
-
-static void chroma_dc_dequant_idct_c(DCTELEM *block, int qmul){
- const int stride= 16*2;
- const int xStride= 16;
- int a,b,c,d,e;
-
- a= block[stride*0 + xStride*0];
- b= block[stride*0 + xStride*1];
- c= block[stride*1 + xStride*0];
- d= block[stride*1 + xStride*1];
-
- e= a-b;
- a= a+b;
- b= c-d;
- c= c+d;
-
- block[stride*0 + xStride*0]= ((a+c)*qmul) >> 7;
- block[stride*0 + xStride*1]= ((e+b)*qmul) >> 7;
- block[stride*1 + xStride*0]= ((a-c)*qmul) >> 7;
- block[stride*1 + xStride*1]= ((e-b)*qmul) >> 7;
-}
-
-#if 0
-static void chroma_dc_dct_c(DCTELEM *block){
- const int stride= 16*2;
- const int xStride= 16;
- int a,b,c,d,e;
-
- a= block[stride*0 + xStride*0];
- b= block[stride*0 + xStride*1];
- c= block[stride*1 + xStride*0];
- d= block[stride*1 + xStride*1];
-
- e= a-b;
- a= a+b;
- b= c-d;
- c= c+d;
-
- block[stride*0 + xStride*0]= (a+c);
- block[stride*0 + xStride*1]= (e+b);
- block[stride*1 + xStride*0]= (a-c);
- block[stride*1 + xStride*1]= (e-b);
-}
-#endif
-
static inline void mc_dir_part(H264Context *h, Picture *pic, int n, int square, int chroma_height, int delta, int list,
uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
int src_x_offset, int src_y_offset,
@@ -1283,17 +1196,19 @@ static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple){
}
}
}else{
+ int chroma_qpu = h->dequant4_coeff[IS_INTRA(mb_type) ? 1:4][h->chroma_qp[0]][0];
+ int chroma_qpv = h->dequant4_coeff[IS_INTRA(mb_type) ? 2:5][h->chroma_qp[1]][0];
if(is_h264){
if(h->non_zero_count_cache[ scan8[CHROMA_DC_BLOCK_INDEX+0] ])
- chroma_dc_dequant_idct_c(h->mb + 16*16 , h->dequant4_coeff[IS_INTRA(mb_type) ? 1:4][h->chroma_qp[0]][0]);
+ h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + 16*16+0*16, &h->mb_chroma_dc[0], chroma_qpu );
if(h->non_zero_count_cache[ scan8[CHROMA_DC_BLOCK_INDEX+1] ])
- chroma_dc_dequant_idct_c(h->mb + 16*16+4*16, h->dequant4_coeff[IS_INTRA(mb_type) ? 2:5][h->chroma_qp[1]][0]);
+ h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + 16*16+4*16, &h->mb_chroma_dc[1], chroma_qpv );
h->h264dsp.h264_idct_add8(dest, block_offset,
h->mb, uvlinesize,
h->non_zero_count_cache);
}else{
- chroma_dc_dequant_idct_c(h->mb + 16*16 , h->dequant4_coeff[IS_INTRA(mb_type) ? 1:4][h->chroma_qp[0]][0]);
- chroma_dc_dequant_idct_c(h->mb + 16*16+4*16, h->dequant4_coeff[IS_INTRA(mb_type) ? 2:5][h->chroma_qp[1]][0]);
+ h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + 16*16+0*16, &h->mb_chroma_dc[0], chroma_qpu );
+ h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + 16*16+4*16, &h->mb_chroma_dc[1], chroma_qpv );
for(i=16; i<16+8; i++){
if(h->non_zero_count_cache[ scan8[i] ] || h->mb[i*16]){
uint8_t * const ptr= dest[(i&4)>>2] + block_offset[i];