1 /* 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 #ifndef VP9_COMMON_VP9_ENUMS_H_ 12 #define VP9_COMMON_VP9_ENUMS_H_ 13 14 #include "./vpx_config.h" 15 #include "vpx/vpx_integer.h" 16 17 #ifdef __cplusplus 18 extern "C" { 19 #endif 20 21 #define MI_SIZE_LOG2 3 22 #define MI_BLOCK_SIZE_LOG2 (6 - MI_SIZE_LOG2) // 64 = 2^6 23 24 #define MI_SIZE (1 << MI_SIZE_LOG2) // pixels per mi-unit 25 #define MI_BLOCK_SIZE (1 << MI_BLOCK_SIZE_LOG2) // mi-units per max block 26 27 #define MI_MASK (MI_BLOCK_SIZE - 1) 28 29 // Bitstream profiles indicated by 2-3 bits in the uncompressed header. 30 // 00: Profile 0. 8-bit 4:2:0 only. 31 // 10: Profile 1. 8-bit 4:4:4, 4:2:2, and 4:4:0. 32 // 01: Profile 2. 10-bit and 12-bit color only, with 4:2:0 sampling. 33 // 110: Profile 3. 10-bit and 12-bit color only, with 4:2:2/4:4:4/4:4:0 34 // sampling. 35 // 111: Undefined profile. 36 typedef enum BITSTREAM_PROFILE { 37 PROFILE_0, 38 PROFILE_1, 39 PROFILE_2, 40 PROFILE_3, 41 MAX_PROFILES 42 } BITSTREAM_PROFILE; 43 44 #define BLOCK_4X4 0 45 #define BLOCK_4X8 1 46 #define BLOCK_8X4 2 47 #define BLOCK_8X8 3 48 #define BLOCK_8X16 4 49 #define BLOCK_16X8 5 50 #define BLOCK_16X16 6 51 #define BLOCK_16X32 7 52 #define BLOCK_32X16 8 53 #define BLOCK_32X32 9 54 #define BLOCK_32X64 10 55 #define BLOCK_64X32 11 56 #define BLOCK_64X64 12 57 #define BLOCK_SIZES 13 58 #define BLOCK_INVALID BLOCK_SIZES 59 typedef uint8_t BLOCK_SIZE; 60 61 typedef enum PARTITION_TYPE { 62 PARTITION_NONE, 63 PARTITION_HORZ, 64 PARTITION_VERT, 65 PARTITION_SPLIT, 66 PARTITION_TYPES, 67 PARTITION_INVALID = PARTITION_TYPES 68 } PARTITION_TYPE; 69 70 typedef char PARTITION_CONTEXT; 71 #define PARTITION_PLOFFSET 4 // number of probability models per block size 72 #define PARTITION_CONTEXTS (4 * PARTITION_PLOFFSET) 73 74 // block transform size 75 typedef uint8_t TX_SIZE; 76 #define TX_4X4 ((TX_SIZE)0) // 4x4 transform 77 #define TX_8X8 ((TX_SIZE)1) // 8x8 transform 78 #define TX_16X16 ((TX_SIZE)2) // 16x16 transform 79 #define TX_32X32 ((TX_SIZE)3) // 32x32 transform 80 #define TX_SIZES ((TX_SIZE)4) 81 82 // frame transform mode 83 typedef enum { 84 ONLY_4X4 = 0, // only 4x4 transform used 85 ALLOW_8X8 = 1, // allow block transform size up to 8x8 86 ALLOW_16X16 = 2, // allow block transform size up to 16x16 87 ALLOW_32X32 = 3, // allow block transform size up to 32x32 88 TX_MODE_SELECT = 4, // transform specified for each block 89 TX_MODES = 5, 90 } TX_MODE; 91 92 typedef enum { 93 DCT_DCT = 0, // DCT in both horizontal and vertical 94 ADST_DCT = 1, // ADST in vertical, DCT in horizontal 95 DCT_ADST = 2, // DCT in vertical, ADST in horizontal 96 ADST_ADST = 3, // ADST in both directions 97 TX_TYPES = 4 98 } TX_TYPE; 99 100 typedef enum { 101 VP9_LAST_FLAG = 1 << 0, 102 VP9_GOLD_FLAG = 1 << 1, 103 VP9_ALT_FLAG = 1 << 2, 104 } VP9_REFFRAME; 105 106 typedef enum { 107 PLANE_TYPE_Y = 0, 108 PLANE_TYPE_UV = 1, 109 PLANE_TYPES 110 } PLANE_TYPE; 111 112 #define DC_PRED 0 // Average of above and left pixels 113 #define V_PRED 1 // Vertical 114 #define H_PRED 2 // Horizontal 115 #define D45_PRED 3 // Directional 45 deg = round(arctan(1/1) * 180/pi) 116 #define D135_PRED 4 // Directional 135 deg = 180 - 45 117 #define D117_PRED 5 // Directional 117 deg = 180 - 63 118 #define D153_PRED 6 // Directional 153 deg = 180 - 27 119 #define D207_PRED 7 // Directional 207 deg = 180 + 27 120 #define D63_PRED 8 // Directional 63 deg = round(arctan(2/1) * 180/pi) 121 #define TM_PRED 9 // True-motion 122 #define NEARESTMV 10 123 #define NEARMV 11 124 #define ZEROMV 12 125 #define NEWMV 13 126 #define MB_MODE_COUNT 14 127 typedef uint8_t PREDICTION_MODE; 128 129 #define INTRA_MODES (TM_PRED + 1) 130 131 #define INTER_MODES (1 + NEWMV - NEARESTMV) 132 133 #define SKIP_CONTEXTS 3 134 #define INTER_MODE_CONTEXTS 7 135 136 /* Segment Feature Masks */ 137 #define MAX_MV_REF_CANDIDATES 2 138 139 #define INTRA_INTER_CONTEXTS 4 140 #define COMP_INTER_CONTEXTS 5 141 #define REF_CONTEXTS 5 142 143 #ifdef __cplusplus 144 } // extern "C" 145 #endif 146 147 #endif // VP9_COMMON_VP9_ENUMS_H_ 148