vc1hwd_picture_layer.h 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  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. -- Description : Interface for picture layer decoding
  17. --
  18. --------------------------------------------------------------------------------
  19. --
  20. -- Version control information, please leave untouched.
  21. --
  22. -- $RCSfile: vc1hwd_picture_layer.h,v $
  23. -- $Revision: 1.2 $
  24. -- $Date: 2007/06/28 12:24:02 $
  25. --
  26. ------------------------------------------------------------------------------*/
  27. #ifndef VC1HWD_PICTURE_LAYER_H
  28. #define VC1HWD_PICTURE_LAYER_H
  29. /*------------------------------------------------------------------------------
  30. Include headers
  31. ------------------------------------------------------------------------------*/
  32. #include "vc1hwd_util.h"
  33. #include "vc1hwd_stream.h"
  34. /*------------------------------------------------------------------------------
  35. Module defines
  36. ------------------------------------------------------------------------------*/
  37. /* Picture type */
  38. typedef enum {
  39. PTYPE_I = 0,
  40. PTYPE_P = 1,
  41. PTYPE_B = 2,
  42. PTYPE_BI = 3,
  43. PTYPE_Skip
  44. } picType_e;
  45. /* Field type */
  46. typedef enum {
  47. FTYPE_I = 0,
  48. FTYPE_P = 1,
  49. FTYPE_B = 2,
  50. FTYPE_BI = 3
  51. } fieldType_e;
  52. /* RESPIC syntax element (Main Profile) */
  53. typedef enum {
  54. RESPIC_FULL_FULL = 0,
  55. RESPIC_HALF_FULL = 1,
  56. RESPIC_FULL_HALF = 2,
  57. RESPIC_HALF_HALF = 3
  58. } resPic_e;
  59. /* DQPROFILE syntax element */
  60. typedef enum {
  61. DQPROFILE_N_A,
  62. DQPROFILE_ALL_FOUR,
  63. DQPROFILE_DOUBLE_EDGES,
  64. DQPROFILE_SINGLE_EDGES,
  65. DQPROFILE_ALL_MACROBLOCKS
  66. } dqProfile_e;
  67. /* DQSBEDGE and DQDBEDGE */
  68. typedef enum {
  69. DQEDGE_LEFT = 1,
  70. DQEDGE_TOP = 2,
  71. DQEDGE_RIGHT = 4,
  72. DQEDGE_BOTTOM = 8
  73. } dqEdge_e;
  74. /* BFRACTION syntax element */
  75. typedef enum {
  76. BFRACT_1_2,
  77. BFRACT_1_3,
  78. BFRACT_2_3,
  79. BFRACT_1_4,
  80. BFRACT_3_4,
  81. BFRACT_1_5,
  82. BFRACT_2_5,
  83. BFRACT_3_5,
  84. BFRACT_4_5,
  85. BFRACT_1_6,
  86. BFRACT_5_6,
  87. BFRACT_1_7,
  88. BFRACT_2_7,
  89. BFRACT_3_7,
  90. BFRACT_4_7,
  91. BFRACT_5_7,
  92. BFRACT_6_7,
  93. BFRACT_1_8,
  94. BFRACT_3_8,
  95. BFRACT_5_8,
  96. BFRACT_7_8,
  97. BFRACT_SMPTE_RESERVED,
  98. BFRACT_PTYPE_BI
  99. } bfract_e;
  100. /* Supported transform types */
  101. typedef enum {
  102. TT_8x8 = 0,
  103. TT_8x4 = 1,
  104. TT_4x8 = 2,
  105. TT_4x4 = 3
  106. } transformType_e;
  107. /* MVMODE syntax element */
  108. typedef enum {
  109. MVMODE_1MV_HALFPEL_LINEAR,
  110. MVMODE_1MV,
  111. MVMODE_1MV_HALFPEL,
  112. MVMODE_MIXEDMV,
  113. MVMODE_INVALID
  114. } mvmode_e;
  115. /* BMVTYPE syntax element */
  116. typedef enum {
  117. BMV_BACKWARD,
  118. BMV_FORWARD,
  119. BMV_INTERPOLATED,
  120. BMV_DIRECT, /* used in mv prediction function */
  121. BMV_P_PICTURE
  122. } bmvType_e;
  123. /* FCM syntax element */
  124. typedef enum {
  125. PROGRESSIVE = 0,
  126. FRAME_INTERLACE = 1,
  127. FIELD_INTERLACE = 2
  128. } fcm_e;
  129. /* Pan scan info */
  130. typedef struct {
  131. u32 hOffset;
  132. u32 vOffset;
  133. u32 width;
  134. u32 height;
  135. } psw_t;
  136. /* FPTYPE */
  137. typedef enum {
  138. FP_I_I = 0,
  139. FP_I_P = 1,
  140. FP_P_I = 2,
  141. FP_P_P = 3,
  142. FP_B_B = 4,
  143. FP_B_BI = 5,
  144. FP_BI_B = 6,
  145. PF_BI_BI = 7
  146. } fpType_e;
  147. /* INTCOMPFIELD */
  148. typedef enum {
  149. IC_BOTH_FIELDS = 0,
  150. IC_TOP_FIELD = 1,
  151. IC_BOTTOM_FIELD = 2,
  152. IC_NONE
  153. } intCompField_e;
  154. /*------------------------------------------------------------------------------
  155. Data types
  156. ------------------------------------------------------------------------------*/
  157. /* Descriptor for the picture layer data */
  158. typedef struct pictureLayer {
  159. picType_e picType; /* Picture type */
  160. u16x pqIndex;
  161. u16x pquant; /* Picture level quantization parameters */
  162. u16x halfQp;
  163. u32 uniformQuantizer;
  164. resPic_e resPic; /* Progressive picture resolution code [0,3] */
  165. u16x bufferFullness;
  166. u32 interpFrm;
  167. u16x frameCount;
  168. mvmode_e mvmode; /* Motion vector coding mode for frame */
  169. mvmode_e mvmode2;
  170. u16x rawMask; /* Raw mode mask; specifies which bitplanes are
  171. * coded with raw coding mode as well as invert
  172. * element status. */
  173. u16x mvTableIndex;
  174. u16x cbpTableIndex;
  175. u16x acCodingSetIndexY;
  176. u16x acCodingSetIndexCbCr;
  177. u16x intraTransformDcIndex;
  178. u32 mbLevelTransformTypeFlag; /* Transform type signaled in MB level */
  179. transformType_e ttFrm; /* Frame level transform type */
  180. /* Main profile stuff */
  181. u32 intensityCompensation;
  182. u16x mvRange; /* Motion vector range [0,3] */
  183. u16x dquantInFrame; /* Implied from decoding VOPDQUANT */
  184. bfract_e bfraction; /* Temporal placement for B pictures */
  185. i16x scaleFactor;
  186. u16x altPquant;
  187. dqProfile_e dqProfile;
  188. dqEdge_e dqEdges; /* Edges to be quantized with ALTPQUANT
  189. * instead of PQUANT */
  190. u16x dqbiLevel; /* Used only if dqProfile==All
  191. * 0 mb may take any quantization step
  192. * 1 only PQUANT and ALTPQUANT allowed */
  193. i32 iShift;
  194. i32 iScale;
  195. u32 rangeRedFrm;
  196. u32 topField; /* 1 TOP, 0 BOTTOM */
  197. u32 isFF; /* is first field */
  198. /* advance profile stuff */
  199. fcm_e fcm; /* frame coding mode */
  200. u32 tfcntr; /* Temporal reference frame count */
  201. u32 tff; /* Top field first TFF=1 -> top, TFF=0 -> bottom */
  202. u32 rff; /* Repeat first field */
  203. u32 rptfrm; /* Repeat Frame Count; Number of frames to repeat (0-3) */
  204. u32 psPresent; /* Pan Scan Flag */
  205. psw_t psw; /* Pan scan window information */
  206. u32 uvSamp; /* subsampling of color-difference: progressive/interlace */
  207. u32 postProc; /* may be used in display process */
  208. u32 condOver; /* conditional overlap flag: 0b, 10b, 11b */
  209. u32 dmvRange; /* extended differential mv range [0,3] */
  210. u32 mvSwitch; /* If 0, only 1mv for MB else 1,2 or 4 mvs for MB */
  211. u32 mbModeTab; /* macroblock mode code table */
  212. u32 mvbpTableIndex2; /* 2-mv block pattern table */
  213. u32 mvbpTableIndex4; /* 4-mv block pattern table */
  214. fpType_e fieldPicType; /* Field picture type */
  215. u32 refDist; /* P reference distance */
  216. u32 numRef; /* 0 = one reference field, 1 = two reference fields */
  217. u32 refField; /* 0 = closest, 1 = second most recent */
  218. intCompField_e intCompField; /* fields to intensity compensate */
  219. i32 iShift2; /* LUMSHIFT2 (shall be applied to bottom field) */
  220. i32 iScale2; /* LUMSCALE2 (shall be applied to bottom field) */
  221. u32 picHeaderBits; /* number of bits in picture layer header */
  222. u32 fieldHeaderBits; /* same for field header */
  223. } pictureLayer_t;
  224. /*------------------------------------------------------------------------------
  225. Function prototypes
  226. ------------------------------------------------------------------------------*/
  227. struct swStrmStorage;
  228. u16x vc1hwdDecodePictureLayer( struct swStrmStorage *pStorage,
  229. strmData_t *pStrmData );
  230. u16x vc1hwdDecodeFieldLayer( struct swStrmStorage *pStorage,
  231. strmData_t *pStrmData,
  232. u16x isFirstField );
  233. u16x vc1hwdDecodePictureLayerAP(struct swStrmStorage *pStorage,
  234. strmData_t *pStrmData );
  235. #endif /* #ifndef VC1HWD_PICTURE_LAYER_H */