vp9_enums.h 4.3 KB

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