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 Dav1dSequenceHeader {
169  int profile;
181 
186 
191  int idc;
192  int tier;
199 
217  int sb128;
225  int jnt_comp;
231  int cdef;
240  int hbd;
246 
247 typedef struct Dav1dSegmentationData {
248  int delta_q;
250  int ref;
251  int skip;
252  int globalmv;
254 
255 typedef struct Dav1dSegmentationDataSet {
257  int preskip;
260 
262  int mode_delta[2 /* is_zeromv */];
265 
266 typedef struct Dav1dFilmGrainData {
267  uint16_t seed;
269  uint8_t y_points[14][2 /* value, scaling */];
272  uint8_t uv_points[2][10][2 /* value, scaling */];
275  int8_t ar_coeffs_y[24];
276  int8_t ar_coeffs_uv[2][25];
279  int uv_mult[2];
280  int uv_luma_mult[2];
281  int uv_offset[2];
285 
286 typedef struct Dav1dFrameHeader {
288  int width[2 /* { coded_width, superresolution_upscaled_width } */], height;
290  struct {
293  } film_grain;
295 
298  int frame_id;
314  struct {
316  int enabled;
317  } super_res;
322  int hp;
327  struct {
328  int uniform;
329  unsigned n_bytes;
334  int update;
335  } tiling;
336  struct {
337  int yac;
340  int qm, qm_y, qm_u, qm_v;
341  } quant;
342  struct {
346  } segmentation;
347  struct {
348  struct {
349  int present;
350  int res_log2;
351  } q;
352  struct {
353  int present;
354  int res_log2;
355  int multi;
356  } lf;
357  } delta;
359  struct {
360  int level_y[2 /* dir */];
366  } loopfilter;
367  struct {
368  int damping;
369  int n_bits;
372  } cdef;
373  struct {
374  enum Dav1dRestorationType type[3 /* plane */];
375  int unit_size[2 /* y, uv */];
376  } restoration;
384 
385 #endif /* __DAV1D_HEADERS_H__ */
Definition: headers.h:123
uint8_t uv_points[2][10][2]
Definition: headers.h:272
int max_log2_cols
Definition: headers.h:330
Definition: headers.h:60
Switch Inter frame.
Definition: headers.h:101
int yac
Definition: headers.h:337
Definition: headers.h:148
int lossless[DAV1D_MAX_SEGMENTS]
Definition: headers.h:345
int decoder_model_param_present
Definition: headers.h:193
int skip
Definition: headers.h:251
int error_resilient_mode
Definition: headers.h:302
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:288
int width_scale_denominator
Definition: headers.h:315
int monochrome
Definition: headers.h:241
int16_t gamma
Definition: headers.h:84
Definition: headers.h:44
int ar_coeff_shift
Definition: headers.h:277
int buffer_removal_time_present
Definition: headers.h:308
int frame_id_n_bits
Definition: headers.h:216
Definition: headers.h:144
Dav1dLoopfilterModeRefDeltas mode_ref_deltas
Definition: headers.h:364
Definition: headers.h:142
struct Dav1dFrameHeader::@12 restoration
int num_uv_points[2]
Definition: headers.h:271
int masked_compound
Definition: headers.h:221
Definition: headers.h:50
Definition: headers.h:113
lograithmic (100*sqrt(10):1 range)
Definition: headers.h:128
int inter_intra
Definition: headers.h:220
int ref_frame_mvs
Definition: headers.h:226
Definition: headers.h:109
int uv_mult[2]
Definition: headers.h:279
Definition: headers.h:43
int delta_frame_id_n_bits
Definition: headers.h:215
int display_model_info_present
Definition: headers.h:212
struct Dav1dFrameHeader::@9::@14 lf
int reduced_still_picture_header
Definition: headers.h:201
enum Dav1dAdaptiveBoolean force_integer_mv
Definition: headers.h:228
enum Dav1dTxfmMode txfm_mode
Definition: headers.h:377
int skip_mode_refs[2]
Definition: headers.h:379
int force_integer_mv
Definition: headers.h:305
int super_res
Definition: headers.h:230
int ref_delta[DAV1D_TOTAL_REFS_PER_FRAME]
Definition: headers.h:263
Definition: headers.h:131
int render_height
Definition: headers.h:313
int jnt_comp
Definition: headers.h:225
Definition: headers.h:286
Dav1dAdaptiveBoolean
Definition: headers.h:59
struct Dav1dFrameHeader::@8 segmentation
Definition: headers.h:146
enum Dav1dChromaSamplePosition chr
chroma sample position (av1)
Definition: headers.h:180
unsigned num_ticks_per_picture
Definition: headers.h:206
int still_picture
Definition: headers.h:200
int skip_mode_enabled
Definition: headers.h:379
enum Dav1dPixelLayout layout
format of the picture
Definition: headers.h:176
int clip_to_restricted_range
Definition: headers.h:283
int vac_delta
Definition: headers.h:339
int buffer_removal_delay_length
Definition: headers.h:210
int separate_uv_delta_q
Definition: headers.h:243
monochrome
Definition: headers.h:91
Definition: headers.h:53
Definition: headers.h:124
Definition: headers.h:157
int overlap_flag
Definition: headers.h:282
Definition: headers.h:108
int color_range
Definition: headers.h:185
int time_scale
Definition: headers.h:204
Definition: headers.h:125
int32_t matrix[6]
Definition: headers.h:81
Definition: headers.h:74
int ss_ver
Definition: headers.h:241
enum Dav1dMatrixCoefficients mtrx
matrix coefficients (av1)
Definition: headers.h:179
Definition: headers.h:135
int frame_presentation_delay_length
Definition: headers.h:211
Definition: headers.h:116
Dav1dChromaSamplePosition
Definition: headers.h:156
Definition: headers.h:266
int refidx[DAV1D_REFS_PER_FRAME]
Definition: headers.h:321
Definition: headers.h:62
int update_data
Definition: headers.h:343
Definition: headers.h:163
Definition: headers.h:55
int restoration
Definition: headers.h:232
int frame_ref_short_signaling
Definition: headers.h:320
int udc_delta
Definition: headers.h:339
Dav1dFrameType
Definition: headers.h:97
Definition: headers.h:132
int delta_lf_y_v
Definition: headers.h:249
int buffer_removal_time
Definition: headers.h:310
int num_units_in_tick
Definition: headers.h:203
int use_ref_frame_mvs
Definition: headers.h:325
int delta_lf_v
Definition: headers.h:249
int equal_picture_interval
Definition: headers.h:205
uint8_t y_points[14][2]
Definition: headers.h:269
int qm
Definition: headers.h:340
int uac_delta
Definition: headers.h:339
Dav1dMatrixCoefficients
Definition: headers.h:139
#define DAV1D_MAX_TILE_COLS
Definition: headers.h:34
int delta_lf_u
Definition: headers.h:249
int level_v
Definition: headers.h:361
int frame_size_override
Definition: headers.h:306
unsigned n_bytes
Definition: headers.h:329
Definition: headers.h:75
int min_log2_cols
Definition: headers.h:330
#define DAV1D_MAX_CDEF_STRENGTHS
Definition: headers.h:32
int uv_strength[DAV1D_MAX_CDEF_STRENGTHS]
Definition: headers.h:371
Chromaticity-derived.
Definition: headers.h:151
Definition: headers.h:106
int height_n_bits
Definition: headers.h:213
int display_model_param_present
Definition: headers.h:197
int present
Definition: headers.h:291
enum Dav1dTransferCharacteristics trc
transfer characteristics (av1)
Definition: headers.h:178
int multi
Definition: headers.h:355
int sharpness
Definition: headers.h:365
int refresh_frame_flags
Definition: headers.h:312
4:2:0 planar
Definition: headers.h:92
int existing_frame_idx
Definition: headers.h:297
int scaling_shift
Definition: headers.h:273
int intra_edge_filter
Definition: headers.h:219
int sb128
Definition: headers.h:217
struct Dav1dFrameHeader::@11 cdef
Definition: headers.h:79
int show_frame
Definition: headers.h:300
int mode_delta[2]
Definition: headers.h:262
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:323
enum Dav1dColorPrimaries pri
color primaries (av1)
Definition: headers.h:177
int qidx[DAV1D_MAX_SEGMENTS]
Definition: headers.h:345
int qm_u
Definition: headers.h:340
int frame_id_numbers_present
Definition: headers.h:214
int ss_hor
Definition: headers.h:241
int16_t delta
Definition: headers.h:84
Dav1dRestorationType
Definition: headers.h:65
Definition: headers.h:247
Definition: headers.h:129
Definition: headers.h:145
Dav1dColorPrimaries
Definition: headers.h:104
int qm_y
Definition: headers.h:340
struct Dav1dFrameHeader::Dav1dFrameHeaderOperatingPoint operating_points[DAV1D_MAX_OPERATING_POINTS]
int disable_cdf_update
Definition: headers.h:303
int damping
Definition: headers.h:368
Dav1dFilmGrainData data
Definition: headers.h:292
Definition: headers.h:150
Definition: headers.h:111
int width[2]
Definition: headers.h:288
int num_units_in_decoding_tick
Definition: headers.h:209
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:281
int warp_motion
Definition: headers.h:380
int mode_ref_delta_enabled
Definition: headers.h:362
int hbd
Definition: headers.h:240
Definition: headers.h:56
int level_y[2]
Definition: headers.h:360
int grain_scale_shift
Definition: headers.h:278
struct Dav1dFrameHeader::@10 loopfilter
int enabled
Definition: headers.h:316
int timing_info_present
Definition: headers.h:202
int have_render_size
Definition: headers.h:318
int frame_offset
frame number
Definition: headers.h:289
Definition: headers.h:107
Definition: headers.h:67
int hp
Definition: headers.h:322
Definition: headers.h:69
Dav1dSegmentationData d[DAV1D_MAX_SEGMENTS]
Definition: headers.h:256
int delta_lf_y_h
Definition: headers.h:249
int uv_luma_mult[2]
Definition: headers.h:280
Definition: headers.h:120
int allow_intrabc
Definition: headers.h:319
#define DAV1D_REFS_PER_FRAME
Definition: headers.h:39
int profile
Definition: headers.h:169
int preskip
Definition: headers.h:257
Definition: headers.h:153
int frame_presentation_delay
Definition: headers.h:299
int render_width
Definition: headers.h:313
Definition: headers.h:54
int min_log2_rows
Definition: headers.h:331
int ydc_delta
Definition: headers.h:338
Inter frame.
Definition: headers.h:99
int frame_id
Definition: headers.h:298
int warped_motion
Definition: headers.h:222
int delta_q
Definition: headers.h:248
Non key Intra frame.
Definition: headers.h:100
Definition: headers.h:261
int skip_mode_allowed
Definition: headers.h:379
int order_hint_n_bits
Definition: headers.h:229
int filter_intra
Definition: headers.h:218
struct Dav1dSequenceHeader::Dav1dSequenceHeaderOperatingPoint operating_points[DAV1D_MAX_OPERATING_POINTS]
Definition: headers.h:255
struct Dav1dFrameHeader::@5 super_res
int uniform
Definition: headers.h:328
int log2_cols
Definition: headers.h:330
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:274
int allow_screen_content_tools
Definition: headers.h:304
Definition: headers.h:115
int8_t ar_coeffs_uv[2][25]
Definition: headers.h:276
int film_grain_present
Definition: headers.h:244
int16_t beta
Definition: headers.h:84
enum Dav1dRestorationType type[3]
Definition: headers.h:374
int num_y_points
Definition: headers.h:268
int8_t ar_coeffs_y[24]
Definition: headers.h:275
int16_t alpha
Definition: headers.h:84
Definition: headers.h:110
int show_existing_frame
Definition: headers.h:296
int unit_size[2]
Definition: headers.h:375
struct Dav1dFrameHeader::@7 quant
int spatial_id
spatial and temporal id of the frame for SVC
Definition: headers.h:294
int cdef
Definition: headers.h:231
Definition: headers.h:140
Definition: headers.h:61
int update_map
Definition: headers.h:343
enum Dav1dWarpedMotionType type
Definition: headers.h:80
int vdc_delta
Definition: headers.h:339
int level_u
Definition: headers.h:361
int max_log2_rows
Definition: headers.h:331
logarithmic (100:1 range)
Definition: headers.h:127
int y_strength[DAV1D_MAX_CDEF_STRENGTHS]
Definition: headers.h:370
4:2:2 planar
Definition: headers.h:93
int ref
Definition: headers.h:250
int switchable_motion_mode
Definition: headers.h:324
Definition: headers.h:66
#define DAV1D_MAX_SEGMENTS
Definition: headers.h:36
struct Dav1dFrameHeader::@9::@13 q
Dav1dSegmentationDataSet seg_data
Definition: headers.h:344
int all_lossless
Definition: headers.h:358
int reduced_txtp_set
Definition: headers.h:381
int decoder_model_info_present
Definition: headers.h:207
Definition: headers.h:143
int temporal_id
Definition: headers.h:294
int n_bits
Definition: headers.h:369
int showable_frame
Definition: headers.h:301
int log2_rows
Definition: headers.h:331
Definition: headers.h:133
Dav1dTxfmMode
Definition: headers.h:42
int refresh_context
Definition: headers.h:326
Dav1dTransferCharacteristics
Definition: headers.h:119
int switchable_comp_refs
Definition: headers.h:378
struct Dav1dFrameHeader::@4 film_grain
film grain parameters
int primary_ref_frame
Definition: headers.h:307
int res_log2
Definition: headers.h:350
Dav1dPixelLayout
Definition: headers.h:90
int max_height
Definition: headers.h:175
int globalmv
Definition: headers.h:252
Co-located with luma(0, 0) sample.
Definition: headers.h:160
uint16_t seed
Definition: headers.h:267
int width_n_bits
Definition: headers.h:213
enum Dav1dAdaptiveBoolean screen_content_tools
Definition: headers.h:227
int mode_ref_delta_update
Definition: headers.h:363
int temporal
Definition: headers.h:343
uint16_t col_start_sb[DAV1D_MAX_TILE_COLS+1]
Definition: headers.h:332
uint16_t row_start_sb[DAV1D_MAX_TILE_ROWS+1]
Definition: headers.h:333
Dav1dWarpedMotionParams gmv[DAV1D_REFS_PER_FRAME]
Definition: headers.h:382
int encoder_decoder_buffer_delay_length
Definition: headers.h:208
int cols
Definition: headers.h:330
struct Dav1dFrameHeader::@9 delta
Definition: headers.h:76
int num_operating_points
Definition: headers.h:187
int order_hint
Definition: headers.h:224
Definition: headers.h:51
Definition: headers.h:73
int max_width
Definition: headers.h:175
Definition: headers.h:114
int update
Definition: headers.h:291
int last_active_segid
Definition: headers.h:258
int dual_filter
Definition: headers.h:223
int color_description_present
Definition: headers.h:242
enum Dav1dFrameType frame_type
type of the picture
Definition: headers.h:287
int rows
Definition: headers.h:331
Definition: headers.h:122
Definition: headers.h:149
int qm_v
Definition: headers.h:340
int chroma_scaling_from_luma
Definition: headers.h:270