gxvadd.h
上传用户:wstnjxml
上传日期:2014-04-03
资源大小:7248k
文件大小:15k
源码类别:

Windows CE

开发平台:

C/C++

  1. /******************************************************************************
  2. ** Copyright (c) 2004, Intel Corporation
  3. ** All rights reserved.
  4. ** 
  5. ** Redistribution and use in source and binary forms, with or without 
  6. ** modification, are permitted provided that the following conditions are met:
  7. ** 
  8. ** - Redistributions of source code must retain the above copyright notice, this 
  9. **   list of conditions and the following disclaimer. 
  10. ** - Redistributions in binary form must reproduce the above copyright notice, 
  11. **   this list of conditions and the following disclaimer in the documentation 
  12. **   and/or other materials provided with the distribution. 
  13. ** - Neither the name of the Intel Corporation nor the names of its contributors
  14. **   may be used to endorse or promote products derived from this software without
  15. **   specific prior written permission. 
  16. ** 
  17. ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  18. ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  19. ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  20. ** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
  21. ** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  22. ** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  23. ** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  24. ** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  25. ** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  26. ** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  27. ** POSSIBILITY OF SUCH DAMAGE.
  28. ******************************************************************************/
  29. /******************************************************************************
  30. **
  31. **  FILENAME:   gxvadd.h
  32. **
  33. **  DESCRIPTION:   GX Video Decode Acceleration and display API
  34. **
  35. ******************************************************************************/
  36. #ifndef _GXVADD_H_
  37. #define _GXVADD_H_
  38. /****************************************************************************/
  39. /*********** External Interface for the GX video acceleration API **********/
  40. /****************************************************************************/
  41. #ifndef GXAPI
  42. #if defined(UNDER_CE)
  43.         #define GXAPI __stdcall
  44. #else
  45.         #define GXAPI
  46. #endif
  47. #endif 
  48. /************************************************************ Standard Types */
  49. typedef enum tag_gx_bool
  50. {
  51.         GX_FALSE,
  52.         GX_TRUE
  53. } gx_bool, *gx_pbool;
  54. typedef unsigned char           gx_uint8;
  55. typedef unsigned short          gx_uint16;
  56. typedef unsigned long           gx_uint32;
  57. typedef signed short            gx_int16;
  58. typedef signed long             gx_int32;
  59. typedef void*                   gx_pvoid;
  60. typedef gx_uint32               SMSurface;
  61. /*****************************************************************************/
  62. /***************************** GXVA Hardware commands ***********************/
  63. /*****************************************************************************/
  64. /*********************************************** Motion Compensation Commands */
  65. #define GXVA_CMD_MC_OPP_TYPE            (0x00000000)
  66. #define GXVA_CMD_FETCH_PRED_B           (0x08000000)
  67. #define GXVA_CMD_IDCT_MODE              (0x10000000)
  68. #define GXVA_CMD_IMAGE_WRITE            (0x18000000)
  69. #define GXVA_CMD_FETCH_PRED_A           (0x80000000)
  70. #define GXVA_CMD_MASK                   (0xf8000000)
  71. /* Motion Comp Operation Type (GXVA_CMD_MC_OPP_TYPE) */
  72. #define GXVA_MC_TYPE_COL_PLANE_MASK     (0x00000003)
  73. #define GXVA_MC_TYPE_COL_PLANE_Y        (0x00000000)
  74. #define GXVA_MC_TYPE_COL_PLANE_U        (0x00000001)
  75. #define GXVA_MC_TYPE_COL_PLANE_V        (0x00000002)
  76. #define GXVA_MC_TYPE_BLK_WIDTH_MASK     (0x0000000c)
  77. #define GXVA_MC_TYPE_BLK_WIDTH_4        (0x00000000)
  78. #define GXVA_MC_TYPE_BLK_WIDTH_8        (0x00000004)
  79. #define GXVA_MC_TYPE_BLK_WIDTH_16       (0x00000008)
  80. #define GXVA_MC_TYPE_BLK_HGHT_MASK      (0x00000030)
  81. #define GXVA_MC_TYPE_BLK_HGHT_4         (0x00000000)
  82. #define GXVA_MC_TYPE_BLK_HGHT_8         (0x00000010)
  83. #define GXVA_MC_TYPE_BLK_HGHT_16        (0x00000020)
  84. #define GXVA_MC_TYPE_INTR_RND_MODE      (0x00000040)
  85. #define GXVA_MC_TYPE_AVR_RND_MODE       (0x00000080)
  86. #define GXVA_MC_TYPE_QUARTR_PIX_ACC     (0x00000100)
  87. #define GXVA_MC_TYPE_WMV_FILTER_MODE    (0x00000400) 
  88. #define GXVA_MC_TYPE_QUARTR_PIX_MODE    (0x00000200)
  89. /* Fetch Prediction A (GXVA_CMD_FETCH_PRED_A)*/
  90. #define GXVA_FETCH_A_PREDX_MASK         (0x00003fff)
  91. #define GXVA_FETCH_A_PREDX_SHIFT        (0)
  92. #define GXVA_FETCH_A_PREDY_MASK         (0x0fffc000)
  93. #define GXVA_FETCH_A_PREDY_SHIFT        (14)
  94. #define GXVA_FETCH_A_SRC_SEL_MASK       (0x30000000)
  95. #define GXVA_FETCH_A_SRC_SEL_REF1       (0x00000000)
  96. #define GXVA_FETCH_A_SRC_SEL_REF2       (0x10000000)
  97. #define GXVA_FETCH_A_SRC_SEL_OUT        (0x20000000)
  98. #define GXVA_FETCH_A_SRC_SEL_SHIFT      (28)
  99. #define GXVA_FETCH_A_FIRST_PRED         (0x40000000)
  100. /* Fetch Prediction B (GXVA_CMD_FETCH_PRED_B)*/
  101. #define GXVA_FETCH_B_IP_FIELD_MODE      (0x00000001)
  102. #define GXVA_FETCH_B_ACC_FIELD_MODE     (0x00000002)
  103. #define GXVA_FETCH_B_ACC_FIELD_SLCT     (0x00000004)
  104. #define GXVA_FETCH_B_ACC_Y_POS_MASK     (0x00000018)
  105. #define GXVA_FETCH_B_ACC_Y_POS_0        (0x00000000)
  106. #define GXVA_FETCH_B_ACC_Y_POS_4        (0x00000008)
  107. #define GXVA_FETCH_B_ACC_Y_POS_8        (0x00000010)
  108. #define GXVA_FETCH_B_ACC_Y_POS_12       (0x00000018)
  109. #define GXVA_FETCH_B_ACC_X_POS_MASK     (0x00000060)
  110. #define GXVA_FETCH_B_ACC_X_POS_0        (0x00000000)
  111. #define GXVA_FETCH_B_ACC_X_POS_4        (0x00000020)
  112. #define GXVA_FETCH_B_ACC_X_POS_8        (0x00000040)
  113. #define GXVA_FETCH_B_ACC_X_POS_12       (0x00000060)
  114. /* IDCT Mode (GXVA_CMD_IDCT_MODE) */
  115. #define GXVA_IDCT_MODE_FIELD            (0x00000001)
  116. #define GXVA_IDCT_MODE_INTRA            (0x00000002)
  117. #define GXVA_IDCT_MODE_BLK_SELX_MASK    (0x0000000c)
  118. #define GXVA_IDCT_MODE_BLK_SELX_SHIFT   (2)
  119. #define GXVA_IDCT_MODE_BLK_SELY_MASK    (0x00000030)
  120. #define GXVA_IDCT_MODE_BLK_SELY_SHIFT   (4)
  121. /* defines for simplicity in 8x8 mode */
  122. #define GXVA_IDCT_MODE_BLK_TOP_LEFT     (0x00000000)
  123. #define GXVA_IDCT_MODE_BLK_TOP_RGHT     (0x00000008)
  124. #define GXVA_IDCT_MODE_BLK_BOT_LEFT     (0x00000020)
  125. #define GXVA_IDCT_MODE_BLK_BOT_RGHT     (0x00000028)
  126. #define GXVA_IDCT_MODE_BLK_BOT_FIELD_LEFT (0x00000010)
  127. #define GXVA_IDCT_MODE_BLK_BOT_FIELD_RGHT (0x00000018)
  128. #define GXVA_IDCT_MODE_DCOFFSET         (0x00000080)
  129. #define GXVA_IDCT_BLK_SIZEX_4           (0x00000100)
  130. #define GXVA_IDCT_BLK_SIZEX_8           (0x00000000)
  131. #define GXVA_IDCT_BLK_SIZEY_4           (0x00000200)
  132. #define GXVA_IDCT_BLK_SIZEY_8           (0x00000000)
  133. /* Image Write (GXVA_CMD_IMAGE_WRITE) */
  134. #define GXVA_IMAGE_WRITE_X_MASK         (0x000007ff)
  135. #define GXVA_IMAGE_WRITE_X_SHIFT        (0)
  136. #define GXVA_IMAGE_WRITE_Y_MASK         (0x003ff800)
  137. #define GXVA_IMAGE_WRITE_Y_SHIFT        (11)
  138. #define GXVA_IMAGE_WRITE_FIELD          (0x00400000)
  139. #define GXVA_IMAGE_WRITE_WIDTH_MASK     (0x01800000)
  140. #define GXVA_IMAGE_WRITE_WIDTH_4        (0x00000000)
  141. #define GXVA_IMAGE_WRITE_WIDTH_8        (0x00800000)
  142. #define GXVA_IMAGE_WRITE_WIDTH_16       (0x01000000)
  143. #define GXVA_IMAGE_WRITE_HGHT_MASK      (0x06000000)
  144. #define GXVA_IMAGE_WRITE_HGHT_4         (0x00000000)
  145. #define GXVA_IMAGE_WRITE_HGHT_8         (0x02000000)
  146. #define GXVA_IMAGE_WRITE_HGHT_16        (0x04000000)
  147. /* End of Frame (GXVA_CMD_END_OF_FRAME) */
  148. /*****************************************************************************/
  149. /***************************** GXVA API Defines *****************************/
  150. /*****************************************************************************/
  151. typedef enum {
  152.         GXVAError_OK = 0,
  153.         GXVAError_GenericError,
  154.         GXVAError_InvalidParameter,
  155.         GXVAError_IncorrectSurfaceFormat,
  156.         GXVAError_OutOfMemory,
  157.         GXVAError_HardwareNotAvailable,
  158.         GXVAError_NotInitialized,
  159.         GXVAError_WriteTimedOut,
  160.         GXVAError_SurfaceUnavailable,
  161. } GXVAError;
  162. /* IZZ mode */
  163. typedef enum _GXVA_IZZMODE_
  164. {
  165.         GXVA_ZigZagScanOrder  = 0,
  166.         GXVA_AltVertScanOrder = 1,
  167.         GXVA_AltHorzScanOrder = 2,
  168.         GXVA_RasterScanOrder  = 3,
  169. } GXVA_IZZMODE;
  170. /* Destination formations of the colour space convertor */
  171. typedef enum 
  172. {
  173.         GXVA_SURF_FORMAT_420,
  174.         GXVA_SURF_FORMAT_422,
  175.         GXVA_SURF_FORMAT_RGB24,
  176. } GXVA_SURF_FORMAT;
  177. /*****************************************************************************/
  178. /********************** GXVA API Function Prototypes ************************/
  179. /*****************************************************************************/
  180. #include "gxcomp.h"
  181. //Frame Management (Stream level)
  182. GXVAError GXAPI GXVA_FrameDimensions(gx_uint32 ui32Height, gx_uint32 ui32Width);
  183. GXVAError GXAPI GXVA_FrameAllocate(SMSurface *phFrames, gx_uint32 ui32FrameCnt);
  184. GXVAError GXAPI GXVA_FrameFree(SMSurface *phFrames, gx_uint32 ui32FrameCnt);
  185. //Frame Control (Per Frame)
  186. GXVAError GXAPI GXVA_BeginFrame(SMSurface hOutputSurface, gx_bool bEnableIDCT);
  187. GXVAError GXAPI GXVA_EndFrame(gx_bool bSyncHardware);
  188. GXVAError GXAPI GXVA_SetReferenceFrameAddress(gx_uint32 ui32FrameNo, SMSurface hSurface);
  189. //Frame Access
  190. GXVAError GXAPI GXVA_FrameBeginAccess(SMSurface hSurface, 
  191.          gx_uint8 **ppuint8FrameAddress,
  192.          gx_uint32 *pui32FrameStride,
  193.          gx_bool bSyncHardware);
  194. GXVAError GXAPI GXVA_FrameEndAccess(SMSurface hSurface);
  195. //Frame decode
  196. GXVAError GXAPI GXVA_WriteIZZBlock(gx_int32 *pi32Data, gx_uint32 ui32Count);
  197. GXVAError GXAPI GXVA_WriteIZZData(gx_int32 i32Coeff, gx_uint32 ui32Index, gx_bool bEOB);
  198. GXVAError GXAPI GXVA_SetIZZMode(GXVA_IZZMODE eMode);
  199. GXVAError GXAPI GXVA_WriteResidualDifferenceData(gx_int16 *pi16Data, gx_uint32 ui32Count); 
  200. GXVAError GXAPI GXVA_WriteMCCmdData(gx_uint32 ui32Data);
  201. //Frame format conversion*/
  202. GXVAError GXAPI GXVA_FCFrameAllocate(SMSurface *phFrame, GXVA_SURF_FORMAT eFormat);
  203. GXVAError GXAPI GXVA_FrameConvert(SMSurface hDestSurface, SMSurface hSourSurface);                                        
  204. // General, defined in all API's
  205. GXVAError GXAPI GXVA_Initialize();
  206. GXVAError GXAPI GXVA_Deinitialize();
  207. GXVAError GXAPI GXVA_Reset();
  208. /******************************************** Internal debug only functions */
  209. gx_bool GXAPI GXVA_SimScriptOpen(char *pszFileName, int Wipe);
  210. void GXAPI GXVA_SimScriptClose();
  211. void GXAPI GXVA_SimScriptFlush();
  212. void GXAPI GXVA_SimScriptLog(char *str,...);
  213. void GXAPI GXVA_SetScriptMode(gx_uint32 ui32ScriptMode);
  214. void GXAPI GXVA_GetStats(gx_uint32 *pui32IDCTAccessCount,
  215.                          gx_uint32 *pui32RegAccessCount,
  216.                          gx_uint32 *pui32CmdCount);
  217. void GXAPI GXVA_GetSlavePortStats(gx_uint32 ui32SlavePortType,
  218.                                   gx_uint32 *pui32CmdCount,
  219.                                   gx_uint32 *pui32CmdPolls,
  220.                                   gx_uint32 *pui32CmdTrys,
  221.                                   gx_uint32 *pui32CmdOverflows);
  222. /*****************************************************************************/
  223. /******************************* PDP Overlay Defines *************************/
  224. /*****************************************************************************/
  225. typedef enum {
  226.         VDISPError_OK = 0,
  227.         VDISPError_GenericError,
  228.         VDISPError_InvalidParameter,
  229.         VDISPError_IncorrectSurfaceFormat,
  230.         VDISPError_HardwareNotAvailable,
  231.         VDISPError_NotInitialised,
  232. } VDISPError;
  233. typedef struct _VDISP_Tag_CSCCoeffs
  234. {
  235.         gx_uint16       ui16RyCoeff;
  236.         gx_uint16       ui16RuCoeff;
  237.         gx_uint16       ui16RvCoeff;
  238.         gx_uint16       ui16GyCoeff;
  239.         gx_uint16       ui16GuCoeff;
  240.         gx_uint16       ui16GvCoeff;
  241.         gx_uint16       ui16ByCoeff;
  242.         gx_uint16       ui16BuCoeff;
  243.         gx_uint16       ui16BvCoeff;
  244. }VDISP_CSCCoeffs, *PVDISP_CSCCoeffs;
  245. typedef enum _VDISP_DEINTERLACE_
  246. {
  247.         VDISP_NONE=0,
  248.         VDISP_WEAVE=1,
  249.         VDISP_BOB_ODD,
  250.         VDISP_BOB_EVEN,
  251.         VDISP_BOB_EVEN_NONINTERLEAVED
  252. } VDISP_DEINTERLACE,*PVDISP_DEINTERLACE;
  253. #define VDISP_OVERLAYATTRIB_VALID_DSTPOSITION   0x0001
  254. #define VDISP_OVERLAYATTRIB_VALID_SRCPOSITION   0x0002
  255. #define VDISP_OVERLAYATTRIB_VALID_CKEY          0x0004
  256. #define VDISP_OVERLAYATTRIB_VALID_VISIBILITY    0x0010
  257. #define VDISP_OVERLAYATTRIB_VALID_ROTATION      0x0020
  258. #define VDISP_OVERLAYATTRIB_VALID_ROTATEDEGREE  0x0040
  259. #define VDISP_OVERLAYATTRIB_VALID_VERIFY        0x8000   // Can we create an overlay?
  260. typedef struct _VDISP_OVERLAYATTRIBS_
  261. {
  262.         gx_uint16       ui16ValidFlags;          // Flags to say which members of this structure are valid
  263.         gx_int16        i16Top;                  // Signed position of top of overlay (overlay starts on this line)
  264.         gx_int16        i16Left;                 // Signed position of left of overlay (overlay starts on this column)
  265.         gx_int16        i16Bottom;               // Signed position of bottom of overlay (line above this one is last line of overlay)
  266.         gx_int16        i16Right;                // Signed position of right overlay  (pixel before this one is last line of overlay)
  267.         gx_uint16       ui16SrcX1;               // SrcX1 position of overlay data within buffer
  268.         gx_uint16       ui16SrcY1;               // SrcY1 position of overlay data within buffer
  269.         gx_uint16       ui16SrcX2;               // SrcX2 position of overlay data within buffer
  270.         gx_uint16       ui16SrcY2;               // SrcY2 position of overlay data within buffer
  271.         gx_bool         bCKeyOn;                 // Turn on/off colorkey;
  272.         gx_uint32       ui32CKeyValue;           // ColorKey value
  273.         gx_bool         bOverlayOn;              // Turn the overlay on/off
  274.         
  275.         gx_bool         bDisableRotation;        // force video to be displayed unrotated for extra performance
  276.         gx_uint16       ui16RotateDegree;        // degree to rotate the surface 
  277. }VDISP_OVERLAYATTRIBS,*PVDISP_OVERLAYATTRIBS;
  278. /*****************************************************************************/
  279. /**************** PDP Overlay API Function Prototypes ************************/
  280. /*****************************************************************************/
  281. VDISPError GXAPI VDISP_Initialize();
  282. VDISPError GXAPI VDISP_Deinitialize();
  283. VDISPError GXAPI VDISP_OverlaySetAttributes(PVDISP_OVERLAYATTRIBS psOverlayAttributes,
  284.                                             SMSurface hSurface);
  285. VDISPError GXAPI VDISP_OverlayFlipSurface(SMSurface hSurfaceFlipTo, VDISP_DEINTERLACE eDeinterlace);
  286. VDISPError GXAPI VDISP_OverlayContrast(gx_uint32 ui32Contrast);
  287. VDISPError GXAPI VDISP_OverlayGamma(gx_uint32 ui32Gamma);
  288. VDISPError GXAPI VDISP_OverlayBrightness(gx_uint32 ui32Brightness);
  289. VDISPError GXAPI VDISP_OverlaySetColorspaceConversion(PVDISP_CSCCoeffs psCoeffs);
  290. #endif /* _GXVADD_H_ */