• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/ap/gpl/iserver/libav-0.8.8/libavcodec/

Lines Matching refs:sps

123 static inline int decode_hrd_parameters(H264Context *h, SPS *sps){
140 sps->initial_cpb_removal_delay_length = get_bits(&s->gb, 5) + 1;
141 sps->cpb_removal_delay_length = get_bits(&s->gb, 5) + 1;
142 sps->dpb_output_delay_length = get_bits(&s->gb, 5) + 1;
143 sps->time_offset_length = get_bits(&s->gb, 5);
144 sps->cpb_cnt = cpb_count;
148 static inline int decode_vui_parameters(H264Context *h, SPS *sps){
158 sps->sar.num= get_bits(&s->gb, 16);
159 sps->sar.den= get_bits(&s->gb, 16);
161 sps->sar= pixel_aspect[aspect_ratio_idc];
167 sps->sar.num=
168 sps->sar.den= 0;
176 sps->video_signal_type_present_flag = get_bits1(&s->gb);
177 if(sps->video_signal_type_present_flag){
179 sps->full_range = get_bits1(&s->gb); /* video_full_range_flag */
181 sps->colour_description_present_flag = get_bits1(&s->gb);
182 if(sps->colour_description_present_flag){
183 sps->color_primaries = get_bits(&s->gb, 8); /* colour_primaries */
184 sps->color_trc = get_bits(&s->gb, 8); /* transfer_characteristics */
185 sps->colorspace = get_bits(&s->gb, 8); /* matrix_coefficients */
186 if (sps->color_primaries >= AVCOL_PRI_NB)
187 sps->color_primaries = AVCOL_PRI_UNSPECIFIED;
188 if (sps->color_trc >= AVCOL_TRC_NB)
189 sps->color_trc = AVCOL_TRC_UNSPECIFIED;
190 if (sps->colorspace >= AVCOL_SPC_NB)
191 sps->colorspace = AVCOL_SPC_UNSPECIFIED;
200 sps->timing_info_present_flag = get_bits1(&s->gb);
201 if(sps->timing_info_present_flag){
202 sps->num_units_in_tick = get_bits_long(&s->gb, 32);
203 sps->time_scale = get_bits_long(&s->gb, 32);
204 if(!sps->num_units_in_tick || !sps->time_scale){
205 av_log(h->s.avctx, AV_LOG_ERROR, "time_scale/num_units_in_tick invalid or unsupported (%d/%d)\n", sps->time_scale, sps->num_units_in_tick);
208 sps->fixed_frame_rate_flag = get_bits1(&s->gb);
211 sps->nal_hrd_parameters_present_flag = get_bits1(&s->gb);
212 if(sps->nal_hrd_parameters_present_flag)
213 if(decode_hrd_parameters(h, sps) < 0)
215 sps->vcl_hrd_parameters_present_flag = get_bits1(&s->gb);
216 if(sps->vcl_hrd_parameters_present_flag)
217 if(decode_hrd_parameters(h, sps) < 0)
219 if(sps->nal_hrd_parameters_present_flag || sps->vcl_hrd_parameters_present_flag)
221 sps->pic_struct_present_flag = get_bits1(&s->gb);
223 sps->bitstream_restriction_flag = get_bits1(&s->gb);
224 if(sps->bitstream_restriction_flag){
230 sps->num_reorder_frames= get_ue_golomb(&s->gb);
234 sps->num_reorder_frames=0;
235 sps->bitstream_restriction_flag= 0;
238 if(sps->num_reorder_frames > 16U /*max_dec_frame_buffering || max_dec_frame_buffering > 16*/){
239 av_log(h->s.avctx, AV_LOG_ERROR, "illegal num_reorder_frames %d\n", sps->num_reorder_frames);
270 static void decode_scaling_matrices(H264Context *h, SPS *sps, PPS *pps, int is_sps,
273 int fallback_sps = !is_sps && sps->scaling_matrix_present;
275 fallback_sps ? sps->scaling_matrix4[0] : default_scaling4[0],
276 fallback_sps ? sps->scaling_matrix4[3] : default_scaling4[1],
277 fallback_sps ? sps->scaling_matrix8[0] : default_scaling8[0],
278 fallback_sps ? sps->scaling_matrix8[3] : default_scaling8[1]
281 sps->scaling_matrix_present |= is_sps;
290 if(sps->chroma_format_idc == 3){
295 if(sps->chroma_format_idc == 3){
308 SPS *sps;
323 sps= av_mallocz(sizeof(SPS));
324 if(sps == NULL)
327 sps->time_offset_length = 24;
328 sps->profile_idc= profile_idc;
329 sps->constraint_set_flags = constraint_set_flags;
330 sps->level_idc= level_idc;
332 memset(sps->scaling_matrix4, 16, sizeof(sps->scaling_matrix4));
333 memset(sps->scaling_matrix8, 16, sizeof(sps->scaling_matrix8));
334 sps->scaling_matrix_present = 0;
336 if (sps->profile_idc == 100 || sps->profile_idc == 110 ||
337 sps->profile_idc == 122 || sps->profile_idc == 244 ||
338 sps->profile_idc == 44 || sps->profile_idc == 83 ||
339 sps->profile_idc == 86 || sps->profile_idc == 118 ||
340 sps->profile_idc == 128 || sps->profile_idc == 144) {
341 sps->chroma_format_idc= get_ue_golomb_31(&s->gb);
342 if(sps->chroma_format_idc > 3) {
343 av_log(h->s.avctx, AV_LOG_ERROR, "chroma_format_idc (%u) out of range\n", sps->chroma_format_idc);
345 } else if(sps->chroma_format_idc == 3) {
346 sps->residual_color_transform_flag = get_bits1(&s->gb);
348 sps->bit_depth_luma = get_ue_golomb(&s->gb) + 8;
349 sps->bit_depth_chroma = get_ue_golomb(&s->gb) + 8;
350 sps->transform_bypass = get_bits1(&s->gb);
351 decode_scaling_matrices(h, sps, NULL, 1, sps->scaling_matrix4, sps->scaling_matrix8);
353 sps->chroma_format_idc= 1;
354 sps->bit_depth_luma = 8;
355 sps->bit_depth_chroma = 8;
366 sps->log2_max_frame_num = log2_max_frame_num_minus4 + 4;
368 sps->poc_type= get_ue_golomb_31(&s->gb);
370 if(sps->poc_type == 0){ //FIXME #define
371 sps->log2_max_poc_lsb= get_ue_golomb(&s->gb) + 4;
372 } else if(sps->poc_type == 1){//FIXME #define
373 sps->delta_pic_order_always_zero_flag= get_bits1(&s->gb);
374 sps->offset_for_non_ref_pic= get_se_golomb(&s->gb);
375 sps->offset_for_top_to_bottom_field= get_se_golomb(&s->gb);
376 sps->poc_cycle_length = get_ue_golomb(&s->gb);
378 if((unsigned)sps->poc_cycle_length >= FF_ARRAY_ELEMS(sps->offset_for_ref_frame)){
379 av_log(h->s.avctx, AV_LOG_ERROR, "poc_cycle_length overflow %u\n", sps->poc_cycle_length);
383 for(i=0; i<sps->poc_cycle_length; i++)
384 sps->offset_for_ref_frame[i]= get_se_golomb(&s->gb);
385 }else if(sps->poc_type != 2){
386 av_log(h->s.avctx, AV_LOG_ERROR, "illegal POC type %d\n", sps->poc_type);
390 sps->ref_frame_count= get_ue_golomb_31(&s->gb);
391 if(sps->ref_frame_count > MAX_PICTURE_COUNT-2 || sps->ref_frame_count >= 32U){
395 sps->gaps_in_frame_num_allowed_flag= get_bits1(&s->gb);
396 sps->mb_width = get_ue_golomb(&s->gb) + 1;
397 sps->mb_height= get_ue_golomb(&s->gb) + 1;
398 if((unsigned)sps->mb_width >= INT_MAX/16 || (unsigned)sps->mb_height >= INT_MAX/16 ||
399 av_image_check_size(16*sps->mb_width, 16*sps->mb_height, 0, h->s.avctx)){
404 sps->frame_mbs_only_flag= get_bits1(&s->gb);
405 if(!sps->frame_mbs_only_flag)
406 sps->mb_aff= get_bits1(&s->gb);
408 sps->mb_aff= 0;
410 sps->direct_8x8_inference_flag= get_bits1(&s->gb);
411 if(!sps->frame_mbs_only_flag && !sps->direct_8x8_inference_flag){
417 if(sps->mb_aff)
420 sps->crop= get_bits1(&s->gb);
421 if(sps->crop){
422 int crop_vertical_limit = sps->chroma_format_idc & 2 ? 16 : 8;
423 int crop_horizontal_limit = sps->chroma_format_idc == 3 ? 16 : 8;
424 sps->crop_left = get_ue_golomb(&s->gb);
425 sps->crop_right = get_ue_golomb(&s->gb);
426 sps->crop_top = get_ue_golomb(&s->gb);
427 sps->crop_bottom= get_ue_golomb(&s->gb);
428 if(sps->crop_left || sps->crop_top){
431 if(sps->crop_right >= crop_horizontal_limit || sps->crop_bottom >= crop_vertical_limit){
435 sps->crop_left =
436 sps->crop_right =
437 sps->crop_top =
438 sps->crop_bottom= 0;
441 sps->vui_parameters_present_flag= get_bits1(&s->gb);
442 if( sps->vui_parameters_present_flag )
443 if (decode_vui_parameters(h, sps) < 0)
446 if(!sps->sar.den)
447 sps->sar.den= 1;
450 av_log(h->s.avctx, AV_LOG_DEBUG, "sps:%u profile:%d/%d poc:%d ref:%d %dx%d %s %s crop:%d/%d/%d/%d %s %s %d/%d\n",
451 sps_id, sps->profile_idc, sps->level_idc,
452 sps->poc_type,
453 sps->ref_frame_count,
454 sps->mb_width, sps->mb_height,
455 sps->frame_mbs_only_flag ? "FRM" : (sps->mb_aff ? "MB-AFF" : "PIC-AFF"),
456 sps->direct_8x8_inference_flag ? "8B8" : "",
457 sps->crop_left, sps->crop_right,
458 sps->crop_top, sps->crop_bottom,
459 sps->vui_parameters_present_flag ? "VUI" : "",
460 ((const char*[]){"Gray","420","422","444"})[sps->chroma_format_idc],
461 sps->timing_info_present_flag ? sps->num_units_in_tick : 0,
462 sps->timing_info_present_flag ? sps->time_scale : 0
467 h->sps_buffers[sps_id]= sps;
468 h->sps = *sps;
471 av_free(sps);
488 const int qp_bd_offset = 6*(h->sps.bit_depth_luma-8);
494 } else if (h->sps.bit_depth_luma > 10) {
495 av_log(h->s.avctx, AV_LOG_ERROR, "Unimplemented luma bit depth=%d (max=10)\n", h->sps.bit_depth_luma);
565 h->dequant_coeff_pps= -1; //contents of sps/pps can change even if id doesn't, so reinit
579 build_qp_table(pps, 0, pps->chroma_qp_index_offset[0], h->sps.bit_depth_luma);
580 build_qp_table(pps, 1, pps->chroma_qp_index_offset[1], h->sps.bit_depth_luma);
585 av_log(h->s.avctx, AV_LOG_DEBUG, "pps:%u sps:%u %s slice_groups:%d ref:%d/%d %s qp:%d/%d/%d/%d %s %s %s %s\n",