summaryrefslogtreecommitdiff
path: root/drivers/frame_provider/decoder/vav1/av1_global.h (plain)
blob: 06a527ab437281dc371c55ab70fecb732b507f51
1#ifndef AV1_GLOBAL_H_
2#define AV1_GLOBAL_H_
3#define AOM_AV1_MMU_DW
4#ifndef HAVE_NEON
5#define HAVE_NEON 0
6#endif
7#ifndef CONFIG_ACCOUNTING
8#define CONFIG_ACCOUNTING 0
9#endif
10#ifndef CONFIG_INSPECTION
11#define CONFIG_INSPECTION 0
12#endif
13#ifndef CONFIG_LPF_MASK
14#define CONFIG_LPF_MASK 0
15#endif
16#ifndef CONFIG_SIZE_LIMIT
17#define CONFIG_SIZE_LIMIT 0
18#endif
19
20#define SUPPORT_SCALE_FACTOR
21#define USE_SCALED_WIDTH_FROM_UCODE
22#define AML
23#ifdef CONFIG_AMLOGIC_MEDIA_MULTI_DEC
24#define AML_DEVICE
25#endif
26#ifdef BUFMGR_FOR_SIM
27#define printf io_printf
28#endif
29
30#ifndef INT_MAX
31#define INT_MAX 0x7FFFFFFF
32#endif
33#define AOMMIN(x, y) (((x) < (y)) ? (x) : (y))
34#define AOMMAX(x, y) (((x) > (y)) ? (x) : (y))
35
36//typedef char int8_t;
37//#ifndef BUFMGR_FOR_SIM
38typedef unsigned char uint8_t;
39//#endif
40typedef unsigned int uint32_t;
41//typedef int int32_t;
42//typedef long long int64_t;
43
44#ifdef AML
45#define AOM_AV1_MMU
46#define FILM_GRAIN_REG_SIZE 39
47typedef struct buff_s
48{
49 uint32_t buf_start;
50 uint32_t buf_size;
51 uint32_t buf_end;
52} buff_t;
53
54typedef struct BuffInfo_s
55{
56 uint32_t max_width;
57 uint32_t max_height;
58 uint32_t start_adr;
59 uint32_t end_adr;
60 buff_t ipp;
61 buff_t sao_abv;
62 buff_t sao_vb;
63 buff_t short_term_rps;
64 buff_t vps;
65 buff_t seg_map;
66 buff_t daala_top;
67 buff_t sao_up;
68 buff_t swap_buf;
69 buff_t cdf_buf;
70 buff_t gmc_buf;
71 buff_t scalelut;
72 buff_t dblk_para;
73 buff_t dblk_data;
74 buff_t cdef_data;
75 buff_t ups_data;
76#ifdef AOM_AV1_MMU
77 buff_t mmu_vbh;
78 buff_t cm_header;
79#endif
80#ifdef AOM_AV1_MMU_DW
81 buff_t mmu_vbh_dw;
82 buff_t cm_header_dw;
83#endif
84 buff_t fgs_table;
85 buff_t mpred_above;
86 buff_t mpred_mv;
87 buff_t rpm;
88 buff_t lmem;
89} BuffInfo_t;
90#endif
91
92#define va_start(v,l) __builtin_va_start(v,l)
93#define va_end(v) __builtin_va_end(v)
94#define va_arg(v,l) __builtin_va_arg(v,l)
95/*
96mem.h
97*/
98#if (defined(__GNUC__) && __GNUC__) || defined(__SUNPRO_C)
99#define DECLARE_ALIGNED(n, typ, val) typ val __attribute__((aligned(n)))
100#elif defined(_MSC_VER)
101#define DECLARE_ALIGNED(n, typ, val) __declspec(align(n)) typ val
102#else
103#warning No alignment directives known for this compiler.
104#define DECLARE_ALIGNED(n, typ, val) typ val
105#endif
106
107/* Indicates that the usage of the specified variable has been audited to assure
108 * that it's safe to use uninitialized. Silences 'may be used uninitialized'
109 * warnings on gcc.
110 */
111#if defined(__GNUC__) && __GNUC__
112#define UNINITIALIZED_IS_SAFE(x) x = x
113#else
114#define UNINITIALIZED_IS_SAFE(x) x
115#endif
116
117#if HAVE_NEON && defined(_MSC_VER)
118#define __builtin_prefetch(x)
119#endif
120
121/* Shift down with rounding for use when n >= 0, value >= 0 */
122#define ROUND_POWER_OF_TWO(value, n) (((value) + (((1 << (n)) >> 1))) >> (n))
123
124/* Shift down with rounding for signed integers, for use when n >= 0 */
125#define ROUND_POWER_OF_TWO_SIGNED(value, n) \
126 (((value) < 0) ? -ROUND_POWER_OF_TWO(-(value), (n)) \
127 : ROUND_POWER_OF_TWO((value), (n)))
128
129/* Shift down with rounding for use when n >= 0, value >= 0 for (64 bit) */
130#define ROUND_POWER_OF_TWO_64(value, n) \
131 (((value) + ((((int64_t)1 << (n)) >> 1))) >> (n))
132/* Shift down with rounding for signed integers, for use when n >= 0 (64 bit) */
133#define ROUND_POWER_OF_TWO_SIGNED_64(value, n) \
134 (((value) < 0) ? -ROUND_POWER_OF_TWO_64(-(value), (n)) \
135 : ROUND_POWER_OF_TWO_64((value), (n)))
136
137/* shift right or left depending on sign of n */
138#define RIGHT_SIGNED_SHIFT(value, n) \
139 ((n) < 0 ? ((value) << (-(n))) : ((value) >> (n)))
140
141#define ALIGN_POWER_OF_TWO(value, n) \
142 (((value) + ((1 << (n)) - 1)) & ~((1 << (n)) - 1))
143
144#define DIVIDE_AND_ROUND(x, y) (((x) + ((y) >> 1)) / (y))
145
146#define CONVERT_TO_SHORTPTR(x) ((uint16_t *)(((uintptr_t)(x)) << 1))
147#define CONVERT_TO_BYTEPTR(x) ((uint8_t *)(((uintptr_t)(x)) >> 1))
148
149#ifdef AML
150#define TYPEDEF typedef
151#define UENUM1BYTE(enumvar) enumvar
152#define SENUM1BYTE(enumvar) enumvar
153#define UENUM2BYTE(enumvar) enumvar
154#define SENUM2BYTE(enumvar) enumvar
155#define UENUM4BYTE(enumvar) enumvar
156#define SENUM4BYTE(enumvar) enumvar
157
158#else
159#define TYPEDEF
160/*!\brief force enum to be unsigned 1 byte*/
161#define UENUM1BYTE(enumvar) \
162 ; \
163 typedef uint8_t enumvar
164
165/*!\brief force enum to be signed 1 byte*/
166#define SENUM1BYTE(enumvar) \
167 ; \
168 typedef int8_t enumvar
169
170/*!\brief force enum to be unsigned 2 byte*/
171#define UENUM2BYTE(enumvar) \
172 ; \
173 typedef uint16_t enumvar
174
175/*!\brief force enum to be signed 2 byte*/
176#define SENUM2BYTE(enumvar) \
177 ; \
178 typedef int16_t enumvar
179
180/*!\brief force enum to be unsigned 4 byte*/
181#define UENUM4BYTE(enumvar) \
182 ; \
183 typedef uint32_t enumvar
184
185/*!\brief force enum to be unsigned 4 byte*/
186#define SENUM4BYTE(enumvar) \
187 ; \
188 typedef int32_t enumvar
189#endif
190
191
192/*
193#include "enums.h"
194*/
195#undef MAX_SB_SIZE
196
197// Max superblock size
198#define MAX_SB_SIZE_LOG2 7
199#define MAX_SB_SIZE (1 << MAX_SB_SIZE_LOG2)
200#define MAX_SB_SQUARE (MAX_SB_SIZE * MAX_SB_SIZE)
201
202// Min superblock size
203#define MIN_SB_SIZE_LOG2 6
204
205// Pixels per Mode Info (MI) unit
206#define MI_SIZE_LOG2 2
207#define MI_SIZE (1 << MI_SIZE_LOG2)
208
209// MI-units per max superblock (MI Block - MIB)
210#define MAX_MIB_SIZE_LOG2 (MAX_SB_SIZE_LOG2 - MI_SIZE_LOG2)
211#define MAX_MIB_SIZE (1 << MAX_MIB_SIZE_LOG2)
212
213// MI-units per min superblock
214#define MIN_MIB_SIZE_LOG2 (MIN_SB_SIZE_LOG2 - MI_SIZE_LOG2)
215
216// Mask to extract MI offset within max MIB
217#define MAX_MIB_MASK (MAX_MIB_SIZE - 1)
218
219// Maximum number of tile rows and tile columns
220#define MAX_TILE_ROWS 64
221#define MAX_TILE_COLS 64
222
223#define MAX_VARTX_DEPTH 2
224
225#define MI_SIZE_64X64 (64 >> MI_SIZE_LOG2)
226#define MI_SIZE_128X128 (128 >> MI_SIZE_LOG2)
227
228#define MAX_PALETTE_SQUARE (64 * 64)
229// Maximum number of colors in a palette.
230#define PALETTE_MAX_SIZE 8
231// Minimum number of colors in a palette.
232#define PALETTE_MIN_SIZE 2
233
234#define FRAME_OFFSET_BITS 5
235#define MAX_FRAME_DISTANCE ((1 << FRAME_OFFSET_BITS) - 1)
236
237// 4 frame filter levels: y plane vertical, y plane horizontal,
238// u plane, and v plane
239#define FRAME_LF_COUNT 4
240#define DEFAULT_DELTA_LF_MULTI 0
241#define MAX_MODE_LF_DELTAS 2
242
243#define DIST_PRECISION_BITS 4
244#define DIST_PRECISION (1 << DIST_PRECISION_BITS) // 16
245
246#define PROFILE_BITS 3
247// The following three profiles are currently defined.
248// Profile 0. 8-bit and 10-bit 4:2:0 and 4:0:0 only.
249// Profile 1. 8-bit and 10-bit 4:4:4
250// Profile 2. 8-bit and 10-bit 4:2:2
251// 12-bit 4:0:0, 4:2:2 and 4:4:4
252// Since we have three bits for the profiles, it can be extended later.
253TYPEDEF enum {
254 PROFILE_0,
255 PROFILE_1,
256 PROFILE_2,
257 MAX_PROFILES,
258} SENUM1BYTE(BITSTREAM_PROFILE);
259
260#define OP_POINTS_CNT_MINUS_1_BITS 5
261#define OP_POINTS_IDC_BITS 12
262
263// Note: Some enums use the attribute 'packed' to use smallest possible integer
264// type, so that we can save memory when they are used in structs/arrays.
265
266typedef enum ATTRIBUTE_PACKED {
267 BLOCK_4X4,
268 BLOCK_4X8,
269 BLOCK_8X4,
270 BLOCK_8X8,
271 BLOCK_8X16,
272 BLOCK_16X8,
273 BLOCK_16X16,
274 BLOCK_16X32,
275 BLOCK_32X16,
276 BLOCK_32X32,
277 BLOCK_32X64,
278 BLOCK_64X32,
279 BLOCK_64X64,
280 BLOCK_64X128,
281 BLOCK_128X64,
282 BLOCK_128X128,
283 BLOCK_4X16,
284 BLOCK_16X4,
285 BLOCK_8X32,
286 BLOCK_32X8,
287 BLOCK_16X64,
288 BLOCK_64X16,
289 BLOCK_SIZES_ALL,
290 BLOCK_SIZES = BLOCK_4X16,
291 BLOCK_INVALID = 255,
292 BLOCK_LARGEST = (BLOCK_SIZES - 1)
293} BLOCK_SIZE2;
294
295// 4X4, 8X8, 16X16, 32X32, 64X64, 128X128
296#define SQR_BLOCK_SIZES 6
297
298TYPEDEF enum {
299 PARTITION_NONE,
300 PARTITION_HORZ,
301 PARTITION_VERT,
302 PARTITION_SPLIT,
303 PARTITION_HORZ_A, // HORZ split and the top partition is split again
304 PARTITION_HORZ_B, // HORZ split and the bottom partition is split again
305 PARTITION_VERT_A, // VERT split and the left partition is split again
306 PARTITION_VERT_B, // VERT split and the right partition is split again
307 PARTITION_HORZ_4, // 4:1 horizontal partition
308 PARTITION_VERT_4, // 4:1 vertical partition
309 EXT_PARTITION_TYPES,
310 PARTITION_TYPES = PARTITION_SPLIT + 1,
311 PARTITION_INVALID = 255
312} UENUM1BYTE(PARTITION_TYPE);
313
314typedef char PARTITION_CONTEXT;
315#define PARTITION_PLOFFSET 4 // number of probability models per block size
316#define PARTITION_BLOCK_SIZES 5
317#define PARTITION_CONTEXTS (PARTITION_BLOCK_SIZES * PARTITION_PLOFFSET)
318
319// block transform size
320TYPEDEF enum {
321 TX_4X4, // 4x4 transform
322 TX_8X8, // 8x8 transform
323 TX_16X16, // 16x16 transform
324 TX_32X32, // 32x32 transform
325 TX_64X64, // 64x64 transform
326 TX_4X8, // 4x8 transform
327 TX_8X4, // 8x4 transform
328 TX_8X16, // 8x16 transform
329 TX_16X8, // 16x8 transform
330 TX_16X32, // 16x32 transform
331 TX_32X16, // 32x16 transform
332 TX_32X64, // 32x64 transform
333 TX_64X32, // 64x32 transform
334 TX_4X16, // 4x16 transform
335 TX_16X4, // 16x4 transform
336 TX_8X32, // 8x32 transform
337 TX_32X8, // 32x8 transform
338 TX_16X64, // 16x64 transform
339 TX_64X16, // 64x16 transform
340 TX_SIZES_ALL, // Includes rectangular transforms
341 TX_SIZES = TX_4X8, // Does NOT include rectangular transforms
342 TX_SIZES_LARGEST = TX_64X64,
343 TX_INVALID = 255 // Invalid transform size
344} UENUM1BYTE(TX_SIZE);
345
346#define TX_SIZE_LUMA_MIN (TX_4X4)
347/* We don't need to code a transform size unless the allowed size is at least
348 one more than the minimum. */
349#define TX_SIZE_CTX_MIN (TX_SIZE_LUMA_MIN + 1)
350
351// Maximum tx_size categories
352#define MAX_TX_CATS (TX_SIZES - TX_SIZE_CTX_MIN)
353#define MAX_TX_DEPTH 2
354
355#define MAX_TX_SIZE_LOG2 (6)
356#define MAX_TX_SIZE (1 << MAX_TX_SIZE_LOG2)
357#define MIN_TX_SIZE_LOG2 2
358#define MIN_TX_SIZE (1 << MIN_TX_SIZE_LOG2)
359#define MAX_TX_SQUARE (MAX_TX_SIZE * MAX_TX_SIZE)
360
361// Pad 4 extra columns to remove horizontal availability check.
362#define TX_PAD_HOR_LOG2 2
363#define TX_PAD_HOR 4
364// Pad 6 extra rows (2 on top and 4 on bottom) to remove vertical availability
365// check.
366#define TX_PAD_TOP 0
367#define TX_PAD_BOTTOM 4
368#define TX_PAD_VER (TX_PAD_TOP + TX_PAD_BOTTOM)
369// Pad 16 extra bytes to avoid reading overflow in SIMD optimization.
370#define TX_PAD_END 16
371#define TX_PAD_2D ((32 + TX_PAD_HOR) * (32 + TX_PAD_VER) + TX_PAD_END)
372
373// Number of maxium size transform blocks in the maximum size superblock
374#define MAX_TX_BLOCKS_IN_MAX_SB_LOG2 ((MAX_SB_SIZE_LOG2 - MAX_TX_SIZE_LOG2) * 2)
375#define MAX_TX_BLOCKS_IN_MAX_SB (1 << MAX_TX_BLOCKS_IN_MAX_SB_LOG2)
376
377// frame transform mode
378TYPEDEF enum {
379 ONLY_4X4, // use only 4x4 transform
380 TX_MODE_LARGEST, // transform size is the largest possible for pu size
381 TX_MODE_SELECT, // transform specified for each block
382 TX_MODES,
383} UENUM1BYTE(TX_MODE);
384
385// 1D tx types
386TYPEDEF enum {
387 DCT_1D,
388 ADST_1D,
389 FLIPADST_1D,
390 IDTX_1D,
391 TX_TYPES_1D,
392} UENUM1BYTE(TX_TYPE_1D);
393
394TYPEDEF enum {
395 DCT_DCT, // DCT in both horizontal and vertical
396 ADST_DCT, // ADST in vertical, DCT in horizontal
397 DCT_ADST, // DCT in vertical, ADST in horizontal
398 ADST_ADST, // ADST in both directions
399 FLIPADST_DCT, // FLIPADST in vertical, DCT in horizontal
400 DCT_FLIPADST, // DCT in vertical, FLIPADST in horizontal
401 FLIPADST_FLIPADST, // FLIPADST in both directions
402 ADST_FLIPADST, // ADST in vertical, FLIPADST in horizontal
403 FLIPADST_ADST, // FLIPADST in vertical, ADST in horizontal
404 IDTX, // Identity in both directions
405 V_DCT, // DCT in vertical, identity in horizontal
406 H_DCT, // Identity in vertical, DCT in horizontal
407 V_ADST, // ADST in vertical, identity in horizontal
408 H_ADST, // Identity in vertical, ADST in horizontal
409 V_FLIPADST, // FLIPADST in vertical, identity in horizontal
410 H_FLIPADST, // Identity in vertical, FLIPADST in horizontal
411 TX_TYPES,
412} UENUM1BYTE(TX_TYPE);
413
414TYPEDEF enum {
415 REG_REG,
416 REG_SMOOTH,
417 REG_SHARP,
418 SMOOTH_REG,
419 SMOOTH_SMOOTH,
420 SMOOTH_SHARP,
421 SHARP_REG,
422 SHARP_SMOOTH,
423 SHARP_SHARP,
424} UENUM1BYTE(DUAL_FILTER_TYPE);
425
426TYPEDEF enum {
427 // DCT only
428 EXT_TX_SET_DCTONLY,
429 // DCT + Identity only
430 EXT_TX_SET_DCT_IDTX,
431 // Discrete Trig transforms w/o flip (4) + Identity (1)
432 EXT_TX_SET_DTT4_IDTX,
433 // Discrete Trig transforms w/o flip (4) + Identity (1) + 1D Hor/vert DCT (2)
434 EXT_TX_SET_DTT4_IDTX_1DDCT,
435 // Discrete Trig transforms w/ flip (9) + Identity (1) + 1D Hor/Ver DCT (2)
436 EXT_TX_SET_DTT9_IDTX_1DDCT,
437 // Discrete Trig transforms w/ flip (9) + Identity (1) + 1D Hor/Ver (6)
438 EXT_TX_SET_ALL16,
439 EXT_TX_SET_TYPES
440} UENUM1BYTE(TxSetType);
441
442#define IS_2D_TRANSFORM(tx_type) (tx_type < IDTX)
443
444#define EXT_TX_SIZES 4 // number of sizes that use extended transforms
445#define EXT_TX_SETS_INTER 4 // Sets of transform selections for INTER
446#define EXT_TX_SETS_INTRA 3 // Sets of transform selections for INTRA
447
448TYPEDEF enum {
449 AOM_LAST_FLAG = 1 << 0,
450 AOM_LAST2_FLAG = 1 << 1,
451 AOM_LAST3_FLAG = 1 << 2,
452 AOM_GOLD_FLAG = 1 << 3,
453 AOM_BWD_FLAG = 1 << 4,
454 AOM_ALT2_FLAG = 1 << 5,
455 AOM_ALT_FLAG = 1 << 6,
456 AOM_REFFRAME_ALL = (1 << 7) - 1
457} UENUM1BYTE(AOM_REFFRAME);
458
459TYPEDEF enum {
460 UNIDIR_COMP_REFERENCE,
461 BIDIR_COMP_REFERENCE,
462 COMP_REFERENCE_TYPES,
463} UENUM1BYTE(COMP_REFERENCE_TYPE);
464
465/*enum { PLANE_TYPE_Y, PLANE_TYPE_UV, PLANE_TYPES } UENUM1BYTE(PLANE_TYPE);*/
466
467#define CFL_ALPHABET_SIZE_LOG2 4
468#define CFL_ALPHABET_SIZE (1 << CFL_ALPHABET_SIZE_LOG2)
469#define CFL_MAGS_SIZE ((2 << CFL_ALPHABET_SIZE_LOG2) + 1)
470#define CFL_IDX_U(idx) (idx >> CFL_ALPHABET_SIZE_LOG2)
471#define CFL_IDX_V(idx) (idx & (CFL_ALPHABET_SIZE - 1))
472
473/*enum { CFL_PRED_U, CFL_PRED_V, CFL_PRED_PLANES } UENUM1BYTE(CFL_PRED_TYPE);*/
474
475TYPEDEF enum {
476 CFL_SIGN_ZERO,
477 CFL_SIGN_NEG,
478 CFL_SIGN_POS,
479 CFL_SIGNS
480} UENUM1BYTE(CFL_SIGN_TYPE);
481
482TYPEDEF enum {
483 CFL_DISALLOWED,
484 CFL_ALLOWED,
485 CFL_ALLOWED_TYPES
486} UENUM1BYTE(CFL_ALLOWED_TYPE);
487
488// CFL_SIGN_ZERO,CFL_SIGN_ZERO is invalid
489#define CFL_JOINT_SIGNS (CFL_SIGNS * CFL_SIGNS - 1)
490// CFL_SIGN_U is equivalent to (js + 1) / 3 for js in 0 to 8
491#define CFL_SIGN_U(js) (((js + 1) * 11) >> 5)
492// CFL_SIGN_V is equivalent to (js + 1) % 3 for js in 0 to 8
493#define CFL_SIGN_V(js) ((js + 1) - CFL_SIGNS * CFL_SIGN_U(js))
494
495// There is no context when the alpha for a given plane is zero.
496// So there are 2 fewer contexts than joint signs.
497#define CFL_ALPHA_CONTEXTS (CFL_JOINT_SIGNS + 1 - CFL_SIGNS)
498#define CFL_CONTEXT_U(js) (js + 1 - CFL_SIGNS)
499// Also, the contexts are symmetric under swapping the planes.
500#define CFL_CONTEXT_V(js) \
501 (CFL_SIGN_V(js) * CFL_SIGNS + CFL_SIGN_U(js) - CFL_SIGNS)
502
503TYPEDEF enum {
504 PALETTE_MAP,
505 COLOR_MAP_TYPES,
506} UENUM1BYTE(COLOR_MAP_TYPE);
507
508TYPEDEF enum {
509 TWO_COLORS,
510 THREE_COLORS,
511 FOUR_COLORS,
512 FIVE_COLORS,
513 SIX_COLORS,
514 SEVEN_COLORS,
515 EIGHT_COLORS,
516 PALETTE_SIZES
517} UENUM1BYTE(PALETTE_SIZE);
518
519TYPEDEF enum {
520 PALETTE_COLOR_ONE,
521 PALETTE_COLOR_TWO,
522 PALETTE_COLOR_THREE,
523 PALETTE_COLOR_FOUR,
524 PALETTE_COLOR_FIVE,
525 PALETTE_COLOR_SIX,
526 PALETTE_COLOR_SEVEN,
527 PALETTE_COLOR_EIGHT,
528 PALETTE_COLORS
529} UENUM1BYTE(PALETTE_COLOR);
530
531// Note: All directional predictors must be between V_PRED and D67_PRED (both
532// inclusive).
533TYPEDEF enum {
534 DC_PRED, // Average of above and left pixels
535 V_PRED, // Vertical
536 H_PRED, // Horizontal
537 D45_PRED, // Directional 45 degree
538 D135_PRED, // Directional 135 degree
539 D113_PRED, // Directional 113 degree
540 D157_PRED, // Directional 157 degree
541 D203_PRED, // Directional 203 degree
542 D67_PRED, // Directional 67 degree
543 SMOOTH_PRED, // Combination of horizontal and vertical interpolation
544 SMOOTH_V_PRED, // Vertical interpolation
545 SMOOTH_H_PRED, // Horizontal interpolation
546 PAETH_PRED, // Predict from the direction of smallest gradient
547 NEARESTMV,
548 NEARMV,
549 GLOBALMV,
550 NEWMV,
551 // Compound ref compound modes
552 NEAREST_NEARESTMV,
553 NEAR_NEARMV,
554 NEAREST_NEWMV,
555 NEW_NEARESTMV,
556 NEAR_NEWMV,
557 NEW_NEARMV,
558 GLOBAL_GLOBALMV,
559 NEW_NEWMV,
560 MB_MODE_COUNT,
561 INTRA_MODE_START = DC_PRED,
562 INTRA_MODE_END = NEARESTMV,
563 INTRA_MODE_NUM = INTRA_MODE_END - INTRA_MODE_START,
564 SINGLE_INTER_MODE_START = NEARESTMV,
565 SINGLE_INTER_MODE_END = NEAREST_NEARESTMV,
566 SINGLE_INTER_MODE_NUM = SINGLE_INTER_MODE_END - SINGLE_INTER_MODE_START,
567 COMP_INTER_MODE_START = NEAREST_NEARESTMV,
568 COMP_INTER_MODE_END = MB_MODE_COUNT,
569 COMP_INTER_MODE_NUM = COMP_INTER_MODE_END - COMP_INTER_MODE_START,
570 INTER_MODE_START = NEARESTMV,
571 INTER_MODE_END = MB_MODE_COUNT,
572 INTRA_MODES = PAETH_PRED + 1, // PAETH_PRED has to be the last intra mode.
573 INTRA_INVALID = MB_MODE_COUNT // For uv_mode in inter blocks
574} UENUM1BYTE(PREDICTION_MODE);
575
576// TODO(ltrudeau) Do we really want to pack this?
577// TODO(ltrudeau) Do we match with PREDICTION_MODE?
578TYPEDEF enum {
579 UV_DC_PRED, // Average of above and left pixels
580 UV_V_PRED, // Vertical
581 UV_H_PRED, // Horizontal
582 UV_D45_PRED, // Directional 45 degree
583 UV_D135_PRED, // Directional 135 degree
584 UV_D113_PRED, // Directional 113 degree
585 UV_D157_PRED, // Directional 157 degree
586 UV_D203_PRED, // Directional 203 degree
587 UV_D67_PRED, // Directional 67 degree
588 UV_SMOOTH_PRED, // Combination of horizontal and vertical interpolation
589 UV_SMOOTH_V_PRED, // Vertical interpolation
590 UV_SMOOTH_H_PRED, // Horizontal interpolation
591 UV_PAETH_PRED, // Predict from the direction of smallest gradient
592 UV_CFL_PRED, // Chroma-from-Luma
593 UV_INTRA_MODES,
594 UV_MODE_INVALID, // For uv_mode in inter blocks
595} UENUM1BYTE(UV_PREDICTION_MODE);
596
597TYPEDEF enum {
598 SIMPLE_TRANSLATION,
599 OBMC_CAUSAL, // 2-sided OBMC
600 WARPED_CAUSAL, // 2-sided WARPED
601 MOTION_MODES
602} UENUM1BYTE(MOTION_MODE);
603
604TYPEDEF enum {
605 II_DC_PRED,
606 II_V_PRED,
607 II_H_PRED,
608 II_SMOOTH_PRED,
609 INTERINTRA_MODES
610} UENUM1BYTE(INTERINTRA_MODE);
611
612TYPEDEF enum {
613 COMPOUND_AVERAGE,
614 COMPOUND_DISTWTD,
615 COMPOUND_WEDGE,
616 COMPOUND_DIFFWTD,
617 COMPOUND_TYPES,
618 MASKED_COMPOUND_TYPES = 2,
619} UENUM1BYTE(COMPOUND_TYPE);
620
621TYPEDEF enum {
622 FILTER_DC_PRED,
623 FILTER_V_PRED,
624 FILTER_H_PRED,
625 FILTER_D157_PRED,
626 FILTER_PAETH_PRED,
627 FILTER_INTRA_MODES,
628} UENUM1BYTE(FILTER_INTRA_MODE);
629
630TYPEDEF enum {
631 SEQ_LEVEL_2_0,
632 SEQ_LEVEL_2_1,
633 SEQ_LEVEL_2_2,
634 SEQ_LEVEL_2_3,
635 SEQ_LEVEL_3_0,
636 SEQ_LEVEL_3_1,
637 SEQ_LEVEL_3_2,
638 SEQ_LEVEL_3_3,
639 SEQ_LEVEL_4_0,
640 SEQ_LEVEL_4_1,
641 SEQ_LEVEL_4_2,
642 SEQ_LEVEL_4_3,
643 SEQ_LEVEL_5_0,
644 SEQ_LEVEL_5_1,
645 SEQ_LEVEL_5_2,
646 SEQ_LEVEL_5_3,
647 SEQ_LEVEL_6_0,
648 SEQ_LEVEL_6_1,
649 SEQ_LEVEL_6_2,
650 SEQ_LEVEL_6_3,
651 SEQ_LEVEL_7_0,
652 SEQ_LEVEL_7_1,
653 SEQ_LEVEL_7_2,
654 SEQ_LEVEL_7_3,
655 SEQ_LEVELS,
656 SEQ_LEVEL_MAX = 31
657} UENUM1BYTE(AV1_LEVEL);
658
659#define LEVEL_BITS 5
660
661#define DIRECTIONAL_MODES 8
662#define MAX_ANGLE_DELTA 3
663#define ANGLE_STEP 3
664
665#define INTER_MODES (1 + NEWMV - NEARESTMV)
666
667#define INTER_COMPOUND_MODES (1 + NEW_NEWMV - NEAREST_NEARESTMV)
668
669#define SKIP_CONTEXTS 3
670#define SKIP_MODE_CONTEXTS 3
671
672#define COMP_INDEX_CONTEXTS 6
673#define COMP_GROUP_IDX_CONTEXTS 6
674
675#define NMV_CONTEXTS 3
676
677#define NEWMV_MODE_CONTEXTS 6
678#define GLOBALMV_MODE_CONTEXTS 2
679#define REFMV_MODE_CONTEXTS 6
680#define DRL_MODE_CONTEXTS 3
681
682#define GLOBALMV_OFFSET 3
683#define REFMV_OFFSET 4
684
685#define NEWMV_CTX_MASK ((1 << GLOBALMV_OFFSET) - 1)
686#define GLOBALMV_CTX_MASK ((1 << (REFMV_OFFSET - GLOBALMV_OFFSET)) - 1)
687#define REFMV_CTX_MASK ((1 << (8 - REFMV_OFFSET)) - 1)
688
689#define COMP_NEWMV_CTXS 5
690#define INTER_MODE_CONTEXTS 8
691
692#define DELTA_Q_SMALL 3
693#define DELTA_Q_PROBS (DELTA_Q_SMALL)
694#define DEFAULT_DELTA_Q_RES_PERCEPTUAL 4
695#define DEFAULT_DELTA_Q_RES_OBJECTIVE 4
696
697#define DELTA_LF_SMALL 3
698#define DELTA_LF_PROBS (DELTA_LF_SMALL)
699#define DEFAULT_DELTA_LF_RES 2
700
701/* Segment Feature Masks */
702#define MAX_MV_REF_CANDIDATES 2
703
704#define MAX_REF_MV_STACK_SIZE 8
705#define REF_CAT_LEVEL 640
706
707#define INTRA_INTER_CONTEXTS 4
708#define COMP_INTER_CONTEXTS 5
709#define REF_CONTEXTS 3
710
711#define COMP_REF_TYPE_CONTEXTS 5
712#define UNI_COMP_REF_CONTEXTS 3
713
714#define TXFM_PARTITION_CONTEXTS ((TX_SIZES - TX_8X8) * 6 - 3)
715#ifdef ORI_CODE
716typedef uint8_t TXFM_CONTEXT;
717#endif
718// An enum for single reference types (and some derived values).
719enum {
720 NONE_FRAME = -1,
721 INTRA_FRAME,
722 LAST_FRAME,
723 LAST2_FRAME,
724 LAST3_FRAME,
725 GOLDEN_FRAME,
726 BWDREF_FRAME,
727 ALTREF2_FRAME,
728 ALTREF_FRAME,
729 REF_FRAMES,
730
731 // Extra/scratch reference frame. It may be:
732 // - used to update the ALTREF2_FRAME ref (see lshift_bwd_ref_frames()), or
733 // - updated from ALTREF2_FRAME ref (see rshift_bwd_ref_frames()).
734 EXTREF_FRAME = REF_FRAMES,
735
736 // Number of inter (non-intra) reference types.
737 INTER_REFS_PER_FRAME = ALTREF_FRAME - LAST_FRAME + 1,
738
739 // Number of forward (aka past) reference types.
740 FWD_REFS = GOLDEN_FRAME - LAST_FRAME + 1,
741
742 // Number of backward (aka future) reference types.
743 BWD_REFS = ALTREF_FRAME - BWDREF_FRAME + 1,
744
745 SINGLE_REFS = FWD_REFS + BWD_REFS,
746};
747
748#define REF_FRAMES_LOG2 3
749
750// REF_FRAMES for the cm->ref_frame_map array, 1 scratch frame for the new
751// frame in cm->cur_frame, INTER_REFS_PER_FRAME for scaled references on the
752// encoder in the cpi->scaled_ref_buf array.
753#define FRAME_BUFFERS (REF_FRAMES + 1 + INTER_REFS_PER_FRAME)
754
755#define FWD_RF_OFFSET(ref) (ref - LAST_FRAME)
756#define BWD_RF_OFFSET(ref) (ref - BWDREF_FRAME)
757
758TYPEDEF enum {
759 LAST_LAST2_FRAMES, // { LAST_FRAME, LAST2_FRAME }
760 LAST_LAST3_FRAMES, // { LAST_FRAME, LAST3_FRAME }
761 LAST_GOLDEN_FRAMES, // { LAST_FRAME, GOLDEN_FRAME }
762 BWDREF_ALTREF_FRAMES, // { BWDREF_FRAME, ALTREF_FRAME }
763 LAST2_LAST3_FRAMES, // { LAST2_FRAME, LAST3_FRAME }
764 LAST2_GOLDEN_FRAMES, // { LAST2_FRAME, GOLDEN_FRAME }
765 LAST3_GOLDEN_FRAMES, // { LAST3_FRAME, GOLDEN_FRAME }
766 BWDREF_ALTREF2_FRAMES, // { BWDREF_FRAME, ALTREF2_FRAME }
767 ALTREF2_ALTREF_FRAMES, // { ALTREF2_FRAME, ALTREF_FRAME }
768 TOTAL_UNIDIR_COMP_REFS,
769 // NOTE: UNIDIR_COMP_REFS is the number of uni-directional reference pairs
770 // that are explicitly signaled.
771 UNIDIR_COMP_REFS = BWDREF_ALTREF_FRAMES + 1,
772} UENUM1BYTE(UNIDIR_COMP_REF);
773
774#define TOTAL_COMP_REFS (FWD_REFS * BWD_REFS + TOTAL_UNIDIR_COMP_REFS)
775
776#define COMP_REFS (FWD_REFS * BWD_REFS + UNIDIR_COMP_REFS)
777
778// NOTE: A limited number of unidirectional reference pairs can be signalled for
779// compound prediction. The use of skip mode, on the other hand, makes it
780// possible to have a reference pair not listed for explicit signaling.
781#define MODE_CTX_REF_FRAMES (REF_FRAMES + TOTAL_COMP_REFS)
782
783// Note: It includes single and compound references. So, it can take values from
784// NONE_FRAME to (MODE_CTX_REF_FRAMES - 1). Hence, it is not defined as an enum.
785typedef int8_t MV_REFERENCE_FRAME;
786
787TYPEDEF enum {
788 RESTORE_NONE,
789 RESTORE_WIENER,
790 RESTORE_SGRPROJ,
791 RESTORE_SWITCHABLE,
792 RESTORE_SWITCHABLE_TYPES = RESTORE_SWITCHABLE,
793 RESTORE_TYPES = 4,
794} UENUM1BYTE(RestorationType);
795
796// Picture prediction structures (0-12 are predefined) in scalability metadata.
797TYPEDEF enum {
798 SCALABILITY_L1T2 = 0,
799 SCALABILITY_L1T3 = 1,
800 SCALABILITY_L2T1 = 2,
801 SCALABILITY_L2T2 = 3,
802 SCALABILITY_L2T3 = 4,
803 SCALABILITY_S2T1 = 5,
804 SCALABILITY_S2T2 = 6,
805 SCALABILITY_S2T3 = 7,
806 SCALABILITY_L2T1h = 8,
807 SCALABILITY_L2T2h = 9,
808 SCALABILITY_L2T3h = 10,
809 SCALABILITY_S2T1h = 11,
810 SCALABILITY_S2T2h = 12,
811 SCALABILITY_S2T3h = 13,
812 SCALABILITY_SS = 14
813} UENUM1BYTE(SCALABILITY_STRUCTURES);
814
815#define SUPERRES_SCALE_BITS 3
816#define SUPERRES_SCALE_DENOMINATOR_MIN (SCALE_NUMERATOR + 1)
817
818// In large_scale_tile coding, external references are used.
819#define MAX_EXTERNAL_REFERENCES 128
820#define MAX_TILES 512
821
822
823#define CONFIG_MULTITHREAD 0
824#define CONFIG_ENTROPY_STATS 0
825
826#define CONFIG_MAX_DECODE_PROFILE 2
827
828/*
829from:
830seg_common.h
831*/
832#ifdef ORI_CODE
833
834#define MAX_SEGMENTS 8
835#define SEG_TREE_PROBS (MAX_SEGMENTS - 1)
836
837#define SEG_TEMPORAL_PRED_CTXS 3
838#define SPATIAL_PREDICTION_PROBS 3
839
840enum {
841 SEG_LVL_ALT_Q, // Use alternate Quantizer ....
842 SEG_LVL_ALT_LF_Y_V, // Use alternate loop filter value on y plane vertical
843 SEG_LVL_ALT_LF_Y_H, // Use alternate loop filter value on y plane horizontal
844 SEG_LVL_ALT_LF_U, // Use alternate loop filter value on u plane
845 SEG_LVL_ALT_LF_V, // Use alternate loop filter value on v plane
846 SEG_LVL_REF_FRAME, // Optional Segment reference frame
847 SEG_LVL_SKIP, // Optional Segment (0,0) + skip mode
848 SEG_LVL_GLOBALMV,
849 SEG_LVL_MAX
850} UENUM1BYTE(SEG_LVL_FEATURES);
851
852struct segmentation {
853 uint8_t enabled;
854 uint8_t update_map;
855 uint8_t update_data;
856 uint8_t temporal_update;
857
858 int16_t feature_data[MAX_SEGMENTS][SEG_LVL_MAX];
859 unsigned int feature_mask[MAX_SEGMENTS];
860 int last_active_segid; // The highest numbered segment id that has some
861 // enabled feature.
862 uint8_t segid_preskip; // Whether the segment id will be read before the
863 // skip syntax element.
864 // 1: the segment id will be read first.
865 // 0: the skip syntax element will be read first.
866};
867
868/*
869from av1_loopfilter.h
870*/
871#define MAX_LOOP_FILTER 63
872
873
874/* from
875quant_common.h:
876*/
877#define MAXQ 255
878
879#endif
880
881/*
882from:
883aom/av1/common/common.h
884*/
885#define av1_zero(dest) memset(&(dest), 0, sizeof(dest))
886#define av1_zero_array(dest, n) memset(dest, 0, n * sizeof(*(dest)))
887/*
888from:
889aom/av1/common/alloccommon.h
890*/
891#define INVALID_IDX -1 // Invalid buffer index.
892
893/*
894from:
895aom/av1/common/timing.h
896*/
897typedef struct aom_timing {
898 uint32_t num_units_in_display_tick;
899 uint32_t time_scale;
900 int equal_picture_interval;
901 uint32_t num_ticks_per_picture;
902} aom_timing_info_t;
903
904typedef struct aom_dec_model_info {
905 uint32_t num_units_in_decoding_tick;
906 int encoder_decoder_buffer_delay_length;
907 int buffer_removal_time_length;
908 int frame_presentation_time_length;
909} aom_dec_model_info_t;
910
911typedef struct aom_dec_model_op_parameters {
912 int decoder_model_param_present_flag;
913 int64_t bitrate;
914 int64_t buffer_size;
915 uint32_t decoder_buffer_delay;
916 uint32_t encoder_buffer_delay;
917 int low_delay_mode_flag;
918 int display_model_param_present_flag;
919 int initial_display_delay;
920} aom_dec_model_op_parameters_t;
921
922typedef struct aom_op_timing_info_t {
923 uint32_t buffer_removal_time;
924} aom_op_timing_info_t;
925/*
926from:
927aom/aom_codec.h
928*/
929/*!\brief OBU types. */
930typedef enum {
931 OBU_SEQUENCE_HEADER = 1,
932 OBU_TEMPORAL_DELIMITER = 2,
933 OBU_FRAME_HEADER = 3,
934 OBU_TILE_GROUP = 4,
935 OBU_METADATA = 5,
936 OBU_FRAME = 6,
937 OBU_REDUNDANT_FRAME_HEADER = 7,
938 OBU_TILE_LIST = 8,
939 OBU_PADDING = 15,
940} OBU_TYPE;
941
942typedef enum aom_bit_depth {
943 AOM_BITS_8 = 8, /**< 8 bits */
944 AOM_BITS_10 = 10, /**< 10 bits */
945 AOM_BITS_12 = 12, /**< 12 bits */
946} aom_bit_depth_t;
947
948/*!\brief Algorithm return codes */
949typedef enum {
950 /*!\brief Operation completed without error */
951 AOM_CODEC_OK,
952
953 /*!\brief Unspecified error */
954 AOM_CODEC_ERROR,
955
956 /*!\brief Memory operation failed */
957 AOM_CODEC_MEM_ERROR,
958
959 /*!\brief ABI version mismatch */
960 AOM_CODEC_ABI_MISMATCH,
961
962 /*!\brief Algorithm does not have required capability */
963 AOM_CODEC_INCAPABLE,
964
965 /*!\brief The given bitstream is not supported.
966 *
967 * The bitstream was unable to be parsed at the highest level. The decoder
968 * is unable to proceed. This error \ref SHOULD be treated as fatal to the
969 * stream. */
970 AOM_CODEC_UNSUP_BITSTREAM,
971
972 /*!\brief Encoded bitstream uses an unsupported feature
973 *
974 * The decoder does not implement a feature required by the encoder. This
975 * return code should only be used for features that prevent future
976 * pictures from being properly decoded. This error \ref MAY be treated as
977 * fatal to the stream or \ref MAY be treated as fatal to the current GOP.
978 */
979 AOM_CODEC_UNSUP_FEATURE,
980
981 /*!\brief The coded data for this stream is corrupt or incomplete
982 *
983 * There was a problem decoding the current frame. This return code
984 * should only be used for failures that prevent future pictures from
985 * being properly decoded. This error \ref MAY be treated as fatal to the
986 * stream or \ref MAY be treated as fatal to the current GOP. If decoding
987 * is continued for the current GOP, artifacts may be present.
988 */
989 AOM_CODEC_CORRUPT_FRAME,
990
991 /*!\brief An application-supplied parameter is not valid.
992 *
993 */
994 AOM_CODEC_INVALID_PARAM,
995
996 /*!\brief An iterator reached the end of list.
997 *
998 */
999 AOM_CODEC_LIST_END
1000
1001} aom_codec_err_t;
1002
1003typedef struct cfg_options {
1004 /*!\brief Reflects if ext_partition should be enabled
1005 *
1006 * If this value is non-zero it enabled the feature
1007 */
1008 unsigned int ext_partition;
1009} cfg_options_t;
1010
1011/*
1012from:
1013aom/av1/common/obu_util.h
1014*/
1015typedef struct {
1016 size_t size; // Size (1 or 2 bytes) of the OBU header (including the
1017 // optional OBU extension header) in the bitstream.
1018 OBU_TYPE type;
1019 int has_size_field;
1020 int has_extension;
1021 // The following fields come from the OBU extension header and therefore are
1022 // only used if has_extension is true.
1023 int temporal_layer_id;
1024 int spatial_layer_id;
1025} ObuHeader;
1026
1027
1028/*
1029from:
1030aom/internal/aom_codec_internal.h
1031*/
1032
1033struct aom_internal_error_info {
1034 aom_codec_err_t error_code;
1035 int has_detail;
1036 char detail[80];
1037 int setjmp; // Boolean: whether 'jmp' is valid.
1038#ifdef ORI_CODE
1039 jmp_buf jmp;
1040#endif
1041};
1042
1043/*
1044from:
1045aom/aom_frame_buffer.h
1046*/
1047typedef struct aom_codec_frame_buffer {
1048 uint8_t *data; /**< Pointer to the data buffer */
1049 size_t size; /**< Size of data in bytes */
1050 void *priv; /**< Frame's private data */
1051} aom_codec_frame_buffer_t;
1052
1053/*
1054from:
1055aom/aom_image.h
1056*/
1057#define AOM_IMAGE_ABI_VERSION (5) /**<\hideinitializer*/
1058
1059#define AOM_IMG_FMT_PLANAR 0x100 /**< Image is a planar format. */
1060#define AOM_IMG_FMT_UV_FLIP 0x200 /**< V plane precedes U in memory. */
1061/** 0x400 used to signal alpha channel, skipping for backwards compatibility. */
1062#define AOM_IMG_FMT_HIGHBITDEPTH 0x800 /**< Image uses 16bit framebuffer. */
1063
1064/*!\brief List of supported image formats */
1065typedef enum aom_img_fmt {
1066 AOM_IMG_FMT_NONE,
1067 AOM_IMG_FMT_YV12 =
1068 AOM_IMG_FMT_PLANAR | AOM_IMG_FMT_UV_FLIP | 1, /**< planar YVU */
1069 AOM_IMG_FMT_I420 = AOM_IMG_FMT_PLANAR | 2,
1070 AOM_IMG_FMT_AOMYV12 = AOM_IMG_FMT_PLANAR | AOM_IMG_FMT_UV_FLIP |
1071 3, /** < planar 4:2:0 format with aom color space */
1072 AOM_IMG_FMT_AOMI420 = AOM_IMG_FMT_PLANAR | 4,
1073 AOM_IMG_FMT_I422 = AOM_IMG_FMT_PLANAR | 5,
1074 AOM_IMG_FMT_I444 = AOM_IMG_FMT_PLANAR | 6,
1075 AOM_IMG_FMT_I42016 = AOM_IMG_FMT_I420 | AOM_IMG_FMT_HIGHBITDEPTH,
1076 AOM_IMG_FMT_YV1216 = AOM_IMG_FMT_YV12 | AOM_IMG_FMT_HIGHBITDEPTH,
1077 AOM_IMG_FMT_I42216 = AOM_IMG_FMT_I422 | AOM_IMG_FMT_HIGHBITDEPTH,
1078 AOM_IMG_FMT_I44416 = AOM_IMG_FMT_I444 | AOM_IMG_FMT_HIGHBITDEPTH,
1079} aom_img_fmt_t; /**< alias for enum aom_img_fmt */
1080
1081/*!\brief List of supported color primaries */
1082typedef enum aom_color_primaries {
1083 AOM_CICP_CP_RESERVED_0 = 0, /**< For future use */
1084 AOM_CICP_CP_BT_709 = 1, /**< BT.709 */
1085 AOM_CICP_CP_UNSPECIFIED = 2, /**< Unspecified */
1086 AOM_CICP_CP_RESERVED_3 = 3, /**< For future use */
1087 AOM_CICP_CP_BT_470_M = 4, /**< BT.470 System M (historical) */
1088 AOM_CICP_CP_BT_470_B_G = 5, /**< BT.470 System B, G (historical) */
1089 AOM_CICP_CP_BT_601 = 6, /**< BT.601 */
1090 AOM_CICP_CP_SMPTE_240 = 7, /**< SMPTE 240 */
1091 AOM_CICP_CP_GENERIC_FILM =
1092 8, /**< Generic film (color filters using illuminant C) */
1093 AOM_CICP_CP_BT_2020 = 9, /**< BT.2020, BT.2100 */
1094 AOM_CICP_CP_XYZ = 10, /**< SMPTE 428 (CIE 1921 XYZ) */
1095 AOM_CICP_CP_SMPTE_431 = 11, /**< SMPTE RP 431-2 */
1096 AOM_CICP_CP_SMPTE_432 = 12, /**< SMPTE EG 432-1 */
1097 AOM_CICP_CP_RESERVED_13 = 13, /**< For future use (values 13 - 21) */
1098 AOM_CICP_CP_EBU_3213 = 22, /**< EBU Tech. 3213-E */
1099 AOM_CICP_CP_RESERVED_23 = 23 /**< For future use (values 23 - 255) */
1100} aom_color_primaries_t; /**< alias for enum aom_color_primaries */
1101
1102/*!\brief List of supported transfer functions */
1103typedef enum aom_transfer_characteristics {
1104 AOM_CICP_TC_RESERVED_0 = 0, /**< For future use */
1105 AOM_CICP_TC_BT_709 = 1, /**< BT.709 */
1106 AOM_CICP_TC_UNSPECIFIED = 2, /**< Unspecified */
1107 AOM_CICP_TC_RESERVED_3 = 3, /**< For future use */
1108 AOM_CICP_TC_BT_470_M = 4, /**< BT.470 System M (historical) */
1109 AOM_CICP_TC_BT_470_B_G = 5, /**< BT.470 System B, G (historical) */
1110 AOM_CICP_TC_BT_601 = 6, /**< BT.601 */
1111 AOM_CICP_TC_SMPTE_240 = 7, /**< SMPTE 240 M */
1112 AOM_CICP_TC_LINEAR = 8, /**< Linear */
1113 AOM_CICP_TC_LOG_100 = 9, /**< Logarithmic (100 : 1 range) */
1114 AOM_CICP_TC_LOG_100_SQRT10 =
1115 10, /**< Logarithmic (100 * Sqrt(10) : 1 range) */
1116 AOM_CICP_TC_IEC_61966 = 11, /**< IEC 61966-2-4 */
1117 AOM_CICP_TC_BT_1361 = 12, /**< BT.1361 */
1118 AOM_CICP_TC_SRGB = 13, /**< sRGB or sYCC*/
1119 AOM_CICP_TC_BT_2020_10_BIT = 14, /**< BT.2020 10-bit systems */
1120 AOM_CICP_TC_BT_2020_12_BIT = 15, /**< BT.2020 12-bit systems */
1121 AOM_CICP_TC_SMPTE_2084 = 16, /**< SMPTE ST 2084, ITU BT.2100 PQ */
1122 AOM_CICP_TC_SMPTE_428 = 17, /**< SMPTE ST 428 */
1123 AOM_CICP_TC_HLG = 18, /**< BT.2100 HLG, ARIB STD-B67 */
1124 AOM_CICP_TC_RESERVED_19 = 19 /**< For future use (values 19-255) */
1125} aom_transfer_characteristics_t; /**< alias for enum aom_transfer_function */
1126
1127/*!\brief List of supported matrix coefficients */
1128typedef enum aom_matrix_coefficients {
1129 AOM_CICP_MC_IDENTITY = 0, /**< Identity matrix */
1130 AOM_CICP_MC_BT_709 = 1, /**< BT.709 */
1131 AOM_CICP_MC_UNSPECIFIED = 2, /**< Unspecified */
1132 AOM_CICP_MC_RESERVED_3 = 3, /**< For future use */
1133 AOM_CICP_MC_FCC = 4, /**< US FCC 73.628 */
1134 AOM_CICP_MC_BT_470_B_G = 5, /**< BT.470 System B, G (historical) */
1135 AOM_CICP_MC_BT_601 = 6, /**< BT.601 */
1136 AOM_CICP_MC_SMPTE_240 = 7, /**< SMPTE 240 M */
1137 AOM_CICP_MC_SMPTE_YCGCO = 8, /**< YCgCo */
1138 AOM_CICP_MC_BT_2020_NCL =
1139 9, /**< BT.2020 non-constant luminance, BT.2100 YCbCr */
1140 AOM_CICP_MC_BT_2020_CL = 10, /**< BT.2020 constant luminance */
1141 AOM_CICP_MC_SMPTE_2085 = 11, /**< SMPTE ST 2085 YDzDx */
1142 AOM_CICP_MC_CHROMAT_NCL =
1143 12, /**< Chromaticity-derived non-constant luminance */
1144 AOM_CICP_MC_CHROMAT_CL = 13, /**< Chromaticity-derived constant luminance */
1145 AOM_CICP_MC_ICTCP = 14, /**< BT.2100 ICtCp */
1146 AOM_CICP_MC_RESERVED_15 = 15 /**< For future use (values 15-255) */
1147} aom_matrix_coefficients_t;
1148
1149/*!\brief List of supported color range */
1150typedef enum aom_color_range {
1151 AOM_CR_STUDIO_RANGE = 0, /**< Y [16..235], UV [16..240] */
1152 AOM_CR_FULL_RANGE = 1 /**< YUV/RGB [0..255] */
1153} aom_color_range_t; /**< alias for enum aom_color_range */
1154
1155/*!\brief List of chroma sample positions */
1156typedef enum aom_chroma_sample_position {
1157 AOM_CSP_UNKNOWN = 0, /**< Unknown */
1158 AOM_CSP_VERTICAL = 1, /**< Horizontally co-located with luma(0, 0)*/
1159 /**< sample, between two vertical samples */
1160 AOM_CSP_COLOCATED = 2, /**< Co-located with luma(0, 0) sample */
1161 AOM_CSP_RESERVED = 3 /**< Reserved value */
1162} aom_chroma_sample_position_t; /**< alias for enum aom_transfer_function */
1163
1164/*
1165from:
1166aom/aom_scale/yv12config.h
1167*/
1168typedef struct PIC_BUFFER_CONFIG_s {
1169 union {
1170 struct {
1171 int y_width;
1172 int uv_width;
1173 };
1174 int widths[2];
1175 };
1176 union {
1177 struct {
1178 int y_height;
1179 int uv_height;
1180 };
1181 int heights[2];
1182 };
1183 union {
1184 struct {
1185 int y_crop_width;
1186 int uv_crop_width;
1187 };
1188 int crop_widths[2];
1189 };
1190 union {
1191 struct {
1192 int y_crop_height;
1193 int uv_crop_height;
1194 };
1195 int crop_heights[2];
1196 };
1197 union {
1198 struct {
1199 int y_stride;
1200 int uv_stride;
1201 };
1202 int strides[2];
1203 };
1204 union {
1205 struct {
1206 uint8_t *y_buffer;
1207 uint8_t *u_buffer;
1208 uint8_t *v_buffer;
1209 };
1210 uint8_t *buffers[3];
1211 };
1212
1213 // Indicate whether y_buffer, u_buffer, and v_buffer points to the internally
1214 // allocated memory or external buffers.
1215 int use_external_reference_buffers;
1216 // This is needed to store y_buffer, u_buffer, and v_buffer when set reference
1217 // uses an external refernece, and restore those buffer pointers after the
1218 // external reference frame is no longer used.
1219 uint8_t *store_buf_adr[3];
1220
1221 // If the frame is stored in a 16-bit buffer, this stores an 8-bit version
1222 // for use in global motion detection. It is allocated on-demand.
1223 uint8_t *y_buffer_8bit;
1224 int buf_8bit_valid;
1225
1226 uint8_t *buffer_alloc;
1227 size_t buffer_alloc_sz;
1228 int border;
1229 size_t frame_size;
1230 int subsampling_x;
1231 int subsampling_y;
1232 unsigned int bit_depth;
1233 aom_color_primaries_t color_primaries;
1234 aom_transfer_characteristics_t transfer_characteristics;
1235 aom_matrix_coefficients_t matrix_coefficients;
1236 uint8_t monochrome;
1237 aom_chroma_sample_position_t chroma_sample_position;
1238 aom_color_range_t color_range;
1239 int render_width;
1240 int render_height;
1241
1242 int corrupted;
1243 int flags;
1244
1245#ifdef AML
1246 int32_t index;
1247 int32_t decode_idx;
1248 int32_t slice_type;
1249 int32_t RefNum_L0;
1250 int32_t RefNum_L1;
1251 int32_t num_reorder_pic;
1252 int32_t stream_offset;
1253 uint8_t referenced;
1254 uint8_t output_mark;
1255 uint8_t recon_mark;
1256 uint8_t output_ready;
1257 uint8_t error_mark;
1258 /**/
1259 int32_t slice_idx;
1260 /*buffer*/
1261 uint32_t fgs_table_adr;
1262#ifdef AOM_AV1_MMU
1263 uint32_t header_adr;
1264#endif
1265#ifdef AOM_AV1_MMU_DW
1266 uint32_t header_dw_adr;
1267#endif
1268 uint32_t mpred_mv_wr_start_addr;
1269 uint32_t mc_y_adr;
1270 uint32_t mc_u_v_adr;
1271 int32_t mc_canvas_y;
1272 int32_t mc_canvas_u_v;
1273
1274 int32_t lcu_total;
1275 /**/
1276 unsigned int order_hint;
1277#endif
1278#ifdef AML_DEVICE
1279 int mv_buf_index;
1280 unsigned long cma_alloc_addr;
1281 int BUF_index;
1282 int buf_size;
1283 int comp_body_size;
1284 unsigned int dw_y_adr;
1285 unsigned int dw_u_v_adr;
1286 int double_write_mode;
1287 int y_canvas_index;
1288 int uv_canvas_index;
1289 int vf_ref;
1290 struct canvas_config_s canvas_config[2];
1291 char *aux_data_buf;
1292 int aux_data_size;
1293 u32 pts;
1294 u64 pts64;
1295 /* picture qos infomation*/
1296 int max_qp;
1297 int avg_qp;
1298 int min_qp;
1299 int max_skip;
1300 int avg_skip;
1301 int min_skip;
1302 int max_mv;
1303 int min_mv;
1304 int avg_mv;
1305#endif
1306} PIC_BUFFER_CONFIG;
1307
1308/*
1309from:
1310common/blockd.h
1311*/
1312TYPEDEF enum {
1313 KEY_FRAME = 0,
1314 INTER_FRAME = 1,
1315 INTRA_ONLY_FRAME = 2, // replaces intra-only
1316 S_FRAME = 3,
1317 FRAME_TYPES,
1318} UENUM1BYTE(FRAME_TYPE);
1319
1320/*from:
1321mv.h
1322*/
1323#ifdef ORI_CODE
1324typedef struct mv32 {
1325 int32_t row;
1326 int32_t col;
1327} MV32;
1328#endif
1329/*from:
1330 aom_filter.h
1331*/
1332#define SUBPEL_BITS 4
1333#define SUBPEL_MASK ((1 << SUBPEL_BITS) - 1)
1334#define SUBPEL_SHIFTS (1 << SUBPEL_BITS)
1335#define SUBPEL_TAPS 8
1336
1337#define SCALE_SUBPEL_BITS 10
1338#define SCALE_SUBPEL_SHIFTS (1 << SCALE_SUBPEL_BITS)
1339#define SCALE_SUBPEL_MASK (SCALE_SUBPEL_SHIFTS - 1)
1340#define SCALE_EXTRA_BITS (SCALE_SUBPEL_BITS - SUBPEL_BITS)
1341#define SCALE_EXTRA_OFF ((1 << SCALE_EXTRA_BITS) / 2)
1342
1343#define RS_SUBPEL_BITS 6
1344#define RS_SUBPEL_MASK ((1 << RS_SUBPEL_BITS) - 1)
1345#define RS_SCALE_SUBPEL_BITS 14
1346#define RS_SCALE_SUBPEL_MASK ((1 << RS_SCALE_SUBPEL_BITS) - 1)
1347#define RS_SCALE_EXTRA_BITS (RS_SCALE_SUBPEL_BITS - RS_SUBPEL_BITS)
1348#define RS_SCALE_EXTRA_OFF (1 << (RS_SCALE_EXTRA_BITS - 1))
1349
1350/*from:
1351scale.h
1352*/
1353#define SCALE_NUMERATOR 8
1354
1355#define REF_SCALE_SHIFT 14
1356#define REF_NO_SCALE (1 << REF_SCALE_SHIFT)
1357#define REF_INVALID_SCALE -1
1358
1359struct scale_factors {
1360 int x_scale_fp; // horizontal fixed point scale factor
1361 int y_scale_fp; // vertical fixed point scale factor
1362 int x_step_q4;
1363 int y_step_q4;
1364
1365 int (*scale_value_x)(int val, const struct scale_factors *sf);
1366 int (*scale_value_y)(int val, const struct scale_factors *sf);
1367#ifdef ORI_CODE
1368 // convolve_fn_ptr[subpel_x != 0][subpel_y != 0][is_compound]
1369 aom_convolve_fn_t convolve[2][2][2];
1370 aom_highbd_convolve_fn_t highbd_convolve[2][2][2];
1371#endif
1372};
1373
1374#ifdef ORI_CODE
1375MV32 av1_scale_mv(const MV *mv, int x, int y, const struct scale_factors *sf);
1376#endif
1377void av1_setup_scale_factors_for_frame(struct scale_factors *sf, int other_w,
1378 int other_h, int this_w, int this_h);
1379
1380static inline int av1_is_valid_scale(const struct scale_factors *sf) {
1381#ifdef ORI_CODE
1382 assert(sf != NULL);
1383#endif
1384 return sf->x_scale_fp != REF_INVALID_SCALE &&
1385 sf->y_scale_fp != REF_INVALID_SCALE;
1386}
1387
1388static inline int av1_is_scaled(const struct scale_factors *sf) {
1389#ifdef ORI_CODE
1390 assert(sf != NULL);
1391#endif
1392 return av1_is_valid_scale(sf) &&
1393 (sf->x_scale_fp != REF_NO_SCALE || sf->y_scale_fp != REF_NO_SCALE);
1394}
1395
1396
1397/*
1398from:
1399common/onyxc_int.h
1400*/
1401
1402#define CDEF_MAX_STRENGTHS 16
1403
1404/* Constant values while waiting for the sequence header */
1405#define FRAME_ID_LENGTH 15
1406#define DELTA_FRAME_ID_LENGTH 14
1407
1408#define FRAME_CONTEXTS (FRAME_BUFFERS + 1)
1409// Extra frame context which is always kept at default values
1410#define FRAME_CONTEXT_DEFAULTS (FRAME_CONTEXTS - 1)
1411#define PRIMARY_REF_BITS 3
1412#define PRIMARY_REF_NONE 7
1413
1414#define NUM_PING_PONG_BUFFERS 2
1415
1416#define MAX_NUM_TEMPORAL_LAYERS 8
1417#define MAX_NUM_SPATIAL_LAYERS 4
1418/* clang-format off */
1419// clang-format seems to think this is a pointer dereference and not a
1420// multiplication.
1421#define MAX_NUM_OPERATING_POINTS \
1422 MAX_NUM_TEMPORAL_LAYERS * MAX_NUM_SPATIAL_LAYERS
1423/* clang-format on*/
1424
1425// TODO(jingning): Turning this on to set up transform coefficient
1426// processing timer.
1427#define TXCOEFF_TIMER 0
1428#define TXCOEFF_COST_TIMER 0
1429
1430TYPEDEF enum {
1431 SINGLE_REFERENCE = 0,
1432 COMPOUND_REFERENCE = 1,
1433 REFERENCE_MODE_SELECT = 2,
1434 REFERENCE_MODES = 3,
1435} UENUM1BYTE(REFERENCE_MODE);
1436
1437TYPEDEF enum {
1438 /**
1439 * Frame context updates are disabled
1440 */
1441 REFRESH_FRAME_CONTEXT_DISABLED,
1442 /**
1443 * Update frame context to values resulting from backward probability
1444 * updates based on entropy/counts in the decoded frame
1445 */
1446 REFRESH_FRAME_CONTEXT_BACKWARD,
1447} UENUM1BYTE(REFRESH_FRAME_CONTEXT_MODE);
1448
1449#define MFMV_STACK_SIZE 3
1450
1451#ifdef AML
1452#define MV_REF_SIZE 8
1453#endif
1454
1455#ifdef ORI_CODE
1456typedef struct {
1457 int_mv mfmv0;
1458 uint8_t ref_frame_offset;
1459} TPL_MV_REF;
1460typedef struct {
1461 int_mv mv;
1462 MV_REFERENCE_FRAME ref_frame;
1463} MV_REF;
1464#endif
1465
1466typedef struct RefCntBuffer_s {
1467 // For a RefCntBuffer, the following are reference-holding variables:
1468 // - cm->ref_frame_map[]
1469 // - cm->cur_frame
1470 // - cm->scaled_ref_buf[] (encoder only)
1471 // - cm->next_ref_frame_map[] (decoder only)
1472 // - pbi->output_frame_index[] (decoder only)
1473 // With that definition, 'ref_count' is the number of reference-holding
1474 // variables that are currently referencing this buffer.
1475 // For example:
1476 // - suppose this buffer is at index 'k' in the buffer pool, and
1477 // - Total 'n' of the variables / array elements above have value 'k' (that
1478 // is, they are pointing to buffer at index 'k').
1479 // Then, pool->frame_bufs[k].ref_count = n.
1480 int ref_count;
1481
1482 unsigned int order_hint;
1483 unsigned int ref_order_hints[INTER_REFS_PER_FRAME];
1484
1485 int intra_only;
1486 int segmentation_enabled;
1487 unsigned int segment_feature[8];
1488#ifdef AML
1489 int segmentation_update_map;
1490 int prev_segmentation_enabled;
1491 int seg_mi_rows;
1492 int seg_mi_cols;
1493
1494 unsigned int seg_lf_info_y[8];
1495 unsigned int seg_lf_info_c[8];
1496 int8_t ref_deltas[REF_FRAMES];
1497 int8_t mode_deltas[MAX_MODE_LF_DELTAS];
1498#endif
1499 //MV_REF *mvs;
1500 uint8_t *seg_map;
1501#ifdef ORI_CODE
1502 struct segmentation seg;
1503#endif
1504
1505 int mi_rows;
1506 int mi_cols;
1507 // Width and height give the size of the buffer (before any upscaling, unlike
1508 // the sizes that can be derived from the buf structure)
1509 int width;
1510 int height;
1511#ifdef ORI_CODE
1512 WarpedMotionParams global_motion[REF_FRAMES];
1513#endif
1514 int showable_frame; // frame can be used as show existing frame in future
1515 uint8_t film_grain_params_present;
1516#ifdef ORI_CODE
1517 aom_film_grain_t film_grain_params;
1518#endif
1519#ifdef AML
1520 int dec_width;
1521 uint8_t film_grain_reg_valid;
1522 uint32_t film_grain_reg[FILM_GRAIN_REG_SIZE];
1523#endif
1524 aom_codec_frame_buffer_t raw_frame_buffer;
1525 PIC_BUFFER_CONFIG buf;
1526#ifdef ORI_CODE
1527 hash_table hash_table;
1528#endif
1529 FRAME_TYPE frame_type;
1530
1531 // This is only used in the encoder but needs to be indexed per ref frame
1532 // so it's extremely convenient to keep it here.
1533#ifdef ORI_CODE
1534 int interp_filter_selected[SWITCHABLE];
1535#endif
1536 // Inter frame reference frame delta for loop filter
1537#ifndef AML
1538 int8_t ref_deltas[REF_FRAMES];
1539#endif
1540#ifdef ORI_CODE
1541 // 0 = ZERO_MV, MV
1542 int8_t mode_deltas[MAX_MODE_LF_DELTAS];
1543
1544 FRAME_CONTEXT frame_context;
1545#endif
1546} RefCntBuffer;
1547
1548typedef struct BufferPool_s {
1549// Protect BufferPool from being accessed by several FrameWorkers at
1550// the same time during frame parallel decode.
1551// TODO(hkuang): Try to use atomic variable instead of locking the whole pool.
1552// TODO(wtc): Remove this. See
1553// https://chromium-review.googlesource.com/c/webm/libvpx/+/560630.
1554#if CONFIG_MULTITHREAD
1555 pthread_mutex_t pool_mutex;
1556#endif
1557
1558 // Private data associated with the frame buffer callbacks.
1559 void *cb_priv;
1560#ifdef ORI_CODE
1561 aom_get_frame_buffer_cb_fn_t get_fb_cb;
1562 aom_release_frame_buffer_cb_fn_t release_fb_cb;
1563#endif
1564 RefCntBuffer frame_bufs[FRAME_BUFFERS];
1565
1566#ifdef ORI_CODE
1567 // Frame buffers allocated internally by the codec.
1568 InternalFrameBufferList int_frame_buffers;
1569#endif
1570#ifdef AML_DEVICE
1571 spinlock_t lock;
1572#endif
1573} BufferPool;
1574
1575typedef struct {
1576 int cdef_pri_damping;
1577 int cdef_sec_damping;
1578 int nb_cdef_strengths;
1579 int cdef_strengths[CDEF_MAX_STRENGTHS];
1580 int cdef_uv_strengths[CDEF_MAX_STRENGTHS];
1581 int cdef_bits;
1582} CdefInfo;
1583
1584typedef struct {
1585 int delta_q_present_flag;
1586 // Resolution of delta quant
1587 int delta_q_res;
1588 int delta_lf_present_flag;
1589 // Resolution of delta lf level
1590 int delta_lf_res;
1591 // This is a flag for number of deltas of loop filter level
1592 // 0: use 1 delta, for y_vertical, y_horizontal, u, and v
1593 // 1: use separate deltas for each filter level
1594 int delta_lf_multi;
1595} DeltaQInfo;
1596
1597typedef struct {
1598 int enable_order_hint; // 0 - disable order hint, and related tools
1599 int order_hint_bits_minus_1; // dist_wtd_comp, ref_frame_mvs,
1600 // frame_sign_bias
1601 // if 0, enable_dist_wtd_comp and
1602 // enable_ref_frame_mvs must be set as 0.
1603 int enable_dist_wtd_comp; // 0 - disable dist-wtd compound modes
1604 // 1 - enable it
1605 int enable_ref_frame_mvs; // 0 - disable ref frame mvs
1606 // 1 - enable it
1607} OrderHintInfo;
1608
1609// Sequence header structure.
1610// Note: All syntax elements of sequence_header_obu that need to be
1611// bit-identical across multiple sequence headers must be part of this struct,
1612// so that consistency is checked by are_seq_headers_consistent() function.
1613typedef struct SequenceHeader {
1614 int num_bits_width;
1615 int num_bits_height;
1616 int max_frame_width;
1617 int max_frame_height;
1618 uint8_t frame_id_numbers_present_flag;
1619 int frame_id_length;
1620 int delta_frame_id_length;
1621 BLOCK_SIZE2 sb_size; // Size of the superblock used for this frame
1622 int mib_size; // Size of the superblock in units of MI blocks
1623 int mib_size_log2; // Log 2 of above.
1624
1625 OrderHintInfo order_hint_info;
1626
1627 uint8_t force_screen_content_tools; // 0 - force off
1628 // 1 - force on
1629 // 2 - adaptive
1630 uint8_t still_picture; // Video is a single frame still picture
1631 uint8_t reduced_still_picture_hdr; // Use reduced header for still picture
1632 uint8_t force_integer_mv; // 0 - Don't force. MV can use subpel
1633 // 1 - force to integer
1634 // 2 - adaptive
1635 uint8_t enable_filter_intra; // enables/disables filterintra
1636 uint8_t enable_intra_edge_filter; // enables/disables edge upsampling
1637 uint8_t enable_interintra_compound; // enables/disables interintra_compound
1638 uint8_t enable_masked_compound; // enables/disables masked compound
1639 uint8_t enable_dual_filter; // 0 - disable dual interpolation filter
1640 // 1 - enable vert/horz filter selection
1641 uint8_t enable_warped_motion; // 0 - disable warp for the sequence
1642 // 1 - enable warp for the sequence
1643 uint8_t enable_superres; // 0 - Disable superres for the sequence
1644 // and no frame level superres flag
1645 // 1 - Enable superres for the sequence
1646 // enable per-frame superres flag
1647 uint8_t enable_cdef; // To turn on/off CDEF
1648 uint8_t enable_restoration; // To turn on/off loop restoration
1649 BITSTREAM_PROFILE profile;
1650
1651 // Operating point info.
1652 int operating_points_cnt_minus_1;
1653 int operating_point_idc[MAX_NUM_OPERATING_POINTS];
1654 uint8_t display_model_info_present_flag;
1655 uint8_t decoder_model_info_present_flag;
1656 AV1_LEVEL seq_level_idx[MAX_NUM_OPERATING_POINTS];
1657 uint8_t tier[MAX_NUM_OPERATING_POINTS]; // seq_tier in the spec. One bit: 0
1658 // or 1.
1659
1660 // Color config.
1661 aom_bit_depth_t bit_depth; // AOM_BITS_8 in profile 0 or 1,
1662 // AOM_BITS_10 or AOM_BITS_12 in profile 2 or 3.
1663 uint8_t use_highbitdepth; // If true, we need to use 16bit frame buffers.
1664 uint8_t monochrome; // Monochorme video
1665 aom_color_primaries_t color_primaries;
1666 aom_transfer_characteristics_t transfer_characteristics;
1667 aom_matrix_coefficients_t matrix_coefficients;
1668 int color_range;
1669 int subsampling_x; // Chroma subsampling for x
1670 int subsampling_y; // Chroma subsampling for y
1671 aom_chroma_sample_position_t chroma_sample_position;
1672 uint8_t separate_uv_delta_q;
1673 uint8_t film_gry_dequant_QTXain_params_present;
1674} SequenceHeader;
1675
1676typedef struct {
1677 int skip_mode_allowed;
1678 int skip_mode_flag;
1679 int ref_frame_idx_0;
1680 int ref_frame_idx_1;
1681} SkipModeInfo;
1682
1683typedef struct {
1684 FRAME_TYPE frame_type;
1685 REFERENCE_MODE reference_mode;
1686
1687 unsigned int order_hint;
1688 unsigned int frame_number;
1689 SkipModeInfo skip_mode_info;
1690 int refresh_frame_flags; // Which ref frames are overwritten by this frame
1691 int frame_refs_short_signaling;
1692} CurrentFrame;
1693
1694typedef struct AV1_Common_s {
1695 CurrentFrame current_frame;
1696 struct aom_internal_error_info error;
1697 int width;
1698 int height;
1699 int render_width;
1700 int render_height;
1701 int timing_info_present;
1702 aom_timing_info_t timing_info;
1703 int buffer_removal_time_present;
1704 aom_dec_model_info_t buffer_model;
1705 aom_dec_model_op_parameters_t op_params[MAX_NUM_OPERATING_POINTS + 1];
1706 aom_op_timing_info_t op_frame_timing[MAX_NUM_OPERATING_POINTS + 1];
1707 uint32_t frame_presentation_time;
1708
1709 int context_update_tile_id;
1710#ifdef SUPPORT_SCALE_FACTOR
1711 // Scale of the current frame with respect to itself.
1712 struct scale_factors sf_identity;
1713#endif
1714 RefCntBuffer *prev_frame;
1715
1716 // TODO(hkuang): Combine this with cur_buf in macroblockd.
1717 RefCntBuffer *cur_frame;
1718
1719 // For encoder, we have a two-level mapping from reference frame type to the
1720 // corresponding buffer in the buffer pool:
1721 // * 'remapped_ref_idx[i - 1]' maps reference type 'i' (range: LAST_FRAME ...
1722 // EXTREF_FRAME) to a remapped index 'j' (in range: 0 ... REF_FRAMES - 1)
1723 // * Later, 'cm->ref_frame_map[j]' maps the remapped index 'j' to a pointer to
1724 // the reference counted buffer structure RefCntBuffer, taken from the buffer
1725 // pool cm->buffer_pool->frame_bufs.
1726 //
1727 // LAST_FRAME, ..., EXTREF_FRAME
1728 // | |
1729 // v v
1730 // remapped_ref_idx[LAST_FRAME - 1], ..., remapped_ref_idx[EXTREF_FRAME - 1]
1731 // | |
1732 // v v
1733 // ref_frame_map[], ..., ref_frame_map[]
1734 //
1735 // Note: INTRA_FRAME always refers to the current frame, so there's no need to
1736 // have a remapped index for the same.
1737 int remapped_ref_idx[REF_FRAMES];
1738
1739#ifdef SUPPORT_SCALE_FACTOR
1740 struct scale_factors ref_scale_factors[REF_FRAMES];
1741#endif
1742 // For decoder, ref_frame_map[i] maps reference type 'i' to a pointer to
1743 // the buffer in the buffer pool 'cm->buffer_pool.frame_bufs'.
1744 // For encoder, ref_frame_map[j] (where j = remapped_ref_idx[i]) maps
1745 // remapped reference index 'j' (that is, original reference type 'i') to
1746 // a pointer to the buffer in the buffer pool 'cm->buffer_pool.frame_bufs'.
1747 RefCntBuffer *ref_frame_map[REF_FRAMES];
1748
1749 // Prepare ref_frame_map for the next frame.
1750 // Only used in frame parallel decode.
1751 RefCntBuffer *next_ref_frame_map[REF_FRAMES];
1752#ifdef AML
1753 RefCntBuffer *next_used_ref_frame_map[REF_FRAMES];
1754#endif
1755 FRAME_TYPE last_frame_type; /* last frame's frame type for motion search.*/
1756
1757 int show_frame;
1758 int showable_frame; // frame can be used as show existing frame in future
1759 int show_existing_frame;
1760
1761 uint8_t disable_cdf_update;
1762 int allow_high_precision_mv;
1763 uint8_t cur_frame_force_integer_mv; // 0 the default in AOM, 1 only integer
1764
1765 uint8_t allow_screen_content_tools;
1766 int allow_intrabc;
1767 int allow_warped_motion;
1768
1769 // MBs, mb_rows/cols is in 16-pixel units; mi_rows/cols is in
1770 // MB_MODE_INFO (8-pixel) units.
1771 int MBs;
1772 int mb_rows, mi_rows;
1773 int mb_cols, mi_cols;
1774 int mi_stride;
1775
1776 /* profile settings */
1777 TX_MODE tx_mode;
1778
1779#if CONFIG_ENTROPY_STATS
1780 int coef_cdf_category;
1781#endif
1782
1783 int base_qindex;
1784 int y_dc_delta_q;
1785 int u_dc_delta_q;
1786 int v_dc_delta_q;
1787 int u_ac_delta_q;
1788 int v_ac_delta_q;
1789
1790#ifdef ORI_CODE
1791 // The dequantizers below are true dequantizers used only in the
1792 // dequantization process. They have the same coefficient
1793 // shift/scale as TX.
1794 int16_t y_dequant_QTX[MAX_SEGMENTS][2];
1795 int16_t u_dequant_QTX[MAX_SEGMENTS][2];
1796 int16_t v_dequant_QTX[MAX_SEGMENTS][2];
1797
1798 // Global quant matrix tables
1799 const qm_val_t *giqmatrix[NUM_QM_LEVELS][3][TX_SIZES_ALL];
1800 const qm_val_t *gqmatrix[NUM_QM_LEVELS][3][TX_SIZES_ALL];
1801
1802 // Local quant matrix tables for each frame
1803 const qm_val_t *y_iqmatrix[MAX_SEGMENTS][TX_SIZES_ALL];
1804 const qm_val_t *u_iqmatrix[MAX_SEGMENTS][TX_SIZES_ALL];
1805 const qm_val_t *v_iqmatrix[MAX_SEGMENTS][TX_SIZES_ALL];
1806#endif
1807 // Encoder
1808 int using_qmatrix;
1809 int qm_y;
1810 int qm_u;
1811 int qm_v;
1812 int min_qmlevel;
1813 int max_qmlevel;
1814 int use_quant_b_adapt;
1815
1816 /* We allocate a MB_MODE_INFO struct for each macroblock, together with
1817 an extra row on top and column on the left to simplify prediction. */
1818 int mi_alloc_size;
1819
1820#ifdef ORI_CODE
1821 MB_MODE_INFO *mip; /* Base of allocated array */
1822 MB_MODE_INFO *mi; /* Corresponds to upper left visible macroblock */
1823
1824 // TODO(agrange): Move prev_mi into encoder structure.
1825 // prev_mip and prev_mi will only be allocated in encoder.
1826 MB_MODE_INFO *prev_mip; /* MB_MODE_INFO array 'mip' from last decoded frame */
1827 MB_MODE_INFO *prev_mi; /* 'mi' from last frame (points into prev_mip) */
1828
1829 // Separate mi functions between encoder and decoder.
1830 int (*alloc_mi)(struct AV1Common *cm, int mi_size);
1831 void (*free_mi)(struct AV1Common *cm);
1832 void (*setup_mi)(struct AV1Common *cm);
1833
1834 // Grid of pointers to 8x8 MB_MODE_INFO structs. Any 8x8 not in the visible
1835 // area will be NULL.
1836 MB_MODE_INFO **mi_grid_base;
1837 MB_MODE_INFO **mi_grid_visible;
1838 MB_MODE_INFO **prev_mi_grid_base;
1839 MB_MODE_INFO **prev_mi_grid_visible;
1840#endif
1841 // Whether to use previous frames' motion vectors for prediction.
1842 int allow_ref_frame_mvs;
1843
1844 uint8_t *last_frame_seg_map;
1845
1846#ifdef ORI_CODE
1847 InterpFilter interp_filter;
1848#endif
1849 int switchable_motion_mode;
1850#ifdef ORI_CODE
1851 loop_filter_info_n lf_info;
1852#endif
1853 // The denominator of the superres scale; the numerator is fixed.
1854 uint8_t superres_scale_denominator;
1855 int superres_upscaled_width;
1856 int superres_upscaled_height;
1857
1858#ifdef ORI_CODE
1859 RestorationInfo rst_info[MAX_MB_PLANE];
1860#endif
1861 // Pointer to a scratch buffer used by self-guided restoration
1862 int32_t *rst_tmpbuf;
1863#ifdef ORI_CODE
1864 RestorationLineBuffers *rlbs;
1865#endif
1866 // Output of loop restoration
1867 PIC_BUFFER_CONFIG rst_frame;
1868
1869 // Flag signaling how frame contexts should be updated at the end of
1870 // a frame decode
1871 REFRESH_FRAME_CONTEXT_MODE refresh_frame_context;
1872
1873 int ref_frame_sign_bias[REF_FRAMES]; /* Two state 0, 1 */
1874
1875#ifdef ORI_CODE
1876 struct loopfilter lf;
1877 struct segmentation seg;
1878#endif
1879
1880 int coded_lossless; // frame is fully lossless at the coded resolution.
1881 int all_lossless; // frame is fully lossless at the upscaled resolution.
1882
1883 int reduced_tx_set_used;
1884
1885#ifdef ORI_CODE
1886 // Context probabilities for reference frame prediction
1887 MV_REFERENCE_FRAME comp_fwd_ref[FWD_REFS];
1888 MV_REFERENCE_FRAME comp_bwd_ref[BWD_REFS];
1889
1890 FRAME_CONTEXT *fc; /* this frame entropy */
1891 FRAME_CONTEXT *default_frame_context;
1892#endif
1893 int primary_ref_frame;
1894
1895 int error_resilient_mode;
1896
1897 int tile_cols, tile_rows;
1898
1899 int max_tile_width_sb;
1900 int min_log2_tile_cols;
1901 int max_log2_tile_cols;
1902 int max_log2_tile_rows;
1903 int min_log2_tile_rows;
1904 int min_log2_tiles;
1905 int max_tile_height_sb;
1906 int uniform_tile_spacing_flag;
1907 int log2_tile_cols; // only valid for uniform tiles
1908 int log2_tile_rows; // only valid for uniform tiles
1909 int tile_col_start_sb[MAX_TILE_COLS + 1]; // valid for 0 <= i <= tile_cols
1910 int tile_row_start_sb[MAX_TILE_ROWS + 1]; // valid for 0 <= i <= tile_rows
1911 int tile_width, tile_height; // In MI units
1912 int min_inner_tile_width; // min width of non-rightmost tile
1913
1914 unsigned int large_scale_tile;
1915 unsigned int single_tile_decoding;
1916
1917 int byte_alignment;
1918 int skip_loop_filter;
1919 int skip_film_grain;
1920
1921 // External BufferPool passed from outside.
1922 BufferPool *buffer_pool;
1923
1924#ifdef ORI_CODE
1925 PARTITION_CONTEXT **above_seg_context;
1926 ENTROPY_CONTEXT **above_context[MAX_MB_PLANE];
1927 TXFM_CONTEXT **above_txfm_context;
1928 WarpedMotionParams global_motion[REF_FRAMES];
1929 aom_film_grain_t film_grain_params;
1930
1931 CdefInfo cdef_info;
1932 DeltaQInfo delta_q_info; // Delta Q and Delta LF parameters
1933#endif
1934 int num_tg;
1935 SequenceHeader seq_params;
1936 int current_frame_id;
1937 int ref_frame_id[REF_FRAMES];
1938 int valid_for_referencing[REF_FRAMES];
1939#ifdef ORI_CODE
1940 TPL_MV_REF *tpl_mvs;
1941#endif
1942 int tpl_mvs_mem_size;
1943 // TODO(jingning): This can be combined with sign_bias later.
1944 int8_t ref_frame_side[REF_FRAMES];
1945
1946 int is_annexb;
1947
1948 int temporal_layer_id;
1949 int spatial_layer_id;
1950 unsigned int number_temporal_layers;
1951 unsigned int number_spatial_layers;
1952 int num_allocated_above_context_mi_col;
1953 int num_allocated_above_contexts;
1954 int num_allocated_above_context_planes;
1955
1956#if TXCOEFF_TIMER
1957 int64_t cum_txcoeff_timer;
1958 int64_t txcoeff_timer;
1959 int txb_count;
1960#endif
1961
1962#if TXCOEFF_COST_TIMER
1963 int64_t cum_txcoeff_cost_timer;
1964 int64_t txcoeff_cost_timer;
1965 int64_t txcoeff_cost_count;
1966#endif
1967 const cfg_options_t *options;
1968 int is_decoding;
1969#ifdef AML
1970 int mv_ref_offset[MV_REF_SIZE][REF_FRAMES];
1971 int mv_ref_id[MV_REF_SIZE];
1972 unsigned char mv_cal_tpl_mvs[MV_REF_SIZE];
1973 int mv_ref_id_index;
1974 int prev_fb_idx;
1975 int new_fb_idx;
1976 int32_t dec_width;
1977#endif
1978#ifdef AML_DEVICE
1979 int cur_fb_idx_mmu;
1980#ifdef AOM_AV1_MMU_DW
1981 int cur_fb_idx_mmu_dw;
1982#endif
1983 int current_video_frame;
1984 int use_prev_frame_mvs;
1985 int frame_type;
1986 int intra_only;
1987 struct RefCntBuffer_s frame_refs[INTER_REFS_PER_FRAME];
1988
1989#endif
1990} AV1_COMMON;
1991
1992
1993/*
1994from:
1995 decoder/decoder.h
1996*/
1997
1998typedef struct EXTERNAL_REFERENCES {
1999 PIC_BUFFER_CONFIG refs[MAX_EXTERNAL_REFERENCES];
2000 int num;
2001} EXTERNAL_REFERENCES;
2002
2003typedef struct AV1Decoder {
2004 //DECLARE_ALIGNED(32, MACROBLOCKD, mb);
2005
2006 //DECLARE_ALIGNED(32, AV1_COMMON, common);
2007 AV1_COMMON common;
2008
2009#ifdef ORI_CODE
2010 AVxWorker lf_worker;
2011 AV1LfSync lf_row_sync;
2012 AV1LrSync lr_row_sync;
2013 AV1LrStruct lr_ctxt;
2014 AVxWorker *tile_workers;
2015 int num_workers;
2016 DecWorkerData *thread_data;
2017 ThreadData td;
2018 TileDataDec *tile_data;
2019 int allocated_tiles;
2020 TileBufferDec tile_buffers[MAX_TILE_ROWS][MAX_TILE_COLS];
2021 AV1DecTileMT tile_mt_info;
2022#endif
2023
2024 // Each time the decoder is called, we expect to receive a full temporal unit.
2025 // This can contain up to one shown frame per spatial layer in the current
2026 // operating point (note that some layers may be entirely omitted).
2027 // If the 'output_all_layers' option is true, we save all of these shown
2028 // frames so that they can be returned to the application. If the
2029 // 'output_all_layers' option is false, then we only output one image per
2030 // temporal unit.
2031 //
2032 // Note: The saved buffers are released at the start of the next time the
2033 // application calls aom_codec_decode().
2034 int output_all_layers;
2035 RefCntBuffer *output_frames[MAX_NUM_SPATIAL_LAYERS];
2036 size_t num_output_frames; // How many frames are queued up so far?
2037
2038 // In order to properly support random-access decoding, we need
2039 // to behave slightly differently for the very first frame we decode.
2040 // So we track whether this is the first frame or not.
2041 int decoding_first_frame;
2042
2043 int allow_lowbitdepth;
2044 int max_threads;
2045 int inv_tile_order;
2046 int need_resync; // wait for key/intra-only frame.
2047 int hold_ref_buf; // Boolean: whether we are holding reference buffers in
2048 // common.next_ref_frame_map.
2049 int reset_decoder_state;
2050
2051 int tile_size_bytes;
2052 int tile_col_size_bytes;
2053 int dec_tile_row, dec_tile_col; // always -1 for non-VR tile encoding
2054#if CONFIG_ACCOUNTING
2055 int acct_enabled;
2056 Accounting accounting;
2057#endif
2058 int tg_size; // Number of tiles in the current tilegroup
2059 int tg_start; // First tile in the current tilegroup
2060 int tg_size_bit_offset;
2061 int sequence_header_ready;
2062 int sequence_header_changed;
2063#if CONFIG_INSPECTION
2064 aom_inspect_cb inspect_cb;
2065 void *inspect_ctx;
2066#endif
2067 int operating_point;
2068 int current_operating_point;
2069 int seen_frame_header;
2070
2071 // State if the camera frame header is already decoded while
2072 // large_scale_tile = 1.
2073 int camera_frame_header_ready;
2074 size_t frame_header_size;
2075#ifdef ORI_CODE
2076 DataBuffer obu_size_hdr;
2077#endif
2078 int output_frame_width_in_tiles_minus_1;
2079 int output_frame_height_in_tiles_minus_1;
2080 int tile_count_minus_1;
2081 uint32_t coded_tile_data_size;
2082 unsigned int ext_tile_debug; // for ext-tile software debug & testing
2083 unsigned int row_mt;
2084 EXTERNAL_REFERENCES ext_refs;
2085 PIC_BUFFER_CONFIG tile_list_outbuf;
2086
2087#ifdef ORI_CODE
2088 CB_BUFFER *cb_buffer_base;
2089#endif
2090 int cb_buffer_alloc_size;
2091
2092 int allocated_row_mt_sync_rows;
2093
2094#if CONFIG_MULTITHREAD
2095 pthread_mutex_t *row_mt_mutex_;
2096 pthread_cond_t *row_mt_cond_;
2097#endif
2098
2099#ifdef ORI_CODE
2100 AV1DecRowMTInfo frame_row_mt_info;
2101#endif
2102
2103#ifdef AML
2104 unsigned char pred_inter_read_enable;
2105 int cur_obu_type;
2106 int decode_idx;
2107 int bufmgr_proc_count;
2108 int obu_frame_frame_head_come_after_tile;
2109 uint32_t frame_width;
2110 uint32_t frame_height;
2111 BuffInfo_t* work_space_buf;
2112 buff_t* mc_buf;
2113 //unsigned short *rpm_ptr;
2114 void *private_data;
2115 u32 pre_stream_offset;
2116#endif
2117} AV1Decoder;
2118
2119#define RPM_BEGIN 0x200
2120#define RPM_END 0x280
2121
2122typedef union param_u {
2123 struct {
2124 unsigned short data[RPM_END - RPM_BEGIN];
2125 } l;
2126 struct {
2127 /*sequence head*/
2128 unsigned short profile;
2129 unsigned short still_picture;
2130 unsigned short reduced_still_picture_hdr;
2131 unsigned short decoder_model_info_present_flag;
2132 unsigned short max_frame_width;
2133 unsigned short max_frame_height;
2134 unsigned short frame_id_numbers_present_flag;
2135 unsigned short delta_frame_id_length;
2136 unsigned short frame_id_length;
2137 unsigned short order_hint_bits_minus_1;
2138 unsigned short enable_order_hint;
2139 unsigned short enable_dist_wtd_comp;
2140 unsigned short enable_ref_frame_mvs;
2141
2142 /*frame head*/
2143 unsigned short show_existing_frame;
2144 unsigned short frame_type;
2145 unsigned short show_frame;
2146 unsigned short error_resilient_mode;
2147 unsigned short refresh_frame_flags;
2148 unsigned short showable_frame;
2149 unsigned short current_frame_id;
2150 unsigned short frame_size_override_flag;
2151 unsigned short order_hint;
2152 unsigned short primary_ref_frame;
2153 unsigned short frame_refs_short_signaling;
2154 unsigned short frame_width;
2155 unsigned short dec_frame_width;
2156 unsigned short frame_width_scaled;
2157 unsigned short frame_height;
2158 unsigned short reference_mode;
2159 unsigned short allow_ref_frame_mvs;
2160 unsigned short superres_scale_denominator;
2161 unsigned short lst_ref;
2162 unsigned short gld_ref;
2163 unsigned short existing_frame_idx;
2164
2165 unsigned short remapped_ref_idx[INTER_REFS_PER_FRAME];
2166 unsigned short delta_frame_id_minus_1[INTER_REFS_PER_FRAME];
2167 unsigned short ref_order_hint[REF_FRAMES];
2168 /*other not in reference*/
2169 unsigned short bit_depth;
2170 unsigned short seq_flags;
2171 unsigned short update_parameters;
2172 unsigned short film_grain_params_ref_idx;
2173
2174 /*loop_filter & segmentation*/
2175 unsigned short loop_filter_sharpness_level;
2176 unsigned short loop_filter_mode_ref_delta_enabled;
2177 unsigned short loop_filter_ref_deltas_0;
2178 unsigned short loop_filter_ref_deltas_1;
2179 unsigned short loop_filter_ref_deltas_2;
2180 unsigned short loop_filter_ref_deltas_3;
2181 unsigned short loop_filter_ref_deltas_4;
2182 unsigned short loop_filter_ref_deltas_5;
2183 unsigned short loop_filter_ref_deltas_6;
2184 unsigned short loop_filter_ref_deltas_7;
2185 unsigned short loop_filter_mode_deltas_0;
2186 unsigned short loop_filter_mode_deltas_1;
2187 unsigned short loop_filter_level_0;
2188 unsigned short loop_filter_level_1;
2189 unsigned short loop_filter_level_u;
2190 unsigned short loop_filter_level_v;
2191
2192 unsigned short segmentation_enabled;
2193 /*
2194 SEG_LVL_ALT_LF_Y_V feature_enable: seg_lf_info_y[bit7]
2195 SEG_LVL_ALT_LF_Y_V data: seg_lf_info_y[bit0~6]
2196 SEG_LVL_ALT_LF_Y_H feature enable: seg_lf_info_y[bit15]
2197 SEG_LVL_ALT_LF_Y_H data: seg_lf_info_y[bit8~14]
2198 */
2199 unsigned short seg_lf_info_y[8];
2200 /*
2201 SEG_LVL_ALT_LF_U feature_enable: seg_lf_info_y[bit7]
2202 SEG_LVL_ALT_LF_U data: seg_lf_info_y[bit0~6]
2203 SEG_LVL_ALT_LF_V feature enable: seg_lf_info_y[bit15]
2204 SEG_LVL_ALT_LF_V data: seg_lf_info_y[bit8~14]
2205 */
2206 unsigned short seg_lf_info_c[8];
2207 unsigned short video_signal_type;
2208 unsigned short color_description;
2209
2210 /*ucode end*/
2211 /*other*/
2212 unsigned short enable_superres;
2213
2214 /*seqence not use*/
2215 unsigned short operating_points_cnt_minus_1;
2216 unsigned short operating_point_idc[MAX_NUM_OPERATING_POINTS];
2217 unsigned short seq_level_idx[MAX_NUM_OPERATING_POINTS];
2218 unsigned short decoder_model_param_present_flag[MAX_NUM_OPERATING_POINTS];
2219 unsigned short timing_info_present;
2220 /*frame head not use*/
2221 unsigned short display_frame_id;
2222 unsigned short frame_presentation_time;
2223 unsigned short buffer_removal_time_present;
2224 unsigned short op_frame_timing[MAX_NUM_OPERATING_POINTS + 1];
2225 unsigned short valid_ref_frame_bits;
2226
2227 } p;
2228}param_t;
2229
2230PIC_BUFFER_CONFIG *av1_get_ref_frame_spec_buf(
2231 const AV1_COMMON *const cm, const MV_REFERENCE_FRAME ref_frame);
2232
2233int av1_bufmgr_process(AV1Decoder *pbi, union param_u *params,
2234 unsigned char new_compressed_data, int obu_type);
2235
2236struct scale_factors *av1_get_ref_scale_factors(
2237 AV1_COMMON *const cm, const MV_REFERENCE_FRAME ref_frame);
2238
2239void av1_set_next_ref_frame_map(AV1Decoder *pbi);
2240
2241unsigned int av1_get_next_used_ref_info(
2242 const AV1_COMMON *const cm, int i);
2243
2244void av1_release_buf(AV1Decoder *pbi, RefCntBuffer *const buf);
2245
2246int av1_bufmgr_postproc(AV1Decoder *pbi, unsigned char frame_decoded);
2247
2248AV1Decoder *av1_decoder_create(BufferPool *const pool);
2249
2250unsigned char av1_frame_is_inter(const AV1_COMMON *const cm);
2251
2252RefCntBuffer *av1_get_primary_ref_frame_buf(
2253 const AV1_COMMON *const cm);
2254
2255void av1_raw_write_image(AV1Decoder *pbi, PIC_BUFFER_CONFIG *sd);
2256
2257#if 1
2258#define lock_buffer_pool(pool, flags) \
2259 spin_lock_irqsave(&pool->lock, flags)
2260
2261#define unlock_buffer_pool(pool, flags) \
2262 spin_unlock_irqrestore(&pool->lock, flags)
2263#else
2264#define lock_buffer_pool(pool, flags) flags=1;
2265
2266#define unlock_buffer_pool(pool, flags) flags=0;
2267
2268#endif
2269
2270#define AV1_DEBUG_BUFMGR 0x01
2271#define AV1_DEBUG_BUFMGR_MORE 0x02
2272#define AV1_DEBUG_BUFMGR_DETAIL 0x04
2273#define AV1_DEBUG_OUT_PTS 0x10
2274#define AOM_DEBUG_HW_MORE 0x20
2275#define AOM_DEBUG_VFRAME 0x40
2276#define AOM_DEBUG_PRINT_LIST_INFO 0x80
2277#define AOM_AV1_DEBUG_SEND_PARAM_WITH_REG 0x100
2278#define AV1_DEBUG_IGNORE_VF_REF 0x200
2279#define AV1_DEBUG_DBG_LF_PRINT 0x400
2280#define AV1_DEBUG_REG 0x800
2281#define AOM_DEBUG_BUFMGR_ONLY 0x1000
2282#define AOM_DEBUG_AUX_DATA 0x2000
2283#define AV1_DEBUG_QOS_INFO 0x4000
2284#define AOM_DEBUG_DW_DISP_MAIN 0x8000
2285#define AV1_DEBUG_DIS_LOC_ERROR_PROC 0x10000
2286#define AV1_DEBUG_DIS_SYS_ERROR_PROC 0x20000
2287#define AV1_DEBUG_DUMP_PIC_LIST 0x40000
2288#define AV1_DEBUG_TRIG_SLICE_SEGMENT_PROC 0x80000
2289#define AV1_DEBUG_NO_TRIGGER_FRAME 0x100000
2290#define AV1_DEBUG_LOAD_UCODE_FROM_FILE 0x200000
2291#define AV1_DEBUG_FORCE_SEND_AGAIN 0x400000
2292#define AV1_DEBUG_DUMP_DATA 0x800000
2293#define AV1_DEBUG_CACHE 0x1000000
2294#define AV1_DEBUG_CACHE_HIT_RATE 0x2000000
2295#define IGNORE_PARAM_FROM_CONFIG 0x8000000
2296#if 1
2297/*def MULTI_INSTANCE_SUPPORT*/
2298#define PRINT_FLAG_ERROR 0x0
2299#define PRINT_FLAG_V4L_DETAIL 0x10000000
2300#define PRINT_FLAG_VDEC_STATUS 0x20000000
2301#define PRINT_FLAG_VDEC_DETAIL 0x40000000
2302#define PRINT_FLAG_VDEC_DATA 0x80000000
2303#endif
2304
2305int av1_print2(int flag, const char *fmt, ...);
2306
2307unsigned char av1_is_debug(int flag);
2308
2309#endif
2310
2311