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