• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * This file has no copyright assigned and is placed in the Public Domain.
3  * This file is part of the mingw-w64 runtime package.
4  * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5  */
6 #ifndef _INC_DXVA
7 #define _INC_DXVA
8 
9 #include <objbase.h>
10 #include <guiddef.h>
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 DEFINE_GUID(DXVA_NoEncrypt, 0x1b81bed0, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
16 
17 /* DXVA H264 */
18 typedef struct {
19     __C89_NAMELESS union {
20         __C89_NAMELESS struct {
21             UCHAR Index7Bits     : 7;
22             UCHAR AssociatedFlag : 1;
23         };
24         UCHAR bPicEntry;
25     };
26 } DXVA_PicEntry_H264;
27 
28 #pragma pack(push, 1)
29 typedef struct {
30     USHORT  wFrameWidthInMbsMinus1;
31     USHORT  wFrameHeightInMbsMinus1;
32     DXVA_PicEntry_H264 InPic;
33     DXVA_PicEntry_H264 OutPic;
34     USHORT  PicOrderCnt_offset;
35     INT     CurrPicOrderCnt;
36     UINT    StatusReportFeedbackNumber;
37     UCHAR   model_id;
38     UCHAR   separate_colour_description_present_flag;
39     UCHAR   film_grain_bit_depth_luma_minus8;
40     UCHAR   film_grain_bit_depth_chroma_minus8;
41     UCHAR   film_grain_full_range_flag;
42     UCHAR   film_grain_colour_primaries;
43     UCHAR   film_grain_transfer_characteristics;
44     UCHAR   film_grain_matrix_coefficients;
45     UCHAR   blending_mode_id;
46     UCHAR   log2_scale_factor;
47     UCHAR   comp_model_present_flag[4];
48     UCHAR   num_intensity_intervals_minus1[4];
49     UCHAR   num_model_values_minus1[4];
50     UCHAR   intensity_interval_lower_bound[3][16];
51     UCHAR   intensity_interval_upper_bound[3][16];
52     SHORT   comp_model_value[3][16][8];
53 } DXVA_FilmGrainChar_H264;
54 #pragma pack(pop)
55 
56 /* DXVA MPEG-I/II and VC-1 */
57 typedef struct _DXVA_PictureParameters {
58     USHORT  wDecodedPictureIndex;
59     USHORT  wDeblockedPictureIndex;
60     USHORT  wForwardRefPictureIndex;
61     USHORT  wBackwardRefPictureIndex;
62     USHORT  wPicWidthInMBminus1;
63     USHORT  wPicHeightInMBminus1;
64     UCHAR   bMacroblockWidthMinus1;
65     UCHAR   bMacroblockHeightMinus1;
66     UCHAR   bBlockWidthMinus1;
67     UCHAR   bBlockHeightMinus1;
68     UCHAR   bBPPminus1;
69     UCHAR   bPicStructure;
70     UCHAR   bSecondField;
71     UCHAR   bPicIntra;
72     UCHAR   bPicBackwardPrediction;
73     UCHAR   bBidirectionalAveragingMode;
74     UCHAR   bMVprecisionAndChromaRelation;
75     UCHAR   bChromaFormat;
76     UCHAR   bPicScanFixed;
77     UCHAR   bPicScanMethod;
78     UCHAR   bPicReadbackRequests;
79     UCHAR   bRcontrol;
80     UCHAR   bPicSpatialResid8;
81     UCHAR   bPicOverflowBlocks;
82     UCHAR   bPicExtrapolation;
83     UCHAR   bPicDeblocked;
84     UCHAR   bPicDeblockConfined;
85     UCHAR   bPic4MVallowed;
86     UCHAR   bPicOBMC;
87     UCHAR   bPicBinPB;
88     UCHAR   bMV_RPS;
89     UCHAR   bReservedBits;
90     USHORT  wBitstreamFcodes;
91     USHORT  wBitstreamPCEelements;
92     UCHAR   bBitstreamConcealmentNeed;
93     UCHAR   bBitstreamConcealmentMethod;
94 } DXVA_PictureParameters, *LPDXVA_PictureParameters;
95 
96 typedef struct _DXVA_QmatrixData {
97     BYTE    bNewQmatrix[4];
98     WORD    Qmatrix[4][8 * 8];
99 } DXVA_QmatrixData, *LPDXVA_QmatrixData;
100 
101 #pragma pack(push, 1)
102 typedef struct _DXVA_SliceInfo {
103     USHORT  wHorizontalPosition;
104     USHORT  wVerticalPosition;
105     UINT    dwSliceBitsInBuffer;
106     UINT    dwSliceDataLocation;
107     UCHAR   bStartCodeBitOffset;
108     UCHAR   bReservedBits;
109     USHORT  wMBbitOffset;
110     USHORT  wNumberMBsInSlice;
111     USHORT  wQuantizerScaleCode;
112     USHORT  wBadSliceChopping;
113 } DXVA_SliceInfo, *LPDXVA_SliceInfo;
114 #pragma pack(pop)
115 
116 typedef struct {
117     USHORT wFrameWidthInMbsMinus1;
118     USHORT wFrameHeightInMbsMinus1;
119     DXVA_PicEntry_H264 CurrPic;
120     UCHAR  num_ref_frames;
121     __C89_NAMELESS union {
122         __C89_NAMELESS struct {
123             USHORT field_pic_flag           : 1;
124             USHORT MbaffFrameFlag           : 1;
125             USHORT residual_colour_transform_flag : 1;
126             USHORT sp_for_switch_flag       : 1;
127             USHORT chroma_format_idc        : 2;
128             USHORT RefPicFlag               : 1;
129             USHORT constrained_intra_pred_flag : 1;
130             USHORT weighted_pred_flag       : 1;
131             USHORT weighted_bipred_idc      : 2;
132             USHORT MbsConsecutiveFlag       : 1;
133             USHORT frame_mbs_only_flag      : 1;
134             USHORT transform_8x8_mode_flag  : 1;
135             USHORT MinLumaBipredSize8x8Flag : 1;
136             USHORT IntraPicFlag             : 1;
137         };
138         USHORT wBitFields;
139     };
140     UCHAR   bit_depth_luma_minus8;
141     UCHAR   bit_depth_chroma_minus8;
142     USHORT  Reserved16Bits;
143     UINT    StatusReportFeedbackNumber;
144     DXVA_PicEntry_H264 RefFrameList[16];
145     INT     CurrFieldOrderCnt[2];
146     INT     FieldOrderCntList[16][2];
147     CHAR    pic_init_qs_minus26;
148     CHAR    chroma_qp_index_offset;
149     CHAR    second_chroma_qp_index_offset;
150     UCHAR   ContinuationFlag;
151     CHAR    pic_init_qp_minus26;
152     UCHAR   num_ref_idx_l0_active_minus1;
153     UCHAR   num_ref_idx_l1_active_minus1;
154     UCHAR   Reserved8BitsA;
155     USHORT  FrameNumList[16];
156     UINT    UsedForReferenceFlags;
157     USHORT  NonExistingFrameFlags;
158     USHORT  frame_num;
159     UCHAR   log2_max_frame_num_minus4;
160     UCHAR   pic_order_cnt_type;
161     UCHAR   log2_max_pic_order_cnt_lsb_minus4;
162     UCHAR   delta_pic_order_always_zero_flag;
163     UCHAR   direct_8x8_inference_flag;
164     UCHAR   entropy_coding_mode_flag;
165     UCHAR   pic_order_present_flag;
166     UCHAR   num_slice_groups_minus1;
167     UCHAR   slice_group_map_type;
168     UCHAR   deblocking_filter_control_present_flag;
169     UCHAR   redundant_pic_cnt_present_flag;
170     UCHAR   Reserved8BitsB;
171     USHORT  slice_group_change_rate_minus1;
172     UCHAR   SliceGroupMap[810];
173 } DXVA_PicParams_H264;
174 
175 typedef struct {
176     UCHAR   bScalingLists4x4[6][16];
177     UCHAR   bScalingLists8x8[2][64];
178 } DXVA_Qmatrix_H264;
179 
180 typedef struct {
181     UINT    BSNALunitDataLocation;
182     UINT    SliceBytesInBuffer;
183     USHORT  wBadSliceChopping;
184     USHORT  first_mb_in_slice;
185     USHORT  NumMbsForSlice;
186     USHORT  BitOffsetToSliceData;
187     UCHAR   slice_type;
188     UCHAR   luma_log2_weight_denom;
189     UCHAR   chroma_log2_weight_denom;
190     UCHAR   num_ref_idx_l0_active_minus1;
191     UCHAR   num_ref_idx_l1_active_minus1;
192     CHAR    slice_alpha_c0_offset_div2;
193     CHAR    slice_beta_offset_div2;
194     UCHAR   Reserved8Bits;
195     DXVA_PicEntry_H264 RefPicList[2][32];
196     SHORT   Weights[2][32][3][2];
197     CHAR    slice_qs_delta;
198     CHAR    slice_qp_delta;
199     UCHAR   redundant_pic_cnt;
200     UCHAR   direct_spatial_mv_pred_flag;
201     UCHAR   cabac_init_idc;
202     UCHAR   disable_deblocking_filter_idc;
203     USHORT  slice_id;
204 } DXVA_Slice_H264_Long;
205 
206 #pragma pack(push, 1)
207 typedef struct {
208     UINT    BSNALunitDataLocation;
209     UINT    SliceBytesInBuffer;
210     USHORT  wBadSliceChopping;
211 } DXVA_Slice_H264_Short;
212 #pragma pack(pop)
213 
214 /* HEVC Picture Entry structure */
215 typedef struct {
216     __C89_NAMELESS union {
217         __C89_NAMELESS struct {
218             UCHAR Index7Bits : 7;
219             UCHAR AssociatedFlag : 1;
220         };
221         UCHAR bPicEntry;
222     };
223 } DXVA_PicEntry_HEVC, *LPDXVA_PicEntry_HEVC;
224 
225 /* HEVC Picture Parameter structure */
226 #pragma pack(push, 1)
227 typedef struct _DXVA_PicParams_HEVC {
228     USHORT      PicWidthInMinCbsY;
229     USHORT      PicHeightInMinCbsY;
230     __C89_NAMELESS union {
231         __C89_NAMELESS struct {
232             USHORT  chroma_format_idc                       : 2;
233             USHORT  separate_colour_plane_flag              : 1;
234             USHORT  bit_depth_luma_minus8                   : 3;
235             USHORT  bit_depth_chroma_minus8                 : 3;
236             USHORT  log2_max_pic_order_cnt_lsb_minus4       : 4;
237             USHORT  NoPicReorderingFlag                     : 1;
238             USHORT  NoBiPredFlag                            : 1;
239             USHORT  ReservedBits1                            : 1;
240         };
241         USHORT wFormatAndSequenceInfoFlags;
242     };
243     DXVA_PicEntry_HEVC  CurrPic;
244     UCHAR   sps_max_dec_pic_buffering_minus1;
245     UCHAR   log2_min_luma_coding_block_size_minus3;
246     UCHAR   log2_diff_max_min_luma_coding_block_size;
247     UCHAR   log2_min_transform_block_size_minus2;
248     UCHAR   log2_diff_max_min_transform_block_size;
249     UCHAR   max_transform_hierarchy_depth_inter;
250     UCHAR   max_transform_hierarchy_depth_intra;
251     UCHAR   num_short_term_ref_pic_sets;
252     UCHAR   num_long_term_ref_pics_sps;
253     UCHAR   num_ref_idx_l0_default_active_minus1;
254     UCHAR   num_ref_idx_l1_default_active_minus1;
255     CHAR    init_qp_minus26;
256     UCHAR   ucNumDeltaPocsOfRefRpsIdx;
257     USHORT  wNumBitsForShortTermRPSInSlice;
258     USHORT  ReservedBits2;
259 
260     __C89_NAMELESS union {
261         __C89_NAMELESS struct {
262             UINT32  scaling_list_enabled_flag                    : 1;
263             UINT32  amp_enabled_flag                            : 1;
264             UINT32  sample_adaptive_offset_enabled_flag         : 1;
265             UINT32  pcm_enabled_flag                            : 1;
266             UINT32  pcm_sample_bit_depth_luma_minus1            : 4;
267             UINT32  pcm_sample_bit_depth_chroma_minus1          : 4;
268             UINT32  log2_min_pcm_luma_coding_block_size_minus3  : 2;
269             UINT32  log2_diff_max_min_pcm_luma_coding_block_size : 2;
270             UINT32  pcm_loop_filter_disabled_flag                : 1;
271             UINT32  long_term_ref_pics_present_flag             : 1;
272             UINT32  sps_temporal_mvp_enabled_flag               : 1;
273             UINT32  strong_intra_smoothing_enabled_flag         : 1;
274             UINT32  dependent_slice_segments_enabled_flag       : 1;
275             UINT32  output_flag_present_flag                    : 1;
276             UINT32  num_extra_slice_header_bits                 : 3;
277             UINT32  sign_data_hiding_enabled_flag               : 1;
278             UINT32  cabac_init_present_flag                     : 1;
279             UINT32  ReservedBits3                               : 5;
280         };
281         UINT32 dwCodingParamToolFlags;
282     };
283 
284     __C89_NAMELESS union {
285         __C89_NAMELESS struct {
286             UINT32  constrained_intra_pred_flag                 : 1;
287             UINT32  transform_skip_enabled_flag                 : 1;
288             UINT32  cu_qp_delta_enabled_flag                    : 1;
289             UINT32  pps_slice_chroma_qp_offsets_present_flag    : 1;
290             UINT32  weighted_pred_flag                          : 1;
291             UINT32  weighted_bipred_flag                        : 1;
292             UINT32  transquant_bypass_enabled_flag              : 1;
293             UINT32  tiles_enabled_flag                          : 1;
294             UINT32  entropy_coding_sync_enabled_flag            : 1;
295             UINT32  uniform_spacing_flag                        : 1;
296             UINT32  loop_filter_across_tiles_enabled_flag       : 1;
297             UINT32  pps_loop_filter_across_slices_enabled_flag  : 1;
298             UINT32  deblocking_filter_override_enabled_flag     : 1;
299             UINT32  pps_deblocking_filter_disabled_flag         : 1;
300             UINT32  lists_modification_present_flag             : 1;
301             UINT32  slice_segment_header_extension_present_flag : 1;
302             UINT32  IrapPicFlag                                 : 1;
303             UINT32  IdrPicFlag                                  : 1;
304             UINT32  IntraPicFlag                                : 1;
305             UINT32  ReservedBits4                               : 13;
306         };
307         UINT32 dwCodingSettingPicturePropertyFlags;
308     };
309     CHAR    pps_cb_qp_offset;
310     CHAR    pps_cr_qp_offset;
311     UCHAR   num_tile_columns_minus1;
312     UCHAR   num_tile_rows_minus1;
313     USHORT  column_width_minus1[19];
314     USHORT  row_height_minus1[21];
315     UCHAR   diff_cu_qp_delta_depth;
316     CHAR    pps_beta_offset_div2;
317     CHAR    pps_tc_offset_div2;
318     UCHAR   log2_parallel_merge_level_minus2;
319     INT     CurrPicOrderCntVal;
320     DXVA_PicEntry_HEVC	RefPicList[15];
321     UCHAR   ReservedBits5;
322     INT     PicOrderCntValList[15];
323     UCHAR   RefPicSetStCurrBefore[8];
324     UCHAR   RefPicSetStCurrAfter[8];
325     UCHAR   RefPicSetLtCurr[8];
326     USHORT  ReservedBits6;
327     USHORT  ReservedBits7;
328     UINT    StatusReportFeedbackNumber;
329 } DXVA_PicParams_HEVC, *LPDXVA_PicParams_HEVC;
330 
331 /* HEVC Quantizatiuon Matrix structure */
332 typedef struct _DXVA_Qmatrix_HEVC {
333     UCHAR ucScalingLists0[6][16];
334     UCHAR ucScalingLists1[6][64];
335     UCHAR ucScalingLists2[6][64];
336     UCHAR ucScalingLists3[2][64];
337     UCHAR ucScalingListDCCoefSizeID2[6];
338     UCHAR ucScalingListDCCoefSizeID3[2];
339 } DXVA_Qmatrix_HEVC, *LPDXVA_Qmatrix_HEVC;
340 
341 
342 /* HEVC Slice Control Structure */
343 typedef struct _DXVA_Slice_HEVC_Short {
344     UINT    BSNALunitDataLocation;
345     UINT    SliceBytesInBuffer;
346     USHORT  wBadSliceChopping;
347 } DXVA_Slice_HEVC_Short, *LPDXVA_Slice_HEVC_Short;
348 
349 /* VPx picture entry data structure */
350 typedef struct _DXVA_PicEntry_VPx {
351     __C89_NAMELESS union {
352         __C89_NAMELESS struct {
353             UCHAR Index7Bits     : 7;
354             UCHAR AssociatedFlag : 1;
355         };
356         UCHAR bPicEntry;
357     };
358 } DXVA_PicEntry_VPx, *LPDXVA_PicEntry_VPx;
359 
360 /* VP9 segmentation structure */
361 typedef struct _segmentation_VP9 {
362     __C89_NAMELESS union {
363         __C89_NAMELESS struct {
364             UCHAR enabled                   : 1;
365             UCHAR update_map                : 1;
366             UCHAR temporal_update           : 1;
367             UCHAR abs_delta                 : 1;
368             UCHAR ReservedSegmentFlags4Bits : 4;
369         };
370         UCHAR wSegmentInfoFlags;
371     };
372     UCHAR tree_probs[7];
373     UCHAR pred_probs[3];
374     SHORT feature_data[8][4];
375     UCHAR feature_mask[8];
376 } DXVA_segmentation_VP9;
377 
378 /* VP9 picture parameters structure */
379 typedef struct _DXVA_PicParams_VP9 {
380     DXVA_PicEntry_VPx    CurrPic;
381     UCHAR                profile;
382     __C89_NAMELESS union {
383         __C89_NAMELESS struct {
384             USHORT frame_type                   : 1;
385             USHORT show_frame                   : 1;
386             USHORT error_resilient_mode         : 1;
387             USHORT subsampling_x                : 1;
388             USHORT subsampling_y                : 1;
389             USHORT extra_plane                  : 1;
390             USHORT refresh_frame_context        : 1;
391             USHORT frame_parallel_decoding_mode : 1;
392             USHORT intra_only                   : 1;
393             USHORT frame_context_idx            : 2;
394             USHORT reset_frame_context          : 2;
395             USHORT allow_high_precision_mv      : 1;
396             USHORT ReservedFormatInfo2Bits      : 2;
397         };
398         USHORT wFormatAndPictureInfoFlags;
399     };
400     UINT  width;
401     UINT  height;
402     UCHAR BitDepthMinus8Luma;
403     UCHAR BitDepthMinus8Chroma;
404     UCHAR interp_filter;
405     UCHAR Reserved8Bits;
406     DXVA_PicEntry_VPx  ref_frame_map[8];
407     UINT  ref_frame_coded_width[8];
408     UINT  ref_frame_coded_height[8];
409     DXVA_PicEntry_VPx  frame_refs[3];
410     CHAR  ref_frame_sign_bias[4];
411     CHAR  filter_level;
412     CHAR  sharpness_level;
413     __C89_NAMELESS union {
414         __C89_NAMELESS struct {
415             UCHAR mode_ref_delta_enabled   : 1;
416             UCHAR mode_ref_delta_update    : 1;
417             UCHAR use_prev_in_find_mv_refs : 1;
418             UCHAR ReservedControlInfo5Bits : 5;
419         };
420         UCHAR wControlInfoFlags;
421     };
422     CHAR   ref_deltas[4];
423     CHAR   mode_deltas[2];
424     SHORT  base_qindex;
425     CHAR   y_dc_delta_q;
426     CHAR   uv_dc_delta_q;
427     CHAR   uv_ac_delta_q;
428     DXVA_segmentation_VP9 stVP9Segments;
429     UCHAR  log2_tile_cols;
430     UCHAR  log2_tile_rows;
431     USHORT uncompressed_header_size_byte_aligned;
432     USHORT first_partition_size;
433     USHORT Reserved16Bits;
434     UINT   Reserved32Bits;
435     UINT   StatusReportFeedbackNumber;
436 } DXVA_PicParams_VP9, *LPDXVA_PicParams_VP9;
437 
438 /* VP8 segmentation structure */
439 typedef struct _segmentation_VP8 {
440     __C89_NAMELESS union {
441         __C89_NAMELESS struct {
442             UCHAR segmentation_enabled        : 1;
443             UCHAR update_mb_segmentation_map  : 1;
444             UCHAR update_mb_segmentation_data : 1;
445             UCHAR mb_segement_abs_delta       : 1;
446             UCHAR ReservedSegmentFlags4Bits   : 4;
447         };
448         UCHAR wSegmentFlags;
449     };
450     CHAR  segment_feature_data[2][4];
451     UCHAR mb_segment_tree_probs[3];
452 } DXVA_segmentation_VP8;
453 
454 /* VP8 picture parameters structure */
455 typedef struct _DXVA_PicParams_VP8 {
456     UINT first_part_size;
457     UINT width;
458     UINT height;
459     DXVA_PicEntry_VPx  CurrPic;
460     __C89_NAMELESS union {
461         __C89_NAMELESS struct {
462             UCHAR frame_type            : 1;
463             UCHAR version               : 3;
464             UCHAR show_frame            : 1;
465             UCHAR clamp_type            : 1;
466             UCHAR ReservedFrameTag3Bits : 2;
467         };
468         UCHAR wFrameTagFlags;
469     };
470     DXVA_segmentation_VP8  stVP8Segments;
471     UCHAR  filter_type;
472     UCHAR  filter_level;
473     UCHAR  sharpness_level;
474     UCHAR  mode_ref_lf_delta_enabled;
475     UCHAR  mode_ref_lf_delta_update;
476     CHAR   ref_lf_deltas[4];
477     CHAR   mode_lf_deltas[4];
478     UCHAR  log2_nbr_of_dct_partitions;
479     UCHAR  base_qindex;
480     CHAR   y1dc_delta_q;
481     CHAR   y2dc_delta_q;
482     CHAR   y2ac_delta_q;
483     CHAR   uvdc_delta_q;
484     CHAR   uvac_delta_q;
485     DXVA_PicEntry_VPx alt_fb_idx;
486     DXVA_PicEntry_VPx gld_fb_idx;
487     DXVA_PicEntry_VPx lst_fb_idx;
488     UCHAR  ref_frame_sign_bias_golden;
489     UCHAR  ref_frame_sign_bias_altref;
490     UCHAR  refresh_entropy_probs;
491     UCHAR  vp8_coef_update_probs[4][8][3][11];
492     UCHAR  mb_no_coeff_skip;
493     UCHAR  prob_skip_false;
494     UCHAR  prob_intra;
495     UCHAR  prob_last;
496     UCHAR  prob_golden;
497     UCHAR  intra_16x16_prob[4];
498     UCHAR  intra_chroma_prob[3];
499     UCHAR  vp8_mv_update_probs[2][19];
500     USHORT ReservedBits1;
501     USHORT ReservedBits2;
502     USHORT ReservedBits3;
503     UINT   StatusReportFeedbackNumber;
504 } DXVA_PicParams_VP8, *LPDXVA_PicParams_VP8;
505 
506 /* VPx slice control data structure - short form */
507 typedef struct _DXVA_Slice_VPx_Short {
508     UINT   BSNALunitDataLocation;
509     UINT   SliceBytesInBuffer;
510     USHORT wBadSliceChopping;
511 } DXVA_Slice_VPx_Short, *LPDXVA_Slice_VPx_Short;
512 
513 /* VPx status reporting data structure */
514 typedef struct _DXVA_Status_VPx {
515     UINT   StatusReportFeedbackNumber;
516     DXVA_PicEntry_VPx CurrPic;
517     UCHAR  bBufType;
518     UCHAR  bStatus;
519     UCHAR  bReserved8Bits;
520     USHORT wNumMbsAffected;
521 } DXVA_Status_VPx, *LPDXVA_Status_VPx;
522 
523 #pragma pack(pop)
524 
525 #ifdef __cplusplus
526 }
527 #endif
528 
529 #endif /*_INC_DXVA */
530