1cabdff1aSopenharmony_ci/*
2cabdff1aSopenharmony_ci * This file is part of FFmpeg.
3cabdff1aSopenharmony_ci *
4cabdff1aSopenharmony_ci * FFmpeg is free software; you can redistribute it and/or
5cabdff1aSopenharmony_ci * modify it under the terms of the GNU Lesser General Public
6cabdff1aSopenharmony_ci * License as published by the Free Software Foundation; either
7cabdff1aSopenharmony_ci * version 2.1 of the License, or (at your option) any later version.
8cabdff1aSopenharmony_ci *
9cabdff1aSopenharmony_ci * FFmpeg is distributed in the hope that it will be useful,
10cabdff1aSopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of
11cabdff1aSopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12cabdff1aSopenharmony_ci * Lesser General Public License for more details.
13cabdff1aSopenharmony_ci *
14cabdff1aSopenharmony_ci * You should have received a copy of the GNU Lesser General Public
15cabdff1aSopenharmony_ci * License along with FFmpeg; if not, write to the Free Software
16cabdff1aSopenharmony_ci * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17cabdff1aSopenharmony_ci */
18cabdff1aSopenharmony_ci
19cabdff1aSopenharmony_ci/**
20cabdff1aSopenharmony_ci * @file
21cabdff1aSopenharmony_ci * AV1 common definitions
22cabdff1aSopenharmony_ci */
23cabdff1aSopenharmony_ci
24cabdff1aSopenharmony_ci#ifndef AVCODEC_AV1_H
25cabdff1aSopenharmony_ci#define AVCODEC_AV1_H
26cabdff1aSopenharmony_ci
27cabdff1aSopenharmony_ci// OBU types (section 6.2.2).
28cabdff1aSopenharmony_citypedef enum {
29cabdff1aSopenharmony_ci    // 0 reserved.
30cabdff1aSopenharmony_ci    AV1_OBU_SEQUENCE_HEADER        = 1,
31cabdff1aSopenharmony_ci    AV1_OBU_TEMPORAL_DELIMITER     = 2,
32cabdff1aSopenharmony_ci    AV1_OBU_FRAME_HEADER           = 3,
33cabdff1aSopenharmony_ci    AV1_OBU_TILE_GROUP             = 4,
34cabdff1aSopenharmony_ci    AV1_OBU_METADATA               = 5,
35cabdff1aSopenharmony_ci    AV1_OBU_FRAME                  = 6,
36cabdff1aSopenharmony_ci    AV1_OBU_REDUNDANT_FRAME_HEADER = 7,
37cabdff1aSopenharmony_ci    AV1_OBU_TILE_LIST              = 8,
38cabdff1aSopenharmony_ci    // 9-14 reserved.
39cabdff1aSopenharmony_ci    AV1_OBU_PADDING                = 15,
40cabdff1aSopenharmony_ci} AV1_OBU_Type;
41cabdff1aSopenharmony_ci
42cabdff1aSopenharmony_ci// Metadata types (section 6.7.1).
43cabdff1aSopenharmony_cienum {
44cabdff1aSopenharmony_ci    AV1_METADATA_TYPE_HDR_CLL     = 1,
45cabdff1aSopenharmony_ci    AV1_METADATA_TYPE_HDR_MDCV    = 2,
46cabdff1aSopenharmony_ci    AV1_METADATA_TYPE_SCALABILITY = 3,
47cabdff1aSopenharmony_ci    AV1_METADATA_TYPE_ITUT_T35    = 4,
48cabdff1aSopenharmony_ci    AV1_METADATA_TYPE_TIMECODE    = 5,
49cabdff1aSopenharmony_ci};
50cabdff1aSopenharmony_ci
51cabdff1aSopenharmony_ci// Frame types (section 6.8.2).
52cabdff1aSopenharmony_cienum {
53cabdff1aSopenharmony_ci    AV1_FRAME_KEY        = 0,
54cabdff1aSopenharmony_ci    AV1_FRAME_INTER      = 1,
55cabdff1aSopenharmony_ci    AV1_FRAME_INTRA_ONLY = 2,
56cabdff1aSopenharmony_ci    AV1_FRAME_SWITCH     = 3,
57cabdff1aSopenharmony_ci};
58cabdff1aSopenharmony_ci
59cabdff1aSopenharmony_ci// Reference frames (section 6.10.24).
60cabdff1aSopenharmony_cienum {
61cabdff1aSopenharmony_ci    AV1_REF_FRAME_INTRA   = 0,
62cabdff1aSopenharmony_ci    AV1_REF_FRAME_LAST    = 1,
63cabdff1aSopenharmony_ci    AV1_REF_FRAME_LAST2   = 2,
64cabdff1aSopenharmony_ci    AV1_REF_FRAME_LAST3   = 3,
65cabdff1aSopenharmony_ci    AV1_REF_FRAME_GOLDEN  = 4,
66cabdff1aSopenharmony_ci    AV1_REF_FRAME_BWDREF  = 5,
67cabdff1aSopenharmony_ci    AV1_REF_FRAME_ALTREF2 = 6,
68cabdff1aSopenharmony_ci    AV1_REF_FRAME_ALTREF  = 7,
69cabdff1aSopenharmony_ci};
70cabdff1aSopenharmony_ci
71cabdff1aSopenharmony_ci// Constants (section 3).
72cabdff1aSopenharmony_cienum {
73cabdff1aSopenharmony_ci    AV1_MAX_OPERATING_POINTS = 32,
74cabdff1aSopenharmony_ci
75cabdff1aSopenharmony_ci    AV1_MAX_SB_SIZE    = 128,
76cabdff1aSopenharmony_ci    AV1_MI_SIZE        = 4,
77cabdff1aSopenharmony_ci
78cabdff1aSopenharmony_ci    AV1_MAX_TILE_WIDTH = 4096,
79cabdff1aSopenharmony_ci    AV1_MAX_TILE_AREA  = 4096 * 2304,
80cabdff1aSopenharmony_ci    AV1_MAX_TILE_ROWS  = 64,
81cabdff1aSopenharmony_ci    AV1_MAX_TILE_COLS  = 64,
82cabdff1aSopenharmony_ci
83cabdff1aSopenharmony_ci    AV1_NUM_REF_FRAMES       = 8,
84cabdff1aSopenharmony_ci    AV1_REFS_PER_FRAME       = 7,
85cabdff1aSopenharmony_ci    AV1_TOTAL_REFS_PER_FRAME = 8,
86cabdff1aSopenharmony_ci    AV1_PRIMARY_REF_NONE     = 7,
87cabdff1aSopenharmony_ci
88cabdff1aSopenharmony_ci    AV1_MAX_SEGMENTS = 8,
89cabdff1aSopenharmony_ci    AV1_SEG_LVL_MAX  = 8,
90cabdff1aSopenharmony_ci
91cabdff1aSopenharmony_ci    AV1_SEG_LVL_ALT_Q      = 0,
92cabdff1aSopenharmony_ci    AV1_SEG_LVL_ALT_LF_Y_V = 1,
93cabdff1aSopenharmony_ci    AV1_SEG_LVL_REF_FRAME  = 5,
94cabdff1aSopenharmony_ci    AV1_SEG_LVL_SKIP       = 6,
95cabdff1aSopenharmony_ci    AV1_SEG_LVL_GLOBAL_MV  = 7,
96cabdff1aSopenharmony_ci
97cabdff1aSopenharmony_ci    AV1_SELECT_SCREEN_CONTENT_TOOLS = 2,
98cabdff1aSopenharmony_ci    AV1_SELECT_INTEGER_MV           = 2,
99cabdff1aSopenharmony_ci
100cabdff1aSopenharmony_ci    AV1_SUPERRES_NUM       = 8,
101cabdff1aSopenharmony_ci    AV1_SUPERRES_DENOM_MIN = 9,
102cabdff1aSopenharmony_ci
103cabdff1aSopenharmony_ci    AV1_INTERPOLATION_FILTER_SWITCHABLE = 4,
104cabdff1aSopenharmony_ci
105cabdff1aSopenharmony_ci    AV1_GM_ABS_ALPHA_BITS       = 12,
106cabdff1aSopenharmony_ci    AV1_GM_ALPHA_PREC_BITS      = 15,
107cabdff1aSopenharmony_ci    AV1_GM_ABS_TRANS_ONLY_BITS  = 9,
108cabdff1aSopenharmony_ci    AV1_GM_TRANS_ONLY_PREC_BITS = 3,
109cabdff1aSopenharmony_ci    AV1_GM_ABS_TRANS_BITS       = 12,
110cabdff1aSopenharmony_ci    AV1_GM_TRANS_PREC_BITS      = 6,
111cabdff1aSopenharmony_ci    AV1_WARPEDMODEL_PREC_BITS   = 16,
112cabdff1aSopenharmony_ci
113cabdff1aSopenharmony_ci    AV1_WARP_MODEL_IDENTITY    = 0,
114cabdff1aSopenharmony_ci    AV1_WARP_MODEL_TRANSLATION = 1,
115cabdff1aSopenharmony_ci    AV1_WARP_MODEL_ROTZOOM     = 2,
116cabdff1aSopenharmony_ci    AV1_WARP_MODEL_AFFINE      = 3,
117cabdff1aSopenharmony_ci    AV1_WARP_PARAM_REDUCE_BITS = 6,
118cabdff1aSopenharmony_ci
119cabdff1aSopenharmony_ci    AV1_DIV_LUT_BITS      = 8,
120cabdff1aSopenharmony_ci    AV1_DIV_LUT_PREC_BITS = 14,
121cabdff1aSopenharmony_ci    AV1_DIV_LUT_NUM       = 257,
122cabdff1aSopenharmony_ci
123cabdff1aSopenharmony_ci    AV1_MAX_LOOP_FILTER = 63,
124cabdff1aSopenharmony_ci};
125cabdff1aSopenharmony_ci
126cabdff1aSopenharmony_ci
127cabdff1aSopenharmony_ci// The main colour configuration information uses the same ISO/IEC 23001-8
128cabdff1aSopenharmony_ci// (H.273) enums as FFmpeg does, so separate definitions are not required.
129cabdff1aSopenharmony_ci
130cabdff1aSopenharmony_ci// Chroma sample position.
131cabdff1aSopenharmony_cienum {
132cabdff1aSopenharmony_ci    AV1_CSP_UNKNOWN   = 0,
133cabdff1aSopenharmony_ci    AV1_CSP_VERTICAL  = 1, // -> AVCHROMA_LOC_LEFT.
134cabdff1aSopenharmony_ci    AV1_CSP_COLOCATED = 2, // -> AVCHROMA_LOC_TOPLEFT.
135cabdff1aSopenharmony_ci};
136cabdff1aSopenharmony_ci
137cabdff1aSopenharmony_ci// Scalability modes (section 6.7.5)
138cabdff1aSopenharmony_cienum {
139cabdff1aSopenharmony_ci    AV1_SCALABILITY_L1T2 = 0,
140cabdff1aSopenharmony_ci    AV1_SCALABILITY_L1T3 = 1,
141cabdff1aSopenharmony_ci    AV1_SCALABILITY_L2T1 = 2,
142cabdff1aSopenharmony_ci    AV1_SCALABILITY_L2T2 = 3,
143cabdff1aSopenharmony_ci    AV1_SCALABILITY_L2T3 = 4,
144cabdff1aSopenharmony_ci    AV1_SCALABILITY_S2T1 = 5,
145cabdff1aSopenharmony_ci    AV1_SCALABILITY_S2T2 = 6,
146cabdff1aSopenharmony_ci    AV1_SCALABILITY_S2T3 = 7,
147cabdff1aSopenharmony_ci    AV1_SCALABILITY_L2T1h = 8,
148cabdff1aSopenharmony_ci    AV1_SCALABILITY_L2T2h = 9,
149cabdff1aSopenharmony_ci    AV1_SCALABILITY_L2T3h = 10,
150cabdff1aSopenharmony_ci    AV1_SCALABILITY_S2T1h = 11,
151cabdff1aSopenharmony_ci    AV1_SCALABILITY_S2T2h = 12,
152cabdff1aSopenharmony_ci    AV1_SCALABILITY_S2T3h = 13,
153cabdff1aSopenharmony_ci    AV1_SCALABILITY_SS = 14,
154cabdff1aSopenharmony_ci    AV1_SCALABILITY_L3T1 = 15,
155cabdff1aSopenharmony_ci    AV1_SCALABILITY_L3T2 = 16,
156cabdff1aSopenharmony_ci    AV1_SCALABILITY_L3T3 = 17,
157cabdff1aSopenharmony_ci    AV1_SCALABILITY_S3T1 = 18,
158cabdff1aSopenharmony_ci    AV1_SCALABILITY_S3T2 = 19,
159cabdff1aSopenharmony_ci    AV1_SCALABILITY_S3T3 = 20,
160cabdff1aSopenharmony_ci    AV1_SCALABILITY_L3T2_KEY = 21,
161cabdff1aSopenharmony_ci    AV1_SCALABILITY_L3T3_KEY = 22,
162cabdff1aSopenharmony_ci    AV1_SCALABILITY_L4T5_KEY = 23,
163cabdff1aSopenharmony_ci    AV1_SCALABILITY_L4T7_KEY = 24,
164cabdff1aSopenharmony_ci    AV1_SCALABILITY_L3T2_KEY_SHIFT = 25,
165cabdff1aSopenharmony_ci    AV1_SCALABILITY_L3T3_KEY_SHIFT = 26,
166cabdff1aSopenharmony_ci    AV1_SCALABILITY_L4T5_KEY_SHIFT = 27,
167cabdff1aSopenharmony_ci    AV1_SCALABILITY_L4T7_KEY_SHIFT = 28,
168cabdff1aSopenharmony_ci};
169cabdff1aSopenharmony_ci
170cabdff1aSopenharmony_ci// Frame Restoration types (section 6.10.15)
171cabdff1aSopenharmony_cienum {
172cabdff1aSopenharmony_ci    AV1_RESTORE_NONE       = 0,
173cabdff1aSopenharmony_ci    AV1_RESTORE_WIENER     = 1,
174cabdff1aSopenharmony_ci    AV1_RESTORE_SGRPROJ    = 2,
175cabdff1aSopenharmony_ci    AV1_RESTORE_SWITCHABLE = 3,
176cabdff1aSopenharmony_ci};
177cabdff1aSopenharmony_ci
178cabdff1aSopenharmony_ci// Sequence Headers are actually unbounded because one can use
179cabdff1aSopenharmony_ci// an arbitrary number of leading zeroes when encoding via uvlc.
180cabdff1aSopenharmony_ci// The following estimate is based around using the lowest number
181cabdff1aSopenharmony_ci// of bits for uvlc encoding.
182cabdff1aSopenharmony_ci#define AV1_SANE_SEQUENCE_HEADER_MAX_BITS           3138
183cabdff1aSopenharmony_ci
184cabdff1aSopenharmony_ci#endif /* AVCODEC_AV1_H */
185