comparison h264.c @ 7892:59e42f624d4d libavcodec

Make pps/sps scaling_matrix initialization closer to the spec. This does not affect any of the conformance streams.
author michael
date Thu, 18 Sep 2008 16:36:19 +0000
parents d0489fa75c41
children 463362e06206
comparison
equal deleted inserted replaced
7891:13ee9bb85721 7892:59e42f624d4d
6961 decode_scaling_list(h,scaling_matrix4[5],16,default_scaling4[1],scaling_matrix4[4]); // Inter, Cb 6961 decode_scaling_list(h,scaling_matrix4[5],16,default_scaling4[1],scaling_matrix4[4]); // Inter, Cb
6962 if(is_sps || pps->transform_8x8_mode){ 6962 if(is_sps || pps->transform_8x8_mode){
6963 decode_scaling_list(h,scaling_matrix8[0],64,default_scaling8[0],fallback[2]); // Intra, Y 6963 decode_scaling_list(h,scaling_matrix8[0],64,default_scaling8[0],fallback[2]); // Intra, Y
6964 decode_scaling_list(h,scaling_matrix8[1],64,default_scaling8[1],fallback[3]); // Inter, Y 6964 decode_scaling_list(h,scaling_matrix8[1],64,default_scaling8[1],fallback[3]); // Inter, Y
6965 } 6965 }
6966 } else if(fallback_sps) {
6967 memcpy(scaling_matrix4, sps->scaling_matrix4, 6*16*sizeof(uint8_t));
6968 memcpy(scaling_matrix8, sps->scaling_matrix8, 2*64*sizeof(uint8_t));
6969 } 6966 }
6970 } 6967 }
6971 6968
6972 /** 6969 /**
6973 * Returns and optionally allocates SPS / PPS structures in the supplied array 'vec' 6970 * Returns and optionally allocates SPS / PPS structures in the supplied array 'vec'
7010 return -1; 7007 return -1;
7011 7008
7012 sps->profile_idc= profile_idc; 7009 sps->profile_idc= profile_idc;
7013 sps->level_idc= level_idc; 7010 sps->level_idc= level_idc;
7014 7011
7012 memset(sps->scaling_matrix4, 16, sizeof(sps->scaling_matrix4));
7013 memset(sps->scaling_matrix8, 16, sizeof(sps->scaling_matrix8));
7014 sps->scaling_matrix_present = 0;
7015
7015 if(sps->profile_idc >= 100){ //high profile 7016 if(sps->profile_idc >= 100){ //high profile
7016 sps->chroma_format_idc= get_ue_golomb(&s->gb); 7017 sps->chroma_format_idc= get_ue_golomb(&s->gb);
7017 if(sps->chroma_format_idc == 3) 7018 if(sps->chroma_format_idc == 3)
7018 get_bits1(&s->gb); //residual_color_transform_flag 7019 get_bits1(&s->gb); //residual_color_transform_flag
7019 get_ue_golomb(&s->gb); //bit_depth_luma_minus8 7020 get_ue_golomb(&s->gb); //bit_depth_luma_minus8
7020 get_ue_golomb(&s->gb); //bit_depth_chroma_minus8 7021 get_ue_golomb(&s->gb); //bit_depth_chroma_minus8
7021 sps->transform_bypass = get_bits1(&s->gb); 7022 sps->transform_bypass = get_bits1(&s->gb);
7022 decode_scaling_matrices(h, sps, NULL, 1, sps->scaling_matrix4, sps->scaling_matrix8); 7023 decode_scaling_matrices(h, sps, NULL, 1, sps->scaling_matrix4, sps->scaling_matrix8);
7023 }else{ 7024 }else{
7024 sps->scaling_matrix_present = 0;
7025 sps->chroma_format_idc= 1; 7025 sps->chroma_format_idc= 1;
7026 } 7026 }
7027 7027
7028 sps->log2_max_frame_num= get_ue_golomb(&s->gb) + 4; 7028 sps->log2_max_frame_num= get_ue_golomb(&s->gb) + 4;
7029 sps->poc_type= get_ue_golomb(&s->gb); 7029 sps->poc_type= get_ue_golomb(&s->gb);
7202 pps->constrained_intra_pred= get_bits1(&s->gb); 7202 pps->constrained_intra_pred= get_bits1(&s->gb);
7203 pps->redundant_pic_cnt_present = get_bits1(&s->gb); 7203 pps->redundant_pic_cnt_present = get_bits1(&s->gb);
7204 7204
7205 pps->transform_8x8_mode= 0; 7205 pps->transform_8x8_mode= 0;
7206 h->dequant_coeff_pps= -1; //contents of sps/pps can change even if id doesn't, so reinit 7206 h->dequant_coeff_pps= -1; //contents of sps/pps can change even if id doesn't, so reinit
7207 memset(pps->scaling_matrix4, 16, 6*16*sizeof(uint8_t)); 7207 memcpy(pps->scaling_matrix4, h->sps_buffers[pps->sps_id]->scaling_matrix4, sizeof(pps->scaling_matrix4));
7208 memset(pps->scaling_matrix8, 16, 2*64*sizeof(uint8_t)); 7208 memcpy(pps->scaling_matrix8, h->sps_buffers[pps->sps_id]->scaling_matrix8, sizeof(pps->scaling_matrix8));
7209 7209
7210 if(get_bits_count(&s->gb) < bit_length){ 7210 if(get_bits_count(&s->gb) < bit_length){
7211 pps->transform_8x8_mode= get_bits1(&s->gb); 7211 pps->transform_8x8_mode= get_bits1(&s->gb);
7212 decode_scaling_matrices(h, h->sps_buffers[pps->sps_id], pps, 0, pps->scaling_matrix4, pps->scaling_matrix8); 7212 decode_scaling_matrices(h, h->sps_buffers[pps->sps_id], pps, 0, pps->scaling_matrix4, pps->scaling_matrix8);
7213 pps->chroma_qp_index_offset[1]= get_se_golomb(&s->gb); //second_chroma_qp_index_offset 7213 pps->chroma_qp_index_offset[1]= get_se_golomb(&s->gb); //second_chroma_qp_index_offset