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 
73  DAV1D_OFF = 0,
74  DAV1D_ON = 1,
76 };
77 
83 };
84 
90 };
91 
92 typedef struct Dav1dWarpedMotionParams {
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 
172  DAV1D_CHR_COLOCATED = 2,
174 };
175 
176 typedef struct Dav1dContentLightLevel {
180 
181 typedef struct Dav1dMasteringDisplay {
183  uint16_t primaries[3][2];
185  uint16_t white_point[2];
187  uint32_t max_luminance;
189  uint32_t min_luminance;
191 
192 typedef struct Dav1dITUTT35 {
193  uint8_t country_code;
195  size_t payload_size;
196  uint8_t *payload;
197 } Dav1dITUTT35;
198 
199 typedef struct Dav1dSequenceHeader {
205  int profile;
217 
224  int hbd;
230 
235  int idc;
236  int tier;
240 
258  int sb128;
266  int jnt_comp;
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 
292 typedef struct Dav1dSegmentationData {
293  int delta_q;
295  int ref;
296  int skip;
297  int globalmv;
299 
300 typedef struct Dav1dSegmentationDataSet {
302  int preskip;
305 
307  int mode_delta[2 /* is_zeromv */];
310 
311 typedef 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];
325  int uv_luma_mult[2];
326  int uv_offset[2];
330 
331 typedef struct Dav1dFrameHeader {
333  int width[2 /* { coded_width, superresolution_upscaled_width } */], height;
335  struct {
338  } film_grain;
340 
343  int frame_id;
359  struct {
361  int enabled;
362  } super_res;
367  int hp;
372  struct {
373  int uniform;
374  unsigned n_bytes;
379  int update;
380  } tiling;
381  struct {
382  int yac;
385  int qm, qm_y, qm_u, qm_v;
386  } quant;
387  struct {
391  } segmentation;
392  struct {
393  struct {
394  int present;
395  int res_log2;
396  } q;
397  struct {
398  int present;
399  int res_log2;
400  int multi;
401  } lf;
402  } delta;
404  struct {
405  int level_y[2 /* dir */];
411  } loopfilter;
412  struct {
413  int damping;
414  int n_bits;
417  } cdef;
418  struct {
419  enum Dav1dRestorationType type[3 /* plane */];
420  int unit_size[2 /* y, uv */];
421  } restoration;
429 
430 #endif /* DAV1D_HEADERS_H */
Definition: headers.h:136
uint8_t uv_points[2][10][2]
Definition: headers.h:317
int max_log2_cols
Definition: headers.h:375
Definition: headers.h:73
Switch Inter frame.
Definition: headers.h:114
int yac
Definition: headers.h:382
int max_frame_average_light_level
Definition: headers.h:178
Definition: headers.h:161
int lossless[DAV1D_MAX_SEGMENTS]
Definition: headers.h:390
int decoder_model_param_present
Definition: headers.h:237
int skip
Definition: headers.h:296
int error_resilient_mode
Definition: headers.h:347
Dav1dWarpedMotionType
Definition: headers.h:85
Definition: headers.h:45
4:4:4 planar
Definition: headers.h:107
Definition: headers.h:125
Definition: headers.h:59
Definition: headers.h:46
Definition: headers.h:58
Definition: headers.h:134
int height
Definition: headers.h:333
int width_scale_denominator
Definition: headers.h:360
int monochrome
Definition: headers.h:274
int16_t gamma
Definition: headers.h:97
Definition: headers.h:57
int ar_coeff_shift
Definition: headers.h:322
int buffer_removal_time_present
Definition: headers.h:353
int frame_id_n_bits
Definition: headers.h:257
Definition: headers.h:157
Dav1dLoopfilterModeRefDeltas mode_ref_deltas
Definition: headers.h:409
Definition: headers.h:155
struct Dav1dFrameHeader::@12 restoration
int num_uv_points[2]
Definition: headers.h:316
int masked_compound
Definition: headers.h:262
Definition: headers.h:63
Definition: headers.h:126
lograithmic (100*sqrt(10):1 range)
Definition: headers.h:141
int inter_intra
Definition: headers.h:261
int ref_frame_mvs
Definition: headers.h:267
Definition: headers.h:122
int uv_mult[2]
Definition: headers.h:324
Definition: headers.h:56
int delta_frame_id_n_bits
Definition: headers.h:256
int display_model_info_present
Definition: headers.h:253
struct Dav1dFrameHeader::@9::@14 lf
int reduced_still_picture_header
Definition: headers.h:242
enum Dav1dAdaptiveBoolean force_integer_mv
Definition: headers.h:269
enum Dav1dTxfmMode txfm_mode
Definition: headers.h:422
uint32_t min_luminance
Definition: headers.h:189
int skip_mode_refs[2]
Definition: headers.h:424
int force_integer_mv
Definition: headers.h:350
int super_res
Definition: headers.h:271
int ref_delta[DAV1D_TOTAL_REFS_PER_FRAME]
Definition: headers.h:308
Definition: headers.h:144
int render_height
Definition: headers.h:358
int jnt_comp
Definition: headers.h:266
Definition: headers.h:331
Dav1dAdaptiveBoolean
Definition: headers.h:72
struct Dav1dFrameHeader::@8 segmentation
Definition: headers.h:159
enum Dav1dChromaSamplePosition chr
chroma sample position (av1)
Definition: headers.h:216
unsigned num_ticks_per_picture
Definition: headers.h:247
int still_picture
Definition: headers.h:241
int skip_mode_enabled
Definition: headers.h:424
enum Dav1dPixelLayout layout
format of the picture
Definition: headers.h:212
int clip_to_restricted_range
Definition: headers.h:328
int vac_delta
Definition: headers.h:384
int buffer_removal_delay_length
Definition: headers.h:251
int separate_uv_delta_q
Definition: headers.h:276
monochrome
Definition: headers.h:104
Definition: headers.h:66
uint16_t primaries[3][2]
< 0.16 fixed point
Definition: headers.h:183
Definition: headers.h:137
Definition: headers.h:170
Definition: headers.h:176
int overlap_flag
Definition: headers.h:327
Definition: headers.h:121
int color_range
Definition: headers.h:229
int time_scale
Definition: headers.h:245
Definition: headers.h:138
int32_t matrix[6]
Definition: headers.h:94
Definition: headers.h:87
int ss_ver
Definition: headers.h:274
enum Dav1dMatrixCoefficients mtrx
matrix coefficients (av1)
Definition: headers.h:215
Definition: headers.h:148
int frame_presentation_delay_length
Definition: headers.h:252
Definition: headers.h:129
Dav1dChromaSamplePosition
Definition: headers.h:169
Definition: headers.h:311
int refidx[DAV1D_REFS_PER_FRAME]
Definition: headers.h:366
Definition: headers.h:75
int update_data
Definition: headers.h:388
Definition: headers.h:199
Dav1dObuType
Definition: headers.h:44
Definition: headers.h:68
Definition: headers.h:52
int restoration
Definition: headers.h:273
int frame_ref_short_signaling
Definition: headers.h:365
int udc_delta
Definition: headers.h:384
Dav1dFrameType
Definition: headers.h:110
Definition: headers.h:145
int delta_lf_y_v
Definition: headers.h:294
int buffer_removal_time
Definition: headers.h:355
uint32_t max_luminance
18.14 fixed point
Definition: headers.h:187
int num_units_in_tick
Definition: headers.h:244
int use_ref_frame_mvs
Definition: headers.h:370
uint8_t * payload
Definition: headers.h:196
int delta_lf_v
Definition: headers.h:294
int equal_picture_interval
Definition: headers.h:246
uint8_t y_points[14][2]
Definition: headers.h:314
Definition: headers.h:47
int qm
Definition: headers.h:385
int uac_delta
Definition: headers.h:384
Dav1dMatrixCoefficients
Definition: headers.h:152
#define DAV1D_MAX_TILE_COLS
Definition: headers.h:36
Definition: headers.h:50
int delta_lf_u
Definition: headers.h:294
int level_v
Definition: headers.h:406
int frame_size_override
Definition: headers.h:351
unsigned n_bytes
Definition: headers.h:374
Definition: headers.h:88
int min_log2_cols
Definition: headers.h:375
#define DAV1D_MAX_CDEF_STRENGTHS
Definition: headers.h:34
int uv_strength[DAV1D_MAX_CDEF_STRENGTHS]
Definition: headers.h:416
Chromaticity-derived.
Definition: headers.h:164
Definition: headers.h:119
int height_n_bits
Definition: headers.h:254
int display_model_param_present
Definition: headers.h:238
int present
Definition: headers.h:336
enum Dav1dTransferCharacteristics trc
transfer characteristics (av1)
Definition: headers.h:214
int multi
Definition: headers.h:400
int sharpness
Definition: headers.h:410
int refresh_frame_flags
Definition: headers.h:357
4:2:0 planar
Definition: headers.h:105
int existing_frame_idx
Definition: headers.h:342
int scaling_shift
Definition: headers.h:318
int intra_edge_filter
Definition: headers.h:260
int sb128
Definition: headers.h:258
struct Dav1dFrameHeader::@11 cdef
Definition: headers.h:92
int show_frame
Definition: headers.h:345
int mode_delta[2]
Definition: headers.h:307
Key Intra frame.
Definition: headers.h:111
PQ.
Definition: headers.h:147
Definition: headers.h:165
Definition: headers.h:160
#define DAV1D_MAX_TILE_ROWS
Definition: headers.h:37
Definition: headers.h:65
#define DAV1D_MAX_OPERATING_POINTS
Definition: headers.h:35
Definition: headers.h:154
Definition: headers.h:81
Definition: headers.h:139
Definition: headers.h:143
enum Dav1dFilterMode subpel_filter_mode
Definition: headers.h:368
enum Dav1dColorPrimaries pri
color primaries (av1)
Definition: headers.h:213
int qidx[DAV1D_MAX_SEGMENTS]
Definition: headers.h:390
int qm_u
Definition: headers.h:385
int frame_id_numbers_present
Definition: headers.h:255
int ss_hor
Definition: headers.h:274
int16_t delta
Definition: headers.h:97
Dav1dRestorationType
Definition: headers.h:78
Definition: headers.h:292
Definition: headers.h:142
Definition: headers.h:158
Dav1dColorPrimaries
Definition: headers.h:117
uint16_t white_point[2]
24.8 fixed point
Definition: headers.h:185
int qm_y
Definition: headers.h:385
struct Dav1dFrameHeader::Dav1dFrameHeaderOperatingPoint operating_points[DAV1D_MAX_OPERATING_POINTS]
int disable_cdf_update
Definition: headers.h:348
int damping
Definition: headers.h:413
Dav1dFilmGrainData data
Definition: headers.h:337
Definition: headers.h:163
Definition: headers.h:124
int max_content_light_level
Definition: headers.h:177
int width[2]
Definition: headers.h:333
int num_units_in_decoding_tick
Definition: headers.h:250
struct Dav1dFrameHeader::@6 tiling
int16_t abcd[4]
Definition: headers.h:99
Definition: headers.h:118
Definition: headers.h:49
#define DAV1D_TOTAL_REFS_PER_FRAME
Definition: headers.h:42
int uv_offset[2]
Definition: headers.h:326
unsigned seed
Definition: headers.h:312
int warp_motion
Definition: headers.h:425
int mode_ref_delta_enabled
Definition: headers.h:407
int hbd
Definition: headers.h:224
Definition: headers.h:69
int level_y[2]
Definition: headers.h:405
int grain_scale_shift
Definition: headers.h:323
struct Dav1dFrameHeader::@10 loopfilter
int enabled
Definition: headers.h:361
int timing_info_present
Definition: headers.h:243
int have_render_size
Definition: headers.h:363
int frame_offset
frame number
Definition: headers.h:334
Definition: headers.h:120
Definition: headers.h:80
int hp
Definition: headers.h:367
Definition: headers.h:82
Dav1dSegmentationData d[DAV1D_MAX_SEGMENTS]
Definition: headers.h:301
int delta_lf_y_h
Definition: headers.h:294
int uv_luma_mult[2]
Definition: headers.h:325
Definition: headers.h:133
int allow_intrabc
Definition: headers.h:364
#define DAV1D_REFS_PER_FRAME
Definition: headers.h:41
int profile
Definition: headers.h:205
int preskip
Definition: headers.h:302
Definition: headers.h:166
int frame_presentation_delay
Definition: headers.h:344
int render_width
Definition: headers.h:358
Definition: headers.h:67
int min_log2_rows
Definition: headers.h:376
int ydc_delta
Definition: headers.h:383
Inter frame.
Definition: headers.h:112
int frame_id
Definition: headers.h:343
int warped_motion
Definition: headers.h:263
int delta_q
Definition: headers.h:293
uint8_t country_code
Definition: headers.h:193
Non key Intra frame.
Definition: headers.h:113
Definition: headers.h:306
int skip_mode_allowed
Definition: headers.h:424
int order_hint_n_bits
Definition: headers.h:270
int filter_intra
Definition: headers.h:259
struct Dav1dSequenceHeader::Dav1dSequenceHeaderOperatingPoint operating_points[DAV1D_MAX_OPERATING_POINTS]
Definition: headers.h:300
struct Dav1dFrameHeader::@5 super_res
uint8_t country_code_extension_byte
Definition: headers.h:194
int uniform
Definition: headers.h:373
int log2_cols
Definition: headers.h:375
Dav1dFilterMode
Definition: headers.h:62
hybrid log/gamma (BT.2100 / ARIB STD-B67)
Definition: headers.h:149
sample, between two vertical samples
Definition: headers.h:171
int ar_coeff_lag
Definition: headers.h:319
int allow_screen_content_tools
Definition: headers.h:349
Definition: headers.h:128
int8_t ar_coeffs_uv[2][25]
Definition: headers.h:321
int film_grain_present
Definition: headers.h:277
int16_t beta
Definition: headers.h:97
enum Dav1dRestorationType type[3]
Definition: headers.h:419
int num_y_points
Definition: headers.h:313
int8_t ar_coeffs_y[24]
Definition: headers.h:320
int16_t alpha
Definition: headers.h:97
Definition: headers.h:123
int show_existing_frame
Definition: headers.h:341
int unit_size[2]
Definition: headers.h:420
struct Dav1dFrameHeader::@7 quant
int spatial_id
spatial and temporal id of the frame for SVC
Definition: headers.h:339
int cdef
Definition: headers.h:272
Definition: headers.h:153
Definition: headers.h:74
int update_map
Definition: headers.h:388
enum Dav1dWarpedMotionType type
Definition: headers.h:93
int vdc_delta
Definition: headers.h:384
int level_u
Definition: headers.h:406
int max_log2_rows
Definition: headers.h:376
logarithmic (100:1 range)
Definition: headers.h:140
Definition: headers.h:192
int y_strength[DAV1D_MAX_CDEF_STRENGTHS]
Definition: headers.h:415
4:2:2 planar
Definition: headers.h:106
int ref
Definition: headers.h:295
int switchable_motion_mode
Definition: headers.h:369
Definition: headers.h:181
Definition: headers.h:79
size_t payload_size
Definition: headers.h:195
#define DAV1D_MAX_SEGMENTS
Definition: headers.h:38
struct Dav1dFrameHeader::@9::@13 q
Dav1dSegmentationDataSet seg_data
Definition: headers.h:389
int all_lossless
Definition: headers.h:403
int reduced_txtp_set
Definition: headers.h:426
int decoder_model_info_present
Definition: headers.h:248
Definition: headers.h:156
int temporal_id
Definition: headers.h:339
int n_bits
Definition: headers.h:414
int showable_frame
Definition: headers.h:346
int log2_rows
Definition: headers.h:376
Definition: headers.h:146
Dav1dTxfmMode
Definition: headers.h:55
int refresh_context
Definition: headers.h:371
Dav1dTransferCharacteristics
Definition: headers.h:132
int switchable_comp_refs
Definition: headers.h:423
struct Dav1dFrameHeader::@4 film_grain
film grain parameters
Definition: headers.h:51
int primary_ref_frame
Definition: headers.h:352
int res_log2
Definition: headers.h:395
Dav1dPixelLayout
Definition: headers.h:103
int max_height
Definition: headers.h:211
struct Dav1dSequenceHeader::Dav1dSequenceHeaderOperatingParameterInfo operating_parameter_info[DAV1D_MAX_OPERATING_POINTS]
int globalmv
Definition: headers.h:297
Co-located with luma(0, 0) sample.
Definition: headers.h:173
int width_n_bits
Definition: headers.h:254
enum Dav1dAdaptiveBoolean screen_content_tools
Definition: headers.h:268
int mode_ref_delta_update
Definition: headers.h:408
int temporal
Definition: headers.h:388
uint16_t col_start_sb[DAV1D_MAX_TILE_COLS+1]
Definition: headers.h:377
uint16_t row_start_sb[DAV1D_MAX_TILE_ROWS+1]
Definition: headers.h:378
Dav1dWarpedMotionParams gmv[DAV1D_REFS_PER_FRAME]
Definition: headers.h:427
int encoder_decoder_buffer_delay_length
Definition: headers.h:249
int cols
Definition: headers.h:375
struct Dav1dFrameHeader::@9 delta
Definition: headers.h:89
int num_operating_points
Definition: headers.h:231
Definition: headers.h:48
int order_hint
Definition: headers.h:265
Definition: headers.h:64
Definition: headers.h:86
int max_width
Definition: headers.h:211
Definition: headers.h:127
int update
Definition: headers.h:336
int last_active_segid
Definition: headers.h:303
int dual_filter
Definition: headers.h:264
int color_description_present
Definition: headers.h:275
enum Dav1dFrameType frame_type
type of the picture
Definition: headers.h:332
int rows
Definition: headers.h:376
Definition: headers.h:135
Definition: headers.h:162
int qm_v
Definition: headers.h:385
int chroma_scaling_from_luma
Definition: headers.h:315