diff options
author | Loren Merritt <lorenm@u.washington.edu> | 2005-10-25 01:17:20 +0000 |
---|---|---|
committer | Loren Merritt <lorenm@u.washington.edu> | 2005-10-25 01:17:20 +0000 |
commit | 239ea04ccfa1015c87bdd4f7da1afbb5dba1aa45 (patch) | |
tree | 88d57e11431523d69d2f6c70bac9ab539f6675f7 /libavcodec/h264.c | |
parent | fe9a734c8211bce69b86113d82062641ec5db746 (diff) | |
download | ffmpeg-239ea04ccfa1015c87bdd4f7da1afbb5dba1aa45.tar.gz |
decode custom quant matrices.
based on a patch by anonymous, with optimizations by me.
Originally committed as revision 4660 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r-- | libavcodec/h264.c | 240 |
1 files changed, 162 insertions, 78 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 5897738ac4..d8a7baf91d 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -90,6 +90,9 @@ typedef struct SPS{ short offset_for_ref_frame[256]; //FIXME dyn aloc? int bitstream_restriction_flag; int num_reorder_frames; + int scaling_matrix_present; + uint8_t scaling_matrix4[6][16]; + uint8_t scaling_matrix8[2][64]; }SPS; /** @@ -111,6 +114,8 @@ typedef struct PPS{ int constrained_intra_pred; ///< constrained_intra_pred_flag int redundant_pic_cnt_present; ///< redundant_pic_cnt_present_flag int transform_8x8_mode; ///< transform_8x8_mode_flag + uint8_t scaling_matrix4[6][16]; + uint8_t scaling_matrix8[2][64]; }PPS; /** @@ -237,8 +242,11 @@ typedef struct H264Context{ */ PPS pps; //FIXME move to Picture perhaps? (->no) do we need that? - uint16_t (*dequant4_coeff)[16]; // FIXME quant matrices should be per SPS or PPS - uint16_t (*dequant8_coeff)[64]; + uint32_t dequant4_buffer[6][52][16]; + uint32_t dequant8_buffer[2][52][64]; + uint32_t (*dequant4_coeff[6])[16]; + uint32_t (*dequant8_coeff[2])[64]; + int dequant_coeff_pps; ///< reinit tables when pps changes int slice_num; uint8_t *slice_table_base; @@ -1598,8 +1606,7 @@ static int decode_rbsp_trailing(uint8_t *src){ * idct tranforms the 16 dc values and dequantize them. * @param qp quantization parameter */ -static void h264_luma_dc_dequant_idct_c(DCTELEM *block, int qp){ - const int qmul= dequant_coeff[qp][0]; +static void h264_luma_dc_dequant_idct_c(DCTELEM *block, int qp, int qmul){ #define stride 16 int i; int temp[16]; //FIXME check if this is a good idea @@ -1628,10 +1635,10 @@ static void h264_luma_dc_dequant_idct_c(DCTELEM *block, int qp){ 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)*qmul + 2)>>2; //FIXME think about merging this into decode_resdual - block[stride*2 +offset]= ((z1 + z2)*qmul + 2)>>2; - block[stride*8 +offset]= ((z1 - z2)*qmul + 2)>>2; - block[stride*10+offset]= ((z0 - z3)*qmul + 2)>>2; + block[stride*0 +offset]= ((((z0 + z3)*qmul + 128 ) >> 8)); //FIXME think about merging this into decode_resdual + block[stride*2 +offset]= ((((z1 + z2)*qmul + 128 ) >> 8)); + block[stride*8 +offset]= ((((z1 - z2)*qmul + 128 ) >> 8)); + block[stride*10+offset]= ((((z0 - z3)*qmul + 128 ) >> 8)); } } @@ -1678,8 +1685,7 @@ static void h264_luma_dc_dct_c(DCTELEM *block/*, int qp*/){ #undef xStride #undef stride -static void chroma_dc_dequant_idct_c(DCTELEM *block, int qp){ - const int qmul= dequant_coeff[qp][0]; +static void chroma_dc_dequant_idct_c(DCTELEM *block, int qp, int qmul){ const int stride= 16*2; const int xStride= 16; int a,b,c,d,e; @@ -1694,10 +1700,10 @@ static void chroma_dc_dequant_idct_c(DCTELEM *block, int qp){ b= c-d; c= c+d; - block[stride*0 + xStride*0]= ((a+c)*qmul + 0)>>1; - block[stride*0 + xStride*1]= ((e+b)*qmul + 0)>>1; - block[stride*1 + xStride*0]= ((a-c)*qmul + 0)>>1; - block[stride*1 + xStride*1]= ((e-b)*qmul + 0)>>1; + 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 @@ -2921,12 +2927,70 @@ static void free_tables(H264Context *h){ av_freep(&h->mb2b_xy); av_freep(&h->mb2b8_xy); - av_freep(&h->dequant4_coeff); - av_freep(&h->dequant8_coeff); - av_freep(&h->s.obmc_scratchpad); } +static void init_dequant8_coeff_table(H264Context *h){ + int i,q,x; + h->dequant8_coeff[0] = h->dequant8_buffer[0]; + h->dequant8_coeff[1] = h->dequant8_buffer[1]; + + for(i=0; i<2; i++ ){ + if(i && !memcmp(h->pps.scaling_matrix8[0], h->pps.scaling_matrix8[1], 64*sizeof(uint8_t))){ + h->dequant8_coeff[1] = h->dequant8_buffer[0]; + break; + } + + for(q=0; q<52; q++){ + int shift = div6[q]; + int idx = rem6[q]; + for(x=0; x<64; x++) + h->dequant8_coeff[i][q][x] = ((uint32_t)dequant8_coeff_init[idx][ + dequant8_coeff_init_scan[((x>>1)&12) | (x&3)] ] * h->pps.scaling_matrix8[i][x]) << shift; + } + } +} + +static void init_dequant4_coeff_table(H264Context *h){ + int i,j,q,x; + for(i=0; i<6; i++ ){ + h->dequant4_coeff[i] = h->dequant4_buffer[i]; + for(j=0; j<i; j++){ + if(!memcmp(h->pps.scaling_matrix4[j], h->pps.scaling_matrix4[i], 16*sizeof(uint8_t))){ + h->dequant4_coeff[i] = h->dequant4_buffer[j]; + break; + } + } + if(j<i) + continue; + + for(q=0; q<52; q++){ + int shift = div6[q] + 2; + int idx = rem6[q]; + for(x=0; x<16; x++) + h->dequant4_coeff[i][q][x] = ((uint32_t)dequant4_coeff_init[idx][(x&1) + ((x>>2)&1)] * + h->pps.scaling_matrix4[i][x]) << shift; + } + } +} + +static void init_dequant_tables(H264Context *h){ + int i,x; + init_dequant4_coeff_table(h); + if(h->pps.transform_8x8_mode) + init_dequant8_coeff_table(h); + if(h->sps.transform_bypass){ + for(i=0; i<6; i++) + for(x=0; x<16; x++) + h->dequant4_coeff[i][0][x] = 1<<6; + if(h->pps.transform_8x8_mode) + for(i=0; i<2; i++) + for(x=0; x<64; x++) + h->dequant8_coeff[i][0][x] = 1<<6; + } +} + + /** * allocates tables. * needs width/height @@ -2934,7 +2998,7 @@ static void free_tables(H264Context *h){ static int alloc_tables(H264Context *h){ MpegEncContext * const s = &h->s; const int big_mb_num= s->mb_stride * (s->mb_height+1); - int x,y,q; + int x,y; CHECKED_ALLOCZ(h->intra4x4_pred_mode, big_mb_num * 8 * sizeof(uint8_t)) @@ -2967,25 +3031,6 @@ static int alloc_tables(H264Context *h){ } } - CHECKED_ALLOCZ(h->dequant4_coeff, 52*16 * sizeof(uint16_t)); - CHECKED_ALLOCZ(h->dequant8_coeff, 52*64 * sizeof(uint16_t)); - memcpy(h->dequant4_coeff, dequant_coeff, 52*16 * sizeof(uint16_t)); - for(q=0; q<52; q++){ - int shift = div6[q]; - int idx = rem6[q]; - if(shift >= 2) // qp<12 are shifted during dequant - shift -= 2; - for(x=0; x<64; x++) - h->dequant8_coeff[q][x] = dequant8_coeff_init[idx][ - dequant8_coeff_init_scan[((x>>1)&12) | (x&3)] ] << shift; - } - if(h->sps.transform_bypass){ - for(x=0; x<16; x++) - h->dequant4_coeff[0][x] = 1; - for(x=0; x<64; x++) - h->dequant8_coeff[0][x] = 1<<2; - } - s->obmc_scratchpad = NULL; return 0; @@ -3003,6 +3048,7 @@ static void common_init(H264Context *h){ init_pred_ptrs(h); + h->dequant_coeff_pps= -1; s->unrestricted_mv=1; s->decode=1; //FIXME } @@ -3349,7 +3395,7 @@ static void hl_decode_mb(H264Context *h){ h->pred16x16[ h->intra16x16_pred_mode ](dest_y , linesize); if(s->codec_id == CODEC_ID_H264){ if(!transform_bypass) - h264_luma_dc_dequant_idct_c(h->mb, s->qscale); + h264_luma_dc_dequant_idct_c(h->mb, s->qscale, h->dequant4_coeff[IS_INTRA(mb_type) ? 0:3][s->qscale][0]); }else svq3_luma_dc_dequant_idct_c(h->mb, s->qscale); } @@ -3397,8 +3443,8 @@ static void hl_decode_mb(H264Context *h){ if(!(s->flags&CODEC_FLAG_GRAY)){ idct_add = transform_bypass ? s->dsp.add_pixels4 : s->dsp.h264_idct_add; if(!transform_bypass){ - chroma_dc_dequant_idct_c(h->mb + 16*16, h->chroma_qp); - chroma_dc_dequant_idct_c(h->mb + 16*16+4*16, h->chroma_qp); + chroma_dc_dequant_idct_c(h->mb + 16*16, h->chroma_qp, h->dequant4_coeff[IS_INTRA(mb_type) ? 1:4][h->chroma_qp][0]); + chroma_dc_dequant_idct_c(h->mb + 16*16+4*16, h->chroma_qp, h->dequant4_coeff[IS_INTRA(mb_type) ? 2:5][h->chroma_qp][0]); } if(s->codec_id == CODEC_ID_H264){ for(i=16; i<16+4; i++){ @@ -4178,6 +4224,11 @@ static int decode_slice_header(H264Context *h){ av_log(h->s.avctx, AV_LOG_ERROR, "non existing SPS referenced\n"); return -1; } + + if(h->dequant_coeff_pps != pps_id){ + h->dequant_coeff_pps = pps_id; + init_dequant_tables(h); + } s->mb_width= h->sps.mb_width; s->mb_height= h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag); @@ -4434,7 +4485,7 @@ static inline int get_dct8x8_allowed(H264Context *h){ * @param max_coeff number of coefficients in the block * @return <0 if an error occured */ -static int decode_residual(H264Context *h, GetBitContext *gb, DCTELEM *block, int n, const uint8_t *scantable, const uint16_t *qmul, int max_coeff){ +static int decode_residual(H264Context *h, GetBitContext *gb, DCTELEM *block, int n, const uint8_t *scantable, const uint32_t *qmul, int max_coeff){ MpegEncContext * const s = &h->s; static const int coeff_token_table_index[17]= {0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3}; int level[16]; @@ -4551,7 +4602,7 @@ static int decode_residual(H264Context *h, GetBitContext *gb, DCTELEM *block, in block[j]= level[i]; } }else{ - block[j] = level[0] * qmul[j]; + block[j] = (level[0] * qmul[j] + 32)>>6; for(i=1;i<total_coeff;i++) { if(zeros_left <= 0) run_before = 0; @@ -4564,8 +4615,7 @@ static int decode_residual(H264Context *h, GetBitContext *gb, DCTELEM *block, in coeff_num -= 1 + run_before; j= scantable[ coeff_num ]; - block[j]= level[i] * qmul[j]; -// printf("%d %d ", block[j], qmul[j]); + block[j]= (level[i] * qmul[j] + 32)>>6; } } @@ -5008,7 +5058,7 @@ decode_intra_mb: h->chroma_qp= chroma_qp= get_chroma_qp(h->pps.chroma_qp_index_offset, s->qscale); if(IS_INTRA16x16(mb_type)){ - if( decode_residual(h, h->intra_gb_ptr, h->mb, LUMA_DC_BLOCK_INDEX, dc_scan, h->dequant4_coeff[s->qscale], 16) < 0){ + if( decode_residual(h, h->intra_gb_ptr, h->mb, LUMA_DC_BLOCK_INDEX, dc_scan, h->dequant4_coeff[0][s->qscale], 16) < 0){ return -1; //FIXME continue if partitioned and other return -1 too } @@ -5018,7 +5068,7 @@ decode_intra_mb: for(i8x8=0; i8x8<4; i8x8++){ for(i4x4=0; i4x4<4; i4x4++){ const int index= i4x4 + 4*i8x8; - if( decode_residual(h, h->intra_gb_ptr, h->mb + 16*index, index, scan + 1, h->dequant4_coeff[s->qscale], 15) < 0 ){ + if( decode_residual(h, h->intra_gb_ptr, h->mb + 16*index, index, scan + 1, h->dequant4_coeff[0][s->qscale], 15) < 0 ){ return -1; } } @@ -5034,21 +5084,16 @@ decode_intra_mb: uint8_t *nnz; for(i4x4=0; i4x4<4; i4x4++){ if( decode_residual(h, gb, buf, i4x4+4*i8x8, zigzag_scan8x8_cavlc+16*i4x4, - h->dequant8_coeff[s->qscale], 16) <0 ) + h->dequant8_coeff[IS_INTRA( mb_type ) ? 0:1][s->qscale], 16) <0 ) return -1; } - if(s->qscale < 12){ - int i; - for(i=0; i<64; i++) - buf[i] = (buf[i] + 2) >> 2; - } nnz= &h->non_zero_count_cache[ scan8[4*i8x8] ]; nnz[0] |= nnz[1] | nnz[8] | nnz[9]; }else{ for(i4x4=0; i4x4<4; i4x4++){ const int index= i4x4 + 4*i8x8; - if( decode_residual(h, gb, h->mb + 16*index, index, scan, h->dequant4_coeff[s->qscale], 16) <0 ){ + if( decode_residual(h, gb, h->mb + 16*index, index, scan, h->dequant4_coeff[IS_INTRA( mb_type ) ? 0:3][s->qscale], 16) <0 ){ return -1; } } @@ -5062,7 +5107,7 @@ decode_intra_mb: if(cbp&0x30){ for(chroma_idx=0; chroma_idx<2; chroma_idx++) - if( decode_residual(h, gb, h->mb + 256 + 16*4*chroma_idx, CHROMA_DC_BLOCK_INDEX, chroma_dc_scan, h->dequant4_coeff[chroma_qp], 4) < 0){ + if( decode_residual(h, gb, h->mb + 256 + 16*4*chroma_idx, CHROMA_DC_BLOCK_INDEX, chroma_dc_scan, NULL, 4) < 0){ return -1; } } @@ -5071,7 +5116,7 @@ decode_intra_mb: for(chroma_idx=0; chroma_idx<2; chroma_idx++){ for(i4x4=0; i4x4<4; i4x4++){ const int index= 16 + 4*chroma_idx + i4x4; - if( decode_residual(h, gb, h->mb + 16*index, index, scan + 1, h->dequant4_coeff[chroma_qp], 15) < 0){ + if( decode_residual(h, gb, h->mb + 16*index, index, scan + 1, h->dequant4_coeff[chroma_idx+1+(IS_INTRA( mb_type ) ? 0:3)][chroma_qp], 15) < 0){ return -1; } } @@ -5510,7 +5555,7 @@ static int inline get_cabac_cbf_ctx( H264Context *h, int cat, int idx ) { return ctx + 4 * cat; } -static int inline decode_cabac_residual( H264Context *h, DCTELEM *block, int cat, int n, const uint8_t *scantable, const uint16_t *qmul, int max_coeff) { +static int inline decode_cabac_residual( H264Context *h, DCTELEM *block, int cat, int n, const uint8_t *scantable, const uint32_t *qmul, int max_coeff) { const int mb_xy = h->s.mb_x + h->s.mb_y*h->s.mb_stride; static const int significant_coeff_flag_field_offset[2] = { 105, 277 }; static const int last_significant_coeff_flag_field_offset[2] = { 166, 338 }; @@ -5616,8 +5661,8 @@ static int inline decode_cabac_residual( H264Context *h, DCTELEM *block, int cat if( get_cabac_bypass( &h->cabac ) ) block[j] = -1; else block[j] = 1; }else{ - if( get_cabac_bypass( &h->cabac ) ) block[j] = -qmul[j]; - else block[j] = qmul[j]; + if( get_cabac_bypass( &h->cabac ) ) block[j] = (-qmul[j] + 32) >> 6; + else block[j] = ( qmul[j] + 32) >> 6; } abslevel1++; @@ -5645,8 +5690,8 @@ static int inline decode_cabac_residual( H264Context *h, DCTELEM *block, int cat if( get_cabac_bypass( &h->cabac ) ) block[j] = -coeff_abs; else block[j] = coeff_abs; }else{ - if( get_cabac_bypass( &h->cabac ) ) block[j] = -coeff_abs * qmul[j]; - else block[j] = coeff_abs * qmul[j]; + if( get_cabac_bypass( &h->cabac ) ) block[j] = (-coeff_abs * qmul[j] + 32) >> 6; + else block[j] = ( coeff_abs * qmul[j] + 32) >> 6; } abslevelgt1++; @@ -6078,7 +6123,7 @@ decode_intra_mb: if( cbp&15 ) { for( i = 0; i < 16; i++ ) { //av_log( s->avctx, AV_LOG_ERROR, "INTRA16x16 AC:%d\n", i ); - if( decode_cabac_residual(h, h->mb + 16*i, 1, i, scan + 1, h->dequant4_coeff[s->qscale], 15) < 0 ) + if( decode_cabac_residual(h, h->mb + 16*i, 1, i, scan + 1, h->dequant4_coeff[0][s->qscale], 15) < 0 ) return -1; } } else { @@ -6090,18 +6135,13 @@ decode_intra_mb: if( cbp & (1<<i8x8) ) { if( IS_8x8DCT(mb_type) ) { if( decode_cabac_residual(h, h->mb + 64*i8x8, 5, 4*i8x8, - zigzag_scan8x8, h->dequant8_coeff[s->qscale], 64) < 0 ) + zigzag_scan8x8, h->dequant8_coeff[IS_INTRA( mb_type ) ? 0:1][s->qscale], 64) < 0 ) return -1; - if(s->qscale < 12){ - int i; - for(i=0; i<64; i++) - h->mb[64*i8x8+i] = (h->mb[64*i8x8+i] + 2) >> 2; - } } else for( i4x4 = 0; i4x4 < 4; i4x4++ ) { const int index = 4*i8x8 + i4x4; //av_log( s->avctx, AV_LOG_ERROR, "Luma4x4: %d\n", index ); - if( decode_cabac_residual(h, h->mb + 16*index, 2, index, scan, h->dequant4_coeff[s->qscale], 16) < 0 ) + if( decode_cabac_residual(h, h->mb + 16*index, 2, index, scan, h->dequant4_coeff[IS_INTRA( mb_type ) ? 0:3][s->qscale], 16) < 0 ) return -1; } } else { @@ -6126,7 +6166,7 @@ decode_intra_mb: for( i = 0; i < 4; i++ ) { const int index = 16 + 4 * c + i; //av_log( s->avctx, AV_LOG_ERROR, "INTRA C%d-AC %d\n",c, index - 16 ); - if( decode_cabac_residual(h, h->mb + 16*index, 4, index - 16, scan + 1, h->dequant4_coeff[h->chroma_qp], 15) < 0) + if( decode_cabac_residual(h, h->mb + 16*index, 4, index - 16, scan + 1, h->dequant4_coeff[c+1+(IS_INTRA( mb_type ) ? 0:3)][h->chroma_qp], 15) < 0) return -1; } } @@ -7006,6 +7046,52 @@ static inline int decode_vui_parameters(H264Context *h, SPS *sps){ return 0; } +static void decode_scaling_list(H264Context *h, uint8_t *factors, int size, const uint8_t *default_list){ + MpegEncContext * const s = &h->s; + int i, last = 8, next = 8; + const uint8_t *scan = size == 16 ? zigzag_scan : zigzag_scan8x8; + if(!get_bits1(&s->gb)) /* matrix not written, we use the default one */ + memcpy(factors, default_list, size*sizeof(uint8_t)); + else + for(i=0;i<size;i++){ + if(next) + next = (last + get_se_golomb(&s->gb)) & 0xff; + if(!i && !next){ /* matrix not written, we use the default one */ + memcpy(factors, default_list, size*sizeof(uint8_t)); + break; + } + last = factors[scan[i]] = next ? next : last; + } +} + +static void decode_scaling_matrices(H264Context *h, SPS *sps, PPS *pps, int is_sps, + uint8_t (*scaling_matrix4)[16], uint8_t (*scaling_matrix8)[64]){ + MpegEncContext * const s = &h->s; + int fallback_sps = !is_sps && sps->scaling_matrix_present; + const uint8_t *fallback[4] = { + fallback_sps ? sps->scaling_matrix4[0] : default_scaling4[0], + fallback_sps ? sps->scaling_matrix4[3] : default_scaling4[1], + fallback_sps ? sps->scaling_matrix8[0] : default_scaling8[0], + fallback_sps ? sps->scaling_matrix8[1] : default_scaling8[1] + }; + if(get_bits1(&s->gb)){ + sps->scaling_matrix_present |= is_sps; + decode_scaling_list(h,scaling_matrix4[0],16,fallback[0]); // Intra, Y + decode_scaling_list(h,scaling_matrix4[1],16,scaling_matrix4[0]); // Intra, Cr + decode_scaling_list(h,scaling_matrix4[2],16,scaling_matrix4[1]); // Intra, Cb + decode_scaling_list(h,scaling_matrix4[3],16,fallback[1]); // Inter, Y + decode_scaling_list(h,scaling_matrix4[4],16,scaling_matrix4[3]); // Inter, Cr + decode_scaling_list(h,scaling_matrix4[5],16,scaling_matrix4[4]); // Inter, Cb + if(is_sps || pps->transform_8x8_mode){ + decode_scaling_list(h,scaling_matrix8[0],64,fallback[2]); // Intra, Y + decode_scaling_list(h,scaling_matrix8[1],64,fallback[3]); // Inter, Y + } + } else if(fallback_sps) { + memcpy(scaling_matrix4, sps->scaling_matrix4, 6*16*sizeof(uint8_t)); + memcpy(scaling_matrix8, sps->scaling_matrix8, 2*64*sizeof(uint8_t)); + } +} + static inline int decode_seq_parameter_set(H264Context *h){ MpegEncContext * const s = &h->s; int profile_idc, level_idc; @@ -7031,11 +7117,9 @@ static inline int decode_seq_parameter_set(H264Context *h){ get_ue_golomb(&s->gb); //bit_depth_luma_minus8 get_ue_golomb(&s->gb); //bit_depth_chroma_minus8 sps->transform_bypass = get_bits1(&s->gb); - if(get_bits1(&s->gb)){ //seq_scaling_matrix_present_flag - av_log(h->s.avctx, AV_LOG_ERROR, "custom scaling matrix not implemented\n"); - return -1; - } - } + decode_scaling_matrices(h, sps, NULL, 1, sps->scaling_matrix4, sps->scaling_matrix8); + }else + sps->scaling_matrix_present = 0; sps->log2_max_frame_num= get_ue_golomb(&s->gb) + 4; sps->poc_type= get_ue_golomb(&s->gb); @@ -7172,13 +7256,13 @@ static inline int decode_picture_parameter_set(H264Context *h, int bit_length){ pps->deblocking_filter_parameters_present= get_bits1(&s->gb); pps->constrained_intra_pred= get_bits1(&s->gb); pps->redundant_pic_cnt_present = get_bits1(&s->gb); + + memset(pps->scaling_matrix4, 16, 6*16*sizeof(uint8_t)); + memset(pps->scaling_matrix8, 16, 2*64*sizeof(uint8_t)); if(get_bits_count(&s->gb) < bit_length){ pps->transform_8x8_mode= get_bits1(&s->gb); - if(get_bits1(&s->gb)){ //pic_scaling_matrix_present_flag - av_log(h->s.avctx, AV_LOG_ERROR, "custom scaling matrix not implemented\n"); - return -1; - } + decode_scaling_matrices(h, &h->sps_buffer[pps->sps_id], pps, 0, pps->scaling_matrix4, pps->scaling_matrix8); get_se_golomb(&s->gb); //second_chroma_qp_index_offset } |