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