vc1decapi.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  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 : API of VC-1 Decoder
  17. --
  18. --------------------------------------------------------------------------------
  19. --
  20. -- Version control information, please leave untouched.
  21. --
  22. -- $RCSfile: vc1decapi.h,v $
  23. -- $Date: 2010/02/25 12:30:19 $
  24. -- $Revision: 1.10 $
  25. --
  26. ------------------------------------------------------------------------------*/
  27. #ifndef VC1DECAPI_H
  28. #define VC1DECAPI_H
  29. #ifdef __cplusplus
  30. extern "C"
  31. {
  32. #endif
  33. #include "basetype.h"
  34. #include "decapicommon.h"
  35. /*------------------------------------------------------------------------------
  36. API type definitions
  37. ------------------------------------------------------------------------------*/
  38. /* Return values */
  39. typedef enum VC1DecRet
  40. {
  41. VC1DEC_OK = 0, /* Operation successful.*/
  42. VC1DEC_PIC_RDY = 1, /* Picture decoded.*/
  43. VC1DEC_STRM_PROCESSED = 2, /* Stream handled, no picture finished.*/
  44. VC1DEC_HDRS_RDY = 3, /* Stream headers decoded */
  45. VC1DEC_END_OF_SEQ = 4, /* End of video sequence */
  46. VC1DEC_PIC_DECODED = 5, /* Picture decoded */
  47. VC1DEC_RESOLUTION_CHANGED = 6,/* Resolution changed in
  48. multiresolution video */
  49. VC1DEC_PARAM_ERROR = -1, /* Function called with invalid
  50. parameters. */
  51. VC1DEC_NOT_INITIALIZED = -3, /* Attempt to decode with
  52. uninitialized Decoder.*/
  53. VC1DEC_MEMFAIL = -4, /* Memory failure. */
  54. VC1DEC_INITFAIL = -5, /* Decoder initialization failure.
  55. Right shift is not signed. */
  56. VC1DEC_METADATA_FAIL = -6, /* Supplied metadata is in wrong
  57. format */
  58. VC1DEC_STRM_ERROR = -7, /* Stream error */
  59. VC1DEC_HW_RESERVED = -254,
  60. VC1DEC_HW_TIMEOUT = -255,
  61. VC1DEC_HW_BUS_ERROR = -256,
  62. VC1DEC_SYSTEM_ERROR = -257,
  63. VC1DEC_DWL_ERROR = -258,
  64. VC1DEC_FORMAT_NOT_SUPPORTED = -1000
  65. } VC1DecRet;
  66. /*
  67. * Container for the metadata of the stream.
  68. * Contains a wide range of information about the stream, e.g. what kind of
  69. * tools are needed to decode the stream.
  70. */
  71. typedef struct
  72. {
  73. u32 maxCodedWidth; /**< Specifies the maximum coded width in
  74. * pixels of picture within the sequence.
  75. * Valid range [2,8192] (even values).*/
  76. u32 maxCodedHeight; /**< Specifies the maximum coded height in
  77. * pixels of picture within the sequence.
  78. * Valid range [2,8192] (even values).*/
  79. u32 vsTransform; /**< Indicates whether variable sized transform
  80. * is enabled for the sequence. Valid range [0,1].*/
  81. u32 overlap; /**< Indicates whether overlap smoothing is
  82. * enabled for the sequence. Valid range [0,1].*/
  83. u32 syncMarker; /**< Indicates whether there are syncronization markers in
  84. * the stream. Valid range [0,1].*/
  85. u32 quantizer; /**< Indicates quantizer type used for the
  86. * sequence. Valid range [0,3].*/
  87. u32 frameInterp; /**< Indicates whether the INTERPFRM flag (which
  88. * provides information to display process)
  89. * exists in the picture headers. Valid range [0,1].*/
  90. u32 maxBframes; /**< Specifies the maximum amount of consecutive
  91. * B-frames within the sequence. Valid range [0,7].*/
  92. u32 fastUvMc; /**< Indicates whether the rounding of color
  93. * difference motion vectors is enabled. Valid range [0,1].*/
  94. u32 extendedMv; /**< Indicates whether extended motion
  95. * vectors are enabled for the sequence. Valid range [0,1].*/
  96. u32 multiRes; /**< Indicates whether frames may be coded
  97. * at smaller resolutions than
  98. * the specified frame resolution. Valid range [0,1].*/
  99. u32 rangeRed; /**< Indicates whether range reduction is used
  100. * in the sequence. Valid range [0,1].*/
  101. u32 dquant; /**< Indicates whether the quantization step
  102. * may vary within a frame. Valid range [0,2].*/
  103. u32 loopFilter; /**< Indicates whether loop filtering is
  104. * enabled for the sequence. Valid range [0,1].*/
  105. u32 profile; /**< Specifies profile of the input video bitstream. */
  106. }VC1DecMetaData;
  107. /*
  108. * Decoder instance is used for identifying subsequent calls to api
  109. * functions.
  110. */
  111. typedef const void *VC1DecInst;
  112. /*
  113. * Decoder input structure.
  114. * This is a container to pass data to the Decoder.
  115. */
  116. typedef struct
  117. {
  118. const u8* pStream; /* Pointer to the video stream. Decoder does
  119. not change the contents of stream buffer.*/
  120. u32 streamBusAddress; /* DMA bus address of the input stream */
  121. u32 streamSize; /* Number of bytes in the stream buffer.*/
  122. u32 picId; /**< User-defined identifier to bind into
  123. * decoded picture. */
  124. } VC1DecInput;
  125. typedef struct
  126. {
  127. u32 dataLeft;
  128. u8 *pStreamCurrPos;
  129. u32 strmCurrBusAddress;
  130. } VC1DecOutput;
  131. /*
  132. * Decoder output structure.
  133. * This is a container for Decoder output data like decoded picture and its
  134. * dimensions.
  135. */
  136. typedef struct
  137. {
  138. u32 frameWidth;
  139. u32 frameHeight;
  140. u32 codedWidth;
  141. u32 codedHeight;
  142. const u8 *pOutputPicture;
  143. u32 outputPictureBusAddress;
  144. u32 keyPicture;
  145. u32 picId;
  146. u32 rangeRedFrm;
  147. u32 rangeMapYFlag;
  148. u32 rangeMapY;
  149. u32 rangeMapUvFlag;
  150. u32 rangeMapUv;
  151. u32 interlaced;
  152. u32 fieldPicture;
  153. u32 topField;
  154. u32 firstField;
  155. u32 repeatFirstField;
  156. u32 repeatFrameCount;
  157. u32 numberOfErrMBs;
  158. u32 anchorPicture;
  159. } VC1DecPicture;
  160. /* Version information. */
  161. typedef struct
  162. {
  163. u32 major; /* Decoder API major version number. */
  164. u32 minor; /* Decoder API minor version number. */
  165. } VC1DecApiVersion;
  166. typedef struct
  167. {
  168. u32 swBuild; /* Software build ID */
  169. u32 hwBuild; /* Hardware build ID */
  170. DecHwConfig hwConfig; /* hardware supported configuration */
  171. } VC1DecBuild;
  172. /* decoder output picture format */
  173. typedef enum
  174. {
  175. VC1DEC_SEMIPLANAR_YUV420 = 0x020001,
  176. VC1DEC_TILED_YUV420 = 0x020002
  177. } VC1DecOutFormat;
  178. typedef struct
  179. {
  180. VC1DecOutFormat outputFormat; /* format of the output picture */
  181. u32 maxCodedWidth;
  182. u32 maxCodedHeight;
  183. u32 codedWidth;
  184. u32 codedHeight;
  185. u32 parWidth;
  186. u32 parHeight;
  187. u32 frameRateNumerator;
  188. u32 frameRateDenominator;
  189. u32 interlacedSequence;
  190. u32 multiBuffPpSize;
  191. } VC1DecInfo;
  192. /*------------------------------------------------------------------------------
  193. Prototypes of Decoder API functions
  194. ------------------------------------------------------------------------------*/
  195. VC1DecApiVersion VC1DecGetAPIVersion(void);
  196. VC1DecBuild VC1DecGetBuild(void);
  197. VC1DecRet VC1DecInit( VC1DecInst* pDecInst, const VC1DecMetaData* pMetaData,
  198. u32 useVideoFreezeConcealment,
  199. u32 numFrameBuffers );
  200. VC1DecRet VC1DecDecode( VC1DecInst decInst,
  201. const VC1DecInput* pInput,
  202. VC1DecOutput* pOutput);
  203. void VC1DecRelease(VC1DecInst decInst);
  204. VC1DecRet VC1DecGetInfo(VC1DecInst decInst, VC1DecInfo * pDecInfo);
  205. VC1DecRet VC1DecUnpackMetaData( const u8 *pBuffer, u32 bufferSize,
  206. VC1DecMetaData *pMetaData );
  207. VC1DecRet VC1DecNextPicture(VC1DecInst decInst,
  208. VC1DecPicture *pPicture,
  209. u32 endOfStream);
  210. VC1DecRet VC1DecPeek(VC1DecInst decInst, VC1DecPicture *pPicture);
  211. /*------------------------------------------------------------------------------
  212. Prototype of the API trace funtion. Traces all API entries and returns.
  213. This must be implemented by the application using the decoder API!
  214. Argument:
  215. string - trace message, a null terminated string
  216. ------------------------------------------------------------------------------*/
  217. void VC1DecTrace(const char *string);
  218. #ifdef __cplusplus
  219. }
  220. #endif
  221. #endif /* VC1DECAPI_H */