MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / decode_vui_parameters

Function decode_vui_parameters

libavcodec/h264_ps.c:133–199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131}
132
133static inline int decode_vui_parameters(GetBitContext *gb, void *logctx,
134 SPS *sps)
135{
136 ff_h2645_decode_common_vui_params(gb, &sps->vui, logctx);
137
138 if (show_bits1(gb) && get_bits_left(gb) < 10) {
139 av_log(logctx, AV_LOG_WARNING, "Truncated VUI (%d)\n", get_bits_left(gb));
140 return 0;
141 }
142
143 sps->timing_info_present_flag = get_bits1(gb);
144 if (sps->timing_info_present_flag) {
145 unsigned num_units_in_tick = get_bits_long(gb, 32);
146 unsigned time_scale = get_bits_long(gb, 32);
147 if (!num_units_in_tick || !time_scale) {
148 av_log(logctx, AV_LOG_ERROR,
149 "time_scale/num_units_in_tick invalid or unsupported (%u/%u)\n",
150 time_scale, num_units_in_tick);
151 sps->timing_info_present_flag = 0;
152 } else {
153 sps->num_units_in_tick = num_units_in_tick;
154 sps->time_scale = time_scale;
155 }
156 sps->fixed_frame_rate_flag = get_bits1(gb);
157 }
158
159 sps->nal_hrd_parameters_present_flag = get_bits1(gb);
160 if (sps->nal_hrd_parameters_present_flag)
161 if (decode_hrd_parameters(gb, logctx, sps) < 0)
162 return AVERROR_INVALIDDATA;
163 sps->vcl_hrd_parameters_present_flag = get_bits1(gb);
164 if (sps->vcl_hrd_parameters_present_flag)
165 if (decode_hrd_parameters(gb, logctx, sps) < 0)
166 return AVERROR_INVALIDDATA;
167 if (sps->nal_hrd_parameters_present_flag ||
168 sps->vcl_hrd_parameters_present_flag)
169 get_bits1(gb); /* low_delay_hrd_flag */
170 sps->pic_struct_present_flag = get_bits1(gb);
171 if (!get_bits_left(gb))
172 return 0;
173 sps->bitstream_restriction_flag = get_bits1(gb);
174 if (sps->bitstream_restriction_flag) {
175 get_bits1(gb); /* motion_vectors_over_pic_boundaries_flag */
176 get_ue_golomb_31(gb); /* max_bytes_per_pic_denom */
177 get_ue_golomb_31(gb); /* max_bits_per_mb_denom */
178 get_ue_golomb_31(gb); /* log2_max_mv_length_horizontal */
179 get_ue_golomb_31(gb); /* log2_max_mv_length_vertical */
180 sps->num_reorder_frames = get_ue_golomb_31(gb);
181 sps->max_dec_frame_buffering = get_ue_golomb_31(gb);
182
183 if (get_bits_left(gb) < 0) {
184 sps->num_reorder_frames = 0;
185 sps->bitstream_restriction_flag = 0;
186 }
187
188 if (sps->num_reorder_frames > 16U
189 /* max_dec_frame_buffering || max_dec_frame_buffering > 16 */) {
190 av_log(logctx, AV_LOG_ERROR,

Callers 1

Calls 8

show_bits1Function · 0.85
get_bits_leftFunction · 0.85
av_logFunction · 0.85
get_bits1Function · 0.85
get_bits_longFunction · 0.85
decode_hrd_parametersFunction · 0.85
get_ue_golomb_31Function · 0.85

Tested by

no test coverage detected