Lines Matching refs:gb
106 static inline int decode_hrd_parameters(GetBitContext *gb, void *logctx,
110 cpb_count = get_ue_golomb_31(gb) + 1;
117 get_bits(gb, 4); /* bit_rate_scale */
118 get_bits(gb, 4); /* cpb_size_scale */
120 get_ue_golomb_long(gb); /* bit_rate_value_minus1 */
121 get_ue_golomb_long(gb); /* cpb_size_value_minus1 */
122 get_bits1(gb); /* cbr_flag */
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);
132 static inline int decode_vui_parameters(GetBitContext *gb, void *logctx,
138 aspect_ratio_info_present_flag = get_bits1(gb);
141 aspect_ratio_idc = get_bits(gb, 8);
143 sps->sar.num = get_bits(gb, 16);
144 sps->sar.den = get_bits(gb, 16);
156 if (get_bits1(gb)) /* overscan_info_present_flag */
157 get_bits1(gb); /* overscan_appropriate_flag */
159 sps->video_signal_type_present_flag = get_bits1(gb);
161 get_bits(gb, 3); /* video_format */
162 sps->full_range = get_bits1(gb); /* video_full_range_flag */
164 sps->colour_description_present_flag = get_bits1(gb);
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 */
181 if (get_bits1(gb)) {
183 sps->chroma_location = get_ue_golomb_31(gb) + 1;
184 get_ue_golomb_31(gb); /* chroma_sample_location_type_bottom_field */
188 if (show_bits1(gb) && get_bits_left(gb) < 10) {
189 av_log(logctx, AV_LOG_WARNING, "Truncated VUI (%d)\n", get_bits_left(gb));
193 sps->timing_info_present_flag = get_bits1(gb);
195 unsigned num_units_in_tick = get_bits_long(gb, 32);
196 unsigned time_scale = get_bits_long(gb, 32);
206 sps->fixed_frame_rate_flag = get_bits1(gb);
209 sps->nal_hrd_parameters_present_flag = get_bits1(gb);
211 if (decode_hrd_parameters(gb, logctx, sps) < 0)
213 sps->vcl_hrd_parameters_present_flag = get_bits1(gb);
215 if (decode_hrd_parameters(gb, logctx, sps) < 0)
219 get_bits1(gb); /* low_delay_hrd_flag */
220 sps->pic_struct_present_flag = get_bits1(gb);
221 if (!get_bits_left(gb))
223 sps->bitstream_restriction_flag = get_bits1(gb);
225 get_bits1(gb); /* motion_vectors_over_pic_boundaries_flag */
226 get_ue_golomb_31(gb); /* max_bytes_per_pic_denom */
227 get_ue_golomb_31(gb); /* max_bits_per_mb_denom */
228 get_ue_golomb_31(gb); /* log2_max_mv_length_horizontal */
229 get_ue_golomb_31(gb); /* log2_max_mv_length_vertical */
230 sps->num_reorder_frames = get_ue_golomb_31(gb);
231 get_ue_golomb_31(gb); /*max_dec_frame_buffering*/
233 if (get_bits_left(gb) < 0) {
251 static int decode_scaling_list(GetBitContext *gb, uint8_t *factors, int size,
257 if (!get_bits1(gb)) /* matrix not written, we use the predicted one */
262 int v = get_se_golomb(gb);
279 static int decode_scaling_matrices(GetBitContext *gb, const SPS *sps,
292 if (get_bits1(gb)) {
293 ret |= decode_scaling_list(gb, scaling_matrix4[0], 16, default_scaling4[0], fallback[0]); // Intra, Y
294 ret |= decode_scaling_list(gb, scaling_matrix4[1], 16, default_scaling4[0], scaling_matrix4[0]); // Intra, Cr
295 ret |= decode_scaling_list(gb, scaling_matrix4[2], 16, default_scaling4[0], scaling_matrix4[1]); // Intra, Cb
296 ret |= decode_scaling_list(gb, scaling_matrix4[3], 16, default_scaling4[1], fallback[1]); // Inter, Y
297 ret |= decode_scaling_list(gb, scaling_matrix4[4], 16, default_scaling4[1], scaling_matrix4[3]); // Inter, Cr
298 ret |= decode_scaling_list(gb, scaling_matrix4[5], 16, default_scaling4[1], scaling_matrix4[4]); // Inter, Cb
300 ret |= decode_scaling_list(gb, scaling_matrix8[0], 64, default_scaling8[0], fallback[2]); // Intra, Y
301 ret |= decode_scaling_list(gb, scaling_matrix8[3], 64, default_scaling8[1], fallback[3]); // Inter, Y
303 ret |= decode_scaling_list(gb, scaling_matrix8[1], 64, default_scaling8[0], scaling_matrix8[0]); // Intra, Cr
304 ret |= decode_scaling_list(gb, scaling_matrix8[4], 64, default_scaling8[1], scaling_matrix8[3]); // Inter, Cr
305 ret |= decode_scaling_list(gb, scaling_matrix8[2], 64, default_scaling8[0], scaling_matrix8[1]); // Intra, Cb
306 ret |= decode_scaling_list(gb, scaling_matrix8[5], 64, default_scaling8[1], scaling_matrix8[4]); // Inter, Cb
332 int ff_h264_decode_seq_parameter_set(GetBitContext *gb, AVCodecContext *avctx,
347 sps->data_size = gb->buffer_end - gb->buffer;
352 memcpy(sps->data, gb->buffer, sps->data_size);
355 if (!(gb->size_in_bits & 7) && sps->data_size < sizeof(sps->data))
358 profile_idc = get_bits(gb, 8);
359 constraint_set_flags |= get_bits1(gb) << 0; // constraint_set0_flag
360 constraint_set_flags |= get_bits1(gb) << 1; // constraint_set1_flag
361 constraint_set_flags |= get_bits1(gb) << 2; // constraint_set2_flag
362 constraint_set_flags |= get_bits1(gb) << 3; // constraint_set3_flag
363 constraint_set_flags |= get_bits1(gb) << 4; // constraint_set4_flag
364 constraint_set_flags |= get_bits1(gb) << 5; // constraint_set5_flag
365 skip_bits(gb, 2); // reserved_zero_2bits
366 level_idc = get_bits(gb, 8);
367 sps_id = get_ue_golomb_31(gb);
397 sps->chroma_format_idc = get_ue_golomb_31(gb);
403 sps->residual_color_transform_flag = get_bits1(gb);
409 sps->bit_depth_luma = get_ue_golomb_31(gb) + 8;
410 sps->bit_depth_chroma = get_ue_golomb_31(gb) + 8;
422 sps->transform_bypass = get_bits1(gb);
423 ret = decode_scaling_matrices(gb, sps, NULL, 1,
434 log2_max_frame_num_minus4 = get_ue_golomb_31(gb);
444 sps->poc_type = get_ue_golomb_31(gb);
447 unsigned t = get_ue_golomb_31(gb);
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);
466 sps->poc_cycle_length = get_ue_golomb(gb);
476 sps->offset_for_ref_frame[i] = get_se_golomb_long(gb);
488 sps->ref_frame_count = get_ue_golomb_31(gb);
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);
509 sps->mb_aff = get_bits1(gb);
521 sps->direct_8x8_inference_flag = get_bits1(gb);
523 sps->crop = get_bits1(gb);
525 unsigned int crop_left = get_ue_golomb(gb);
526 unsigned int crop_right = get_ue_golomb(gb);
527 unsigned int crop_top = get_ue_golomb(gb);
528 unsigned int crop_bottom = get_ue_golomb(gb);
572 sps->vui_parameters_present_flag = get_bits1(gb);
574 int ret = decode_vui_parameters(gb, avctx, sps);
579 if (get_bits_left(gb) < 0) {
582 "Overread %s by %d bits\n", sps->vui_parameters_present_flag ? "VUI" : "SPS", -get_bits_left(gb));
747 int ff_h264_decode_picture_parameter_set(GetBitContext *gb, AVCodecContext *avctx,
752 unsigned int pps_id = get_ue_golomb(gb);
773 pps->data_size = gb->buffer_end - gb->buffer;
780 memcpy(pps->data, gb->buffer, pps->data_size);
786 pps->sps_id = get_ue_golomb_31(gb);
815 pps->cabac = get_bits1(gb);
816 pps->pic_order_present = get_bits1(gb);
817 pps->slice_group_count = get_ue_golomb(gb) + 1;
819 pps->mb_slice_group_map_type = get_ue_golomb(gb);
824 pps->ref_count[0] = get_ue_golomb(gb) + 1;
825 pps->ref_count[1] = get_ue_golomb(gb) + 1;
834 pps->weighted_pred = get_bits1(gb);
835 pps->weighted_bipred_idc = get_bits(gb, 2);
836 pps->init_qp = get_se_golomb(gb) + 26U + qp_bd_offset;
837 pps->init_qs = get_se_golomb(gb) + 26U + qp_bd_offset;
838 pps->chroma_qp_index_offset[0] = get_se_golomb(gb);
844 pps->deblocking_filter_parameters_present = get_bits1(gb);
845 pps->constrained_intra_pred = get_bits1(gb);
846 pps->redundant_pic_cnt_present = get_bits1(gb);
854 bits_left = bit_length - get_bits_count(gb);
856 pps->transform_8x8_mode = get_bits1(gb);
857 ret = decode_scaling_matrices(gb, sps, pps, 0,
862 pps->chroma_qp_index_offset[1] = get_se_golomb(gb);