FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
cbs_av1.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_AV1_H
20 #define AVCODEC_CBS_AV1_H
21 
22 #include <stddef.h>
23 #include <stdint.h>
24 
25 #include "av1.h"
26 #include "cbs.h"
27 
28 
29 typedef struct AV1RawOBUHeader {
35 
40 
41 typedef struct AV1RawColorConfig {
45 
50 
57 
58 typedef struct AV1RawTimingInfo {
60  uint32_t time_scale;
61 
65 
66 typedef struct AV1RawDecoderModelInfo {
72 
73 typedef struct AV1RawSequenceHeader {
77 
82 
85 
95 
100 
104 
112 
116 
121 
123 
127 
129 
132 
133 typedef struct AV1RawFrameHeader {
138 
142 
147 
151 
154 
163 
165 
174 
180 
182 
190 
191  // These are derived values, but it's very unhelpful to have to
192  // recalculate them all the time so we store them here.
193  uint16_t tile_cols;
194  uint16_t tile_rows;
195 
197  int8_t delta_q_y_dc;
199  int8_t delta_q_u_dc;
200  int8_t delta_q_u_ac;
201  int8_t delta_q_v_dc;
202  int8_t delta_q_v_ac;
207 
214 
220 
229 
236 
240 
244 
247 
251  //AV1RawSubexp gm_params[AV1_TOTAL_REFS_PER_FRAME][6];
253 
255  uint16_t grain_seed;
277  uint16_t cb_offset;
280  uint16_t cr_offset;
284 
285 typedef struct AV1RawTileData {
287  size_t data_size;
290 
291 typedef struct AV1RawTileGroup {
293  uint16_t tg_start;
294  uint16_t tg_end;
295 
298 
299 typedef struct AV1RawFrame {
302 } AV1RawFrame;
303 
304 typedef struct AV1RawTileList {
308 
311 
312 typedef struct AV1RawMetadataHDRCLL {
313  uint16_t max_cll;
314  uint16_t max_fall;
316 
317 typedef struct AV1RawMetadataHDRMDCV {
322  uint32_t luminance_max;
323  uint32_t luminance_min;
325 
328  // TODO: more stuff.
330 
331 typedef struct AV1RawMetadataITUTT35 {
334 
336  size_t payload_size;
339 
340 typedef struct AV1RawMetadataTimecode {
345  uint16_t n_frames;
355 
356 typedef struct AV1RawMetadata {
357  uint64_t metadata_type;
358  union {
364  } metadata;
366 
367 
368 typedef struct AV1RawOBU {
370 
371  size_t obu_size;
372 
373  union {
380  } obu;
381 } AV1RawOBU;
382 
383 typedef struct AV1ReferenceFrameState {
384  int valid; // RefValid
385  int frame_id; // RefFrameId
386  int upscaled_width; // RefUpscaledWidth
387  int frame_width; // RefFrameWidth
388  int frame_height; // RefFrameHeight
389  int render_width; // RefRenderWidth
390  int render_height; // RefRenderHeight
391  int frame_type; // RefFrameType
392  int subsampling_x; // RefSubsamplingX
393  int subsampling_y; // RefSubsamplingY
394  int bit_depth; // RefBitDepth
395  int order_hint; // RefOrderHint
397 
398 typedef struct CodedBitstreamAV1Context {
401 
406 
410 
417 
423 
425 
426  // Write buffer.
430 
431 
432 #endif /* AVCODEC_CBS_AV1_H */
AV1RawMetadata metadata
Definition: cbs_av1.h:379
uint8_t use_ref_frame_mvs
Definition: cbs_av1.h:179
uint8_t tx_mode
Definition: cbs_av1.h:241
uint32_t display_frame_id
Definition: cbs_av1.h:137
uint8_t full_timestamp_flag
Definition: cbs_av1.h:342
int8_t ref_frame_idx[AV1_REFS_PER_FRAME]
Definition: cbs_av1.h:172
size_t obu_size
Definition: cbs_av1.h:371
uint8_t cdef_y_pri_strength[8]
Definition: cbs_av1.h:232
uint8_t frame_width_bits_minus_1
Definition: cbs_av1.h:96
AV1RawTileList tile_list
Definition: cbs_av1.h:378
uint8_t loop_filter_sharpness
Definition: cbs_av1.h:222
uint8_t enable_superres
Definition: cbs_av1.h:124
uint8_t film_grain_params_ref_idx
Definition: cbs_av1.h:257
uint8_t cnt_dropped_flag
Definition: cbs_av1.h:344
uint32_t time_scale
Definition: cbs_av1.h:60
uint8_t refresh_frame_flags
Definition: cbs_av1.h:166
uint8_t disable_cdf_update
Definition: cbs_av1.h:144
uint8_t mono_chrome
Definition: cbs_av1.h:44
uint8_t seq_choose_integer_mv
Definition: cbs_av1.h:119
uint8_t allow_screen_content_tools
Definition: cbs_av1.h:145
AVBufferRef * payload_ref
Definition: cbs_av1.h:337
uint8_t cdef_y_sec_strength[8]
Definition: cbs_av1.h:233
uint8_t num_y_points
Definition: cbs_av1.h:258
AVBufferRef * sequence_header_ref
Definition: cbs_av1.h:400
uint8_t ar_coeffs_cr_plus_128[24]
Definition: cbs_av1.h:272
uint8_t height_in_sbs_minus_1[AV1_MAX_TILE_ROWS]
Definition: cbs_av1.h:187
uint8_t additional_frame_id_length_minus_1
Definition: cbs_av1.h:103
uint8_t grain_scaling_minus_8
Definition: cbs_av1.h:268
uint16_t white_point_chromaticity_x
Definition: cbs_av1.h:320
uint8_t primary_ref_frame
Definition: cbs_av1.h:155
uint8_t allow_high_precision_mv
Definition: cbs_av1.h:175
uint8_t order_hint_bits_minus_1
Definition: cbs_av1.h:122
uint8_t point_cb_value[16]
Definition: cbs_av1.h:263
uint8_t enable_jnt_comp
Definition: cbs_av1.h:114
uint8_t ar_coeffs_y_plus_128[24]
Definition: cbs_av1.h:270
uint8_t cr_mult
Definition: cbs_av1.h:278
uint8_t initial_display_delay_minus_1[AV1_MAX_OPERATING_POINTS]
Definition: cbs_av1.h:94
uint8_t timing_info_present_flag
Definition: cbs_av1.h:78
uint32_t num_units_in_display_tick
Definition: cbs_av1.h:59
uint32_t gm_params[AV1_TOTAL_REFS_PER_FRAME][6]
Definition: cbs_av1.h:252
uint8_t showable_frame
Definition: cbs_av1.h:141
uint8_t tile_cols_log2
Definition: cbs_av1.h:184
uint8_t color_range
Definition: cbs_av1.h:51
uint8_t lr_unit_shift
Definition: cbs_av1.h:238
uint16_t frame_width_minus_1
Definition: cbs_av1.h:156
uint8_t operating_points_cnt_minus_1
Definition: cbs_av1.h:81
uint8_t chroma_scaling_from_luma
Definition: cbs_av1.h:261
uint8_t update_mode_delta[2]
Definition: cbs_av1.h:227
uint8_t seq_profile
Definition: cbs_av1.h:74
uint8_t interpolation_filter
Definition: cbs_av1.h:177
uint8_t cb_luma_mult
Definition: cbs_av1.h:276
uint8_t lr_uv_shift
Definition: cbs_av1.h:239
uint8_t reduced_still_picture_header
Definition: cbs_av1.h:76
uint8_t seq_choose_screen_content_tools
Definition: cbs_av1.h:117
uint8_t delta_lf_res
Definition: cbs_av1.h:218
uint8_t buffer_removal_time_present_flag
Definition: cbs_av1.h:152
uint16_t tile_rows
Definition: cbs_av1.h:194
AV1RawTileData tile_data
Definition: cbs_av1.h:309
uint8_t matrix_coefficients
Definition: cbs_av1.h:49
uint8_t enable_intra_edge_filter
Definition: cbs_av1.h:107
uint8_t clip_to_restricted_range
Definition: cbs_av1.h:282
uint8_t order_hint
Definition: cbs_av1.h:150
uint8_t discontinuity_flag
Definition: cbs_av1.h:343
uint8_t
uint8_t film_grain_params_present
Definition: cbs_av1.h:130
uint8_t enable_masked_compound
Definition: cbs_av1.h:109
uint8_t * data
Definition: cbs_av1.h:286
uint16_t max_frame_width_minus_1
Definition: cbs_av1.h:98
uint8_t * write_buffer
Definition: cbs_av1.h:427
union AV1RawMetadata::@46 metadata
uint8_t point_cr_value[16]
Definition: cbs_av1.h:266
uint16_t context_update_tile_id
Definition: cbs_av1.h:188
uint8_t initial_display_delay_present_for_this_op[AV1_MAX_OPERATING_POINTS]
Definition: cbs_av1.h:93
uint8_t ar_coeffs_cb_plus_128[24]
Definition: cbs_av1.h:271
uint8_t cr_luma_mult
Definition: cbs_av1.h:279
uint8_t allow_intrabc
Definition: cbs_av1.h:167
uint8_t delta_lf_multi
Definition: cbs_av1.h:219
uint8_t qm_v
Definition: cbs_av1.h:206
uint8_t output_frame_width_in_tiles_minus_1
Definition: cbs_av1.h:305
AV1RawMetadataHDRMDCV hdr_mdcv
Definition: cbs_av1.h:360
uint8_t high_bitdepth
Definition: cbs_av1.h:42
uint8_t enable_warped_motion
Definition: cbs_av1.h:110
uint8_t ref_order_hint[AV1_NUM_REF_FRAMES]
Definition: cbs_av1.h:168
uint8_t itu_t_t35_country_code
Definition: cbs_av1.h:332
uint8_t allow_warped_motion
Definition: cbs_av1.h:245
uint8_t extension_header_reserved_3bits
Definition: cbs_av1.h:38
uint16_t tile_count_minus_1
Definition: cbs_av1.h:307
uint8_t render_height_minus_1
Definition: cbs_av1.h:162
uint8_t enable_ref_frame_mvs
Definition: cbs_av1.h:115
uint8_t frame_presentation_time_length_minus_1
Definition: cbs_av1.h:70
uint8_t cdef_bits
Definition: cbs_av1.h:231
int8_t delta_q_v_dc
Definition: cbs_av1.h:201
uint8_t tile_start_and_end_present_flag
Definition: cbs_av1.h:292
uint8_t * frame_header
Definition: cbs_av1.h:404
uint8_t enable_filter_intra
Definition: cbs_av1.h:106
uint16_t operating_point_idc[AV1_MAX_OPERATING_POINTS]
Definition: cbs_av1.h:86
uint8_t seq_force_integer_mv
Definition: cbs_av1.h:120
uint8_t use_superres
Definition: cbs_av1.h:158
uint8_t separate_uv_delta_q
Definition: cbs_av1.h:55
AV1RawTileData tile_data
Definition: cbs_av1.h:296
uint8_t temporal_id
Definition: cbs_av1.h:36
AVBufferRef * frame_header_ref
Definition: cbs_av1.h:403
uint16_t frame_height_minus_1
Definition: cbs_av1.h:157
uint8_t twelve_bit
Definition: cbs_av1.h:43
AV1RawMetadataTimecode timecode
Definition: cbs_av1.h:363
AV1RawFrame frame
Definition: cbs_av1.h:376
uint8_t point_y_scaling[16]
Definition: cbs_av1.h:260
uint8_t force_integer_mv
Definition: cbs_av1.h:146
uint8_t buffer_delay_length_minus_1
Definition: cbs_av1.h:67
uint16_t primary_chromaticity_y[3]
Definition: cbs_av1.h:319
uint8_t still_picture
Definition: cbs_av1.h:75
uint8_t apply_grain
Definition: cbs_av1.h:254
AV1RawColorConfig color_config
Definition: cbs_av1.h:128
uint16_t tg_start
Definition: cbs_av1.h:293
uint8_t obu_extension_flag
Definition: cbs_av1.h:32
uint8_t qm_u
Definition: cbs_av1.h:205
uint8_t cdef_uv_sec_strength[8]
Definition: cbs_av1.h:235
uint8_t seq_tier[AV1_MAX_OPERATING_POINTS]
Definition: cbs_av1.h:88
uint32_t frame_presentation_time
Definition: cbs_av1.h:136
uint16_t max_cll
Definition: cbs_av1.h:313
uint32_t luminance_min
Definition: cbs_av1.h:323
uint8_t reference_select
Definition: cbs_av1.h:242
uint8_t use_128x128_superblock
Definition: cbs_av1.h:105
uint8_t frame_type
Definition: cbs_av1.h:139
int8_t loop_filter_mode_deltas[2]
Definition: cbs_av1.h:228
uint8_t obu_reserved_1bit
Definition: cbs_av1.h:34
uint8_t enable_restoration
Definition: cbs_av1.h:126
AV1RawOBUHeader header
Definition: cbs_av1.h:369
uint8_t is_global[AV1_TOTAL_REFS_PER_FRAME]
Definition: cbs_av1.h:248
AV1RawMetadataScalability scalability
Definition: cbs_av1.h:361
uint8_t enable_cdef
Definition: cbs_av1.h:125
uint32_t time_offset_value
Definition: cbs_av1.h:353
uint8_t ar_coeff_lag
Definition: cbs_av1.h:269
uint8_t color_primaries
Definition: cbs_av1.h:47
uint16_t cr_offset
Definition: cbs_av1.h:280
uint8_t width_in_sbs_minus_1[AV1_MAX_TILE_COLS]
Definition: cbs_av1.h:186
size_t data_size
Definition: cbs_av1.h:287
uint16_t white_point_chromaticity_y
Definition: cbs_av1.h:321
uint8_t scalability_mode_idc
Definition: cbs_av1.h:327
uint8_t cb_mult
Definition: cbs_av1.h:275
uint8_t subsampling_y
Definition: cbs_av1.h:53
uint8_t decoder_model_info_present_flag
Definition: cbs_av1.h:79
uint8_t delta_frame_id_minus1
Definition: cbs_av1.h:173
uint16_t max_frame_height_minus_1
Definition: cbs_av1.h:99
uint8_t using_qmatrix
Definition: cbs_av1.h:203
uint8_t low_delay_mode_flag[AV1_MAX_OPERATING_POINTS]
Definition: cbs_av1.h:92
uint8_t diff_uv_delta
Definition: cbs_av1.h:198
uint8_t delta_frame_id_length_minus_2
Definition: cbs_av1.h:102
uint8_t loop_filter_delta_update
Definition: cbs_av1.h:224
int8_t delta_q_u_dc
Definition: cbs_av1.h:199
uint8_t subsampling_x
Definition: cbs_av1.h:52
uint8_t error_resilient_mode
Definition: cbs_av1.h:143
uint16_t max_fall
Definition: cbs_av1.h:314
uint8_t enable_order_hint
Definition: cbs_av1.h:113
uint8_t segmentation_temporal_update
Definition: cbs_av1.h:210
uint32_t current_frame_id
Definition: cbs_av1.h:148
AV1 common definitions.
uint8_t delta_q_res
Definition: cbs_av1.h:216
uint8_t loop_filter_delta_enabled
Definition: cbs_av1.h:223
AV1ReferenceFrameState ref[AV1_NUM_REF_FRAMES]
Definition: cbs_av1.h:424
uint32_t buffer_removal_time[AV1_MAX_OPERATING_POINTS]
Definition: cbs_av1.h:153
uint8_t loop_filter_level[4]
Definition: cbs_av1.h:221
uint8_t decoder_model_present_for_this_op[AV1_MAX_OPERATING_POINTS]
Definition: cbs_av1.h:89
uint8_t is_filter_switchable
Definition: cbs_av1.h:176
uint16_t cb_offset
Definition: cbs_av1.h:277
uint8_t show_existing_frame
Definition: cbs_av1.h:134
AV1RawTileGroup tile_group
Definition: cbs_av1.h:301
uint8_t point_cb_scaling[16]
Definition: cbs_av1.h:264
uint8_t color_description_present_flag
Definition: cbs_av1.h:46
uint32_t luminance_max
Definition: cbs_av1.h:322
uint8_t obu_type
Definition: cbs_av1.h:31
AV1RawDecoderModelInfo decoder_model_info
Definition: cbs_av1.h:84
int8_t delta_q_u_ac
Definition: cbs_av1.h:200
uint8_t last_frame_idx
Definition: cbs_av1.h:170
uint8_t base_q_idx
Definition: cbs_av1.h:196
AV1RawSequenceHeader * sequence_header
Definition: cbs_av1.h:399
uint8_t spatial_id
Definition: cbs_av1.h:37
uint8_t feature_enabled[AV1_MAX_SEGMENTS][AV1_SEG_LVL_MAX]
Definition: cbs_av1.h:212
uint32_t num_ticks_per_picture_minus_1
Definition: cbs_av1.h:63
AV1RawSequenceHeader sequence_header
Definition: cbs_av1.h:374
uint8_t equal_picture_interval
Definition: cbs_av1.h:62
uint8_t tile_size_bytes_minus1
Definition: cbs_av1.h:189
uint32_t encoder_buffer_delay[AV1_MAX_OPERATING_POINTS]
Definition: cbs_av1.h:91
uint8_t lr_type[3]
Definition: cbs_av1.h:237
uint8_t segmentation_enabled
Definition: cbs_av1.h:208
uint8_t cdef_uv_pri_strength[8]
Definition: cbs_av1.h:234
uint8_t qm_y
Definition: cbs_av1.h:204
AV1RawMetadataHDRCLL hdr_cll
Definition: cbs_av1.h:359
uint16_t tile_cols
Definition: cbs_av1.h:193
uint8_t disable_frame_end_update_cdf
Definition: cbs_av1.h:181
AVBufferRef * data_ref
Definition: cbs_av1.h:288
uint8_t segmentation_update_map
Definition: cbs_av1.h:209
uint8_t frame_id_numbers_present_flag
Definition: cbs_av1.h:101
A reference to a data buffer.
Definition: buffer.h:81
uint8_t coded_denom
Definition: cbs_av1.h:159
uint8_t frame_height_bits_minus_1
Definition: cbs_av1.h:97
AV1RawMetadataITUTT35 itut_t35
Definition: cbs_av1.h:362
uint8_t is_translation[AV1_TOTAL_REFS_PER_FRAME]
Definition: cbs_av1.h:250
int8_t loop_filter_ref_deltas[AV1_TOTAL_REFS_PER_FRAME]
Definition: cbs_av1.h:226
uint8_t buffer_removal_time_length_minus_1
Definition: cbs_av1.h:69
uint8_t cdef_damping_minus_3
Definition: cbs_av1.h:230
uint8_t ar_coeff_shift_minus_6
Definition: cbs_av1.h:273
uint8_t frame_size_override_flag
Definition: cbs_av1.h:149
uint8_t overlap_flag
Definition: cbs_av1.h:281
uint8_t time_offset_length
Definition: cbs_av1.h:352
uint8_t point_cr_scaling[16]
Definition: cbs_av1.h:267
uint8_t delta_q_present
Definition: cbs_av1.h:215
uint8_t found_ref[AV1_REFS_PER_FRAME]
Definition: cbs_av1.h:164
uint8_t feature_value[AV1_MAX_SEGMENTS][AV1_SEG_LVL_MAX]
Definition: cbs_av1.h:213
uint8_t uniform_tile_spacing_flag
Definition: cbs_av1.h:183
int8_t delta_q_v_ac
Definition: cbs_av1.h:202
uint8_t point_y_value[16]
Definition: cbs_av1.h:259
uint8_t num_cb_points
Definition: cbs_av1.h:262
uint64_t metadata_type
Definition: cbs_av1.h:357
uint8_t * payload
Definition: cbs_av1.h:335
uint32_t decoder_buffer_delay[AV1_MAX_OPERATING_POINTS]
Definition: cbs_av1.h:90
int8_t delta_q_y_dc
Definition: cbs_av1.h:197
uint16_t tg_end
Definition: cbs_av1.h:294
uint8_t is_motion_mode_switchable
Definition: cbs_av1.h:178
uint8_t skip_mode_present
Definition: cbs_av1.h:243
uint8_t initial_display_delay_present_flag
Definition: cbs_av1.h:80
uint8_t tile_rows_log2
Definition: cbs_av1.h:185
uint8_t is_rot_zoom[AV1_TOTAL_REFS_PER_FRAME]
Definition: cbs_av1.h:249
uint8_t update_ref_delta[AV1_TOTAL_REFS_PER_FRAME]
Definition: cbs_av1.h:225
uint8_t obu_has_size_field
Definition: cbs_av1.h:33
uint8_t update_grain
Definition: cbs_av1.h:256
uint8_t chroma_sample_position
Definition: cbs_av1.h:54
uint8_t delta_lf_present
Definition: cbs_av1.h:217
uint8_t golden_frame_idx
Definition: cbs_av1.h:171
uint16_t primary_chromaticity_x[3]
Definition: cbs_av1.h:318
AV1RawTileGroup tile_group
Definition: cbs_av1.h:377
AV1RawFrameHeader frame_header
Definition: cbs_av1.h:375
uint8_t frame_refs_short_signaling
Definition: cbs_av1.h:169
uint8_t itu_t_t35_country_code_extension_byte
Definition: cbs_av1.h:333
uint32_t num_units_in_decoding_tick
Definition: cbs_av1.h:68
union AV1RawOBU::@47 obu
uint8_t output_frame_height_in_tiles_minus_1
Definition: cbs_av1.h:306
AV1RawTimingInfo timing_info
Definition: cbs_av1.h:83
uint8_t show_frame
Definition: cbs_av1.h:140
uint8_t frame_to_show_map_idx
Definition: cbs_av1.h:135
uint8_t num_cr_points
Definition: cbs_av1.h:265
AV1RawFrameHeader header
Definition: cbs_av1.h:300
uint8_t enable_intraintra_compound
Definition: cbs_av1.h:108
uint8_t segmentation_update_data
Definition: cbs_av1.h:211
uint8_t seq_force_screen_content_tools
Definition: cbs_av1.h:118
uint8_t seq_level_idx[AV1_MAX_OPERATING_POINTS]
Definition: cbs_av1.h:87
uint8_t render_width_minus_1
Definition: cbs_av1.h:161
uint8_t grain_scale_shift
Definition: cbs_av1.h:274
uint8_t enable_dual_filter
Definition: cbs_av1.h:111
uint16_t grain_seed
Definition: cbs_av1.h:255
uint8_t transfer_characteristics
Definition: cbs_av1.h:48
uint8_t reduced_tx_set
Definition: cbs_av1.h:246
uint8_t obu_forbidden_bit
Definition: cbs_av1.h:30
uint8_t render_and_frame_size_different
Definition: cbs_av1.h:160