23 fixed(1, rbsp_stop_one_bit, 1);
25 fixed(1, rbsp_alignment_zero_bit, 0);
32 int expected_nal_unit_type)
36 u(1, forbidden_zero_bit, 0, 0);
38 if (expected_nal_unit_type >= 0)
39 u(6, nal_unit_type, expected_nal_unit_type,
40 expected_nal_unit_type);
42 u(6, nal_unit_type, 0, 63);
44 u(6, nuh_layer_id, 0, 62);
45 u(3, nuh_temporal_id_plus1, 1, 7);
54 fixed(1, alignment_bit_equal_to_one, 1);
56 fixed(1, alignment_bit_equal_to_zero, 0);
72 current->bit_length = k;
75 allocate(current->data, (current->bit_length + 7) / 8);
76 for (k = 0; k < current->bit_length; k++) {
78 current->data[k / 8] |= bit << (7 - k % 8);
82 for (k = 0; k < current->bit_length; k++)
90 int profile_present_flag,
91 int max_num_sub_layers_minus1)
95 if (profile_present_flag) {
96 u(2, general_profile_space, 0, 0);
97 flag(general_tier_flag);
98 u(5, general_profile_idc, 0, 31);
100 for (j = 0; j < 32; j++)
101 flags(general_profile_compatibility_flag[j], 1, j);
103 flag(general_progressive_source_flag);
104 flag(general_interlaced_source_flag);
105 flag(general_non_packed_constraint_flag);
106 flag(general_frame_only_constraint_flag);
108 #define profile_compatible(x) (current->general_profile_idc == (x) || \
109 current->general_profile_compatibility_flag[x])
114 flag(general_max_12bit_constraint_flag);
115 flag(general_max_10bit_constraint_flag);
116 flag(general_max_8bit_constraint_flag);
117 flag(general_max_422chroma_constraint_flag);
118 flag(general_max_420chroma_constraint_flag);
119 flag(general_max_monochrome_constraint_flag);
120 flag(general_intra_constraint_flag);
121 flag(general_one_picture_only_constraint_flag);
122 flag(general_lower_bit_rate_constraint_flag);
126 flag(general_max_14bit_constraint_flag);
127 fixed(24, general_reserved_zero_33bits, 0);
128 fixed( 9, general_reserved_zero_33bits, 0);
130 fixed(24, general_reserved_zero_34bits, 0);
131 fixed(10, general_reserved_zero_34bits, 0);
134 fixed(7, general_reserved_zero_7bits, 0);
135 flag(general_one_picture_only_constraint_flag);
136 fixed(24, general_reserved_zero_35bits, 0);
137 fixed(11, general_reserved_zero_35bits, 0);
139 fixed(24, general_reserved_zero_43bits, 0);
140 fixed(19, general_reserved_zero_43bits, 0);
146 flag(general_inbld_flag);
148 fixed(1, general_reserved_zero_bit, 0);
150 #undef profile_compatible
153 u(8, general_level_idc, 0, 255);
155 for (i = 0; i < max_num_sub_layers_minus1; i++) {
156 flags(sub_layer_profile_present_flag[i], 1, i);
157 flags(sub_layer_level_present_flag[i], 1, i);
160 if (max_num_sub_layers_minus1 > 0) {
161 for (i = max_num_sub_layers_minus1; i < 8; i++)
162 fixed(2, reserved_zero_2bits, 0);
165 for (i = 0; i < max_num_sub_layers_minus1; i++) {
166 if (current->sub_layer_profile_present_flag[i])
168 if (current->sub_layer_level_present_flag[i])
177 int nal,
int sub_layer_id)
183 current = &hrd->nal_sub_layer_hrd_parameters[sub_layer_id];
185 current = &hrd->vcl_sub_layer_hrd_parameters[sub_layer_id];
187 for (i = 0; i <= hrd->cpb_cnt_minus1[sub_layer_id]; i++) {
188 ues(bit_rate_value_minus1[i], 0, UINT32_MAX - 1, 1, i);
189 ues(cpb_size_value_minus1[i], 0, UINT32_MAX - 1, 1, i);
190 if (hrd->sub_pic_hrd_params_present_flag) {
191 ues(cpb_size_du_value_minus1[i], 0, UINT32_MAX - 1, 1, i);
192 ues(bit_rate_du_value_minus1[i], 0, UINT32_MAX - 1, 1, i);
194 flags(cbr_flag[i], 1, i);
202 int max_num_sub_layers_minus1)
206 if (common_inf_present_flag) {
207 flag(nal_hrd_parameters_present_flag);
208 flag(vcl_hrd_parameters_present_flag);
210 if (current->nal_hrd_parameters_present_flag ||
211 current->vcl_hrd_parameters_present_flag) {
212 flag(sub_pic_hrd_params_present_flag);
213 if (current->sub_pic_hrd_params_present_flag) {
214 u(8, tick_divisor_minus2, 0, 255);
215 u(5, du_cpb_removal_delay_increment_length_minus1, 0, 31);
216 flag(sub_pic_cpb_params_in_pic_timing_sei_flag);
217 u(5, dpb_output_delay_du_length_minus1, 0, 31);
220 u(4, bit_rate_scale, 0, 15);
221 u(4, cpb_size_scale, 0, 15);
222 if (current->sub_pic_hrd_params_present_flag)
223 u(4, cpb_size_du_scale, 0, 15);
225 u(5, initial_cpb_removal_delay_length_minus1, 0, 31);
226 u(5, au_cpb_removal_delay_length_minus1, 0, 31);
227 u(5, dpb_output_delay_length_minus1, 0, 31);
229 infer(sub_pic_hrd_params_present_flag, 0);
231 infer(initial_cpb_removal_delay_length_minus1, 23);
232 infer(au_cpb_removal_delay_length_minus1, 23);
233 infer(dpb_output_delay_length_minus1, 23);
237 for (i = 0; i <= max_num_sub_layers_minus1; i++) {
238 flags(fixed_pic_rate_general_flag[i], 1, i);
240 if (!current->fixed_pic_rate_general_flag[i])
241 flags(fixed_pic_rate_within_cvs_flag[i], 1, i);
243 infer(fixed_pic_rate_within_cvs_flag[i], 1);
245 if (current->fixed_pic_rate_within_cvs_flag[i]) {
246 ues(elemental_duration_in_tc_minus1[i], 0, 2047, 1, i);
247 infer(low_delay_hrd_flag[i], 0);
249 flags(low_delay_hrd_flag[i], 1, i);
251 if (!current->low_delay_hrd_flag[i])
252 ues(cpb_cnt_minus1[i], 0, 31, 1, i);
254 infer(cpb_cnt_minus1[i], 0);
256 if (current->nal_hrd_parameters_present_flag)
258 if (current->vcl_hrd_parameters_present_flag)
270 flag(aspect_ratio_info_present_flag);
271 if (current->aspect_ratio_info_present_flag) {
272 u(8, aspect_ratio_idc, 0, 255);
273 if (current->aspect_ratio_idc == 255) {
274 u(16, sar_width, 0, 65535);
275 u(16, sar_height, 0, 65535);
278 infer(aspect_ratio_idc, 0);
281 flag(overscan_info_present_flag);
282 if (current->overscan_info_present_flag)
283 flag(overscan_appropriate_flag);
285 flag(video_signal_type_present_flag);
286 if (current->video_signal_type_present_flag) {
287 u(3, video_format, 0, 7);
288 flag(video_full_range_flag);
289 flag(colour_description_present_flag);
290 if (current->colour_description_present_flag) {
291 u(8, colour_primaries, 0, 255);
293 u(8, matrix_coefficients, 0, 255);
295 infer(colour_primaries, 2);
297 infer(matrix_coefficients, 2);
300 infer(video_format, 5);
301 infer(video_full_range_flag, 0);
302 infer(colour_primaries, 2);
304 infer(matrix_coefficients, 2);
307 flag(chroma_loc_info_present_flag);
308 if (current->chroma_loc_info_present_flag) {
309 ue(chroma_sample_loc_type_top_field, 0, 5);
310 ue(chroma_sample_loc_type_bottom_field, 0, 5);
312 infer(chroma_sample_loc_type_top_field, 0);
313 infer(chroma_sample_loc_type_bottom_field, 0);
316 flag(neutral_chroma_indication_flag);
317 flag(field_seq_flag);
318 flag(frame_field_info_present_flag);
320 flag(default_display_window_flag);
321 if (current->default_display_window_flag) {
322 ue(def_disp_win_left_offset, 0, 16384);
323 ue(def_disp_win_right_offset, 0, 16384);
324 ue(def_disp_win_top_offset, 0, 16384);
325 ue(def_disp_win_bottom_offset, 0, 16384);
328 flag(vui_timing_info_present_flag);
329 if (current->vui_timing_info_present_flag) {
330 u(32, vui_num_units_in_tick, 1, UINT32_MAX);
331 u(32, vui_time_scale, 1, UINT32_MAX);
332 flag(vui_poc_proportional_to_timing_flag);
333 if (current->vui_poc_proportional_to_timing_flag)
334 ue(vui_num_ticks_poc_diff_one_minus1, 0, UINT32_MAX - 1);
336 flag(vui_hrd_parameters_present_flag);
337 if (current->vui_hrd_parameters_present_flag) {
339 1,
sps->sps_max_sub_layers_minus1));
343 flag(bitstream_restriction_flag);
344 if (current->bitstream_restriction_flag) {
345 flag(tiles_fixed_structure_flag);
346 flag(motion_vectors_over_pic_boundaries_flag);
347 flag(restricted_ref_pic_lists_flag);
348 ue(min_spatial_segmentation_idc, 0, 4095);
349 ue(max_bytes_per_pic_denom, 0, 16);
350 ue(max_bits_per_min_cu_denom, 0, 16);
351 ue(log2_max_mv_length_horizontal, 0, 16);
352 ue(log2_max_mv_length_vertical, 0, 16);
354 infer(tiles_fixed_structure_flag, 0);
355 infer(motion_vectors_over_pic_boundaries_flag, 1);
356 infer(min_spatial_segmentation_idc, 0);
357 infer(max_bytes_per_pic_denom, 2);
358 infer(max_bits_per_min_cu_denom, 1);
359 infer(log2_max_mv_length_horizontal, 15);
360 infer(log2_max_mv_length_vertical, 15);
371 HEADER(
"Video Parameter Set");
375 u(4, vps_video_parameter_set_id, 0, 15);
377 flag(vps_base_layer_internal_flag);
378 flag(vps_base_layer_available_flag);
381 flag(vps_temporal_id_nesting_flag);
383 if (current->vps_max_sub_layers_minus1 == 0 &&
384 current->vps_temporal_id_nesting_flag != 1) {
386 "vps_temporal_id_nesting_flag must be 1 if "
387 "vps_max_sub_layers_minus1 is 0.\n");
391 fixed(16, vps_reserved_0xffff_16bits, 0xffff);
394 1, current->vps_max_sub_layers_minus1));
396 flag(vps_sub_layer_ordering_info_present_flag);
397 for (i = (current->vps_sub_layer_ordering_info_present_flag ?
398 0 : current->vps_max_sub_layers_minus1);
399 i <= current->vps_max_sub_layers_minus1; i++) {
400 ues(vps_max_dec_pic_buffering_minus1[i],
402 ues(vps_max_num_reorder_pics[i],
403 0, current->vps_max_dec_pic_buffering_minus1[i], 1, i);
404 ues(vps_max_latency_increase_plus1[i],
405 0, UINT32_MAX - 1, 1, i);
407 if (!current->vps_sub_layer_ordering_info_present_flag) {
408 for (i = 0; i < current->vps_max_sub_layers_minus1; i++) {
409 infer(vps_max_dec_pic_buffering_minus1[i],
410 current->vps_max_dec_pic_buffering_minus1[current->vps_max_sub_layers_minus1]);
411 infer(vps_max_num_reorder_pics[i],
412 current->vps_max_num_reorder_pics[current->vps_max_sub_layers_minus1]);
413 infer(vps_max_latency_increase_plus1[i],
414 current->vps_max_latency_increase_plus1[current->vps_max_sub_layers_minus1]);
420 for (i = 1; i <= current->vps_num_layer_sets_minus1; i++) {
421 for (j = 0; j <= current->vps_max_layer_id; j++)
422 flags(layer_id_included_flag[i][j], 2, i, j);
424 for (j = 0; j <= current->vps_max_layer_id; j++)
425 infer(layer_id_included_flag[0][j], j == 0);
427 flag(vps_timing_info_present_flag);
428 if (current->vps_timing_info_present_flag) {
429 u(32, vps_num_units_in_tick, 1, UINT32_MAX);
430 u(32, vps_time_scale, 1, UINT32_MAX);
431 flag(vps_poc_proportional_to_timing_flag);
432 if (current->vps_poc_proportional_to_timing_flag)
433 ue(vps_num_ticks_poc_diff_one_minus1, 0, UINT32_MAX - 1);
434 ue(vps_num_hrd_parameters, 0, current->vps_num_layer_sets_minus1 + 1);
435 for (i = 0; i < current->vps_num_hrd_parameters; i++) {
436 ues(hrd_layer_set_idx[i],
437 current->vps_base_layer_internal_flag ? 0 : 1,
438 current->vps_num_layer_sets_minus1, 1, i);
440 flags(cprms_present_flag[i], 1, i);
442 infer(cprms_present_flag[0], 1);
445 current->cprms_present_flag[i],
446 current->vps_max_sub_layers_minus1));
450 flag(vps_extension_flag);
451 if (current->vps_extension_flag)
466 flag(inter_ref_pic_set_prediction_flag);
468 infer(inter_ref_pic_set_prediction_flag, 0);
470 if (current->inter_ref_pic_set_prediction_flag) {
471 unsigned int ref_rps_idx, num_delta_pocs;
473 int delta_rps, d_poc;
479 if (st_rps_idx ==
sps->num_short_term_ref_pic_sets)
480 ue(delta_idx_minus1, 0, st_rps_idx - 1);
482 infer(delta_idx_minus1, 0);
484 ref_rps_idx = st_rps_idx - (current->delta_idx_minus1 + 1);
485 ref = &
sps->st_ref_pic_set[ref_rps_idx];
486 num_delta_pocs = ref->num_negative_pics + ref->num_positive_pics;
488 flag(delta_rps_sign);
489 ue(abs_delta_rps_minus1, 0, INT16_MAX);
490 delta_rps = (1 - 2 * current->delta_rps_sign) *
491 (current->abs_delta_rps_minus1 + 1);
493 for (j = 0; j <= num_delta_pocs; j++) {
494 flags(used_by_curr_pic_flag[j], 1, j);
495 if (!current->used_by_curr_pic_flag[j])
496 flags(use_delta_flag[j], 1, j);
498 infer(use_delta_flag[j], 1);
518 for (i = 0; i < ref->num_negative_pics; i++) {
519 d_poc -= ref->delta_poc_s0_minus1[i] + 1;
520 ref_delta_poc_s0[i] = d_poc;
523 for (i = 0; i < ref->num_positive_pics; i++) {
524 d_poc += ref->delta_poc_s1_minus1[i] + 1;
525 ref_delta_poc_s1[i] = d_poc;
529 for (j = ref->num_positive_pics - 1; j >= 0; j--) {
530 d_poc = ref_delta_poc_s1[j] + delta_rps;
531 if (d_poc < 0 && current->use_delta_flag[ref->num_negative_pics + j]) {
532 delta_poc_s0[i] = d_poc;
533 used_by_curr_pic_s0[i++] =
534 current->used_by_curr_pic_flag[ref->num_negative_pics + j];
537 if (delta_rps < 0 && current->use_delta_flag[num_delta_pocs]) {
538 delta_poc_s0[i] = delta_rps;
539 used_by_curr_pic_s0[i++] =
540 current->used_by_curr_pic_flag[num_delta_pocs];
542 for (j = 0; j < ref->num_negative_pics; j++) {
543 d_poc = ref_delta_poc_s0[j] + delta_rps;
544 if (d_poc < 0 && current->use_delta_flag[j]) {
545 delta_poc_s0[i] = d_poc;
546 used_by_curr_pic_s0[i++] = current->used_by_curr_pic_flag[j];
550 infer(num_negative_pics, i);
551 for (i = 0; i < current->num_negative_pics; i++) {
552 infer(delta_poc_s0_minus1[i],
553 -(delta_poc_s0[i] - (i == 0 ? 0 : delta_poc_s0[i - 1])) - 1);
554 infer(used_by_curr_pic_s0_flag[i], used_by_curr_pic_s0[i]);
558 for (j = ref->num_negative_pics - 1; j >= 0; j--) {
559 d_poc = ref_delta_poc_s0[j] + delta_rps;
560 if (d_poc > 0 && current->use_delta_flag[j]) {
561 delta_poc_s1[i] = d_poc;
562 used_by_curr_pic_s1[i++] = current->used_by_curr_pic_flag[j];
565 if (delta_rps > 0 && current->use_delta_flag[num_delta_pocs]) {
566 delta_poc_s1[i] = delta_rps;
567 used_by_curr_pic_s1[i++] =
568 current->used_by_curr_pic_flag[num_delta_pocs];
570 for (j = 0; j < ref->num_positive_pics; j++) {
571 d_poc = ref_delta_poc_s1[j] + delta_rps;
572 if (d_poc > 0 && current->use_delta_flag[ref->num_negative_pics + j]) {
573 delta_poc_s1[i] = d_poc;
574 used_by_curr_pic_s1[i++] =
575 current->used_by_curr_pic_flag[ref->num_negative_pics + j];
579 infer(num_positive_pics, i);
580 for (i = 0; i < current->num_positive_pics; i++) {
581 infer(delta_poc_s1_minus1[i],
582 delta_poc_s1[i] - (i == 0 ? 0 : delta_poc_s1[i - 1]) - 1);
583 infer(used_by_curr_pic_s1_flag[i], used_by_curr_pic_s1[i]);
587 ue(num_negative_pics, 0, 15);
588 ue(num_positive_pics, 0, 15 - current->num_negative_pics);
590 for (i = 0; i < current->num_negative_pics; i++) {
591 ues(delta_poc_s0_minus1[i], 0, INT16_MAX, 1, i);
592 flags(used_by_curr_pic_s0_flag[i], 1, i);
595 for (i = 0; i < current->num_positive_pics; i++) {
596 ues(delta_poc_s1_minus1[i], 0, INT16_MAX, 1, i);
597 flags(used_by_curr_pic_s1_flag[i], 1, i);
607 int sizeId, matrixId;
610 for (sizeId = 0; sizeId < 4; sizeId++) {
611 for (matrixId = 0; matrixId < 6; matrixId += (sizeId == 3 ? 3 : 1)) {
612 flags(scaling_list_pred_mode_flag[sizeId][matrixId],
613 2, sizeId, matrixId);
614 if (!current->scaling_list_pred_mode_flag[sizeId][matrixId]) {
615 ues(scaling_list_pred_matrix_id_delta[sizeId][matrixId],
616 0, sizeId == 3 ? matrixId / 3 : matrixId,
617 2, sizeId, matrixId);
619 n =
FFMIN(64, 1 << (4 + (sizeId << 1)));
621 ses(scaling_list_dc_coef_minus8[sizeId - 2][matrixId], -7, +247,
622 2, sizeId - 2, matrixId);
624 for (i = 0; i <
n; i++) {
625 ses(scaling_list_delta_coeff[sizeId][matrixId][i],
626 -128, +127, 3, sizeId, matrixId, i);
640 flag(transform_skip_rotation_enabled_flag);
641 flag(transform_skip_context_enabled_flag);
642 flag(implicit_rdpcm_enabled_flag);
643 flag(explicit_rdpcm_enabled_flag);
644 flag(extended_precision_processing_flag);
645 flag(intra_smoothing_disabled_flag);
646 flag(high_precision_offsets_enabled_flag);
647 flag(persistent_rice_adaptation_enabled_flag);
648 flag(cabac_bypass_alignment_enabled_flag);
658 flag(sps_curr_pic_ref_enabled_flag);
660 flag(palette_mode_enabled_flag);
661 if (current->palette_mode_enabled_flag) {
662 ue(palette_max_size, 0, 64);
663 ue(delta_palette_max_predictor_size, 0, 128);
665 flag(sps_palette_predictor_initializer_present_flag);
666 if (current->sps_palette_predictor_initializer_present_flag) {
667 ue(sps_num_palette_predictor_initializer_minus1, 0, 128);
668 for (comp = 0; comp < (current->chroma_format_idc ? 3 : 1); comp++) {
669 int bit_depth = comp == 0 ? current->bit_depth_luma_minus8 + 8
670 : current->bit_depth_chroma_minus8 + 8;
671 for (i = 0; i <= current->sps_num_palette_predictor_initializer_minus1; i++)
672 us(bit_depth, sps_palette_predictor_initializers[comp][i],
678 u(2, motion_vector_resolution_control_idc, 0, 2);
679 flag(intra_boundary_filtering_disable_flag);
690 unsigned int min_cb_log2_size_y, ctb_log2_size_y,
691 min_cb_size_y, min_tb_log2_size_y;
693 HEADER(
"Sequence Parameter Set");
697 u(4, sps_video_parameter_set_id, 0, 15);
698 h265->
active_vps = vps = h265->
vps[current->sps_video_parameter_set_id];
701 flag(sps_temporal_id_nesting_flag);
705 "sps_max_sub_layers_minus1 (%d) must be less than or equal to "
706 "vps_max_sub_layers_minus1 (%d).\n",
708 current->sps_max_sub_layers_minus1);
712 !current->sps_temporal_id_nesting_flag) {
714 "sps_temporal_id_nesting_flag must be 1 if "
715 "vps_temporal_id_nesting_flag is 1.\n");
721 1, current->sps_max_sub_layers_minus1));
723 ue(sps_seq_parameter_set_id, 0, 15);
725 ue(chroma_format_idc, 0, 3);
726 if (current->chroma_format_idc == 3)
727 flag(separate_colour_plane_flag);
729 infer(separate_colour_plane_flag, 0);
734 flag(conformance_window_flag);
735 if (current->conformance_window_flag) {
736 ue(conf_win_left_offset, 0, current->pic_width_in_luma_samples);
737 ue(conf_win_right_offset, 0, current->pic_width_in_luma_samples);
738 ue(conf_win_top_offset, 0, current->pic_height_in_luma_samples);
739 ue(conf_win_bottom_offset, 0, current->pic_height_in_luma_samples);
741 infer(conf_win_left_offset, 0);
742 infer(conf_win_right_offset, 0);
743 infer(conf_win_top_offset, 0);
744 infer(conf_win_bottom_offset, 0);
747 ue(bit_depth_luma_minus8, 0, 8);
748 ue(bit_depth_chroma_minus8, 0, 8);
750 ue(log2_max_pic_order_cnt_lsb_minus4, 0, 12);
752 flag(sps_sub_layer_ordering_info_present_flag);
753 for (i = (current->sps_sub_layer_ordering_info_present_flag ?
754 0 : current->sps_max_sub_layers_minus1);
755 i <= current->sps_max_sub_layers_minus1; i++) {
756 ues(sps_max_dec_pic_buffering_minus1[i],
758 ues(sps_max_num_reorder_pics[i],
759 0, current->sps_max_dec_pic_buffering_minus1[i], 1, i);
760 ues(sps_max_latency_increase_plus1[i],
761 0, UINT32_MAX - 1, 1, i);
763 if (!current->sps_sub_layer_ordering_info_present_flag) {
764 for (i = 0; i < current->sps_max_sub_layers_minus1; i++) {
765 infer(sps_max_dec_pic_buffering_minus1[i],
766 current->sps_max_dec_pic_buffering_minus1[current->sps_max_sub_layers_minus1]);
767 infer(sps_max_num_reorder_pics[i],
768 current->sps_max_num_reorder_pics[current->sps_max_sub_layers_minus1]);
769 infer(sps_max_latency_increase_plus1[i],
770 current->sps_max_latency_increase_plus1[current->sps_max_sub_layers_minus1]);
774 ue(log2_min_luma_coding_block_size_minus3, 0, 3);
775 min_cb_log2_size_y = current->log2_min_luma_coding_block_size_minus3 + 3;
777 ue(log2_diff_max_min_luma_coding_block_size, 0, 3);
778 ctb_log2_size_y = min_cb_log2_size_y +
779 current->log2_diff_max_min_luma_coding_block_size;
781 min_cb_size_y = 1 << min_cb_log2_size_y;
782 if (current->pic_width_in_luma_samples % min_cb_size_y ||
783 current->pic_height_in_luma_samples % min_cb_size_y) {
785 "by MinCbSizeY = %u.\n", current->pic_width_in_luma_samples,
786 current->pic_height_in_luma_samples, min_cb_size_y);
790 ue(log2_min_luma_transform_block_size_minus2, 0, min_cb_log2_size_y - 3);
791 min_tb_log2_size_y = current->log2_min_luma_transform_block_size_minus2 + 2;
793 ue(log2_diff_max_min_luma_transform_block_size,
794 0,
FFMIN(ctb_log2_size_y, 5) - min_tb_log2_size_y);
796 ue(max_transform_hierarchy_depth_inter,
797 0, ctb_log2_size_y - min_tb_log2_size_y);
798 ue(max_transform_hierarchy_depth_intra,
799 0, ctb_log2_size_y - min_tb_log2_size_y);
801 flag(scaling_list_enabled_flag);
802 if (current->scaling_list_enabled_flag) {
803 flag(sps_scaling_list_data_present_flag);
804 if (current->sps_scaling_list_data_present_flag)
807 infer(sps_scaling_list_data_present_flag, 0);
810 flag(amp_enabled_flag);
811 flag(sample_adaptive_offset_enabled_flag);
813 flag(pcm_enabled_flag);
814 if (current->pcm_enabled_flag) {
815 u(4, pcm_sample_bit_depth_luma_minus1,
816 0, current->bit_depth_luma_minus8 + 8 - 1);
817 u(4, pcm_sample_bit_depth_chroma_minus1,
818 0, current->bit_depth_chroma_minus8 + 8 - 1);
820 ue(log2_min_pcm_luma_coding_block_size_minus3,
821 FFMIN(min_cb_log2_size_y, 5) - 3,
FFMIN(ctb_log2_size_y, 5) - 3);
822 ue(log2_diff_max_min_pcm_luma_coding_block_size,
823 0,
FFMIN(ctb_log2_size_y, 5) - (current->log2_min_pcm_luma_coding_block_size_minus3 + 3));
825 flag(pcm_loop_filter_disabled_flag);
829 for (i = 0; i < current->num_short_term_ref_pic_sets; i++)
832 flag(long_term_ref_pics_present_flag);
833 if (current->long_term_ref_pics_present_flag) {
835 for (i = 0; i < current->num_long_term_ref_pics_sps; i++) {
836 us(current->log2_max_pic_order_cnt_lsb_minus4 + 4,
837 lt_ref_pic_poc_lsb_sps[i],
838 0,
MAX_UINT_BITS(current->log2_max_pic_order_cnt_lsb_minus4 + 4), 1, i);
839 flags(used_by_curr_pic_lt_sps_flag[i], 1, i);
843 flag(sps_temporal_mvp_enabled_flag);
844 flag(strong_intra_smoothing_enabled_flag);
846 flag(vui_parameters_present_flag);
847 if (current->vui_parameters_present_flag)
850 flag(sps_extension_present_flag);
851 if (current->sps_extension_present_flag) {
852 flag(sps_range_extension_flag);
853 flag(sps_multilayer_extension_flag);
854 flag(sps_3d_extension_flag);
855 flag(sps_scc_extension_flag);
859 if (current->sps_range_extension_flag)
861 if (current->sps_multilayer_extension_flag)
863 if (current->sps_3d_extension_flag)
865 if (current->sps_scc_extension_flag)
867 if (current->sps_extension_4bits)
882 if (current->transform_skip_enabled_flag)
883 ue(log2_max_transform_skip_block_size_minus2, 0, 3);
884 flag(cross_component_prediction_enabled_flag);
886 flag(chroma_qp_offset_list_enabled_flag);
887 if (current->chroma_qp_offset_list_enabled_flag) {
888 ue(diff_cu_chroma_qp_offset_depth,
890 ue(chroma_qp_offset_list_len_minus1, 0, 5);
891 for (i = 0; i <= current->chroma_qp_offset_list_len_minus1; i++) {
892 ses(cb_qp_offset_list[i], -12, +12, 1, i);
893 ses(cr_qp_offset_list[i], -12, +12, 1, i);
908 flag(pps_curr_pic_ref_enabled_flag);
910 flag(residual_adaptive_colour_transform_enabled_flag);
911 if (current->residual_adaptive_colour_transform_enabled_flag) {
912 flag(pps_slice_act_qp_offsets_present_flag);
913 se(pps_act_y_qp_offset_plus5, -7, +17);
914 se(pps_act_cb_qp_offset_plus5, -7, +17);
915 se(pps_act_cr_qp_offset_plus3, -9, +15);
917 infer(pps_slice_act_qp_offsets_present_flag, 0);
918 infer(pps_act_y_qp_offset_plus5, 0);
919 infer(pps_act_cb_qp_offset_plus5, 0);
920 infer(pps_act_cr_qp_offset_plus3, 0);
923 flag(pps_palette_predictor_initializer_present_flag);
924 if (current->pps_palette_predictor_initializer_present_flag) {
925 ue(pps_num_palette_predictor_initializer, 0, 128);
926 if (current->pps_num_palette_predictor_initializer > 0) {
927 flag(monochrome_palette_flag);
928 ue(luma_bit_depth_entry_minus8, 0, 8);
929 if (!current->monochrome_palette_flag)
930 ue(chroma_bit_depth_entry_minus8, 0, 8);
931 for (comp = 0; comp < (current->monochrome_palette_flag ? 1 : 3); comp++) {
932 int bit_depth = comp == 0 ? current->luma_bit_depth_entry_minus8 + 8
933 : current->chroma_bit_depth_entry_minus8 + 8;
934 for (i = 0; i < current->pps_num_palette_predictor_initializer; i++)
935 us(bit_depth, pps_palette_predictor_initializers[comp][i],
951 HEADER(
"Picture Parameter Set");
955 ue(pps_pic_parameter_set_id, 0, 63);
956 ue(pps_seq_parameter_set_id, 0, 15);
957 sps = h265->
sps[current->pps_seq_parameter_set_id];
960 current->pps_seq_parameter_set_id);
965 flag(dependent_slice_segments_enabled_flag);
966 flag(output_flag_present_flag);
967 u(3, num_extra_slice_header_bits, 0, 7);
968 flag(sign_data_hiding_enabled_flag);
969 flag(cabac_init_present_flag);
971 ue(num_ref_idx_l0_default_active_minus1, 0, 14);
972 ue(num_ref_idx_l1_default_active_minus1, 0, 14);
976 flag(constrained_intra_pred_flag);
977 flag(transform_skip_enabled_flag);
978 flag(cu_qp_delta_enabled_flag);
979 if (current->cu_qp_delta_enabled_flag)
980 ue(diff_cu_qp_delta_depth,
983 infer(diff_cu_qp_delta_depth, 0);
985 se(pps_cb_qp_offset, -12, +12);
986 se(pps_cr_qp_offset, -12, +12);
987 flag(pps_slice_chroma_qp_offsets_present_flag);
989 flag(weighted_pred_flag);
990 flag(weighted_bipred_flag);
992 flag(transquant_bypass_enabled_flag);
993 flag(tiles_enabled_flag);
994 flag(entropy_coding_sync_enabled_flag);
996 if (current->tiles_enabled_flag) {
999 flag(uniform_spacing_flag);
1000 if (!current->uniform_spacing_flag) {
1001 for (i = 0; i < current->num_tile_columns_minus1; i++)
1003 for (i = 0; i < current->num_tile_rows_minus1; i++)
1006 flag(loop_filter_across_tiles_enabled_flag);
1008 infer(num_tile_columns_minus1, 0);
1009 infer(num_tile_rows_minus1, 0);
1012 flag(pps_loop_filter_across_slices_enabled_flag);
1013 flag(deblocking_filter_control_present_flag);
1014 if (current->deblocking_filter_control_present_flag) {
1015 flag(deblocking_filter_override_enabled_flag);
1016 flag(pps_deblocking_filter_disabled_flag);
1017 if (!current->pps_deblocking_filter_disabled_flag) {
1018 se(pps_beta_offset_div2, -6, +6);
1019 se(pps_tc_offset_div2, -6, +6);
1021 infer(pps_beta_offset_div2, 0);
1022 infer(pps_tc_offset_div2, 0);
1025 infer(deblocking_filter_override_enabled_flag, 0);
1026 infer(pps_deblocking_filter_disabled_flag, 0);
1027 infer(pps_beta_offset_div2, 0);
1028 infer(pps_tc_offset_div2, 0);
1031 flag(pps_scaling_list_data_present_flag);
1032 if (current->pps_scaling_list_data_present_flag)
1035 flag(lists_modification_present_flag);
1037 ue(log2_parallel_merge_level_minus2,
1041 flag(slice_segment_header_extension_present_flag);
1043 flag(pps_extension_present_flag);
1044 if (current->pps_extension_present_flag) {
1045 flag(pps_range_extension_flag);
1046 flag(pps_multilayer_extension_flag);
1047 flag(pps_3d_extension_flag);
1048 flag(pps_scc_extension_flag);
1051 if (current->pps_range_extension_flag)
1053 if (current->pps_multilayer_extension_flag)
1055 if (current->pps_3d_extension_flag)
1057 if (current->pps_scc_extension_flag)
1059 if (current->pps_extension_4bits)
1072 HEADER(
"Access Unit Delimiter");
1076 u(3, pic_type, 0, 2);
1085 unsigned int num_pic_total_curr)
1087 unsigned int entry_size;
1090 entry_size =
av_log2(num_pic_total_curr - 1) + 1;
1092 flag(ref_pic_list_modification_flag_l0);
1093 if (current->ref_pic_list_modification_flag_l0) {
1094 for (i = 0; i <= current->num_ref_idx_l0_active_minus1; i++)
1095 us(entry_size, list_entry_l0[i], 0, num_pic_total_curr - 1, 1, i);
1099 flag(ref_pic_list_modification_flag_l1);
1100 if (current->ref_pic_list_modification_flag_l1) {
1101 for (i = 0; i <= current->num_ref_idx_l1_active_minus1; i++)
1102 us(entry_size, list_entry_l1[i], 0, num_pic_total_curr - 1, 1, i);
1118 ue(luma_log2_weight_denom, 0, 7);
1120 se(delta_chroma_log2_weight_denom, -7, 7);
1122 infer(delta_chroma_log2_weight_denom, 0);
1124 for (i = 0; i <= current->num_ref_idx_l0_active_minus1; i++) {
1126 flags(luma_weight_l0_flag[i], 1, i);
1128 infer(luma_weight_l0_flag[i], 0);
1131 for (i = 0; i <= current->num_ref_idx_l0_active_minus1; i++) {
1133 flags(chroma_weight_l0_flag[i], 1, i);
1135 infer(chroma_weight_l0_flag[i], 0);
1139 for (i = 0; i <= current->num_ref_idx_l0_active_minus1; i++) {
1140 if (current->luma_weight_l0_flag[i]) {
1141 ses(delta_luma_weight_l0[i], -128, +127, 1, i);
1142 ses(luma_offset_l0[i],
1146 infer(delta_luma_weight_l0[i], 0);
1147 infer(luma_offset_l0[i], 0);
1149 if (current->chroma_weight_l0_flag[i]) {
1150 for (j = 0; j < 2; j++) {
1151 ses(delta_chroma_weight_l0[i][j], -128, +127, 2, i, j);
1152 ses(chroma_offset_l0[i][j],
1157 for (j = 0; j < 2; j++) {
1158 infer(delta_chroma_weight_l0[i][j], 0);
1159 infer(chroma_offset_l0[i][j], 0);
1165 for (i = 0; i <= current->num_ref_idx_l1_active_minus1; i++) {
1167 flags(luma_weight_l1_flag[i], 1, i);
1169 infer(luma_weight_l1_flag[i], 0);
1172 for (i = 0; i <= current->num_ref_idx_l1_active_minus1; i++) {
1174 flags(chroma_weight_l1_flag[i], 1, i);
1176 infer(chroma_weight_l1_flag[i], 0);
1180 for (i = 0; i <= current->num_ref_idx_l1_active_minus1; i++) {
1181 if (current->luma_weight_l1_flag[i]) {
1182 ses(delta_luma_weight_l1[i], -128, +127, 1, i);
1183 ses(luma_offset_l1[i],
1187 infer(delta_luma_weight_l1[i], 0);
1188 infer(luma_offset_l1[i], 0);
1190 if (current->chroma_weight_l1_flag[i]) {
1191 for (j = 0; j < 2; j++) {
1192 ses(delta_chroma_weight_l1[i][j], -128, +127, 2, i, j);
1193 ses(chroma_offset_l1[i][j],
1198 for (j = 0; j < 2; j++) {
1199 infer(delta_chroma_weight_l1[i][j], 0);
1200 infer(chroma_offset_l1[i][j], 0);
1215 unsigned int min_cb_log2_size_y, ctb_log2_size_y, ctb_size_y;
1216 unsigned int pic_width_in_ctbs_y, pic_height_in_ctbs_y, pic_size_in_ctbs_y;
1217 unsigned int num_pic_total_curr = 0;
1220 HEADER(
"Slice Segment Header");
1224 flag(first_slice_segment_in_pic_flag);
1228 flag(no_output_of_prior_pics_flag);
1230 ue(slice_pic_parameter_set_id, 0, 63);
1232 pps = h265->
pps[current->slice_pic_parameter_set_id];
1235 current->slice_pic_parameter_set_id);
1250 ctb_size_y = 1 << ctb_log2_size_y;
1251 pic_width_in_ctbs_y =
1253 pic_height_in_ctbs_y =
1255 pic_size_in_ctbs_y = pic_width_in_ctbs_y * pic_height_in_ctbs_y;
1257 if (!current->first_slice_segment_in_pic_flag) {
1258 unsigned int address_size =
av_log2(pic_size_in_ctbs_y - 1) + 1;
1260 flag(dependent_slice_segment_flag);
1262 infer(dependent_slice_segment_flag, 0);
1263 u(address_size, slice_segment_address, 0, pic_size_in_ctbs_y - 1);
1265 infer(dependent_slice_segment_flag, 0);
1268 if (!current->dependent_slice_segment_flag) {
1270 flags(slice_reserved_flag[i], 1, i);
1272 ue(slice_type, 0, 2);
1275 flag(pic_output_flag);
1278 u(2, colour_plane_id, 0, 2);
1287 flag(short_term_ref_pic_set_sps_flag);
1288 if (!current->short_term_ref_pic_set_sps_flag) {
1291 rps = ¤t->short_term_ref_pic_set;
1294 u(idx_size, short_term_ref_pic_set_idx,
1298 infer(short_term_ref_pic_set_idx, 0);
1302 num_pic_total_curr = 0;
1305 ++num_pic_total_curr;
1308 ++num_pic_total_curr;
1311 unsigned int idx_size;
1317 infer(num_long_term_sps, 0);
1322 for (i = 0; i < current->num_long_term_sps +
1323 current->num_long_term_pics; i++) {
1324 if (i < current->num_long_term_sps) {
1326 us(idx_size, lt_idx_sps[i],
1329 ++num_pic_total_curr;
1333 flags(used_by_curr_pic_lt_flag[i], 1, i);
1334 if (current->used_by_curr_pic_lt_flag[i])
1335 ++num_pic_total_curr;
1337 flags(delta_poc_msb_present_flag[i], 1, i);
1338 if (current->delta_poc_msb_present_flag[i])
1339 ues(delta_poc_msb_cycle_lt[i], 0, UINT32_MAX - 1, 1, i);
1341 infer(delta_poc_msb_cycle_lt[i], 0);
1346 flag(slice_temporal_mvp_enabled_flag);
1348 infer(slice_temporal_mvp_enabled_flag, 0);
1351 ++num_pic_total_curr;
1355 flag(slice_sao_luma_flag);
1357 flag(slice_sao_chroma_flag);
1359 infer(slice_sao_chroma_flag, 0);
1361 infer(slice_sao_luma_flag, 0);
1362 infer(slice_sao_chroma_flag, 0);
1367 flag(num_ref_idx_active_override_flag);
1368 if (current->num_ref_idx_active_override_flag) {
1369 ue(num_ref_idx_l0_active_minus1, 0, 14);
1371 ue(num_ref_idx_l1_active_minus1, 0, 14);
1381 num_pic_total_curr));
1384 flag(mvd_l1_zero_flag);
1386 flag(cabac_init_flag);
1388 infer(cabac_init_flag, 0);
1389 if (current->slice_temporal_mvp_enabled_flag) {
1391 flag(collocated_from_l0_flag);
1393 infer(collocated_from_l0_flag, 1);
1394 if (current->collocated_from_l0_flag) {
1395 if (current->num_ref_idx_l0_active_minus1 > 0)
1396 ue(collocated_ref_idx, 0, current->num_ref_idx_l0_active_minus1);
1398 infer(collocated_ref_idx, 0);
1400 if (current->num_ref_idx_l1_active_minus1 > 0)
1401 ue(collocated_ref_idx, 0, current->num_ref_idx_l1_active_minus1);
1403 infer(collocated_ref_idx, 0);
1411 ue(five_minus_max_num_merge_cand, 0, 4);
1413 flag(use_integer_mv_flag);
1422 se(slice_cb_qp_offset, -12, +12);
1423 se(slice_cr_qp_offset, -12, +12);
1425 infer(slice_cb_qp_offset, 0);
1426 infer(slice_cr_qp_offset, 0);
1429 se(slice_act_y_qp_offset,
1432 se(slice_act_cb_qp_offset,
1435 se(slice_act_cr_qp_offset,
1439 infer(slice_act_y_qp_offset, 0);
1440 infer(slice_act_cb_qp_offset, 0);
1441 infer(slice_act_cr_qp_offset, 0);
1444 flag(cu_chroma_qp_offset_enabled_flag);
1446 infer(cu_chroma_qp_offset_enabled_flag, 0);
1449 flag(deblocking_filter_override_flag);
1451 infer(deblocking_filter_override_flag, 0);
1452 if (current->deblocking_filter_override_flag) {
1453 flag(slice_deblocking_filter_disabled_flag);
1454 if (!current->slice_deblocking_filter_disabled_flag) {
1455 se(slice_beta_offset_div2, -6, +6);
1456 se(slice_tc_offset_div2, -6, +6);
1462 infer(slice_deblocking_filter_disabled_flag,
1468 (current->slice_sao_luma_flag || current->slice_sao_chroma_flag ||
1469 !current->slice_deblocking_filter_disabled_flag))
1470 flag(slice_loop_filter_across_slices_enabled_flag);
1472 infer(slice_loop_filter_across_slices_enabled_flag,
1477 unsigned int num_entry_point_offsets_limit;
1479 num_entry_point_offsets_limit = pic_height_in_ctbs_y - 1;
1481 num_entry_point_offsets_limit =
1484 num_entry_point_offsets_limit =
1486 ue(num_entry_point_offsets, 0, num_entry_point_offsets_limit);
1490 "%"PRIu16
".\n", current->num_entry_point_offsets);
1494 if (current->num_entry_point_offsets > 0) {
1495 ue(offset_len_minus1, 0, 31);
1496 for (i = 0; i < current->num_entry_point_offsets; i++)
1497 us(current->offset_len_minus1 + 1, entry_point_offset_minus1[i],
1503 ue(slice_segment_header_extension_length, 0, 256);
1504 for (i = 0; i < current->slice_segment_header_extension_length; i++)
1505 us(8, slice_segment_header_extension_data_byte[i], 0x00, 0xff, 1, i);
1518 for (c = 0; c < 3; c++) {
1519 us(16, display_primaries_x[c], 0, 50000, 1, c);
1520 us(16, display_primaries_y[c], 0, 50000, 1, c);
1523 u(16, white_point_x, 0, 50000);
1524 u(16, white_point_y, 0, 50000);
1526 u(32, max_display_mastering_luminance,
1528 u(32, min_display_mastering_luminance,
1529 0, current->max_display_mastering_luminance - 1);
1549 int start_position, end_position;
1557 switch (current->payload_type) {
1560 (
ctx, rw, ¤t->payload.mastering_display));
1566 (
ctx, rw, ¤t->payload.content_light_level));
1573 current->payload.other.data_length = current->payload_size;
1575 allocate(current->payload.other.data, current->payload.other.data_length);
1577 for (i = 0; i < current->payload_size; i++)
1578 xu(8, payload_byte[i], current->payload.other.data[i], 0, 255,
1584 fixed(1, bit_equal_to_one, 1);
1586 fixed(1, bit_equal_to_zero, 0);
1591 if (end_position < start_position + 8 * current->payload_size) {
1593 "header %"PRIu32
" bits, actually %d bits.\n",
1594 8 * current->payload_size,
1595 end_position - start_position);
1600 current->payload_size = (end_position - start_position) >> 3;
1611 HEADER(
"Supplemental Enhancement Information");
1618 uint32_t payload_type = 0;
1619 uint32_t payload_size = 0;
1623 fixed(8, ff_byte, 0xff);
1624 payload_type += 255;
1626 xu(8, last_payload_type_byte, tmp, 0, 254, 0);
1627 payload_type +=
tmp;
1630 fixed(8, ff_byte, 0xff);
1631 payload_size += 255;
1633 xu(8, last_payload_size_byte, tmp, 0, 254, 0);
1634 payload_size +=
tmp;
1636 current->payload[k].payload_type = payload_type;
1637 current->payload[k].payload_size = payload_size;
1644 if (k >= H265_MAX_SEI_PAYLOADS) {
1646 "SEI message: found %d.\n", k);
1649 current->payload_count = k + 1;
1651 for (k = 0; k < current->payload_count; k++) {
1660 need_size = !current->payload[k].payload_size;
1661 for (i = 0; i < 1 + need_size; i++) {
1664 tmp = current->payload[k].payload_type;
1665 while (tmp >= 255) {
1666 fixed(8, ff_byte, 0xff);
1669 xu(8, last_payload_type_byte, tmp, 0, 254, 0);
1671 tmp = current->payload[k].payload_size;
1672 while (tmp >= 255) {
1673 fixed(8, ff_byte, 0xff);
1676 xu(8, last_payload_size_byte, tmp, 0, 254, 0);
#define allocate(name, size)
H265RawPPS * pps[HEVC_MAX_PPS_COUNT]
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static int FUNC() byte_alignment(CodedBitstreamContext *ctx, RWContext *rw)
#define se(name, range_min, range_max)
uint8_t deblocking_filter_override_enabled_flag
static int FUNC() sei_content_light_level(CodedBitstreamContext *ctx, RWContext *rw, H265RawSEIContentLightLevelInfo *current)
uint8_t num_ref_idx_l0_default_active_minus1
#define fixed(width, name, value)
static int FUNC() sub_layer_hrd_parameters(CodedBitstreamContext *ctx, RWContext *rw, H265RawHRDParameters *hrd, int nal, int sub_layer_id)
uint8_t chroma_qp_offset_list_enabled_flag
uint8_t bit_depth_luma_minus8
static int FUNC() sps_scc_extension(CodedBitstreamContext *ctx, RWContext *rw, H265RawSPS *current)
static int FUNC() pred_weight_table(CodedBitstreamContext *ctx, RWContext *rw, H265RawSliceHeader *current)
int8_t pps_act_y_qp_offset_plus5
static int FUNC() hrd_parameters(CodedBitstreamContext *ctx, RWContext *rw, H265RawHRDParameters *current, int common_inf_present_flag, int max_num_sub_layers_minus1)
#define us(width, name, range_min, range_max, subs,...)
uint8_t tiles_enabled_flag
H265RawSTRefPicSet st_ref_pic_set[HEVC_MAX_SHORT_TERM_REF_PIC_SETS]
static int FUNC() slice_segment_header(CodedBitstreamContext *ctx, RWContext *rw, H265RawSliceHeader *current)
uint8_t pps_slice_chroma_qp_offsets_present_flag
static int FUNC() pps_scc_extension(CodedBitstreamContext *ctx, RWContext *rw, H265RawPPS *current)
uint8_t sample_adaptive_offset_enabled_flag
uint8_t bit_depth_chroma_minus8
uint8_t used_by_curr_pic_s0_flag[HEVC_MAX_REFS]
static int FUNC() extension_data(CodedBitstreamContext *ctx, RWContext *rw, H265RawPSExtensionData *current)
uint16_t pic_height_in_luma_samples
static int FUNC() pps_range_extension(CodedBitstreamContext *ctx, RWContext *rw, H265RawPPS *current)
static int FUNC() ref_pic_lists_modification(CodedBitstreamContext *ctx, RWContext *rw, H265RawSliceHeader *current, unsigned int num_pic_total_curr)
#define MAX_UINT_BITS(length)
#define u(width, name, range_min, range_max)
uint8_t log2_max_pic_order_cnt_lsb_minus4
H265RawSPS * sps[HEVC_MAX_SPS_COUNT]
static int FUNC() vui_parameters(CodedBitstreamContext *ctx, RWContext *rw, H265RawVUI *current, const H265RawSPS *sps)
CHECK(-1) CHECK(-2)}}}}CHECK(1) CHECK(2)}}}}}if(diff0+diff1 > 0) temp-
#define ses(name, range_min, range_max, subs,...)
static int get_bits_count(const GetBitContext *s)
uint8_t vps_max_sub_layers_minus1
static int FUNC() sei(CodedBitstreamContext *ctx, RWContext *rw, H265RawSEI *current)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
uint8_t pps_slice_act_qp_offsets_present_flag
static int FUNC() st_ref_pic_set(CodedBitstreamContext *ctx, RWContext *rw, H265RawSTRefPicSet *current, int st_rps_idx, const H265RawSPS *sps)
#define ue(name, range_min, range_max)
uint8_t num_negative_pics
static int put_bits_count(PutBitContext *s)
uint8_t motion_vector_resolution_control_idc
static const struct TransferCharacteristics transfer_characteristics[AVCOL_TRC_NB]
#define profile_compatible(x)
static int FUNC() sei_mastering_display(CodedBitstreamContext *ctx, RWContext *rw, H265RawSEIMasteringDisplayColourVolume *current)
uint8_t num_long_term_ref_pics_sps
static void bit_depth(AudioStatsContext *s, uint64_t mask, uint64_t imask, AVRational *depth)
int8_t pps_beta_offset_div2
uint8_t pps_deblocking_filter_disabled_flag
static int FUNC() pps(CodedBitstreamContext *ctx, RWContext *rw, H265RawPPS *current)
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits.
uint16_t pic_width_in_luma_samples
uint8_t lists_modification_present_flag
uint8_t log2_min_luma_coding_block_size_minus3
uint8_t pps_seq_parameter_set_id
uint8_t cabac_init_present_flag
static void comp(unsigned char *dst, ptrdiff_t dst_stride, unsigned char *src, ptrdiff_t src_stride, int add)
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
static int FUNC() aud(CodedBitstreamContext *ctx, RWContext *rw, H265RawAUD *current)
uint8_t used_by_curr_pic_s1_flag[HEVC_MAX_REFS]
uint8_t num_extra_slice_header_bits
const H265RawSPS * active_sps
static int FUNC() scaling_list_data(CodedBitstreamContext *ctx, RWContext *rw, H265RawScalingList *current)
uint8_t entropy_coding_sync_enabled_flag
uint8_t output_flag_present_flag
uint8_t weighted_bipred_flag
uint8_t dependent_slice_segments_enabled_flag
uint8_t sps_temporal_mvp_enabled_flag
#define xu(width, name, var, range_min, range_max, subs,...)
uint8_t pps_loop_filter_across_slices_enabled_flag
uint8_t weighted_pred_flag
static void skip_bits(GetBitContext *s, int n)
Context structure for coded bitstream operations.
const H265RawVPS * active_vps
static int FUNC() profile_tier_level(CodedBitstreamContext *ctx, RWContext *rw, H265RawProfileTierLevel *current, int profile_present_flag, int max_num_sub_layers_minus1)
uint8_t chroma_format_idc
static int cbs_h2645_read_more_rbsp_data(GetBitContext *gbc)
const H265RawPPS * active_pps
static int FUNC() vps(CodedBitstreamContext *ctx, RWContext *rw, H265RawVPS *current)
#define flags(name, subs,...)
uint8_t num_positive_pics
static int FUNC() sei_payload(CodedBitstreamContext *ctx, RWContext *rw, H265RawSEIPayload *current)
static int FUNC() nal_unit_header(CodedBitstreamContext *ctx, RWContext *rw, H265RawNALUnitHeader *current, int expected_nal_unit_type)
static int ref[MAX_W *MAX_W]
uint8_t num_tile_rows_minus1
int8_t pps_act_cb_qp_offset_plus5
uint8_t num_tile_columns_minus1
uint8_t log2_diff_max_min_luma_coding_block_size
uint8_t used_by_curr_pic_lt_sps_flag[HEVC_MAX_LONG_TERM_REF_PICS]
void * priv_data
Format private data.
uint8_t num_short_term_ref_pic_sets
static int FUNC() sps(CodedBitstreamContext *ctx, RWContext *rw, H265RawSPS *current)
uint8_t vps_temporal_id_nesting_flag
int8_t pps_tc_offset_div2
static int FUNC() sps_range_extension(CodedBitstreamContext *ctx, RWContext *rw, H265RawSPS *current)
uint8_t pps_curr_pic_ref_enabled_flag
uint8_t slice_segment_header_extension_present_flag
#define infer(name, value)
H265RawVPS * vps[HEVC_MAX_VPS_COUNT]
uint8_t separate_colour_plane_flag
static int FUNC() rbsp_trailing_bits(CodedBitstreamContext *ctx, RWContext *rw)
uint8_t long_term_ref_pics_present_flag
#define ues(name, range_min, range_max, subs,...)
int8_t pps_act_cr_qp_offset_plus3
uint8_t num_ref_idx_l1_default_active_minus1