cbs_h265: read/write HEVC PREFIX SEI
[ffmpeg.git] / libavcodec / cbs_h265.h
1 /*
2  * This file is part of FFmpeg.
3  *
4  * FFmpeg is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * FFmpeg is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with FFmpeg; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18
19 #ifndef AVCODEC_CBS_H265_H
20 #define AVCODEC_CBS_H265_H
21
22 #include <stddef.h>
23 #include <stdint.h>
24
25 #include "cbs_h2645.h"
26 #include "hevc.h"
27
28 enum {
29     // This limit is arbitrary - it is sufficient for one message of each
30     // type plus some repeats, and will therefore easily cover all sane
31     // streams.  However, it is possible to make technically-valid streams
32     // for which it will fail (for example, by including a large number of
33     // user-data-unregistered messages).
34     H265_MAX_SEI_PAYLOADS = 64,
35 };
36
37 typedef struct H265RawNALUnitHeader {
38     uint8_t forbidden_zero_bit;
39     uint8_t nal_unit_type;
40     uint8_t nuh_layer_id;
41     uint8_t nuh_temporal_id_plus1;
42 } H265RawNALUnitHeader;
43
44 typedef struct H265RawProfileTierLevel {
45     uint8_t general_profile_space;
46     uint8_t general_tier_flag;
47     uint8_t general_profile_idc;
48
49     uint8_t general_profile_compatibility_flag[32];
50
51     uint8_t general_progressive_source_flag;
52     uint8_t general_interlaced_source_flag;
53     uint8_t general_non_packed_constraint_flag;
54     uint8_t general_frame_only_constraint_flag;
55
56     uint8_t general_max_12bit_constraint_flag;
57     uint8_t general_max_10bit_constraint_flag;
58     uint8_t general_max_8bit_constraint_flag;
59     uint8_t general_max_422chroma_constraint_flag;
60     uint8_t general_max_420chroma_constraint_flag;
61     uint8_t general_max_monochrome_constraint_flag;
62     uint8_t general_intra_constraint_flag;
63     uint8_t general_one_picture_only_constraint_flag;
64     uint8_t general_lower_bit_rate_constraint_flag;
65     uint8_t general_max_14bit_constraint_flag;
66
67     uint8_t general_inbld_flag;
68
69     uint8_t general_level_idc;
70
71     uint8_t sub_layer_profile_present_flag[HEVC_MAX_SUB_LAYERS];
72     uint8_t sub_layer_level_present_flag[HEVC_MAX_SUB_LAYERS];
73
74     // TODO: much of that again for each sub-layer.
75 } H265RawProfileTierLevel;
76
77 typedef struct H265RawSubLayerHRDParameters {
78     uint32_t bit_rate_value_minus1[HEVC_MAX_CPB_CNT];
79     uint32_t cpb_size_value_minus1[HEVC_MAX_CPB_CNT];
80     uint32_t cpb_size_du_value_minus1[HEVC_MAX_CPB_CNT];
81     uint32_t bit_rate_du_value_minus1[HEVC_MAX_CPB_CNT];
82     uint8_t cbr_flag[HEVC_MAX_CPB_CNT];
83 } H265RawSubLayerHRDParameters;
84
85 typedef struct H265RawHRDParameters {
86     uint8_t nal_hrd_parameters_present_flag;
87     uint8_t vcl_hrd_parameters_present_flag;
88
89     uint8_t sub_pic_hrd_params_present_flag;
90     uint8_t tick_divisor_minus2;
91     uint8_t du_cpb_removal_delay_increment_length_minus1;
92     uint8_t sub_pic_cpb_params_in_pic_timing_sei_flag;
93     uint8_t dpb_output_delay_du_length_minus1;
94
95     uint8_t bit_rate_scale;
96     uint8_t cpb_size_scale;
97     uint8_t cpb_size_du_scale;
98
99     uint8_t initial_cpb_removal_delay_length_minus1;
100     uint8_t au_cpb_removal_delay_length_minus1;
101     uint8_t dpb_output_delay_length_minus1;
102
103     uint8_t fixed_pic_rate_general_flag[HEVC_MAX_SUB_LAYERS];
104     uint8_t fixed_pic_rate_within_cvs_flag[HEVC_MAX_SUB_LAYERS];
105     uint16_t elemental_duration_in_tc_minus1[HEVC_MAX_SUB_LAYERS];
106     uint8_t low_delay_hrd_flag[HEVC_MAX_SUB_LAYERS];
107     uint8_t cpb_cnt_minus1[HEVC_MAX_SUB_LAYERS];
108     H265RawSubLayerHRDParameters nal_sub_layer_hrd_parameters[HEVC_MAX_SUB_LAYERS];
109     H265RawSubLayerHRDParameters vcl_sub_layer_hrd_parameters[HEVC_MAX_SUB_LAYERS];
110 } H265RawHRDParameters;
111
112 typedef struct H265RawVUI {
113     uint8_t aspect_ratio_info_present_flag;
114     uint8_t aspect_ratio_idc;
115     uint16_t sar_width;
116     uint16_t sar_height;
117
118     uint8_t overscan_info_present_flag;
119     uint8_t overscan_appropriate_flag;
120
121     uint8_t video_signal_type_present_flag;
122     uint8_t video_format;
123     uint8_t video_full_range_flag;
124     uint8_t colour_description_present_flag;
125     uint8_t colour_primaries;
126     uint8_t transfer_characteristics;
127     uint8_t matrix_coefficients;
128
129     uint8_t chroma_loc_info_present_flag;
130     uint8_t chroma_sample_loc_type_top_field;
131     uint8_t chroma_sample_loc_type_bottom_field;
132
133     uint8_t neutral_chroma_indication_flag;
134     uint8_t field_seq_flag;
135     uint8_t frame_field_info_present_flag;
136
137     uint8_t default_display_window_flag;
138     uint16_t def_disp_win_left_offset;
139     uint16_t def_disp_win_right_offset;
140     uint16_t def_disp_win_top_offset;
141     uint16_t def_disp_win_bottom_offset;
142
143     uint8_t vui_timing_info_present_flag;
144     uint32_t vui_num_units_in_tick;
145     uint32_t vui_time_scale;
146     uint8_t vui_poc_proportional_to_timing_flag;
147     uint32_t vui_num_ticks_poc_diff_one_minus1;
148     uint8_t vui_hrd_parameters_present_flag;
149     H265RawHRDParameters hrd_parameters;
150
151     uint8_t bitstream_restriction_flag;
152     uint8_t tiles_fixed_structure_flag;
153     uint8_t motion_vectors_over_pic_boundaries_flag;
154     uint8_t restricted_ref_pic_lists_flag;
155     uint16_t min_spatial_segmentation_idc;
156     uint8_t max_bytes_per_pic_denom;
157     uint8_t max_bits_per_min_cu_denom;
158     uint8_t log2_max_mv_length_horizontal;
159     uint8_t log2_max_mv_length_vertical;
160 } H265RawVUI;
161
162 typedef struct H265RawPSExtensionData {
163     uint8_t *data;
164     size_t bit_length;
165     AVBufferRef *data_ref;
166 } H265RawPSExtensionData;
167
168 typedef struct H265RawVPS {
169     H265RawNALUnitHeader nal_unit_header;
170
171     uint8_t vps_video_parameter_set_id;
172
173     uint8_t vps_base_layer_internal_flag;
174     uint8_t vps_base_layer_available_flag;
175     uint8_t vps_max_layers_minus1;
176     uint8_t vps_max_sub_layers_minus1;
177     uint8_t vps_temporal_id_nesting_flag;
178
179     H265RawProfileTierLevel profile_tier_level;
180
181     uint8_t vps_sub_layer_ordering_info_present_flag;
182     uint8_t vps_max_dec_pic_buffering_minus1[HEVC_MAX_SUB_LAYERS];
183     uint8_t vps_max_num_reorder_pics[HEVC_MAX_SUB_LAYERS];
184     uint32_t vps_max_latency_increase_plus1[HEVC_MAX_SUB_LAYERS];
185
186     uint8_t vps_max_layer_id;
187     uint16_t vps_num_layer_sets_minus1;
188     uint8_t layer_id_included_flag[HEVC_MAX_LAYER_SETS][HEVC_MAX_LAYERS];
189
190     uint8_t vps_timing_info_present_flag;
191     uint32_t vps_num_units_in_tick;
192     uint32_t vps_time_scale;
193     uint8_t vps_poc_proportional_to_timing_flag;
194     uint32_t vps_num_ticks_poc_diff_one_minus1;
195     uint16_t vps_num_hrd_parameters;
196     uint16_t hrd_layer_set_idx[HEVC_MAX_LAYER_SETS];
197     uint8_t cprms_present_flag[HEVC_MAX_LAYER_SETS];
198     H265RawHRDParameters hrd_parameters[HEVC_MAX_LAYER_SETS];
199
200     uint8_t vps_extension_flag;
201     H265RawPSExtensionData extension_data;
202 } H265RawVPS;
203
204 typedef struct H265RawSTRefPicSet {
205     uint8_t inter_ref_pic_set_prediction_flag;
206
207     uint8_t delta_idx_minus1;
208     uint8_t delta_rps_sign;
209     uint16_t abs_delta_rps_minus1;
210
211     uint8_t used_by_curr_pic_flag[HEVC_MAX_REFS];
212     uint8_t use_delta_flag[HEVC_MAX_REFS];
213
214     uint8_t num_negative_pics;
215     uint8_t num_positive_pics;
216     uint16_t delta_poc_s0_minus1[HEVC_MAX_REFS];
217     uint8_t used_by_curr_pic_s0_flag[HEVC_MAX_REFS];
218     uint16_t delta_poc_s1_minus1[HEVC_MAX_REFS];
219     uint8_t used_by_curr_pic_s1_flag[HEVC_MAX_REFS];
220 } H265RawSTRefPicSet;
221
222 typedef struct H265RawScalingList {
223     uint8_t scaling_list_pred_mode_flag[4][6];
224     uint8_t scaling_list_pred_matrix_id_delta[4][6];
225     int16_t scaling_list_dc_coef_minus8[4][6];
226     int8_t scaling_list_delta_coeff[4][6][64];
227 } H265RawScalingList;
228
229 typedef struct H265RawSPS {
230     H265RawNALUnitHeader nal_unit_header;
231
232     uint8_t sps_video_parameter_set_id;
233
234     uint8_t sps_max_sub_layers_minus1;
235     uint8_t sps_temporal_id_nesting_flag;
236
237     H265RawProfileTierLevel profile_tier_level;
238
239     uint8_t sps_seq_parameter_set_id;
240
241     uint8_t chroma_format_idc;
242     uint8_t separate_colour_plane_flag;
243
244     uint16_t pic_width_in_luma_samples;
245     uint16_t pic_height_in_luma_samples;
246
247     uint8_t conformance_window_flag;
248     uint16_t conf_win_left_offset;
249     uint16_t conf_win_right_offset;
250     uint16_t conf_win_top_offset;
251     uint16_t conf_win_bottom_offset;
252
253     uint8_t bit_depth_luma_minus8;
254     uint8_t bit_depth_chroma_minus8;
255
256     uint8_t log2_max_pic_order_cnt_lsb_minus4;
257
258     uint8_t sps_sub_layer_ordering_info_present_flag;
259     uint8_t sps_max_dec_pic_buffering_minus1[HEVC_MAX_SUB_LAYERS];
260     uint8_t sps_max_num_reorder_pics[HEVC_MAX_SUB_LAYERS];
261     uint32_t sps_max_latency_increase_plus1[HEVC_MAX_SUB_LAYERS];
262
263     uint8_t log2_min_luma_coding_block_size_minus3;
264     uint8_t log2_diff_max_min_luma_coding_block_size;
265     uint8_t log2_min_luma_transform_block_size_minus2;
266     uint8_t log2_diff_max_min_luma_transform_block_size;
267     uint8_t max_transform_hierarchy_depth_inter;
268     uint8_t max_transform_hierarchy_depth_intra;
269
270     uint8_t scaling_list_enabled_flag;
271     uint8_t sps_scaling_list_data_present_flag;
272     H265RawScalingList scaling_list;
273
274     uint8_t amp_enabled_flag;
275     uint8_t sample_adaptive_offset_enabled_flag;
276
277     uint8_t pcm_enabled_flag;
278     uint8_t pcm_sample_bit_depth_luma_minus1;
279     uint8_t pcm_sample_bit_depth_chroma_minus1;
280     uint8_t log2_min_pcm_luma_coding_block_size_minus3;
281     uint8_t log2_diff_max_min_pcm_luma_coding_block_size;
282     uint8_t pcm_loop_filter_disabled_flag;
283
284     uint8_t num_short_term_ref_pic_sets;
285     H265RawSTRefPicSet st_ref_pic_set[HEVC_MAX_SHORT_TERM_REF_PIC_SETS];
286
287     uint8_t long_term_ref_pics_present_flag;
288     uint8_t num_long_term_ref_pics_sps;
289     uint16_t lt_ref_pic_poc_lsb_sps[HEVC_MAX_LONG_TERM_REF_PICS];
290     uint8_t used_by_curr_pic_lt_sps_flag[HEVC_MAX_LONG_TERM_REF_PICS];
291
292     uint8_t sps_temporal_mvp_enabled_flag;
293     uint8_t strong_intra_smoothing_enabled_flag;
294
295     uint8_t vui_parameters_present_flag;
296     H265RawVUI vui;
297
298     uint8_t sps_extension_present_flag;
299     uint8_t sps_range_extension_flag;
300     uint8_t sps_multilayer_extension_flag;
301     uint8_t sps_3d_extension_flag;
302     uint8_t sps_scc_extension_flag;
303     uint8_t sps_extension_4bits;
304
305     H265RawPSExtensionData extension_data;
306
307     // Range extension.
308     uint8_t transform_skip_rotation_enabled_flag;
309     uint8_t transform_skip_context_enabled_flag;
310     uint8_t implicit_rdpcm_enabled_flag;
311     uint8_t explicit_rdpcm_enabled_flag;
312     uint8_t extended_precision_processing_flag;
313     uint8_t intra_smoothing_disabled_flag;
314     uint8_t high_precision_offsets_enabled_flag;
315     uint8_t persistent_rice_adaptation_enabled_flag;
316     uint8_t cabac_bypass_alignment_enabled_flag;
317
318     // Screen content coding extension.
319     uint8_t sps_curr_pic_ref_enabled_flag;
320     uint8_t palette_mode_enabled_flag;
321     uint8_t palette_max_size;
322     uint8_t delta_palette_max_predictor_size;
323     uint8_t sps_palette_predictor_initializer_present_flag;
324     uint8_t sps_num_palette_predictor_initializer_minus1;
325     uint16_t sps_palette_predictor_initializers[3][128];
326
327     uint8_t motion_vector_resolution_control_idc;
328     uint8_t intra_boundary_filtering_disable_flag;
329 } H265RawSPS;
330
331 typedef struct H265RawPPS {
332     H265RawNALUnitHeader nal_unit_header;
333
334     uint8_t pps_pic_parameter_set_id;
335     uint8_t pps_seq_parameter_set_id;
336
337     uint8_t dependent_slice_segments_enabled_flag;
338     uint8_t output_flag_present_flag;
339     uint8_t num_extra_slice_header_bits;
340     uint8_t sign_data_hiding_enabled_flag;
341     uint8_t cabac_init_present_flag;
342
343     uint8_t num_ref_idx_l0_default_active_minus1;
344     uint8_t num_ref_idx_l1_default_active_minus1;
345
346     int8_t init_qp_minus26;
347
348     uint8_t constrained_intra_pred_flag;
349     uint8_t transform_skip_enabled_flag;
350     uint8_t cu_qp_delta_enabled_flag;
351     uint8_t diff_cu_qp_delta_depth;
352
353     int8_t pps_cb_qp_offset;
354     int8_t pps_cr_qp_offset;
355     uint8_t pps_slice_chroma_qp_offsets_present_flag;
356
357     uint8_t weighted_pred_flag;
358     uint8_t weighted_bipred_flag;
359
360     uint8_t transquant_bypass_enabled_flag;
361     uint8_t tiles_enabled_flag;
362     uint8_t entropy_coding_sync_enabled_flag;
363
364     uint8_t num_tile_columns_minus1;
365     uint8_t num_tile_rows_minus1;
366     uint8_t uniform_spacing_flag;
367     uint16_t column_width_minus1[HEVC_MAX_TILE_COLUMNS];
368     uint16_t row_height_minus1[HEVC_MAX_TILE_ROWS];
369     uint8_t loop_filter_across_tiles_enabled_flag;
370
371     uint8_t pps_loop_filter_across_slices_enabled_flag;
372     uint8_t deblocking_filter_control_present_flag;
373     uint8_t deblocking_filter_override_enabled_flag;
374     uint8_t pps_deblocking_filter_disabled_flag;
375     int8_t pps_beta_offset_div2;
376     int8_t pps_tc_offset_div2;
377
378     uint8_t pps_scaling_list_data_present_flag;
379     H265RawScalingList scaling_list;
380
381     uint8_t lists_modification_present_flag;
382     uint8_t log2_parallel_merge_level_minus2;
383
384     uint8_t slice_segment_header_extension_present_flag;
385
386     uint8_t pps_extension_present_flag;
387     uint8_t pps_range_extension_flag;
388     uint8_t pps_multilayer_extension_flag;
389     uint8_t pps_3d_extension_flag;
390     uint8_t pps_scc_extension_flag;
391     uint8_t pps_extension_4bits;
392
393     H265RawPSExtensionData extension_data;
394
395     // Range extension.
396     uint8_t log2_max_transform_skip_block_size_minus2;
397     uint8_t cross_component_prediction_enabled_flag;
398     uint8_t chroma_qp_offset_list_enabled_flag;
399     uint8_t diff_cu_chroma_qp_offset_depth;
400     uint8_t chroma_qp_offset_list_len_minus1;
401     int8_t cb_qp_offset_list[6];
402     int8_t cr_qp_offset_list[6];
403     uint8_t log2_sao_offset_scale_luma;
404     uint8_t log2_sao_offset_scale_chroma;
405
406     // Screen content coding extension.
407     uint8_t pps_curr_pic_ref_enabled_flag;
408     uint8_t residual_adaptive_colour_transform_enabled_flag;
409     uint8_t pps_slice_act_qp_offsets_present_flag;
410     int8_t pps_act_y_qp_offset_plus5;
411     int8_t pps_act_cb_qp_offset_plus5;
412     int8_t pps_act_cr_qp_offset_plus3;
413
414     uint8_t pps_palette_predictor_initializer_present_flag;
415     uint8_t pps_num_palette_predictor_initializer;
416     uint8_t monochrome_palette_flag;
417     uint8_t luma_bit_depth_entry_minus8;
418     uint8_t chroma_bit_depth_entry_minus8;
419     uint16_t pps_palette_predictor_initializers[3][128];
420 } H265RawPPS;
421
422 typedef struct H265RawAUD {
423     H265RawNALUnitHeader nal_unit_header;
424
425     uint8_t pic_type;
426 } H265RawAUD;
427
428 typedef struct  H265RawSliceHeader {
429     H265RawNALUnitHeader nal_unit_header;
430
431     uint8_t first_slice_segment_in_pic_flag;
432     uint8_t no_output_of_prior_pics_flag;
433     uint8_t slice_pic_parameter_set_id;
434
435     uint8_t dependent_slice_segment_flag;
436     uint16_t slice_segment_address;
437
438     uint8_t slice_reserved_flag[8];
439     uint8_t slice_type;
440
441     uint8_t pic_output_flag;
442     uint8_t colour_plane_id;
443
444     uint16_t slice_pic_order_cnt_lsb;
445
446     uint8_t short_term_ref_pic_set_sps_flag;
447     H265RawSTRefPicSet short_term_ref_pic_set;
448     uint8_t short_term_ref_pic_set_idx;
449
450     uint8_t num_long_term_sps;
451     uint8_t num_long_term_pics;
452     uint8_t lt_idx_sps[HEVC_MAX_REFS];
453     uint8_t poc_lsb_lt[HEVC_MAX_REFS];
454     uint8_t used_by_curr_pic_lt_flag[HEVC_MAX_REFS];
455     uint8_t delta_poc_msb_present_flag[HEVC_MAX_REFS];
456     uint32_t delta_poc_msb_cycle_lt[HEVC_MAX_REFS];
457
458     uint8_t slice_temporal_mvp_enabled_flag;
459
460     uint8_t slice_sao_luma_flag;
461     uint8_t slice_sao_chroma_flag;
462
463     uint8_t num_ref_idx_active_override_flag;
464     uint8_t num_ref_idx_l0_active_minus1;
465     uint8_t num_ref_idx_l1_active_minus1;
466
467     uint8_t ref_pic_list_modification_flag_l0;
468     uint8_t list_entry_l0[HEVC_MAX_REFS];
469     uint8_t ref_pic_list_modification_flag_l1;
470     uint8_t list_entry_l1[HEVC_MAX_REFS];
471
472     uint8_t mvd_l1_zero_flag;
473     uint8_t cabac_init_flag;
474     uint8_t collocated_from_l0_flag;
475     uint8_t collocated_ref_idx;
476
477     uint8_t luma_log2_weight_denom;
478     int8_t delta_chroma_log2_weight_denom;
479     uint8_t luma_weight_l0_flag[HEVC_MAX_REFS];
480     uint8_t chroma_weight_l0_flag[HEVC_MAX_REFS];
481     int8_t delta_luma_weight_l0[HEVC_MAX_REFS];
482     int16_t luma_offset_l0[HEVC_MAX_REFS];
483     int8_t delta_chroma_weight_l0[HEVC_MAX_REFS][2];
484     int16_t chroma_offset_l0[HEVC_MAX_REFS][2];
485     uint8_t luma_weight_l1_flag[HEVC_MAX_REFS];
486     uint8_t chroma_weight_l1_flag[HEVC_MAX_REFS];
487     int8_t delta_luma_weight_l1[HEVC_MAX_REFS];
488     int16_t luma_offset_l1[HEVC_MAX_REFS];
489     int8_t delta_chroma_weight_l1[HEVC_MAX_REFS][2];
490     int16_t chroma_offset_l1[HEVC_MAX_REFS][2];
491
492     uint8_t five_minus_max_num_merge_cand;
493     uint8_t use_integer_mv_flag;
494
495     int8_t slice_qp_delta;
496     int8_t slice_cb_qp_offset;
497     int8_t slice_cr_qp_offset;
498     int8_t slice_act_y_qp_offset;
499     int8_t slice_act_cb_qp_offset;
500     int8_t slice_act_cr_qp_offset;
501     uint8_t cu_chroma_qp_offset_enabled_flag;
502
503     uint8_t deblocking_filter_override_flag;
504     uint8_t slice_deblocking_filter_disabled_flag;
505     int8_t slice_beta_offset_div2;
506     int8_t slice_tc_offset_div2;
507     uint8_t slice_loop_filter_across_slices_enabled_flag;
508
509     uint16_t num_entry_point_offsets;
510     uint8_t offset_len_minus1;
511     uint32_t entry_point_offset_minus1[HEVC_MAX_ENTRY_POINT_OFFSETS];
512
513     uint16_t slice_segment_header_extension_length;
514     uint8_t slice_segment_header_extension_data_byte[256];
515 } H265RawSliceHeader;
516
517
518 typedef struct H265RawSlice {
519     H265RawSliceHeader header;
520
521     uint8_t *data;
522     size_t   data_size;
523     int      data_bit_start;
524     AVBufferRef *data_ref;
525 } H265RawSlice;
526
527 typedef struct H265RawSEIMasteringDisplayColourVolume {
528     uint16_t display_primaries_x[3];
529     uint16_t display_primaries_y[3];
530     uint16_t white_point_x;
531     uint16_t white_point_y;
532     uint32_t max_display_mastering_luminance;
533     uint32_t min_display_mastering_luminance;
534 } H265RawSEIMasteringDisplayColourVolume;
535
536 typedef struct H265RawSEIPayload {
537     uint32_t payload_type;
538     uint32_t payload_size;
539     union {
540         H265RawSEIMasteringDisplayColourVolume mastering_display;
541         struct {
542             uint8_t *data;
543             size_t data_length;
544             AVBufferRef *data_ref;
545         } other;
546     } payload;
547 } H265RawSEIPayload;
548
549 typedef struct H265RawSEI {
550     H265RawNALUnitHeader nal_unit_header;
551
552     H265RawSEIPayload payload[H265_MAX_SEI_PAYLOADS];
553     uint8_t payload_count;
554 } H265RawSEI;
555
556 typedef struct CodedBitstreamH265Context {
557     // Reader/writer context in common with the H.264 implementation.
558     CodedBitstreamH2645Context common;
559
560     // All currently available parameter sets.  These are updated when
561     // any parameter set NAL unit is read/written with this context.
562     AVBufferRef *vps_ref[HEVC_MAX_VPS_COUNT];
563     AVBufferRef *sps_ref[HEVC_MAX_SPS_COUNT];
564     AVBufferRef *pps_ref[HEVC_MAX_PPS_COUNT];
565     H265RawVPS *vps[HEVC_MAX_VPS_COUNT];
566     H265RawSPS *sps[HEVC_MAX_SPS_COUNT];
567     H265RawPPS *pps[HEVC_MAX_PPS_COUNT];
568
569     // The currently active parameter sets.  These are updated when any
570     // NAL unit refers to the relevant parameter set.  These pointers
571     // must also be present in the arrays above.
572     const H265RawVPS *active_vps;
573     const H265RawSPS *active_sps;
574     const H265RawPPS *active_pps;
575 } CodedBitstreamH265Context;
576
577
578 #endif /* AVCODEC_CBS_H265_H */