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 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 
20 #define MI_SIZE_LOG2 3
21 #define MI_BLOCK_SIZE_LOG2 (6 - MI_SIZE_LOG2)  // 64 = 2^6
22 
23 #define MI_SIZE (1 << MI_SIZE_LOG2)  // pixels per mi-unit
24 #define MI_BLOCK_SIZE (1 << MI_BLOCK_SIZE_LOG2)  // mi-units per max block
25 
26 #define MI_MASK (MI_BLOCK_SIZE - 1)
27 
28 // Bitstream profiles indicated by 2-3 bits in the uncompressed header.
29 // 00: Profile 0.  8-bit 4:2:0 only.
30 // 10: Profile 1.  8-bit 4:4:4, 4:2:2, and 4:4:0.
31 // 01: Profile 2.  10-bit and 12-bit color only, with 4:2:0 sampling.
32 // 110: Profile 3. 10-bit and 12-bit color only, with 4:2:2/4:4:4/4:4:0
33 //                 sampling.
34 // 111: Undefined profile.
35 typedef enum BITSTREAM_PROFILE {
36   PROFILE_0,
37   PROFILE_1,
38   PROFILE_2,
39   PROFILE_3,
40   MAX_PROFILES
41 } BITSTREAM_PROFILE;
42 
43 typedef enum BIT_DEPTH {
44   BITS_8,
45   BITS_10,
46   BITS_12
47 } BIT_DEPTH;
48 
49 typedef enum BLOCK_SIZE {
50   BLOCK_4X4,
51   BLOCK_4X8,
52   BLOCK_8X4,
53   BLOCK_8X8,
54   BLOCK_8X16,
55   BLOCK_16X8,
56   BLOCK_16X16,
57   BLOCK_16X32,
58   BLOCK_32X16,
59   BLOCK_32X32,
60   BLOCK_32X64,
61   BLOCK_64X32,
62   BLOCK_64X64,
63   BLOCK_SIZES,
64   BLOCK_INVALID = BLOCK_SIZES
65 } BLOCK_SIZE;
66 
67 typedef enum PARTITION_TYPE {
68   PARTITION_NONE,
69   PARTITION_HORZ,
70   PARTITION_VERT,
71   PARTITION_SPLIT,
72   PARTITION_TYPES,
73   PARTITION_INVALID = PARTITION_TYPES
74 } PARTITION_TYPE;
75 
76 #define PARTITION_PLOFFSET   4  // number of probability models per block size
77 #define PARTITION_CONTEXTS (4 * PARTITION_PLOFFSET)
78 
79 // block transform size
80 typedef enum {
81   TX_4X4 = 0,                      // 4x4 transform
82   TX_8X8 = 1,                      // 8x8 transform
83   TX_16X16 = 2,                    // 16x16 transform
84   TX_32X32 = 3,                    // 32x32 transform
85   TX_SIZES
86 } TX_SIZE;
87 
88 // frame transform mode
89 typedef enum {
90   ONLY_4X4            = 0,        // only 4x4 transform used
91   ALLOW_8X8           = 1,        // allow block transform size up to 8x8
92   ALLOW_16X16         = 2,        // allow block transform size up to 16x16
93   ALLOW_32X32         = 3,        // allow block transform size up to 32x32
94   TX_MODE_SELECT      = 4,        // transform specified for each block
95   TX_MODES            = 5,
96 } TX_MODE;
97 
98 typedef enum {
99   DCT_DCT   = 0,                      // DCT  in both horizontal and vertical
100   ADST_DCT  = 1,                      // ADST in vertical, DCT in horizontal
101   DCT_ADST  = 2,                      // DCT  in vertical, ADST in horizontal
102   ADST_ADST = 3,                      // ADST in both directions
103   TX_TYPES = 4
104 } TX_TYPE;
105 
106 typedef enum {
107   UNKNOWN    = 0,
108   BT_601     = 1,  // YUV
109   BT_709     = 2,  // YUV
110   SMPTE_170  = 3,  // YUV
111   SMPTE_240  = 4,  // YUV
112   RESERVED_1 = 5,
113   RESERVED_2 = 6,
114   SRGB       = 7   // RGB
115 } COLOR_SPACE;
116 
117 typedef enum {
118   VP9_LAST_FLAG = 1 << 0,
119   VP9_GOLD_FLAG = 1 << 1,
120   VP9_ALT_FLAG = 1 << 2,
121 } VP9_REFFRAME;
122 
123 #ifdef __cplusplus
124 }  // extern "C"
125 #endif
126 
127 #endif  // VP9_COMMON_VP9_ENUMS_H_
128