h264decapi.h 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  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 H.264 Decoder
  17. --
  18. --------------------------------------------------------------------------------
  19. --
  20. -- Version control information, please leave untouched.
  21. --
  22. -- $RCSfile: h264decapi.h,v $
  23. -- $Date: 2010/02/17 13:28:46 $
  24. -- $Revision: 1.9 $
  25. --
  26. ------------------------------------------------------------------------------*/
  27. #ifndef __H264DECAPI_H__
  28. #define __H264DECAPI_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 H264DecRet_
  40. {
  41. H264DEC_OK = 0,
  42. H264DEC_STRM_PROCESSED = 1,
  43. H264DEC_PIC_RDY = 2,
  44. H264DEC_PIC_DECODED = 3,
  45. H264DEC_HDRS_RDY = 4,
  46. H264DEC_ADVANCED_TOOLS = 5,
  47. H264DEC_PENDING_FLUSH = 6,
  48. H264DEC_PARAM_ERROR = -1,
  49. H264DEC_STRM_ERROR = -2,
  50. H264DEC_NOT_INITIALIZED = -3,
  51. H264DEC_MEMFAIL = -4,
  52. H264DEC_INITFAIL = -5,
  53. H264DEC_HDRS_NOT_RDY = -6,
  54. H264DEC_STREAM_NOT_SUPPORTED = -8,
  55. H264DEC_HW_RESERVED = -254,
  56. H264DEC_HW_TIMEOUT = -255,
  57. H264DEC_HW_BUS_ERROR = -256,
  58. H264DEC_SYSTEM_ERROR = -257,
  59. H264DEC_DWL_ERROR = -258,
  60. H264DEC_EVALUATION_LIMIT_EXCEEDED = -999,
  61. H264DEC_FORMAT_NOT_SUPPORTED = -1000
  62. } H264DecRet;
  63. /* decoder output picture format */
  64. typedef enum H264DecOutFormat_
  65. {
  66. H264DEC_SEMIPLANAR_YUV420 = 0x020001,
  67. H264DEC_TILED_YUV420 = 0x020002,
  68. H264DEC_YUV400 = 0x080000
  69. } H264DecOutFormat;
  70. /* Decoder instance */
  71. typedef const void *H264DecInst;
  72. /* Input structure */
  73. typedef struct H264DecInput_
  74. {
  75. u8 *pStream; /* Pointer to the input */
  76. u32 streamBusAddress; /* DMA bus address of the input stream */
  77. u32 dataLen; /* Number of bytes to be decoded */
  78. u32 picId; /* Identifier for the picture to be decoded */
  79. } H264DecInput;
  80. /* Output structure */
  81. typedef struct H264DecOutput_
  82. {
  83. u8 *pStrmCurrPos; /* Pointer to stream position where decoding ended */
  84. u32 strmCurrBusAddress; /* DMA bus address location where the decoding ended */
  85. u32 dataLeft; /* how many bytes left undecoded */
  86. } H264DecOutput;
  87. /* cropping info */
  88. typedef struct H264CropParams_
  89. {
  90. u32 cropLeftOffset;
  91. u32 cropOutWidth;
  92. u32 cropTopOffset;
  93. u32 cropOutHeight;
  94. } H264CropParams;
  95. /* Output structure for H264DecNextPicture */
  96. typedef struct H264DecPicture_
  97. {
  98. u32 picWidth; /* pixels width of the picture as stored in memory */
  99. u32 picHeight; /* pixel height of the picture as stored in memory */
  100. H264CropParams cropParams; /* cropping parameters */
  101. const u32 *pOutputPicture; /* Pointer to the picture */
  102. u32 outputPictureBusAddress; /* DMA bus address of the output picture buffer */
  103. u32 picId; /* Identifier of the picture to be displayed */
  104. u32 isIdrPicture; /* Indicates if picture is an IDR picture */
  105. u32 nbrOfErrMBs; /* Number of concealed MB's in the picture */
  106. u32 interlaced; /* non-zero for interlaced picture */
  107. u32 fieldPicture; /* non-zero if interlaced and only one field present */
  108. u32 topField; /* if only one field, non-zero signals TOP field otherwise BOTTOM */
  109. } H264DecPicture;
  110. /* stream info filled by H264DecGetInfo */
  111. typedef struct H264DecInfo_
  112. {
  113. u32 picWidth; /* decoded picture width in pixels */
  114. u32 picHeight; /* decoded picture height in pixels */
  115. u32 videoRange; /* samples' video range */
  116. u32 matrixCoefficients;
  117. H264CropParams cropParams; /* display cropping information */
  118. H264DecOutFormat outputFormat; /* format of the output picture */
  119. u32 sarWidth; /* sample aspect ratio */
  120. u32 sarHeight; /* sample aspect ratio */
  121. u32 monoChrome; /* is sequence monochrome */
  122. u32 interlacedSequence; /* is sequence interlaced */
  123. u32 picBuffSize; /* number of picture buffers allocated&used by decoder */
  124. u32 multiBuffPpSize; /* number of picture buffers needed in decoder+postprocessor multibuffer mode */
  125. } H264DecInfo;
  126. /* Version information */
  127. typedef struct H264DecApiVersion_
  128. {
  129. u32 major; /* API major version */
  130. u32 minor; /* API minor version */
  131. } H264DecApiVersion;
  132. typedef struct H264DecBuild_
  133. {
  134. u32 swBuild; /* Software build ID */
  135. u32 hwBuild; /* Hardware build ID */
  136. DecHwConfig hwConfig; /* hardware supported configuration */
  137. } H264DecBuild;
  138. /*------------------------------------------------------------------------------
  139. Prototypes of Decoder API functions
  140. ------------------------------------------------------------------------------*/
  141. H264DecApiVersion H264DecGetAPIVersion(void);
  142. H264DecBuild H264DecGetBuild(void);
  143. H264DecRet H264DecInit(H264DecInst * pDecInst, u32 noOutputReordering,
  144. u32 useVideoFreezeConcealment,
  145. u32 useDisplaySmoothing);
  146. void H264DecRelease(H264DecInst decInst);
  147. H264DecRet H264DecDecode(H264DecInst decInst,
  148. const H264DecInput * pInput,
  149. H264DecOutput * pOutput);
  150. H264DecRet H264DecNextPicture(H264DecInst decInst,
  151. H264DecPicture * pOutput, u32 endOfStream);
  152. H264DecRet H264DecGetInfo(H264DecInst decInst, H264DecInfo * pDecInfo);
  153. H264DecRet H264DecPeek(H264DecInst decInst, H264DecPicture * pOutput);
  154. /*------------------------------------------------------------------------------
  155. Prototype of the API trace funtion. Traces all API entries and returns.
  156. This must be implemented by the application using the decoder API!
  157. Argument:
  158. string - trace message, a null terminated string
  159. ------------------------------------------------------------------------------*/
  160. void H264DecTrace(const char *string);
  161. #ifdef __cplusplus
  162. }
  163. #endif
  164. #endif /* __H264DECAPI_H__ */