Ticket #391: dxva2api.h

File dxva2api.h, 25.9 KB (added by KSHawkEye, 5 years ago)
Line 
1/**
2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the w64 mingw-runtime package.
4 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5 */
6#ifndef _INC_DXVA2API
7#define _INC_DXVA2API
8#if (_WIN32_WINNT >= 0x0600)
9#include <objbase.h>
10#include <d3d9.h>
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15#ifndef __REFERENCE_TIME_DEFINED
16#define __REFERENCE_TIME_DEFINED
17typedef LONGLONG REFERENCE_TIME;
18#endif /*__REFERENCE_TIME_DEFINED*/
19
20#define DXVA2_ProcAmp_None 0x0000
21#define DXVA2_ProcAmp_Brightness 0x0001
22#define DXVA2_ProcAmp_Contrast 0x0002
23#define DXVA2_ProcAmp_Hue 0x0004
24#define DXVA2_ProcAmp_Saturation 0x0008
25
26typedef struct IDirect3DDeviceManager9 IDirect3DDeviceManager9;
27typedef struct IDirectXVideoDecoderService IDirectXVideoDecoderService;
28
29typedef enum _DXVA2_SampleFormat {
30  DXVA2_SampleFormatMask                  = 0x00FF,
31  DXVA2_SampleUnknown                     = 0,
32  DXVA2_SampleProgressiveFrame            = 2,
33  DXVA2_SampleFieldInterleavedEvenFirst   = 3,
34  DXVA2_SampleFieldInterleavedOddFirst    = 4,
35  DXVA2_SampleFieldSingleEven             = 5,
36  DXVA2_SampleFieldSingleOdd              = 6,
37  DXVA2_SampleSubStream                   = 7 
38} DXVA2_SampleFormat;
39
40typedef enum _DXVA2_VideoChromaSubSampling {
41  DXVA2_VideoChromaSubsamplingMask                              = 0x0F,
42  DXVA2_VideoChromaSubsampling_Unknown                          = 0,
43  DXVA2_VideoChromaSubsampling_ProgressiveChroma                = 0x8,
44  DXVA2_VideoChromaSubsampling_Horizontally_Cosited             = 0x4,
45  DXVA2_VideoChromaSubsampling_Vertically_Cosited               = 0x2,
46  DXVA2_VideoChromaSubsampling_Vertically_AlignedChromaPlanes   = 0x1,
47  DXVA2_VideoChromaSubsampling_MPEG2                            = 
48              DXVA2_VideoChromaSubsampling_Horizontally_Cosited |
49              DXVA2_VideoChromaSubsampling_Vertically_AlignedChromaPlanes,
50  DXVA2_VideoChromaSubsampling_MPEG1                            = 
51              DXVA2_VideoChromaSubsampling_Vertically_AlignedChromaPlanes,
52  DXVA2_VideoChromaSubsampling_DV_PAL                           = 
53              DXVA2_VideoChromaSubsampling_Horizontally_Cosited | 
54              DXVA2_VideoChromaSubsampling_Vertically_Cosited,
55  DXVA2_VideoChromaSubsampling_Cosited                          = 
56              DXVA2_VideoChromaSubsampling_Horizontally_Cosited | 
57              DXVA2_VideoChromaSubsampling_Vertically_Cosited | 
58              DXVA2_VideoChromaSubsampling_Vertically_AlignedChromaPlanes
59} DXVA2_VideoChromaSubSampling;
60
61typedef enum _DXVA2_NominalRange {
62  DXVA2_NominalRangeMask       = 0x07,
63  DXVA2_NominalRange_Unknown   = 0,
64  DXVA2_NominalRange_Normal    = 1,
65  DXVA2_NominalRange_Wide      = 2,
66  DXVA2_NominalRange_0_255     = 1,
67  DXVA2_NominalRange_16_235    = 2,
68  DXVA2_NominalRange_48_208    = 3 
69} DXVA2_NominalRange;
70
71typedef enum _DXVA2_VideoLighting {
72  DXVA2_VideoLightingMask       = 0x0F,
73  DXVA2_VideoLighting_Unknown   = 0,
74  DXVA2_VideoLighting_bright    = 1,
75  DXVA2_VideoLighting_office    = 2,
76  DXVA2_VideoLighting_dim       = 3,
77  DXVA2_VideoLighting_dark      = 4 
78} DXVA2_VideoLighting;
79
80typedef enum _DXVA2_VideoPrimaries {
81  DXVA2_VideoPrimariesMask             = 0x001f,
82  DXVA2_VideoPrimaries_Unknown         = 0,
83  DXVA2_VideoPrimaries_reserved        = 1,
84  DXVA2_VideoPrimaries_BT709           = 2,
85  DXVA2_VideoPrimaries_BT470_2_SysM    = 3,
86  DXVA2_VideoPrimaries_BT470_2_SysBG   = 4,
87  DXVA2_VideoPrimaries_SMPTE170M       = 5,
88  DXVA2_VideoPrimaries_SMPTE240M       = 6,
89  DXVA2_VideoPrimaries_EBU3213         = 7,
90  DXVA2_VideoPrimaries_SMPTE_C         = 8 
91} DXVA2_VideoPrimaries;
92
93typedef enum _DXVA2_VideoTransferFunction {
94  DXVA2_VideoTransFuncMask       = 0x001f,
95  DXVA2_VideoTransFunc_Unknown   = 0,
96  DXVA2_VideoTransFunc_10        = 1,
97  DXVA2_VideoTransFunc_18        = 2,
98  DXVA2_VideoTransFunc_20        = 3,
99  DXVA2_VideoTransFunc_22        = 4,
100  DXVA2_VideoTransFunc_709       = 5,
101  DXVA2_VideoTransFunc_240M      = 6,
102  DXVA2_VideoTransFunc_sRGB      = 7,
103  DXVA2_VideoTransFunc_28        = 8 
104} DXVA2_VideoTransferFunction;
105
106typedef enum  {
107  DXVA2_SurfaceType_DecoderRenderTarget      = 0,
108  DXVA2_SurfaceType_ProcessorRenderTarget    = 1,
109  DXVA2_SurfaceType_D3DRenderTargetTexture   = 2 
110} DXVA2_SurfaceType;
111
112typedef enum _DXVA2_VideoTransferMatrix {
113  DXVA2_VideoTransferMatrixMask         = 0x07,
114  DXVA2_VideoTransferMatrix_Unknown     = 0,
115  DXVA2_VideoTransferMatrix_BT709       = 1,
116  DXVA2_VideoTransferMatrix_BT601       = 2,
117  DXVA2_VideoTransferMatrix_SMPTE240M   = 3 
118} DXVA2_VideoTransferMatrix;
119
120#pragma pack(push, 1)
121typedef struct _DXVA2_AYUVSample16 {
122  USHORT Cr;
123  USHORT Cb;
124  USHORT Y;
125  USHORT Alpha;
126} DXVA2_AYUVSample16;
127
128typedef struct _DXVA2_AYUVSample8 {
129  UCHAR Cr;
130  UCHAR Cb;
131  UCHAR Y;
132  UCHAR Alpha;
133} DXVA2_AYUVSample8;
134
135typedef struct _DXVA2_ConfigPictureDecode {
136  GUID   guidConfigBitstreamEncryption;
137  GUID   guidConfigMBcontrolEncryption;
138  GUID   guidConfigResidDiffEncryption;
139  UINT   ConfigBitstreamRaw;
140  UINT   ConfigMBcontrolRasterOrder;
141  UINT   ConfigResidDiffHost;
142  UINT   ConfigSpatialResid8;
143  UINT   ConfigResid8Subtraction;
144  UINT   ConfigSpatialHost8or9Clipping;
145  UINT   ConfigSpatialResidInterleaved;
146  UINT   ConfigIntraResidUnsigned;
147  UINT   ConfigResidDiffAccelerator;
148  UINT   ConfigHostInverseScan;
149  UINT   ConfigSpecificIDCT;
150  UINT   Config4GroupedCoefs;
151  UINT   ConfigMinRenderTargetBuffCount;
152  USHORT ConfigDecoderSpecific;
153} DXVA2_ConfigPictureDecode;
154
155typedef struct _DXVA2_DecodeBufferDesc {
156  DWORD CompressedBufferType;
157  UINT  BufferIndex;
158  UINT  DataOffset;
159  UINT  DataSize;
160  UINT  FirstMBaddress;
161  UINT  NumMBsInBuffer;
162  UINT  Width;
163  UINT  Height;
164  UINT  Stride;
165  UINT  ReservedBits;
166  PVOID pvPVPState;
167} DXVA2_DecodeBufferDesc;
168
169typedef struct _DXVA2_DecodeExtensionData {
170  UINT  Function;
171  PVOID pPrivateInputData;
172  UINT  PrivateInputDataSize;
173  PVOID pPrivateOutputData;
174  UINT  PrivateOutputDataSize;
175} DXVA2_DecodeExtensionData;
176
177typedef struct _DXVA2_DecodeExecuteParams {
178  UINT                      NumCompBuffers;
179  DXVA2_DecodeBufferDesc    *pCompressedBuffers;
180  DXVA2_DecodeExtensionData *pExtensionData;
181} DXVA2_DecodeExecuteParams;
182
183typedef struct {
184  __C89_NAMELESS union {
185    __C89_NAMELESS struct {
186      UINT SampleFormat            :8;
187      UINT VideoChromaSubsampling  :4;
188      UINT NominalRange            :3;
189      UINT VideoTransferMatrix     :3;
190      UINT VideoLighting           :4;
191      UINT VideoPrimaries          :5;
192      UINT VideoTransferFunction   :5;
193    } DUMMYSTRUCTNAME;
194    UINT   value;
195  } DUMMYUNIONNAME;
196} DXVA2_ExtendedFormat;
197
198typedef struct _DXVA2_Fixed32 {
199  __C89_NAMELESS union {
200    __C89_NAMELESS struct {
201      USHORT Fraction;
202      SHORT  Value;
203    } DUMMYSTRUCTNAME;
204    LONG   ll;
205  } DUMMYUNIONNAME;
206} DXVA2_Fixed32;
207
208typedef struct _DXVA2_FilterValues {
209  DXVA2_Fixed32 Level;
210  DXVA2_Fixed32 Threshold;
211  DXVA2_Fixed32 Radius;
212} DXVA2_FilterValues;
213
214typedef struct _DXVA2_Frequency {
215  UINT Numerator;
216  UINT Denominator;
217} DXVA2_Frequency;
218
219typedef struct _DXVA2_ProcAmpValues {
220  DXVA2_Fixed32 Brightness;
221  DXVA2_Fixed32 Contrast;
222  DXVA2_Fixed32 Hue;
223  DXVA2_Fixed32 Saturation;
224} DXVA2_ProcAmpValues;
225
226typedef struct _DXVA2_ValueRange {
227  DXVA2_Fixed32 MinValue;
228  DXVA2_Fixed32 MaxValue;
229  DXVA2_Fixed32 DefaultValue;
230  DXVA2_Fixed32 StepSize;
231} DXVA2_ValueRange;
232
233typedef struct _DXVA2_VideoDesc {
234  UINT                 SampleWidth;
235  UINT                 SampleHeight;
236  DXVA2_ExtendedFormat SampleFormat;
237  D3DFORMAT            Format;
238  DXVA2_Frequency      InputSampleFreq;
239  DXVA2_Frequency      OutputFrameFreq;
240  UINT                 UABProtectionLevel;
241  UINT                 Reserved;
242} DXVA2_VideoDesc;
243
244/* DeviceCaps
245DXVA2_VPDev_EmulatedDXVA1
246DXVA2_VPDev_HardwareDevice
247DXVA2_VPDev_SoftwareDevice
248*/
249/* DeinterlaceTechnology
250DXVA2_DeinterlaceTech_Unknown
251DXVA2_DeinterlaceTech_BOBLineReplicate
252DXVA2_DeinterlaceTech_BOBVerticalStretch
253DXVA2_DeinterlaceTech_BOBVerticalStretch4Tap
254DXVA2_DeinterlaceTech_MedianFiltering
255DXVA2_DeinterlaceTech_EdgeFiltering
256DXVA2_DeinterlaceTech_FieldAdaptive
257DXVA2_DeinterlaceTech_PixelAdaptive
258DXVA2_DeinterlaceTech_MotionVectorSteered
259DXVA2_DeinterlaceTech_InverseTelecine
260*/
261
262/* VideoProcessorOperations
263DXVA2_VideoProcess_YUV2RGB
264DXVA2_VideoProcess_StretchX
265DXVA2_VideoProcess_StretchY
266DXVA2_VideoProcess_AlphaBlend
267DXVA2_VideoProcess_SubRects
268DXVA2_VideoProcess_SubStreams
269DXVA2_VideoProcess_SubStreamsExtended
270DXVA2_VideoProcess_YUV2RGBExtended
271DXVA2_VideoProcess_AlphaBlendExtended
272DXVA2_VideoProcess_Constriction
273DXVA2_VideoProcess_NoiseFilter
274DXVA2_VideoProcess_DetailFilter
275DXVA2_VideoProcess_PlanarAlpha
276DXVA2_VideoProcess_LinearScaling
277DXVA2_VideoProcess_GammaCompensated
278DXVA2_VideoProcess_MaintainsOriginalFieldData
279*/
280
281/*NoiseFilterTechnology
282DXVA2_NoiseFilterTech_Unsupported
283DXVA2_NoiseFilterTech_Unknown
284DXVA2_NoiseFilterTech_Median
285DXVA2_NoiseFilterTech_Temporal
286DXVA2_NoiseFilterTech_BlockNoise
287DXVA2_NoiseFilterTech_MosquitoNoise
288*/
289
290/* DetailFilterTechnology
291DXVA2_DetailFilterTech_Unsupported
292DXVA2_DetailFilterTech_Unknown
293DXVA2_DetailFilterTech_Edge
294DXVA2_DetailFilterTech_Sharpening
295*/
296typedef struct _DXVA2_VideoProcessBltParams {
297  REFERENCE_TIME       TargetFrame;
298  RECT                 TargetRect;
299  SIZE                 ConstrictionSize;
300  UINT                 StreamingFlags;
301  DXVA2_AYUVSample16   BackgroundColor;
302  DXVA2_ExtendedFormat DestFormat;
303  DXVA2_ProcAmpValues  ProcAmpValues;
304  DXVA2_Fixed32        Alpha;
305  DXVA2_FilterValues   NoiseFilterLuma;
306  DXVA2_FilterValues   NoiseFilterChroma;
307  DXVA2_FilterValues   DetailFilterLuma;
308  DXVA2_FilterValues   DetailFilterChroma;
309  DWORD                DestData;
310} DXVA2_VideoProcessBltParams;
311
312typedef struct _DXVA2_VideoProcessorCaps {
313  UINT    DeviceCaps;
314  D3DPOOL InputPool;
315  UINT    NumForwardRefSamples;
316  UINT    NumBackwardRefSamples;
317  UINT    Reserved;
318  UINT    DeinterlaceTechnology;
319  UINT    ProcAmpControlCaps;
320  UINT    VideoProcessorOperations;
321  UINT    NoiseFilterTechnology;
322  UINT    DetailFilterTechnology;
323} DXVA2_VideoProcessorCaps;
324
325/* SampleData
326DXVA2_SampleData_RFF
327DXVA2_SampleData_TFF
328DXVA2_SampleData_RFF_TFF_Present
329*/
330
331typedef struct _DXVA2_VideoSample {
332  REFERENCE_TIME       Start;
333  REFERENCE_TIME       End;
334  DXVA2_ExtendedFormat SampleFormat;
335  IDirect3DSurface9*   SrcSurface;
336  RECT                 SrcRect;
337  RECT                 DstRect;
338  DXVA2_AYUVSample8    Pal[16];
339  DXVA2_Fixed32        PlanarAlpha;
340  DWORD                SampleData;
341} DXVA2_VideoSample;
342
343/* DXVA H264 */
344typedef struct {
345    __C89_NAMELESS union {
346        __C89_NAMELESS struct {
347            UCHAR Index7Bits     : 7;
348            UCHAR AssociatedFlag : 1;
349        };
350        UCHAR bPicEntry;
351    };
352} DXVA_PicEntry_H264;
353
354typedef struct {
355    USHORT  wFrameWidthInMbsMinus1;
356    USHORT  wFrameHeightInMbsMinus1;
357    DXVA_PicEntry_H264 InPic;
358    DXVA_PicEntry_H264 OutPic;
359    USHORT  PicOrderCnt_offset;
360    INT     CurrPicOrderCnt;
361    UINT    StatusReportFeedbackNumber;
362    UCHAR   model_id;
363    UCHAR   separate_colour_description_present_flag;
364    UCHAR   film_grain_bit_depth_luma_minus8;
365    UCHAR   film_grain_bit_depth_chroma_minus8;
366    UCHAR   film_grain_full_range_flag;
367    UCHAR   film_grain_colour_primaries;
368    UCHAR   film_grain_transfer_characteristics;
369    UCHAR   film_grain_matrix_coefficients;
370    UCHAR   blending_mode_id;
371    UCHAR   log2_scale_factor;
372    UCHAR   comp_model_present_flag[4];
373    UCHAR   num_intensity_intervals_minus1[4];
374    UCHAR   num_model_values_minus1[4];
375    UCHAR   intensity_interval_lower_bound[3][16];
376    UCHAR   intensity_interval_upper_bound[3][16];
377    SHORT   comp_model_value[3][16][8];
378} DXVA_FilmGrainChar_H264;
379
380/* DXVA MPEG-I/II and VC-1 */
381typedef struct _DXVA_PictureParameters {
382    USHORT  wDecodedPictureIndex;
383    USHORT  wDeblockedPictureIndex;
384    USHORT  wForwardRefPictureIndex;
385    USHORT  wBackwardRefPictureIndex;
386    USHORT  wPicWidthInMBminus1;
387    USHORT  wPicHeightInMBminus1;
388    UCHAR   bMacroblockWidthMinus1;
389    UCHAR   bMacroblockHeightMinus1;
390    UCHAR   bBlockWidthMinus1;
391    UCHAR   bBlockHeightMinus1;
392    UCHAR   bBPPminus1;
393    UCHAR   bPicStructure;
394    UCHAR   bSecondField;
395    UCHAR   bPicIntra;
396    UCHAR   bPicBackwardPrediction;
397    UCHAR   bBidirectionalAveragingMode;
398    UCHAR   bMVprecisionAndChromaRelation;
399    UCHAR   bChromaFormat;
400    UCHAR   bPicScanFixed;
401    UCHAR   bPicScanMethod;
402    UCHAR   bPicReadbackRequests;
403    UCHAR   bRcontrol;
404    UCHAR   bPicSpatialResid8;
405    UCHAR   bPicOverflowBlocks;
406    UCHAR   bPicExtrapolation;
407    UCHAR   bPicDeblocked;
408    UCHAR   bPicDeblockConfined;
409    UCHAR   bPic4MVallowed;
410    UCHAR   bPicOBMC;
411    UCHAR   bPicBinPB;
412    UCHAR   bMV_RPS;
413    UCHAR   bReservedBits;
414    USHORT  wBitstreamFcodes;
415    USHORT  wBitstreamPCEelements;
416    UCHAR   bBitstreamConcealmentNeed;
417    UCHAR   bBitstreamConcealmentMethod;
418} DXVA_PictureParameters, *LPDXVA_PictureParameters;
419
420typedef struct _DXVA_QmatrixData {
421    BYTE    bNewQmatrix[4];
422    WORD    Qmatrix[4][8 * 8];
423} DXVA_QmatrixData, *LPDXVA_QmatrixData;
424
425typedef struct _DXVA_SliceInfo {
426    USHORT  wHorizontalPosition;
427    USHORT  wVerticalPosition;
428    UINT    dwSliceBitsInBuffer;
429    UINT    dwSliceDataLocation;
430    UCHAR   bStartCodeBitOffset;
431    UCHAR   bReservedBits;
432    USHORT  wMBbitOffset;
433    USHORT  wNumberMBsInSlice;
434    USHORT  wQuantizerScaleCode;
435    USHORT  wBadSliceChopping;
436} DXVA_SliceInfo, *LPDXVA_SliceInfo;
437
438typedef struct {
439    USHORT wFrameWidthInMbsMinus1;
440    USHORT wFrameHeightInMbsMinus1;
441    DXVA_PicEntry_H264 CurrPic;
442    UCHAR  num_ref_frames;
443    __C89_NAMELESS union {
444        __C89_NAMELESS struct {
445            USHORT field_pic_flag           : 1;
446            USHORT MbaffFrameFlag           : 1;
447            USHORT residual_colour_transform_flag : 1;
448            USHORT sp_for_switch_flag       : 1;
449            USHORT chroma_format_idc        : 2;
450            USHORT RefPicFlag               : 1;
451            USHORT constrained_intra_pred_flag : 1;
452            USHORT weighted_pred_flag       : 1;
453            USHORT weighted_bipred_idc      : 2;
454            USHORT MbsConsecutiveFlag       : 1;
455            USHORT frame_mbs_only_flag      : 1;
456            USHORT transform_8x8_mode_flag  : 1;
457            USHORT MinLumaBipredSize8x8Flag : 1;
458            USHORT IntraPicFlag             : 1;
459        };
460        USHORT wBitFields;
461    };
462    UCHAR   bit_depth_luma_minus8;
463    UCHAR   bit_depth_chroma_minus8;
464    USHORT  Reserved16Bits;
465    UINT    StatusReportFeedbackNumber;
466    DXVA_PicEntry_H264 RefFrameList[16];
467    INT     CurrFieldOrderCnt[2];
468    INT     FieldOrderCntList[16][2];
469    CHAR    pic_init_qs_minus26;
470    CHAR    chroma_qp_index_offset;
471    CHAR    second_chroma_qp_index_offset;
472    UCHAR   ContinuationFlag;
473    CHAR    pic_init_qp_minus26;
474    UCHAR   num_ref_idx_l0_active_minus1;
475    UCHAR   num_ref_idx_l1_active_minus1;
476    UCHAR   Reserved8BitsA;
477    USHORT  FrameNumList[16];
478    UINT    UsedForReferenceFlags;
479    USHORT  NonExistingFrameFlags;
480    USHORT  frame_num;
481    UCHAR   log2_max_frame_num_minus4;
482    UCHAR   pic_order_cnt_type;
483    UCHAR   log2_max_pic_order_cnt_lsb_minus4;
484    UCHAR   delta_pic_order_always_zero_flag;
485    UCHAR   direct_8x8_inference_flag;
486    UCHAR   entropy_coding_mode_flag;
487    UCHAR   pic_order_present_flag;
488    UCHAR   num_slice_groups_minus1;
489    UCHAR   slice_group_map_type;
490    UCHAR   deblocking_filter_control_present_flag;
491    UCHAR   redundant_pic_cnt_present_flag;
492    UCHAR   Reserved8BitsB;
493    USHORT  slice_group_change_rate_minus1;
494    UCHAR   SliceGroupMap[810];
495} DXVA_PicParams_H264;
496
497typedef struct {
498    UCHAR   bScalingLists4x4[6][16];
499    UCHAR   bScalingLists8x8[2][64];
500} DXVA_Qmatrix_H264;
501
502typedef struct {
503    UINT    BSNALunitDataLocation;
504    UINT    SliceBytesInBuffer;
505    USHORT  wBadSliceChopping;
506    USHORT  first_mb_in_slice;
507    USHORT  NumMbsForSlice;
508    USHORT  BitOffsetToSliceData;
509    UCHAR   slice_type;
510    UCHAR   luma_log2_weight_denom;
511    UCHAR   chroma_log2_weight_denom;
512    UCHAR   num_ref_idx_l0_active_minus1;
513    UCHAR   num_ref_idx_l1_active_minus1;
514    CHAR    slice_alpha_c0_offset_div2;
515    CHAR    slice_beta_offset_div2;
516    UCHAR   Reserved8Bits;
517    DXVA_PicEntry_H264 RefPicList[2][32];
518    SHORT   Weights[2][32][3][2];
519    CHAR    slice_qs_delta;
520    CHAR    slice_qp_delta;
521    UCHAR   redundant_pic_cnt;
522    UCHAR   direct_spatial_mv_pred_flag;
523    UCHAR   cabac_init_idc;
524    UCHAR   disable_deblocking_filter_idc;
525    USHORT  slice_id;
526} DXVA_Slice_H264_Long;
527
528typedef struct {
529    UINT    BSNALunitDataLocation;
530    UINT    SliceBytesInBuffer;
531    USHORT  wBadSliceChopping;
532} DXVA_Slice_H264_Short;
533
534#pragma pack(pop)
535
536/* Constants */
537
538#define DXVA2_VideoDecoderRenderTarget 0
539#define DXVA2_VideoProcessorRenderTarget 1
540#define DXVA2_VideoSoftwareRenderTarget 2
541
542/* CompressedBufferType */
543#define DXVA2_PictureParametersBufferType 0
544#define DXVA2_MacroBlockControlBufferType 1
545#define DXVA2_ResidualDifferenceBufferType 2
546#define DXVA2_DeblockingControlBufferType 3
547#define DXVA2_InverseQuantizationMatrixBufferType 4
548#define DXVA2_SliceControlBufferType 5
549#define DXVA2_BitStreamDateBufferType 6
550#define DXVA2_MotionVectorBuffer 7
551#define DXVA2_FilmGrainBuffer 8
552
553__forceinline const DXVA2_Fixed32 DXVA2_Fixed32OpaqueAlpha (void) {
554  DXVA2_Fixed32 f32;
555  f32.ll = 0 + (1 << 16);
556  return f32;
557}
558
559__forceinline const DXVA2_Fixed32 DXVA2_Fixed32TransparentAlpha (void) {
560  DXVA2_Fixed32 f32;
561  f32.ll = 0;
562  return f32;
563}
564
565__forceinline float DXVA2FixedToFloat (const DXVA2_Fixed32 f32) {
566  return (float)f32.Value + (float)f32.Fraction / (1 << 16);
567}
568
569__forceinline DXVA2_Fixed32 DXVA2FloatToFixed (const float f) {
570  DXVA2_Fixed32 f32;
571  f32.Value    = ((ULONG) (f * (1 << 16))) >> 16;
572  f32.Fraction = ((ULONG) (f * (1 << 16))) & 0xFFFF;
573  return f32;
574}
575
576HRESULT WINAPI DXVA2CreateDirect3DDeviceManager9(UINT *pResetToken,IDirect3DDeviceManager9 **ppDXVAManager);
577HRESULT WINAPI DXVA2CreateVideoService(IDirect3DDevice9 *pDD,REFIID riid,void **ppService);
578
579#ifdef __cplusplus
580}
581#endif
582
583/* COM Interfaces */
584
585#undef  INTERFACE
586#define INTERFACE IDirectXVideoDecoder
587DECLARE_INTERFACE_(IDirectXVideoDecoder,IUnknown)
588{
589    BEGIN_INTERFACE
590
591    /* IUnknown methods */
592    STDMETHOD(QueryInterface)(THIS_ REFIID riid, void **ppvObject) PURE;
593    STDMETHOD_(ULONG, AddRef)(THIS) PURE;
594    STDMETHOD_(ULONG, Release)(THIS) PURE;
595
596    /* IDirectXVideoDecoder methods */
597    STDMETHOD_(HRESULT,GetVideoDecoderService)(THIS_ IDirectXVideoDecoderService **ppAccelServices) PURE;
598    STDMETHOD_(HRESULT,GetCreationParameters)(THIS_ GUID *pDeviceGuid,DXVA2_VideoDesc *pVideoDesc,DXVA2_ConfigPictureDecode *pConfig,IDirect3DSurface9 ***pppDecoderRenderTargets,UINT *pNumSurfaces) PURE;
599    STDMETHOD_(HRESULT,GetBuffer)(THIS_ UINT BufferType,void **ppBuffer,UINT *pBufferSize) PURE;
600    STDMETHOD_(HRESULT,ReleaseBuffer)(THIS_ UINT BufferType) PURE;
601    STDMETHOD_(HRESULT,BeginFrame)(THIS_ IDirect3DSurface9 *pRenderTarget,void *pvPVPData) PURE;
602    STDMETHOD_(HRESULT,EndFrame)(THIS_ HANDLE *pHandleComplete) PURE;
603    STDMETHOD_(HRESULT,Execute)(THIS_ const DXVA2_DecodeExecuteParams *pExecuteParams) PURE;
604
605    END_INTERFACE
606};
607#ifdef COBJMACROS
608#define IDirectXVideoDecoder_QueryInterface(This,riid,ppvObject) (This)->pVtbl->QueryInterface(This,riid,ppvObject)
609#define IDirectXVideoDecoder_AddRef(This) (This)->pVtbl->AddRef(This)
610#define IDirectXVideoDecoder_Release(This) (This)->pVtbl->Release(This)
611#define IDirectXVideoDecoder_GetVideoDecoderService(This,ppAccelServices) (This)->lpVtbl->GetVideoDecoderService(This,ppAccelServices)
612#define IDirectXVideoDecoder_GetCreationParameters(This,pDeviceGuid,pVideoDesc,pConfig,pppDecoderRenderTargets,pNumSurfaces) (This)->lpVtbl->GetCreationParameters(This,pDeviceGuid,pVideoDesc,pConfig,pppDecoderRenderTargets,pNumSurfaces)
613#define IDirectXVideoDecoder_GetBuffer(This,BufferType,ppBuffer,pBufferSize) (This)->lpVtbl->GetBuffer(This,BufferType,ppBuffer,pBufferSize)
614#define IDirectXVideoDecoder_ReleaseBuffer(This,BufferType) (This)->lpVtbl->ReleaseBuffer(This,BufferType)
615#define IDirectXVideoDecoder_BeginFrame(This,pRenderTarget,pvPVPData) (This)->lpVtbl->BeginFrame(This,pRenderTarget,pvPVPData)
616#define IDirectXVideoDecoder_EndFrame(This,pHandleComplete) (This)->lpVtbl->EndFrame(This,pHandleComplete)
617#define IDirectXVideoDecoder_Execute(This,pExecuteParams) (This)->lpVtbl->Execute(This,pExecuteParams)
618#endif /*COBJMACROS*/
619
620#undef  INTERFACE
621#define INTERFACE IDirectXVideoAccelerationService
622DECLARE_INTERFACE_(IDirectXVideoAccelerationService,IUnknown)
623{
624    BEGIN_INTERFACE
625
626    /* IUnknown methods */
627    STDMETHOD(QueryInterface)(THIS_ REFIID riid, void **ppvObject) PURE;
628    STDMETHOD_(ULONG, AddRef)(THIS) PURE;
629    STDMETHOD_(ULONG, Release)(THIS) PURE;
630
631    /* IDirectXVideoAccelerationService methods */
632    STDMETHOD_(HRESULT,CreateSurface)(THIS_ UINT Width,UINT Height,UINT BackBuffers,D3DFORMAT Format,D3DPOOL Pool,DWORD Usage,DWORD DxvaType,IDirect3DSurface9 **ppSurface,HANDLE *pSharedHandle) PURE;
633
634    END_INTERFACE
635};
636#ifdef COBJMACROS
637#define IDirectXVideoAccelerationService_QueryInterface(This,riid,ppvObject) (This)->pVtbl->QueryInterface(This,riid,ppvObject)
638#define IDirectXVideoAccelerationService_AddRef(This) (This)->pVtbl->AddRef(This)
639#define IDirectXVideoAccelerationService_Release(This) (This)->pVtbl->Release(This)
640#define IDirectXVideoAccelerationService_CreateSurface(This,Width,Height,BackBuffers,Format,Pool,Usage,DxvaType,ppSurface,pSharedHandle) (This)->lpVtbl->CreateSurface(This,Width,Height,BackBuffers,Format,Pool,Usage,DxvaType,ppSurface,pSharedHandle)
641#endif /*COBJMACROS*/
642
643#undef  INTERFACE
644#define INTERFACE IDirectXVideoDecoderService
645DECLARE_INTERFACE_(IDirectXVideoDecoderService,IDirectXVideoAccelerationService)
646{
647    BEGIN_INTERFACE
648
649    /* IUnknown methods */
650    STDMETHOD(QueryInterface)(THIS_ REFIID riid, void **ppvObject) PURE;
651    STDMETHOD_(ULONG, AddRef)(THIS) PURE;
652    STDMETHOD_(ULONG, Release)(THIS) PURE;
653
654    /* IDirectXVideoAccelerationService methods */
655    STDMETHOD_(HRESULT,CreateSurface)(THIS_ UINT Width,UINT Height,UINT BackBuffers,D3DFORMAT Format,D3DPOOL Pool,DWORD Usage,DWORD DxvaType,IDirect3DSurface9 **ppSurface,HANDLE *pSharedHandle) PURE;
656   
657    /* IDirectXVideoDecoderService methods */
658    STDMETHOD_(HRESULT,GetDecoderDeviceGuids)(THIS_ UINT *Count,GUID **pGuids) PURE;
659    STDMETHOD_(HRESULT,GetDecoderRenderTargets)(THIS_ REFGUID Guid,UINT *pCount,D3DFORMAT **pFormats) PURE;
660    STDMETHOD_(HRESULT,GetDecoderConfigurations)(THIS_ REFGUID Guid,const DXVA2_VideoDesc *pVideoDesc,IUnknown *pReserved,UINT *pCount,DXVA2_ConfigPictureDecode **ppConfigs) PURE;
661    STDMETHOD_(HRESULT,CreateVideoDecoder)(THIS_ REFGUID Guid,const DXVA2_VideoDesc *pVideoDesc,DXVA2_ConfigPictureDecode *pConfig,IDirect3DSurface9 **ppDecoderRenderTargets,UINT NumSurfaces,IDirectXVideoDecoder **ppDecode) PURE;
662
663    END_INTERFACE
664};
665#ifdef COBJMACROS
666#define IDirectXVideoDecoderService_QueryInterface(This,riid,ppvObject) (This)->pVtbl->QueryInterface(This,riid,ppvObject)
667#define IDirectXVideoDecoderService_AddRef(This) (This)->pVtbl->AddRef(This)
668#define IDirectXVideoDecoderService_Release(This) (This)->pVtbl->Release(This)
669#define IDirectXVideoDecoderService_CreateSurface(This,Width,Height,BackBuffers,Format,Pool,Usage,DxvaType,ppSurface,pSharedHandle) (This)->lpVtbl->CreateSurface(This,Width,Height,BackBuffers,Format,Pool,Usage,DxvaType,ppSurface,pSharedHandle)
670#define IDirectXVideoDecoderService_GetDecoderDeviceGuids(This,Count,pGuids) (This)->lpVtbl->GetDecoderDeviceGuids(This,Count,pGuids)
671#define IDirectXVideoDecoderService_GetDecoderRenderTargets(This,Guid,pCount,pFormats) (This)->lpVtbl->GetDecoderRenderTargets(This,Guid,pCount,pFormats)
672#define IDirectXVideoDecoderService_GetDecoderConfigurations(This,Guid,pVideoDesc,pReserved,pCount,ppConfigs) (This)->lpVtbl->GetDecoderConfigurations(This,Guid,pVideoDesc,pReserved,pCount,ppConfigs)
673#define IDirectXVideoDecoderService_CreateVideoDecoder(This,Guid,pVideoDesc,pConfig,ppDecoderRenderTargets,NumSurfaces,ppDecode) (This)->lpVtbl->CreateVideoDecoder(This,Guid,pVideoDesc,pConfig,ppDecoderRenderTargets,NumSurfaces,ppDecode)
674#endif /*COBJMACROS*/
675
676#undef  INTERFACE
677#define INTERFACE IDirect3DDeviceManager9
678DECLARE_INTERFACE_(IDirect3DDeviceManager9,IUnknown)
679{
680    BEGIN_INTERFACE
681
682    /* IUnknown methods */
683    STDMETHOD(QueryInterface)(THIS_ REFIID riid, void **ppvObject) PURE;
684    STDMETHOD_(ULONG, AddRef)(THIS) PURE;
685    STDMETHOD_(ULONG, Release)(THIS) PURE;
686
687    /* IDirect3DDeviceManager9 methods */
688    STDMETHOD_(HRESULT,ResetDevice)(THIS_ IDirect3DDevice9 *pDevice,UINT resetToken) PURE;
689    STDMETHOD_(HRESULT,OpenDeviceHandle)(THIS_ HANDLE *phDevice) PURE;
690    STDMETHOD_(HRESULT,CloseDeviceHandle)(THIS_ HANDLE hDevice) PURE;
691    STDMETHOD_(HRESULT,TestDevice)(THIS_ HANDLE hDevice) PURE;
692    STDMETHOD_(HRESULT,LockDevice)(THIS_ HANDLE hDevice,IDirect3DDevice9 **ppDevice,WINBOOL fBlock) PURE;
693    STDMETHOD_(HRESULT,UnlockDevice)(THIS_ HANDLE hDevice,BOOL fSaveState) PURE;
694    STDMETHOD_(HRESULT,GetVideoService)(THIS_ HANDLE hDevice,REFIID riid,void **ppService) PURE;
695
696    END_INTERFACE
697};
698#ifdef COBJMACROS
699#define IDirect3DDeviceManager9_QueryInterface(This,riid,ppvObject) (This)->pVtbl->QueryInterface(This,riid,ppvObject)
700#define IDirect3DDeviceManager9_AddRef(This) (This)->pVtbl->AddRef(This)
701#define IDirect3DDeviceManager9_Release(This) (This)->pVtbl->Release(This)
702#define IDirect3DDeviceManager9_ResetDevice(This,pDevice,resetToken) (This)->lpVtbl->ResetDevice(This,pDevice,resetToken)
703#define IDirect3DDeviceManager9_OpenDeviceHandle(This,phDevice) (This)->lpVtbl->OpenDeviceHandle(This,phDevice)
704#define IDirect3DDeviceManager9_CloseDeviceHandle(This,hDevice) (This)->lpVtbl->CloseDeviceHandle(This,hDevice)
705#define IDirect3DDeviceManager9_TestDevice(This,hDevice) (This)->lpVtbl->TestDevice(This,hDevice)
706#define IDirect3DDeviceManager9_LockDevice(This,hDevice,ppDevice,fBlock) (This)->lpVtbl->LockDevice(This,hDevice,ppDevice,fBlock)
707#define IDirect3DDeviceManager9_UnlockDevice(This,hDevice,fSaveState) (This)->lpVtbl->UnlockDevice(This,hDevice,fSaveState)
708#define IDirect3DDeviceManager9_GetVideoService(This,hDevice,riid,ppService) (This)->lpVtbl->GetVideoService(This,hDevice,riid,ppService)
709#endif /*COBJMACROS*/
710
711#endif /*(_WIN32_WINNT >= 0x0600)*/
712#endif /*_INC_DXVA2API*/