| @@ -389,6 +389,13 @@ typedef struct H264SliceContext { | |||
| DECLARE_ALIGNED(8, int8_t, ref_cache)[2][5 * 8]; | |||
| DECLARE_ALIGNED(8, uint16_t, sub_mb_type)[4]; | |||
| ///< as a dct coeffecient is int32_t in high depth, we need to reserve twice the space. | |||
| DECLARE_ALIGNED(16, int16_t, mb)[16 * 48 * 2]; | |||
| DECLARE_ALIGNED(16, int16_t, mb_luma_dc)[3][16 * 2]; | |||
| ///< as mb is addressed by scantable[i] and scantable is uint8_t we can either | |||
| ///< check that i is not too large or ensure that there is some unused stuff after mb | |||
| int16_t mb_padding[256 * 2]; | |||
| } H264SliceContext; | |||
| /** | |||
| @@ -469,10 +476,6 @@ typedef struct H264Context { | |||
| GetBitContext *intra_gb_ptr; | |||
| GetBitContext *inter_gb_ptr; | |||
| DECLARE_ALIGNED(16, int16_t, mb)[16 * 48 * 2]; ///< as a dct coeffecient is int32_t in high depth, we need to reserve twice the space. | |||
| DECLARE_ALIGNED(16, int16_t, mb_luma_dc)[3][16 * 2]; | |||
| int16_t mb_padding[256 * 2]; ///< as mb is addressed by scantable[i] and scantable is uint8_t we can either check that i is not too large or ensure that there is some unused stuff after mb | |||
| /** | |||
| * Cabac | |||
| */ | |||
| @@ -1857,17 +1857,17 @@ static av_always_inline void decode_cabac_luma_residual(H264Context *h, H264Slic | |||
| int i8x8, i4x4; | |||
| int qscale = p == 0 ? sl->qscale : sl->chroma_qp[p - 1]; | |||
| if( IS_INTRA16x16( mb_type ) ) { | |||
| AV_ZERO128(h->mb_luma_dc[p]+0); | |||
| AV_ZERO128(h->mb_luma_dc[p]+8); | |||
| AV_ZERO128(h->mb_luma_dc[p]+16); | |||
| AV_ZERO128(h->mb_luma_dc[p]+24); | |||
| decode_cabac_residual_dc(h, sl, h->mb_luma_dc[p], ctx_cat[0][p], LUMA_DC_BLOCK_INDEX+p, scan, 16); | |||
| AV_ZERO128(sl->mb_luma_dc[p]+0); | |||
| AV_ZERO128(sl->mb_luma_dc[p]+8); | |||
| AV_ZERO128(sl->mb_luma_dc[p]+16); | |||
| AV_ZERO128(sl->mb_luma_dc[p]+24); | |||
| decode_cabac_residual_dc(h, sl, sl->mb_luma_dc[p], ctx_cat[0][p], LUMA_DC_BLOCK_INDEX+p, scan, 16); | |||
| if( cbp&15 ) { | |||
| qmul = h->dequant4_coeff[p][qscale]; | |||
| for( i4x4 = 0; i4x4 < 16; i4x4++ ) { | |||
| const int index = 16*p + i4x4; | |||
| decode_cabac_residual_nondc(h, sl, h->mb + (16*index << pixel_shift), ctx_cat[1][p], index, scan + 1, qmul, 15); | |||
| decode_cabac_residual_nondc(h, sl, sl->mb + (16*index << pixel_shift), ctx_cat[1][p], index, scan + 1, qmul, 15); | |||
| } | |||
| } else { | |||
| fill_rectangle(&sl->non_zero_count_cache[scan8[16*p]], 4, 4, 8, 0, 1); | |||
| @@ -1878,14 +1878,14 @@ static av_always_inline void decode_cabac_luma_residual(H264Context *h, H264Slic | |||
| if( cbp & (1<<i8x8) ) { | |||
| if( IS_8x8DCT(mb_type) ) { | |||
| const int index = 16*p + 4*i8x8; | |||
| decode_cabac_residual_nondc(h, sl, h->mb + (16*index << pixel_shift), ctx_cat[3][p], index, | |||
| decode_cabac_residual_nondc(h, sl, sl->mb + (16*index << pixel_shift), ctx_cat[3][p], index, | |||
| scan8x8, h->dequant8_coeff[cqm][qscale], 64); | |||
| } else { | |||
| qmul = h->dequant4_coeff[cqm][qscale]; | |||
| for( i4x4 = 0; i4x4 < 4; i4x4++ ) { | |||
| const int index = 16*p + 4*i8x8 + i4x4; | |||
| //START_TIMER | |||
| decode_cabac_residual_nondc(h, sl, h->mb + (16*index << pixel_shift), ctx_cat[2][p], index, scan, qmul, 16); | |||
| decode_cabac_residual_nondc(h, sl, sl->mb + (16*index << pixel_shift), ctx_cat[2][p], index, scan, qmul, 16); | |||
| //STOP_TIMER("decode_residual") | |||
| } | |||
| } | |||
| @@ -2389,7 +2389,7 @@ decode_intra_mb: | |||
| if( cbp&0x30 ){ | |||
| int c; | |||
| for (c = 0; c < 2; c++) | |||
| decode_cabac_residual_dc_422(h, sl, h->mb + ((256 + 16*16*c) << pixel_shift), 3, | |||
| decode_cabac_residual_dc_422(h, sl, sl->mb + ((256 + 16*16*c) << pixel_shift), 3, | |||
| CHROMA_DC_BLOCK_INDEX + c, | |||
| chroma422_dc_scan, 8); | |||
| } | |||
| @@ -2397,7 +2397,7 @@ decode_intra_mb: | |||
| if( cbp&0x20 ) { | |||
| int c, i, i8x8; | |||
| for( c = 0; c < 2; c++ ) { | |||
| int16_t *mb = h->mb + (16*(16 + 16*c) << pixel_shift); | |||
| int16_t *mb = sl->mb + (16*(16 + 16*c) << pixel_shift); | |||
| qmul = h->dequant4_coeff[c+1+(IS_INTRA( mb_type ) ? 0:3)][sl->chroma_qp[c]]; | |||
| for (i8x8 = 0; i8x8 < 2; i8x8++) { | |||
| for (i = 0; i < 4; i++) { | |||
| @@ -2415,7 +2415,7 @@ decode_intra_mb: | |||
| if( cbp&0x30 ){ | |||
| int c; | |||
| for (c = 0; c < 2; c++) | |||
| decode_cabac_residual_dc(h, sl, h->mb + ((256 + 16*16*c) << pixel_shift), 3, CHROMA_DC_BLOCK_INDEX+c, chroma_dc_scan, 4); | |||
| decode_cabac_residual_dc(h, sl, sl->mb + ((256 + 16*16*c) << pixel_shift), 3, CHROMA_DC_BLOCK_INDEX+c, chroma_dc_scan, 4); | |||
| } | |||
| if( cbp&0x20 ) { | |||
| @@ -2424,7 +2424,7 @@ decode_intra_mb: | |||
| qmul = h->dequant4_coeff[c+1+(IS_INTRA( mb_type ) ? 0:3)][sl->chroma_qp[c]]; | |||
| for( i = 0; i < 4; i++ ) { | |||
| const int index = 16 + 16 * c + i; | |||
| decode_cabac_residual_nondc(h, sl, h->mb + (16*index << pixel_shift), 4, index, scan + 1, qmul, 15); | |||
| decode_cabac_residual_nondc(h, sl, sl->mb + (16*index << pixel_shift), 4, index, scan + 1, qmul, 15); | |||
| } | |||
| } | |||
| } else { | |||
| @@ -632,11 +632,11 @@ static av_always_inline int decode_luma_residual(H264Context *h, H264SliceContex | |||
| int i4x4, i8x8; | |||
| int qscale = p == 0 ? sl->qscale : sl->chroma_qp[p - 1]; | |||
| if(IS_INTRA16x16(mb_type)){ | |||
| AV_ZERO128(h->mb_luma_dc[p]+0); | |||
| AV_ZERO128(h->mb_luma_dc[p]+8); | |||
| AV_ZERO128(h->mb_luma_dc[p]+16); | |||
| AV_ZERO128(h->mb_luma_dc[p]+24); | |||
| if( decode_residual(h, sl, h->intra_gb_ptr, h->mb_luma_dc[p], LUMA_DC_BLOCK_INDEX+p, scan, NULL, 16) < 0){ | |||
| AV_ZERO128(sl->mb_luma_dc[p]+0); | |||
| AV_ZERO128(sl->mb_luma_dc[p]+8); | |||
| AV_ZERO128(sl->mb_luma_dc[p]+16); | |||
| AV_ZERO128(sl->mb_luma_dc[p]+24); | |||
| if( decode_residual(h, sl, h->intra_gb_ptr, sl->mb_luma_dc[p], LUMA_DC_BLOCK_INDEX+p, scan, NULL, 16) < 0){ | |||
| return -1; //FIXME continue if partitioned and other return -1 too | |||
| } | |||
| @@ -646,7 +646,7 @@ static av_always_inline int decode_luma_residual(H264Context *h, H264SliceContex | |||
| for(i8x8=0; i8x8<4; i8x8++){ | |||
| for(i4x4=0; i4x4<4; i4x4++){ | |||
| const int index= i4x4 + 4*i8x8 + p*16; | |||
| if( decode_residual(h, sl, h->intra_gb_ptr, h->mb + (16*index << pixel_shift), | |||
| if( decode_residual(h, sl, h->intra_gb_ptr, sl->mb + (16*index << pixel_shift), | |||
| index, scan + 1, h->dequant4_coeff[p][qscale], 15) < 0 ){ | |||
| return -1; | |||
| } | |||
| @@ -664,7 +664,7 @@ static av_always_inline int decode_luma_residual(H264Context *h, H264SliceContex | |||
| for(i8x8=0; i8x8<4; i8x8++){ | |||
| if(cbp & (1<<i8x8)){ | |||
| if(IS_8x8DCT(mb_type)){ | |||
| int16_t *buf = &h->mb[64*i8x8+256*p << pixel_shift]; | |||
| int16_t *buf = &sl->mb[64*i8x8+256*p << pixel_shift]; | |||
| uint8_t *nnz; | |||
| for(i4x4=0; i4x4<4; i4x4++){ | |||
| const int index= i4x4 + 4*i8x8 + p*16; | |||
| @@ -678,7 +678,7 @@ static av_always_inline int decode_luma_residual(H264Context *h, H264SliceContex | |||
| }else{ | |||
| for(i4x4=0; i4x4<4; i4x4++){ | |||
| const int index= i4x4 + 4*i8x8 + p*16; | |||
| if( decode_residual(h, sl, gb, h->mb + (16*index << pixel_shift), index, | |||
| if( decode_residual(h, sl, gb, sl->mb + (16*index << pixel_shift), index, | |||
| scan, h->dequant4_coeff[cqm][qscale], 16) < 0 ){ | |||
| return -1; | |||
| } | |||
| @@ -1125,7 +1125,7 @@ decode_intra_mb: | |||
| } else if (CHROMA422(h)) { | |||
| if(cbp&0x30){ | |||
| for(chroma_idx=0; chroma_idx<2; chroma_idx++) | |||
| if (decode_residual(h, sl, gb, h->mb + ((256 + 16*16*chroma_idx) << pixel_shift), | |||
| if (decode_residual(h, sl, gb, sl->mb + ((256 + 16*16*chroma_idx) << pixel_shift), | |||
| CHROMA_DC_BLOCK_INDEX+chroma_idx, chroma422_dc_scan, | |||
| NULL, 8) < 0) { | |||
| return -1; | |||
| @@ -1135,7 +1135,7 @@ decode_intra_mb: | |||
| if(cbp&0x20){ | |||
| for(chroma_idx=0; chroma_idx<2; chroma_idx++){ | |||
| const uint32_t *qmul = h->dequant4_coeff[chroma_idx+1+(IS_INTRA( mb_type ) ? 0:3)][sl->chroma_qp[chroma_idx]]; | |||
| int16_t *mb = h->mb + (16*(16 + 16*chroma_idx) << pixel_shift); | |||
| int16_t *mb = sl->mb + (16*(16 + 16*chroma_idx) << pixel_shift); | |||
| for (i8x8 = 0; i8x8 < 2; i8x8++) { | |||
| for (i4x4 = 0; i4x4 < 4; i4x4++) { | |||
| const int index = 16 + 16*chroma_idx + 8*i8x8 + i4x4; | |||
| @@ -1152,7 +1152,7 @@ decode_intra_mb: | |||
| } else /* yuv420 */ { | |||
| if(cbp&0x30){ | |||
| for(chroma_idx=0; chroma_idx<2; chroma_idx++) | |||
| if( decode_residual(h, sl, gb, h->mb + ((256 + 16*16*chroma_idx) << pixel_shift), CHROMA_DC_BLOCK_INDEX+chroma_idx, chroma_dc_scan, NULL, 4) < 0){ | |||
| if( decode_residual(h, sl, gb, sl->mb + ((256 + 16*16*chroma_idx) << pixel_shift), CHROMA_DC_BLOCK_INDEX+chroma_idx, chroma_dc_scan, NULL, 4) < 0){ | |||
| return -1; | |||
| } | |||
| } | |||
| @@ -1162,7 +1162,7 @@ decode_intra_mb: | |||
| const uint32_t *qmul = h->dequant4_coeff[chroma_idx+1+(IS_INTRA( mb_type ) ? 0:3)][sl->chroma_qp[chroma_idx]]; | |||
| for(i4x4=0; i4x4<4; i4x4++){ | |||
| const int index= 16 + 16*chroma_idx + i4x4; | |||
| if( decode_residual(h, sl, gb, h->mb + (16*index << pixel_shift), index, scan + 1, qmul, 15) < 0){ | |||
| if( decode_residual(h, sl, gb, sl->mb + (16*index << pixel_shift), index, scan + 1, qmul, 15) < 0){ | |||
| return -1; | |||
| } | |||
| } | |||
| @@ -638,16 +638,16 @@ static av_always_inline void hl_decode_mb_predict_luma(H264Context *h, | |||
| uint8_t *const ptr = dest_y + block_offset[i]; | |||
| const int dir = sl->intra4x4_pred_mode_cache[scan8[i]]; | |||
| if (transform_bypass && h->sps.profile_idc == 244 && dir <= 1) { | |||
| h->hpc.pred8x8l_add[dir](ptr, h->mb + (i * 16 + p * 256 << pixel_shift), linesize); | |||
| h->hpc.pred8x8l_add[dir](ptr, sl->mb + (i * 16 + p * 256 << pixel_shift), linesize); | |||
| } else { | |||
| const int nnz = sl->non_zero_count_cache[scan8[i + p * 16]]; | |||
| h->hpc.pred8x8l[dir](ptr, (sl->topleft_samples_available << i) & 0x8000, | |||
| (sl->topright_samples_available << i) & 0x4000, linesize); | |||
| if (nnz) { | |||
| if (nnz == 1 && dctcoef_get(h->mb, pixel_shift, i * 16 + p * 256)) | |||
| idct_dc_add(ptr, h->mb + (i * 16 + p * 256 << pixel_shift), linesize); | |||
| if (nnz == 1 && dctcoef_get(sl->mb, pixel_shift, i * 16 + p * 256)) | |||
| idct_dc_add(ptr, sl->mb + (i * 16 + p * 256 << pixel_shift), linesize); | |||
| else | |||
| idct_add(ptr, h->mb + (i * 16 + p * 256 << pixel_shift), linesize); | |||
| idct_add(ptr, sl->mb + (i * 16 + p * 256 << pixel_shift), linesize); | |||
| } | |||
| } | |||
| } | |||
| @@ -664,7 +664,7 @@ static av_always_inline void hl_decode_mb_predict_luma(H264Context *h, | |||
| const int dir = sl->intra4x4_pred_mode_cache[scan8[i]]; | |||
| if (transform_bypass && h->sps.profile_idc == 244 && dir <= 1) { | |||
| h->hpc.pred4x4_add[dir](ptr, h->mb + (i * 16 + p * 256 << pixel_shift), linesize); | |||
| h->hpc.pred4x4_add[dir](ptr, sl->mb + (i * 16 + p * 256 << pixel_shift), linesize); | |||
| } else { | |||
| uint8_t *topright; | |||
| int nnz, tr; | |||
| @@ -689,12 +689,12 @@ static av_always_inline void hl_decode_mb_predict_luma(H264Context *h, | |||
| nnz = sl->non_zero_count_cache[scan8[i + p * 16]]; | |||
| if (nnz) { | |||
| if (is_h264) { | |||
| if (nnz == 1 && dctcoef_get(h->mb, pixel_shift, i * 16 + p * 256)) | |||
| idct_dc_add(ptr, h->mb + (i * 16 + p * 256 << pixel_shift), linesize); | |||
| if (nnz == 1 && dctcoef_get(sl->mb, pixel_shift, i * 16 + p * 256)) | |||
| idct_dc_add(ptr, sl->mb + (i * 16 + p * 256 << pixel_shift), linesize); | |||
| else | |||
| idct_add(ptr, h->mb + (i * 16 + p * 256 << pixel_shift), linesize); | |||
| idct_add(ptr, sl->mb + (i * 16 + p * 256 << pixel_shift), linesize); | |||
| } else if (CONFIG_SVQ3_DECODER) | |||
| ff_svq3_add_idct_c(ptr, h->mb + i * 16 + p * 256, linesize, qscale, 0); | |||
| ff_svq3_add_idct_c(ptr, sl->mb + i * 16 + p * 256, linesize, qscale, 0); | |||
| } | |||
| } | |||
| } | |||
| @@ -704,8 +704,8 @@ static av_always_inline void hl_decode_mb_predict_luma(H264Context *h, | |||
| if (is_h264) { | |||
| if (sl->non_zero_count_cache[scan8[LUMA_DC_BLOCK_INDEX + p]]) { | |||
| if (!transform_bypass) | |||
| h->h264dsp.h264_luma_dc_dequant_idct(h->mb + (p * 256 << pixel_shift), | |||
| h->mb_luma_dc[p], | |||
| h->h264dsp.h264_luma_dc_dequant_idct(sl->mb + (p * 256 << pixel_shift), | |||
| sl->mb_luma_dc[p], | |||
| h->dequant4_coeff[p][qscale][0]); | |||
| else { | |||
| static const uint8_t dc_mapping[16] = { | |||
| @@ -715,15 +715,15 @@ static av_always_inline void hl_decode_mb_predict_luma(H264Context *h, | |||
| 10 * 16, 11 * 16, 14 * 16, 15 * 16 | |||
| }; | |||
| for (i = 0; i < 16; i++) | |||
| dctcoef_set(h->mb + (p * 256 << pixel_shift), | |||
| dctcoef_set(sl->mb + (p * 256 << pixel_shift), | |||
| pixel_shift, dc_mapping[i], | |||
| dctcoef_get(h->mb_luma_dc[p], | |||
| dctcoef_get(sl->mb_luma_dc[p], | |||
| pixel_shift, i)); | |||
| } | |||
| } | |||
| } else if (CONFIG_SVQ3_DECODER) | |||
| ff_svq3_luma_dc_dequant_idct_c(h->mb + p * 256, | |||
| h->mb_luma_dc[p], qscale); | |||
| ff_svq3_luma_dc_dequant_idct_c(sl->mb + p * 256, | |||
| sl->mb_luma_dc[p], qscale); | |||
| } | |||
| } | |||
| @@ -747,19 +747,19 @@ static av_always_inline void hl_decode_mb_idct_luma(H264Context *h, H264SliceCon | |||
| (sl->intra16x16_pred_mode == VERT_PRED8x8 || | |||
| sl->intra16x16_pred_mode == HOR_PRED8x8)) { | |||
| h->hpc.pred16x16_add[sl->intra16x16_pred_mode](dest_y, block_offset, | |||
| h->mb + (p * 256 << pixel_shift), | |||
| sl->mb + (p * 256 << pixel_shift), | |||
| linesize); | |||
| } else { | |||
| for (i = 0; i < 16; i++) | |||
| if (sl->non_zero_count_cache[scan8[i + p * 16]] || | |||
| dctcoef_get(h->mb, pixel_shift, i * 16 + p * 256)) | |||
| dctcoef_get(sl->mb, pixel_shift, i * 16 + p * 256)) | |||
| h->h264dsp.h264_add_pixels4_clear(dest_y + block_offset[i], | |||
| h->mb + (i * 16 + p * 256 << pixel_shift), | |||
| sl->mb + (i * 16 + p * 256 << pixel_shift), | |||
| linesize); | |||
| } | |||
| } else { | |||
| h->h264dsp.h264_idct_add16intra(dest_y, block_offset, | |||
| h->mb + (p * 256 << pixel_shift), | |||
| sl->mb + (p * 256 << pixel_shift), | |||
| linesize, | |||
| sl->non_zero_count_cache + p * 5 * 8); | |||
| } | |||
| @@ -771,27 +771,27 @@ static av_always_inline void hl_decode_mb_idct_luma(H264Context *h, H264SliceCon | |||
| for (i = 0; i < 16; i += di) | |||
| if (sl->non_zero_count_cache[scan8[i + p * 16]]) | |||
| idct_add(dest_y + block_offset[i], | |||
| h->mb + (i * 16 + p * 256 << pixel_shift), | |||
| sl->mb + (i * 16 + p * 256 << pixel_shift), | |||
| linesize); | |||
| } else { | |||
| if (IS_8x8DCT(mb_type)) | |||
| h->h264dsp.h264_idct8_add4(dest_y, block_offset, | |||
| h->mb + (p * 256 << pixel_shift), | |||
| sl->mb + (p * 256 << pixel_shift), | |||
| linesize, | |||
| sl->non_zero_count_cache + p * 5 * 8); | |||
| else | |||
| h->h264dsp.h264_idct_add16(dest_y, block_offset, | |||
| h->mb + (p * 256 << pixel_shift), | |||
| sl->mb + (p * 256 << pixel_shift), | |||
| linesize, | |||
| sl->non_zero_count_cache + p * 5 * 8); | |||
| } | |||
| } | |||
| } else if (CONFIG_SVQ3_DECODER) { | |||
| for (i = 0; i < 16; i++) | |||
| if (sl->non_zero_count_cache[scan8[i + p * 16]] || h->mb[i * 16 + p * 256]) { | |||
| if (sl->non_zero_count_cache[scan8[i + p * 16]] || sl->mb[i * 16 + p * 256]) { | |||
| // FIXME benchmark weird rule, & below | |||
| uint8_t *const ptr = dest_y + block_offset[i]; | |||
| ff_svq3_add_idct_c(ptr, h->mb + i * 16 + p * 256, linesize, | |||
| ff_svq3_add_idct_c(ptr, sl->mb + i * 16 + p * 256, linesize, | |||
| sl->qscale, IS_INTRA(mb_type) ? 1 : 0); | |||
| } | |||
| } | |||
| @@ -202,27 +202,27 @@ static av_noinline void FUNC(hl_decode_mb)(H264Context *h, H264SliceContext *sl) | |||
| sl->chroma_pred_mode == HOR_PRED8x8)) { | |||
| h->hpc.pred8x8_add[sl->chroma_pred_mode](dest[0], | |||
| block_offset + 16, | |||
| h->mb + (16 * 16 * 1 << PIXEL_SHIFT), | |||
| sl->mb + (16 * 16 * 1 << PIXEL_SHIFT), | |||
| uvlinesize); | |||
| h->hpc.pred8x8_add[sl->chroma_pred_mode](dest[1], | |||
| block_offset + 32, | |||
| h->mb + (16 * 16 * 2 << PIXEL_SHIFT), | |||
| sl->mb + (16 * 16 * 2 << PIXEL_SHIFT), | |||
| uvlinesize); | |||
| } else { | |||
| idct_add = h->h264dsp.h264_add_pixels4_clear; | |||
| for (j = 1; j < 3; j++) { | |||
| for (i = j * 16; i < j * 16 + 4; i++) | |||
| if (sl->non_zero_count_cache[scan8[i]] || | |||
| dctcoef_get(h->mb, PIXEL_SHIFT, i * 16)) | |||
| dctcoef_get(sl->mb, PIXEL_SHIFT, i * 16)) | |||
| idct_add(dest[j - 1] + block_offset[i], | |||
| h->mb + (i * 16 << PIXEL_SHIFT), | |||
| sl->mb + (i * 16 << PIXEL_SHIFT), | |||
| uvlinesize); | |||
| if (chroma422) { | |||
| for (i = j * 16 + 4; i < j * 16 + 8; i++) | |||
| if (sl->non_zero_count_cache[scan8[i + 4]] || | |||
| dctcoef_get(h->mb, PIXEL_SHIFT, i * 16)) | |||
| dctcoef_get(sl->mb, PIXEL_SHIFT, i * 16)) | |||
| idct_add(dest[j - 1] + block_offset[i + 4], | |||
| h->mb + (i * 16 << PIXEL_SHIFT), | |||
| sl->mb + (i * 16 << PIXEL_SHIFT), | |||
| uvlinesize); | |||
| } | |||
| } | |||
| @@ -238,24 +238,24 @@ static av_noinline void FUNC(hl_decode_mb)(H264Context *h, H264SliceContext *sl) | |||
| qp[1] = sl->chroma_qp[1]; | |||
| } | |||
| if (sl->non_zero_count_cache[scan8[CHROMA_DC_BLOCK_INDEX + 0]]) | |||
| h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + (16 * 16 * 1 << PIXEL_SHIFT), | |||
| h->h264dsp.h264_chroma_dc_dequant_idct(sl->mb + (16 * 16 * 1 << PIXEL_SHIFT), | |||
| h->dequant4_coeff[IS_INTRA(mb_type) ? 1 : 4][qp[0]][0]); | |||
| if (sl->non_zero_count_cache[scan8[CHROMA_DC_BLOCK_INDEX + 1]]) | |||
| h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + (16 * 16 * 2 << PIXEL_SHIFT), | |||
| h->h264dsp.h264_chroma_dc_dequant_idct(sl->mb + (16 * 16 * 2 << PIXEL_SHIFT), | |||
| h->dequant4_coeff[IS_INTRA(mb_type) ? 2 : 5][qp[1]][0]); | |||
| h->h264dsp.h264_idct_add8(dest, block_offset, | |||
| h->mb, uvlinesize, | |||
| sl->mb, uvlinesize, | |||
| sl->non_zero_count_cache); | |||
| } else if (CONFIG_SVQ3_DECODER) { | |||
| h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + 16 * 16 * 1, | |||
| h->h264dsp.h264_chroma_dc_dequant_idct(sl->mb + 16 * 16 * 1, | |||
| h->dequant4_coeff[IS_INTRA(mb_type) ? 1 : 4][sl->chroma_qp[0]][0]); | |||
| h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + 16 * 16 * 2, | |||
| h->h264dsp.h264_chroma_dc_dequant_idct(sl->mb + 16 * 16 * 2, | |||
| h->dequant4_coeff[IS_INTRA(mb_type) ? 2 : 5][sl->chroma_qp[1]][0]); | |||
| for (j = 1; j < 3; j++) { | |||
| for (i = j * 16; i < j * 16 + 4; i++) | |||
| if (sl->non_zero_count_cache[scan8[i]] || h->mb[i * 16]) { | |||
| if (sl->non_zero_count_cache[scan8[i]] || sl->mb[i * 16]) { | |||
| uint8_t *const ptr = dest[j - 1] + block_offset[i]; | |||
| ff_svq3_add_idct_c(ptr, h->mb + i * 16, | |||
| ff_svq3_add_idct_c(ptr, sl->mb + i * 16, | |||
| uvlinesize, | |||
| ff_h264_chroma_qp[0][sl->qscale + 12] - 12, 2); | |||
| } | |||
| @@ -498,9 +498,6 @@ int ff_h264_update_thread_context(AVCodecContext *dst, | |||
| memset(h->sps_buffers, 0, sizeof(h->sps_buffers)); | |||
| memset(h->pps_buffers, 0, sizeof(h->pps_buffers)); | |||
| memset(&h->er, 0, sizeof(h->er)); | |||
| memset(&h->mb, 0, sizeof(h->mb)); | |||
| memset(&h->mb_luma_dc, 0, sizeof(h->mb_luma_dc)); | |||
| memset(&h->mb_padding, 0, sizeof(h->mb_padding)); | |||
| h->context_initialized = 0; | |||
| memset(&h->cur_pic, 0, sizeof(h->cur_pic)); | |||
| @@ -509,6 +506,10 @@ int ff_h264_update_thread_context(AVCodecContext *dst, | |||
| h->slice_ctx = orig_slice_ctx; | |||
| memset(&h->slice_ctx[0].mb, 0, sizeof(h->slice_ctx[0].mb)); | |||
| memset(&h->slice_ctx[0].mb_luma_dc, 0, sizeof(h->slice_ctx[0].mb_luma_dc)); | |||
| memset(&h->slice_ctx[0].mb_padding, 0, sizeof(h->slice_ctx[0].mb_padding)); | |||
| h->avctx = dst; | |||
| h->DPB = NULL; | |||
| h->qscale_table_pool = NULL; | |||
| @@ -707,9 +707,9 @@ static int svq3_decode_mb(SVQ3Context *s, unsigned int mb_type) | |||
| } | |||
| } | |||
| if (IS_INTRA16x16(mb_type)) { | |||
| AV_ZERO128(h->mb_luma_dc[0] + 0); | |||
| AV_ZERO128(h->mb_luma_dc[0] + 8); | |||
| if (svq3_decode_block(&h->gb, h->mb_luma_dc[0], 0, 1)) { | |||
| AV_ZERO128(sl->mb_luma_dc[0] + 0); | |||
| AV_ZERO128(sl->mb_luma_dc[0] + 8); | |||
| if (svq3_decode_block(&h->gb, sl->mb_luma_dc[0], 0, 1)) { | |||
| av_log(h->avctx, AV_LOG_ERROR, | |||
| "error while decoding intra luma dc\n"); | |||
| return -1; | |||
| @@ -728,7 +728,7 @@ static int svq3_decode_mb(SVQ3Context *s, unsigned int mb_type) | |||
| : (4 * i + j); | |||
| sl->non_zero_count_cache[scan8[k]] = 1; | |||
| if (svq3_decode_block(&h->gb, &h->mb[16 * k], index, type)) { | |||
| if (svq3_decode_block(&h->gb, &sl->mb[16 * k], index, type)) { | |||
| av_log(h->avctx, AV_LOG_ERROR, | |||
| "error while decoding block\n"); | |||
| return -1; | |||
| @@ -738,7 +738,7 @@ static int svq3_decode_mb(SVQ3Context *s, unsigned int mb_type) | |||
| if ((cbp & 0x30)) { | |||
| for (i = 1; i < 3; ++i) | |||
| if (svq3_decode_block(&h->gb, &h->mb[16 * 16 * i], 0, 3)) { | |||
| if (svq3_decode_block(&h->gb, &sl->mb[16 * 16 * i], 0, 3)) { | |||
| av_log(h->avctx, AV_LOG_ERROR, | |||
| "error while decoding chroma dc block\n"); | |||
| return -1; | |||
| @@ -750,7 +750,7 @@ static int svq3_decode_mb(SVQ3Context *s, unsigned int mb_type) | |||
| k = 16 * i + j; | |||
| sl->non_zero_count_cache[scan8[k]] = 1; | |||
| if (svq3_decode_block(&h->gb, &h->mb[16 * k], 1, 1)) { | |||
| if (svq3_decode_block(&h->gb, &sl->mb[16 * k], 1, 1)) { | |||
| av_log(h->avctx, AV_LOG_ERROR, | |||
| "error while decoding chroma ac block\n"); | |||
| return -1; | |||