/H264Dec/source/h264bsd_macroblock_layer.h

http://github.com/mbebenita/Broadway · C Header · 212 lines · 143 code · 29 blank · 40 comment · 1 complexity · a99d1f1b40a7b4d1163398aad4908f1f MD5 · raw file

  1. /*
  2. * Copyright (C) 2009 The Android Open Source Project
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /*------------------------------------------------------------------------------
  17. Table of contents
  18. 1. Include headers
  19. 2. Module defines
  20. 3. Data types
  21. 4. Function prototypes
  22. ------------------------------------------------------------------------------*/
  23. #ifndef H264SWDEC_MACROBLOCK_LAYER_H
  24. #define H264SWDEC_MACROBLOCK_LAYER_H
  25. /*------------------------------------------------------------------------------
  26. 1. Include headers
  27. ------------------------------------------------------------------------------*/
  28. #include "basetype.h"
  29. #include "h264bsd_stream.h"
  30. #include "h264bsd_image.h"
  31. #include "h264bsd_dpb.h"
  32. /*------------------------------------------------------------------------------
  33. 2. Module defines
  34. ------------------------------------------------------------------------------*/
  35. /* Macro to determine if a mb is an intra mb */
  36. #define IS_INTRA_MB(a) ((a).mbType > 5)
  37. /* Macro to determine if a mb is an I_PCM mb */
  38. #define IS_I_PCM_MB(a) ((a).mbType == 31)
  39. typedef enum {
  40. P_Skip = 0,
  41. P_L0_16x16 = 1,
  42. P_L0_L0_16x8 = 2,
  43. P_L0_L0_8x16 = 3,
  44. P_8x8 = 4,
  45. P_8x8ref0 = 5,
  46. I_4x4 = 6,
  47. I_16x16_0_0_0 = 7,
  48. I_16x16_1_0_0 = 8,
  49. I_16x16_2_0_0 = 9,
  50. I_16x16_3_0_0 = 10,
  51. I_16x16_0_1_0 = 11,
  52. I_16x16_1_1_0 = 12,
  53. I_16x16_2_1_0 = 13,
  54. I_16x16_3_1_0 = 14,
  55. I_16x16_0_2_0 = 15,
  56. I_16x16_1_2_0 = 16,
  57. I_16x16_2_2_0 = 17,
  58. I_16x16_3_2_0 = 18,
  59. I_16x16_0_0_1 = 19,
  60. I_16x16_1_0_1 = 20,
  61. I_16x16_2_0_1 = 21,
  62. I_16x16_3_0_1 = 22,
  63. I_16x16_0_1_1 = 23,
  64. I_16x16_1_1_1 = 24,
  65. I_16x16_2_1_1 = 25,
  66. I_16x16_3_1_1 = 26,
  67. I_16x16_0_2_1 = 27,
  68. I_16x16_1_2_1 = 28,
  69. I_16x16_2_2_1 = 29,
  70. I_16x16_3_2_1 = 30,
  71. I_PCM = 31
  72. } mbType_e;
  73. typedef enum {
  74. P_L0_8x8 = 0,
  75. P_L0_8x4 = 1,
  76. P_L0_4x8 = 2,
  77. P_L0_4x4 = 3
  78. } subMbType_e;
  79. typedef enum {
  80. MB_P_16x16 = 0,
  81. MB_P_16x8,
  82. MB_P_8x16,
  83. MB_P_8x8
  84. } mbPartMode_e;
  85. typedef enum {
  86. MB_SP_8x8 = 0,
  87. MB_SP_8x4,
  88. MB_SP_4x8,
  89. MB_SP_4x4
  90. } subMbPartMode_e;
  91. typedef enum {
  92. PRED_MODE_INTRA4x4 = 0,
  93. PRED_MODE_INTRA16x16 ,
  94. PRED_MODE_INTER
  95. } mbPartPredMode_e;
  96. /*------------------------------------------------------------------------------
  97. 3. Data types
  98. ------------------------------------------------------------------------------*/
  99. typedef struct
  100. {
  101. /* MvPrediction16x16 assumes that MVs are 16bits */
  102. i16 hor;
  103. i16 ver;
  104. } mv_t;
  105. typedef struct
  106. {
  107. u32 prevIntra4x4PredModeFlag[16];
  108. u32 remIntra4x4PredMode[16];
  109. u32 intraChromaPredMode;
  110. u32 refIdxL0[4];
  111. mv_t mvdL0[4];
  112. } mbPred_t;
  113. typedef struct
  114. {
  115. subMbType_e subMbType[4];
  116. u32 refIdxL0[4];
  117. mv_t mvdL0[4][4];
  118. } subMbPred_t;
  119. typedef struct
  120. {
  121. #ifdef H264DEC_OMXDL
  122. u8 posCoefBuf[27*16*3];
  123. u8 totalCoeff[27];
  124. #else
  125. i16 totalCoeff[27];
  126. #endif
  127. i32 level[26][16];
  128. u32 coeffMap[24];
  129. } residual_t;
  130. typedef struct
  131. {
  132. mbType_e mbType;
  133. u32 codedBlockPattern;
  134. i32 mbQpDelta;
  135. mbPred_t mbPred;
  136. subMbPred_t subMbPred;
  137. residual_t residual;
  138. } macroblockLayer_t;
  139. typedef struct mbStorage
  140. {
  141. mbType_e mbType;
  142. u32 sliceId;
  143. u32 disableDeblockingFilterIdc;
  144. i32 filterOffsetA;
  145. i32 filterOffsetB;
  146. u32 qpY;
  147. i32 chromaQpIndexOffset;
  148. #ifdef H264DEC_OMXDL
  149. u8 totalCoeff[27];
  150. #else
  151. i16 totalCoeff[27];
  152. #endif
  153. u8 intra4x4PredMode[16];
  154. u32 refPic[4];
  155. u8* refAddr[4];
  156. mv_t mv[16];
  157. u32 decoded;
  158. struct mbStorage *mbA;
  159. struct mbStorage *mbB;
  160. struct mbStorage *mbC;
  161. struct mbStorage *mbD;
  162. } mbStorage_t;
  163. /*------------------------------------------------------------------------------
  164. 4. Function prototypes
  165. ------------------------------------------------------------------------------*/
  166. u32 h264bsdDecodeMacroblockLayer(strmData_t *pStrmData,
  167. macroblockLayer_t *pMbLayer, mbStorage_t *pMb, u32 sliceType,
  168. u32 numRefIdxActive);
  169. u32 h264bsdNumMbPart(mbType_e mbType);
  170. u32 h264bsdNumSubMbPart(subMbType_e subMbType);
  171. subMbPartMode_e h264bsdSubMbPartMode(subMbType_e subMbType);
  172. u32 h264bsdDecodeMacroblock(mbStorage_t *pMb, macroblockLayer_t *pMbLayer,
  173. image_t *currImage, dpbStorage_t *dpb, i32 *qpY, u32 mbNum,
  174. u32 constrainedIntraPredFlag, u8* data);
  175. u32 h264bsdPredModeIntra16x16(mbType_e mbType);
  176. mbPartPredMode_e h264bsdMbPartPredMode(mbType_e mbType);
  177. #ifdef H264DEC_NEON
  178. u32 h264bsdClearMbLayer(macroblockLayer_t *pMbLayer, u32 size);
  179. #endif
  180. #endif /* #ifdef H264SWDEC_MACROBLOCK_LAYER_H */