dav1d
headers.h
Go to the documentation of this file.
1/*
2 * Copyright © 2018, VideoLAN and dav1d authors
3 * Copyright © 2018, Two Orioles, LLC
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright notice, this
10 * list of conditions and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright notice,
13 * this list of conditions and the following disclaimer in the documentation
14 * and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
20 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#ifndef DAV1D_HEADERS_H
29#define DAV1D_HEADERS_H
30
31#include <stddef.h>
32
33// Constants from Section 3. "Symbols and abbreviated terms"
34#define DAV1D_MAX_CDEF_STRENGTHS 8
35#define DAV1D_MAX_OPERATING_POINTS 32
36#define DAV1D_MAX_TILE_COLS 64
37#define DAV1D_MAX_TILE_ROWS 64
38#define DAV1D_MAX_SEGMENTS 8
39#define DAV1D_NUM_REF_FRAMES 8
40#define DAV1D_PRIMARY_REF_NONE 7
41#define DAV1D_REFS_PER_FRAME 7
42#define DAV1D_TOTAL_REFS_PER_FRAME (DAV1D_REFS_PER_FRAME + 1)
43
53};
54
60};
61
70};
71
76};
77
83};
84
90};
91
94 int32_t matrix[6];
95 union {
96 struct {
97 int16_t alpha, beta, gamma, delta;
98 };
99 int16_t abcd[4];
100 };
102
108};
109
115};
116
130};
131
150};
151
167};
168
174};
175
180
181typedef struct Dav1dMasteringDisplay {
183 uint16_t primaries[3][2];
185 uint16_t white_point[2];
191
192typedef struct Dav1dITUTT35 {
196 uint8_t *payload;
198
199typedef struct Dav1dSequenceHeader {
224 int hbd;
230
235 int idc;
236 int tier;
240
258 int sb128;
272 int cdef;
278
279 // Dav1dSequenceHeaders of the same sequence are required to be
280 // bit-identical until this offset. See 7.5 "Ordering of OBUs":
281 // Within a particular coded video sequence, the contents of
282 // sequence_header_obu must be bit-identical each time the
283 // sequence header appears except for the contents of
284 // operating_parameters_info.
291
292typedef struct Dav1dSegmentationData {
295 int ref;
296 int skip;
299
305
307 int mode_delta[2 /* is_zeromv */];
310
311typedef struct Dav1dFilmGrainData {
312 unsigned seed;
314 uint8_t y_points[14][2 /* value, scaling */];
317 uint8_t uv_points[2][10][2 /* value, scaling */];
320 int8_t ar_coeffs_y[24];
321 int8_t ar_coeffs_uv[2][25];
324 int uv_mult[2];
326 int uv_offset[2];
330
331typedef struct Dav1dFrameHeader {
333 int width[2 /* { coded_width, superresolution_upscaled_width } */], height;
335 struct {
340
359 struct {
367 int hp;
372 struct {
374 unsigned n_bytes;
379 int update;
381 struct {
382 int yac;
385 int qm, qm_y, qm_u, qm_v;
387 struct {
392 struct {
393 struct {
394 int present;
396 } q;
397 struct {
398 int present;
399 int res_log2;
400 int multi;
401 } lf;
404 struct {
405 int level_y[2 /* dir */];
412 struct {
418 struct {
419 enum Dav1dRestorationType type[3 /* plane */];
420 int unit_size[2 /* y, uv */];
429
430#endif /* DAV1D_HEADERS_H */
Dav1dRestorationType
Definition: headers.h:78
@ DAV1D_RESTORATION_SGRPROJ
Definition: headers.h:82
@ DAV1D_RESTORATION_NONE
Definition: headers.h:79
@ DAV1D_RESTORATION_WIENER
Definition: headers.h:81
@ DAV1D_RESTORATION_SWITCHABLE
Definition: headers.h:80
Dav1dObuType
Definition: headers.h:44
@ DAV1D_OBU_PADDING
Definition: headers.h:52
@ DAV1D_OBU_FRAME
Definition: headers.h:50
@ DAV1D_OBU_METADATA
Definition: headers.h:49
@ DAV1D_OBU_REDUNDANT_FRAME_HDR
Definition: headers.h:51
@ DAV1D_OBU_TILE_GRP
Definition: headers.h:48
@ DAV1D_OBU_TD
Definition: headers.h:46
@ DAV1D_OBU_FRAME_HDR
Definition: headers.h:47
@ DAV1D_OBU_SEQ_HDR
Definition: headers.h:45
Dav1dFilterMode
Definition: headers.h:62
@ DAV1D_FILTER_8TAP_REGULAR
Definition: headers.h:63
@ DAV1D_N_SWITCHABLE_FILTERS
Definition: headers.h:66
@ DAV1D_FILTER_8TAP_SHARP
Definition: headers.h:65
@ DAV1D_N_FILTERS
Definition: headers.h:68
@ DAV1D_FILTER_8TAP_SMOOTH
Definition: headers.h:64
@ DAV1D_FILTER_BILINEAR
Definition: headers.h:67
@ DAV1D_FILTER_SWITCHABLE
Definition: headers.h:69
#define DAV1D_TOTAL_REFS_PER_FRAME
Definition: headers.h:42
Dav1dPixelLayout
Definition: headers.h:103
@ DAV1D_PIXEL_LAYOUT_I444
4:4:4 planar
Definition: headers.h:107
@ DAV1D_PIXEL_LAYOUT_I400
monochrome
Definition: headers.h:104
@ DAV1D_PIXEL_LAYOUT_I422
4:2:2 planar
Definition: headers.h:106
@ DAV1D_PIXEL_LAYOUT_I420
4:2:0 planar
Definition: headers.h:105
#define DAV1D_MAX_OPERATING_POINTS
Definition: headers.h:35
Dav1dChromaSamplePosition
Definition: headers.h:169
@ DAV1D_CHR_COLOCATED
Co-located with luma(0, 0) sample.
Definition: headers.h:173
@ DAV1D_CHR_UNKNOWN
Definition: headers.h:170
@ DAV1D_CHR_VERTICAL
sample, between two vertical samples
Definition: headers.h:171
#define DAV1D_REFS_PER_FRAME
Definition: headers.h:41
Dav1dColorPrimaries
Definition: headers.h:117
@ DAV1D_COLOR_PRI_SMPTE432
Definition: headers.h:128
@ DAV1D_COLOR_PRI_BT470M
Definition: headers.h:120
@ DAV1D_COLOR_PRI_UNKNOWN
Definition: headers.h:119
@ DAV1D_COLOR_PRI_SMPTE240
Definition: headers.h:123
@ DAV1D_COLOR_PRI_BT601
Definition: headers.h:122
@ DAV1D_COLOR_PRI_SMPTE431
Definition: headers.h:127
@ DAV1D_COLOR_PRI_FILM
Definition: headers.h:124
@ DAV1D_COLOR_PRI_BT709
Definition: headers.h:118
@ DAV1D_COLOR_PRI_BT470BG
Definition: headers.h:121
@ DAV1D_COLOR_PRI_EBU3213
Definition: headers.h:129
@ DAV1D_COLOR_PRI_BT2020
Definition: headers.h:125
@ DAV1D_COLOR_PRI_XYZ
Definition: headers.h:126
#define DAV1D_MAX_CDEF_STRENGTHS
Definition: headers.h:34
Dav1dTransferCharacteristics
Definition: headers.h:132
@ DAV1D_TRC_SMPTE2084
PQ.
Definition: headers.h:147
@ DAV1D_TRC_BT601
Definition: headers.h:137
@ DAV1D_TRC_SMPTE428
Definition: headers.h:148
@ DAV1D_TRC_LINEAR
Definition: headers.h:139
@ DAV1D_TRC_SMPTE240
Definition: headers.h:138
@ DAV1D_TRC_BT709
Definition: headers.h:133
@ DAV1D_TRC_LOG100_SQRT10
lograithmic (100*sqrt(10):1 range)
Definition: headers.h:141
@ DAV1D_TRC_BT2020_10BIT
Definition: headers.h:145
@ DAV1D_TRC_BT2020_12BIT
Definition: headers.h:146
@ DAV1D_TRC_BT470BG
Definition: headers.h:136
@ DAV1D_TRC_BT470M
Definition: headers.h:135
@ DAV1D_TRC_IEC61966
Definition: headers.h:142
@ DAV1D_TRC_UNKNOWN
Definition: headers.h:134
@ DAV1D_TRC_HLG
hybrid log/gamma (BT.2100 / ARIB STD-B67)
Definition: headers.h:149
@ DAV1D_TRC_LOG100
logarithmic (100:1 range)
Definition: headers.h:140
@ DAV1D_TRC_BT1361
Definition: headers.h:143
@ DAV1D_TRC_SRGB
Definition: headers.h:144
#define DAV1D_MAX_TILE_ROWS
Definition: headers.h:37
Dav1dWarpedMotionType
Definition: headers.h:85
@ DAV1D_WM_TYPE_IDENTITY
Definition: headers.h:86
@ DAV1D_WM_TYPE_AFFINE
Definition: headers.h:89
@ DAV1D_WM_TYPE_TRANSLATION
Definition: headers.h:87
@ DAV1D_WM_TYPE_ROT_ZOOM
Definition: headers.h:88
#define DAV1D_MAX_TILE_COLS
Definition: headers.h:36
#define DAV1D_MAX_SEGMENTS
Definition: headers.h:38
Dav1dFrameType
Definition: headers.h:110
@ DAV1D_FRAME_TYPE_INTRA
Non key Intra frame.
Definition: headers.h:113
@ DAV1D_FRAME_TYPE_INTER
Inter frame.
Definition: headers.h:112
@ DAV1D_FRAME_TYPE_KEY
Key Intra frame.
Definition: headers.h:111
@ DAV1D_FRAME_TYPE_SWITCH
Switch Inter frame.
Definition: headers.h:114
Dav1dMatrixCoefficients
Definition: headers.h:152
@ DAV1D_MC_BT601
Definition: headers.h:158
@ DAV1D_MC_SMPTE240
Definition: headers.h:159
@ DAV1D_MC_SMPTE_YCGCO
Definition: headers.h:160
@ DAV1D_MC_ICTCP
Definition: headers.h:166
@ DAV1D_MC_IDENTITY
Definition: headers.h:153
@ DAV1D_MC_BT2020_CL
Definition: headers.h:162
@ DAV1D_MC_SMPTE2085
Definition: headers.h:163
@ DAV1D_MC_BT2020_NCL
Definition: headers.h:161
@ DAV1D_MC_FCC
Definition: headers.h:156
@ DAV1D_MC_UNKNOWN
Definition: headers.h:155
@ DAV1D_MC_BT709
Definition: headers.h:154
@ DAV1D_MC_BT470BG
Definition: headers.h:157
@ DAV1D_MC_CHROMAT_NCL
Chromaticity-derived.
Definition: headers.h:164
@ DAV1D_MC_CHROMAT_CL
Definition: headers.h:165
Dav1dAdaptiveBoolean
Definition: headers.h:72
@ DAV1D_ADAPTIVE
Definition: headers.h:75
@ DAV1D_OFF
Definition: headers.h:73
@ DAV1D_ON
Definition: headers.h:74
Dav1dTxfmMode
Definition: headers.h:55
@ DAV1D_N_TX_MODES
Definition: headers.h:59
@ DAV1D_TX_LARGEST
Definition: headers.h:57
@ DAV1D_TX_4X4_ONLY
Definition: headers.h:56
@ DAV1D_TX_SWITCHABLE
Definition: headers.h:58
Definition: headers.h:176
int max_frame_average_light_level
Definition: headers.h:178
int max_content_light_level
Definition: headers.h:177
Definition: headers.h:311
int scaling_shift
Definition: headers.h:318
uint8_t y_points[14][2]
Definition: headers.h:314
unsigned seed
Definition: headers.h:312
int uv_luma_mult[2]
Definition: headers.h:325
uint8_t uv_points[2][10][2]
Definition: headers.h:317
int grain_scale_shift
Definition: headers.h:323
int8_t ar_coeffs_y[24]
Definition: headers.h:320
int ar_coeff_shift
Definition: headers.h:322
int overlap_flag
Definition: headers.h:327
int num_y_points
Definition: headers.h:313
int chroma_scaling_from_luma
Definition: headers.h:315
int uv_offset[2]
Definition: headers.h:326
int uv_mult[2]
Definition: headers.h:324
int8_t ar_coeffs_uv[2][25]
Definition: headers.h:321
int clip_to_restricted_range
Definition: headers.h:328
int ar_coeff_lag
Definition: headers.h:319
int num_uv_points[2]
Definition: headers.h:316
int buffer_removal_time
Definition: headers.h:355
Definition: headers.h:331
int switchable_motion_mode
Definition: headers.h:369
int use_ref_frame_mvs
Definition: headers.h:370
Dav1dFilmGrainData data
Definition: headers.h:337
int res_log2
Definition: headers.h:395
int refidx[DAV1D_REFS_PER_FRAME]
Definition: headers.h:366
int mode_ref_delta_enabled
Definition: headers.h:407
int temporal_id
Definition: headers.h:339
int temporal
Definition: headers.h:388
int lossless[DAV1D_MAX_SEGMENTS]
Definition: headers.h:390
int qm_v
Definition: headers.h:385
int level_v
Definition: headers.h:406
int width[2]
Definition: headers.h:333
int buffer_removal_time_present
Definition: headers.h:353
struct Dav1dFrameHeader::@8 segmentation
int uv_strength[DAV1D_MAX_CDEF_STRENGTHS]
Definition: headers.h:416
int hp
Definition: headers.h:367
int render_height
Definition: headers.h:358
int show_frame
Definition: headers.h:345
int qidx[DAV1D_MAX_SEGMENTS]
Definition: headers.h:390
struct Dav1dFrameHeader::Dav1dFrameHeaderOperatingPoint operating_points[DAV1D_MAX_OPERATING_POINTS]
int existing_frame_idx
Definition: headers.h:342
int qm
Definition: headers.h:385
int damping
Definition: headers.h:413
int update_map
Definition: headers.h:388
int switchable_comp_refs
Definition: headers.h:423
int skip_mode_enabled
Definition: headers.h:424
int primary_ref_frame
Definition: headers.h:352
int height
Definition: headers.h:333
uint16_t col_start_sb[DAV1D_MAX_TILE_COLS+1]
Definition: headers.h:377
struct Dav1dFrameHeader::@9::@13 q
enum Dav1dTxfmMode txfm_mode
Definition: headers.h:422
struct Dav1dFrameHeader::@11 cdef
int mode_ref_delta_update
Definition: headers.h:408
Dav1dSegmentationDataSet seg_data
Definition: headers.h:389
Dav1dLoopfilterModeRefDeltas mode_ref_deltas
Definition: headers.h:409
int uac_delta
Definition: headers.h:384
struct Dav1dFrameHeader::@6 tiling
struct Dav1dFrameHeader::@10 loopfilter
int frame_offset
frame number
Definition: headers.h:334
int min_log2_cols
Definition: headers.h:375
int max_log2_cols
Definition: headers.h:375
int enabled
Definition: headers.h:361
unsigned n_bytes
Definition: headers.h:374
int n_bits
Definition: headers.h:414
int min_log2_rows
Definition: headers.h:376
enum Dav1dRestorationType type[3]
Definition: headers.h:419
int present
Definition: headers.h:336
int showable_frame
Definition: headers.h:346
int qm_y
Definition: headers.h:385
int vac_delta
Definition: headers.h:384
enum Dav1dFrameType frame_type
type of the picture
Definition: headers.h:332
int refresh_frame_flags
Definition: headers.h:357
int multi
Definition: headers.h:400
struct Dav1dFrameHeader::@12 restoration
struct Dav1dFrameHeader::@4 film_grain
film grain parameters
int warp_motion
Definition: headers.h:425
int frame_presentation_delay
Definition: headers.h:344
int log2_rows
Definition: headers.h:376
enum Dav1dFilterMode subpel_filter_mode
Definition: headers.h:368
uint16_t row_start_sb[DAV1D_MAX_TILE_ROWS+1]
Definition: headers.h:378
int rows
Definition: headers.h:376
int refresh_context
Definition: headers.h:371
Dav1dWarpedMotionParams gmv[DAV1D_REFS_PER_FRAME]
Definition: headers.h:427
struct Dav1dFrameHeader::@9 delta
int y_strength[DAV1D_MAX_CDEF_STRENGTHS]
Definition: headers.h:415
int spatial_id
spatial and temporal id of the frame for SVC
Definition: headers.h:339
int force_integer_mv
Definition: headers.h:350
int update_data
Definition: headers.h:388
struct Dav1dFrameHeader::@5 super_res
struct Dav1dFrameHeader::@7 quant
int vdc_delta
Definition: headers.h:384
int sharpness
Definition: headers.h:410
int ydc_delta
Definition: headers.h:383
int allow_screen_content_tools
Definition: headers.h:349
int all_lossless
Definition: headers.h:403
int log2_cols
Definition: headers.h:375
int level_u
Definition: headers.h:406
int show_existing_frame
Definition: headers.h:341
int uniform
Definition: headers.h:373
int frame_ref_short_signaling
Definition: headers.h:365
int udc_delta
Definition: headers.h:384
int unit_size[2]
Definition: headers.h:420
int qm_u
Definition: headers.h:385
int skip_mode_allowed
Definition: headers.h:424
int width_scale_denominator
Definition: headers.h:360
int level_y[2]
Definition: headers.h:405
int allow_intrabc
Definition: headers.h:364
int frame_size_override
Definition: headers.h:351
int yac
Definition: headers.h:382
int reduced_txtp_set
Definition: headers.h:426
int max_log2_rows
Definition: headers.h:376
int error_resilient_mode
Definition: headers.h:347
int skip_mode_refs[2]
Definition: headers.h:424
int render_width
Definition: headers.h:358
int cols
Definition: headers.h:375
int update
Definition: headers.h:336
int disable_cdf_update
Definition: headers.h:348
struct Dav1dFrameHeader::@9::@14 lf
int frame_id
Definition: headers.h:343
int have_render_size
Definition: headers.h:363
Definition: headers.h:192
uint8_t country_code_extension_byte
Definition: headers.h:194
uint8_t * payload
Definition: headers.h:196
uint8_t country_code
Definition: headers.h:193
size_t payload_size
Definition: headers.h:195
Definition: headers.h:306
int mode_delta[2]
Definition: headers.h:307
int ref_delta[DAV1D_TOTAL_REFS_PER_FRAME]
Definition: headers.h:308
Definition: headers.h:181
uint16_t white_point[2]
24.8 fixed point
Definition: headers.h:185
uint32_t max_luminance
18.14 fixed point
Definition: headers.h:187
uint32_t min_luminance
Definition: headers.h:189
uint16_t primaries[3][2]
< 0.16 fixed point
Definition: headers.h:183
Definition: headers.h:300
Dav1dSegmentationData d[DAV1D_MAX_SEGMENTS]
Definition: headers.h:301
int preskip
Definition: headers.h:302
int last_active_segid
Definition: headers.h:303
Definition: headers.h:292
int globalmv
Definition: headers.h:297
int ref
Definition: headers.h:295
int delta_lf_y_h
Definition: headers.h:294
int skip
Definition: headers.h:296
int delta_lf_y_v
Definition: headers.h:294
int delta_lf_v
Definition: headers.h:294
int delta_q
Definition: headers.h:293
int delta_lf_u
Definition: headers.h:294
int display_model_param_present
Definition: headers.h:238
int decoder_model_param_present
Definition: headers.h:237
Definition: headers.h:199
int inter_intra
Definition: headers.h:261
enum Dav1dPixelLayout layout
format of the picture
Definition: headers.h:212
int intra_edge_filter
Definition: headers.h:260
int display_model_info_present
Definition: headers.h:253
enum Dav1dChromaSamplePosition chr
chroma sample position (av1)
Definition: headers.h:216
int order_hint
Definition: headers.h:265
int dual_filter
Definition: headers.h:264
int jnt_comp
Definition: headers.h:266
int masked_compound
Definition: headers.h:262
int filter_intra
Definition: headers.h:259
unsigned num_ticks_per_picture
Definition: headers.h:247
int film_grain_present
Definition: headers.h:277
int still_picture
Definition: headers.h:241
int sb128
Definition: headers.h:258
int warped_motion
Definition: headers.h:263
int equal_picture_interval
Definition: headers.h:246
int frame_id_n_bits
Definition: headers.h:257
int num_units_in_decoding_tick
Definition: headers.h:250
int separate_uv_delta_q
Definition: headers.h:276
int num_operating_points
Definition: headers.h:231
int hbd
Definition: headers.h:224
int color_description_present
Definition: headers.h:275
int reduced_still_picture_header
Definition: headers.h:242
int ss_ver
Definition: headers.h:274
int super_res
Definition: headers.h:271
int height_n_bits
Definition: headers.h:254
int time_scale
Definition: headers.h:245
int decoder_model_info_present
Definition: headers.h:248
int encoder_decoder_buffer_delay_length
Definition: headers.h:249
int restoration
Definition: headers.h:273
int order_hint_n_bits
Definition: headers.h:270
struct Dav1dSequenceHeader::Dav1dSequenceHeaderOperatingParameterInfo operating_parameter_info[DAV1D_MAX_OPERATING_POINTS]
int timing_info_present
Definition: headers.h:243
enum Dav1dTransferCharacteristics trc
transfer characteristics (av1)
Definition: headers.h:214
struct Dav1dSequenceHeader::Dav1dSequenceHeaderOperatingPoint operating_points[DAV1D_MAX_OPERATING_POINTS]
int width_n_bits
Definition: headers.h:254
int ref_frame_mvs
Definition: headers.h:267
int frame_presentation_delay_length
Definition: headers.h:252
int delta_frame_id_n_bits
Definition: headers.h:256
enum Dav1dAdaptiveBoolean force_integer_mv
Definition: headers.h:269
int frame_id_numbers_present
Definition: headers.h:255
int max_width
Definition: headers.h:211
enum Dav1dColorPrimaries pri
color primaries (av1)
Definition: headers.h:213
int profile
Definition: headers.h:205
int num_units_in_tick
Definition: headers.h:244
int ss_hor
Definition: headers.h:274
int color_range
Definition: headers.h:229
int buffer_removal_delay_length
Definition: headers.h:251
enum Dav1dAdaptiveBoolean screen_content_tools
Definition: headers.h:268
int monochrome
Definition: headers.h:274
enum Dav1dMatrixCoefficients mtrx
matrix coefficients (av1)
Definition: headers.h:215
int max_height
Definition: headers.h:211
int cdef
Definition: headers.h:272
Definition: headers.h:92
int16_t abcd[4]
Definition: headers.h:99
int32_t matrix[6]
Definition: headers.h:94
int16_t delta
Definition: headers.h:97
int16_t alpha
Definition: headers.h:97
int16_t gamma
Definition: headers.h:97
enum Dav1dWarpedMotionType type
Definition: headers.h:93
int16_t beta
Definition: headers.h:97