• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/ap/gpl/minidlna/ffmpeg-2.3.4/libavcodec/

Lines Matching refs:sps

130 static inline int decode_hrd_parameters(H264Context *h, SPS *sps)
147 sps->initial_cpb_removal_delay_length = get_bits(&h->gb, 5) + 1;
148 sps->cpb_removal_delay_length = get_bits(&h->gb, 5) + 1;
149 sps->dpb_output_delay_length = get_bits(&h->gb, 5) + 1;
150 sps->time_offset_length = get_bits(&h->gb, 5);
151 sps->cpb_cnt = cpb_count;
155 static inline int decode_vui_parameters(H264Context *h, SPS *sps)
165 sps->sar.num = get_bits(&h->gb, 16);
166 sps->sar.den = get_bits(&h->gb, 16);
168 sps->sar = pixel_aspect[aspect_ratio_idc];
174 sps->sar.num =
175 sps->sar.den = 0;
181 sps->video_signal_type_present_flag = get_bits1(&h->gb);
182 if (sps->video_signal_type_present_flag) {
184 sps->full_range = get_bits1(&h->gb); /* video_full_range_flag */
186 sps->colour_description_present_flag = get_bits1(&h->gb);
187 if (sps->colour_description_present_flag) {
188 sps->color_primaries = get_bits(&h->gb, 8); /* colour_primaries */
189 sps->color_trc = get_bits(&h->gb, 8); /* transfer_characteristics */
190 sps->colorspace = get_bits(&h->gb, 8); /* matrix_coefficients */
191 if (sps->color_primaries >= AVCOL_PRI_NB)
192 sps->color_primaries = AVCOL_PRI_UNSPECIFIED;
193 if (sps->color_trc >= AVCOL_TRC_NB)
194 sps->color_trc = AVCOL_TRC_UNSPECIFIED;
195 if (sps->colorspace >= AVCOL_SPC_NB)
196 sps->colorspace = AVCOL_SPC_UNSPECIFIED;
212 sps->timing_info_present_flag = get_bits1(&h->gb);
213 if (sps->timing_info_present_flag) {
214 sps->num_units_in_tick = get_bits_long(&h->gb, 32);
215 sps->time_scale = get_bits_long(&h->gb, 32);
216 if (!sps->num_units_in_tick || !sps->time_scale) {
219 sps->time_scale, sps->num_units_in_tick);
222 sps->fixed_frame_rate_flag = get_bits1(&h->gb);
225 sps->nal_hrd_parameters_present_flag = get_bits1(&h->gb);
226 if (sps->nal_hrd_parameters_present_flag)
227 if (decode_hrd_parameters(h, sps) < 0)
229 sps->vcl_hrd_parameters_present_flag = get_bits1(&h->gb);
230 if (sps->vcl_hrd_parameters_present_flag)
231 if (decode_hrd_parameters(h, sps) < 0)
233 if (sps->nal_hrd_parameters_present_flag ||
234 sps->vcl_hrd_parameters_present_flag)
236 sps->pic_struct_present_flag = get_bits1(&h->gb);
239 sps->bitstream_restriction_flag = get_bits1(&h->gb);
240 if (sps->bitstream_restriction_flag) {
246 sps->num_reorder_frames = get_ue_golomb(&h->gb);
250 sps->num_reorder_frames = 0;
251 sps->bitstream_restriction_flag = 0;
254 if (sps->num_reorder_frames > 16U
258 sps->num_reorder_frames);
259 sps->num_reorder_frames = 16;
293 static void decode_scaling_matrices(H264Context *h, SPS *sps,
298 int fallback_sps = !is_sps && sps->scaling_matrix_present;
300 fallback_sps ? sps->scaling_matrix4[0] : default_scaling4[0],
301 fallback_sps ? sps->scaling_matrix4[3] : default_scaling4[1],
302 fallback_sps ? sps->scaling_matrix8[0] : default_scaling8[0],
303 fallback_sps ? sps->scaling_matrix8[3] : default_scaling8[1]
306 sps->scaling_matrix_present |= is_sps;
316 if (sps->chroma_format_idc == 3) {
331 SPS *sps;
348 sps = av_mallocz(sizeof(SPS));
349 if (!sps)
352 sps->sps_id = sps_id;
353 sps->time_offset_length = 24;
354 sps->profile_idc = profile_idc;
355 sps->constraint_set_flags = constraint_set_flags;
356 sps->level_idc = level_idc;
357 sps->full_range = -1;
359 memset(sps->scaling_matrix4, 16, sizeof(sps->scaling_matrix4));
360 memset(sps->scaling_matrix8, 16, sizeof(sps->scaling_matrix8));
361 sps->scaling_matrix_present = 0;
362 sps->colorspace = 2; //AVCOL_SPC_UNSPECIFIED
364 if (sps->profile_idc == 100 || // High profile
365 sps->profile_idc == 110 || // High10 profile
366 sps->profile_idc == 122 || // High422 profile
367 sps->profile_idc == 244 || // High444 Predictive profile
368 sps->profile_idc == 44 || // Cavlc444 profile
369 sps->profile_idc == 83 || // Scalable Constrained High profile (SVC)
370 sps->profile_idc == 86 || // Scalable High Intra profile (SVC)
371 sps->profile_idc == 118 || // Stereo High profile (MVC)
372 sps->profile_idc == 128 || // Multiview High profile (MVC)
373 sps->profile_idc == 138 || // Multiview Depth High profile (MVCD)
374 sps->profile_idc == 144) { // old High444 profile
375 sps->chroma_format_idc = get_ue_golomb_31(&h->gb);
376 if (sps->chroma_format_idc > 3U) {
378 sps->chroma_format_idc);
380 } else if (sps->chroma_format_idc == 3) {
381 sps->residual_color_transform_flag = get_bits1(&h->gb);
382 if (sps->residual_color_transform_flag) {
387 sps->bit_depth_luma = get_ue_golomb(&h->gb) + 8;
388 sps->bit_depth_chroma = get_ue_golomb(&h->gb) + 8;
389 if (sps->bit_depth_chroma != sps->bit_depth_luma) {
394 if (sps->bit_depth_luma > 14U || sps->bit_depth_chroma > 14U) {
396 sps->bit_depth_luma, sps->bit_depth_chroma);
399 sps->transform_bypass = get_bits1(&h->gb);
400 decode_scaling_matrices(h, sps, NULL, 1,
401 sps->scaling_matrix4, sps->scaling_matrix8);
403 sps->chroma_format_idc = 1;
404 sps->bit_depth_luma = 8;
405 sps->bit_depth_chroma = 8;
416 sps->log2_max_frame_num = log2_max_frame_num_minus4 + 4;
418 sps->poc_type = get_ue_golomb_31(&h->gb);
420 if (sps->poc_type == 0) { // FIXME #define
426 sps->log2_max_poc_lsb = t + 4;
427 } else if (sps->poc_type == 1) { // FIXME #define
428 sps->delta_pic_order_always_zero_flag = get_bits1(&h->gb);
429 sps->offset_for_non_ref_pic = get_se_golomb(&h->gb);
430 sps->offset_for_top_to_bottom_field = get_se_golomb(&h->gb);
431 sps->poc_cycle_length = get_ue_golomb(&h->gb);
433 if ((unsigned)sps->poc_cycle_length >=
434 FF_ARRAY_ELEMS(sps->offset_for_ref_frame)) {
436 "poc_cycle_length overflow %d\n", sps->poc_cycle_length);
440 for (i = 0; i < sps->poc_cycle_length; i++)
441 sps->offset_for_ref_frame[i] = get_se_golomb(&h->gb);
442 } else if (sps->poc_type != 2) {
443 av_log(h->avctx, AV_LOG_ERROR, "illegal POC type %d\n", sps->poc_type);
447 sps->ref_frame_count = get_ue_golomb_31(&h->gb);
449 sps->ref_frame_count = FFMAX(2, sps->ref_frame_count);
450 if (sps->ref_frame_count > H264_MAX_PICTURE_COUNT - 2 ||
451 sps->ref_frame_count > 16U) {
453 "too many reference frames %d\n", sps->ref_frame_count);
456 sps->gaps_in_frame_num_allowed_flag = get_bits1(&h->gb);
457 sps->mb_width = get_ue_golomb(&h->gb) + 1;
458 sps->mb_height = get_ue_golomb(&h->gb) + 1;
459 if ((unsigned)sps->mb_width >= INT_MAX / 16 ||
460 (unsigned)sps->mb_height >= INT_MAX / 16 ||
461 av_image_check_size(16 * sps->mb_width,
462 16 * sps->mb_height, 0, h->avctx)) {
467 sps->frame_mbs_only_flag = get_bits1(&h->gb);
468 if (!sps->frame_mbs_only_flag)
469 sps->mb_aff = get_bits1(&h->gb);
471 sps->mb_aff = 0;
473 sps->direct_8x8_inference_flag = get_bits1(&h->gb);
476 if (sps->mb_aff)
480 sps->crop = get_bits1(&h->gb);
481 if (sps->crop) {
486 int width = 16 * sps->mb_width;
487 int height = 16 * sps->mb_height * (2 - sps->frame_mbs_only_flag);
490 av_log(h->avctx, AV_LOG_DEBUG, "discarding sps cropping, original "
494 sps->crop_left =
495 sps->crop_right =
496 sps->crop_top =
497 sps->crop_bottom = 0;
499 int vsub = (sps->chroma_format_idc == 1) ? 1 : 0;
500 int hsub = (sps->chroma_format_idc == 1 ||
501 sps->chroma_format_idc == 2) ? 1 : 0;
503 int step_y = (2 - sps->frame_mbs_only_flag) << vsub;
505 if (crop_left & (0x1F >> (sps->bit_depth_luma > 8)) &&
507 crop_left &= ~(0x1F >> (sps->bit_depth_luma > 8));
525 sps->crop_left = crop_left * step_x;
526 sps->crop_right = crop_right * step_x;
527 sps->crop_top = crop_top * step_y;
528 sps->crop_bottom = crop_bottom * step_y;
531 sps->crop_left =
532 sps->crop_right =
533 sps->crop_top =
534 sps->crop_bottom =
535 sps->crop = 0;
538 sps->vui_parameters_present_flag = get_bits1(&h->gb);
539 if (sps->vui_parameters_present_flag) {
540 int ret = decode_vui_parameters(h, sps);
545 if (!sps->sar.den)
546 sps->sar.den = 1;
551 "sps:%u profile:%d/%d poc:%d ref:%d %dx%d %s %s crop:%u/%u/%u/%u %s %s %"PRId32"/%"PRId32" b%d reo:%d\n",
552 sps_id, sps->profile_idc, sps->level_idc,
553 sps->poc_type,
554 sps->ref_frame_count,
555 sps->mb_width, sps->mb_height,
556 sps->frame_mbs_only_flag ? "FRM" : (sps->mb_aff ? "MB-AFF" : "PIC-AFF"),
557 sps->direct_8x8_inference_flag ? "8B8" : "",
558 sps->crop_left, sps->crop_right,
559 sps->crop_top, sps->crop_bottom,
560 sps->vui_parameters_present_flag ? "VUI" : "",
561 csp[sps->chroma_format_idc],
562 sps->timing_info_present_flag ? sps->num_units_in_tick : 0,
563 sps->timing_info_present_flag ? sps->time_scale : 0,
564 sps->bit_depth_luma,
565 sps->bitstream_restriction_flag ? sps->num_reorder_frames : -1
568 sps->new = 1;
571 h->sps_buffers[sps_id] = sps;
576 av_free(sps);
591 const SPS *sps = h->sps_buffers[pps->sps_id];
592 int profile_idc = sps->profile_idc;
595 profile_idc == 88) && (sps->constraint_set_flags & 7)) {
608 SPS *sps;
626 sps = h->sps_buffers[pps->sps_id];
627 qp_bd_offset = 6 * (sps->bit_depth_luma - 8);
628 if (sps->bit_depth_luma > 14) {
631 sps->bit_depth_luma);
633 } else if (sps->bit_depth_luma == 11 || sps->bit_depth_luma == 13) {
636 sps->bit_depth_luma);
695 // contents of sps/pps can change even if id doesn't, so reinit
713 build_qp_table(pps, 0, pps->chroma_qp_index_offset[0], sps->bit_depth_luma);
714 build_qp_table(pps, 1, pps->chroma_qp_index_offset[1], sps->bit_depth_luma);
720 "pps:%u sps:%u %s slice_groups:%d ref:%u/%u %s qp:%d/%d/%d/%d %s %s %s %s\n",