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 
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 
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 + 3 /* padding for alignment purposes */];
322  uint64_t ar_coeff_shift;
324  int uv_mult[2];
325  int uv_luma_mult[2];
326  int uv_offset[2];
330 
331 typedef struct Dav1dFrameHeader {
332  struct {
335  } film_grain;
337  int width[2 /* { coded_width, superresolution_upscaled_width } */], height;
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 */