Mercurial > cgi-bin > hgwebdir.cgi > PR > Applications > VSs > VSs__H264__App
diff libavcodec/h264_ps.c @ 2:897f711a7157
rearrange to work with autoconf
| author | Nina Engelhardt <nengel@mailbox.tu-berlin.de> |
|---|---|
| date | Tue, 25 Sep 2012 15:55:33 +0200 |
| parents | |
| children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/libavcodec/h264_ps.c Tue Sep 25 15:55:33 2012 +0200 1.3 @@ -0,0 +1,462 @@ 1.4 +/* 1.5 + * H.26L/H.264/AVC/JVT/14496-10/... parameter set decoding 1.6 + * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at> 1.7 + * 1.8 + * This file is part of FFmpeg. 1.9 + * 1.10 + * FFmpeg is free software; you can redistribute it and/or 1.11 + * modify it under the terms of the GNU Lesser General Public 1.12 + * License as published by the Free Software Foundation; either 1.13 + * version 2.1 of the License, or (at your option) any later version. 1.14 + * 1.15 + * FFmpeg is distributed in the hope that it will be useful, 1.16 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 1.17 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1.18 + * Lesser General Public License for more details. 1.19 + * 1.20 + * You should have received a copy of the GNU Lesser General Public 1.21 + * License along with FFmpeg; if not, write to the Free Software 1.22 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 1.23 + */ 1.24 + 1.25 +/** 1.26 + * @file 1.27 + * H.264 / AVC / MPEG4 part10 parameter set decoding. 1.28 + * @author Michael Niedermayer <michaelni@gmx.at> 1.29 + */ 1.30 + 1.31 +#include "dsputil.h" 1.32 +#include "avcodec.h" 1.33 +#include "h264_types.h" 1.34 +#include "h264_data.h" 1.35 +#include "golomb.h" 1.36 + 1.37 + 1.38 +//#undef NDEBUG 1.39 +#include <assert.h> 1.40 + 1.41 +static const int pixel_aspect[17][2]={ 1.42 + {0, 1}, 1.43 + {1, 1}, 1.44 + {12, 11}, 1.45 + {10, 11}, 1.46 + {16, 11}, 1.47 + {40, 33}, 1.48 + {24, 11}, 1.49 + {20, 11}, 1.50 + {32, 11}, 1.51 + {80, 33}, 1.52 + {18, 11}, 1.53 + {15, 11}, 1.54 + {64, 33}, 1.55 + {160,99}, 1.56 + {4, 3}, 1.57 + {3, 2}, 1.58 + {2, 1}, 1.59 +}; 1.60 + 1.61 +const uint8_t ff_h264_chroma_qp[52]={ 1.62 + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11, 1.63 + 12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27, 1.64 + 28,29,29,30,31,32,32,33,34,34,35,35,36,36,37,37, 1.65 + 37,38,38,38,39,39,39,39 1.66 +}; 1.67 + 1.68 +static const uint8_t default_scaling4[2][16]={ 1.69 +{ 6,13,20,28, 1.70 + 13,20,28,32, 1.71 + 20,28,32,37, 1.72 + 28,32,37,42 1.73 +},{ 1.74 + 10,14,20,24, 1.75 + 14,20,24,27, 1.76 + 20,24,27,30, 1.77 + 24,27,30,34 1.78 +}}; 1.79 + 1.80 +static const uint8_t default_scaling8[2][64]={ 1.81 +{ 6,10,13,16,18,23,25,27, 1.82 + 10,11,16,18,23,25,27,29, 1.83 + 13,16,18,23,25,27,29,31, 1.84 + 16,18,23,25,27,29,31,33, 1.85 + 18,23,25,27,29,31,33,36, 1.86 + 23,25,27,29,31,33,36,38, 1.87 + 25,27,29,31,33,36,38,40, 1.88 + 27,29,31,33,36,38,40,42 1.89 +},{ 1.90 + 9,13,15,17,19,21,22,24, 1.91 + 13,13,17,19,21,22,24,25, 1.92 + 15,17,19,21,22,24,25,27, 1.93 + 17,19,21,22,24,25,27,28, 1.94 + 19,21,22,24,25,27,28,30, 1.95 + 21,22,24,25,27,28,30,32, 1.96 + 22,24,25,27,28,30,32,33, 1.97 + 24,25,27,28,30,32,33,35 1.98 +}}; 1.99 + 1.100 +static inline int decode_hrd_parameters(GetBitContext *gb, SPS *sps){ 1.101 + int cpb_count, i; 1.102 + cpb_count = get_ue_golomb_31(gb) + 1; 1.103 + 1.104 + if(cpb_count > 32){ 1.105 + av_log(AV_LOG_ERROR, "cpb_count %d invalid\n", cpb_count); 1.106 + return -1; 1.107 + } 1.108 + 1.109 + get_bits(gb, 4); /* bit_rate_scale */ 1.110 + get_bits(gb, 4); /* cpb_size_scale */ 1.111 + for(i=0; i<cpb_count; i++){ 1.112 + get_ue_golomb(gb); /* bit_rate_value_minus1 */ 1.113 + get_ue_golomb(gb); /* cpb_size_value_minus1 */ 1.114 + get_bits1(gb); /* cbr_flag */ 1.115 + } 1.116 + sps->initial_cpb_removal_delay_length = get_bits(gb, 5) + 1; 1.117 + sps->cpb_removal_delay_length = get_bits(gb, 5) + 1; 1.118 + sps->dpb_output_delay_length = get_bits(gb, 5) + 1; 1.119 + sps->time_offset_length = get_bits(gb, 5); 1.120 + sps->cpb_cnt = cpb_count; 1.121 + return 0; 1.122 +} 1.123 + 1.124 +static inline int decode_vui_parameters(GetBitContext *gb, SPS *sps){ 1.125 + int aspect_ratio_info_present_flag; 1.126 + unsigned int aspect_ratio_idc; 1.127 + 1.128 + aspect_ratio_info_present_flag= get_bits1(gb); 1.129 + 1.130 + if( aspect_ratio_info_present_flag ) { 1.131 + aspect_ratio_idc= get_bits(gb, 8); 1.132 + if( aspect_ratio_idc == EXTENDED_SAR ) { 1.133 + sps->num= get_bits(gb, 16); 1.134 + sps->den= get_bits(gb, 16); 1.135 + }else if(aspect_ratio_idc < sizeof(pixel_aspect)/sizeof(int[2])){ 1.136 + //sps->sar= pixel_aspect[aspect_ratio_idc]; 1.137 + }else{ 1.138 + av_log( AV_LOG_ERROR, "illegal aspect ratio idc %d\n", aspect_ratio_idc); 1.139 + // return -1; 1.140 + } 1.141 + }else{ 1.142 + sps->num= 1.143 + sps->den= 0; 1.144 + } 1.145 + 1.146 + if(get_bits1(gb)){ /* overscan_info_present_flag */ 1.147 + get_bits1(gb); /* overscan_appropriate_flag */ 1.148 + } 1.149 + 1.150 + sps->video_signal_type_present_flag = get_bits1(gb); 1.151 + if(sps->video_signal_type_present_flag){ 1.152 + get_bits(gb, 3); /* video_format */ 1.153 + sps->full_range = get_bits1(gb); /* video_full_range_flag */ 1.154 + 1.155 + sps->colour_description_present_flag = get_bits1(gb); 1.156 + if(sps->colour_description_present_flag){ 1.157 + sps->color_primaries = get_bits(gb, 8); /* colour_primaries */ 1.158 + sps->color_trc = get_bits(gb, 8); /* transfer_characteristics */ 1.159 + sps->colorspace = get_bits(gb, 8); /* matrix_coefficients */ 1.160 + if (sps->color_primaries >= AVCOL_PRI_NB) 1.161 + sps->color_primaries = AVCOL_PRI_UNSPECIFIED; 1.162 + if (sps->color_trc >= AVCOL_TRC_NB) 1.163 + sps->color_trc = AVCOL_TRC_UNSPECIFIED; 1.164 + if (sps->colorspace >= AVCOL_SPC_NB) 1.165 + sps->colorspace = AVCOL_SPC_UNSPECIFIED; 1.166 + } 1.167 + } 1.168 + 1.169 + if(get_bits1(gb)){ /* chroma_location_info_present_flag */ 1.170 + av_log(AV_LOG_ERROR, "chroma_location_info_present_flag found, but not supported\n"); 1.171 + (void) (get_ue_golomb(gb)+1); /* chroma_sample_location_type_top_field */ 1.172 + (void) get_ue_golomb(gb); /* chroma_sample_location_type_bottom_field */ 1.173 + } 1.174 + 1.175 + sps->timing_info_present_flag = get_bits1(gb); 1.176 + if(sps->timing_info_present_flag){ 1.177 + sps->num_units_in_tick = get_bits_long(gb, 32); 1.178 + sps->time_scale = get_bits_long(gb, 32); 1.179 + if(!sps->num_units_in_tick || !sps->time_scale){ 1.180 + av_log(AV_LOG_ERROR, "time_scale/num_units_in_tick invalid or unsupported (%d/%d)\n", sps->time_scale, sps->num_units_in_tick); 1.181 + return -1; 1.182 + } 1.183 + sps->fixed_frame_rate_flag = get_bits1(gb); 1.184 + } 1.185 + 1.186 + sps->nal_hrd_parameters_present_flag = get_bits1(gb); 1.187 + if(sps->nal_hrd_parameters_present_flag) 1.188 + if(decode_hrd_parameters(gb, sps) < 0) 1.189 + return -1; 1.190 + sps->vcl_hrd_parameters_present_flag = get_bits1(gb); 1.191 + if(sps->vcl_hrd_parameters_present_flag) 1.192 + if(decode_hrd_parameters(gb, sps) < 0) 1.193 + return -1; 1.194 + if(sps->nal_hrd_parameters_present_flag || sps->vcl_hrd_parameters_present_flag) 1.195 + get_bits1(gb); /* low_delay_hrd_flag */ 1.196 + sps->pic_struct_present_flag = get_bits1(gb); 1.197 + 1.198 + sps->bitstream_restriction_flag = get_bits1(gb); 1.199 + if(sps->bitstream_restriction_flag){ 1.200 + get_bits1(gb); /* motion_vectors_over_pic_boundaries_flag */ 1.201 + get_ue_golomb(gb); /* max_bytes_per_pic_denom */ 1.202 + get_ue_golomb(gb); /* max_bits_per_mb_denom */ 1.203 + get_ue_golomb(gb); /* log2_max_mv_length_horizontal */ 1.204 + get_ue_golomb(gb); /* log2_max_mv_length_vertical */ 1.205 + sps->num_reorder_frames= get_ue_golomb(gb); 1.206 + get_ue_golomb(gb); /*max_dec_frame_buffering*/ 1.207 + 1.208 + if(sps->num_reorder_frames > 16 /*max_dec_frame_buffering || max_dec_frame_buffering > 16*/){ 1.209 + av_log(AV_LOG_ERROR, "illegal num_reorder_frames %d\n", sps->num_reorder_frames); 1.210 + return -1; 1.211 + } 1.212 + } 1.213 + 1.214 + return 0; 1.215 +} 1.216 + 1.217 +static void decode_scaling_list(GetBitContext *gb, uint8_t *factors, int size, const uint8_t *jvt_list, const uint8_t *fallback_list){ 1.218 + int i, last = 8, next = 8; 1.219 + const uint8_t *scan = size == 16 ? zigzag_scan : ff_zigzag_direct; 1.220 + if(!get_bits1(gb)) /* matrix not written, we use the predicted one */ 1.221 + memcpy(factors, fallback_list, size*sizeof(uint8_t)); 1.222 + else 1.223 + for(i=0;i<size;i++){ 1.224 + if(next) 1.225 + next = (last + get_se_golomb(gb)) & 0xff; 1.226 + if(!i && !next){ /* matrix not written, we use the preset one */ 1.227 + memcpy(factors, jvt_list, size*sizeof(uint8_t)); 1.228 + break; 1.229 + } 1.230 + last = factors[scan[i]] = next ? next : last; 1.231 + } 1.232 +} 1.233 + 1.234 +static void decode_scaling_matrices(GetBitContext *gb, SPS *sps, PPS *pps, int is_sps, 1.235 + uint8_t (*scaling_matrix4)[16], uint8_t (*scaling_matrix8)[64]){ 1.236 + int fallback_sps = !is_sps && sps->scaling_matrix_present; 1.237 + const uint8_t *fallback[4] = { 1.238 + fallback_sps ? sps->scaling_matrix4[0] : default_scaling4[0], 1.239 + fallback_sps ? sps->scaling_matrix4[3] : default_scaling4[1], 1.240 + fallback_sps ? sps->scaling_matrix8[0] : default_scaling8[0], 1.241 + fallback_sps ? sps->scaling_matrix8[1] : default_scaling8[1] 1.242 + }; 1.243 + if(get_bits1(gb)){ 1.244 + sps->scaling_matrix_present |= is_sps; 1.245 + decode_scaling_list(gb, scaling_matrix4[0],16,default_scaling4[0],fallback[0]); // Intra, Y 1.246 + decode_scaling_list(gb, scaling_matrix4[1],16,default_scaling4[0],scaling_matrix4[0]); // Intra, Cr 1.247 + decode_scaling_list(gb, scaling_matrix4[2],16,default_scaling4[0],scaling_matrix4[1]); // Intra, Cb 1.248 + decode_scaling_list(gb, scaling_matrix4[3],16,default_scaling4[1],fallback[1]); // Inter, Y 1.249 + decode_scaling_list(gb, scaling_matrix4[4],16,default_scaling4[1],scaling_matrix4[3]); // Inter, Cr 1.250 + decode_scaling_list(gb, scaling_matrix4[5],16,default_scaling4[1],scaling_matrix4[4]); // Inter, Cb 1.251 + if(is_sps || pps->transform_8x8_mode){ 1.252 + decode_scaling_list(gb, scaling_matrix8[0],64,default_scaling8[0],fallback[2]); // Intra, Y 1.253 + decode_scaling_list(gb, scaling_matrix8[1],64,default_scaling8[1],fallback[3]); // Inter, Y 1.254 + } 1.255 + } 1.256 +} 1.257 + 1.258 +int ff_h264_decode_seq_parameter_set(NalContext *n, GetBitContext *gb){ 1.259 + int profile_idc, level_idc; 1.260 + unsigned int sps_id; 1.261 + int i; 1.262 + SPS *sps; 1.263 + 1.264 + profile_idc= get_bits(gb, 8); 1.265 + get_bits1(gb); //constraint_set0_flag 1.266 + get_bits1(gb); //constraint_set1_flag 1.267 + get_bits1(gb); //constraint_set2_flag 1.268 + get_bits1(gb); //constraint_set3_flag 1.269 + get_bits(gb, 4); // reserved 1.270 + level_idc= get_bits(gb, 8); 1.271 + sps_id= get_ue_golomb_31(gb); 1.272 + 1.273 + if(sps_id >= MAX_SPS_COUNT) { 1.274 + av_log(AV_LOG_ERROR, "sps_id (%d) out of range\n", sps_id); 1.275 + return -1; 1.276 + } 1.277 + if (!n->sps_buffers[sps_id]) 1.278 + n->sps_buffers[sps_id]= av_mallocz(sizeof(SPS)); 1.279 + 1.280 + sps = n->sps_buffers[sps_id]; 1.281 + if(sps == NULL) 1.282 + return -1; 1.283 + 1.284 + sps->profile_idc= profile_idc; 1.285 + sps->level_idc= level_idc; 1.286 + 1.287 + memset(sps->scaling_matrix4, 16, sizeof(sps->scaling_matrix4)); 1.288 + memset(sps->scaling_matrix8, 16, sizeof(sps->scaling_matrix8)); 1.289 + sps->scaling_matrix_present = 0; 1.290 + 1.291 + if(sps->profile_idc >= 100){ //high profile 1.292 + sps->chroma_format_idc= get_ue_golomb_31(gb); 1.293 + if(sps->chroma_format_idc == 3) 1.294 + sps->residual_color_transform_flag = get_bits1(gb); 1.295 + sps->bit_depth_luma = get_ue_golomb(gb) + 8; 1.296 + sps->bit_depth_chroma = get_ue_golomb(gb) + 8; 1.297 + sps->transform_bypass = get_bits1(gb); 1.298 + decode_scaling_matrices(gb, sps, NULL, 1, sps->scaling_matrix4, sps->scaling_matrix8); 1.299 + }else{ 1.300 + sps->chroma_format_idc= 1; 1.301 + sps->bit_depth_luma = 8; 1.302 + sps->bit_depth_chroma = 8; 1.303 + } 1.304 + 1.305 + sps->log2_max_frame_num= get_ue_golomb(gb) + 4; 1.306 + sps->poc_type= get_ue_golomb_31(gb); 1.307 + 1.308 + if(sps->poc_type == 0){ //FIXME #define 1.309 + sps->log2_max_poc_lsb= get_ue_golomb(gb) + 4; 1.310 + } else if(sps->poc_type == 1){//FIXME #define 1.311 + sps->delta_pic_order_always_zero_flag= get_bits1(gb); 1.312 + sps->offset_for_non_ref_pic= get_se_golomb(gb); 1.313 + sps->offset_for_top_to_bottom_field= get_se_golomb(gb); 1.314 + sps->poc_cycle_length = get_ue_golomb(gb); 1.315 + 1.316 + if((unsigned)sps->poc_cycle_length >= FF_ARRAY_ELEMS(sps->offset_for_ref_frame)){ 1.317 + av_log(AV_LOG_ERROR, "poc_cycle_length overflow %u\n", sps->poc_cycle_length); 1.318 + goto fail; 1.319 + } 1.320 + 1.321 + for(i=0; i<sps->poc_cycle_length; i++) 1.322 + sps->offset_for_ref_frame[i]= get_se_golomb(gb); 1.323 + }else if(sps->poc_type != 2){ 1.324 + av_log(AV_LOG_ERROR, "illegal POC type %d\n", sps->poc_type); 1.325 + goto fail; 1.326 + } 1.327 + 1.328 + sps->ref_frame_count= get_ue_golomb_31(gb); 1.329 + if(sps->ref_frame_count >= 32){ 1.330 + av_log(AV_LOG_ERROR, "too many reference frames\n"); 1.331 + goto fail; 1.332 + } 1.333 + sps->gaps_in_frame_num_allowed_flag= get_bits1(gb); 1.334 + sps->mb_width = get_ue_golomb(gb) + 1; 1.335 + sps->mb_height= get_ue_golomb(gb) + 1; 1.336 + 1.337 + 1.338 + sps->frame_mbs_only_flag= get_bits1(gb); 1.339 + if(!sps->frame_mbs_only_flag){ 1.340 + av_log(AV_LOG_ERROR, "MBAFF support not included\n"); 1.341 + get_bits1(gb); 1.342 + }else 1.343 + sps->mb_aff= 0; 1.344 + 1.345 + sps->direct_8x8_inference_flag= get_bits1(gb); 1.346 + if(!sps->frame_mbs_only_flag && !sps->direct_8x8_inference_flag){ 1.347 + av_log(AV_LOG_ERROR, "This stream was generated by a broken encoder, invalid 8x8 inference\n"); 1.348 + goto fail; 1.349 + } 1.350 + 1.351 + sps->crop= get_bits1(gb); 1.352 + if(sps->crop){ 1.353 + sps->crop_left = get_ue_golomb(gb); 1.354 + sps->crop_right = get_ue_golomb(gb); 1.355 + sps->crop_top = get_ue_golomb(gb); 1.356 + sps->crop_bottom= get_ue_golomb(gb); 1.357 + if(sps->crop_left || sps->crop_top){ 1.358 + av_log( AV_LOG_ERROR, "insane cropping not completely supported, this could look slightly wrong ...\n"); 1.359 + } 1.360 + if(sps->crop_right >= 8 || sps->crop_bottom >= (8>> !sps->frame_mbs_only_flag)){ 1.361 + av_log( AV_LOG_ERROR, "brainfart cropping not supported, this could look slightly wrong ...\n"); 1.362 + } 1.363 + }else { 1.364 + 1.365 + sps->crop_left = 1.366 + sps->crop_right = 1.367 + sps->crop_top = 1.368 + sps->crop_bottom= 0; 1.369 + } 1.370 + 1.371 + sps->vui_parameters_present_flag= get_bits1(gb); 1.372 + if( sps->vui_parameters_present_flag ) 1.373 + if (decode_vui_parameters(gb, sps) < 0) 1.374 + goto fail; 1.375 + 1.376 + 1.377 + n->sps = *sps; 1.378 + 1.379 + if( sps->bitstream_restriction_flag){ 1.380 + n->has_b_frames = sps->num_reorder_frames; 1.381 + } 1.382 + else 1.383 + n->has_b_frames= MAX_DELAYED_PIC_COUNT; 1.384 + 1.385 + return 0; 1.386 +fail: 1.387 + av_free(sps); 1.388 + return -1; 1.389 +} 1.390 + 1.391 +static void 1.392 +build_qp_table(PPS *pps, int t, int index) 1.393 +{ 1.394 + int i; 1.395 + for(i = 0; i < 52; i++) 1.396 + pps->chroma_qp_table[t][i] = ff_h264_chroma_qp[av_clip(i + index, 0, 51)]; 1.397 +} 1.398 + 1.399 +int ff_h264_decode_picture_parameter_set(NalContext *n, GetBitContext *gb, int bit_length){ 1.400 + unsigned int pps_id= get_ue_golomb(gb); 1.401 + PPS *pps; 1.402 + 1.403 + if(pps_id >= MAX_PPS_COUNT) { 1.404 + av_log(AV_LOG_ERROR, "pps_id (%d) out of range\n", pps_id); 1.405 + return -1; 1.406 + } 1.407 + if (!n->pps_buffers[pps_id]) 1.408 + n->pps_buffers[pps_id]= av_mallocz(sizeof(PPS)); 1.409 + pps = n->pps_buffers[pps_id]; 1.410 + if(pps == NULL) 1.411 + return -1; 1.412 + pps->sps_id= get_ue_golomb_31(gb); 1.413 + if((unsigned)pps->sps_id>=MAX_SPS_COUNT || n->sps_buffers[pps->sps_id] == NULL){ 1.414 + av_log(AV_LOG_ERROR, "sps_id out of range\n"); 1.415 + goto fail; 1.416 + } 1.417 + 1.418 + pps->cabac= get_bits1(gb); 1.419 + pps->pic_order_present= get_bits1(gb); 1.420 + if(pps->pic_order_present){ 1.421 + av_log(AV_LOG_ERROR, "no interlaces support\n"); 1.422 + } 1.423 + pps->slice_group_count= get_ue_golomb(gb) + 1; 1.424 + if(pps->slice_group_count > 1 ){ 1.425 + pps->mb_slice_group_map_type= get_ue_golomb(gb); 1.426 + av_log(AV_LOG_ERROR, "multiple slices not supported\n"); 1.427 + } 1.428 + pps->ref_count[0]= get_ue_golomb(gb) + 1; 1.429 + pps->ref_count[1]= get_ue_golomb(gb) + 1; 1.430 + if(pps->ref_count[0]> 32 || pps->ref_count[1]> 32){ 1.431 + av_log(AV_LOG_ERROR, "reference overflow (pps)\n"); 1.432 + goto fail; 1.433 + } 1.434 + 1.435 + pps->weighted_pred= get_bits1(gb); 1.436 + pps->weighted_bipred_idc= get_bits(gb, 2); 1.437 + pps->init_qp= get_se_golomb(gb) + 26; 1.438 + pps->init_qs= get_se_golomb(gb) + 26; 1.439 + pps->chroma_qp_index_offset[0]= get_se_golomb(gb); 1.440 + pps->deblocking_filter_parameters_present= get_bits1(gb); 1.441 + pps->constrained_intra_pred= get_bits1(gb); 1.442 + pps->redundant_pic_cnt_present = get_bits1(gb); 1.443 + 1.444 + pps->transform_8x8_mode= 0; 1.445 + memcpy(pps->scaling_matrix4, n->sps_buffers[pps->sps_id]->scaling_matrix4, sizeof(pps->scaling_matrix4)); 1.446 + memcpy(pps->scaling_matrix8, n->sps_buffers[pps->sps_id]->scaling_matrix8, sizeof(pps->scaling_matrix8)); 1.447 + 1.448 + if(get_bits_count(gb) < bit_length){ 1.449 + pps->transform_8x8_mode= get_bits1(gb); 1.450 + decode_scaling_matrices(gb, n->sps_buffers[pps->sps_id], pps, 0, pps->scaling_matrix4, pps->scaling_matrix8); 1.451 + pps->chroma_qp_index_offset[1]= get_se_golomb(gb); //second_chroma_qp_index_offset 1.452 + } else { 1.453 + pps->chroma_qp_index_offset[1]= pps->chroma_qp_index_offset[0]; 1.454 + } 1.455 + 1.456 + build_qp_table(pps, 0, pps->chroma_qp_index_offset[0]); 1.457 + build_qp_table(pps, 1, pps->chroma_qp_index_offset[1]); 1.458 + if(pps->chroma_qp_index_offset[0] != pps->chroma_qp_index_offset[1]) 1.459 + pps->chroma_qp_diff= 1; 1.460 + 1.461 + return 0; 1.462 +fail: 1.463 + av_free(pps); 1.464 + return -1; 1.465 +}
