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