Lines Matching defs:sps
107 SPS *sps)
124 sps->initial_cpb_removal_delay_length = get_bits(gb, 5) + 1;
125 sps->cpb_removal_delay_length = get_bits(gb, 5) + 1;
126 sps->dpb_output_delay_length = get_bits(gb, 5) + 1;
127 sps->time_offset_length = get_bits(gb, 5);
128 sps->cpb_cnt = cpb_count;
133 SPS *sps)
143 sps->sar.num = get_bits(gb, 16);
144 sps->sar.den = get_bits(gb, 16);
146 sps->sar = ff_h264_pixel_aspect[aspect_ratio_idc];
152 sps->sar.num =
153 sps->sar.den = 0;
159 sps->video_signal_type_present_flag = get_bits1(gb);
160 if (sps->video_signal_type_present_flag) {
162 sps->full_range = get_bits1(gb); /* video_full_range_flag */
164 sps->colour_description_present_flag = get_bits1(gb);
165 if (sps->colour_description_present_flag) {
166 sps->color_primaries = get_bits(gb, 8); /* colour_primaries */
167 sps->color_trc = get_bits(gb, 8); /* transfer_characteristics */
168 sps->colorspace = get_bits(gb, 8); /* matrix_coefficients */
171 if (!av_color_primaries_name(sps->color_primaries))
172 sps->color_primaries = AVCOL_PRI_UNSPECIFIED;
173 if (!av_color_transfer_name(sps->color_trc))
174 sps->color_trc = AVCOL_TRC_UNSPECIFIED;
175 if (!av_color_space_name(sps->colorspace))
176 sps->colorspace = AVCOL_SPC_UNSPECIFIED;
183 sps->chroma_location = get_ue_golomb_31(gb) + 1;
186 sps->chroma_location = AVCHROMA_LOC_LEFT;
193 sps->timing_info_present_flag = get_bits1(gb);
194 if (sps->timing_info_present_flag) {
201 sps->timing_info_present_flag = 0;
203 sps->num_units_in_tick = num_units_in_tick;
204 sps->time_scale = time_scale;
206 sps->fixed_frame_rate_flag = get_bits1(gb);
209 sps->nal_hrd_parameters_present_flag = get_bits1(gb);
210 if (sps->nal_hrd_parameters_present_flag)
211 if (decode_hrd_parameters(gb, logctx, sps) < 0)
213 sps->vcl_hrd_parameters_present_flag = get_bits1(gb);
214 if (sps->vcl_hrd_parameters_present_flag)
215 if (decode_hrd_parameters(gb, logctx, sps) < 0)
217 if (sps->nal_hrd_parameters_present_flag ||
218 sps->vcl_hrd_parameters_present_flag)
220 sps->pic_struct_present_flag = get_bits1(gb);
223 sps->bitstream_restriction_flag = get_bits1(gb);
224 if (sps->bitstream_restriction_flag) {
230 sps->num_reorder_frames = get_ue_golomb_31(gb);
234 sps->num_reorder_frames = 0;
235 sps->bitstream_restriction_flag = 0;
238 if (sps->num_reorder_frames > 16U
242 sps->num_reorder_frames);
243 sps->num_reorder_frames = 16;
279 static int decode_scaling_matrices(GetBitContext *gb, const SPS *sps,
284 int fallback_sps = !is_sps && sps->scaling_matrix_present;
286 fallback_sps ? sps->scaling_matrix4[0] : default_scaling4[0],
287 fallback_sps ? sps->scaling_matrix4[3] : default_scaling4[1],
288 fallback_sps ? sps->scaling_matrix8[0] : default_scaling8[0],
289 fallback_sps ? sps->scaling_matrix8[3] : default_scaling8[1]
302 if (sps->chroma_format_idc == 3) {
329 ps->sps = NULL;
339 SPS *sps;
342 sps_buf = av_buffer_allocz(sizeof(*sps));
345 sps = (SPS*)sps_buf->data;
347 sps->data_size = gb->buffer_end - gb->buffer;
348 if (sps->data_size > sizeof(sps->data)) {
350 sps->data_size = sizeof(sps->data);
352 memcpy(sps->data, gb->buffer, sps->data_size);
355 if (!(gb->size_in_bits & 7) && sps->data_size < sizeof(sps->data))
356 sps->data[sps->data_size++] = 0x80;
374 sps->sps_id = sps_id;
375 sps->time_offset_length = 24;
376 sps->profile_idc = profile_idc;
377 sps->constraint_set_flags = constraint_set_flags;
378 sps->level_idc = level_idc;
379 sps->full_range = -1;
381 memset(sps->scaling_matrix4, 16, sizeof(sps->scaling_matrix4));
382 memset(sps->scaling_matrix8, 16, sizeof(sps->scaling_matrix8));
383 sps->scaling_matrix_present = 0;
384 sps->colorspace = 2; //AVCOL_SPC_UNSPECIFIED
386 if (sps->profile_idc == 100 || // High profile
387 sps->profile_idc == 110 || // High10 profile
388 sps->profile_idc == 122 || // High422 profile
389 sps->profile_idc == 244 || // High444 Predictive profile
390 sps->profile_idc == 44 || // Cavlc444 profile
391 sps->profile_idc == 83 || // Scalable Constrained High profile (SVC)
392 sps->profile_idc == 86 || // Scalable High Intra profile (SVC)
393 sps->profile_idc == 118 || // Stereo High profile (MVC)
394 sps->profile_idc == 128 || // Multiview High profile (MVC)
395 sps->profile_idc == 138 || // Multiview Depth High profile (MVCD)
396 sps->profile_idc == 144) { // old High444 profile
397 sps->chroma_format_idc = get_ue_golomb_31(gb);
398 if (sps->chroma_format_idc > 3U) {
400 sps->chroma_format_idc);
402 } else if (sps->chroma_format_idc == 3) {
403 sps->residual_color_transform_flag = get_bits1(gb);
404 if (sps->residual_color_transform_flag) {
409 sps->bit_depth_luma = get_ue_golomb_31(gb) + 8;
410 sps->bit_depth_chroma = get_ue_golomb_31(gb) + 8;
411 if (sps->bit_depth_chroma != sps->bit_depth_luma) {
416 if (sps->bit_depth_luma < 8 || sps->bit_depth_luma > 14 ||
417 sps->bit_depth_chroma < 8 || sps->bit_depth_chroma > 14) {
419 sps->bit_depth_luma, sps->bit_depth_chroma);
422 sps->transform_bypass = get_bits1(gb);
423 ret = decode_scaling_matrices(gb, sps, NULL, 1,
424 sps->scaling_matrix4, sps->scaling_matrix8);
427 sps->scaling_matrix_present |= ret;
429 sps->chroma_format_idc = 1;
430 sps->bit_depth_luma = 8;
431 sps->bit_depth_chroma = 8;
442 sps->log2_max_frame_num = log2_max_frame_num_minus4 + 4;
444 sps->poc_type = get_ue_golomb_31(gb);
446 if (sps->poc_type == 0) { // FIXME #define
452 sps->log2_max_poc_lsb = t + 4;
453 } else if (sps->poc_type == 1) { // FIXME #define
454 sps->delta_pic_order_always_zero_flag = get_bits1(gb);
455 sps->offset_for_non_ref_pic = get_se_golomb_long(gb);
456 sps->offset_for_top_to_bottom_field = get_se_golomb_long(gb);
458 if ( sps->offset_for_non_ref_pic == INT32_MIN
459 || sps->offset_for_top_to_bottom_field == INT32_MIN
466 sps->poc_cycle_length = get_ue_golomb(gb);
468 if ((unsigned)sps->poc_cycle_length >=
469 FF_ARRAY_ELEMS(sps->offset_for_ref_frame)) {
471 "poc_cycle_length overflow %d\n", sps->poc_cycle_length);
475 for (i = 0; i < sps->poc_cycle_length; i++) {
476 sps->offset_for_ref_frame[i] = get_se_golomb_long(gb);
477 if (sps->offset_for_ref_frame[i] == INT32_MIN) {
483 } else if (sps->poc_type != 2) {
484 av_log(avctx, AV_LOG_ERROR, "illegal POC type %d\n", sps->poc_type);
488 sps->ref_frame_count = get_ue_golomb_31(gb);
490 sps->ref_frame_count = FFMAX(2, sps->ref_frame_count);
491 if (sps->ref_frame_count > H264_MAX_DPB_FRAMES) {
493 "too many reference frames %d\n", sps->ref_frame_count);
496 sps->gaps_in_frame_num_allowed_flag = get_bits1(gb);
497 sps->mb_width = get_ue_golomb(gb) + 1;
498 sps->mb_height = get_ue_golomb(gb) + 1;
500 sps->frame_mbs_only_flag = get_bits1(gb);
502 if (sps->mb_height >= INT_MAX / 2U) {
506 sps->mb_height *= 2 - sps->frame_mbs_only_flag;
508 if (!sps->frame_mbs_only_flag)
509 sps->mb_aff = get_bits1(gb);
511 sps->mb_aff = 0;
513 if ((unsigned)sps->mb_width >= INT_MAX / 16 ||
514 (unsigned)sps->mb_height >= INT_MAX / 16 ||
515 av_image_check_size(16 * sps->mb_width,
516 16 * sps->mb_height, 0, avctx)) {
521 sps->direct_8x8_inference_flag = get_bits1(gb);
523 sps->crop = get_bits1(gb);
524 if (sps->crop) {
529 int width = 16 * sps->mb_width;
530 int height = 16 * sps->mb_height;
533 av_log(avctx, AV_LOG_DEBUG, "discarding sps cropping, original "
537 sps->crop_left =
538 sps->crop_right =
539 sps->crop_top =
540 sps->crop_bottom = 0;
542 int vsub = (sps->chroma_format_idc == 1) ? 1 : 0;
543 int hsub = (sps->chroma_format_idc == 1 ||
544 sps->chroma_format_idc == 2) ? 1 : 0;
546 int step_y = (2 - sps->frame_mbs_only_flag) << vsub;
559 sps->crop_left = crop_left * step_x;
560 sps->crop_right = crop_right * step_x;
561 sps->crop_top = crop_top * step_y;
562 sps->crop_bottom = crop_bottom * step_y;
565 sps->crop_left =
566 sps->crop_right =
567 sps->crop_top =
568 sps->crop_bottom =
569 sps->crop = 0;
572 sps->vui_parameters_present_flag = get_bits1(gb);
573 if (sps->vui_parameters_present_flag) {
574 int ret = decode_vui_parameters(gb, avctx, sps);
581 &ps->overread_warning_printed[sps->vui_parameters_present_flag],
582 "Overread %s by %d bits\n", sps->vui_parameters_present_flag ? "VUI" : "SPS", -get_bits_left(gb));
589 if (!sps->bitstream_restriction_flag &&
590 (sps->ref_frame_count || avctx->strict_std_compliance >= FF_COMPLIANCE_STRICT)) {
591 sps->num_reorder_frames = H264_MAX_DPB_FRAMES - 1;
593 if (level_max_dpb_mbs[i][0] == sps->level_idc) {
594 sps->num_reorder_frames = FFMIN(level_max_dpb_mbs[i][1] / (sps->mb_width * sps->mb_height),
595 sps->num_reorder_frames);
601 if (!sps->sar.den)
602 sps->sar.den = 1;
607 "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",
608 sps_id, sps->profile_idc, sps->level_idc,
609 sps->poc_type,
610 sps->ref_frame_count,
611 sps->mb_width, sps->mb_height,
612 sps->frame_mbs_only_flag ? "FRM" : (sps->mb_aff ? "MB-AFF" : "PIC-AFF"),
613 sps->direct_8x8_inference_flag ? "8B8" : "",
614 sps->crop_left, sps->crop_right,
615 sps->crop_top, sps->crop_bottom,
616 sps->vui_parameters_present_flag ? "VUI" : "",
617 csp[sps->chroma_format_idc],
618 sps->timing_info_present_flag ? sps->num_units_in_tick : 0,
619 sps->timing_info_present_flag ? sps->time_scale : 0,
620 sps->bit_depth_luma,
621 sps->bitstream_restriction_flag ? sps->num_reorder_frames : -1
643 static void init_dequant8_coeff_table(PPS *pps, const SPS *sps)
646 const int max_qp = 51 + 6 * (sps->bit_depth_luma - 8);
670 static void init_dequant4_coeff_table(PPS *pps, const SPS *sps)
673 const int max_qp = 51 + 6 * (sps->bit_depth_luma - 8);
696 static void init_dequant_tables(PPS *pps, const SPS *sps)
699 init_dequant4_coeff_table(pps, sps);
703 init_dequant8_coeff_table(pps, sps);
704 if (sps->transform_bypass) {
724 static int more_rbsp_data_in_pps(const SPS *sps, void *logctx)
726 int profile_idc = sps->profile_idc;
729 profile_idc == 88) && (sps->constraint_set_flags & 7)) {
751 const SPS *sps;
798 pps->sps = (const SPS*)pps->sps_ref->data;
799 sps = pps->sps;
801 if (sps->bit_depth_luma > 14) {
804 sps->bit_depth_luma);
807 } else if (sps->bit_depth_luma == 11 || sps->bit_depth_luma == 13) {
810 sps->bit_depth_luma);
832 qp_bd_offset = 6 * (sps->bit_depth_luma - 8);
849 memcpy(pps->scaling_matrix4, sps->scaling_matrix4,
851 memcpy(pps->scaling_matrix8, sps->scaling_matrix8,
855 if (bits_left > 0 && more_rbsp_data_in_pps(sps, avctx)) {
857 ret = decode_scaling_matrices(gb, sps, pps, 0,
872 sps->bit_depth_luma);
874 sps->bit_depth_luma);
876 init_dequant_tables(pps, sps);
883 "pps:%u sps:%u %s slice_groups:%d ref:%u/%u %s qp:%d/%d/%d/%d %s %s %s %s\n",