dxva.h
上传用户:dzyhzl
上传日期:2019-04-29
资源大小:56270k
文件大小:23k
源码类别:

模拟服务器

开发平台:

C/C++

  1. //------------------------------------------------------------------------------
  2. // File: DXVA.h
  3. //
  4. // Desc: DirectX Video Acceleration header file.
  5. //
  6. // Copyright (c) 1999 - 2000, 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_NoEncrypt,   0x1b81beD0, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
  28. DEFINE_GUID(DXVA_EncryptProt1, 0x1b81beD1, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
  29. #define DXVA_RESTRICTED_MODE_UNRESTRICTED        0xFFFF
  30. #define DXVA_RESTRICTED_MODE_H261_A              1
  31. #define DXVA_RESTRICTED_MODE_H261_B              2
  32. #define DXVA_RESTRICTED_MODE_H263_A              3
  33. #define DXVA_RESTRICTED_MODE_H263_B              4
  34. #define DXVA_RESTRICTED_MODE_H263_C              5
  35. #define DXVA_RESTRICTED_MODE_H263_D              6
  36. #define DXVA_RESTRICTED_MODE_H263_E              7
  37. #define DXVA_RESTRICTED_MODE_H263_F              8
  38. #define DXVA_RESTRICTED_MODE_MPEG1_A             9
  39. #define DXVA_RESTRICTED_MODE_MPEG2_A             0xA
  40. #define DXVA_RESTRICTED_MODE_MPEG2_B             0xB
  41. #define DXVA_RESTRICTED_MODE_MPEG2_C             0xC
  42. #define DXVA_RESTRICTED_MODE_MPEG2_D             0xD
  43. #define DXVA_COMPBUFFER_TYPE_THAT_IS_NOT_USED    0
  44. #define DXVA_PICTURE_DECODE_BUFFER               1
  45. #define DXVA_MACROBLOCK_CONTROL_BUFFER           2
  46. #define DXVA_RESIDUAL_DIFFERENCE_BUFFER          3
  47. #define DXVA_DEBLOCKING_CONTROL_BUFFER           4
  48. #define DXVA_INVERSE_QUANTIZATION_MATRIX_BUFFER  5
  49. #define DXVA_SLICE_CONTROL_BUFFER                6
  50. #define DXVA_BITSTREAM_DATA_BUFFER               7
  51. #define DXVA_AYUV_BUFFER                         8
  52. #define DXVA_IA44_SURFACE_BUFFER                 9
  53. #define DXVA_DPXD_SURFACE_BUFFER                10
  54. #define DXVA_HIGHLIGHT_BUFFER                   11
  55. #define DXVA_DCCMD_SURFACE_BUFFER               12
  56. #define DXVA_ALPHA_BLEND_COMBINATION_BUFFER     13
  57. #define DXVA_PICTURE_RESAMPLE_BUFFER            14
  58. #define DXVA_READ_BACK_BUFFER                   15
  59. #define DXVA_NUM_TYPES_COMP_BUFFERS             16
  60. /* values for bDXVA_Func */
  61. #define DXVA_PICTURE_DECODING_FUNCTION        1
  62. #define DXVA_ALPHA_BLEND_DATA_LOAD_FUNCTION   2
  63. #define DXVA_ALPHA_BLEND_COMBINATION_FUNCTION 3
  64. #define DXVA_PICTURE_RESAMPLE_FUNCTION        4
  65. /* values returned from Execute command in absence of read-back */
  66. #define DXVA_EXECUTE_RETURN_OK                  0
  67. #define DXVA_EXECUTE_RETURN_DATA_ERROR_MINOR    1
  68. #define DXVA_EXECUTE_RETURN_DATA_ERROR_SIGNIF   2
  69. #define DXVA_EXECUTE_RETURN_DATA_ERROR_SEVERE   3
  70. #define DXVA_EXECUTE_RETURN_OTHER_ERROR_SEVERE  4
  71. #pragma pack(push, BeforeDXVApacking, 1)
  72. typedef struct _DXVA_ConnectMode {
  73.   GUID guidMode;
  74.   WORD wRestrictedMode;
  75. } DXVA_ConnectMode, *LPDXVA_ConnectMode;
  76. typedef DWORD DXVA_ConfigQueryOrReplyFunc, *LPDXVA_ConfigQueryOrReplyFunc;
  77. #define DXVA_QUERYORREPLYFUNCFLAG_DECODER_PROBE_QUERY     0xFFFFF1
  78. #define DXVA_QUERYORREPLYFUNCFLAG_DECODER_LOCK_QUERY      0xFFFFF5
  79. #define DXVA_QUERYORREPLYFUNCFLAG_ACCEL_PROBE_OK_COPY     0xFFFFF8
  80. #define DXVA_QUERYORREPLYFUNCFLAG_ACCEL_PROBE_OK_PLUS     0xFFFFF9
  81. #define DXVA_QUERYORREPLYFUNCFLAG_ACCEL_LOCK_OK_COPY      0xFFFFFC
  82. #define DXVA_QUERYORREPLYFUNCFLAG_ACCEL_PROBE_FALSE_PLUS  0xFFFFFB
  83. #define DXVA_QUERYORREPLYFUNCFLAG_ACCEL_LOCK_FALSE_PLUS   0xFFFFFF
  84. #define readDXVA_QueryOrReplyFuncFlag(ptr)        ((*(ptr)) >> 8)
  85. #define readDXVA_QueryOrReplyFuncFlag_ACCEL(ptr)  (((*(ptr)) >> 11) & 1)
  86. #define readDXVA_QueryOrReplyFuncFlag_LOCK(ptr)   (((*(ptr)) >> 10) & 1)
  87. #define readDXVA_QueryOrReplyFuncFlag_BAD(ptr)    (((*(ptr)) >>  9) & 1)
  88. #define readDXVA_QueryOrReplyFuncFlag_PLUS(ptr)   (((*(ptr)) >>  8) & 1)
  89. #define readDXVA_QueryOrReplyFuncFunc(ptr)        ((*(ptr)) & 0xFF)
  90. #define writeDXVA_QueryOrReplyFunc(ptr, flg, fnc) ((*(ptr)) = ((flg) << 8) | (fnc))
  91. #define setDXVA_QueryOrReplyFuncFlag(ptr, flg) ((*(ptr)) |= ((flg) << 8))
  92. #define setDXVA_QueryOrReplyFuncFunc(ptr, fnc) ((*(ptr)) |= (fnc));
  93. typedef DWORD DXVA_EncryptProtocolFunc, *LPDXVA_EncryptProtocolFunc;
  94. #define DXVA_ENCRYPTPROTOCOLFUNCFLAG_HOST    0xFFFF00
  95. #define DXVA_ENCRYPTPROTOCOLFUNCFLAG_ACCEL   0xFFFF08
  96. #define readDXVA_EncryptProtocolFuncFlag(ptr)        ((*(ptr)) >> 8)
  97. #define readDXVA_EncryptProtocolFuncFlag_ACCEL(ptr)  (((*(ptr)) >> 11) & 1)
  98. #define readDXVA_EncryptProtocolFuncFunc(ptr)        ((*(ptr)) & 0xFF)
  99. #define writeDXVA_EncryptProtocolFunc(ptr, flg, fnc) ((*(ptr)) = ((flg) << 8) | (fnc))
  100. #define setDXVA_EncryptProtocolFuncFlag(ptr, flg) ((*(ptr)) |= ((flg) << 8))
  101. #define setDXVA_EncryptProtocolFuncFunc(ptr, fnc) ((*(ptr)) |= (fnc));
  102. typedef struct _DXVA_EncryptProtocolHeader {
  103.   DXVA_EncryptProtocolFunc dwFunction;
  104.   DWORD ReservedBits[3];
  105.   GUID  guidEncryptProtocol;
  106. } DXVA_EncryptProtocolHeader, *LPDXVA_EncryptProtocolHeader;
  107. typedef struct _DXVA_ConfigPictureDecode {
  108.   // Operation Indicated
  109.   DXVA_ConfigQueryOrReplyFunc dwFunction;
  110.   // Alignment
  111.   DWORD dwReservedBits[3];
  112.   // Encryption GUIDs
  113.   GUID guidConfigBitstreamEncryption;
  114.   GUID guidConfigMBcontrolEncryption;
  115.   GUID guidConfigResidDiffEncryption;
  116.   // Bitstream Processing Indicator
  117.   BYTE bConfigBitstreamRaw;
  118.   // Macroblock Control Config
  119.   BYTE bConfigMBcontrolRasterOrder;
  120.   // Host Resid Diff Config
  121.   BYTE bConfigResidDiffHost;
  122.   BYTE bConfigSpatialResid8;
  123.   BYTE bConfigResid8Subtraction;
  124.   BYTE bConfigSpatialHost8or9Clipping;
  125.   BYTE bConfigSpatialResidInterleaved;
  126.   BYTE bConfigIntraResidUnsigned;
  127.   // Accelerator Resid Diff Config
  128.   BYTE bConfigResidDiffAccelerator;
  129.   BYTE bConfigHostInverseScan;
  130.   BYTE bConfigSpecificIDCT;
  131.   BYTE bConfig4GroupedCoefs;
  132. } DXVA_ConfigPictureDecode, *LPDXVA_ConfigPictureDecode;
  133. /* Picture Decoding Parameters */
  134. typedef struct _DXVA_PictureParameters {
  135.   WORD wDecodedPictureIndex;
  136.   WORD wDeblockedPictureIndex;
  137.   WORD wForwardRefPictureIndex;
  138.   WORD wBackwardRefPictureIndex;
  139.   WORD wPicWidthInMBminus1;
  140.   WORD wPicHeightInMBminus1;
  141.   BYTE bMacroblockWidthMinus1;
  142.   BYTE bMacroblockHeightMinus1;
  143.   BYTE bBlockWidthMinus1;
  144.   BYTE bBlockHeightMinus1;
  145.   BYTE bBPPminus1;
  146.   BYTE bPicStructure;
  147.   BYTE bSecondField;
  148.   BYTE bPicIntra;
  149.   BYTE bPicBackwardPrediction;
  150.   BYTE bBidirectionalAveragingMode;
  151.   BYTE bMVprecisionAndChromaRelation;
  152.   BYTE bChromaFormat;
  153.   BYTE bPicScanFixed;
  154.   BYTE bPicScanMethod;
  155.   BYTE bPicReadbackRequests;
  156.   BYTE bRcontrol;
  157.   BYTE bPicSpatialResid8;
  158.   BYTE bPicOverflowBlocks;
  159.   BYTE bPicExtrapolation;
  160.   BYTE bPicDeblocked;
  161.   BYTE bPicDeblockConfined;
  162.   BYTE bPic4MVallowed;
  163.   BYTE bPicOBMC;
  164.   BYTE bPicBinPB;
  165.   BYTE bMV_RPS;
  166.   BYTE bReservedBits;
  167.   WORD wBitstreamFcodes;
  168.   WORD wBitstreamPCEelements;
  169.   BYTE bBitstreamConcealmentNeed;
  170.   BYTE bBitstreamConcealmentMethod;
  171. } DXVA_PictureParameters, *LPDXVA_PictureParameters;
  172. /* Picture Resampling */
  173. typedef struct _DXVA_PicResample {
  174.   WORD  wPicResampleSourcePicIndex;
  175.   WORD  wPicResampleDestPicIndex;
  176.   WORD  wPicResampleRcontrol;
  177.   BYTE  bPicResampleExtrapWidth;
  178.   BYTE  bPicResampleExtrapHeight;
  179.   DWORD dwPicResampleSourceWidth;
  180.   DWORD dwPicResampleSourceHeight;
  181.   DWORD dwPicResampleDestWidth;
  182.   DWORD dwPicResampleDestHeight;
  183.   DWORD dwPicResampleFullDestWidth;
  184.   DWORD dwPicResampleFullDestHeight;
  185. } DXVA_PicResample, *LPDXVA_PicResample;
  186. #define DXVA_CHROMA_FORMAT_420 1
  187. #define DXVA_CHROMA_FORMAT_422 2
  188. #define DXVA_CHROMA_FORMAT_444 3
  189. #define DXVA_PICTURE_STRUCTURE_TOP_FIELD    1
  190. #define DXVA_PICTURE_STRUCTURE_BOTTOM_FIELD 2
  191. #define DXVA_PICTURE_STRUCTURE_FRAME        3
  192. #define DXVA_BIDIRECTIONAL_AVERAGING_MPEG2_ROUND 0
  193. #define DXVA_BIDIRECTIONAL_AVERAGING_H263_TRUNC  1
  194. #define DXVA_MV_PRECISION_AND_CHROMA_RELATION_MPEG2  0
  195. #define DXVA_MV_PRECISION_AND_CHROMA_RELATION_H263   1
  196. #define DXVA_MV_PRECISION_AND_CHROMA_RELATION_H261   2
  197. #define DXVA_SCAN_METHOD_ZIG_ZAG              0
  198. #define DXVA_SCAN_METHOD_ALTERNATE_VERTICAL   1
  199. #define DXVA_SCAN_METHOD_ALTERNATE_HORIZONTAL 2
  200. #define DXVA_SCAN_METHOD_ARBITRARY            3
  201. #define DXVA_BITSTREAM_CONCEALMENT_NEED_UNLIKELY 0
  202. #define DXVA_BITSTREAM_CONCEALMENT_NEED_MILD     1
  203. #define DXVA_BITSTREAM_CONCEALMENT_NEED_LIKELY   2
  204. #define DXVA_BITSTREAM_CONCEALMENT_NEED_SEVERE   3
  205. #define DXVA_BITSTREAM_CONCEALMENT_METHOD_UNSPECIFIED 0
  206. #define DXVA_BITSTREAM_CONCEALMENT_METHOD_INTRA       1
  207. #define DXVA_BITSTREAM_CONCEALMENT_METHOD_FORWARD     2
  208. #define DXVA_BITSTREAM_CONCEALMENT_METHOD_BACKWARD    3
  209. /* Buffer Description Data */
  210. typedef struct _DXVA_BufferDescription {
  211.   DWORD dwTypeIndex;
  212.   DWORD dwBufferIndex;
  213.   DWORD dwDataOffset;
  214.   DWORD dwDataSize;
  215.   DWORD dwFirstMBaddress;
  216.   DWORD dwNumMBsInBuffer;
  217.   DWORD dwWidth;
  218.   DWORD dwHeight;
  219.   DWORD dwStride;
  220.   DWORD dwReservedBits;
  221. } DXVA_BufferDescription, *LPDXVA_BufferDescription;
  222. /* Off-Host IDCT Coefficient Data Structures */
  223. typedef struct _DXVA_TCoef4Group {
  224.   BYTE  TCoefIDX[4];
  225.   SHORT TCoefValue[4];
  226. } DXVA_TCoef4Group, *LPDXVA_TCoef4Group;
  227. typedef struct _DXVA_TCoefSingle {
  228.   WORD  wIndexWithEOB;
  229.   SHORT TCoefValue;
  230. } DXVA_TCoefSingle, *LPDXVA_TCoefSingle;
  231. /* Macros for Reading EOB and Index Values */
  232. #define readDXVA_TCoefSingleIDX(ptr) ((ptr)->wIndexWithEOB >> 1)
  233. #define readDXVA_TCoefSingleEOB(ptr) ((ptr)->wIndexWithEOB & 1)
  234. /* Macro for Writing EOB and Index Values */
  235. #define writeDXVA_TCoefSingleIndexWithEOB(ptr, idx, eob) ((ptr)->wIndexWithEOB = ((idx) << 1) | (eob))
  236. #define setDXVA_TCoefSingleIDX(ptr, idx) ((ptr)->wIndexWithEOB |= ((idx) << 1))
  237. #define setDXVA_TCoefSingleEOB(ptr)      ((ptr)->wIndexWithEOB |= 1)
  238. /* Spatial-Domain Residual Difference Blocks */
  239. #define DXVA_USUAL_BLOCK_WIDTH   8
  240. #define DXVA_USUAL_BLOCK_HEIGHT  8
  241. #define DXVA_USUAL_BLOCK_SIZE   (DXVA_USUAL_BLOCK_WIDTH * DXVA_USUAL_BLOCK_HEIGHT)
  242. typedef SHORT       DXVA_Sample16[DXVA_USUAL_BLOCK_SIZE];
  243. typedef signed char DXVA_Sample8 [DXVA_USUAL_BLOCK_SIZE];
  244. /* Deblocking Filter Control Structure */
  245. typedef BYTE DXVA_DeblockingEdgeControl;
  246. typedef DXVA_DeblockingEdgeControl * LPDXVA_DeblockingEdgeControl;
  247. /* Macros for Reading STRENGTH and FilterOn */
  248. #define readDXVA_EdgeFilterStrength(ptr) ((*(ptr)) >> 1)
  249. #define readDXVA_EdgeFilterOn(ptr)       ((*(ptr)) & 1)
  250. /* Macro for Writing STRENGTH and FilterOn */
  251. #define writeDXVA_DeblockingEdgeControl(ptr, str, fon) ((*(ptr)) = ((str) << 1) | (fon))
  252. #define setDXVA_EdgeFilterStrength(ptr, str)           ((*(ptr)) |= ((str) << 1))
  253. #define setDXVA_EdgeFilterOn(ptr)                      ((*(ptr)) |= 1)
  254. /* Macroblock Control Command Data Structures */
  255. typedef struct _DXVA_MVvalue {
  256.   SHORT horz, vert;
  257. } DXVA_MVvalue, *LPDXVA_MVvalue;
  258. /* Inverse Quantization Matrices */
  259. typedef struct _DXVA_QmatrixData {
  260.   BYTE bNewQmatrix[4]; /* intra Y, inter Y, intra chroma, inter chroma */
  261.   WORD Qmatrix[4][DXVA_USUAL_BLOCK_WIDTH * DXVA_USUAL_BLOCK_HEIGHT];
  262. } DXVA_QmatrixData, *LPDXVA_QmatrixData;
  263. /* Slice Control Buffer Data */
  264. typedef struct _DXVA_SliceInfo {
  265.   WORD  wHorizontalPosition;
  266.   WORD  wVerticalPosition;
  267.   DWORD dwSliceBitsInBuffer;
  268.   DWORD dwSliceDataLocation;
  269.   BYTE  bStartCodeBitOffset;
  270.   BYTE  bReservedBits;
  271.   WORD  wMBbitOffset;
  272.   WORD  wNumberMBsInSlice;
  273.   WORD  wQuantizerScaleCode;
  274.   WORD  wBadSliceChopping;
  275. } DXVA_SliceInfo, *LPDXVA_SliceInfo;
  276. #define DXVA_NumMV_OBMC_off_BinPBwith4MV_off    4
  277. #define DXVA_NumMV_OBMC_off_BinPBwith4MV_on  (4+1)
  278. #define DXVA_NumMV_OBMC_on__BinPB_off         (10)
  279. #define DXVA_NumMV_OBMC_on__BinPB_on          (11) /* not current standards */
  280. #define DXVA_NumBlocksPerMB_420 (4+2+0)
  281. #define DXVA_NumBlocksPerMB_422 (4+2+2)
  282. #define DXVA_NumBlocksPerMB_444 (4+4+4)
  283. /* Basic form for I pictures */
  284. /* Host Residual Differences */
  285. typedef struct _DXVA_MBctrl_I_HostResidDiff_1 {
  286.   WORD  wMBaddress;
  287.   WORD  wMBtype;
  288.   DWORD dwMB_SNL;
  289.   WORD  wPatternCode;
  290.   WORD  wPC_Overflow; /* zero if not overflow format */
  291.   DWORD dwReservedBits2;
  292. } DXVA_MBctrl_I_HostResidDiff_1;
  293. /* Basic form for I pictures */
  294. /* Off-Host IDCT, 4:2:0 sampling */
  295. typedef struct _DXVA_MBctrl_I_OffHostIDCT_1 {
  296.   WORD  wMBaddress;
  297.   WORD  wMBtype;
  298.   DWORD dwMB_SNL;
  299.   WORD  wPatternCode;
  300.   BYTE  bNumCoef[DXVA_NumBlocksPerMB_420];
  301. } DXVA_MBctrl_I_OffHostIDCT_1;
  302. /* Basic form for P and B pictures */
  303. /* Should also be used for concealment MVs in MPEG-2 I pictures */
  304. /* Without OBMC, without BinPB and 4MV together, without MV RPS */
  305. /* Host Residual Differences */
  306. typedef struct _DXVA_MBctrl_P_HostResidDiff_1 {
  307.   WORD         wMBaddress;
  308.   WORD         wMBtype;
  309.   DWORD        dwMB_SNL;
  310.   WORD         wPatternCode;
  311.   WORD         wPC_Overflow; /* zero if not overflow format */
  312.   DWORD        dwReservedBits2;
  313.   DXVA_MVvalue MVector[DXVA_NumMV_OBMC_off_BinPBwith4MV_off];
  314. } DXVA_MBctrl_P_HostResidDiff_1;
  315. /* Basic form for P and B pictures */
  316. /* Without OBMC, without BinPB and 4MV together, without MV RPS */
  317. /* Off-Host IDCT, 4:2:0 sampling */
  318. typedef struct _DXVA_MBctrl_P_OffHostIDCT_1 {
  319.   WORD         wMBaddress;
  320.   WORD         wMBtype;
  321.   DWORD        dwMB_SNL;
  322.   WORD         wPatternCode;
  323.   BYTE         bNumCoef[DXVA_NumBlocksPerMB_420];
  324.   DXVA_MVvalue MVector[DXVA_NumMV_OBMC_off_BinPBwith4MV_off];
  325. } DXVA_MBctrl_P_OffHostIDCT_1;
  326. /* How to load alpha blending graphic data */
  327. typedef struct _DXVA_ConfigAlphaLoad {
  328.   // Operation Indicated
  329.   DXVA_ConfigQueryOrReplyFunc dwFunction;
  330.   // Alignment
  331.   DWORD dwReservedBits[3];
  332.   BYTE  bConfigDataType;
  333. } DXVA_ConfigAlphaLoad, *LPDXVA_ConfigAlphaLoad;
  334. #define DXVA_CONFIG_DATA_TYPE_IA44  0
  335. #define DXVA_CONFIG_DATA_TYPE_AI44  1
  336. #define DXVA_CONFIG_DATA_TYPE_DPXD  2
  337. #define DXVA_CONFIG_DATA_TYPE_AYUV  3
  338. /* How to combine alpha blending graphic data */
  339. typedef struct _DXVA_ConfigAlphaCombine {
  340.   // Operation Indicated
  341.   DXVA_ConfigQueryOrReplyFunc dwFunction;
  342.   // Alignment
  343.   DWORD dwReservedBits[3];
  344.   BYTE  bConfigBlendType;
  345.   BYTE  bConfigPictureResizing;
  346.   BYTE  bConfigOnlyUsePicDestRectArea;
  347.   BYTE  bConfigGraphicResizing;
  348.   BYTE  bConfigWholePlaneAlpha;
  349. } DXVA_ConfigAlphaCombine, *LPDXVA_ConfigAlphaCombine;
  350. #define DXVA_CONFIG_BLEND_TYPE_FRONT_BUFFER   0
  351. #define DXVA_CONFIG_BLEND_TYPE_BACK_HARDWARE  1
  352. /* AYUV sample for 16-entry YUV palette or graphic surface */
  353. typedef struct _DXVA_AYUVsample {
  354.   BYTE bSampleAlpha8, bY_Value, bCbValue, bCrValue;
  355. } DXVA_AYUVsample, *LPDXVA_AYUVsample;
  356. /* Macros for IA44 alpha blending surface samples */
  357. typedef BYTE DXVA_IA44sample, *LPDXVA_IA44sample;
  358. #define readDXVA_IA44index(ptr) (((*(ptr)) & 0xF0) >> 4)
  359. #define readDXVA_IA44alpha(ptr)  ((*(ptr)) & 0x0F)
  360. #define writeDXVA_IA44(ptr, idx, alpha) ((*(ptr)) = (((idx) << 4) | (alpha)))
  361. #define setDXVA_IA44index(ptr, idx)    ((*(ptr)) |= ((idx) << 4))
  362. #define setDXVA_IA44alpha(ptr, alpha)  ((*(ptr)) |= (alpha))
  363. /* Macros for AI44 alpha blending surface samples */
  364. typedef BYTE DXVA_AI44sample, *LPDXVA_AI44sample;
  365. #define readDXVA_AI44index(ptr)  ((*(ptr)) & 0x0F)
  366. #define readDXVA_AI44alpha(ptr) (((*(ptr)) & 0xF0) >> 4)
  367. #define writeDXVA_AI44(ptr, idx, alpha) ((*(ptr)) = (((alpha) << 4) | (idx)))
  368. #define setDXVA_AI44index(ptr, idx)    ((*(ptr)) |= (idx))
  369. #define setDXVA_AI44alpha(ptr, alpha)  ((*(ptr)) |= ((alpha) << 4))
  370. /* Highlight data structure */
  371. typedef struct _DXVA_Highlight {
  372.   WORD wHighlightActive;
  373.   WORD wHighlightIndices;
  374.   WORD wHighlightAlphas;
  375.   RECT HighlightRect;
  376. } DXVA_Highlight, *LPDXVA_Highlight;
  377. typedef BYTE DXVA_DPXD,  *LPDXVA_DPXD;
  378. typedef WORD DXVA_DCCMD, *LPDXVA_DCCMD;
  379. /* Alpha blend combination */
  380. typedef struct _DXVA_BlendCombination {
  381.   WORD wPictureSourceIndex;
  382.   WORD wBlendedDestinationIndex;
  383.   RECT PictureSourceRect16thPel;
  384.   RECT PictureDestinationRect;
  385.   RECT GraphicSourceRect;
  386.   RECT GraphicDestinationRect;
  387.   WORD wBlendDelay;
  388.   BYTE bBlendOn;
  389.   BYTE bWholePlaneAlpha;
  390.   DXVA_AYUVsample OutsideYUVcolor;
  391. } DXVA_BlendCombination, *LPDXVA_BlendCombination;
  392. /* Encryption Protocol #1 Data Structure */
  393. #define DXVA_MAX_URIsize  1024
  394. typedef struct _DXVA_EncryptProt1Data_Sign512_Accel512 {
  395.   DXVA_EncryptProtocolHeader header;
  396.   DWORD  dwSigningModulusSize;  /* equal to 64 */
  397.   BYTE   SigningModulusValue[64];
  398.   DWORD  dwSigningExponentSize; /* equal to 64 */
  399.   BYTE   SigningExponentValue[64];
  400.   DWORD  dwAccelModulusSize;    /* equal to 64 */
  401.   BYTE   AccelModulusValue[64];
  402.   DWORD  dwAccelExponentSize;   /* equal to 64 */
  403.   BYTE   AccelExponentValue[64];
  404.   DWORD  dwEncryptionFrequency;
  405.   DWORD  dwURIsize;
  406.   WCHAR  URIstring[DXVA_MAX_URIsize];
  407.   BYTE   Signature[64];
  408. } DXVA_EncryptProt1Data_Sign512_Accel512,
  409.   *LPDXVA_EncryptProt1Data_Sign512_Accel512;
  410. #pragma pack(push, 16)
  411. typedef DXVA_MBctrl_I_HostResidDiff_1 *
  412.        LPDXVA_MBctrl_I_HostResidDiff_1;
  413. typedef DXVA_MBctrl_I_OffHostIDCT_1 *
  414.        LPDXVA_MBctrl_I_OffHostIDCT_1;
  415. typedef DXVA_MBctrl_P_HostResidDiff_1 *
  416.        LPDXVA_MBctrl_P_HostResidDiff_1;
  417. typedef DXVA_MBctrl_P_OffHostIDCT_1 *
  418.        LPDXVA_MBctrl_P_OffHostIDCT_1;
  419. #pragma pack(pop)
  420. /*
  421.  * Other forms of pictures are constructed in the obvious way
  422.  * from the above by adjusting the number of residual difference
  423.  * blocks, the number of motion vectors per macroblock, etc.
  424.  */
  425. #define readDXVA_MBskipsFollowing(ptr)       (((ptr)->dwMB_SNL & 0xFF000000) >> 24)
  426. #define readDXVA_MBdataLocation(ptr)         (((ptr)->dwMB_SNL & 0x00FFFFFF))
  427. #define writeDXVA_MB_SNL(ptr, skips, dloc)   ((ptr)->dwMB_SNL = (((skips) << 24) | (dloc)))
  428. #define setDXVA_MBskipsFollowing(ptr, skips) ((ptr)->dwMB_SNL |= ((skips) << 24))
  429. #define setDXVA_MBdataLocation(ptr, dloc)    ((ptr)->dwMB_SNL |= (dloc))
  430. #define readDXVA_MvertFieldSel_3(ptr)    (((ptr)->wMBtype & 0x8000) >> 15)
  431. #define readDXVA_MvertFieldSel_2(ptr)    (((ptr)->wMBtype & 0x4000) >> 14)
  432. #define readDXVA_MvertFieldSel_1(ptr)    (((ptr)->wMBtype & 0x2000) >> 13)
  433. #define readDXVA_MvertFieldSel_0(ptr)    (((ptr)->wMBtype & 0x1000) >> 12)
  434. #define readDXVA_ReservedBits(ptr)       (((ptr)->wMBtype & 0x0800) >> 11)
  435. #define readDXVA_HostResidDiff(ptr)      (((ptr)->wMBtype & 0x0400) >> 10)
  436. #define readDXVA_MotionType(ptr)         (((ptr)->wMBtype & 0x0300) >>  8)
  437. #define readDXVA_MBscanMethod(ptr)       (((ptr)->wMBtype & 0x00C0) >>  6)
  438. #define readDXVA_FieldResidual(ptr)      (((ptr)->wMBtype & 0x0020) >>  5)
  439. #define readDXVA_H261LoopFilter(ptr)     (((ptr)->wMBtype & 0x0010) >>  4)
  440. #define readDXVA_Motion4MV(ptr)          (((ptr)->wMBtype & 0x0008) >>  3)
  441. #define readDXVA_MotionBackward(ptr)     (((ptr)->wMBtype & 0x0004) >>  2)
  442. #define readDXVA_MotionForward(ptr)      (((ptr)->wMBtype & 0x0002) >>  1)
  443. #define readDXVA_IntraMacroblock(ptr)    (((ptr)->wMBtype & 0x0001))
  444. #define setDXVA_MvertFieldSel_3(ptr)     ((ptr)->wMBtype |= 0x8000)
  445. #define setDXVA_MvertFieldSel_2(ptr)     ((ptr)->wMBtype |= 0x4000)
  446. #define setDXVA_MvertFieldSel_1(ptr)     ((ptr)->wMBtype |= 0x2000)
  447. #define setDXVA_MvertFieldSel_0(ptr)     ((ptr)->wMBtype |= 0x1000)
  448. #define setDXVA_ReservedBits(ptr)        ((ptr)->wMBtype |= 0x0800)
  449. #define setDXVA_HostResidDiff(ptr)       ((ptr)->wMBtype |= 0x0400)
  450. #define setDXVA_MotionType(ptr, value)   ((ptr)->wMBtype |= ((value) << 8))
  451. #define setDXVA_MBscanMethod(ptr, value) ((ptr)->wMBtype |= ((value) << 6))
  452. #define setDXVA_FieldResidual(ptr)       ((ptr)->wMBtype |= 0x0020)
  453. #define setDXVA_H261LoopFilter(ptr)      ((ptr)->wMBtype |= 0x0010)
  454. #define setDXVA_Motion4MV(ptr)           ((ptr)->wMBtype |= 0x0008)
  455. #define setDXVA_MotionBackward(ptr)      ((ptr)->wMBtype |= 0x0004)
  456. #define setDXVA_MotionForward(ptr)       ((ptr)->wMBtype |= 0x0002)
  457. #define setDXVA_IntraMacroblock(ptr)     ((ptr)->wMBtype |= 0x0001)
  458. #define readDXVA_Y___0coded(ptr)        (((ptr)->wPatternCode & 0x0800) >> 11)
  459. #define readDXVA_Y___1coded(ptr)        (((ptr)->wPatternCode & 0x0400) >> 10)
  460. #define readDXVA_Y___2coded(ptr)        (((ptr)->wPatternCode & 0x0200) >>  9)
  461. #define readDXVA_Y___3coded(ptr)        (((ptr)->wPatternCode & 0x0100) >>  8)
  462. #define readDXVA_Cb__4coded(ptr)        (((ptr)->wPatternCode & 0x0080) >>  7)
  463. #define readDXVA_Cr__5coded(ptr)        (((ptr)->wPatternCode & 0x0040) >>  6)
  464. #define readDXVA_Cb__6coded(ptr)        (((ptr)->wPatternCode & 0x0020) >>  5)
  465. #define readDXVA_Cr__7coded(ptr)        (((ptr)->wPatternCode & 0x0010) >>  4)
  466. #define readDXVA_Cb__8coded(ptr)        (((ptr)->wPatternCode & 0x0008) >>  3)
  467. #define readDXVA_Cb__9coded(ptr)        (((ptr)->wPatternCode & 0x0004) >>  2)
  468. #define readDXVA_Cr_10coded(ptr)        (((ptr)->wPatternCode & 0x0002) >>  1)
  469. #define readDXVA_Cr_11coded(ptr)        (((ptr)->wPatternCode & 0x0001))
  470. #define readDXVA_Y___0oflow(ptr)        (((ptr)->wPC_Overflow & 0x0800) >> 11)
  471. #define readDXVA_Y___1oflow(ptr)        (((ptr)->wPC_Overflow & 0x0400) >> 10)
  472. #define readDXVA_Y___2oflow(ptr)        (((ptr)->wPC_Overflow & 0x0200) >>  9)
  473. #define readDXVA_Y___3oflow(ptr)        (((ptr)->wPC_Overflow & 0x0100) >>  8)
  474. #define readDXVA_Cb__4oflow(ptr)        (((ptr)->wPC_Overflow & 0x0080) >>  7)
  475. #define readDXVA_Cr__5oflow(ptr)        (((ptr)->wPC_Overflow & 0x0040) >>  6)
  476. #define readDXVA_Cb__6oflow(ptr)        (((ptr)->wPC_Overflow & 0x0020) >>  5)
  477. #define readDXVA_Cr__7oflow(ptr)        (((ptr)->wPC_Overflow & 0x0010) >>  4)
  478. #define readDXVA_Cb__8oflow(ptr)        (((ptr)->wPC_Overflow & 0x0008) >>  3)
  479. #define readDXVA_Cb__9oflow(ptr)        (((ptr)->wPC_Overflow & 0x0004) >>  2)
  480. #define readDXVA_Cr_10oflow(ptr)        (((ptr)->wPC_Overflow & 0x0002) >>  1)
  481. #define readDXVA_Cr_11oflow(ptr)        (((ptr)->wPC_Overflow & 0x0001))
  482. #pragma pack(pop, BeforeDXVApacking)
  483. #ifdef __cplusplus
  484. }
  485. #endif
  486. #endif /* __DIRECTX_VA__ */