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