FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
cbs_h264.h
Go to the documentation of this file.
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_H264_H
20 #define AVCODEC_CBS_H264_H
21 
22 #include <stddef.h>
23 #include <stdint.h>
24 
25 #include "cbs_h2645.h"
26 #include "h264.h"
27 
28 
29 enum {
30  // This limit is arbitrary - it is sufficient for one message of each
31  // type plus some repeats, and will therefore easily cover all sane
32  // streams. However, it is possible to make technically-valid streams
33  // for which it will fail (for example, by including a large number of
34  // user-data-unregistered messages).
36 };
37 
38 
39 typedef struct H264RawNALUnitHeader {
43 
47 
48 typedef struct H264RawScalingList {
49  int8_t delta_scale[64];
51 
52 typedef struct H264RawHRD {
56 
60 
65 } H264RawHRD;
66 
67 typedef struct H264RawVUI {
70  uint16_t sar_width;
71  uint16_t sar_height;
72 
75 
83 
87 
90  uint32_t time_scale;
92 
98 
100 
109 } H264RawVUI;
110 
111 typedef struct H264RawSPS {
113 
123 
125 
131 
136 
145 
148 
151 
155 
161 
164 } H264RawSPS;
165 
166 typedef struct H264RawSPSExtension {
168 
170 
176 
179 
180 typedef struct H264RawPPS {
182 
185 
188 
198 
201 
204 
208 
211 
213 
216 
221 
223 } H264RawPPS;
224 
225 typedef struct H264RawAUD {
227 
229 } H264RawAUD;
230 
233  struct {
236  } nal, vcl;
238 
239 typedef struct H264RawSEIPicTimestamp {
253  uint32_t time_offset;
255 
256 typedef struct H264RawSEIPicTiming {
263 
268  size_t data_length;
270 
274  size_t data_length;
276 
277 typedef struct H264RawSEIRecoveryPoint {
283 
292 
293 typedef struct H264RawSEIPayload {
294  uint32_t payload_type;
295  uint32_t payload_size;
296  union {
299  // H264RawSEIFiller filler -> no fields.
304  struct {
306  size_t data_length;
307  } other;
308  } payload;
310 
311 typedef struct H264RawSEI {
313 
316 } H264RawSEI;
317 
318 typedef struct H264RawSliceHeader {
320 
323 
325 
327 
328  uint16_t frame_num;
331 
332  uint16_t idr_pic_id;
333 
337 
340 
344 
347  struct {
352 
355 
362 
369 
372 
374  struct {
381 
383 
385 
388 
392 
395 
396 typedef struct H264RawSlice {
398 
400  size_t data_size;
402 } H264RawSlice;
403 
404 
406  // Reader/writer context in common with the H.265 implementation.
408 
409  // All currently available parameter sets. These are updated when
410  // any parameter set NAL unit is read/written with this context.
413 
414  // The currently active parameter sets. These are updated when any
415  // NAL unit refers to the relevant parameter set. These pointers
416  // must also be present in the arrays above.
419 
420  // The NAL unit type of the most recent normal slice. This is required
421  // to be able to read/write auxiliary slices, because IdrPicFlag is
422  // otherwise unknown.
425 
426 
427 #endif /* AVCODEC_CBS_H264_H */
struct H264RawSEIBufferingPeriod::@55 nal
H264RawNALUnitHeader nal_unit_header
Definition: cbs_h264.h:181
uint8_t frame_cropping_flag
Definition: cbs_h264.h:156
uint8_t deblocking_filter_control_present_flag
Definition: cbs_h264.h:209
uint32_t payload_type
Definition: cbs_h264.h:294
uint8_t slice_group_change_direction_flag
Definition: cbs_h264.h:194
uint8_t cnt_dropped_flag
Definition: cbs_h264.h:245
int8_t chroma_weight_l0[H264_MAX_REFS][2]
Definition: cbs_h264.h:360
uint8_t bit_depth_chroma_minus8
Definition: cbs_h264.h:129
int8_t luma_offset_l0[H264_MAX_REFS]
Definition: cbs_h264.h:358
uint8_t aspect_ratio_idc
Definition: cbs_h264.h:69
uint8_t bit_depth_aux_minus8
Definition: cbs_h264.h:172
uint8_t num_ref_idx_l0_active_minus1
Definition: cbs_h264.h:342
uint8_t max_long_term_frame_idx_plus1
Definition: cbs_h264.h:379
uint8_t cabac_init_idc
Definition: cbs_h264.h:382
uint8_t video_format
Definition: cbs_h264.h:77
uint8_t bit_rate_scale
Definition: cbs_h264.h:54
uint16_t recovery_frame_cnt
Definition: cbs_h264.h:278
uint8_t discontinuity_flag
Definition: cbs_h264.h:244
struct H264RawSEIPayload::@56::@57 other
uint8_t dpb_output_delay_length_minus1
Definition: cbs_h264.h:63
uint8_t initial_cpb_removal_delay_length_minus1
Definition: cbs_h264.h:61
uint8_t chroma_sample_loc_type_bottom_field
Definition: cbs_h264.h:86
int32_t offset_for_top_to_bottom_field
Definition: cbs_h264.h:142
uint16_t bottom_right[H264_MAX_SLICE_GROUPS]
Definition: cbs_h264.h:193
uint8_t * data
Definition: cbs_h264.h:305
H264RawPPS * pps[H264_MAX_PPS_COUNT]
Definition: cbs_h264.h:412
uint8_t num_ref_idx_l1_active_minus1
Definition: cbs_h264.h:343
H264RawNALUnitHeader nal_unit_header
Definition: cbs_h264.h:312
uint8_t long_term_pic_num
Definition: cbs_h264.h:350
H264RawSEIRecoveryPoint recovery_point
Definition: cbs_h264.h:302
uint8_t log2_max_frame_num_minus4
Definition: cbs_h264.h:137
H264RawScalingList scaling_list_4x4[6]
Definition: cbs_h264.h:134
uint8_t num_ref_frames_in_pic_order_cnt_cycle
Definition: cbs_h264.h:143
uint8_t sp_for_switch_flag
Definition: cbs_h264.h:386
uint16_t pic_order_cnt_lsb
Definition: cbs_h264.h:334
uint8_t time_offset_length
Definition: cbs_h264.h:64
uint8_t low_delay_hrd_flag
Definition: cbs_h264.h:97
uint8_t max_dec_frame_buffering
Definition: cbs_h264.h:108
uint8_t fixed_frame_rate_flag
Definition: cbs_h264.h:91
H264RawVUI vui
Definition: cbs_h264.h:163
uint32_t first_mb_in_slice
Definition: cbs_h264.h:321
int8_t slice_alpha_c0_offset_div2
Definition: cbs_h264.h:390
uint8_t field_pic_flag
Definition: cbs_h264.h:329
struct H264RawSliceHeader::@58 rplm_l1[H264_MAX_RPLM_COUNT]
uint8_t display_orientation_extension_flag
Definition: cbs_h264.h:290
uint8_t weighted_pred_flag
Definition: cbs_h264.h:202
uint8_t constraint_set4_flag
Definition: cbs_h264.h:119
H264RawHRD nal_hrd_parameters
Definition: cbs_h264.h:94
uint8_t itu_t_t35_country_code_extension_byte
Definition: cbs_h264.h:266
int8_t slice_qp_delta
Definition: cbs_h264.h:384
uint8_t reserved_zero_2bits
Definition: cbs_h264.h:121
uint8_t bottom_field_flag
Definition: cbs_h264.h:330
uint8_t
uint8_t overscan_info_present_flag
Definition: cbs_h264.h:73
uint16_t frame_crop_top_offset
Definition: cbs_h264.h:159
uint16_t pic_width_in_mbs_minus1
Definition: cbs_h264.h:149
uint8_t colour_plane_id
Definition: cbs_h264.h:326
uint8_t long_term_frame_idx
Definition: cbs_h264.h:378
uint16_t display_orientation_repetition_period
Definition: cbs_h264.h:289
H264RawNALUnitHeader nal_unit_header
Definition: cbs_h264.h:319
uint32_t num_units_in_tick
Definition: cbs_h264.h:89
uint8_t mb_adaptive_frame_field_flag
Definition: cbs_h264.h:153
uint8_t transform_8x8_mode_flag
Definition: cbs_h264.h:215
uint8_t constrained_intra_pred_flag
Definition: cbs_h264.h:210
uint32_t cpb_size_value_minus1[H264_MAX_CPB_CNT]
Definition: cbs_h264.h:58
uint16_t frame_crop_left_offset
Definition: cbs_h264.h:157
uint16_t run_length_minus1[H264_MAX_SLICE_GROUPS]
Definition: cbs_h264.h:191
H264RawSPS * sps[H264_MAX_SPS_COUNT]
Definition: cbs_h264.h:411
uint8_t luma_log2_weight_denom
Definition: cbs_h264.h:353
H264RawNALUnitHeader nal_unit_header
Definition: cbs_h264.h:226
uint16_t idr_pic_id
Definition: cbs_h264.h:332
uint8_t ref_pic_list_modification_flag_l0
Definition: cbs_h264.h:345
int8_t second_chroma_qp_index_offset
Definition: cbs_h264.h:222
uint8_t additional_extension_flag
Definition: cbs_h264.h:177
uint8_t aux_format_idc
Definition: cbs_h264.h:171
uint8_t cpb_size_scale
Definition: cbs_h264.h:55
uint8_t nal_hrd_parameters_present_flag
Definition: cbs_h264.h:93
uint8_t bit_depth_luma_minus8
Definition: cbs_h264.h:128
uint8_t primary_pic_type
Definition: cbs_h264.h:228
uint8_t slice_group_map_type
Definition: cbs_h264.h:190
uint8_t svc_extension_flag
Definition: cbs_h264.h:44
H.264 common definitions.
uint8_t pic_scaling_matrix_present_flag
Definition: cbs_h264.h:217
uint8_t chroma_sample_loc_type_top_field
Definition: cbs_h264.h:85
uint8_t modification_of_pic_nums_idc
Definition: cbs_h264.h:348
uint8_t aspect_ratio_info_present_flag
Definition: cbs_h264.h:68
uint8_t seq_scaling_list_present_flag[12]
Definition: cbs_h264.h:133
uint8_t luma_weight_l1_flag[H264_MAX_REFS]
Definition: cbs_h264.h:363
uint8_t max_bits_per_mb_denom
Definition: cbs_h264.h:104
uint8_t max_num_ref_frames
Definition: cbs_h264.h:146
uint8_t weighted_bipred_idc
Definition: cbs_h264.h:203
struct H264RawSliceHeader::@59 mmco[H264_MAX_MMCO_COUNT]
uint8_t transfer_characteristics
Definition: cbs_h264.h:81
uint8_t chroma_weight_l1_flag[H264_MAX_REFS]
Definition: cbs_h264.h:366
struct H264RawSliceHeader::@58 rplm_l0[H264_MAX_RPLM_COUNT]
uint16_t sar_width
Definition: cbs_h264.h:70
uint32_t initial_cpb_removal_delay_offset[H264_MAX_CPB_CNT]
Definition: cbs_h264.h:235
uint8_t slice_type
Definition: cbs_h264.h:322
int32_t offset_for_non_ref_pic
Definition: cbs_h264.h:141
uint8_t num_ref_idx_l1_default_active_minus1
Definition: cbs_h264.h:200
uint16_t top_left[H264_MAX_SLICE_GROUPS]
Definition: cbs_h264.h:192
uint8_t frame_mbs_only_flag
Definition: cbs_h264.h:152
uint8_t clock_timestamp_flag[3]
Definition: cbs_h264.h:260
int8_t slice_qs_delta
Definition: cbs_h264.h:387
uint8_t ref_pic_list_modification_flag_l1
Definition: cbs_h264.h:346
uint8_t num_ref_idx_active_override_flag
Definition: cbs_h264.h:341
uint8_t seq_parameter_set_id
Definition: cbs_h264.h:124
int8_t chroma_weight_l1[H264_MAX_REFS][2]
Definition: cbs_h264.h:367
uint8_t seq_scaling_matrix_present_flag
Definition: cbs_h264.h:132
int32_t delta_pic_order_cnt[2]
Definition: cbs_h264.h:336
H264RawSEIPicTiming pic_timing
Definition: cbs_h264.h:298
uint8_t timing_info_present_flag
Definition: cbs_h264.h:88
uint8_t more_rbsp_data
Definition: cbs_h264.h:212
uint8_t full_timestamp_flag
Definition: cbs_h264.h:243
uint8_t constraint_set2_flag
Definition: cbs_h264.h:117
uint8_t video_full_range_flag
Definition: cbs_h264.h:78
uint8_t seq_parameter_set_id
Definition: cbs_h264.h:184
H264RawSEIUserDataUnregistered user_data_unregistered
Definition: cbs_h264.h:301
H264RawSEIPicTimestamp timestamp[3]
Definition: cbs_h264.h:261
uint8_t pic_struct
Definition: cbs_h264.h:259
uint8_t adaptive_ref_pic_marking_mode_flag
Definition: cbs_h264.h:373
uint8_t colour_primaries
Definition: cbs_h264.h:80
uint8_t chroma_log2_weight_denom
Definition: cbs_h264.h:354
uint16_t sar_height
Definition: cbs_h264.h:71
uint16_t frame_crop_bottom_offset
Definition: cbs_h264.h:160
uint8_t separate_colour_plane_flag
Definition: cbs_h264.h:127
uint8_t vui_parameters_present_flag
Definition: cbs_h264.h:162
uint8_t gaps_in_frame_num_allowed_flag
Definition: cbs_h264.h:147
uint8_t last_slice_nal_unit_type
Definition: cbs_h264.h:423
uint32_t cpb_removal_delay
Definition: cbs_h264.h:257
int32_t
uint8_t colour_description_present_flag
Definition: cbs_h264.h:79
int8_t slice_beta_offset_div2
Definition: cbs_h264.h:391
uint8_t seq_parameter_set_id
Definition: cbs_h264.h:169
uint32_t dpb_output_delay
Definition: cbs_h264.h:258
uint8_t video_signal_type_present_flag
Definition: cbs_h264.h:76
int8_t chroma_offset_l1[H264_MAX_REFS][2]
Definition: cbs_h264.h:368
uint8_t overscan_appropriate_flag
Definition: cbs_h264.h:74
int8_t chroma_qp_index_offset
Definition: cbs_h264.h:207
uint8_t qpprime_y_zero_transform_bypass_flag
Definition: cbs_h264.h:130
int8_t luma_weight_l0[H264_MAX_REFS]
Definition: cbs_h264.h:357
uint8_t slice_group_id[H264_MAX_MB_PIC_SIZE]
Definition: cbs_h264.h:197
uint8_t constraint_set5_flag
Definition: cbs_h264.h:120
union H264RawSEIPayload::@56 payload
size_t data_size
Definition: cbs_h264.h:400
uint8_t pic_parameter_set_id
Definition: cbs_h264.h:324
uint8_t chroma_format_idc
Definition: cbs_h264.h:126
uint8_t disable_deblocking_filter_idc
Definition: cbs_h264.h:389
uint8_t profile_idc
Definition: cbs_h264.h:114
int32_t abs_diff_pic_num_minus1
Definition: cbs_h264.h:349
H264RawSEIUserDataRegistered user_data_registered
Definition: cbs_h264.h:300
uint32_t bit_rate_value_minus1[H264_MAX_CPB_CNT]
Definition: cbs_h264.h:57
uint8_t cpb_cnt_minus1
Definition: cbs_h264.h:53
H264RawNALUnitHeader nal_unit_header
Definition: cbs_h264.h:112
uint8_t nuit_field_based_flag
Definition: cbs_h264.h:241
uint8_t chroma_loc_info_present_flag
Definition: cbs_h264.h:84
uint8_t cbr_flag[H264_MAX_CPB_CNT]
Definition: cbs_h264.h:59
uint8_t num_slice_groups_minus1
Definition: cbs_h264.h:189
uint8_t bottom_field_pic_order_in_frame_present_flag
Definition: cbs_h264.h:187
int8_t luma_weight_l1[H264_MAX_REFS]
Definition: cbs_h264.h:364
uint8_t entropy_coding_mode_flag
Definition: cbs_h264.h:186
uint8_t changing_slice_group_idc
Definition: cbs_h264.h:281
uint8_t redundant_pic_cnt
Definition: cbs_h264.h:338
uint8_t avc_3d_extension_flag
Definition: cbs_h264.h:45
uint16_t slice_group_change_cycle
Definition: cbs_h264.h:393
struct H264RawSEIBufferingPeriod::@55 vcl
H264RawScalingList scaling_list_8x8[6]
Definition: cbs_h264.h:135
uint16_t pic_size_in_map_units_minus1
Definition: cbs_h264.h:196
uint8_t pic_order_cnt_type
Definition: cbs_h264.h:138
uint8_t matrix_coefficients
Definition: cbs_h264.h:82
uint8_t num_ref_idx_l0_default_active_minus1
Definition: cbs_h264.h:199
uint8_t constraint_set0_flag
Definition: cbs_h264.h:115
uint8_t alpha_incr_flag
Definition: cbs_h264.h:173
uint16_t frame_num
Definition: cbs_h264.h:328
uint8_t log2_max_mv_length_horizontal
Definition: cbs_h264.h:105
uint8_t direct_spatial_mv_pred_flag
Definition: cbs_h264.h:339
uint8_t luma_weight_l0_flag[H264_MAX_REFS]
Definition: cbs_h264.h:356
int8_t luma_offset_l1[H264_MAX_REFS]
Definition: cbs_h264.h:365
H264RawSEIBufferingPeriod buffering_period
Definition: cbs_h264.h:297
H264RawSEIPayload payload[H264_MAX_SEI_PAYLOADS]
Definition: cbs_h264.h:314
int8_t chroma_offset_l0[H264_MAX_REFS][2]
Definition: cbs_h264.h:361
uint8_t direct_8x8_inference_flag
Definition: cbs_h264.h:154
uint16_t alpha_transparent_value
Definition: cbs_h264.h:175
uint32_t initial_cpb_removal_delay[H264_MAX_CPB_CNT]
Definition: cbs_h264.h:234
size_t data_length
Definition: cbs_h264.h:306
uint8_t redundant_pic_cnt_present_flag
Definition: cbs_h264.h:214
int32_t offset_for_ref_frame[256]
Definition: cbs_h264.h:144
uint8_t memory_management_control_operation
Definition: cbs_h264.h:375
uint8_t pic_struct_present_flag
Definition: cbs_h264.h:99
int8_t delta_scale[64]
Definition: cbs_h264.h:49
uint8_t cpb_removal_delay_length_minus1
Definition: cbs_h264.h:62
H264RawSEIDisplayOrientation display_orientation
Definition: cbs_h264.h:303
uint8_t motion_vectors_over_pic_boundaries_flag
Definition: cbs_h264.h:102
uint32_t time_scale
Definition: cbs_h264.h:90
uint8_t display_orientation_cancel_flag
Definition: cbs_h264.h:285
H264RawScalingList scaling_list_8x8[6]
Definition: cbs_h264.h:220
uint8_t level_idc
Definition: cbs_h264.h:122
uint8_t bitstream_restriction_flag
Definition: cbs_h264.h:101
uint16_t frame_crop_right_offset
Definition: cbs_h264.h:158
uint8_t pic_parameter_set_id
Definition: cbs_h264.h:183
uint8_t max_num_reorder_frames
Definition: cbs_h264.h:107
int data_bit_start
Definition: cbs_h264.h:401
H264RawScalingList scaling_list_4x4[6]
Definition: cbs_h264.h:219
uint8_t log2_max_mv_length_vertical
Definition: cbs_h264.h:106
int32_t delta_pic_order_cnt_bottom
Definition: cbs_h264.h:335
H264RawSliceHeader header
Definition: cbs_h264.h:397
uint8_t long_term_reference_flag
Definition: cbs_h264.h:371
uint8_t log2_max_pic_order_cnt_lsb_minus4
Definition: cbs_h264.h:139
H264RawNALUnitHeader nal_unit_header
Definition: cbs_h264.h:167
uint16_t alpha_opaque_value
Definition: cbs_h264.h:174
uint8_t delta_pic_order_always_zero_flag
Definition: cbs_h264.h:140
uint8_t forbidden_zero_bit
Definition: cbs_h264.h:40
int8_t pic_init_qp_minus26
Definition: cbs_h264.h:205
const H264RawPPS * active_pps
Definition: cbs_h264.h:418
CodedBitstreamH2645Context common
Definition: cbs_h264.h:407
uint8_t nal_ref_idc
Definition: cbs_h264.h:41
uint32_t payload_size
Definition: cbs_h264.h:295
int8_t pic_init_qs_minus26
Definition: cbs_h264.h:206
uint8_t chroma_weight_l0_flag[H264_MAX_REFS]
Definition: cbs_h264.h:359
uint8_t constraint_set1_flag
Definition: cbs_h264.h:116
uint16_t pic_height_in_map_units_minus1
Definition: cbs_h264.h:150
int32_t difference_of_pic_nums_minus1
Definition: cbs_h264.h:376
uint8_t nal_unit_type
Definition: cbs_h264.h:42
uint8_t pic_scaling_list_present_flag[12]
Definition: cbs_h264.h:218
uint8_t * data
Definition: cbs_h264.h:399
uint8_t payload_count
Definition: cbs_h264.h:315
uint8_t vcl_hrd_parameters_present_flag
Definition: cbs_h264.h:95
uint8_t no_output_of_prior_pics_flag
Definition: cbs_h264.h:370
uint8_t max_bytes_per_pic_denom
Definition: cbs_h264.h:103
H264RawHRD vcl_hrd_parameters
Definition: cbs_h264.h:96
const H264RawSPS * active_sps
Definition: cbs_h264.h:417
uint16_t slice_group_change_rate_minus1
Definition: cbs_h264.h:195
uint8_t constraint_set3_flag
Definition: cbs_h264.h:118