Based on the DXVA AV1 specs https://www.microsoft.com/en-us/download/details.aspx?id=101577
The structures and the associated define are available in Windows SDK since at least 10.0.20231.0.
The GUIDs were present in previous SDKs as well. --- include/dxva.h | 279 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 279 insertions(+)
diff --git a/include/dxva.h b/include/dxva.h index 4f18f2e60da..b474bd87111 100644 --- a/include/dxva.h +++ b/include/dxva.h @@ -563,6 +563,285 @@ typedef struct _DXVA_Status_VPx USHORT wNumMbsAffected; } DXVA_Status_VPx, *LPDXVA_Status_VPx;
+ +#define _DIRECTX_AV1_VA_ + +/* AV1 decoder GUIDs */ +DEFINE_GUID(DXVA_ModeAV1_VLD_Profile0, 0xb8be4ccb, 0xcf53, 0x46ba, 0x8d, 0x59, 0xd6, 0xb8, 0xa6, 0xda, 0x5d, 0x2a); +DEFINE_GUID(DXVA_ModeAV1_VLD_Profile1, 0x6936ff0f, 0x45b1, 0x4163, 0x9c, 0xc1, 0x64, 0x6e, 0xf6, 0x94, 0x61, 0x08); +DEFINE_GUID(DXVA_ModeAV1_VLD_Profile2, 0x0c5f2aa1, 0xe541, 0x4089, 0xbb, 0x7b, 0x98, 0x11, 0x0a, 0x19, 0xd7, 0xc8); +DEFINE_GUID(DXVA_ModeAV1_VLD_12bit_Profile2, 0x17127009, 0xa00f, 0x4ce1, 0x99, 0x4e, 0xbf, 0x40, 0x81, 0xf6, 0xf3, 0xf0); +DEFINE_GUID(DXVA_ModeAV1_VLD_12bit_Profile2_420, 0x2d80bed6, 0x9cac, 0x4835, 0x9e, 0x91, 0x32, 0x7b, 0xbc, 0x4f, 0x9e, 0xe8); + +/* AV1 picture entry data structure */ +typedef struct _DXVA_PicEntry_AV1 { + UINT width; + UINT height; + + // Global motion parameters + INT wmmat[6]; + union { + struct { + UCHAR wminvalid : 1; + UCHAR wmtype : 2; + UCHAR Reserved : 5; + }; + UCHAR GlobalMotionFlags; + }; + UCHAR Index; + USHORT Reserved16Bits; +} DXVA_PicEntry_AV1, *LPDXVA_PicEntry_AV1; + +/* AV1 picture parameters data structure */ +typedef struct _DXVA_PicParams_AV1 { + UINT width; + UINT height; + + UINT max_width; + UINT max_height; + + UCHAR CurrPicTextureIndex; + UCHAR superres_denom; + UCHAR bitdepth; + UCHAR seq_profile; + + // Tiles: + struct { + UCHAR cols; + UCHAR rows; + USHORT context_update_id; + USHORT widths[64]; + USHORT heights[64]; + } tiles; + + // Coding Tools + union { + struct { + UINT use_128x128_superblock : 1; + UINT intra_edge_filter : 1; + UINT interintra_compound : 1; + UINT masked_compound : 1; + UINT warped_motion : 1; + UINT dual_filter : 1; + UINT jnt_comp : 1; + UINT screen_content_tools : 1; + UINT integer_mv : 1; + UINT cdef : 1; + UINT restoration : 1; + UINT film_grain : 1; + UINT intrabc : 1; + UINT high_precision_mv : 1; + UINT switchable_motion_mode : 1; + UINT filter_intra : 1; + UINT disable_frame_end_update_cdf : 1; + UINT disable_cdf_update : 1; + UINT reference_mode : 1; + UINT skip_mode : 1; + UINT reduced_tx_set : 1; + UINT superres : 1; + UINT tx_mode : 2; + UINT use_ref_frame_mvs : 1; + UINT enable_ref_frame_mvs : 1; + UINT reference_frame_update : 1; + UINT Reserved : 5; + }; + UINT32 CodingParamToolFlags; + } coding; + + // Format & Picture Info flags + union { + struct { + UCHAR frame_type : 2; + UCHAR show_frame : 1; + UCHAR showable_frame : 1; + UCHAR subsampling_x : 1; + UCHAR subsampling_y : 1; + UCHAR mono_chrome : 1; + UCHAR Reserved : 1; + }; + UCHAR FormatAndPictureInfoFlags; + } format; + + // References + UCHAR primary_ref_frame; + UCHAR order_hint; + UCHAR order_hint_bits; + + DXVA_PicEntry_AV1 frame_refs[7]; + UCHAR RefFrameMapTextureIndex[8]; + + // Loop filter parameters + struct { + UCHAR filter_level[2]; + UCHAR filter_level_u; + UCHAR filter_level_v; + + UCHAR sharpness_level; + union { + struct { + UCHAR mode_ref_delta_enabled : 1; + UCHAR mode_ref_delta_update : 1; + UCHAR delta_lf_multi : 1; + UCHAR delta_lf_present : 1; + UCHAR Reserved : 4; + }; + UCHAR ControlFlags; + } DUMMYUNIONNAME; + CHAR ref_deltas[8]; + CHAR mode_deltas[2]; + UCHAR delta_lf_res; + UCHAR frame_restoration_type[3]; + USHORT log2_restoration_unit_size[3]; + UINT16 Reserved16Bits; + } loop_filter; + + // Quantization + struct { + union { + struct { + UCHAR delta_q_present : 1; + UCHAR delta_q_res : 2; + UCHAR Reserved : 5; + }; + UCHAR ControlFlags; + } DUMMYUNIONNAME; + + UCHAR base_qindex; + CHAR y_dc_delta_q; + CHAR u_dc_delta_q; + CHAR v_dc_delta_q; + CHAR u_ac_delta_q; + CHAR v_ac_delta_q; + // using_qmatrix: + UCHAR qm_y; + UCHAR qm_u; + UCHAR qm_v; + UINT16 Reserved16Bits; + } quantization; + + // Cdef parameters + struct { + union { + struct { + UCHAR damping : 2; + UCHAR bits : 2; + UCHAR Reserved : 4; + }; + UCHAR ControlFlags; + } DUMMYUNIONNAME; + + union { + struct { + UCHAR primary : 6; + UCHAR secondary : 2; + }; + UCHAR combined; + } y_strengths[8]; + + union { + struct { + UCHAR primary : 6; + UCHAR secondary : 2; + }; + UCHAR combined; + } uv_strengths[8]; + + } cdef; + + UCHAR interp_filter; + + // Segmentation + struct { + union { + struct { + UCHAR enabled : 1; + UCHAR update_map : 1; + UCHAR update_data : 1; + UCHAR temporal_update : 1; + UCHAR Reserved : 4; + }; + UCHAR ControlFlags; + } DUMMYUNIONNAME; + UCHAR Reserved24Bits[3]; + + union { + struct { + UCHAR alt_q : 1; + UCHAR alt_lf_y_v : 1; + UCHAR alt_lf_y_h : 1; + UCHAR alt_lf_u : 1; + UCHAR alt_lf_v : 1; + UCHAR ref_frame : 1; + UCHAR skip : 1; + UCHAR globalmv : 1; + }; + UCHAR mask; + } feature_mask[8]; + + SHORT feature_data[8][8]; + + } segmentation; + + struct { + union { + struct { + USHORT apply_grain : 1; + USHORT scaling_shift_minus8 : 2; + USHORT chroma_scaling_from_luma : 1; + USHORT ar_coeff_lag : 2; + USHORT ar_coeff_shift_minus6 : 2; + USHORT grain_scale_shift : 2; + USHORT overlap_flag : 1; + USHORT clip_to_restricted_range : 1; + USHORT matrix_coeff_is_identity : 1; + USHORT Reserved : 3; + }; + USHORT ControlFlags; + } DUMMYUNIONNAME; + + USHORT grain_seed; + UCHAR scaling_points_y[14][2]; + UCHAR num_y_points; + UCHAR scaling_points_cb[10][2]; + UCHAR num_cb_points; + UCHAR scaling_points_cr[10][2]; + UCHAR num_cr_points; + UCHAR ar_coeffs_y[24]; + UCHAR ar_coeffs_cb[25]; + UCHAR ar_coeffs_cr[25]; + UCHAR cb_mult; + UCHAR cb_luma_mult; + UCHAR cr_mult; + UCHAR cr_luma_mult; + UCHAR Reserved8Bits; + SHORT cb_offset; + SHORT cr_offset; + } film_grain; + + UINT Reserved32Bits; + UINT StatusReportFeedbackNumber; +} DXVA_PicParams_AV1, *LPDXVA_PicParams_AV1; + +/* AV1 tile data structure */ +typedef struct _DXVA_Tile_AV1 { + UINT DataOffset; + UINT DataSize; + USHORT row; + USHORT column; + USHORT Reserved16Bits; + UCHAR anchor_frame; + UCHAR Reserved8Bits; +} DXVA_Tile_AV1, *LPDXVA_Tile_AV1; + +typedef struct _DXVA_Status_AV1 { + UINT StatusReportFeedbackNumber; + DXVA_PicEntry_AV1 CurrPic; + UCHAR bBufType; + UCHAR bStatus; + UCHAR bReserved8Bits; + USHORT wNumMbsAffected; +} DXVA_Status_AV1, *LPDXVA_Status_AV1; + #include <poppack.h>
typedef enum _DXVA_VideoChromaSubsampling
On 11/20/20 3:37 PM, Steve Lhomme wrote:
Based on the DXVA AV1 specs https://www.microsoft.com/en-us/download/details.aspx?id=101577
The structures and the associated define are available in Windows SDK since at least 10.0.20231.0.
Is this something pre-released? Latest one I see is 10.0.19041.0, corresponding to Windows 10 2004. It does not have the types.
The GUIDs were present in previous SDKs as well.
include/dxva.h | 279 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 279 insertions(+)
diff --git a/include/dxva.h b/include/dxva.h index 4f18f2e60da..b474bd87111 100644 --- a/include/dxva.h +++ b/include/dxva.h @@ -563,6 +563,285 @@ typedef struct _DXVA_Status_VPx USHORT wNumMbsAffected; } DXVA_Status_VPx, *LPDXVA_Status_VPx;
+#define _DIRECTX_AV1_VA_
+/* AV1 decoder GUIDs */ +DEFINE_GUID(DXVA_ModeAV1_VLD_Profile0, 0xb8be4ccb, 0xcf53, 0x46ba, 0x8d, 0x59, 0xd6, 0xb8, 0xa6, 0xda, 0x5d, 0x2a); +DEFINE_GUID(DXVA_ModeAV1_VLD_Profile1, 0x6936ff0f, 0x45b1, 0x4163, 0x9c, 0xc1, 0x64, 0x6e, 0xf6, 0x94, 0x61, 0x08); +DEFINE_GUID(DXVA_ModeAV1_VLD_Profile2, 0x0c5f2aa1, 0xe541, 0x4089, 0xbb, 0x7b, 0x98, 0x11, 0x0a, 0x19, 0xd7, 0xc8); +DEFINE_GUID(DXVA_ModeAV1_VLD_12bit_Profile2, 0x17127009, 0xa00f, 0x4ce1, 0x99, 0x4e, 0xbf, 0x40, 0x81, 0xf6, 0xf3, 0xf0); +DEFINE_GUID(DXVA_ModeAV1_VLD_12bit_Profile2_420, 0x2d80bed6, 0x9cac, 0x4835, 0x9e, 0x91, 0x32, 0x7b, 0xbc, 0x4f, 0x9e, 0xe8);
Adding GUIDs is fine, since they are indeed present in current versions.
+/* AV1 picture entry data structure */ +typedef struct _DXVA_PicEntry_AV1 {
- UINT width;
- UINT height;
- // Global motion parameters
- INT wmmat[6];
- union {
struct {
UCHAR wminvalid : 1;
UCHAR wmtype : 2;
UCHAR Reserved : 5;
};
UCHAR GlobalMotionFlags;
- };
- UCHAR Index;
- USHORT Reserved16Bits;
+} DXVA_PicEntry_AV1, *LPDXVA_PicEntry_AV1;
For that I think we should wait for released SDK.
On 11/20/20 3:37 PM, Steve Lhomme wrote: Based on the DXVA AV1 specs https://www.microsoft.com/en-us/download/details.aspx?id=101577
The structures and the associated define are available in Windows SDK since at least 10.0.20231.0.
Is this something pre-released? Latest one I see is 10.0.19041.0, corresponding to Windows 10 2004. It does not have the types.
Hi,
Sorry for the out-of-the-blue outsider comment onto an old thread (hopefully the In-Reply-To header will work from the archive URL), but as various OSS multimedia projects would like these definitions to be in wine/mingw-w64, I can inform you that:
1. Since mid-May the structures have been officially defined in what was previously called MSDN: https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/dxva/ns-dxva-d... 2. MS seemingly today (?) released a stable SDK 10.0.20348.0 which finally is a non-insider SDK that defines these structures. It is not currently available in the VS installer, but it is available as a "server" SDK at https://developer.microsoft.com/en-US/windows/downloads/windows-10-sdk/ .
I hope this should enable these structures to be verified, and pulled in.
Best regards, Jan
On 2021-06-30 13:51, Jan Ekström wrote:
On 11/20/20 3:37 PM, Steve Lhomme wrote: Based on the DXVA AV1 specs https://www.microsoft.com/en-us/download/details.aspx?id=101577
The structures and the associated define are available in Windows SDK since at least 10.0.20231.0.
Is this something pre-released? Latest one I see is 10.0.19041.0, corresponding to Windows 10 2004. It does not have the types.
Hi,
Sorry for the out-of-the-blue outsider comment onto an old thread (hopefully the In-Reply-To header will work from the archive URL), but as various OSS multimedia projects would like these definitions to be in wine/mingw-w64, I can inform you that:
- Since mid-May the structures have been officially defined in what was previously called MSDN: https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/dxva/ns-dxva-d...
- MS seemingly today (?) released a stable SDK 10.0.20348.0 which finally is a non-insider SDK that defines these structures. It is not currently available in the VS installer, but it is available as a "server" SDK at https://developer.microsoft.com/en-US/windows/downloads/windows-10-sdk/ .
I hope this should enable these structures to be verified, and pulled in.
Hi,
Nice catch. I checked last week and there was still nothing. At least putting the structures in MSDN makes it a lot easier. The GUIDs were already found in the D3D12 doc [1].
There seem to be bugs in their doc on DXVA_PicParams_AV1.cdef.y_strengths, DXVA_PicParams_AV1.cdef.uv_strengths and DXVA_PicParams_AV1.segmentation.feature_mask as the union names are misplaced.
Some other changes: - the Reserved16Bits fields are now a UINT16. - fields in DXVA_Status_AV1 have lost their 'b' and 'w' prefix.
The original patch submitted got this build job https://testbot.winehq.org/JobDetails.pl?Key=82245 But it seems gone from the database (too old?).
I'll submit a revised version. It still builds when used in libavcodec [2].
Best regards, Jan
[1] https://docs.microsoft.com/en-us/windows/win32/medfound/direct3d-12-video-gu... [2] https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/dxva2_av1.c
From: Steve Lhomme [email protected]
Based on the DXVA AV1 specs https://www.microsoft.com/en-us/download/details.aspx?id=101577 And the DDI documentation of DXVA https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/dxva/ns-dxva-d...
The structures and the associated define are available in Windows SDK since at least 10.0.20231.0 and in the stable 10.0.20348.0.
The GUIDs were present in previous SDKs as well. --- include/dxva.h | 269 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 269 insertions(+)
diff --git a/include/dxva.h b/include/dxva.h index 4f18f2e60da..37739c4a5dc 100644 --- a/include/dxva.h +++ b/include/dxva.h @@ -563,6 +563,275 @@ typedef struct _DXVA_Status_VPx USHORT wNumMbsAffected; } DXVA_Status_VPx, *LPDXVA_Status_VPx;
+ +#define _DIRECTX_AV1_VA_ + +/* AV1 decoder GUIDs */ +DEFINE_GUID(DXVA_ModeAV1_VLD_Profile0, 0xb8be4ccb, 0xcf53, 0x46ba, 0x8d, 0x59, 0xd6, 0xb8, 0xa6, 0xda, 0x5d, 0x2a); +DEFINE_GUID(DXVA_ModeAV1_VLD_Profile1, 0x6936ff0f, 0x45b1, 0x4163, 0x9c, 0xc1, 0x64, 0x6e, 0xf6, 0x94, 0x61, 0x08); +DEFINE_GUID(DXVA_ModeAV1_VLD_Profile2, 0x0c5f2aa1, 0xe541, 0x4089, 0xbb, 0x7b, 0x98, 0x11, 0x0a, 0x19, 0xd7, 0xc8); +DEFINE_GUID(DXVA_ModeAV1_VLD_12bit_Profile2, 0x17127009, 0xa00f, 0x4ce1, 0x99, 0x4e, 0xbf, 0x40, 0x81, 0xf6, 0xf3, 0xf0); +DEFINE_GUID(DXVA_ModeAV1_VLD_12bit_Profile2_420, 0x2d80bed6, 0x9cac, 0x4835, 0x9e, 0x91, 0x32, 0x7b, 0xbc, 0x4f, 0x9e, 0xe8); + +/* AV1 picture entry data structure */ +typedef struct _DXVA_PicEntry_AV1 { + UINT width; + UINT height; + + INT wmmat[6]; + __C89_NAMELESS union { + __C89_NAMELESS struct { + UCHAR wminvalid : 1; + UCHAR wmtype : 2; + UCHAR Reserved : 5; + } __C89_NAMELESSSTRUCTNAME; + UCHAR GlobalMotionFlags; + } __C89_NAMELESSUNIONNAME; + UCHAR Index; + UINT16 Reserved16Bits; +} DXVA_PicEntry_AV1, *LPDXVA_PicEntry_AV1; + +/* AV1 picture parameters data structure */ +typedef struct _DXVA_PicParams_AV1 { + UINT width; + UINT height; + + UINT max_width; + UINT max_height; + + UCHAR CurrPicTextureIndex; + UCHAR superres_denom; + UCHAR bitdepth; + UCHAR seq_profile; + + struct { + UCHAR cols; + UCHAR rows; + USHORT context_update_id; + USHORT widths[64]; + USHORT heights[64]; + } tiles; + + union { + __C89_NAMELESS struct { + UINT use_128x128_superblock : 1; + UINT intra_edge_filter : 1; + UINT interintra_compound : 1; + UINT masked_compound : 1; + UINT warped_motion : 1; + UINT dual_filter : 1; + UINT jnt_comp : 1; + UINT screen_content_tools : 1; + UINT integer_mv : 1; + UINT cdef : 1; + UINT restoration : 1; + UINT film_grain : 1; + UINT intrabc : 1; + UINT high_precision_mv : 1; + UINT switchable_motion_mode : 1; + UINT filter_intra : 1; + UINT disable_frame_end_update_cdf : 1; + UINT disable_cdf_update : 1; + UINT reference_mode : 1; + UINT skip_mode : 1; + UINT reduced_tx_set : 1; + UINT superres : 1; + UINT tx_mode : 2; + UINT use_ref_frame_mvs : 1; + UINT enable_ref_frame_mvs : 1; + UINT reference_frame_update : 1; + UINT Reserved : 5; + } __C89_NAMELESSSTRUCTNAME; + UINT32 CodingParamToolFlags; + } coding; + + union { + __C89_NAMELESS struct { + UCHAR frame_type : 2; + UCHAR show_frame : 1; + UCHAR showable_frame : 1; + UCHAR subsampling_x : 1; + UCHAR subsampling_y : 1; + UCHAR mono_chrome : 1; + UCHAR Reserved : 1; + } __C89_NAMELESSSTRUCTNAME; + UCHAR FormatAndPictureInfoFlags; + } format; + + UCHAR primary_ref_frame; + UCHAR order_hint; + UCHAR order_hint_bits; + + DXVA_PicEntry_AV1 frame_refs[7]; + UCHAR RefFrameMapTextureIndex[8]; + + struct { + UCHAR filter_level[2]; + UCHAR filter_level_u; + UCHAR filter_level_v; + + UCHAR sharpness_level; + __C89_NAMELESS union { + __C89_NAMELESS struct { + UCHAR mode_ref_delta_enabled : 1; + UCHAR mode_ref_delta_update : 1; + UCHAR delta_lf_multi : 1; + UCHAR delta_lf_present : 1; + UCHAR Reserved : 4; + } __C89_NAMELESSSTRUCTNAME; + UCHAR ControlFlags; + } __C89_NAMELESSUNIONNAME; + CHAR ref_deltas[8]; + CHAR mode_deltas[2]; + UCHAR delta_lf_res; + UCHAR frame_restoration_type[3]; + USHORT log2_restoration_unit_size[3]; + UINT16 Reserved16Bits; + } loop_filter; + + struct { + __C89_NAMELESS union { + __C89_NAMELESS struct { + UCHAR delta_q_present : 1; + UCHAR delta_q_res : 2; + UCHAR Reserved : 5; + } __C89_NAMELESSSTRUCTNAME; + UCHAR ControlFlags; + } __C89_NAMELESSUNIONNAME; + + UCHAR base_qindex; + CHAR y_dc_delta_q; + CHAR u_dc_delta_q; + CHAR v_dc_delta_q; + CHAR u_ac_delta_q; + CHAR v_ac_delta_q; + UCHAR qm_y; + UCHAR qm_u; + UCHAR qm_v; + UINT16 Reserved16Bits; + } quantization; + + struct { + __C89_NAMELESS union { + __C89_NAMELESS struct { + UCHAR damping : 2; + UCHAR bits : 2; + UCHAR Reserved : 4; + } __C89_NAMELESSSTRUCTNAME; + UCHAR ControlFlags; + } __C89_NAMELESSUNIONNAME; + + union { + __C89_NAMELESS struct { + UCHAR primary : 6; + UCHAR secondary : 2; + } __C89_NAMELESSSTRUCTNAME; + UCHAR combined; + } y_strengths[8]; + + union { + __C89_NAMELESS struct { + UCHAR primary : 6; + UCHAR secondary : 2; + } __C89_NAMELESSSTRUCTNAME; + UCHAR combined; + } uv_strengths[8]; + + } cdef; + + UCHAR interp_filter; + + struct { + __C89_NAMELESS union { + __C89_NAMELESS struct { + UCHAR enabled : 1; + UCHAR update_map : 1; + UCHAR update_data : 1; + UCHAR temporal_update : 1; + UCHAR Reserved : 4; + } __C89_NAMELESSSTRUCTNAME; + UCHAR ControlFlags; + } __C89_NAMELESSUNIONNAME; + UCHAR Reserved24Bits[3]; + + union { + __C89_NAMELESS struct { + UCHAR alt_q : 1; + UCHAR alt_lf_y_v : 1; + UCHAR alt_lf_y_h : 1; + UCHAR alt_lf_u : 1; + UCHAR alt_lf_v : 1; + UCHAR ref_frame : 1; + UCHAR skip : 1; + UCHAR globalmv : 1; + } __C89_NAMELESSSTRUCTNAME; + UCHAR mask; + } feature_mask[8]; + + SHORT feature_data[8][8]; + + } segmentation; + + struct { + __C89_NAMELESS union { + __C89_NAMELESS struct { + USHORT apply_grain : 1; + USHORT scaling_shift_minus8 : 2; + USHORT chroma_scaling_from_luma : 1; + USHORT ar_coeff_lag : 2; + USHORT ar_coeff_shift_minus6 : 2; + USHORT grain_scale_shift : 2; + USHORT overlap_flag : 1; + USHORT clip_to_restricted_range : 1; + USHORT matrix_coeff_is_identity : 1; + USHORT Reserved : 3; + } __C89_NAMELESSSTRUCTNAME; + USHORT ControlFlags; + } __C89_NAMELESSUNIONNAME; + + USHORT grain_seed; + UCHAR scaling_points_y[14][2]; + UCHAR num_y_points; + UCHAR scaling_points_cb[10][2]; + UCHAR num_cb_points; + UCHAR scaling_points_cr[10][2]; + UCHAR num_cr_points; + UCHAR ar_coeffs_y[24]; + UCHAR ar_coeffs_cb[25]; + UCHAR ar_coeffs_cr[25]; + UCHAR cb_mult; + UCHAR cb_luma_mult; + UCHAR cr_mult; + UCHAR cr_luma_mult; + UCHAR Reserved8Bits; + SHORT cb_offset; + SHORT cr_offset; + } film_grain; + + UINT Reserved32Bits; + UINT StatusReportFeedbackNumber; +} DXVA_PicParams_AV1, *LPDXVA_PicParams_AV1; + +/* AV1 tile data structure */ +typedef struct _DXVA_Tile_AV1 { + UINT DataOffset; + UINT DataSize; + USHORT row; + USHORT column; + UINT16 Reserved16Bits; + UCHAR anchor_frame; + UCHAR Reserved8Bits; +} DXVA_Tile_AV1, *LPDXVA_Tile_AV1; + +typedef struct _DXVA_Status_AV1 { + UINT StatusReportFeedbackNumber; + DXVA_PicEntry_AV1 CurrPic; + UCHAR BufType; + UCHAR Status; + UCHAR Reserved8Bits; + USHORT NumMbsAffected; +} DXVA_Status_AV1, *LPDXVA_Status_AV1; + #include <poppack.h>
typedef enum _DXVA_VideoChromaSubsampling
From: Steve Lhomme [email protected]
Based on the DXVA AV1 specs https://www.microsoft.com/en-us/download/details.aspx?id=101577 And the DDI documentation of DXVA https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/dxva/ns-dxva-d...
The structures and the associated define are available in Windows SDK since at least 10.0.20231.0 and in the stable 10.0.20348.0.
The GUIDs were present in previous SDKs as well.
Signed-off-by: Steve Lhomme [email protected] --- include/dxva.h | 269 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 269 insertions(+)
diff --git a/include/dxva.h b/include/dxva.h index 4f18f2e60da..b8505630d0b 100644 --- a/include/dxva.h +++ b/include/dxva.h @@ -563,6 +563,275 @@ typedef struct _DXVA_Status_VPx USHORT wNumMbsAffected; } DXVA_Status_VPx, *LPDXVA_Status_VPx;
+ +#define _DIRECTX_AV1_VA_ + +/* AV1 decoder GUIDs */ +DEFINE_GUID(DXVA_ModeAV1_VLD_Profile0, 0xb8be4ccb, 0xcf53, 0x46ba, 0x8d, 0x59, 0xd6, 0xb8, 0xa6, 0xda, 0x5d, 0x2a); +DEFINE_GUID(DXVA_ModeAV1_VLD_Profile1, 0x6936ff0f, 0x45b1, 0x4163, 0x9c, 0xc1, 0x64, 0x6e, 0xf6, 0x94, 0x61, 0x08); +DEFINE_GUID(DXVA_ModeAV1_VLD_Profile2, 0x0c5f2aa1, 0xe541, 0x4089, 0xbb, 0x7b, 0x98, 0x11, 0x0a, 0x19, 0xd7, 0xc8); +DEFINE_GUID(DXVA_ModeAV1_VLD_12bit_Profile2, 0x17127009, 0xa00f, 0x4ce1, 0x99, 0x4e, 0xbf, 0x40, 0x81, 0xf6, 0xf3, 0xf0); +DEFINE_GUID(DXVA_ModeAV1_VLD_12bit_Profile2_420, 0x2d80bed6, 0x9cac, 0x4835, 0x9e, 0x91, 0x32, 0x7b, 0xbc, 0x4f, 0x9e, 0xe8); + +/* AV1 picture entry data structure */ +typedef struct _DXVA_PicEntry_AV1 { + UINT width; + UINT height; + + INT wmmat[6]; + __C89_NAMELESS union { + __C89_NAMELESS struct { + UCHAR wminvalid : 1; + UCHAR wmtype : 2; + UCHAR Reserved : 5; + } __C89_NAMELESSSTRUCTNAME; + UCHAR GlobalMotionFlags; + } __C89_NAMELESSUNIONNAME; + UCHAR Index; + UINT16 Reserved16Bits; +} DXVA_PicEntry_AV1, *LPDXVA_PicEntry_AV1; + +/* AV1 picture parameters data structure */ +typedef struct _DXVA_PicParams_AV1 { + UINT width; + UINT height; + + UINT max_width; + UINT max_height; + + UCHAR CurrPicTextureIndex; + UCHAR superres_denom; + UCHAR bitdepth; + UCHAR seq_profile; + + struct { + UCHAR cols; + UCHAR rows; + USHORT context_update_id; + USHORT widths[64]; + USHORT heights[64]; + } tiles; + + union { + __C89_NAMELESS struct { + UINT use_128x128_superblock : 1; + UINT intra_edge_filter : 1; + UINT interintra_compound : 1; + UINT masked_compound : 1; + UINT warped_motion : 1; + UINT dual_filter : 1; + UINT jnt_comp : 1; + UINT screen_content_tools : 1; + UINT integer_mv : 1; + UINT cdef : 1; + UINT restoration : 1; + UINT film_grain : 1; + UINT intrabc : 1; + UINT high_precision_mv : 1; + UINT switchable_motion_mode : 1; + UINT filter_intra : 1; + UINT disable_frame_end_update_cdf : 1; + UINT disable_cdf_update : 1; + UINT reference_mode : 1; + UINT skip_mode : 1; + UINT reduced_tx_set : 1; + UINT superres : 1; + UINT tx_mode : 2; + UINT use_ref_frame_mvs : 1; + UINT enable_ref_frame_mvs : 1; + UINT reference_frame_update : 1; + UINT Reserved : 5; + } __C89_NAMELESSSTRUCTNAME; + UINT32 CodingParamToolFlags; + } coding; + + union { + __C89_NAMELESS struct { + UCHAR frame_type : 2; + UCHAR show_frame : 1; + UCHAR showable_frame : 1; + UCHAR subsampling_x : 1; + UCHAR subsampling_y : 1; + UCHAR mono_chrome : 1; + UCHAR Reserved : 1; + } __C89_NAMELESSSTRUCTNAME; + UCHAR FormatAndPictureInfoFlags; + } format; + + UCHAR primary_ref_frame; + UCHAR order_hint; + UCHAR order_hint_bits; + + DXVA_PicEntry_AV1 frame_refs[7]; + UCHAR RefFrameMapTextureIndex[8]; + + struct { + UCHAR filter_level[2]; + UCHAR filter_level_u; + UCHAR filter_level_v; + + UCHAR sharpness_level; + __C89_NAMELESS union { + __C89_NAMELESS struct { + UCHAR mode_ref_delta_enabled : 1; + UCHAR mode_ref_delta_update : 1; + UCHAR delta_lf_multi : 1; + UCHAR delta_lf_present : 1; + UCHAR Reserved : 4; + } __C89_NAMELESSSTRUCTNAME; + UCHAR ControlFlags; + } __C89_NAMELESSUNIONNAME; + CHAR ref_deltas[8]; + CHAR mode_deltas[2]; + UCHAR delta_lf_res; + UCHAR frame_restoration_type[3]; + USHORT log2_restoration_unit_size[3]; + UINT16 Reserved16Bits; + } loop_filter; + + struct { + __C89_NAMELESS union { + __C89_NAMELESS struct { + UCHAR delta_q_present : 1; + UCHAR delta_q_res : 2; + UCHAR Reserved : 5; + } __C89_NAMELESSSTRUCTNAME; + UCHAR ControlFlags; + } __C89_NAMELESSUNIONNAME; + + UCHAR base_qindex; + CHAR y_dc_delta_q; + CHAR u_dc_delta_q; + CHAR v_dc_delta_q; + CHAR u_ac_delta_q; + CHAR v_ac_delta_q; + UCHAR qm_y; + UCHAR qm_u; + UCHAR qm_v; + UINT16 Reserved16Bits; + } quantization; + + struct { + __C89_NAMELESS union { + __C89_NAMELESS struct { + UCHAR damping : 2; + UCHAR bits : 2; + UCHAR Reserved : 4; + } __C89_NAMELESSSTRUCTNAME; + UCHAR ControlFlags; + } __C89_NAMELESSUNIONNAME; + + union { + __C89_NAMELESS struct { + UCHAR primary : 6; + UCHAR secondary : 2; + } __C89_NAMELESSSTRUCTNAME; + UCHAR combined; + } y_strengths[8]; + + union { + __C89_NAMELESS struct { + UCHAR primary : 6; + UCHAR secondary : 2; + } __C89_NAMELESSSTRUCTNAME; + UCHAR combined; + } uv_strengths[8]; + + } cdef; + + UCHAR interp_filter; + + struct { + __C89_NAMELESS union { + __C89_NAMELESS struct { + UCHAR enabled : 1; + UCHAR update_map : 1; + UCHAR update_data : 1; + UCHAR temporal_update : 1; + UCHAR Reserved : 4; + } __C89_NAMELESSSTRUCTNAME; + UCHAR ControlFlags; + } __C89_NAMELESSUNIONNAME; + UCHAR Reserved24Bits[3]; + + union { + __C89_NAMELESS struct { + UCHAR alt_q : 1; + UCHAR alt_lf_y_v : 1; + UCHAR alt_lf_y_h : 1; + UCHAR alt_lf_u : 1; + UCHAR alt_lf_v : 1; + UCHAR ref_frame : 1; + UCHAR skip : 1; + UCHAR globalmv : 1; + } __C89_NAMELESSSTRUCTNAME; + UCHAR mask; + } feature_mask[8]; + + SHORT feature_data[8][8]; + + } segmentation; + + struct { + __C89_NAMELESS union { + __C89_NAMELESS struct { + USHORT apply_grain : 1; + USHORT scaling_shift_minus8 : 2; + USHORT chroma_scaling_from_luma : 1; + USHORT ar_coeff_lag : 2; + USHORT ar_coeff_shift_minus6 : 2; + USHORT grain_scale_shift : 2; + USHORT overlap_flag : 1; + USHORT clip_to_restricted_range : 1; + USHORT matrix_coeff_is_identity : 1; + USHORT Reserved : 3; + } __C89_NAMELESSSTRUCTNAME; + USHORT ControlFlags; + } __C89_NAMELESSUNIONNAME; + + USHORT grain_seed; + UCHAR scaling_points_y[14][2]; + UCHAR num_y_points; + UCHAR scaling_points_cb[10][2]; + UCHAR num_cb_points; + UCHAR scaling_points_cr[10][2]; + UCHAR num_cr_points; + UCHAR ar_coeffs_y[24]; + UCHAR ar_coeffs_cb[25]; + UCHAR ar_coeffs_cr[25]; + UCHAR cb_mult; + UCHAR cb_luma_mult; + UCHAR cr_mult; + UCHAR cr_luma_mult; + UCHAR Reserved8Bits; + SHORT cb_offset; + SHORT cr_offset; + } film_grain; + + UINT Reserved32Bits; + UINT StatusReportFeedbackNumber; +} DXVA_PicParams_AV1, *LPDXVA_PicParams_AV1; + +/* AV1 tile data structure */ +typedef struct _DXVA_Tile_AV1 { + UINT DataOffset; + UINT DataSize; + USHORT row; + USHORT column; + UINT16 Reserved16Bits; + UCHAR anchor_frame; + UCHAR Reserved8Bits; +} DXVA_Tile_AV1, *LPDXVA_Tile_AV1; + +typedef struct _DXVA_Status_AV1 { + UINT StatusReportFeedbackNumber; + DXVA_PicEntry_AV1 CurrPic; + UCHAR BufType; + UCHAR Status; + UCHAR Reserved8Bits; + USHORT NumMbsAffected; +} DXVA_Status_AV1, *LPDXVA_Status_AV1; + #include <poppack.h>
typedef enum _DXVA_VideoChromaSubsampling
On Sat, Jul 3, 2021 at 9:14 AM Steve Lhomme [email protected] wrote:
From: Steve Lhomme [email protected]
Based on the DXVA AV1 specs https://www.microsoft.com/en-us/download/details.aspx?id=101577 And the DDI documentation of DXVA https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/dxva/ns-dxva-d...
The structures and the associated define are available in Windows SDK since at least 10.0.20231.0 and in the stable 10.0.20348.0.
The GUIDs were present in previous SDKs as well.
Signed-off-by: Steve Lhomme [email protected]
include/dxva.h | 269 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 269 insertions(+)
Ping on this set since the only posted negative review of it earlier was the lack of a non-insider SDK which contained these structures, and that is now fixed as Microsoft actually published a newer stable SDK.
It might not be as important for wine (at least for now), but projects such as mingw-w64 seem to utilize wine as their upstream for DirectX related headers, and synchronize them periodically.
Getting these definitions into wine would thus help this stuff go downwards without people resorting to manual additions (which may get lost in a later synchronization), or adding custom compatibility headers into projects such as FFmpeg.
Best regards, Jan
This patch had been applied in
wine https://source.winehq.org/git/wine.git/commitdiff/2f05dd0719e7dc51b48397cf44... mingw-w64 https://sourceforge.net/p/mingw-w64/mingw-w64/ci/aaec44a4cea27f1ee1212d82c76...