Needed for high bit depth h264 decoding.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
| ... | ... |
@@ -64,6 +64,7 @@ void ff_h264_idct_add16intra_c(uint8_t *dst, const int *blockoffset, DCTELEM *bl |
| 64 | 64 |
void ff_h264_idct8_add4_c(uint8_t *dst, const int *blockoffset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]); |
| 65 | 65 |
void ff_h264_idct_add8_c(uint8_t **dest, const int *blockoffset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]); |
| 66 | 66 |
|
| 67 |
+void ff_h264_chroma_dc_dequant_idct_c(DCTELEM *block, int qmul); |
|
| 67 | 68 |
void ff_h264_luma_dc_dequant_idct_c(DCTELEM *output, DCTELEM *input, int qmul); |
| 68 | 69 |
void ff_svq3_luma_dc_dequant_idct_c(DCTELEM *output, DCTELEM *input, int qp); |
| 69 | 70 |
void ff_svq3_add_idct_c(uint8_t *dst, DCTELEM *block, int stride, int qp, int dc); |
| ... | ... |
@@ -428,27 +428,6 @@ static void h264_luma_dc_dct_c(DCTELEM *block/*, int qp*/){
|
| 428 | 428 |
#undef xStride |
| 429 | 429 |
#undef stride |
| 430 | 430 |
|
| 431 |
-static void chroma_dc_dequant_idct_c(DCTELEM *block, int qmul){
|
|
| 432 |
- const int stride= 16*2; |
|
| 433 |
- const int xStride= 16; |
|
| 434 |
- int a,b,c,d,e; |
|
| 435 |
- |
|
| 436 |
- a= block[stride*0 + xStride*0]; |
|
| 437 |
- b= block[stride*0 + xStride*1]; |
|
| 438 |
- c= block[stride*1 + xStride*0]; |
|
| 439 |
- d= block[stride*1 + xStride*1]; |
|
| 440 |
- |
|
| 441 |
- e= a-b; |
|
| 442 |
- a= a+b; |
|
| 443 |
- b= c-d; |
|
| 444 |
- c= c+d; |
|
| 445 |
- |
|
| 446 |
- block[stride*0 + xStride*0]= ((a+c)*qmul) >> 7; |
|
| 447 |
- block[stride*0 + xStride*1]= ((e+b)*qmul) >> 7; |
|
| 448 |
- block[stride*1 + xStride*0]= ((a-c)*qmul) >> 7; |
|
| 449 |
- block[stride*1 + xStride*1]= ((e-b)*qmul) >> 7; |
|
| 450 |
-} |
|
| 451 |
- |
|
| 452 | 431 |
#if 0 |
| 453 | 432 |
static void chroma_dc_dct_c(DCTELEM *block){
|
| 454 | 433 |
const int stride= 16*2; |
| ... | ... |
@@ -1712,17 +1691,17 @@ static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple){
|
| 1712 | 1712 |
}else{
|
| 1713 | 1713 |
if(is_h264){
|
| 1714 | 1714 |
if(h->non_zero_count_cache[ scan8[CHROMA_DC_BLOCK_INDEX+0] ]) |
| 1715 |
- chroma_dc_dequant_idct_c(h->mb + 16*16 , h->dequant4_coeff[IS_INTRA(mb_type) ? 1:4][h->chroma_qp[0]][0]); |
|
| 1715 |
+ h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + 16*16 , h->dequant4_coeff[IS_INTRA(mb_type) ? 1:4][h->chroma_qp[0]][0]); |
|
| 1716 | 1716 |
if(h->non_zero_count_cache[ scan8[CHROMA_DC_BLOCK_INDEX+1] ]) |
| 1717 |
- 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]); |
|
| 1717 |
+ h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + 16*16+4*16, h->dequant4_coeff[IS_INTRA(mb_type) ? 2:5][h->chroma_qp[1]][0]); |
|
| 1718 | 1718 |
h->h264dsp.h264_idct_add8(dest, block_offset, |
| 1719 | 1719 |
h->mb, uvlinesize, |
| 1720 | 1720 |
h->non_zero_count_cache); |
| 1721 | 1721 |
} |
| 1722 | 1722 |
#if CONFIG_SVQ3_DECODER |
| 1723 | 1723 |
else{
|
| 1724 |
- chroma_dc_dequant_idct_c(h->mb + 16*16 , h->dequant4_coeff[IS_INTRA(mb_type) ? 1:4][h->chroma_qp[0]][0]); |
|
| 1725 |
- 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]); |
|
| 1724 |
+ h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + 16*16 , h->dequant4_coeff[IS_INTRA(mb_type) ? 1:4][h->chroma_qp[0]][0]); |
|
| 1725 |
+ h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + 16*16+4*16, h->dequant4_coeff[IS_INTRA(mb_type) ? 2:5][h->chroma_qp[1]][0]); |
|
| 1726 | 1726 |
for(i=16; i<16+8; i++){
|
| 1727 | 1727 |
if(h->non_zero_count_cache[ scan8[i] ] || h->mb[i*16]){
|
| 1728 | 1728 |
uint8_t * const ptr= dest[(i&4)>>2] + block_offset[i]; |
| ... | ... |
@@ -283,6 +283,7 @@ void ff_h264dsp_init(H264DSPContext *c) |
| 283 | 283 |
c->h264_idct_add8 = ff_h264_idct_add8_c; |
| 284 | 284 |
c->h264_idct_add16intra= ff_h264_idct_add16intra_c; |
| 285 | 285 |
c->h264_luma_dc_dequant_idct= ff_h264_luma_dc_dequant_idct_c; |
| 286 |
+ c->h264_chroma_dc_dequant_idct= ff_h264_chroma_dc_dequant_idct_c; |
|
| 286 | 287 |
|
| 287 | 288 |
c->weight_h264_pixels_tab[0]= weight_h264_pixels16x16_c; |
| 288 | 289 |
c->weight_h264_pixels_tab[1]= weight_h264_pixels16x8_c; |
| ... | ... |
@@ -68,6 +68,7 @@ typedef struct H264DSPContext{
|
| 68 | 68 |
void (*h264_idct_add8)(uint8_t **dst/*align 16*/, const int *blockoffset, DCTELEM *block/*align 16*/, int stride, const uint8_t nnzc[6*8]); |
| 69 | 69 |
void (*h264_idct_add16intra)(uint8_t *dst/*align 16*/, const int *blockoffset, DCTELEM *block/*align 16*/, int stride, const uint8_t nnzc[6*8]); |
| 70 | 70 |
void (*h264_luma_dc_dequant_idct)(DCTELEM *output, DCTELEM *input/*align 16*/, int qmul); |
| 71 |
+ void (*h264_chroma_dc_dequant_idct)(DCTELEM *block, int qmul); |
|
| 71 | 72 |
}H264DSPContext; |
| 72 | 73 |
|
| 73 | 74 |
void ff_h264dsp_init(H264DSPContext *c); |
| ... | ... |
@@ -250,4 +250,26 @@ void ff_h264_luma_dc_dequant_idct_c(DCTELEM *output, DCTELEM *input, int qmul){
|
| 250 | 250 |
output[stride* 4+offset]= ((((z1 - z2)*qmul + 128 ) >> 8)); |
| 251 | 251 |
output[stride* 5+offset]= ((((z0 - z3)*qmul + 128 ) >> 8)); |
| 252 | 252 |
} |
| 253 |
+#undef stride |
|
| 254 |
+} |
|
| 255 |
+ |
|
| 256 |
+void ff_h264_chroma_dc_dequant_idct_c(DCTELEM *block, int qmul){
|
|
| 257 |
+ const int stride= 16*2; |
|
| 258 |
+ const int xStride= 16; |
|
| 259 |
+ int a,b,c,d,e; |
|
| 260 |
+ |
|
| 261 |
+ a= block[stride*0 + xStride*0]; |
|
| 262 |
+ b= block[stride*0 + xStride*1]; |
|
| 263 |
+ c= block[stride*1 + xStride*0]; |
|
| 264 |
+ d= block[stride*1 + xStride*1]; |
|
| 265 |
+ |
|
| 266 |
+ e= a-b; |
|
| 267 |
+ a= a+b; |
|
| 268 |
+ b= c-d; |
|
| 269 |
+ c= c+d; |
|
| 270 |
+ |
|
| 271 |
+ block[stride*0 + xStride*0]= ((a+c)*qmul) >> 7; |
|
| 272 |
+ block[stride*0 + xStride*1]= ((e+b)*qmul) >> 7; |
|
| 273 |
+ block[stride*1 + xStride*0]= ((a-c)*qmul) >> 7; |
|
| 274 |
+ block[stride*1 + xStride*1]= ((e-b)*qmul) >> 7; |
|
| 253 | 275 |
} |