12#ifndef AOM_AV1_COMMON_ENUMS_H_
13#define AOM_AV1_COMMON_ENUMS_H_
15#include "config/aom_config.h"
18#include "aom/aom_integer.h"
19#include "aom_dsp/txfm_common.h"
20#include "aom_ports/mem.h"
31#define MAX_SB_SIZE_LOG2 7
32#define MAX_SB_SIZE (1 << MAX_SB_SIZE_LOG2)
33#define MAX_SB_SQUARE (MAX_SB_SIZE * MAX_SB_SIZE)
36#define MIN_SB_SIZE_LOG2 6
40#define MI_SIZE (1 << MI_SIZE_LOG2)
43#define MAX_MIB_SIZE_LOG2 (MAX_SB_SIZE_LOG2 - MI_SIZE_LOG2)
44#define MAX_MIB_SIZE (1 << MAX_MIB_SIZE_LOG2)
47#define MIN_MIB_SIZE_LOG2 (MIN_SB_SIZE_LOG2 - MI_SIZE_LOG2)
50#define MAX_MIB_MASK (MAX_MIB_SIZE - 1)
53#define MAX_TILE_ROWS 64
54#define MAX_TILE_COLS 64
56#define MAX_VARTX_DEPTH 2
58#define MI_SIZE_64X64 (64 >> MI_SIZE_LOG2)
59#define MI_SIZE_128X128 (128 >> MI_SIZE_LOG2)
61#define MAX_PALETTE_SQUARE (64 * 64)
63#define PALETTE_MAX_SIZE 8
65#define PALETTE_MIN_SIZE 2
67#define FRAME_OFFSET_BITS 5
68#define MAX_FRAME_DISTANCE ((1 << FRAME_OFFSET_BITS) - 1)
72#define FRAME_LF_COUNT 4
73#define DEFAULT_DELTA_LF_MULTI 0
74#define MAX_MODE_LF_DELTAS 2
76#define DIST_PRECISION_BITS 4
77#define DIST_PRECISION (1 << DIST_PRECISION_BITS)
91} SENUM1BYTE(BITSTREAM_PROFILE);
93#define OP_POINTS_CNT_MINUS_1_BITS 5
94#define OP_POINTS_IDC_BITS 12
123 BLOCK_SIZES = BLOCK_4X16,
125 BLOCK_LARGEST = (BLOCK_SIZES - 1)
129#define SQR_BLOCK_SIZES 6
164 PARTITION_TYPES = PARTITION_SPLIT + 1,
165 PARTITION_INVALID = 255
166} UENUM1BYTE(PARTITION_TYPE);
168typedef char PARTITION_CONTEXT;
169#define PARTITION_PLOFFSET 4
170#define PARTITION_BLOCK_SIZES 5
171#define PARTITION_CONTEXTS (PARTITION_BLOCK_SIZES * PARTITION_PLOFFSET)
173#define TX_SIZE_LUMA_MIN (TX_4X4)
176#define TX_SIZE_CTX_MIN (TX_SIZE_LUMA_MIN + 1)
179#define MAX_TX_CATS (TX_SIZES - TX_SIZE_CTX_MIN)
180#define MAX_TX_DEPTH 2
182#define MAX_TX_SIZE_LOG2 (6)
183#define MAX_TX_SIZE (1 << MAX_TX_SIZE_LOG2)
184#define MIN_TX_SIZE_LOG2 2
185#define MIN_TX_SIZE (1 << MIN_TX_SIZE_LOG2)
186#define MAX_TX_SQUARE (MAX_TX_SIZE * MAX_TX_SIZE)
189#define TX_PAD_HOR_LOG2 2
194#define TX_PAD_BOTTOM 4
195#define TX_PAD_VER (TX_PAD_TOP + TX_PAD_BOTTOM)
198#define TX_PAD_2D ((32 + TX_PAD_HOR) * (32 + TX_PAD_VER) + TX_PAD_END)
201#define MAX_TX_BLOCKS_IN_MAX_SB_LOG2 ((MAX_SB_SIZE_LOG2 - MAX_TX_SIZE_LOG2) * 2)
202#define MAX_TX_BLOCKS_IN_MAX_SB (1 << MAX_TX_BLOCKS_IN_MAX_SB_LOG2)
210} UENUM1BYTE(TX_MODE);
219} UENUM1BYTE(TX_TYPE_1D);
231} UENUM1BYTE(DUAL_FILTER_TYPE);
233#define EXT_TX_SIZES 4
234#define EXT_TX_SETS_INTER 4
235#define EXT_TX_SETS_INTRA 3
238 AOM_LAST_FLAG = 1 << 0,
239 AOM_LAST2_FLAG = 1 << 1,
240 AOM_LAST3_FLAG = 1 << 2,
241 AOM_GOLD_FLAG = 1 << 3,
242 AOM_BWD_FLAG = 1 << 4,
243 AOM_ALT2_FLAG = 1 << 5,
244 AOM_ALT_FLAG = 1 << 6,
245 AOM_REFFRAME_ALL = (1 << 7) - 1
246} UENUM1BYTE(AOM_REFFRAME);
249 UNIDIR_COMP_REFERENCE,
250 BIDIR_COMP_REFERENCE,
251 COMP_REFERENCE_TYPES,
252} UENUM1BYTE(COMP_REFERENCE_TYPE);
254enum { PLANE_TYPE_Y, PLANE_TYPE_UV, PLANE_TYPES } UENUM1BYTE(PLANE_TYPE);
256#define CFL_ALPHABET_SIZE_LOG2 4
257#define CFL_ALPHABET_SIZE (1 << CFL_ALPHABET_SIZE_LOG2)
258#define CFL_MAGS_SIZE ((2 << CFL_ALPHABET_SIZE_LOG2) + 1)
259#define CFL_INDEX_ZERO CFL_ALPHABET_SIZE
260#define CFL_IDX_U(idx) (idx >> CFL_ALPHABET_SIZE_LOG2)
261#define CFL_IDX_V(idx) (idx & (CFL_ALPHABET_SIZE - 1))
263enum { CFL_PRED_U, CFL_PRED_V, CFL_PRED_PLANES } UENUM1BYTE(CFL_PRED_TYPE);
270} UENUM1BYTE(CFL_SIGN_TYPE);
276} UENUM1BYTE(CFL_ALLOWED_TYPE);
279#define CFL_JOINT_SIGNS (CFL_SIGNS * CFL_SIGNS - 1)
281#define CFL_SIGN_U(js) (((js + 1) * 11) >> 5)
283#define CFL_SIGN_V(js) ((js + 1) - CFL_SIGNS * CFL_SIGN_U(js))
287#define CFL_ALPHA_CONTEXTS (CFL_JOINT_SIGNS + 1 - CFL_SIGNS)
288#define CFL_CONTEXT_U(js) (js + 1 - CFL_SIGNS)
290#define CFL_CONTEXT_V(js) \
291 (CFL_SIGN_V(js) * CFL_SIGNS + CFL_SIGN_U(js) - CFL_SIGNS)
296} UENUM1BYTE(COLOR_MAP_TYPE);
307} UENUM1BYTE(PALETTE_SIZE);
319} UENUM1BYTE(PALETTE_COLOR);
351 PRED_MODE_INVALID = MB_MODE_COUNT,
352 INTRA_MODE_START = DC_PRED,
353 INTRA_MODE_END = NEARESTMV,
354 DIR_MODE_START = V_PRED,
355 DIR_MODE_END = D67_PRED + 1,
356 INTRA_MODE_NUM = INTRA_MODE_END - INTRA_MODE_START,
357 SINGLE_INTER_MODE_START = NEARESTMV,
358 SINGLE_INTER_MODE_END = NEAREST_NEARESTMV,
359 SINGLE_INTER_MODE_NUM = SINGLE_INTER_MODE_END - SINGLE_INTER_MODE_START,
360 COMP_INTER_MODE_START = NEAREST_NEARESTMV,
361 COMP_INTER_MODE_END = MB_MODE_COUNT,
362 COMP_INTER_MODE_NUM = COMP_INTER_MODE_END - COMP_INTER_MODE_START,
363 INTER_MODE_START = NEARESTMV,
364 INTER_MODE_END = MB_MODE_COUNT,
365 INTRA_MODES = PAETH_PRED + 1,
366 INTRA_INVALID = MB_MODE_COUNT
367} UENUM1BYTE(PREDICTION_MODE);
388} UENUM1BYTE(UV_PREDICTION_MODE);
391#define TOP_INTRA_MODEL_COUNT 4
395#define LUMA_MODE_COUNT (PAETH_PRED - DC_PRED + 1 + 6 * 8)
402} UENUM1BYTE(MOTION_MODE);
410} UENUM1BYTE(INTERINTRA_MODE);
418 MASKED_COMPOUND_TYPES = 2,
419} UENUM1BYTE(COMPOUND_TYPE);
428} UENUM1BYTE(FILTER_INTRA_MODE);
461 SEQ_LEVEL_KEEP_STATS = 32,
462} UENUM1BYTE(AV1_LEVEL);
466#define DIRECTIONAL_MODES 8
467#define MAX_ANGLE_DELTA 3
470#define INTER_MODES (1 + NEWMV - NEARESTMV)
472#define INTER_COMPOUND_MODES (1 + NEW_NEWMV - NEAREST_NEARESTMV)
474#define SKIP_CONTEXTS 3
475#define SKIP_MODE_CONTEXTS 3
477#define COMP_INDEX_CONTEXTS 6
478#define COMP_GROUP_IDX_CONTEXTS 6
480#define NMV_CONTEXTS 3
482#define NEWMV_MODE_CONTEXTS 6
483#define GLOBALMV_MODE_CONTEXTS 2
484#define REFMV_MODE_CONTEXTS 6
485#define DRL_MODE_CONTEXTS 3
487#define GLOBALMV_OFFSET 3
488#define REFMV_OFFSET 4
490#define NEWMV_CTX_MASK ((1 << GLOBALMV_OFFSET) - 1)
491#define GLOBALMV_CTX_MASK ((1 << (REFMV_OFFSET - GLOBALMV_OFFSET)) - 1)
492#define REFMV_CTX_MASK ((1 << (8 - REFMV_OFFSET)) - 1)
494#define COMP_NEWMV_CTXS 5
495#define INTER_MODE_CONTEXTS 8
497#define DELTA_Q_SMALL 3
498#define DELTA_Q_PROBS (DELTA_Q_SMALL)
499#define DEFAULT_DELTA_Q_RES_PERCEPTUAL 4
500#define DEFAULT_DELTA_Q_RES_OBJECTIVE 4
501#define DEFAULT_DELTA_Q_RES_DUCKY_ENCODE 4
503#define DELTA_LF_SMALL 3
504#define DELTA_LF_PROBS (DELTA_LF_SMALL)
505#define DEFAULT_DELTA_LF_RES 2
508#define MAX_MV_REF_CANDIDATES 2
510#define MAX_REF_MV_STACK_SIZE 8
511#define USABLE_REF_MV_STACK_SIZE 4
512#define REF_CAT_LEVEL 640
514#define INTRA_INTER_CONTEXTS 4
515#define COMP_INTER_CONTEXTS 5
516#define REF_CONTEXTS 3
518#define COMP_REF_TYPE_CONTEXTS 5
519#define UNI_COMP_REF_CONTEXTS 3
521#define TXFM_PARTITION_CONTEXTS ((TX_SIZES - TX_8X8) * 6 - 3)
522typedef uint8_t TXFM_CONTEXT;
540 EXTREF_FRAME = REF_FRAMES,
543 INTER_REFS_PER_FRAME = ALTREF_FRAME - LAST_FRAME + 1,
546 FWD_REFS = GOLDEN_FRAME - LAST_FRAME + 1,
549 BWD_REFS = ALTREF_FRAME - BWDREF_FRAME + 1,
551 SINGLE_REFS = FWD_REFS + BWD_REFS,
554#define REF_FRAMES_LOG2 3
561#define FRAME_BUFFERS (REF_FRAMES + 1 + INTER_REFS_PER_FRAME)
567#define FRAME_BUFFERS_ALLINTRA 2
569#define FWD_RF_OFFSET(ref) (ref - LAST_FRAME)
570#define BWD_RF_OFFSET(ref) (ref - BWDREF_FRAME)
573#define SELECT_ALL_BUF_SLOTS 0xFF
579 BWDREF_ALTREF_FRAMES,
583 BWDREF_ALTREF2_FRAMES,
584 ALTREF2_ALTREF_FRAMES,
585 TOTAL_UNIDIR_COMP_REFS,
588 UNIDIR_COMP_REFS = BWDREF_ALTREF_FRAMES + 1,
589} UENUM1BYTE(UNIDIR_COMP_REF);
591#define TOTAL_COMP_REFS (FWD_REFS * BWD_REFS + TOTAL_UNIDIR_COMP_REFS)
593#define COMP_REFS (FWD_REFS * BWD_REFS + UNIDIR_COMP_REFS)
598#define MODE_CTX_REF_FRAMES (REF_FRAMES + TOTAL_COMP_REFS)
602typedef int8_t MV_REFERENCE_FRAME;
621 SCALABILITY_L1T2 = 0,
622 SCALABILITY_L1T3 = 1,
623 SCALABILITY_L2T1 = 2,
624 SCALABILITY_L2T2 = 3,
625 SCALABILITY_L2T3 = 4,
626 SCALABILITY_S2T1 = 5,
627 SCALABILITY_S2T2 = 6,
628 SCALABILITY_S2T3 = 7,
629 SCALABILITY_L2T1h = 8,
630 SCALABILITY_L2T2h = 9,
631 SCALABILITY_L2T3h = 10,
632 SCALABILITY_S2T1h = 11,
633 SCALABILITY_S2T2h = 12,
634 SCALABILITY_S2T3h = 13,
636} UENUM1BYTE(SCALABILITY_STRUCTURES);
638#define SUPERRES_SCALE_BITS 3
639#define SUPERRES_SCALE_DENOMINATOR_MIN (SCALE_NUMERATOR + 1)
642#define MAX_EXTERNAL_REFERENCES 128
Describes the codec algorithm interface to applications.
RestorationType
This enumeration defines various restoration types supported.
Definition enums.h:609
@ RESTORE_NONE
Definition enums.h:610
@ RESTORE_SWITCHABLE_TYPES
Definition enums.h:614
@ RESTORE_SWITCHABLE
Definition enums.h:613
@ RESTORE_TYPES
Definition enums.h:615
@ RESTORE_SGRPROJ
Definition enums.h:612
@ RESTORE_WIENER
Definition enums.h:611
#define ATTRIBUTE_PACKED
Decorator indicating that given struct/union/enum is packed.
Definition aom_codec.h:140