ppapi.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  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 : The video post processor API
  17. --
  18. --------------------------------------------------------------------------------
  19. --
  20. -- Version control information, please leave untouched.
  21. --
  22. -- $RCSfile: ppapi.h,v $
  23. -- $Date: 2010/11/22 07:57:04 $
  24. -- $Revision: 1.22 $
  25. --
  26. ------------------------------------------------------------------------------*/
  27. #ifndef __PPAPI_H__
  28. #define __PPAPI_H__
  29. #ifdef __cplusplus
  30. extern "C"
  31. {
  32. #endif
  33. #include "basetype.h"
  34. #include "decapicommon.h"
  35. #define PP_PIPELINE_DISABLED 0U
  36. #define PP_PIPELINED_DEC_TYPE_H264 1U
  37. #define PP_PIPELINED_DEC_TYPE_MPEG4 2U
  38. #define PP_PIPELINED_DEC_TYPE_JPEG 3U
  39. #define PP_PIPELINED_DEC_TYPE_VC1 4U
  40. #define PP_PIPELINED_DEC_TYPE_MPEG2 5U
  41. #define PP_PIPELINED_DEC_TYPE_VP6 6U
  42. #define PP_PIPELINED_DEC_TYPE_AVS 7U
  43. #define PP_PIPELINED_DEC_TYPE_RV 8U
  44. #define PP_PIPELINED_DEC_TYPE_VP8 9U
  45. #define PP_PIPELINED_DEC_TYPE_WEBP 10U
  46. #define PP_PIX_FMT_YCBCR_4_0_0 0x080000U
  47. #define PP_PIX_FMT_YCBCR_4_2_2_INTERLEAVED 0x010001U
  48. #define PP_PIX_FMT_YCRYCB_4_2_2_INTERLEAVED 0x010005U
  49. #define PP_PIX_FMT_CBYCRY_4_2_2_INTERLEAVED 0x010006U
  50. #define PP_PIX_FMT_CRYCBY_4_2_2_INTERLEAVED 0x010007U
  51. #define PP_PIX_FMT_YCBCR_4_2_2_SEMIPLANAR 0x010002U
  52. #define PP_PIX_FMT_YCBCR_4_2_2_TILED_4X4 0x010008U
  53. #define PP_PIX_FMT_YCRYCB_4_2_2_TILED_4X4 0x010009U
  54. #define PP_PIX_FMT_CBYCRY_4_2_2_TILED_4X4 0x01000AU
  55. #define PP_PIX_FMT_CRYCBY_4_2_2_TILED_4X4 0x01000BU
  56. #define PP_PIX_FMT_YCBCR_4_4_0 0x010004U
  57. #define PP_PIX_FMT_YCBCR_4_2_0_PLANAR 0x020000U
  58. #define PP_PIX_FMT_YCBCR_4_2_0_SEMIPLANAR 0x020001U
  59. #define PP_PIX_FMT_YCBCR_4_2_0_TILED 0x020002U
  60. #define PP_PIX_FMT_YCBCR_4_1_1_SEMIPLANAR 0x100001U
  61. #define PP_PIX_FMT_YCBCR_4_4_4_SEMIPLANAR 0x200001U
  62. #define PP_PIX_FMT_RGB16_CUSTOM 0x040000U
  63. #define PP_PIX_FMT_RGB16_5_5_5 0x040001U
  64. #define PP_PIX_FMT_RGB16_5_6_5 0x040002U
  65. #define PP_PIX_FMT_BGR16_5_5_5 0x040003U
  66. #define PP_PIX_FMT_BGR16_5_6_5 0x040004U
  67. #define PP_PIX_FMT_RGB32_CUSTOM 0x041000U
  68. #define PP_PIX_FMT_RGB32 0x041001U
  69. #define PP_PIX_FMT_BGR32 0x041002U
  70. #define PP_YCBCR2RGB_TRANSFORM_CUSTOM 0U
  71. #define PP_YCBCR2RGB_TRANSFORM_BT_601 1U
  72. #define PP_YCBCR2RGB_TRANSFORM_BT_709 2U
  73. #define PP_ROTATION_NONE 0U
  74. #define PP_ROTATION_RIGHT_90 1U
  75. #define PP_ROTATION_LEFT_90 2U
  76. #define PP_ROTATION_HOR_FLIP 3U
  77. #define PP_ROTATION_VER_FLIP 4U
  78. #define PP_ROTATION_180 5U
  79. #define PP_PIC_FRAME_OR_TOP_FIELD 0U
  80. #define PP_PIC_BOT_FIELD 1U
  81. #define PP_PIC_TOP_AND_BOT_FIELD 2U
  82. #define PP_PIC_TOP_AND_BOT_FIELD_FRAME 3U
  83. #define PP_PIC_TOP_FIELD_FRAME 4U
  84. #define PP_PIC_BOT_FIELD_FRAME 5U
  85. #define PP_MAX_MULTIBUFFER 17
  86. typedef const void *PPInst;
  87. typedef enum PPResult_
  88. {
  89. PP_OK = 0,
  90. PP_PARAM_ERROR = -1,
  91. PP_MEMFAIL = -4,
  92. PP_SET_IN_SIZE_INVALID = -64,
  93. PP_SET_IN_ADDRESS_INVALID = -65,
  94. PP_SET_IN_FORMAT_INVALID = -66,
  95. PP_SET_CROP_INVALID = -67,
  96. PP_SET_ROTATION_INVALID = -68,
  97. PP_SET_OUT_SIZE_INVALID = -69,
  98. PP_SET_OUT_ADDRESS_INVALID = -70,
  99. PP_SET_OUT_FORMAT_INVALID = -71,
  100. PP_SET_VIDEO_ADJUST_INVALID = -72,
  101. PP_SET_RGB_BITMASK_INVALID = -73,
  102. PP_SET_FRAMEBUFFER_INVALID = -74,
  103. PP_SET_MASK1_INVALID = -75,
  104. PP_SET_MASK2_INVALID = -76,
  105. PP_SET_DEINTERLACE_INVALID = -77,
  106. PP_SET_IN_STRUCT_INVALID = -78,
  107. PP_SET_IN_RANGE_MAP_INVALID = -79,
  108. PP_SET_ABLEND_UNSUPPORTED = -80,
  109. PP_SET_DEINTERLACING_UNSUPPORTED = -81,
  110. PP_SET_DITHERING_UNSUPPORTED = -82,
  111. PP_SET_SCALING_UNSUPPORTED = -83,
  112. PP_BUSY = -128,
  113. PP_HW_BUS_ERROR = -256,
  114. PP_HW_TIMEOUT = -257,
  115. PP_DWL_ERROR = -258,
  116. PP_SYSTEM_ERROR = -259,
  117. PP_DEC_COMBINED_MODE_ERROR = -512,
  118. PP_DEC_RUNTIME_ERROR = -513
  119. } PPResult;
  120. typedef struct PPInImage_
  121. {
  122. u32 pixFormat;
  123. u32 picStruct;
  124. u32 videoRange;
  125. u32 width;
  126. u32 height;
  127. u32 bufferBusAddr;
  128. u32 bufferCbBusAddr;
  129. u32 bufferCrBusAddr;
  130. u32 bufferBusAddrBot;
  131. u32 bufferBusAddrChBot;
  132. u32 vc1MultiResEnable;
  133. u32 vc1RangeRedFrm;
  134. u32 vc1RangeMapYEnable;
  135. u32 vc1RangeMapYCoeff;
  136. u32 vc1RangeMapCEnable;
  137. u32 vc1RangeMapCCoeff;
  138. } PPInImage;
  139. typedef struct PPOutImage_
  140. {
  141. u32 pixFormat;
  142. u32 width;
  143. u32 height;
  144. u32 bufferBusAddr;
  145. u32 bufferChromaBusAddr;
  146. } PPOutImage;
  147. typedef struct PPRgbTransform_
  148. {
  149. u32 a;
  150. u32 b;
  151. u32 c;
  152. u32 d;
  153. u32 e;
  154. } PPRgbTransform;
  155. typedef struct PPRgbBitmask_
  156. {
  157. u32 maskR;
  158. u32 maskG;
  159. u32 maskB;
  160. u32 maskAlpha;
  161. } PPRgbBitmask;
  162. typedef struct PPOutRgb_
  163. {
  164. u32 rgbTransform;
  165. i32 contrast;
  166. i32 brightness;
  167. i32 saturation;
  168. u32 alpha;
  169. u32 transparency;
  170. PPRgbTransform rgbTransformCoeffs;
  171. PPRgbBitmask rgbBitmask;
  172. u32 ditheringEnable;
  173. } PPOutRgb;
  174. typedef struct PPInCropping_
  175. {
  176. u32 enable;
  177. /* NOTE: these are coordinates relative to the input picture */
  178. u32 originX;
  179. u32 originY;
  180. u32 height;
  181. u32 width;
  182. } PPInCropping;
  183. typedef struct PPOutMask1_
  184. {
  185. u32 enable;
  186. /* NOTE: these are coordinates relative to the output image */
  187. i32 originX;
  188. i32 originY;
  189. u32 height;
  190. u32 width;
  191. u32 alphaBlendEna;
  192. u32 blendComponentBase;
  193. /* following parameters are to be set nonzero *only* if HW
  194. * supports alpha blend cropping. */
  195. i32 blendOriginX;
  196. i32 blendOriginY;
  197. u32 blendWidth;
  198. u32 blendHeight;
  199. } PPOutMask1;
  200. typedef struct PPOutMask2_
  201. {
  202. u32 enable;
  203. /* NOTE: these are coordinates relative to the output image */
  204. i32 originX;
  205. i32 originY;
  206. u32 height;
  207. u32 width;
  208. u32 alphaBlendEna;
  209. u32 blendComponentBase;
  210. /* following parameters are to be set nonzero *only* if HW
  211. * supports alpha blend cropping. */
  212. i32 blendOriginX;
  213. i32 blendOriginY;
  214. u32 blendWidth;
  215. u32 blendHeight;
  216. } PPOutMask2;
  217. typedef struct PPOutFrameBuffer_
  218. {
  219. u32 enable;
  220. /* NOTE: these are coordinates relative to the framebuffer */
  221. i32 writeOriginX;
  222. i32 writeOriginY;
  223. u32 frameBufferWidth;
  224. u32 frameBufferHeight;
  225. } PPOutFrameBuffer;
  226. typedef struct PPInRotation_
  227. {
  228. u32 rotation;
  229. } PPInRotation;
  230. typedef struct PPOutDeinterlace_
  231. {
  232. u32 enable;
  233. } PPOutDeinterlace;
  234. typedef struct PPConfig_
  235. {
  236. PPInImage ppInImg;
  237. PPInCropping ppInCrop;
  238. PPInRotation ppInRotation;
  239. PPOutImage ppOutImg;
  240. PPOutRgb ppOutRgb;
  241. PPOutMask1 ppOutMask1;
  242. PPOutMask2 ppOutMask2;
  243. PPOutFrameBuffer ppOutFrmBuffer;
  244. PPOutDeinterlace ppOutDeinterlace;
  245. } PPConfig;
  246. /* Version information */
  247. typedef struct PPApiVersion_
  248. {
  249. u32 major; /* PP API major version */
  250. u32 minor; /* PP API minor version */
  251. } PPApiVersion;
  252. typedef struct PPBuild_
  253. {
  254. u32 swBuild; /* Software build ID */
  255. u32 hwBuild; /* Hardware build ID */
  256. DecHwConfig hwConfig; /* hardware supported configuration */
  257. } PPBuild;
  258. typedef struct PPOutput_
  259. {
  260. u32 bufferBusAddr;
  261. u32 bufferChromaBusAddr;
  262. } PPOutput;
  263. typedef struct PPOutputBuffers_
  264. {
  265. u32 nbrOfBuffers;
  266. PPOutput ppOutputBuffers[PP_MAX_MULTIBUFFER];
  267. } PPOutputBuffers;
  268. /*------------------------------------------------------------------------------
  269. Prototypes of PP API functions
  270. ------------------------------------------------------------------------------*/
  271. PPResult PPInit(PPInst * pPostPInst);
  272. PPResult PPDecCombinedModeEnable(PPInst postPInst, const void *pDecInst,
  273. u32 decType);
  274. PPResult PPDecCombinedModeDisable(PPInst postPInst, const void *pDecInst);
  275. PPResult PPGetConfig(PPInst postPInst, PPConfig * pPpConf);
  276. PPResult PPSetConfig(PPInst postPInst, PPConfig * pPpConf);
  277. PPResult PPDecSetMultipleOutput(PPInst postPInst,
  278. const PPOutputBuffers * pBuffers);
  279. PPResult PPGetNextOutput(PPInst postPInst, PPOutput * pOut);
  280. void PPRelease(PPInst pPpInst);
  281. PPResult PPGetResult(PPInst postPInst);
  282. PPApiVersion PPGetAPIVersion(void);
  283. PPBuild PPGetBuild(void);
  284. void PPTrace(const char *string);
  285. #ifdef __cplusplus
  286. }
  287. #endif
  288. #endif /* __PPAPI_H__ */