Lines Matching refs:gb
31 static int decode_nal_sei_decoded_picture_hash(HEVCSEIPictureHash *s, GetBitContext *gb) in decode_nal_sei_decoded_picture_hash() argument
37 hash_type = get_bits(gb, 8); in decode_nal_sei_decoded_picture_hash()
43 s->md5[cIdx][i] = get_bits(gb, 8); in decode_nal_sei_decoded_picture_hash()
46 skip_bits(gb, 16); in decode_nal_sei_decoded_picture_hash()
49 skip_bits(gb, 32); in decode_nal_sei_decoded_picture_hash()
55 static int decode_nal_sei_mastering_display_info(HEVCSEIMasteringDisplay *s, GetBitContext *gb) in decode_nal_sei_mastering_display_info() argument
60 s->display_primaries[i][0] = get_bits(gb, 16); in decode_nal_sei_mastering_display_info()
61 s->display_primaries[i][1] = get_bits(gb, 16); in decode_nal_sei_mastering_display_info()
64 s->white_point[0] = get_bits(gb, 16); in decode_nal_sei_mastering_display_info()
65 s->white_point[1] = get_bits(gb, 16); in decode_nal_sei_mastering_display_info()
68 s->max_luminance = get_bits_long(gb, 32); in decode_nal_sei_mastering_display_info()
69 s->min_luminance = get_bits_long(gb, 32); in decode_nal_sei_mastering_display_info()
78 static int decode_nal_sei_content_light_info(HEVCSEIContentLight *s, GetBitContext *gb) in decode_nal_sei_content_light_info() argument
81 s->max_content_light_level = get_bits(gb, 16); in decode_nal_sei_content_light_info()
82 s->max_pic_average_light_level = get_bits(gb, 16); in decode_nal_sei_content_light_info()
90 static int decode_nal_sei_frame_packing_arrangement(HEVCSEIFramePacking *s, GetBitContext *gb) in decode_nal_sei_frame_packing_arrangement() argument
92 get_ue_golomb_long(gb); // frame_packing_arrangement_id in decode_nal_sei_frame_packing_arrangement()
93 s->present = !get_bits1(gb); in decode_nal_sei_frame_packing_arrangement()
96 s->arrangement_type = get_bits(gb, 7); in decode_nal_sei_frame_packing_arrangement()
97 s->quincunx_subsampling = get_bits1(gb); in decode_nal_sei_frame_packing_arrangement()
98 s->content_interpretation_type = get_bits(gb, 6); in decode_nal_sei_frame_packing_arrangement()
101 skip_bits(gb, 3); in decode_nal_sei_frame_packing_arrangement()
102 s->current_frame_is_frame0_flag = get_bits1(gb); in decode_nal_sei_frame_packing_arrangement()
104 skip_bits(gb, 2); in decode_nal_sei_frame_packing_arrangement()
107 skip_bits(gb, 16); // frame[01]_grid_position_[xy] in decode_nal_sei_frame_packing_arrangement()
108 skip_bits(gb, 8); // frame_packing_arrangement_reserved_byte in decode_nal_sei_frame_packing_arrangement()
109 skip_bits1(gb); // frame_packing_arrangement_persistence_flag in decode_nal_sei_frame_packing_arrangement()
111 skip_bits1(gb); // upsampled_aspect_ratio_flag in decode_nal_sei_frame_packing_arrangement()
115 static int decode_nal_sei_display_orientation(HEVCSEIDisplayOrientation *s, GetBitContext *gb) in decode_nal_sei_display_orientation() argument
117 s->present = !get_bits1(gb); in decode_nal_sei_display_orientation()
120 s->hflip = get_bits1(gb); // hor_flip in decode_nal_sei_display_orientation()
121 s->vflip = get_bits1(gb); // ver_flip in decode_nal_sei_display_orientation()
123 s->anticlockwise_rotation = get_bits(gb, 16); in decode_nal_sei_display_orientation()
124 skip_bits1(gb); // display_orientation_persistence_flag in decode_nal_sei_display_orientation()
130 static int decode_nal_sei_pic_timing(HEVCSEI *s, GetBitContext *gb, const HEVCParamSets *ps, in decode_nal_sei_pic_timing() argument
141 int pic_struct = get_bits(gb, 4); in decode_nal_sei_pic_timing()
156 get_bits(gb, 2); // source_scan_type in decode_nal_sei_pic_timing()
157 get_bits(gb, 1); // duplicate_flag in decode_nal_sei_pic_timing()
158 skip_bits1(gb); in decode_nal_sei_pic_timing()
161 skip_bits_long(gb, 8 * size); in decode_nal_sei_pic_timing()
166 static int decode_registered_user_data_closed_caption(HEVCSEIA53Caption *s, GetBitContext *gb, in decode_registered_user_data_closed_caption() argument
174 ret = ff_parse_a53_cc(&s->buf_ref, gb->buffer + get_bits_count(gb) / 8, size); in decode_registered_user_data_closed_caption()
179 skip_bits_long(gb, size * 8); in decode_registered_user_data_closed_caption()
184 static int decode_nal_sei_user_data_unregistered(HEVCSEIUnregistered *s, GetBitContext *gb, in decode_nal_sei_user_data_unregistered() argument
202 buf_ref->data[i] = get_bits(gb, 8); in decode_nal_sei_user_data_unregistered()
211 GetBitContext *gb, int size) in decode_registered_user_data_dynamic_hdr_plus() argument
220 gb->buffer + get_bits_count(gb) / 8, size); in decode_registered_user_data_dynamic_hdr_plus()
233 skip_bits_long(gb, size * 8); in decode_registered_user_data_dynamic_hdr_plus()
238 static int decode_nal_sei_user_data_registered_itu_t_t35(HEVCSEI *s, GetBitContext *gb, in decode_nal_sei_user_data_registered_itu_t_t35() argument
247 country_code = get_bits(gb, 8); in decode_nal_sei_user_data_registered_itu_t_t35()
252 skip_bits(gb, 8); in decode_nal_sei_user_data_registered_itu_t_t35()
263 provider_code = get_bits(gb, 16); in decode_nal_sei_user_data_registered_itu_t_t35()
277 provider_oriented_code = get_bits(gb, 16); in decode_nal_sei_user_data_registered_itu_t_t35()
278 application_identifier = get_bits(gb, 8); in decode_nal_sei_user_data_registered_itu_t_t35()
281 return decode_registered_user_data_dynamic_hdr_plus(&s->dynamic_hdr_plus, gb, size); in decode_nal_sei_user_data_registered_itu_t_t35()
292 user_identifier = get_bits_long(gb, 32); in decode_nal_sei_user_data_registered_itu_t_t35()
295 return decode_registered_user_data_closed_caption(&s->a53_caption, gb, size); in decode_nal_sei_user_data_registered_itu_t_t35()
312 skip_bits_long(gb, size * 8); in decode_nal_sei_user_data_registered_itu_t_t35()
316 static int decode_nal_sei_active_parameter_sets(HEVCSEI *s, GetBitContext *gb, void *logctx) in decode_nal_sei_active_parameter_sets() argument
322 get_bits(gb, 4); // active_video_parameter_set_id in decode_nal_sei_active_parameter_sets()
323 get_bits(gb, 1); // self_contained_cvs_flag in decode_nal_sei_active_parameter_sets()
324 get_bits(gb, 1); // num_sps_ids_minus1 in decode_nal_sei_active_parameter_sets()
325 num_sps_ids_minus1 = get_ue_golomb_long(gb); // num_sps_ids_minus1 in decode_nal_sei_active_parameter_sets()
332 active_seq_parameter_set_id = get_ue_golomb_long(gb); in decode_nal_sei_active_parameter_sets()
340 get_ue_golomb_long(gb); // active_seq_parameter_set_id[i] in decode_nal_sei_active_parameter_sets()
345 static int decode_nal_sei_alternative_transfer(HEVCSEIAlternativeTransfer *s, GetBitContext *gb) in decode_nal_sei_alternative_transfer() argument
348 s->preferred_transfer_characteristics = get_bits(gb, 8); in decode_nal_sei_alternative_transfer()
352 static int decode_nal_sei_timecode(HEVCSEITimeCode *s, GetBitContext *gb) in decode_nal_sei_timecode() argument
354 s->num_clock_ts = get_bits(gb, 2); in decode_nal_sei_timecode()
357 s->clock_timestamp_flag[i] = get_bits(gb, 1); in decode_nal_sei_timecode()
360 s->units_field_based_flag[i] = get_bits(gb, 1); in decode_nal_sei_timecode()
361 s->counting_type[i] = get_bits(gb, 5); in decode_nal_sei_timecode()
362 s->full_timestamp_flag[i] = get_bits(gb, 1); in decode_nal_sei_timecode()
363 s->discontinuity_flag[i] = get_bits(gb, 1); in decode_nal_sei_timecode()
364 s->cnt_dropped_flag[i] = get_bits(gb, 1); in decode_nal_sei_timecode()
366 s->n_frames[i] = get_bits(gb, 9); in decode_nal_sei_timecode()
369 s->seconds_value[i] = av_clip(get_bits(gb, 6), 0, 59); in decode_nal_sei_timecode()
370 s->minutes_value[i] = av_clip(get_bits(gb, 6), 0, 59); in decode_nal_sei_timecode()
371 s->hours_value[i] = av_clip(get_bits(gb, 5), 0, 23); in decode_nal_sei_timecode()
373 s->seconds_flag[i] = get_bits(gb, 1); in decode_nal_sei_timecode()
375 s->seconds_value[i] = av_clip(get_bits(gb, 6), 0, 59); in decode_nal_sei_timecode()
376 s->minutes_flag[i] = get_bits(gb, 1); in decode_nal_sei_timecode()
378 s->minutes_value[i] = av_clip(get_bits(gb, 6), 0, 59); in decode_nal_sei_timecode()
379 s->hours_flag[i] = get_bits(gb, 1); in decode_nal_sei_timecode()
381 s->hours_value[i] = av_clip(get_bits(gb, 5), 0, 23); in decode_nal_sei_timecode()
387 s->time_offset_length[i] = get_bits(gb, 5); in decode_nal_sei_timecode()
389 s->time_offset_value[i] = get_bits_long(gb, s->time_offset_length[i]); in decode_nal_sei_timecode()
399 static int decode_nal_sei_prefix(GetBitContext *gb, void *logctx, HEVCSEI *s, in decode_nal_sei_prefix() argument
404 return decode_nal_sei_decoded_picture_hash(&s->picture_hash, gb); in decode_nal_sei_prefix()
406 return decode_nal_sei_frame_packing_arrangement(&s->frame_packing, gb); in decode_nal_sei_prefix()
408 return decode_nal_sei_display_orientation(&s->display_orientation, gb); in decode_nal_sei_prefix()
410 return decode_nal_sei_pic_timing(s, gb, ps, logctx, size); in decode_nal_sei_prefix()
412 return decode_nal_sei_mastering_display_info(&s->mastering_display, gb); in decode_nal_sei_prefix()
414 return decode_nal_sei_content_light_info(&s->content_light, gb); in decode_nal_sei_prefix()
416 return decode_nal_sei_active_parameter_sets(s, gb, logctx); in decode_nal_sei_prefix()
418 return decode_nal_sei_user_data_registered_itu_t_t35(s, gb, logctx, size); in decode_nal_sei_prefix()
420 return decode_nal_sei_user_data_unregistered(&s->unregistered, gb, size); in decode_nal_sei_prefix()
422 return decode_nal_sei_alternative_transfer(&s->alternative_transfer, gb); in decode_nal_sei_prefix()
424 return decode_nal_sei_timecode(&s->timecode, gb); in decode_nal_sei_prefix()
427 skip_bits_long(gb, 8 * size); in decode_nal_sei_prefix()
432 static int decode_nal_sei_suffix(GetBitContext *gb, void *logctx, HEVCSEI *s, in decode_nal_sei_suffix() argument
437 return decode_nal_sei_decoded_picture_hash(&s->picture_hash, gb); in decode_nal_sei_suffix()
440 skip_bits_long(gb, 8 * size); in decode_nal_sei_suffix()
445 static int decode_nal_sei_message(GetBitContext *gb, void *logctx, HEVCSEI *s, in decode_nal_sei_message() argument
454 if (get_bits_left(gb) < 16 || payload_type > INT_MAX - 255) in decode_nal_sei_message()
456 byte = get_bits(gb, 8); in decode_nal_sei_message()
461 if (get_bits_left(gb) < 8 + 8LL*payload_size) in decode_nal_sei_message()
463 byte = get_bits(gb, 8); in decode_nal_sei_message()
466 if (get_bits_left(gb) < 8LL*payload_size) in decode_nal_sei_message()
469 return decode_nal_sei_prefix(gb, logctx, s, ps, payload_type, payload_size); in decode_nal_sei_message()
471 return decode_nal_sei_suffix(gb, logctx, s, payload_type, payload_size); in decode_nal_sei_message()
475 static int more_rbsp_data(GetBitContext *gb) in more_rbsp_data() argument
477 return get_bits_left(gb) > 0 && show_bits(gb, 8) != 0x80; in more_rbsp_data()
480 int ff_hevc_decode_nal_sei(GetBitContext *gb, void *logctx, HEVCSEI *s, in ff_hevc_decode_nal_sei() argument
486 ret = decode_nal_sei_message(gb, logctx, s, ps, type); in ff_hevc_decode_nal_sei()
489 } while (more_rbsp_data(gb)); in ff_hevc_decode_nal_sei()