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 VPX_VP9_COMMON_VP9_ENUMS_H_ 12 #define VPX_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 typedef enum PARSE_RECON_FLAG { PARSE = 1, RECON = 2 } PARSE_RECON_FLAG; 45 46 #define BLOCK_4X4 0 47 #define BLOCK_4X8 1 48 #define BLOCK_8X4 2 49 #define BLOCK_8X8 3 50 #define BLOCK_8X16 4 51 #define BLOCK_16X8 5 52 #define BLOCK_16X16 6 53 #define BLOCK_16X32 7 54 #define BLOCK_32X16 8 55 #define BLOCK_32X32 9 56 #define BLOCK_32X64 10 57 #define BLOCK_64X32 11 58 #define BLOCK_64X64 12 59 #define BLOCK_SIZES 13 60 #define BLOCK_INVALID BLOCK_SIZES 61 typedef uint8_t BLOCK_SIZE; 62 63 typedef enum PARTITION_TYPE { 64 PARTITION_NONE, 65 PARTITION_HORZ, 66 PARTITION_VERT, 67 PARTITION_SPLIT, 68 PARTITION_TYPES, 69 PARTITION_INVALID = PARTITION_TYPES 70 } PARTITION_TYPE; 71 72 typedef char PARTITION_CONTEXT; 73 #define PARTITION_PLOFFSET 4 // number of probability models per block size 74 #define PARTITION_CONTEXTS (4 * PARTITION_PLOFFSET) 75 76 // block transform size 77 typedef uint8_t TX_SIZE; 78 #define TX_4X4 ((TX_SIZE)0) // 4x4 transform 79 #define TX_8X8 ((TX_SIZE)1) // 8x8 transform 80 #define TX_16X16 ((TX_SIZE)2) // 16x16 transform 81 #define TX_32X32 ((TX_SIZE)3) // 32x32 transform 82 #define TX_SIZES ((TX_SIZE)4) 83 84 // frame transform mode 85 typedef enum { 86 ONLY_4X4 = 0, // only 4x4 transform used 87 ALLOW_8X8 = 1, // allow block transform size up to 8x8 88 ALLOW_16X16 = 2, // allow block transform size up to 16x16 89 ALLOW_32X32 = 3, // allow block transform size up to 32x32 90 TX_MODE_SELECT = 4, // transform specified for each block 91 TX_MODES = 5, 92 } TX_MODE; 93 94 typedef enum { 95 DCT_DCT = 0, // DCT in both horizontal and vertical 96 ADST_DCT = 1, // ADST in vertical, DCT in horizontal 97 DCT_ADST = 2, // DCT in vertical, ADST in horizontal 98 ADST_ADST = 3, // ADST in both directions 99 TX_TYPES = 4 100 } TX_TYPE; 101 102 typedef enum { 103 VP9_LAST_FLAG = 1 << 0, 104 VP9_GOLD_FLAG = 1 << 1, 105 VP9_ALT_FLAG = 1 << 2, 106 } VP9_REFFRAME; 107 108 typedef enum { PLANE_TYPE_Y = 0, PLANE_TYPE_UV = 1, PLANE_TYPES } PLANE_TYPE; 109 110 #define DC_PRED 0 // Average of above and left pixels 111 #define V_PRED 1 // Vertical 112 #define H_PRED 2 // Horizontal 113 #define D45_PRED 3 // Directional 45 deg = round(arctan(1/1) * 180/pi) 114 #define D135_PRED 4 // Directional 135 deg = 180 - 45 115 #define D117_PRED 5 // Directional 117 deg = 180 - 63 116 #define D153_PRED 6 // Directional 153 deg = 180 - 27 117 #define D207_PRED 7 // Directional 207 deg = 180 + 27 118 #define D63_PRED 8 // Directional 63 deg = round(arctan(2/1) * 180/pi) 119 #define TM_PRED 9 // True-motion 120 #define NEARESTMV 10 121 #define NEARMV 11 122 #define ZEROMV 12 123 #define NEWMV 13 124 #define MB_MODE_COUNT 14 125 typedef uint8_t PREDICTION_MODE; 126 127 #define INTRA_MODES (TM_PRED + 1) 128 129 #define INTER_MODES (1 + NEWMV - NEARESTMV) 130 131 #define SKIP_CONTEXTS 3 132 #define INTER_MODE_CONTEXTS 7 133 134 /* Segment Feature Masks */ 135 #define MAX_MV_REF_CANDIDATES 2 136 137 #define INTRA_INTER_CONTEXTS 4 138 #define COMP_INTER_CONTEXTS 5 139 #define REF_CONTEXTS 5 140 141 #ifdef __cplusplus 142 } // extern "C" 143 #endif 144 145 #endif // VPX_VP9_COMMON_VP9_ENUMS_H_ 146