Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

844 lines
30 KiB

  1. //------------------------------------------------------------------------------
  2. // File: DXVA.h
  3. //
  4. // Desc: DirectX Video Acceleration header file.
  5. //
  6. // Copyright (c) 1999 - 2002, Microsoft Corporation. All rights reserved.
  7. //------------------------------------------------------------------------------
  8. #ifndef __DIRECTX_VA__
  9. #define __DIRECTX_VA__
  10. #ifdef __cplusplus
  11. extern "C" {
  12. #endif
  13. DEFINE_GUID(DXVA_ModeNone, 0x1b81be00, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
  14. DEFINE_GUID(DXVA_ModeH261_A, 0x1b81be01, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
  15. DEFINE_GUID(DXVA_ModeH261_B, 0x1b81be02, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
  16. DEFINE_GUID(DXVA_ModeH263_A, 0x1b81be03, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
  17. DEFINE_GUID(DXVA_ModeH263_B, 0x1b81be04, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
  18. DEFINE_GUID(DXVA_ModeH263_C, 0x1b81be05, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
  19. DEFINE_GUID(DXVA_ModeH263_D, 0x1b81be06, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
  20. DEFINE_GUID(DXVA_ModeH263_E, 0x1b81be07, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
  21. DEFINE_GUID(DXVA_ModeH263_F, 0x1b81be08, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
  22. DEFINE_GUID(DXVA_ModeMPEG1_A, 0x1b81be09, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
  23. DEFINE_GUID(DXVA_ModeMPEG2_A, 0x1b81be0A, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
  24. DEFINE_GUID(DXVA_ModeMPEG2_B, 0x1b81be0B, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
  25. DEFINE_GUID(DXVA_ModeMPEG2_C, 0x1b81be0C, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
  26. DEFINE_GUID(DXVA_ModeMPEG2_D, 0x1b81be0D, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
  27. DEFINE_GUID(DXVA_ModeMPEG2_E, 0x1b81be0E, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
  28. DEFINE_GUID(DXVA_ModeWMV8_A, 0x1b81be80, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
  29. DEFINE_GUID(DXVA_ModeWMV8_B, 0x1b81be81, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
  30. DEFINE_GUID(DXVA_ModeWMV9_A, 0x1b81be90, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
  31. DEFINE_GUID(DXVA_ModeWMV9_B, 0x1b81be91, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
  32. DEFINE_GUID(DXVA_ModeWMV9_Ai, 0x1b81be92, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
  33. DEFINE_GUID(DXVA_ModeWMV9_Bi, 0x1b81be93, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
  34. DEFINE_GUID(DXVA_NoEncrypt, 0x1b81beD0, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
  35. #define DXVA_RESTRICTED_MODE_UNRESTRICTED 0xFFFF
  36. #define DXVA_RESTRICTED_MODE_H261_A 1
  37. #define DXVA_RESTRICTED_MODE_H261_B 2
  38. #define DXVA_RESTRICTED_MODE_H263_A 3
  39. #define DXVA_RESTRICTED_MODE_H263_B 4
  40. #define DXVA_RESTRICTED_MODE_H263_C 5
  41. #define DXVA_RESTRICTED_MODE_H263_D 6
  42. #define DXVA_RESTRICTED_MODE_H263_E 7
  43. #define DXVA_RESTRICTED_MODE_H263_F 8
  44. #define DXVA_RESTRICTED_MODE_MPEG1_A 9
  45. #define DXVA_RESTRICTED_MODE_MPEG2_A 0xA
  46. #define DXVA_RESTRICTED_MODE_MPEG2_B 0xB
  47. #define DXVA_RESTRICTED_MODE_MPEG2_C 0xC
  48. #define DXVA_RESTRICTED_MODE_MPEG2_D 0xD
  49. #define DXVA_RESTRICTED_MODE_MPEG2_E 0xE
  50. #define DXVA_RESTRICTED_MODE_WMV8_A 0x80
  51. #define DXVA_RESTRICTED_MODE_WMV8_B 0x81
  52. #define DXVA_RESTRICTED_MODE_WMV9_A 0x90
  53. #define DXVA_RESTRICTED_MODE_WMV9_B 0x91
  54. #define DXVA_RESTRICTED_MODE_WMV9_Ai 0x92
  55. #define DXVA_RESTRICTED_MODE_WMV9_Bi 0x93
  56. #define DXVA_COMPBUFFER_TYPE_THAT_IS_NOT_USED 0
  57. #define DXVA_PICTURE_DECODE_BUFFER 1
  58. #define DXVA_MACROBLOCK_CONTROL_BUFFER 2
  59. #define DXVA_RESIDUAL_DIFFERENCE_BUFFER 3
  60. #define DXVA_DEBLOCKING_CONTROL_BUFFER 4
  61. #define DXVA_INVERSE_QUANTIZATION_MATRIX_BUFFER 5
  62. #define DXVA_SLICE_CONTROL_BUFFER 6
  63. #define DXVA_BITSTREAM_DATA_BUFFER 7
  64. #define DXVA_AYUV_BUFFER 8
  65. #define DXVA_IA44_SURFACE_BUFFER 9
  66. #define DXVA_DPXD_SURFACE_BUFFER 10
  67. #define DXVA_HIGHLIGHT_BUFFER 11
  68. #define DXVA_DCCMD_SURFACE_BUFFER 12
  69. #define DXVA_ALPHA_BLEND_COMBINATION_BUFFER 13
  70. #define DXVA_PICTURE_RESAMPLE_BUFFER 14
  71. #define DXVA_READ_BACK_BUFFER 15
  72. #define DXVA_NUM_TYPES_COMP_BUFFERS 16
  73. /* values for bDXVA_Func */
  74. #define DXVA_PICTURE_DECODING_FUNCTION 1
  75. #define DXVA_ALPHA_BLEND_DATA_LOAD_FUNCTION 2
  76. #define DXVA_ALPHA_BLEND_COMBINATION_FUNCTION 3
  77. #define DXVA_PICTURE_RESAMPLE_FUNCTION 4
  78. /* values returned from Execute command in absence of read-back */
  79. #define DXVA_EXECUTE_RETURN_OK 0
  80. #define DXVA_EXECUTE_RETURN_DATA_ERROR_MINOR 1
  81. #define DXVA_EXECUTE_RETURN_DATA_ERROR_SIGNIF 2
  82. #define DXVA_EXECUTE_RETURN_DATA_ERROR_SEVERE 3
  83. #define DXVA_EXECUTE_RETURN_OTHER_ERROR_SEVERE 4
  84. #pragma pack(push, BeforeDXVApacking, 1)
  85. typedef struct _DXVA_ConnectMode {
  86. GUID guidMode;
  87. WORD wRestrictedMode;
  88. } DXVA_ConnectMode, *LPDXVA_ConnectMode;
  89. typedef DWORD DXVA_ConfigQueryOrReplyFunc, *LPDXVA_ConfigQueryOrReplyFunc;
  90. #define DXVA_QUERYORREPLYFUNCFLAG_DECODER_PROBE_QUERY 0xFFFFF1
  91. #define DXVA_QUERYORREPLYFUNCFLAG_DECODER_LOCK_QUERY 0xFFFFF5
  92. #define DXVA_QUERYORREPLYFUNCFLAG_ACCEL_PROBE_OK_COPY 0xFFFFF8
  93. #define DXVA_QUERYORREPLYFUNCFLAG_ACCEL_PROBE_OK_PLUS 0xFFFFF9
  94. #define DXVA_QUERYORREPLYFUNCFLAG_ACCEL_LOCK_OK_COPY 0xFFFFFC
  95. #define DXVA_QUERYORREPLYFUNCFLAG_ACCEL_PROBE_FALSE_PLUS 0xFFFFFB
  96. #define DXVA_QUERYORREPLYFUNCFLAG_ACCEL_LOCK_FALSE_PLUS 0xFFFFFF
  97. #define readDXVA_QueryOrReplyFuncFlag(ptr) ((*(ptr)) >> 8)
  98. #define readDXVA_QueryOrReplyFuncFlag_ACCEL(ptr) (((*(ptr)) >> 11) & 1)
  99. #define readDXVA_QueryOrReplyFuncFlag_LOCK(ptr) (((*(ptr)) >> 10) & 1)
  100. #define readDXVA_QueryOrReplyFuncFlag_BAD(ptr) (((*(ptr)) >> 9) & 1)
  101. #define readDXVA_QueryOrReplyFuncFlag_PLUS(ptr) (((*(ptr)) >> 8) & 1)
  102. #define readDXVA_QueryOrReplyFuncFunc(ptr) ((*(ptr)) & 0xFF)
  103. #define writeDXVA_QueryOrReplyFunc(ptr, flg, fnc) ((*(ptr)) = ((flg) << 8) | (fnc))
  104. #define setDXVA_QueryOrReplyFuncFlag(ptr, flg) ((*(ptr)) |= ((flg) << 8))
  105. #define setDXVA_QueryOrReplyFuncFunc(ptr, fnc) ((*(ptr)) |= (fnc));
  106. typedef DWORD DXVA_EncryptProtocolFunc, *LPDXVA_EncryptProtocolFunc;
  107. #define DXVA_ENCRYPTPROTOCOLFUNCFLAG_HOST 0xFFFF00
  108. #define DXVA_ENCRYPTPROTOCOLFUNCFLAG_ACCEL 0xFFFF08
  109. #define readDXVA_EncryptProtocolFuncFlag(ptr) ((*(ptr)) >> 8)
  110. #define readDXVA_EncryptProtocolFuncFlag_ACCEL(ptr) (((*(ptr)) >> 11) & 1)
  111. #define readDXVA_EncryptProtocolFuncFunc(ptr) ((*(ptr)) & 0xFF)
  112. #define writeDXVA_EncryptProtocolFunc(ptr, flg, fnc) ((*(ptr)) = ((flg) << 8) | (fnc))
  113. #define setDXVA_EncryptProtocolFuncFlag(ptr, flg) ((*(ptr)) |= ((flg) << 8))
  114. #define setDXVA_EncryptProtocolFuncFunc(ptr, fnc) ((*(ptr)) |= (fnc));
  115. typedef struct _DXVA_EncryptProtocolHeader {
  116. DXVA_EncryptProtocolFunc dwFunction;
  117. DWORD ReservedBits[3];
  118. GUID guidEncryptProtocol;
  119. } DXVA_EncryptProtocolHeader, *LPDXVA_EncryptProtocolHeader;
  120. typedef struct _DXVA_ConfigPictureDecode {
  121. // Operation Indicated
  122. DXVA_ConfigQueryOrReplyFunc dwFunction;
  123. // Alignment
  124. DWORD dwReservedBits[3];
  125. // Encryption GUIDs
  126. GUID guidConfigBitstreamEncryption;
  127. GUID guidConfigMBcontrolEncryption;
  128. GUID guidConfigResidDiffEncryption;
  129. // Bitstream Processing Indicator
  130. BYTE bConfigBitstreamRaw;
  131. // Macroblock Control Config
  132. BYTE bConfigMBcontrolRasterOrder;
  133. // Host Resid Diff Config
  134. BYTE bConfigResidDiffHost;
  135. BYTE bConfigSpatialResid8;
  136. BYTE bConfigResid8Subtraction;
  137. BYTE bConfigSpatialHost8or9Clipping;
  138. BYTE bConfigSpatialResidInterleaved;
  139. BYTE bConfigIntraResidUnsigned;
  140. // Accelerator Resid Diff Config
  141. BYTE bConfigResidDiffAccelerator;
  142. BYTE bConfigHostInverseScan;
  143. BYTE bConfigSpecificIDCT;
  144. BYTE bConfig4GroupedCoefs;
  145. } DXVA_ConfigPictureDecode, *LPDXVA_ConfigPictureDecode;
  146. /* Picture Decoding Parameters */
  147. typedef struct _DXVA_PictureParameters {
  148. WORD wDecodedPictureIndex;
  149. WORD wDeblockedPictureIndex;
  150. WORD wForwardRefPictureIndex;
  151. WORD wBackwardRefPictureIndex;
  152. WORD wPicWidthInMBminus1;
  153. WORD wPicHeightInMBminus1;
  154. BYTE bMacroblockWidthMinus1;
  155. BYTE bMacroblockHeightMinus1;
  156. BYTE bBlockWidthMinus1;
  157. BYTE bBlockHeightMinus1;
  158. BYTE bBPPminus1;
  159. BYTE bPicStructure;
  160. BYTE bSecondField;
  161. BYTE bPicIntra;
  162. BYTE bPicBackwardPrediction;
  163. BYTE bBidirectionalAveragingMode;
  164. BYTE bMVprecisionAndChromaRelation;
  165. BYTE bChromaFormat;
  166. BYTE bPicScanFixed;
  167. BYTE bPicScanMethod;
  168. BYTE bPicReadbackRequests;
  169. BYTE bRcontrol;
  170. BYTE bPicSpatialResid8;
  171. BYTE bPicOverflowBlocks;
  172. BYTE bPicExtrapolation;
  173. BYTE bPicDeblocked;
  174. BYTE bPicDeblockConfined;
  175. BYTE bPic4MVallowed;
  176. BYTE bPicOBMC;
  177. BYTE bPicBinPB;
  178. BYTE bMV_RPS;
  179. BYTE bReservedBits;
  180. WORD wBitstreamFcodes;
  181. WORD wBitstreamPCEelements;
  182. BYTE bBitstreamConcealmentNeed;
  183. BYTE bBitstreamConcealmentMethod;
  184. } DXVA_PictureParameters, *LPDXVA_PictureParameters;
  185. /* Picture Resampling */
  186. typedef struct _DXVA_PicResample {
  187. WORD wPicResampleSourcePicIndex;
  188. WORD wPicResampleDestPicIndex;
  189. WORD wPicResampleRcontrol;
  190. BYTE bPicResampleExtrapWidth;
  191. BYTE bPicResampleExtrapHeight;
  192. DWORD dwPicResampleSourceWidth;
  193. DWORD dwPicResampleSourceHeight;
  194. DWORD dwPicResampleDestWidth;
  195. DWORD dwPicResampleDestHeight;
  196. DWORD dwPicResampleFullDestWidth;
  197. DWORD dwPicResampleFullDestHeight;
  198. } DXVA_PicResample, *LPDXVA_PicResample;
  199. #define DXVA_CHROMA_FORMAT_420 1
  200. #define DXVA_CHROMA_FORMAT_422 2
  201. #define DXVA_CHROMA_FORMAT_444 3
  202. #define DXVA_PICTURE_STRUCTURE_TOP_FIELD 1
  203. #define DXVA_PICTURE_STRUCTURE_BOTTOM_FIELD 2
  204. #define DXVA_PICTURE_STRUCTURE_FRAME 3
  205. #define DXVA_BIDIRECTIONAL_AVERAGING_MPEG2_ROUND 0
  206. #define DXVA_BIDIRECTIONAL_AVERAGING_H263_TRUNC 1
  207. #define DXVA_MV_PRECISION_AND_CHROMA_RELATION_MPEG2 0
  208. #define DXVA_MV_PRECISION_AND_CHROMA_RELATION_H263 1
  209. #define DXVA_MV_PRECISION_AND_CHROMA_RELATION_H261 2
  210. #define DXVA_SCAN_METHOD_ZIG_ZAG 0
  211. #define DXVA_SCAN_METHOD_ALTERNATE_VERTICAL 1
  212. #define DXVA_SCAN_METHOD_ALTERNATE_HORIZONTAL 2
  213. #define DXVA_SCAN_METHOD_ARBITRARY 3
  214. #define DXVA_BITSTREAM_CONCEALMENT_NEED_UNLIKELY 0
  215. #define DXVA_BITSTREAM_CONCEALMENT_NEED_MILD 1
  216. #define DXVA_BITSTREAM_CONCEALMENT_NEED_LIKELY 2
  217. #define DXVA_BITSTREAM_CONCEALMENT_NEED_SEVERE 3
  218. #define DXVA_BITSTREAM_CONCEALMENT_METHOD_UNSPECIFIED 0
  219. #define DXVA_BITSTREAM_CONCEALMENT_METHOD_INTRA 1
  220. #define DXVA_BITSTREAM_CONCEALMENT_METHOD_FORWARD 2
  221. #define DXVA_BITSTREAM_CONCEALMENT_METHOD_BACKWARD 3
  222. /* Buffer Description Data */
  223. typedef struct _DXVA_BufferDescription {
  224. DWORD dwTypeIndex;
  225. DWORD dwBufferIndex;
  226. DWORD dwDataOffset;
  227. DWORD dwDataSize;
  228. DWORD dwFirstMBaddress;
  229. DWORD dwNumMBsInBuffer;
  230. DWORD dwWidth;
  231. DWORD dwHeight;
  232. DWORD dwStride;
  233. DWORD dwReservedBits;
  234. } DXVA_BufferDescription, *LPDXVA_BufferDescription;
  235. /* Off-Host IDCT Coefficient Data Structures */
  236. typedef struct _DXVA_TCoef4Group {
  237. BYTE TCoefIDX[4];
  238. SHORT TCoefValue[4];
  239. } DXVA_TCoef4Group, *LPDXVA_TCoef4Group;
  240. typedef struct _DXVA_TCoefSingle {
  241. WORD wIndexWithEOB;
  242. SHORT TCoefValue;
  243. } DXVA_TCoefSingle, *LPDXVA_TCoefSingle;
  244. /* Macros for Reading EOB and Index Values */
  245. #define readDXVA_TCoefSingleIDX(ptr) ((ptr)->wIndexWithEOB >> 1)
  246. #define readDXVA_TCoefSingleEOB(ptr) ((ptr)->wIndexWithEOB & 1)
  247. /* Macro for Writing EOB and Index Values */
  248. #define writeDXVA_TCoefSingleIndexWithEOB(ptr, idx, eob) ((ptr)->wIndexWithEOB = ((idx) << 1) | (eob))
  249. #define setDXVA_TCoefSingleIDX(ptr, idx) ((ptr)->wIndexWithEOB |= ((idx) << 1))
  250. #define setDXVA_TCoefSingleEOB(ptr) ((ptr)->wIndexWithEOB |= 1)
  251. /* Spatial-Domain Residual Difference Blocks */
  252. #define DXVA_USUAL_BLOCK_WIDTH 8
  253. #define DXVA_USUAL_BLOCK_HEIGHT 8
  254. #define DXVA_USUAL_BLOCK_SIZE (DXVA_USUAL_BLOCK_WIDTH * DXVA_USUAL_BLOCK_HEIGHT)
  255. typedef SHORT DXVA_Sample16[DXVA_USUAL_BLOCK_SIZE];
  256. typedef signed char DXVA_Sample8 [DXVA_USUAL_BLOCK_SIZE];
  257. /* Deblocking Filter Control Structure */
  258. typedef BYTE DXVA_DeblockingEdgeControl;
  259. typedef DXVA_DeblockingEdgeControl * LPDXVA_DeblockingEdgeControl;
  260. /* Macros for Reading STRENGTH and FilterOn */
  261. #define readDXVA_EdgeFilterStrength(ptr) ((*(ptr)) >> 1)
  262. #define readDXVA_EdgeFilterOn(ptr) ((*(ptr)) & 1)
  263. /* Macro for Writing STRENGTH and FilterOn */
  264. #define writeDXVA_DeblockingEdgeControl(ptr, str, fon) ((*(ptr)) = ((str) << 1) | (fon))
  265. #define setDXVA_EdgeFilterStrength(ptr, str) ((*(ptr)) |= ((str) << 1))
  266. #define setDXVA_EdgeFilterOn(ptr) ((*(ptr)) |= 1)
  267. /* Macroblock Control Command Data Structures */
  268. typedef struct _DXVA_MVvalue {
  269. SHORT horz, vert;
  270. } DXVA_MVvalue, *LPDXVA_MVvalue;
  271. /* Inverse Quantization Matrices */
  272. typedef struct _DXVA_QmatrixData {
  273. BYTE bNewQmatrix[4]; /* intra Y, inter Y, intra chroma, inter chroma */
  274. WORD Qmatrix[4][DXVA_USUAL_BLOCK_WIDTH * DXVA_USUAL_BLOCK_HEIGHT];
  275. } DXVA_QmatrixData, *LPDXVA_QmatrixData;
  276. /* Slice Control Buffer Data */
  277. typedef struct _DXVA_SliceInfo {
  278. WORD wHorizontalPosition;
  279. WORD wVerticalPosition;
  280. DWORD dwSliceBitsInBuffer;
  281. DWORD dwSliceDataLocation;
  282. BYTE bStartCodeBitOffset;
  283. BYTE bReservedBits;
  284. WORD wMBbitOffset;
  285. WORD wNumberMBsInSlice;
  286. WORD wQuantizerScaleCode;
  287. WORD wBadSliceChopping;
  288. } DXVA_SliceInfo, *LPDXVA_SliceInfo;
  289. #define DXVA_NumMV_OBMC_off_BinPBwith4MV_off 4
  290. #define DXVA_NumMV_OBMC_off_BinPBwith4MV_on (4+1)
  291. #define DXVA_NumMV_OBMC_on__BinPB_off (10)
  292. #define DXVA_NumMV_OBMC_on__BinPB_on (11) /* not current standards */
  293. #define DXVA_NumBlocksPerMB_420 (4+2+0)
  294. #define DXVA_NumBlocksPerMB_422 (4+2+2)
  295. #define DXVA_NumBlocksPerMB_444 (4+4+4)
  296. /* Basic form for I pictures */
  297. /* Host Residual Differences */
  298. typedef struct _DXVA_MBctrl_I_HostResidDiff_1 {
  299. WORD wMBaddress;
  300. WORD wMBtype;
  301. DWORD dwMB_SNL;
  302. WORD wPatternCode;
  303. WORD wPC_Overflow; /* zero if not overflow format */
  304. DWORD dwReservedBits2;
  305. } DXVA_MBctrl_I_HostResidDiff_1;
  306. /* Basic form for I pictures */
  307. /* Off-Host IDCT, 4:2:0 sampling */
  308. typedef struct _DXVA_MBctrl_I_OffHostIDCT_1 {
  309. WORD wMBaddress;
  310. WORD wMBtype;
  311. DWORD dwMB_SNL;
  312. WORD wPatternCode;
  313. BYTE bNumCoef[DXVA_NumBlocksPerMB_420];
  314. } DXVA_MBctrl_I_OffHostIDCT_1;
  315. /* Basic form for P and B pictures */
  316. /* Should also be used for concealment MVs in MPEG-2 I pictures */
  317. /* Without OBMC, without BinPB and 4MV together, without MV RPS */
  318. /* Host Residual Differences */
  319. typedef struct _DXVA_MBctrl_P_HostResidDiff_1 {
  320. WORD wMBaddress;
  321. WORD wMBtype;
  322. DWORD dwMB_SNL;
  323. WORD wPatternCode;
  324. WORD wPC_Overflow; /* zero if not overflow format */
  325. DWORD dwReservedBits2;
  326. DXVA_MVvalue MVector[DXVA_NumMV_OBMC_off_BinPBwith4MV_off];
  327. } DXVA_MBctrl_P_HostResidDiff_1;
  328. /* Basic form for P and B pictures */
  329. /* Without OBMC, without BinPB and 4MV together, without MV RPS */
  330. /* Off-Host IDCT, 4:2:0 sampling */
  331. typedef struct _DXVA_MBctrl_P_OffHostIDCT_1 {
  332. WORD wMBaddress;
  333. WORD wMBtype;
  334. DWORD dwMB_SNL;
  335. WORD wPatternCode;
  336. BYTE bNumCoef[DXVA_NumBlocksPerMB_420];
  337. DXVA_MVvalue MVector[DXVA_NumMV_OBMC_off_BinPBwith4MV_off];
  338. } DXVA_MBctrl_P_OffHostIDCT_1;
  339. /* How to load alpha blending graphic data */
  340. typedef struct _DXVA_ConfigAlphaLoad {
  341. // Operation Indicated
  342. DXVA_ConfigQueryOrReplyFunc dwFunction;
  343. // Alignment
  344. DWORD dwReservedBits[3];
  345. BYTE bConfigDataType;
  346. } DXVA_ConfigAlphaLoad, *LPDXVA_ConfigAlphaLoad;
  347. #define DXVA_CONFIG_DATA_TYPE_IA44 0
  348. #define DXVA_CONFIG_DATA_TYPE_AI44 1
  349. #define DXVA_CONFIG_DATA_TYPE_DPXD 2
  350. #define DXVA_CONFIG_DATA_TYPE_AYUV 3
  351. /* How to combine alpha blending graphic data */
  352. typedef struct _DXVA_ConfigAlphaCombine {
  353. // Operation Indicated
  354. DXVA_ConfigQueryOrReplyFunc dwFunction;
  355. // Alignment
  356. DWORD dwReservedBits[3];
  357. BYTE bConfigBlendType;
  358. BYTE bConfigPictureResizing;
  359. BYTE bConfigOnlyUsePicDestRectArea;
  360. BYTE bConfigGraphicResizing;
  361. BYTE bConfigWholePlaneAlpha;
  362. } DXVA_ConfigAlphaCombine, *LPDXVA_ConfigAlphaCombine;
  363. #define DXVA_CONFIG_BLEND_TYPE_FRONT_BUFFER 0
  364. #define DXVA_CONFIG_BLEND_TYPE_BACK_HARDWARE 1
  365. /* AYUV sample for 16-entry YUV palette or graphic surface */
  366. typedef struct _DXVA_AYUVsample2 {
  367. BYTE bCrValue;
  368. BYTE bCbValue;
  369. BYTE bY_Value;
  370. BYTE bSampleAlpha8;
  371. } DXVA_AYUVsample2, *LPDXVA_AYUVsample2;
  372. /* Macros for IA44 alpha blending surface samples */
  373. typedef BYTE DXVA_IA44sample, *LPDXVA_IA44sample;
  374. #define readDXVA_IA44index(ptr) (((*(ptr)) & 0xF0) >> 4)
  375. #define readDXVA_IA44alpha(ptr) ((*(ptr)) & 0x0F)
  376. #define writeDXVA_IA44(ptr, idx, alpha) ((*(ptr)) = (((idx) << 4) | (alpha)))
  377. #define setDXVA_IA44index(ptr, idx) ((*(ptr)) |= ((idx) << 4))
  378. #define setDXVA_IA44alpha(ptr, alpha) ((*(ptr)) |= (alpha))
  379. /* Macros for AI44 alpha blending surface samples */
  380. typedef BYTE DXVA_AI44sample, *LPDXVA_AI44sample;
  381. #define readDXVA_AI44index(ptr) ((*(ptr)) & 0x0F)
  382. #define readDXVA_AI44alpha(ptr) (((*(ptr)) & 0xF0) >> 4)
  383. #define writeDXVA_AI44(ptr, idx, alpha) ((*(ptr)) = (((alpha) << 4) | (idx)))
  384. #define setDXVA_AI44index(ptr, idx) ((*(ptr)) |= (idx))
  385. #define setDXVA_AI44alpha(ptr, alpha) ((*(ptr)) |= ((alpha) << 4))
  386. /* Highlight data structure */
  387. typedef struct _DXVA_Highlight {
  388. WORD wHighlightActive;
  389. WORD wHighlightIndices;
  390. WORD wHighlightAlphas;
  391. RECT HighlightRect;
  392. } DXVA_Highlight, *LPDXVA_Highlight;
  393. typedef BYTE DXVA_DPXD, *LPDXVA_DPXD;
  394. typedef WORD DXVA_DCCMD, *LPDXVA_DCCMD;
  395. /* Alpha blend combination */
  396. typedef struct _DXVA_BlendCombination {
  397. WORD wPictureSourceIndex;
  398. WORD wBlendedDestinationIndex;
  399. RECT PictureSourceRect16thPel;
  400. RECT PictureDestinationRect;
  401. RECT GraphicSourceRect;
  402. RECT GraphicDestinationRect;
  403. WORD wBlendDelay;
  404. BYTE bBlendOn;
  405. BYTE bWholePlaneAlpha;
  406. DXVA_AYUVsample2 OutsideYUVcolor;
  407. } DXVA_BlendCombination, *LPDXVA_BlendCombination;
  408. #pragma pack(push, 16)
  409. typedef DXVA_MBctrl_I_HostResidDiff_1 *
  410. LPDXVA_MBctrl_I_HostResidDiff_1;
  411. typedef DXVA_MBctrl_I_OffHostIDCT_1 *
  412. LPDXVA_MBctrl_I_OffHostIDCT_1;
  413. typedef DXVA_MBctrl_P_HostResidDiff_1 *
  414. LPDXVA_MBctrl_P_HostResidDiff_1;
  415. typedef DXVA_MBctrl_P_OffHostIDCT_1 *
  416. LPDXVA_MBctrl_P_OffHostIDCT_1;
  417. #pragma pack(pop)
  418. /*
  419. * Other forms of pictures are constructed in the obvious way
  420. * from the above by adjusting the number of residual difference
  421. * blocks, the number of motion vectors per macroblock, etc.
  422. */
  423. #define readDXVA_MBskipsFollowing(ptr) (((ptr)->dwMB_SNL & 0xFF000000) >> 24)
  424. #define readDXVA_MBdataLocation(ptr) (((ptr)->dwMB_SNL & 0x00FFFFFF))
  425. #define writeDXVA_MB_SNL(ptr, skips, dloc) ((ptr)->dwMB_SNL = (((skips) << 24) | (dloc)))
  426. #define setDXVA_MBskipsFollowing(ptr, skips) ((ptr)->dwMB_SNL |= ((skips) << 24))
  427. #define setDXVA_MBdataLocation(ptr, dloc) ((ptr)->dwMB_SNL |= (dloc))
  428. #define readDXVA_MvertFieldSel_3(ptr) (((ptr)->wMBtype & 0x8000) >> 15)
  429. #define readDXVA_MvertFieldSel_2(ptr) (((ptr)->wMBtype & 0x4000) >> 14)
  430. #define readDXVA_MvertFieldSel_1(ptr) (((ptr)->wMBtype & 0x2000) >> 13)
  431. #define readDXVA_MvertFieldSel_0(ptr) (((ptr)->wMBtype & 0x1000) >> 12)
  432. #define readDXVA_ReservedBits(ptr) (((ptr)->wMBtype & 0x0800) >> 11)
  433. #define readDXVA_HostResidDiff(ptr) (((ptr)->wMBtype & 0x0400) >> 10)
  434. #define readDXVA_MotionType(ptr) (((ptr)->wMBtype & 0x0300) >> 8)
  435. #define readDXVA_MBscanMethod(ptr) (((ptr)->wMBtype & 0x00C0) >> 6)
  436. #define readDXVA_FieldResidual(ptr) (((ptr)->wMBtype & 0x0020) >> 5)
  437. #define readDXVA_H261LoopFilter(ptr) (((ptr)->wMBtype & 0x0010) >> 4)
  438. #define readDXVA_Motion4MV(ptr) (((ptr)->wMBtype & 0x0008) >> 3)
  439. #define readDXVA_MotionBackward(ptr) (((ptr)->wMBtype & 0x0004) >> 2)
  440. #define readDXVA_MotionForward(ptr) (((ptr)->wMBtype & 0x0002) >> 1)
  441. #define readDXVA_IntraMacroblock(ptr) (((ptr)->wMBtype & 0x0001))
  442. #define setDXVA_MvertFieldSel_3(ptr) ((ptr)->wMBtype |= 0x8000)
  443. #define setDXVA_MvertFieldSel_2(ptr) ((ptr)->wMBtype |= 0x4000)
  444. #define setDXVA_MvertFieldSel_1(ptr) ((ptr)->wMBtype |= 0x2000)
  445. #define setDXVA_MvertFieldSel_0(ptr) ((ptr)->wMBtype |= 0x1000)
  446. #define setDXVA_ReservedBits(ptr) ((ptr)->wMBtype |= 0x0800)
  447. #define setDXVA_HostResidDiff(ptr) ((ptr)->wMBtype |= 0x0400)
  448. #define setDXVA_MotionType(ptr, value) ((ptr)->wMBtype |= ((value) << 8))
  449. #define setDXVA_MBscanMethod(ptr, value) ((ptr)->wMBtype |= ((value) << 6))
  450. #define setDXVA_FieldResidual(ptr) ((ptr)->wMBtype |= 0x0020)
  451. #define setDXVA_H261LoopFilter(ptr) ((ptr)->wMBtype |= 0x0010)
  452. #define setDXVA_Motion4MV(ptr) ((ptr)->wMBtype |= 0x0008)
  453. #define setDXVA_MotionBackward(ptr) ((ptr)->wMBtype |= 0x0004)
  454. #define setDXVA_MotionForward(ptr) ((ptr)->wMBtype |= 0x0002)
  455. #define setDXVA_IntraMacroblock(ptr) ((ptr)->wMBtype |= 0x0001)
  456. #define readDXVA_Y___0coded(ptr) (((ptr)->wPatternCode & 0x0800) >> 11)
  457. #define readDXVA_Y___1coded(ptr) (((ptr)->wPatternCode & 0x0400) >> 10)
  458. #define readDXVA_Y___2coded(ptr) (((ptr)->wPatternCode & 0x0200) >> 9)
  459. #define readDXVA_Y___3coded(ptr) (((ptr)->wPatternCode & 0x0100) >> 8)
  460. #define readDXVA_Cb__4coded(ptr) (((ptr)->wPatternCode & 0x0080) >> 7)
  461. #define readDXVA_Cr__5coded(ptr) (((ptr)->wPatternCode & 0x0040) >> 6)
  462. #define readDXVA_Cb__6coded(ptr) (((ptr)->wPatternCode & 0x0020) >> 5)
  463. #define readDXVA_Cr__7coded(ptr) (((ptr)->wPatternCode & 0x0010) >> 4)
  464. #define readDXVA_Cb__8coded(ptr) (((ptr)->wPatternCode & 0x0008) >> 3)
  465. #define readDXVA_Cb__9coded(ptr) (((ptr)->wPatternCode & 0x0004) >> 2)
  466. #define readDXVA_Cr_10coded(ptr) (((ptr)->wPatternCode & 0x0002) >> 1)
  467. #define readDXVA_Cr_11coded(ptr) (((ptr)->wPatternCode & 0x0001))
  468. #define readDXVA_Y___0oflow(ptr) (((ptr)->wPC_Overflow & 0x0800) >> 11)
  469. #define readDXVA_Y___1oflow(ptr) (((ptr)->wPC_Overflow & 0x0400) >> 10)
  470. #define readDXVA_Y___2oflow(ptr) (((ptr)->wPC_Overflow & 0x0200) >> 9)
  471. #define readDXVA_Y___3oflow(ptr) (((ptr)->wPC_Overflow & 0x0100) >> 8)
  472. #define readDXVA_Cb__4oflow(ptr) (((ptr)->wPC_Overflow & 0x0080) >> 7)
  473. #define readDXVA_Cr__5oflow(ptr) (((ptr)->wPC_Overflow & 0x0040) >> 6)
  474. #define readDXVA_Cb__6oflow(ptr) (((ptr)->wPC_Overflow & 0x0020) >> 5)
  475. #define readDXVA_Cr__7oflow(ptr) (((ptr)->wPC_Overflow & 0x0010) >> 4)
  476. #define readDXVA_Cb__8oflow(ptr) (((ptr)->wPC_Overflow & 0x0008) >> 3)
  477. #define readDXVA_Cb__9oflow(ptr) (((ptr)->wPC_Overflow & 0x0004) >> 2)
  478. #define readDXVA_Cr_10oflow(ptr) (((ptr)->wPC_Overflow & 0x0002) >> 1)
  479. #define readDXVA_Cr_11oflow(ptr) (((ptr)->wPC_Overflow & 0x0001))
  480. #pragma pack(pop, BeforeDXVApacking)
  481. // -------------------------------------------------------------------------
  482. //
  483. // The definitions that follow describe the video de-interlace interface
  484. // between the VMR and the graphics device driver. This interface is not
  485. // accessable via the IAMVideoAccelerator interface.
  486. //
  487. // -------------------------------------------------------------------------
  488. //
  489. typedef LONGLONG REFERENCE_TIME;
  490. DEFINE_GUID(DXVA_DeinterlaceBobDevice,
  491. 0x335aa36e,0x7884,0x43a4,0x9c,0x91,0x7f,0x87,0xfa,0xf3,0xe3,0x7e);
  492. DEFINE_GUID(DXVA_DeinterlaceContainerDevice,
  493. 0x0e85cb93,0x3046,0x4ff0,0xae,0xcc,0xd5,0x8c,0xb5,0xf0,0x35,0xfd);
  494. #if !defined(VALID_POOL)
  495. typedef DWORD D3DFORMAT;
  496. enum {
  497. D3DPOOL_DEFAULT = 0,
  498. D3DPOOL_MANAGED = 1,
  499. D3DPOOL_SYSTEMMEM = 2,
  500. D3DPOOL_SCRATCH = 3,
  501. D3DPOOL_LOCALVIDMEM = 4,
  502. D3DPOOL_NONLOCALVIDMEM = 5,
  503. D3DPOOL_FORCE_DWORD = 0x7fffffff
  504. };
  505. #endif
  506. // -------------------------------------------------------------------------
  507. // data structures shared by User mode and Kernel mode.
  508. // -------------------------------------------------------------------------
  509. //
  510. typedef enum _DXVA_SampleFormat {
  511. DXVA_SamplePreviousFrame = 1,
  512. DXVA_SampleProgressiveFrame = 2,
  513. DXVA_SampleFieldInterleavedEvenFirst = 3,
  514. DXVA_SampleFieldInterleavedOddFirst = 4,
  515. DXVA_SampleFieldSingleEven = 5,
  516. DXVA_SampleFieldSingleOdd = 6,
  517. } DXVA_SampleFormat;
  518. typedef struct _DXVA_Frequency {
  519. DWORD Numerator;
  520. DWORD Denominator;
  521. } DXVA_Frequency;
  522. typedef struct _DXVA_VideoDesc {
  523. DWORD Size;
  524. DWORD SampleWidth;
  525. DWORD SampleHeight;
  526. DXVA_SampleFormat SampleFormat;
  527. D3DFORMAT d3dFormat;
  528. DXVA_Frequency InputSampleFreq;
  529. DXVA_Frequency OutputFrameFreq;
  530. } DXVA_VideoDesc, *LPDXVA_VideoDesc;
  531. typedef enum _DXVA_VideoProcessCaps {
  532. DXVA_VideoProcess_None = 0x0000,
  533. DXVA_VideoProcess_YUV2RGB = 0x0001,
  534. DXVA_VideoProcess_StretchX = 0x0002,
  535. DXVA_VideoProcess_StretchY = 0x0004,
  536. DXVA_VideoProcess_AlphaBlend = 0x0008
  537. } DXVA_VideoProcessCaps;
  538. typedef enum _DXVA_DeinterlaceTech {
  539. // the algorithm is unknown or proprietary
  540. DXVA_DeinterlaceTech_Unknown = 0x0000,
  541. // the algorithm creates the missing lines by repeating
  542. // the line either above or below it - this method will look very jaggy and
  543. // isn't recommended
  544. DXVA_DeinterlaceTech_BOBLineReplicate = 0x0001,
  545. // the algorithm creates the missing lines by vertically stretching each
  546. // video field by a factor of two. Slight vertical adjustments are made to
  547. // ensure that the resulting image does not "bob" up and down.
  548. // The algorithm creates the missing lines by vertically stretching each
  549. // video field by a factor of two, for example by averaging two lines or
  550. // using a [-1, 9, 9, -1]/16 filter across four lines.
  551. // Slight vertical adjustments are made to ensure that the resulting image
  552. // does not "bob" up and down.
  553. DXVA_DeinterlaceTech_BOBVerticalStretch = 0x0002,
  554. // the pixels in the missing line are recreated by a median filtering operation
  555. DXVA_DeinterlaceTech_MedianFiltering = 0x0004,
  556. // the pixels in the missing line are recreated by an edge filter.
  557. // In this process, spatial directional filters are applied to determine
  558. // the orientation of edges in the picture content, and missing
  559. // pixels are created by filtering along (rather than across) the
  560. // detected edges.
  561. DXVA_DeinterlaceTech_EdgeFiltering = 0x0010,
  562. // the pixels in the missing line are recreated by switching on a field by
  563. // field basis between using either spatial or temporal interpolation
  564. // depending on the amount of motion.
  565. DXVA_DeinterlaceTech_FieldAdaptive = 0x0020,
  566. // the pixels in the missing line are recreated by switching on a pixel by pixel
  567. // basis between using either spatial or temporal interpolation depending on
  568. // the amount of motion..
  569. DXVA_DeinterlaceTech_PixelAdaptive = 0x0040,
  570. // Motion Vector Steering identifies objects within a sequence of video
  571. // fields. The missing pixels are recreated after first aligning the
  572. // movement axes of the individual objects in the scene to make them
  573. // parallel with the time axis.
  574. DXVA_DeinterlaceTech_MotionVectorSteered = 0x0080
  575. } DXVA_DeinterlaceTech;
  576. typedef struct _DXVA_VideoSample {
  577. REFERENCE_TIME rtStart;
  578. REFERENCE_TIME rtEnd;
  579. DXVA_SampleFormat SampleFormat;
  580. VOID* lpDDSSrcSurface;
  581. } DXVA_VideoSample, *LPDXVA_VideoSample;
  582. typedef struct _DXVA_DeinterlaceCaps {
  583. DWORD Size;
  584. DWORD NumPreviousOutputFrames;
  585. DWORD InputPool;
  586. DWORD NumForwardRefSamples;
  587. DWORD NumBackwardRefSamples;
  588. D3DFORMAT d3dOutputFormat;
  589. DXVA_VideoProcessCaps VideoProcessingCaps;
  590. DXVA_DeinterlaceTech DeinterlaceTechnology;
  591. } DXVA_DeinterlaceCaps, *LPDXVA_DeinterlaceCaps;
  592. // -------------------------------------------------------------------------
  593. // Data types used with RenderMoComp in kernel mode
  594. // -------------------------------------------------------------------------
  595. //
  596. // Function codes for RenderMoComp
  597. #define MAX_DEINTERLACE_SURFACES 32
  598. typedef struct _DXVA_DeinterlaceBlt {
  599. DWORD Size;
  600. REFERENCE_TIME rtTarget;
  601. RECT DstRect;
  602. RECT SrcRect;
  603. DWORD NumSourceSurfaces;
  604. FLOAT Alpha;
  605. DXVA_VideoSample Source[MAX_DEINTERLACE_SURFACES];
  606. } DXVA_DeinterlaceBlt;
  607. #define DXVA_DeinterlaceBltFnCode 0x01
  608. // lpInput => DXVA_DeinterlaceBlt*
  609. // lpOuput => NULL /* not currently used */
  610. #define MAX_DEINTERLACE_DEVICE_GUIDS 32
  611. typedef struct _DXVA_DeinterlaceQueryAvailableModes {
  612. DWORD Size;
  613. DWORD NumGuids;
  614. GUID Guids[MAX_DEINTERLACE_DEVICE_GUIDS];
  615. } DXVA_DeinterlaceQueryAvailableModes;
  616. #define DXVA_DeinterlaceQueryAvailableModesFnCode 0x01
  617. // lpInput => DXVA_VideoDesc*
  618. // lpOuput => DXVA_DeinterlaceQueryAvailableModes*
  619. typedef struct _DXVA_DeinterlaceQueryModeCaps {
  620. DWORD Size;
  621. GUID Guid;
  622. DXVA_VideoDesc VideoDesc;
  623. } DXVA_DeinterlaceQueryModeCaps;
  624. #define DXVA_DeinterlaceQueryModeCapsFnCode 0x02
  625. // lpInput => DXVA_DeinterlaceQueryModeCaps*
  626. // lpOuput => DXVA_DeinterlaceCaps*
  627. #ifdef __cplusplus
  628. }
  629. #endif
  630. #endif /* __DIRECTX_VA__ */