h264hwd_macroblock_layer.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. /*------------------------------------------------------------------------------
  2. -- --
  3. -- This software is confidential and proprietary and may be used --
  4. -- only as expressly authorized by a licensing agreement from --
  5. -- --
  6. -- Hantro Products Oy. --
  7. -- --
  8. -- (C) COPYRIGHT 2006 HANTRO PRODUCTS OY --
  9. -- ALL RIGHTS RESERVED --
  10. -- --
  11. -- The entire notice above must be reproduced --
  12. -- on all copies and should not be removed. --
  13. -- --
  14. --------------------------------------------------------------------------------
  15. --
  16. -- Abstract : Macroblock level stream decoding and macroblock reconstruction
  17. --
  18. --------------------------------------------------------------------------------
  19. --
  20. -- Version control information, please leave untouched.
  21. --
  22. -- $RCSfile: h264hwd_macroblock_layer.h,v $
  23. -- $Date: 2008/03/13 12:48:06 $
  24. -- $Revision: 1.1 $
  25. --
  26. ------------------------------------------------------------------------------*/
  27. #ifndef H264HWD_MACROBLOCK_LAYER_H
  28. #define H264HWD_MACROBLOCK_LAYER_H
  29. /*------------------------------------------------------------------------------
  30. 1. Include headers
  31. ------------------------------------------------------------------------------*/
  32. #include "basetype.h"
  33. #include "h264hwd_stream.h"
  34. #include "h264hwd_slice_header.h"
  35. /*------------------------------------------------------------------------------
  36. 2. Module defines
  37. ------------------------------------------------------------------------------*/
  38. /* Macro to determine if a mb is an intra mb */
  39. #define IS_INTRA_MB(a) ((a).mbType > 5)
  40. /* Macro to determine if a mb is an I_PCM mb */
  41. #define IS_I_PCM_MB(a) ((a).mbType == 31)
  42. typedef enum mbType
  43. {
  44. P_Skip = 0,
  45. P_L0_16x16 = 1,
  46. P_L0_L0_16x8 = 2,
  47. P_L0_L0_8x16 = 3,
  48. P_8x8 = 4,
  49. P_8x8ref0 = 5,
  50. I_4x4 = 6,
  51. I_16x16_0_0_0 = 7,
  52. I_16x16_1_0_0 = 8,
  53. I_16x16_2_0_0 = 9,
  54. I_16x16_3_0_0 = 10,
  55. I_16x16_0_1_0 = 11,
  56. I_16x16_1_1_0 = 12,
  57. I_16x16_2_1_0 = 13,
  58. I_16x16_3_1_0 = 14,
  59. I_16x16_0_2_0 = 15,
  60. I_16x16_1_2_0 = 16,
  61. I_16x16_2_2_0 = 17,
  62. I_16x16_3_2_0 = 18,
  63. I_16x16_0_0_1 = 19,
  64. I_16x16_1_0_1 = 20,
  65. I_16x16_2_0_1 = 21,
  66. I_16x16_3_0_1 = 22,
  67. I_16x16_0_1_1 = 23,
  68. I_16x16_1_1_1 = 24,
  69. I_16x16_2_1_1 = 25,
  70. I_16x16_3_1_1 = 26,
  71. I_16x16_0_2_1 = 27,
  72. I_16x16_1_2_1 = 28,
  73. I_16x16_2_2_1 = 29,
  74. I_16x16_3_2_1 = 30,
  75. I_PCM = 31
  76. } mbType_e;
  77. typedef enum subMbType
  78. {
  79. P_L0_8x8 = 0,
  80. P_L0_8x4 = 1,
  81. P_L0_4x8 = 2,
  82. P_L0_4x4 = 3
  83. } subMbType_e;
  84. typedef enum mbPartMode
  85. {
  86. MB_P_16x16 = 0,
  87. MB_P_16x8,
  88. MB_P_8x16,
  89. MB_P_8x8
  90. } mbPartMode_e;
  91. typedef enum subMbPartMode
  92. {
  93. MB_SP_8x8 = 0,
  94. MB_SP_8x4,
  95. MB_SP_4x8,
  96. MB_SP_4x4
  97. } subMbPartMode_e;
  98. typedef enum mbPartPredMode
  99. {
  100. PRED_MODE_INTRA4x4 = 0,
  101. PRED_MODE_INTRA16x16,
  102. PRED_MODE_INTER
  103. } mbPartPredMode_e;
  104. /*------------------------------------------------------------------------------
  105. 3. Data types
  106. ------------------------------------------------------------------------------*/
  107. typedef struct mv
  108. {
  109. i16 hor;
  110. i16 ver;
  111. } mv_t;
  112. typedef struct mbPred
  113. {
  114. u32 prevIntra4x4PredModeFlag[16];
  115. u32 remIntra4x4PredMode[16];
  116. u32 intraChromaPredMode;
  117. } mbPred_t;
  118. typedef struct subMbPred
  119. {
  120. subMbType_e subMbType[4];
  121. } subMbPred_t;
  122. typedef struct
  123. {
  124. u16 rlc[468];
  125. u8 totalCoeff[28];
  126. } residual_t;
  127. typedef struct macroblockLayer
  128. {
  129. /*u32 disableDeblockingFilterIdc; */
  130. i32 filterOffsetA;
  131. i32 filterOffsetB;
  132. u32 disableDeblockingFilterIdc;
  133. mbType_e mbType;
  134. u32 codedBlockPattern;
  135. i32 mbQpDelta;
  136. mbPred_t mbPred;
  137. subMbPred_t subMbPred;
  138. residual_t residual;
  139. } macroblockLayer_t;
  140. typedef struct mbStorage
  141. {
  142. mbType_e mbType;
  143. mbType_e mbType_asic;
  144. u32 sliceId;
  145. /*u32 disableDeblockingFilterIdc; */
  146. /*i32 filterOffsetA; */
  147. /*i32 filterOffsetB; */
  148. u32 qpY;
  149. /*i32 chromaQpIndexOffset; */
  150. u8 totalCoeff[24];
  151. u8 intra4x4PredMode[16];
  152. u8 intra4x4PredMode_asic[16];
  153. /* u32 refPic[4]; */
  154. u8 refIdxL0[4];
  155. u8 refID[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. struct cabac_s;
  164. /*------------------------------------------------------------------------------
  165. 4. Function prototypes
  166. ------------------------------------------------------------------------------*/
  167. u32 h264bsdDecodeMacroblockLayerCavlc(strmData_t * pStrmData,
  168. macroblockLayer_t * pMbLayer,
  169. mbStorage_t * pMb,
  170. const sliceHeader_t * pSliceHdr );
  171. u32 h264bsdDecodeMacroblockLayerCabac(strmData_t * pStrmData,
  172. macroblockLayer_t * pMbLayer,
  173. mbStorage_t * pMb,
  174. const sliceHeader_t * pSliceHdr,
  175. struct cabac_s * pCabac );
  176. u32 h264bsdNumSubMbPart(subMbType_e subMbType);
  177. subMbPartMode_e h264bsdSubMbPartMode(subMbType_e subMbType);
  178. u32 h264bsdPredModeIntra16x16(mbType_e mbType);
  179. mbPartPredMode_e h264bsdMbPartPredMode(mbType_e mbType);
  180. #endif /* #ifdef H264HWD_MACROBLOCK_LAYER_H */