AOMedia AV1 Codec
enums.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
3 *
4 * This source code is subject to the terms of the BSD 2 Clause License and
5 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6 * was not distributed with this source code in the LICENSE file, you can
7 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
8 * Media Patent License 1.0 was not distributed with this source code in the
9 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
10 */
11
12#ifndef AOM_AV1_COMMON_ENUMS_H_
13#define AOM_AV1_COMMON_ENUMS_H_
14
15#include "config/aom_config.h"
16
17#include "aom/aom_codec.h"
18#include "aom/aom_integer.h"
19#include "aom_dsp/txfm_common.h"
20#include "aom_ports/mem.h"
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
30// Max superblock size
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)
34
35// Min superblock size
36#define MIN_SB_SIZE_LOG2 6
37
38// Pixels per Mode Info (MI) unit
39#define MI_SIZE_LOG2 2
40#define MI_SIZE (1 << MI_SIZE_LOG2)
41
42// MI-units per max superblock (MI Block - MIB)
43#define MAX_MIB_SIZE_LOG2 (MAX_SB_SIZE_LOG2 - MI_SIZE_LOG2)
44#define MAX_MIB_SIZE (1 << MAX_MIB_SIZE_LOG2)
45
46// MI-units per min superblock
47#define MIN_MIB_SIZE_LOG2 (MIN_SB_SIZE_LOG2 - MI_SIZE_LOG2)
48
49// Mask to extract MI offset within max MIB
50#define MAX_MIB_MASK (MAX_MIB_SIZE - 1)
51
52// Maximum number of tile rows and tile columns
53#define MAX_TILE_ROWS 64
54#define MAX_TILE_COLS 64
55
56#define MAX_VARTX_DEPTH 2
57
58#define MI_SIZE_64X64 (64 >> MI_SIZE_LOG2)
59#define MI_SIZE_128X128 (128 >> MI_SIZE_LOG2)
60
61#define MAX_PALETTE_SQUARE (64 * 64)
62// Maximum number of colors in a palette.
63#define PALETTE_MAX_SIZE 8
64// Minimum number of colors in a palette.
65#define PALETTE_MIN_SIZE 2
66
67#define FRAME_OFFSET_BITS 5
68#define MAX_FRAME_DISTANCE ((1 << FRAME_OFFSET_BITS) - 1)
69
70// 4 frame filter levels: y plane vertical, y plane horizontal,
71// u plane, and v plane
72#define FRAME_LF_COUNT 4
73#define DEFAULT_DELTA_LF_MULTI 0
74#define MAX_MODE_LF_DELTAS 2
75
76#define DIST_PRECISION_BITS 4
77#define DIST_PRECISION (1 << DIST_PRECISION_BITS) // 16
78
79#define PROFILE_BITS 3
80// The following three profiles are currently defined.
81// Profile 0. 8-bit and 10-bit 4:2:0 and 4:0:0 only.
82// Profile 1. 8-bit and 10-bit 4:4:4
83// Profile 2. 8-bit and 10-bit 4:2:2
84// 12-bit 4:0:0, 4:2:2 and 4:4:4
85// Since we have three bits for the profiles, it can be extended later.
86enum {
87 PROFILE_0,
88 PROFILE_1,
89 PROFILE_2,
90 MAX_PROFILES,
91} SENUM1BYTE(BITSTREAM_PROFILE);
92
93#define OP_POINTS_CNT_MINUS_1_BITS 5
94#define OP_POINTS_IDC_BITS 12
95
96// Note: Some enums use the attribute 'packed' to use smallest possible integer
97// type, so that we can save memory when they are used in structs/arrays.
98
99typedef enum ATTRIBUTE_PACKED {
100 BLOCK_4X4,
101 BLOCK_4X8,
102 BLOCK_8X4,
103 BLOCK_8X8,
104 BLOCK_8X16,
105 BLOCK_16X8,
106 BLOCK_16X16,
107 BLOCK_16X32,
108 BLOCK_32X16,
109 BLOCK_32X32,
110 BLOCK_32X64,
111 BLOCK_64X32,
112 BLOCK_64X64,
113 BLOCK_64X128,
114 BLOCK_128X64,
115 BLOCK_128X128,
116 BLOCK_4X16,
117 BLOCK_16X4,
118 BLOCK_8X32,
119 BLOCK_32X8,
120 BLOCK_16X64,
121 BLOCK_64X16,
122 BLOCK_SIZES_ALL,
123 BLOCK_SIZES = BLOCK_4X16,
124 BLOCK_INVALID = 255,
125 BLOCK_LARGEST = (BLOCK_SIZES - 1)
126} BLOCK_SIZE;
127
128// 4X4, 8X8, 16X16, 32X32, 64X64, 128X128
129#define SQR_BLOCK_SIZES 6
130
131// Partition types. R: Recursive
132//
133// NONE HORZ VERT SPLIT
134// +-------+ +-------+ +---+---+ +---+---+
135// | | | | | | | | R | R |
136// | | +-------+ | | | +---+---+
137// | | | | | | | | R | R |
138// +-------+ +-------+ +---+---+ +---+---+
139//
140// HORZ_A HORZ_B VERT_A VERT_B
141// +---+---+ +-------+ +---+---+ +---+---+
142// | | | | | | | | | | |
143// +---+---+ +---+---+ +---+ | | +---+
144// | | | | | | | | | | |
145// +-------+ +---+---+ +---+---+ +---+---+
146//
147// HORZ_4 VERT_4
148// +-----+ +-+-+-+
149// +-----+ | | | |
150// +-----+ | | | |
151// +-----+ +-+-+-+
152enum {
153 PARTITION_NONE,
154 PARTITION_HORZ,
155 PARTITION_VERT,
156 PARTITION_SPLIT,
157 PARTITION_HORZ_A, // HORZ split and the top partition is split again
158 PARTITION_HORZ_B, // HORZ split and the bottom partition is split again
159 PARTITION_VERT_A, // VERT split and the left partition is split again
160 PARTITION_VERT_B, // VERT split and the right partition is split again
161 PARTITION_HORZ_4, // 4:1 horizontal partition
162 PARTITION_VERT_4, // 4:1 vertical partition
163 EXT_PARTITION_TYPES,
164 PARTITION_TYPES = PARTITION_SPLIT + 1,
165 PARTITION_INVALID = 255
166} UENUM1BYTE(PARTITION_TYPE);
167
168typedef char PARTITION_CONTEXT;
169#define PARTITION_PLOFFSET 4 // number of probability models per block size
170#define PARTITION_BLOCK_SIZES 5
171#define PARTITION_CONTEXTS (PARTITION_BLOCK_SIZES * PARTITION_PLOFFSET)
172
173#define TX_SIZE_LUMA_MIN (TX_4X4)
174/* We don't need to code a transform size unless the allowed size is at least
175 one more than the minimum. */
176#define TX_SIZE_CTX_MIN (TX_SIZE_LUMA_MIN + 1)
177
178// Maximum tx_size categories
179#define MAX_TX_CATS (TX_SIZES - TX_SIZE_CTX_MIN)
180#define MAX_TX_DEPTH 2
181
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)
187
188// Pad 4 extra columns to remove horizontal availability check.
189#define TX_PAD_HOR_LOG2 2
190#define TX_PAD_HOR 4
191// Pad 6 extra rows (2 on top and 4 on bottom) to remove vertical availability
192// check.
193#define TX_PAD_TOP 0
194#define TX_PAD_BOTTOM 4
195#define TX_PAD_VER (TX_PAD_TOP + TX_PAD_BOTTOM)
196// Pad 16 extra bytes to avoid reading overflow in SIMD optimization.
197#define TX_PAD_END 16
198#define TX_PAD_2D ((32 + TX_PAD_HOR) * (32 + TX_PAD_VER) + TX_PAD_END)
199
200// Number of maximum size transform blocks in the maximum size superblock
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)
203
204// frame transform mode
205enum {
206 ONLY_4X4, // use only 4x4 transform
207 TX_MODE_LARGEST, // transform size is the largest possible for pu size
208 TX_MODE_SELECT, // transform specified for each block
209 TX_MODES,
210} UENUM1BYTE(TX_MODE);
211
212// 1D tx types
213enum {
214 DCT_1D,
215 ADST_1D,
216 FLIPADST_1D,
217 IDTX_1D,
218 TX_TYPES_1D,
219} UENUM1BYTE(TX_TYPE_1D);
220
221enum {
222 REG_REG,
223 REG_SMOOTH,
224 REG_SHARP,
225 SMOOTH_REG,
226 SMOOTH_SMOOTH,
227 SMOOTH_SHARP,
228 SHARP_REG,
229 SHARP_SMOOTH,
230 SHARP_SHARP,
231} UENUM1BYTE(DUAL_FILTER_TYPE);
232
233#define EXT_TX_SIZES 4 // number of sizes that use extended transforms
234#define EXT_TX_SETS_INTER 4 // Sets of transform selections for INTER
235#define EXT_TX_SETS_INTRA 3 // Sets of transform selections for INTRA
236
237enum {
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);
247
248enum {
249 UNIDIR_COMP_REFERENCE,
250 BIDIR_COMP_REFERENCE,
251 COMP_REFERENCE_TYPES,
252} UENUM1BYTE(COMP_REFERENCE_TYPE);
253
254enum { PLANE_TYPE_Y, PLANE_TYPE_UV, PLANE_TYPES } UENUM1BYTE(PLANE_TYPE);
255
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))
262
263enum { CFL_PRED_U, CFL_PRED_V, CFL_PRED_PLANES } UENUM1BYTE(CFL_PRED_TYPE);
264
265enum {
266 CFL_SIGN_ZERO,
267 CFL_SIGN_NEG,
268 CFL_SIGN_POS,
269 CFL_SIGNS
270} UENUM1BYTE(CFL_SIGN_TYPE);
271
272enum {
273 CFL_DISALLOWED,
274 CFL_ALLOWED,
275 CFL_ALLOWED_TYPES
276} UENUM1BYTE(CFL_ALLOWED_TYPE);
277
278// CFL_SIGN_ZERO,CFL_SIGN_ZERO is invalid
279#define CFL_JOINT_SIGNS (CFL_SIGNS * CFL_SIGNS - 1)
280// CFL_SIGN_U is equivalent to (js + 1) / 3 for js in 0 to 8
281#define CFL_SIGN_U(js) (((js + 1) * 11) >> 5)
282// CFL_SIGN_V is equivalent to (js + 1) % 3 for js in 0 to 8
283#define CFL_SIGN_V(js) ((js + 1) - CFL_SIGNS * CFL_SIGN_U(js))
284
285// There is no context when the alpha for a given plane is zero.
286// So there are 2 fewer contexts than joint signs.
287#define CFL_ALPHA_CONTEXTS (CFL_JOINT_SIGNS + 1 - CFL_SIGNS)
288#define CFL_CONTEXT_U(js) (js + 1 - CFL_SIGNS)
289// Also, the contexts are symmetric under swapping the planes.
290#define CFL_CONTEXT_V(js) \
291 (CFL_SIGN_V(js) * CFL_SIGNS + CFL_SIGN_U(js) - CFL_SIGNS)
292
293enum {
294 PALETTE_MAP,
295 COLOR_MAP_TYPES,
296} UENUM1BYTE(COLOR_MAP_TYPE);
297
298enum {
299 TWO_COLORS,
300 THREE_COLORS,
301 FOUR_COLORS,
302 FIVE_COLORS,
303 SIX_COLORS,
304 SEVEN_COLORS,
305 EIGHT_COLORS,
306 PALETTE_SIZES
307} UENUM1BYTE(PALETTE_SIZE);
308
309enum {
310 PALETTE_COLOR_ONE,
311 PALETTE_COLOR_TWO,
312 PALETTE_COLOR_THREE,
313 PALETTE_COLOR_FOUR,
314 PALETTE_COLOR_FIVE,
315 PALETTE_COLOR_SIX,
316 PALETTE_COLOR_SEVEN,
317 PALETTE_COLOR_EIGHT,
318 PALETTE_COLORS
319} UENUM1BYTE(PALETTE_COLOR);
320
321// Note: All directional predictors must be between V_PRED and D67_PRED (both
322// inclusive).
323enum {
324 DC_PRED, // Average of above and left pixels
325 V_PRED, // Vertical
326 H_PRED, // Horizontal
327 D45_PRED, // Directional 45 degree
328 D135_PRED, // Directional 135 degree
329 D113_PRED, // Directional 113 degree
330 D157_PRED, // Directional 157 degree
331 D203_PRED, // Directional 203 degree
332 D67_PRED, // Directional 67 degree
333 SMOOTH_PRED, // Combination of horizontal and vertical interpolation
334 SMOOTH_V_PRED, // Vertical interpolation
335 SMOOTH_H_PRED, // Horizontal interpolation
336 PAETH_PRED, // Predict from the direction of smallest gradient
337 NEARESTMV,
338 NEARMV,
339 GLOBALMV,
340 NEWMV,
341 // Compound ref compound modes
342 NEAREST_NEARESTMV,
343 NEAR_NEARMV,
344 NEAREST_NEWMV,
345 NEW_NEARESTMV,
346 NEAR_NEWMV,
347 NEW_NEARMV,
348 GLOBAL_GLOBALMV,
349 NEW_NEWMV,
350 MB_MODE_COUNT,
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, // PAETH_PRED has to be the last intra mode.
366 INTRA_INVALID = MB_MODE_COUNT // For uv_mode in inter blocks
367} UENUM1BYTE(PREDICTION_MODE);
368
369// TODO(ltrudeau) Do we really want to pack this?
370// TODO(ltrudeau) Do we match with PREDICTION_MODE?
371enum {
372 UV_DC_PRED, // Average of above and left pixels
373 UV_V_PRED, // Vertical
374 UV_H_PRED, // Horizontal
375 UV_D45_PRED, // Directional 45 degree
376 UV_D135_PRED, // Directional 135 degree
377 UV_D113_PRED, // Directional 113 degree
378 UV_D157_PRED, // Directional 157 degree
379 UV_D203_PRED, // Directional 203 degree
380 UV_D67_PRED, // Directional 67 degree
381 UV_SMOOTH_PRED, // Combination of horizontal and vertical interpolation
382 UV_SMOOTH_V_PRED, // Vertical interpolation
383 UV_SMOOTH_H_PRED, // Horizontal interpolation
384 UV_PAETH_PRED, // Predict from the direction of smallest gradient
385 UV_CFL_PRED, // Chroma-from-Luma
386 UV_INTRA_MODES,
387 UV_MODE_INVALID, // For uv_mode in inter blocks
388} UENUM1BYTE(UV_PREDICTION_MODE);
389
390// Number of top model rd to store for pruning y modes in intra mode decision
391#define TOP_INTRA_MODEL_COUNT 4
392// Total number of luma intra prediction modes (include both directional and
393// non-directional modes)
394// Because there are 8 directional modes, each has additional 6 delta angles.
395#define LUMA_MODE_COUNT (PAETH_PRED - DC_PRED + 1 + 6 * 8)
396
397enum {
398 SIMPLE_TRANSLATION,
399 OBMC_CAUSAL, // 2-sided OBMC
400 WARPED_CAUSAL, // 2-sided WARPED
401 MOTION_MODES
402} UENUM1BYTE(MOTION_MODE);
403
404enum {
405 II_DC_PRED,
406 II_V_PRED,
407 II_H_PRED,
408 II_SMOOTH_PRED,
409 INTERINTRA_MODES
410} UENUM1BYTE(INTERINTRA_MODE);
411
412enum {
413 COMPOUND_AVERAGE,
414 COMPOUND_DISTWTD,
415 COMPOUND_WEDGE,
416 COMPOUND_DIFFWTD,
417 COMPOUND_TYPES,
418 MASKED_COMPOUND_TYPES = 2,
419} UENUM1BYTE(COMPOUND_TYPE);
420
421enum {
422 FILTER_DC_PRED,
423 FILTER_V_PRED,
424 FILTER_H_PRED,
425 FILTER_D157_PRED,
426 FILTER_PAETH_PRED,
427 FILTER_INTRA_MODES,
428} UENUM1BYTE(FILTER_INTRA_MODE);
429
430enum {
431 SEQ_LEVEL_2_0,
432 SEQ_LEVEL_2_1,
433 SEQ_LEVEL_2_2,
434 SEQ_LEVEL_2_3,
435 SEQ_LEVEL_3_0,
436 SEQ_LEVEL_3_1,
437 SEQ_LEVEL_3_2,
438 SEQ_LEVEL_3_3,
439 SEQ_LEVEL_4_0,
440 SEQ_LEVEL_4_1,
441 SEQ_LEVEL_4_2,
442 SEQ_LEVEL_4_3,
443 SEQ_LEVEL_5_0,
444 SEQ_LEVEL_5_1,
445 SEQ_LEVEL_5_2,
446 SEQ_LEVEL_5_3,
447 SEQ_LEVEL_6_0,
448 SEQ_LEVEL_6_1,
449 SEQ_LEVEL_6_2,
450 SEQ_LEVEL_6_3,
451 SEQ_LEVEL_7_0,
452 SEQ_LEVEL_7_1,
453 SEQ_LEVEL_7_2,
454 SEQ_LEVEL_7_3,
455 SEQ_LEVEL_8_0,
456 SEQ_LEVEL_8_1,
457 SEQ_LEVEL_8_2,
458 SEQ_LEVEL_8_3,
459 SEQ_LEVELS,
460 SEQ_LEVEL_MAX = 31,
461 SEQ_LEVEL_KEEP_STATS = 32,
462} UENUM1BYTE(AV1_LEVEL);
463
464#define LEVEL_BITS 5
465
466#define DIRECTIONAL_MODES 8
467#define MAX_ANGLE_DELTA 3
468#define ANGLE_STEP 3
469
470#define INTER_MODES (1 + NEWMV - NEARESTMV)
471
472#define INTER_COMPOUND_MODES (1 + NEW_NEWMV - NEAREST_NEARESTMV)
473
474#define SKIP_CONTEXTS 3
475#define SKIP_MODE_CONTEXTS 3
476
477#define COMP_INDEX_CONTEXTS 6
478#define COMP_GROUP_IDX_CONTEXTS 6
479
480#define NMV_CONTEXTS 3
481
482#define NEWMV_MODE_CONTEXTS 6
483#define GLOBALMV_MODE_CONTEXTS 2
484#define REFMV_MODE_CONTEXTS 6
485#define DRL_MODE_CONTEXTS 3
486
487#define GLOBALMV_OFFSET 3
488#define REFMV_OFFSET 4
489
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)
493
494#define COMP_NEWMV_CTXS 5
495#define INTER_MODE_CONTEXTS 8
496
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
502
503#define DELTA_LF_SMALL 3
504#define DELTA_LF_PROBS (DELTA_LF_SMALL)
505#define DEFAULT_DELTA_LF_RES 2
506
507/* Segment Feature Masks */
508#define MAX_MV_REF_CANDIDATES 2
509
510#define MAX_REF_MV_STACK_SIZE 8
511#define USABLE_REF_MV_STACK_SIZE 4
512#define REF_CAT_LEVEL 640
513
514#define INTRA_INTER_CONTEXTS 4
515#define COMP_INTER_CONTEXTS 5
516#define REF_CONTEXTS 3
517
518#define COMP_REF_TYPE_CONTEXTS 5
519#define UNI_COMP_REF_CONTEXTS 3
520
521#define TXFM_PARTITION_CONTEXTS ((TX_SIZES - TX_8X8) * 6 - 3)
522typedef uint8_t TXFM_CONTEXT;
523
524// An enum for single reference types (and some derived values).
525enum {
526 NONE_FRAME = -1,
527 INTRA_FRAME,
528 LAST_FRAME,
529 LAST2_FRAME,
530 LAST3_FRAME,
531 GOLDEN_FRAME,
532 BWDREF_FRAME,
533 ALTREF2_FRAME,
534 ALTREF_FRAME,
535 REF_FRAMES,
536
537 // Extra/scratch reference frame. It may be:
538 // - used to update the ALTREF2_FRAME ref (see lshift_bwd_ref_frames()), or
539 // - updated from ALTREF2_FRAME ref (see rshift_bwd_ref_frames()).
540 EXTREF_FRAME = REF_FRAMES,
541
542 // Number of inter (non-intra) reference types.
543 INTER_REFS_PER_FRAME = ALTREF_FRAME - LAST_FRAME + 1,
544
545 // Number of forward (aka past) reference types.
546 FWD_REFS = GOLDEN_FRAME - LAST_FRAME + 1,
547
548 // Number of backward (aka future) reference types.
549 BWD_REFS = ALTREF_FRAME - BWDREF_FRAME + 1,
550
551 SINGLE_REFS = FWD_REFS + BWD_REFS,
552};
553
554#define REF_FRAMES_LOG2 3
555
556// REF_FRAMES for the cm->ref_frame_map array, 1 scratch frame for the new
557// frame in cm->cur_frame, INTER_REFS_PER_FRAME for scaled references on the
558// encoder in the cpi->scaled_ref_buf array.
559// The encoder uses FRAME_BUFFERS only in GOOD and REALTIME encoding modes.
560// The decoder also uses FRAME_BUFFERS.
561#define FRAME_BUFFERS (REF_FRAMES + 1 + INTER_REFS_PER_FRAME)
562
563// During allintra encoding, one reference frame buffer is free to be used again
564// only after another frame buffer is stored as the reference frame. Hence, it
565// is necessary and sufficient to maintain only two reference frame buffers in
566// this case.
567#define FRAME_BUFFERS_ALLINTRA 2
568
569#define FWD_RF_OFFSET(ref) (ref - LAST_FRAME)
570#define BWD_RF_OFFSET(ref) (ref - BWDREF_FRAME)
571
572// Select all the decoded frame buffer slots
573#define SELECT_ALL_BUF_SLOTS 0xFF
574
575enum {
576 LAST_LAST2_FRAMES, // { LAST_FRAME, LAST2_FRAME }
577 LAST_LAST3_FRAMES, // { LAST_FRAME, LAST3_FRAME }
578 LAST_GOLDEN_FRAMES, // { LAST_FRAME, GOLDEN_FRAME }
579 BWDREF_ALTREF_FRAMES, // { BWDREF_FRAME, ALTREF_FRAME }
580 LAST2_LAST3_FRAMES, // { LAST2_FRAME, LAST3_FRAME }
581 LAST2_GOLDEN_FRAMES, // { LAST2_FRAME, GOLDEN_FRAME }
582 LAST3_GOLDEN_FRAMES, // { LAST3_FRAME, GOLDEN_FRAME }
583 BWDREF_ALTREF2_FRAMES, // { BWDREF_FRAME, ALTREF2_FRAME }
584 ALTREF2_ALTREF_FRAMES, // { ALTREF2_FRAME, ALTREF_FRAME }
585 TOTAL_UNIDIR_COMP_REFS,
586 // NOTE: UNIDIR_COMP_REFS is the number of uni-directional reference pairs
587 // that are explicitly signaled.
588 UNIDIR_COMP_REFS = BWDREF_ALTREF_FRAMES + 1,
589} UENUM1BYTE(UNIDIR_COMP_REF);
590
591#define TOTAL_COMP_REFS (FWD_REFS * BWD_REFS + TOTAL_UNIDIR_COMP_REFS)
592
593#define COMP_REFS (FWD_REFS * BWD_REFS + UNIDIR_COMP_REFS)
594
595// NOTE: A limited number of unidirectional reference pairs can be signalled for
596// compound prediction. The use of skip mode, on the other hand, makes it
597// possible to have a reference pair not listed for explicit signaling.
598#define MODE_CTX_REF_FRAMES (REF_FRAMES + TOTAL_COMP_REFS)
599
600// Note: It includes single and compound references. So, it can take values from
601// NONE_FRAME to (MODE_CTX_REF_FRAMES - 1). Hence, it is not defined as an enum.
602typedef int8_t MV_REFERENCE_FRAME;
603
617
619// Picture prediction structures (0-13 are predefined) in scalability metadata.
620enum {
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,
635 SCALABILITY_SS = 14
636} UENUM1BYTE(SCALABILITY_STRUCTURES);
637
638#define SUPERRES_SCALE_BITS 3
639#define SUPERRES_SCALE_DENOMINATOR_MIN (SCALE_NUMERATOR + 1)
640
641// In large_scale_tile coding, external references are used.
642#define MAX_EXTERNAL_REFERENCES 128
643#define MAX_TILES 512
644
647#ifdef __cplusplus
648} // extern "C"
649#endif
650
651#endif // AOM_AV1_COMMON_ENUMS_H_
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