mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 18:18:06 +02:00
d3d12: Remove D3D12_SDK_VERSION checks after bumping directx-headers dependency to v611
Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26556>
This commit is contained in:
parent
90b49f16f7
commit
0739927080
8 changed files with 5 additions and 144 deletions
|
|
@ -37,18 +37,14 @@
|
|||
#include "d3d12_video_enc_hevc.h"
|
||||
#endif
|
||||
#if VIDEO_CODEC_AV1ENC
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
#include "d3d12_video_enc_av1.h"
|
||||
#endif
|
||||
#endif
|
||||
#include "d3d12_video_buffer.h"
|
||||
#include "d3d12_video_texture_array_dpb_manager.h"
|
||||
#include "d3d12_video_array_of_textures_dpb_manager.h"
|
||||
#include "d3d12_video_encoder_references_manager_h264.h"
|
||||
#include "d3d12_video_encoder_references_manager_hevc.h"
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
#include "d3d12_video_encoder_references_manager_av1.h"
|
||||
#endif
|
||||
#include "d3d12_residency.h"
|
||||
|
||||
#include "vl/vl_video_buffer.h"
|
||||
|
|
@ -71,12 +67,10 @@ d3d12_video_encoder_convert_codec_to_d3d12_enc_codec(enum pipe_video_profile pro
|
|||
{
|
||||
return D3D12_VIDEO_ENCODER_CODEC_HEVC;
|
||||
} break;
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
case PIPE_VIDEO_FORMAT_AV1:
|
||||
{
|
||||
return D3D12_VIDEO_ENCODER_CODEC_AV1;
|
||||
} break;
|
||||
#endif
|
||||
case PIPE_VIDEO_FORMAT_MPEG12:
|
||||
case PIPE_VIDEO_FORMAT_MPEG4:
|
||||
case PIPE_VIDEO_FORMAT_VC1:
|
||||
|
|
@ -324,12 +318,10 @@ d3d12_video_encoder_update_picparams_tracking(struct d3d12_video_encoder *pD3D12
|
|||
} break;
|
||||
#endif
|
||||
#if VIDEO_CODEC_AV1ENC
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
case PIPE_VIDEO_FORMAT_AV1:
|
||||
{
|
||||
d3d12_video_encoder_update_current_frame_pic_params_info_av1(pD3D12Enc, srcTexture, picture, currentPicParams, bUsedAsReference);
|
||||
} break;
|
||||
#endif
|
||||
#endif
|
||||
default:
|
||||
{
|
||||
|
|
@ -596,7 +588,6 @@ d3d12_video_encoder_create_reference_picture_manager(struct d3d12_video_encoder
|
|||
} break;
|
||||
#endif
|
||||
#if VIDEO_CODEC_AV1ENC
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
case PIPE_VIDEO_FORMAT_AV1:
|
||||
{
|
||||
bool hasInterFrames =
|
||||
|
|
@ -613,7 +604,6 @@ d3d12_video_encoder_create_reference_picture_manager(struct d3d12_video_encoder
|
|||
// We use packed headers and pist encode execution syntax for AV1
|
||||
pD3D12Enc->m_upBitstreamBuilder = std::make_unique<d3d12_video_bitstream_builder_av1>();
|
||||
} break;
|
||||
#endif
|
||||
#endif
|
||||
default:
|
||||
{
|
||||
|
|
@ -654,7 +644,6 @@ d3d12_video_encoder_get_current_slice_param_settings(struct d3d12_video_encoder
|
|||
} break;
|
||||
#endif
|
||||
#if VIDEO_CODEC_AV1ENC
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
case PIPE_VIDEO_FORMAT_AV1:
|
||||
{
|
||||
D3D12_VIDEO_ENCODER_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA subregionData = {};
|
||||
|
|
@ -666,7 +655,6 @@ d3d12_video_encoder_get_current_slice_param_settings(struct d3d12_video_encoder
|
|||
}
|
||||
return subregionData;
|
||||
} break;
|
||||
#endif
|
||||
#endif
|
||||
default:
|
||||
{
|
||||
|
|
@ -699,7 +687,6 @@ d3d12_video_encoder_get_current_picture_param_settings(struct d3d12_video_encode
|
|||
} break;
|
||||
#endif
|
||||
#if VIDEO_CODEC_AV1ENC
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
case PIPE_VIDEO_FORMAT_AV1:
|
||||
{
|
||||
D3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA curPicParamsData = {};
|
||||
|
|
@ -707,7 +694,6 @@ d3d12_video_encoder_get_current_picture_param_settings(struct d3d12_video_encode
|
|||
curPicParamsData.DataSize = sizeof(pD3D12Enc->m_currentEncodeConfig.m_encoderPicParamsDesc.m_AV1PicData);
|
||||
return curPicParamsData;
|
||||
} break;
|
||||
#endif
|
||||
#endif
|
||||
default:
|
||||
{
|
||||
|
|
@ -724,7 +710,6 @@ d3d12_video_encoder_get_current_rate_control_settings(struct d3d12_video_encoder
|
|||
curRateControlDesc.Flags = pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Flags;
|
||||
curRateControlDesc.TargetFrameRate = pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_FrameRate;
|
||||
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
if ((curRateControlDesc.Flags & D3D12_VIDEO_ENCODER_RATE_CONTROL_FLAG_ENABLE_EXTENSION1_SUPPORT) != 0)
|
||||
{
|
||||
switch (pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Mode) {
|
||||
|
|
@ -768,7 +753,6 @@ d3d12_video_encoder_get_current_rate_control_settings(struct d3d12_video_encoder
|
|||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
switch (pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Mode) {
|
||||
case D3D12_VIDEO_ENCODER_RATE_CONTROL_MODE_ABSOLUTE_QP_MAP:
|
||||
|
|
@ -838,7 +822,6 @@ d3d12_video_encoder_get_current_level_desc(struct d3d12_video_encoder *pD3D12Enc
|
|||
} break;
|
||||
#endif
|
||||
#if VIDEO_CODEC_AV1ENC
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
case PIPE_VIDEO_FORMAT_AV1:
|
||||
{
|
||||
D3D12_VIDEO_ENCODER_LEVEL_SETTING curLevelDesc = {};
|
||||
|
|
@ -846,7 +829,6 @@ d3d12_video_encoder_get_current_level_desc(struct d3d12_video_encoder *pD3D12Enc
|
|||
curLevelDesc.DataSize = sizeof(pD3D12Enc->m_currentEncodeConfig.m_encoderLevelDesc.m_AV1LevelSetting);
|
||||
return curLevelDesc;
|
||||
} break;
|
||||
#endif
|
||||
#endif
|
||||
default:
|
||||
{
|
||||
|
|
@ -919,7 +901,6 @@ d3d12_video_encoder_get_current_gop_desc(struct d3d12_video_encoder *pD3D12Enc)
|
|||
} break;
|
||||
#endif
|
||||
#if VIDEO_CODEC_AV1ENC
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
case PIPE_VIDEO_FORMAT_AV1:
|
||||
{
|
||||
D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE curGOPDesc = {};
|
||||
|
|
@ -928,7 +909,6 @@ d3d12_video_encoder_get_current_gop_desc(struct d3d12_video_encoder *pD3D12Enc)
|
|||
curGOPDesc.DataSize = sizeof(pD3D12Enc->m_currentEncodeConfig.m_encoderGOPConfigDesc.m_AV1SequenceStructure);
|
||||
return curGOPDesc;
|
||||
} break;
|
||||
#endif
|
||||
#endif
|
||||
default:
|
||||
{
|
||||
|
|
@ -963,7 +943,6 @@ d3d12_video_encoder_get_current_codec_config_desc(struct d3d12_video_encoder *pD
|
|||
} break;
|
||||
#endif
|
||||
#if VIDEO_CODEC_AV1ENC
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
case PIPE_VIDEO_FORMAT_AV1:
|
||||
{
|
||||
D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION codecConfigDesc = {};
|
||||
|
|
@ -972,7 +951,6 @@ d3d12_video_encoder_get_current_codec_config_desc(struct d3d12_video_encoder *pD
|
|||
sizeof(pD3D12Enc->m_currentEncodeConfig.m_encoderCodecSpecificConfigDesc.m_AV1Config);
|
||||
return codecConfigDesc;
|
||||
} break;
|
||||
#endif
|
||||
#endif
|
||||
default:
|
||||
{
|
||||
|
|
@ -999,12 +977,10 @@ d3d12_video_encoder_get_current_codec(struct d3d12_video_encoder *pD3D12Enc)
|
|||
} break;
|
||||
#endif
|
||||
#if VIDEO_CODEC_AV1ENC
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
case PIPE_VIDEO_FORMAT_AV1:
|
||||
{
|
||||
return D3D12_VIDEO_ENCODER_CODEC_AV1;
|
||||
} break;
|
||||
#endif
|
||||
#endif
|
||||
default:
|
||||
{
|
||||
|
|
@ -1028,13 +1004,11 @@ d3d12_video_encoder_disable_rc_vbv_sizes(struct D3D12EncodeRateControlState & rc
|
|||
rcState.m_Config.m_Configuration_VBR.VBVCapacity = 0;
|
||||
rcState.m_Config.m_Configuration_VBR.InitialVBVFullness = 0;
|
||||
} break;
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
case D3D12_VIDEO_ENCODER_RATE_CONTROL_MODE_QVBR:
|
||||
{
|
||||
rcState.m_Config.m_Configuration_QVBR1.VBVCapacity = 0;
|
||||
rcState.m_Config.m_Configuration_QVBR1.InitialVBVFullness = 0;
|
||||
} break;
|
||||
#endif
|
||||
default:
|
||||
{
|
||||
unreachable("Unsupported D3D12_VIDEO_ENCODER_RATE_CONTROL_MODE for VBV Sizes");
|
||||
|
|
@ -1067,7 +1041,6 @@ d3d12_video_encoder_disable_rc_maxframesize(struct D3D12EncodeRateControlState &
|
|||
}
|
||||
}
|
||||
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
static bool
|
||||
d3d12_video_encoder_is_qualitylevel_in_range(struct D3D12EncodeRateControlState & rcState, UINT MaxQualityVsSpeed)
|
||||
{
|
||||
|
|
@ -1118,7 +1091,6 @@ d3d12_video_encoder_disable_rc_qualitylevels(struct D3D12EncodeRateControlState
|
|||
} break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
d3d12_video_encoder_disable_rc_minmaxqp(struct D3D12EncodeRateControlState & rcState)
|
||||
|
|
@ -1147,7 +1119,6 @@ d3d12_video_encoder_disable_rc_minmaxqp(struct D3D12EncodeRateControlState & rcS
|
|||
}
|
||||
}
|
||||
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
static void
|
||||
d3d12_video_encoder_disable_rc_extended1_to_legacy(struct D3D12EncodeRateControlState & rcState)
|
||||
{
|
||||
|
|
@ -1157,7 +1128,6 @@ d3d12_video_encoder_disable_rc_extended1_to_legacy(struct D3D12EncodeRateControl
|
|||
// rcState.m_Configuration_XXX and m_Configuration_XXX1 are unions, can be aliased
|
||||
// as the m_Configuration_XXX1 extensions are binary backcompat with m_Configuration_XXX
|
||||
}
|
||||
#endif
|
||||
|
||||
///
|
||||
/// Call d3d12_video_encoder_query_d3d12_driver_caps and see if any optional feature requested
|
||||
|
|
@ -1207,7 +1177,6 @@ bool d3d12_video_encoder_negotiate_requested_features_and_d3d12_driver_caps(stru
|
|||
d3d12_video_encoder_disable_rc_minmaxqp(pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc);
|
||||
}
|
||||
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
bool isRequestingExtended1RCSupported = ((capEncoderSupportData1.SupportFlags & D3D12_VIDEO_ENCODER_SUPPORT_FLAG_RATE_CONTROL_EXTENSION1_SUPPORT) != 0);
|
||||
bool isClientRequestingExtended1RC = ((pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Flags & D3D12_VIDEO_ENCODER_RATE_CONTROL_FLAG_ENABLE_EXTENSION1_SUPPORT) != 0);
|
||||
|
||||
|
|
@ -1233,7 +1202,6 @@ bool d3d12_video_encoder_negotiate_requested_features_and_d3d12_driver_caps(stru
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
///
|
||||
/// Try fallback configuration
|
||||
|
|
@ -1347,7 +1315,6 @@ bool d3d12_video_encoder_query_d3d12_driver_caps(struct d3d12_video_encoder *pD3
|
|||
} break;
|
||||
#endif
|
||||
#if VIDEO_CODEC_AV1ENC
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
case PIPE_VIDEO_FORMAT_AV1:
|
||||
{
|
||||
capEncoderSupportData1.SuggestedProfile.pAV1Profile =
|
||||
|
|
@ -1359,7 +1326,6 @@ bool d3d12_video_encoder_query_d3d12_driver_caps(struct d3d12_video_encoder *pD3
|
|||
capEncoderSupportData1.SuggestedLevel.DataSize =
|
||||
sizeof(pD3D12Enc->m_currentEncodeCapabilities.m_encoderLevelSuggestedDesc.m_AV1LevelSetting);
|
||||
} break;
|
||||
#endif
|
||||
#endif
|
||||
default:
|
||||
{
|
||||
|
|
@ -1371,9 +1337,7 @@ bool d3d12_video_encoder_query_d3d12_driver_caps(struct d3d12_video_encoder *pD3
|
|||
capEncoderSupportData1.pResolutionDependentSupport =
|
||||
&pD3D12Enc->m_currentEncodeCapabilities.m_currentResolutionSupportCaps;
|
||||
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
capEncoderSupportData1.SubregionFrameEncodingData = d3d12_video_encoder_get_current_slice_param_settings(pD3D12Enc);
|
||||
#endif
|
||||
HRESULT hr = pD3D12Enc->m_spD3D12VideoDevice->CheckFeatureSupport(D3D12_FEATURE_VIDEO_ENCODER_SUPPORT1,
|
||||
&capEncoderSupportData1,
|
||||
sizeof(capEncoderSupportData1));
|
||||
|
|
@ -1439,7 +1403,6 @@ d3d12_video_encoder_get_current_profile_desc(struct d3d12_video_encoder *pD3D12E
|
|||
} break;
|
||||
#endif
|
||||
#if VIDEO_CODEC_AV1ENC
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
case PIPE_VIDEO_FORMAT_AV1:
|
||||
{
|
||||
D3D12_VIDEO_ENCODER_PROFILE_DESC curProfDesc = {};
|
||||
|
|
@ -1447,7 +1410,6 @@ d3d12_video_encoder_get_current_profile_desc(struct d3d12_video_encoder *pD3D12E
|
|||
curProfDesc.DataSize = sizeof(pD3D12Enc->m_currentEncodeConfig.m_encoderProfileDesc.m_AV1Profile);
|
||||
return curProfDesc;
|
||||
} break;
|
||||
#endif
|
||||
#endif
|
||||
default:
|
||||
{
|
||||
|
|
@ -1484,12 +1446,10 @@ d3d12_video_encoder_update_current_encoder_config_state(struct d3d12_video_encod
|
|||
} break;
|
||||
#endif
|
||||
#if VIDEO_CODEC_AV1ENC
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
case PIPE_VIDEO_FORMAT_AV1:
|
||||
{
|
||||
return d3d12_video_encoder_update_current_encoder_config_state_av1(pD3D12Enc, srcTextureDesc, picture);
|
||||
} break;
|
||||
#endif
|
||||
#endif
|
||||
default:
|
||||
{
|
||||
|
|
@ -1810,13 +1770,11 @@ d3d12_video_encoder_calculate_metadata_resolved_buffer_size(enum pipe_video_form
|
|||
break;
|
||||
#endif
|
||||
#if VIDEO_CODEC_AV1ENC
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
case PIPE_VIDEO_FORMAT_AV1:
|
||||
{
|
||||
size_t extra_av1_size = d3d12_video_encoder_calculate_metadata_resolved_buffer_size_av1(maxSliceNumber);
|
||||
bufferSize += extra_av1_size;
|
||||
} break;
|
||||
#endif
|
||||
#endif
|
||||
default:
|
||||
{
|
||||
|
|
@ -2483,7 +2441,6 @@ d3d12_video_encoder_build_post_encode_codec_bitstream(struct d3d12_video_encoder
|
|||
} break; // Do not need post encode values in headers
|
||||
#endif
|
||||
#if VIDEO_CODEC_AV1ENC
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
case PIPE_VIDEO_FORMAT_AV1:
|
||||
{
|
||||
return d3d12_video_encoder_build_post_encode_codec_bitstream_av1(
|
||||
|
|
@ -2495,7 +2452,6 @@ d3d12_video_encoder_build_post_encode_codec_bitstream(struct d3d12_video_encoder
|
|||
associatedMetadata
|
||||
);
|
||||
} break;
|
||||
#endif
|
||||
#endif
|
||||
default:
|
||||
unreachable("Unsupported pipe_video_format");
|
||||
|
|
@ -2623,12 +2579,10 @@ d3d12_video_encoder_store_current_picture_references(d3d12_video_encoder *pD3D12
|
|||
} break;
|
||||
#endif
|
||||
#if VIDEO_CODEC_AV1ENC
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
case PIPE_VIDEO_FORMAT_AV1:
|
||||
{
|
||||
d3d12_video_encoder_store_current_picture_references_av1(pD3D12Enc, current_metadata_slot);
|
||||
} break;
|
||||
#endif
|
||||
#endif
|
||||
default:
|
||||
{
|
||||
|
|
|
|||
|
|
@ -29,9 +29,7 @@
|
|||
#include "d3d12_video_dpb_storage_manager.h"
|
||||
#include "d3d12_video_encoder_bitstream_builder_h264.h"
|
||||
#include "d3d12_video_encoder_bitstream_builder_hevc.h"
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
#include "d3d12_video_encoder_bitstream_builder_av1.h"
|
||||
#endif
|
||||
#include <list>
|
||||
|
||||
///
|
||||
|
|
@ -148,18 +146,14 @@ struct D3D12EncodeCapabilities
|
|||
{
|
||||
D3D12_VIDEO_ENCODER_PROFILE_H264 m_H264Profile;
|
||||
D3D12_VIDEO_ENCODER_PROFILE_HEVC m_HEVCProfile;
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
D3D12_VIDEO_ENCODER_AV1_PROFILE m_AV1Profile;
|
||||
#endif
|
||||
} m_encoderSuggestedProfileDesc = {};
|
||||
|
||||
union
|
||||
{
|
||||
D3D12_VIDEO_ENCODER_LEVELS_H264 m_H264LevelSetting;
|
||||
D3D12_VIDEO_ENCODER_LEVEL_TIER_CONSTRAINTS_HEVC m_HEVCLevelSetting;
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
D3D12_VIDEO_ENCODER_AV1_LEVEL_TIER_CONSTRAINTS m_AV1LevelSetting;
|
||||
#endif
|
||||
} m_encoderLevelSuggestedDesc = {};
|
||||
|
||||
struct
|
||||
|
|
@ -167,14 +161,10 @@ struct D3D12EncodeCapabilities
|
|||
union{
|
||||
D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT_H264 m_H264CodecCaps;
|
||||
D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT_HEVC m_HEVCCodecCaps;
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
D3D12_VIDEO_ENCODER_AV1_CODEC_CONFIGURATION_SUPPORT m_AV1CodecCaps;
|
||||
#endif
|
||||
};
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
D3D12_VIDEO_ENCODER_AV1_FRAME_SUBREGION_LAYOUT_CONFIG_SUPPORT m_AV1TileCaps;
|
||||
D3D12_VIDEO_ENCODER_AV1_FEATURE_FLAGS RequiredNotRequestedFeatureFlags;
|
||||
#endif
|
||||
} m_encoderCodecSpecificConfigCaps = {};
|
||||
|
||||
// The maximum number of slices that the output of the current frame to be encoded will contain
|
||||
|
|
@ -196,12 +186,10 @@ struct D3D12EncodeRateControlState
|
|||
D3D12_VIDEO_ENCODER_RATE_CONTROL_CBR m_Configuration_CBR;
|
||||
D3D12_VIDEO_ENCODER_RATE_CONTROL_VBR m_Configuration_VBR;
|
||||
D3D12_VIDEO_ENCODER_RATE_CONTROL_QVBR m_Configuration_QVBR;
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
D3D12_VIDEO_ENCODER_RATE_CONTROL_CQP1 m_Configuration_CQP1;
|
||||
D3D12_VIDEO_ENCODER_RATE_CONTROL_CBR1 m_Configuration_CBR1;
|
||||
D3D12_VIDEO_ENCODER_RATE_CONTROL_VBR1 m_Configuration_VBR1;
|
||||
D3D12_VIDEO_ENCODER_RATE_CONTROL_QVBR1 m_Configuration_QVBR1;
|
||||
#endif
|
||||
} m_Config;
|
||||
};
|
||||
|
||||
|
|
@ -224,18 +212,14 @@ struct D3D12EncodeConfiguration
|
|||
{
|
||||
D3D12_VIDEO_ENCODER_PROFILE_H264 m_H264Profile;
|
||||
D3D12_VIDEO_ENCODER_PROFILE_HEVC m_HEVCProfile;
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
D3D12_VIDEO_ENCODER_AV1_PROFILE m_AV1Profile;
|
||||
#endif
|
||||
} m_encoderProfileDesc = {};
|
||||
|
||||
union
|
||||
{
|
||||
D3D12_VIDEO_ENCODER_LEVELS_H264 m_H264LevelSetting;
|
||||
D3D12_VIDEO_ENCODER_LEVEL_TIER_CONSTRAINTS_HEVC m_HEVCLevelSetting;
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
D3D12_VIDEO_ENCODER_AV1_LEVEL_TIER_CONSTRAINTS m_AV1LevelSetting;
|
||||
#endif
|
||||
} m_encoderLevelDesc = {};
|
||||
|
||||
struct D3D12EncodeRateControlState m_encoderRateControlDesc = {};
|
||||
|
|
@ -244,9 +228,7 @@ struct D3D12EncodeConfiguration
|
|||
{
|
||||
D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264 m_H264Config;
|
||||
D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC m_HEVCConfig;
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
D3D12_VIDEO_ENCODER_AV1_CODEC_CONFIGURATION m_AV1Config;
|
||||
#endif
|
||||
} m_encoderCodecSpecificConfigDesc = {};
|
||||
|
||||
|
||||
|
|
@ -255,31 +237,25 @@ struct D3D12EncodeConfiguration
|
|||
{
|
||||
D3D12_VIDEO_ENCODER_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA_SLICES m_SlicesPartition_H264;
|
||||
D3D12_VIDEO_ENCODER_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA_SLICES m_SlicesPartition_HEVC;
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
struct {
|
||||
D3D12_VIDEO_ENCODER_AV1_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA_TILES TilesPartition;
|
||||
uint8_t TilesGroupsCount;
|
||||
av1_tile_group_t TilesGroups[128];
|
||||
} m_TilesConfig_AV1;
|
||||
#endif
|
||||
} m_encoderSliceConfigDesc = {};
|
||||
|
||||
union
|
||||
{
|
||||
D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE_H264 m_H264GroupOfPictures;
|
||||
D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE_HEVC m_HEVCGroupOfPictures;
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
D3D12_VIDEO_ENCODER_AV1_SEQUENCE_STRUCTURE m_AV1SequenceStructure;
|
||||
#endif
|
||||
} m_encoderGOPConfigDesc = {};
|
||||
|
||||
union
|
||||
{
|
||||
D3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA_H264 m_H264PicData;
|
||||
D3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA_HEVC m_HEVCPicData;
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
D3D12_VIDEO_ENCODER_AV1_PICTURE_CONTROL_CODEC_DATA m_AV1PicData;
|
||||
#endif
|
||||
} m_encoderPicParamsDesc = {};
|
||||
|
||||
D3D12_VIDEO_ENCODER_MOTION_ESTIMATION_PRECISION_MODE m_encoderMotionPrecisionLimit =
|
||||
|
|
|
|||
|
|
@ -101,7 +101,6 @@ d3d12_video_encoder_update_current_rate_control_av1(struct d3d12_video_encoder *
|
|||
picture->rc[0].max_qp;
|
||||
}
|
||||
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
if (picture->quality_modes.level > 0) {
|
||||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Flags |=
|
||||
D3D12_VIDEO_ENCODER_RATE_CONTROL_FLAG_ENABLE_QUALITY_VS_SPEED;
|
||||
|
|
@ -119,7 +118,6 @@ d3d12_video_encoder_update_current_rate_control_av1(struct d3d12_video_encoder *
|
|||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Config.m_Configuration_VBR1.QualityVsSpeed =
|
||||
pD3D12Enc->max_quality_levels - picture->quality_modes.level;
|
||||
}
|
||||
#endif
|
||||
|
||||
} break;
|
||||
case PIPE_H2645_ENC_RATE_CONTROL_METHOD_QUALITY_VARIABLE:
|
||||
|
|
@ -132,7 +130,6 @@ d3d12_video_encoder_update_current_rate_control_av1(struct d3d12_video_encoder *
|
|||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Config.m_Configuration_QVBR.ConstantQualityTarget =
|
||||
picture->rc[0].vbr_quality_factor;
|
||||
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
if (D3D12_VIDEO_ENC_CBR_FORCE_VBV_EQUAL_BITRATE) {
|
||||
debug_printf("[d3d12_video_encoder_av1] d3d12_video_encoder_update_current_rate_control_av1 "
|
||||
"D3D12_VIDEO_ENC_CBR_FORCE_VBV_EQUAL_BITRATE environment variable is set, "
|
||||
|
|
@ -162,7 +159,6 @@ d3d12_video_encoder_update_current_rate_control_av1(struct d3d12_video_encoder *
|
|||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Config.m_Configuration_QVBR1.InitialVBVFullness =
|
||||
picture->rc[0].vbv_buf_initial_size;
|
||||
}
|
||||
#endif
|
||||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.max_frame_size = picture->rc[0].max_au_size;
|
||||
if (picture->rc[0].max_au_size > 0) {
|
||||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Flags |=
|
||||
|
|
@ -189,7 +185,6 @@ d3d12_video_encoder_update_current_rate_control_av1(struct d3d12_video_encoder *
|
|||
picture->rc[0].max_qp;
|
||||
}
|
||||
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
if (picture->quality_modes.level > 0) {
|
||||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Flags |=
|
||||
D3D12_VIDEO_ENCODER_RATE_CONTROL_FLAG_ENABLE_QUALITY_VS_SPEED;
|
||||
|
|
@ -207,7 +202,6 @@ d3d12_video_encoder_update_current_rate_control_av1(struct d3d12_video_encoder *
|
|||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Config.m_Configuration_QVBR1.QualityVsSpeed =
|
||||
pD3D12Enc->max_quality_levels - picture->quality_modes.level;
|
||||
}
|
||||
#endif
|
||||
|
||||
} break;
|
||||
case PIPE_H2645_ENC_RATE_CONTROL_METHOD_CONSTANT_SKIP:
|
||||
|
|
@ -274,7 +268,6 @@ d3d12_video_encoder_update_current_rate_control_av1(struct d3d12_video_encoder *
|
|||
picture->rc[0].max_qp;
|
||||
}
|
||||
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
if (picture->quality_modes.level > 0) {
|
||||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Flags |=
|
||||
D3D12_VIDEO_ENCODER_RATE_CONTROL_FLAG_ENABLE_QUALITY_VS_SPEED;
|
||||
|
|
@ -292,7 +285,6 @@ d3d12_video_encoder_update_current_rate_control_av1(struct d3d12_video_encoder *
|
|||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Config.m_Configuration_CBR1.QualityVsSpeed =
|
||||
pD3D12Enc->max_quality_levels - picture->quality_modes.level;
|
||||
}
|
||||
#endif
|
||||
|
||||
} break;
|
||||
case PIPE_H2645_ENC_RATE_CONTROL_METHOD_DISABLE:
|
||||
|
|
@ -307,7 +299,6 @@ d3d12_video_encoder_update_current_rate_control_av1(struct d3d12_video_encoder *
|
|||
.ConstantQP_InterPredictedFrame_BiDirectionalRef =
|
||||
picture->rc[0].app_requested_initial_qp ? picture->rc[0].qp : 0;
|
||||
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
if (picture->quality_modes.level > 0) {
|
||||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Flags |=
|
||||
D3D12_VIDEO_ENCODER_RATE_CONTROL_FLAG_ENABLE_QUALITY_VS_SPEED;
|
||||
|
|
@ -324,7 +315,6 @@ d3d12_video_encoder_update_current_rate_control_av1(struct d3d12_video_encoder *
|
|||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Config.m_Configuration_CQP1.QualityVsSpeed =
|
||||
pD3D12Enc->max_quality_levels - picture->quality_modes.level;
|
||||
}
|
||||
#endif
|
||||
} break;
|
||||
default:
|
||||
{
|
||||
|
|
|
|||
|
|
@ -98,7 +98,6 @@ d3d12_video_encoder_update_current_rate_control_h264(struct d3d12_video_encoder
|
|||
picture->rate_ctrl[0].max_qp;
|
||||
}
|
||||
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
if (picture->quality_modes.level > 0) {
|
||||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Flags |=
|
||||
D3D12_VIDEO_ENCODER_RATE_CONTROL_FLAG_ENABLE_QUALITY_VS_SPEED;
|
||||
|
|
@ -116,7 +115,6 @@ d3d12_video_encoder_update_current_rate_control_h264(struct d3d12_video_encoder
|
|||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Config.m_Configuration_VBR1.QualityVsSpeed =
|
||||
pD3D12Enc->max_quality_levels - picture->quality_modes.level;
|
||||
}
|
||||
#endif
|
||||
|
||||
} break;
|
||||
case PIPE_H2645_ENC_RATE_CONTROL_METHOD_QUALITY_VARIABLE:
|
||||
|
|
@ -129,7 +127,6 @@ d3d12_video_encoder_update_current_rate_control_h264(struct d3d12_video_encoder
|
|||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Config.m_Configuration_QVBR.ConstantQualityTarget =
|
||||
picture->rate_ctrl[0].vbr_quality_factor;
|
||||
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
if (D3D12_VIDEO_ENC_CBR_FORCE_VBV_EQUAL_BITRATE) {
|
||||
debug_printf("[d3d12_video_encoder_h264] d3d12_video_encoder_update_current_rate_control_h264 D3D12_VIDEO_ENC_CBR_FORCE_VBV_EQUAL_BITRATE environment variable is set, "
|
||||
", forcing VBV Size = VBV Initial Capacity = Target Bitrate = %" PRIu64 " (bits)\n", pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Config.m_Configuration_QVBR1.TargetAvgBitRate);
|
||||
|
|
@ -153,7 +150,6 @@ d3d12_video_encoder_update_current_rate_control_h264(struct d3d12_video_encoder
|
|||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Config.m_Configuration_QVBR1.InitialVBVFullness =
|
||||
picture->rate_ctrl[0].vbv_buf_initial_size;
|
||||
}
|
||||
#endif
|
||||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.max_frame_size = picture->rate_ctrl[0].max_au_size;
|
||||
if (picture->rate_ctrl[0].max_au_size > 0) {
|
||||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Flags |=
|
||||
|
|
@ -179,7 +175,6 @@ d3d12_video_encoder_update_current_rate_control_h264(struct d3d12_video_encoder
|
|||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Config.m_Configuration_QVBR.MaxQP =
|
||||
picture->rate_ctrl[0].max_qp;
|
||||
}
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
if (picture->quality_modes.level > 0) {
|
||||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Flags |=
|
||||
D3D12_VIDEO_ENCODER_RATE_CONTROL_FLAG_ENABLE_QUALITY_VS_SPEED;
|
||||
|
|
@ -197,7 +192,6 @@ d3d12_video_encoder_update_current_rate_control_h264(struct d3d12_video_encoder
|
|||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Config.m_Configuration_QVBR1.QualityVsSpeed =
|
||||
pD3D12Enc->max_quality_levels - picture->quality_modes.level;
|
||||
}
|
||||
#endif
|
||||
} break;
|
||||
case PIPE_H2645_ENC_RATE_CONTROL_METHOD_CONSTANT_SKIP:
|
||||
case PIPE_H2645_ENC_RATE_CONTROL_METHOD_CONSTANT:
|
||||
|
|
@ -257,7 +251,6 @@ d3d12_video_encoder_update_current_rate_control_h264(struct d3d12_video_encoder
|
|||
picture->rate_ctrl[0].max_qp;
|
||||
}
|
||||
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
if (picture->quality_modes.level > 0) {
|
||||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Flags |=
|
||||
D3D12_VIDEO_ENCODER_RATE_CONTROL_FLAG_ENABLE_QUALITY_VS_SPEED;
|
||||
|
|
@ -275,7 +268,6 @@ d3d12_video_encoder_update_current_rate_control_h264(struct d3d12_video_encoder
|
|||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Config.m_Configuration_CBR1.QualityVsSpeed =
|
||||
pD3D12Enc->max_quality_levels - picture->quality_modes.level;
|
||||
}
|
||||
#endif
|
||||
} break;
|
||||
case PIPE_H2645_ENC_RATE_CONTROL_METHOD_DISABLE:
|
||||
{
|
||||
|
|
@ -286,7 +278,6 @@ d3d12_video_encoder_update_current_rate_control_h264(struct d3d12_video_encoder
|
|||
.ConstantQP_InterPredictedFrame_PrevRefOnly = picture->quant_p_frames;
|
||||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Config.m_Configuration_CQP
|
||||
.ConstantQP_InterPredictedFrame_BiDirectionalRef = picture->quant_b_frames;
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
if (picture->quality_modes.level > 0) {
|
||||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Flags |=
|
||||
D3D12_VIDEO_ENCODER_RATE_CONTROL_FLAG_ENABLE_QUALITY_VS_SPEED;
|
||||
|
|
@ -304,7 +295,6 @@ d3d12_video_encoder_update_current_rate_control_h264(struct d3d12_video_encoder
|
|||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Config.m_Configuration_CQP1.QualityVsSpeed =
|
||||
pD3D12Enc->max_quality_levels - picture->quality_modes.level;
|
||||
}
|
||||
#endif
|
||||
} break;
|
||||
default:
|
||||
{
|
||||
|
|
|
|||
|
|
@ -98,7 +98,6 @@ d3d12_video_encoder_update_current_rate_control_hevc(struct d3d12_video_encoder
|
|||
picture->rc.max_qp;
|
||||
}
|
||||
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
if (picture->quality_modes.level > 0) {
|
||||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Flags |=
|
||||
D3D12_VIDEO_ENCODER_RATE_CONTROL_FLAG_ENABLE_QUALITY_VS_SPEED;
|
||||
|
|
@ -116,7 +115,6 @@ d3d12_video_encoder_update_current_rate_control_hevc(struct d3d12_video_encoder
|
|||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Config.m_Configuration_VBR1.QualityVsSpeed =
|
||||
pD3D12Enc->max_quality_levels - picture->quality_modes.level;
|
||||
}
|
||||
#endif
|
||||
|
||||
} break;
|
||||
case PIPE_H2645_ENC_RATE_CONTROL_METHOD_QUALITY_VARIABLE:
|
||||
|
|
@ -128,7 +126,6 @@ d3d12_video_encoder_update_current_rate_control_hevc(struct d3d12_video_encoder
|
|||
picture->rc.peak_bitrate;
|
||||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Config.m_Configuration_QVBR.ConstantQualityTarget =
|
||||
picture->rc.vbr_quality_factor;
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
if (D3D12_VIDEO_ENC_CBR_FORCE_VBV_EQUAL_BITRATE) {
|
||||
debug_printf("[d3d12_video_encoder_hevc] d3d12_video_encoder_update_current_rate_control_hevc D3D12_VIDEO_ENC_CBR_FORCE_VBV_EQUAL_BITRATE environment variable is set, "
|
||||
", forcing VBV Size = VBV Initial Capacity = Target Bitrate = %" PRIu64 " (bits)\n", pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Config.m_Configuration_QVBR1.TargetAvgBitRate);
|
||||
|
|
@ -152,7 +149,6 @@ d3d12_video_encoder_update_current_rate_control_hevc(struct d3d12_video_encoder
|
|||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Config.m_Configuration_QVBR1.InitialVBVFullness =
|
||||
picture->rc.vbv_buf_initial_size;
|
||||
}
|
||||
#endif
|
||||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.max_frame_size = picture->rc.max_au_size;
|
||||
if (picture->rc.max_au_size > 0) {
|
||||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Flags |=
|
||||
|
|
@ -179,7 +175,6 @@ d3d12_video_encoder_update_current_rate_control_hevc(struct d3d12_video_encoder
|
|||
picture->rc.max_qp;
|
||||
}
|
||||
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
if (picture->quality_modes.level > 0) {
|
||||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Flags |=
|
||||
D3D12_VIDEO_ENCODER_RATE_CONTROL_FLAG_ENABLE_QUALITY_VS_SPEED;
|
||||
|
|
@ -197,7 +192,6 @@ d3d12_video_encoder_update_current_rate_control_hevc(struct d3d12_video_encoder
|
|||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Config.m_Configuration_QVBR1.QualityVsSpeed =
|
||||
pD3D12Enc->max_quality_levels - picture->quality_modes.level;
|
||||
}
|
||||
#endif
|
||||
|
||||
} break;
|
||||
case PIPE_H2645_ENC_RATE_CONTROL_METHOD_CONSTANT_SKIP:
|
||||
|
|
@ -257,7 +251,6 @@ d3d12_video_encoder_update_current_rate_control_hevc(struct d3d12_video_encoder
|
|||
picture->rc.max_qp;
|
||||
}
|
||||
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
if (picture->quality_modes.level > 0) {
|
||||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Flags |=
|
||||
D3D12_VIDEO_ENCODER_RATE_CONTROL_FLAG_ENABLE_QUALITY_VS_SPEED;
|
||||
|
|
@ -275,7 +268,6 @@ d3d12_video_encoder_update_current_rate_control_hevc(struct d3d12_video_encoder
|
|||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Config.m_Configuration_CBR1.QualityVsSpeed =
|
||||
pD3D12Enc->max_quality_levels - picture->quality_modes.level;
|
||||
}
|
||||
#endif
|
||||
|
||||
} break;
|
||||
case PIPE_H2645_ENC_RATE_CONTROL_METHOD_DISABLE:
|
||||
|
|
@ -288,7 +280,6 @@ d3d12_video_encoder_update_current_rate_control_hevc(struct d3d12_video_encoder
|
|||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Config.m_Configuration_CQP
|
||||
.ConstantQP_InterPredictedFrame_BiDirectionalRef = picture->rc.quant_b_frames;
|
||||
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
if (picture->quality_modes.level > 0) {
|
||||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Flags |=
|
||||
D3D12_VIDEO_ENCODER_RATE_CONTROL_FLAG_ENABLE_QUALITY_VS_SPEED;
|
||||
|
|
@ -306,7 +297,6 @@ d3d12_video_encoder_update_current_rate_control_hevc(struct d3d12_video_encoder
|
|||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Config.m_Configuration_CQP1.QualityVsSpeed =
|
||||
pD3D12Enc->max_quality_levels - picture->quality_modes.level;
|
||||
}
|
||||
#endif
|
||||
} break;
|
||||
default:
|
||||
{
|
||||
|
|
|
|||
|
|
@ -50,10 +50,8 @@ struct d3d12_encode_codec_support {
|
|||
union pipe_av1_enc_cap_features features;
|
||||
union pipe_av1_enc_cap_features_ext1 features_ext1;
|
||||
union pipe_av1_enc_cap_features_ext2 features_ext2;
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
D3D12_VIDEO_ENCODER_AV1_CODEC_CONFIGURATION_SUPPORT d3d12_caps;
|
||||
D3D12_VIDEO_ENCODER_CODEC_AV1_PICTURE_CONTROL_SUPPORT d3d12_picture_control;
|
||||
#endif
|
||||
} av1_support;
|
||||
};
|
||||
};
|
||||
|
|
@ -331,7 +329,6 @@ d3d12_video_encode_supported_references_per_frame_structures(const D3D12_VIDEO_E
|
|||
supportedMaxRefFrames = (maxRefForL0 & 0xffff) | ((maxRefForL1 & 0xffff) << 16);
|
||||
}
|
||||
}
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
else if(codec == D3D12_VIDEO_ENCODER_CODEC_AV1){
|
||||
codecSupport.av1_support.d3d12_picture_control = {};
|
||||
capPictureControlData.Profile = profile;
|
||||
|
|
@ -353,11 +350,9 @@ d3d12_video_encode_supported_references_per_frame_structures(const D3D12_VIDEO_E
|
|||
supportedMaxRefFrames = (supportedMaxRefFrames & 0xffff) | ((supportedMaxRefFrames & 0xffff) << 16);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return supportedMaxRefFrames;
|
||||
}
|
||||
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
static void
|
||||
d3d12_video_encode_supported_tile_structures(const D3D12_VIDEO_ENCODER_CODEC &codec,
|
||||
const D3D12_VIDEO_ENCODER_PROFILE_DESC &profile,
|
||||
|
|
@ -457,7 +452,6 @@ d3d12_video_encode_supported_tile_structures(const D3D12_VIDEO_ENCODER_CODEC &co
|
|||
PIPE_VIDEO_CAP_SLICE_STRUCTURE_ARBITRARY_ROWS);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static uint32_t
|
||||
d3d12_video_encode_supported_slice_structures(const D3D12_VIDEO_ENCODER_CODEC &codec,
|
||||
|
|
@ -598,12 +592,10 @@ d3d12_video_encode_support_caps(const D3D12_VIDEO_ENCODER_CODEC &argTargetCodec,
|
|||
D3D12_VIDEO_ENCODER_LEVEL_TIER_CONSTRAINTS_HEVC hevcLvl = { };
|
||||
D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE_HEVC hevcGop = { 1, 0, 0 };
|
||||
D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC hevcConfig = {};
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
D3D12_VIDEO_ENCODER_AV1_PROFILE av1prof = { };
|
||||
D3D12_VIDEO_ENCODER_AV1_LEVEL_TIER_CONSTRAINTS av1Lvl = { };
|
||||
D3D12_VIDEO_ENCODER_AV1_SEQUENCE_STRUCTURE av1Gop = { 1, 0 };
|
||||
D3D12_VIDEO_ENCODER_AV1_CODEC_CONFIGURATION av1Config = {};
|
||||
#endif
|
||||
switch (argTargetCodec) {
|
||||
case D3D12_VIDEO_ENCODER_CODEC_H264:
|
||||
{
|
||||
|
|
@ -645,7 +637,6 @@ d3d12_video_encode_support_caps(const D3D12_VIDEO_ENCODER_CODEC &argTargetCodec,
|
|||
capEncoderSupportData1.CodecConfiguration.pHEVCConfig = &hevcConfig;
|
||||
} break;
|
||||
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
case D3D12_VIDEO_ENCODER_CODEC_AV1:
|
||||
{
|
||||
capEncoderSupportData1.SuggestedProfile.pAV1Profile = &av1prof;
|
||||
|
|
@ -675,7 +666,6 @@ d3d12_video_encode_support_caps(const D3D12_VIDEO_ENCODER_CODEC &argTargetCodec,
|
|||
capEncoderSupportData1.CodecConfiguration.DataSize = sizeof(av1Config);
|
||||
capEncoderSupportData1.CodecConfiguration.pAV1Config = &av1Config;
|
||||
} break;
|
||||
#endif
|
||||
default:
|
||||
{
|
||||
unreachable("Unsupported D3D12_VIDEO_ENCODER_CODEC");
|
||||
|
|
@ -705,7 +695,6 @@ d3d12_video_encode_support_caps(const D3D12_VIDEO_ENCODER_CODEC &argTargetCodec,
|
|||
}
|
||||
}
|
||||
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
// Convert between D3D12 definition and PIPE definition
|
||||
|
||||
// D3D12: QualityVsSpeed must be in the range [0, D3D12_FEATURE_DATA_VIDEO_ENCODER_SUPPORT1.MaxQualityVsSpeed]
|
||||
|
|
@ -716,9 +705,6 @@ d3d12_video_encode_support_caps(const D3D12_VIDEO_ENCODER_CODEC &argTargetCodec,
|
|||
// The quality level setting is used as a trade-off between quality and speed/power
|
||||
// consumption, with higher quality corresponds to lower speed and higher power consumption.
|
||||
maxQualityLevels = capEncoderSupportData1.MaxQualityVsSpeed + 1; // VA range starts from 1, D3D12 starts from 0
|
||||
#else
|
||||
maxQualityLevels = 1; // This needs to be 1 for backcompat of frontend/va calling for PIPE_VIDEO_CAP_ENC_QUALITY_LEVEL > 0
|
||||
#endif
|
||||
|
||||
bool configSupported =
|
||||
(((capEncoderSupportData1.SupportFlags & D3D12_VIDEO_ENCODER_SUPPORT_FLAG_GENERAL_SUPPORT_OK) != 0) &&
|
||||
|
|
@ -727,7 +713,6 @@ d3d12_video_encode_support_caps(const D3D12_VIDEO_ENCODER_CODEC &argTargetCodec,
|
|||
return configSupported;
|
||||
}
|
||||
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
bool
|
||||
static d3d12_video_encode_get_av1_codec_support ( const D3D12_VIDEO_ENCODER_CODEC &argCodec,
|
||||
const D3D12_VIDEO_ENCODER_PROFILE_DESC &argTargetProfile,
|
||||
|
|
@ -748,7 +733,6 @@ static d3d12_video_encode_get_av1_codec_support ( const D3D12_VIDEO_ENCODER_CODE
|
|||
memset(&av1Support, 0, sizeof(D3D12_VIDEO_ENCODER_AV1_CODEC_CONFIGURATION_SUPPORT));
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool
|
||||
static d3d12_video_encode_get_h264_codec_support(const D3D12_VIDEO_ENCODER_PROFILE_DESC &argTargetProfile,
|
||||
|
|
@ -926,11 +910,9 @@ d3d12_has_video_encode_support(struct pipe_screen *pscreen,
|
|||
capEncoderSupportData1.SubregionFrameEncoding = (supportedSliceStructures == PIPE_VIDEO_CAP_SLICE_STRUCTURE_NONE) ?
|
||||
D3D12_VIDEO_ENCODER_FRAME_SUBREGION_LAYOUT_MODE_FULL_FRAME :
|
||||
D3D12_VIDEO_ENCODER_FRAME_SUBREGION_LAYOUT_MODE_UNIFORM_PARTITIONING_SUBREGIONS_PER_FRAME;
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
D3D12_VIDEO_ENCODER_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA_SLICES sliceData = { };
|
||||
capEncoderSupportData1.SubregionFrameEncodingData.DataSize = sizeof(sliceData);
|
||||
capEncoderSupportData1.SubregionFrameEncodingData.pSlicesPartition_H264 = &sliceData;
|
||||
#endif
|
||||
supportsProfile = supportsProfile && d3d12_video_encode_support_caps(codecDesc,
|
||||
maxRes,
|
||||
encodeFormat,
|
||||
|
|
@ -1104,11 +1086,9 @@ d3d12_has_video_encode_support(struct pipe_screen *pscreen,
|
|||
capEncoderSupportData1.SubregionFrameEncoding = (supportedSliceStructures == PIPE_VIDEO_CAP_SLICE_STRUCTURE_NONE) ?
|
||||
D3D12_VIDEO_ENCODER_FRAME_SUBREGION_LAYOUT_MODE_FULL_FRAME :
|
||||
D3D12_VIDEO_ENCODER_FRAME_SUBREGION_LAYOUT_MODE_UNIFORM_PARTITIONING_SUBREGIONS_PER_FRAME;
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
D3D12_VIDEO_ENCODER_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA_SLICES sliceData = { };
|
||||
capEncoderSupportData1.SubregionFrameEncodingData.DataSize = sizeof(sliceData);
|
||||
capEncoderSupportData1.SubregionFrameEncodingData.pSlicesPartition_HEVC = &sliceData;
|
||||
#endif
|
||||
supportsProfile = supportsProfile && d3d12_video_encode_support_caps(codecDesc,
|
||||
maxRes,
|
||||
encodeFormat,
|
||||
|
|
@ -1129,7 +1109,6 @@ d3d12_has_video_encode_support(struct pipe_screen *pscreen,
|
|||
} break;
|
||||
#endif
|
||||
#if VIDEO_CODEC_AV1ENC
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
case PIPE_VIDEO_PROFILE_AV1_MAIN:
|
||||
{
|
||||
D3D12_VIDEO_ENCODER_PROFILE_DESC profDesc = {};
|
||||
|
|
@ -1387,7 +1366,6 @@ d3d12_has_video_encode_support(struct pipe_screen *pscreen,
|
|||
}
|
||||
}
|
||||
} break;
|
||||
#endif // #if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
#endif // #if VIDEO_CODEC_AV1ENC
|
||||
default:
|
||||
supportsProfile = false;
|
||||
|
|
@ -1794,7 +1772,6 @@ d3d12_screen_get_video_param_encode(struct pipe_screen *pscreen,
|
|||
return codec_specific_support.hevc_support.prediction_direction;
|
||||
return 0;
|
||||
}
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
else if (param == PIPE_VIDEO_CAP_ENC_AV1_FEATURE) {
|
||||
return codec_specific_support.av1_support.features.value;
|
||||
} else if (param == PIPE_VIDEO_CAP_ENC_AV1_FEATURE_EXT1) {
|
||||
|
|
@ -1806,7 +1783,6 @@ d3d12_screen_get_video_param_encode(struct pipe_screen *pscreen,
|
|||
} else if(param == PIPE_VIDEO_CAP_ENC_QUALITY_LEVEL) {
|
||||
return maxQualityLevels;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} else if (param == PIPE_VIDEO_CAP_ENC_QUALITY_LEVEL) {
|
||||
return 1; // This needs to be 1 for backcompat of frontend/va calling for PIPE_VIDEO_CAP_ENC_QUALITY_LEVEL > 0
|
||||
|
|
@ -1881,9 +1857,7 @@ is_d3d12_video_encode_format_supported(struct pipe_screen *screen,
|
|||
D3D12_VIDEO_ENCODER_PROFILE_HEVC profHEVC = {};
|
||||
#endif
|
||||
#if VIDEO_CODEC_AV1ENC
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
D3D12_VIDEO_ENCODER_AV1_PROFILE profAV1 = {};
|
||||
#endif
|
||||
#endif
|
||||
D3D12_FEATURE_DATA_VIDEO_ENCODER_INPUT_FORMAT capDataFmt = {};
|
||||
capDataFmt.NodeIndex = 0;
|
||||
|
|
@ -1907,14 +1881,12 @@ is_d3d12_video_encode_format_supported(struct pipe_screen *screen,
|
|||
} break;
|
||||
#endif
|
||||
#if VIDEO_CODEC_AV1ENC
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
case PIPE_VIDEO_FORMAT_AV1:
|
||||
{
|
||||
profAV1 = d3d12_video_encoder_convert_profile_to_d3d12_enc_profile_av1(profile);
|
||||
capDataFmt.Profile.DataSize = sizeof(profAV1);
|
||||
capDataFmt.Profile.pAV1Profile = &profAV1;
|
||||
} break;
|
||||
#endif
|
||||
#endif
|
||||
default:
|
||||
{
|
||||
|
|
|
|||
|
|
@ -37,11 +37,6 @@
|
|||
#include <directx/d3d12video.h>
|
||||
#include <dxguids/dxguids.h>
|
||||
|
||||
#if ((D3D12_SDK_VERSION < 611) || (D3D12_PREVIEW_SDK_VERSION < 711))
|
||||
using D3D12_FEATURE_DATA_VIDEO_ENCODER_SUPPORT1 = D3D12_FEATURE_DATA_VIDEO_ENCODER_SUPPORT;
|
||||
constexpr D3D12_FEATURE_VIDEO D3D12_FEATURE_VIDEO_ENCODER_SUPPORT1 = D3D12_FEATURE_VIDEO_ENCODER_SUPPORT;
|
||||
#endif
|
||||
|
||||
#include <wrl/client.h>
|
||||
using Microsoft::WRL::ComPtr;
|
||||
|
||||
|
|
@ -136,7 +131,6 @@ d3d12_video_encoder_convert_from_d3d12_level_h264(D3D12_VIDEO_ENCODER_LEVELS_H26
|
|||
void
|
||||
d3d12_video_encoder_convert_from_d3d12_level_hevc(D3D12_VIDEO_ENCODER_LEVELS_HEVC level12,
|
||||
uint32_t & specLevel);
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
void
|
||||
d3d12_video_encoder_convert_d3d12_to_spec_level_av1(D3D12_VIDEO_ENCODER_AV1_LEVELS level12,
|
||||
uint32_t & specLevel);
|
||||
|
|
@ -146,15 +140,12 @@ d3d12_video_encoder_convert_spec_to_d3d12_level_av1(uint32_t specLevel,
|
|||
void
|
||||
d3d12_video_encoder_convert_spec_to_d3d12_tier_av1(uint32_t specTier,
|
||||
D3D12_VIDEO_ENCODER_AV1_TIER & tier12);
|
||||
#endif
|
||||
D3D12_VIDEO_ENCODER_PROFILE_H264
|
||||
d3d12_video_encoder_convert_profile_to_d3d12_enc_profile_h264(enum pipe_video_profile profile);
|
||||
D3D12_VIDEO_ENCODER_PROFILE_HEVC
|
||||
d3d12_video_encoder_convert_profile_to_d3d12_enc_profile_hevc(enum pipe_video_profile profile);
|
||||
#if ((D3D12_SDK_VERSION >= 611) && (D3D12_PREVIEW_SDK_VERSION >= 712))
|
||||
D3D12_VIDEO_ENCODER_AV1_PROFILE
|
||||
d3d12_video_encoder_convert_profile_to_d3d12_enc_profile_av1(enum pipe_video_profile profile);
|
||||
#endif
|
||||
D3D12_VIDEO_ENCODER_CODEC
|
||||
d3d12_video_encoder_convert_codec_to_d3d12_enc_codec(enum pipe_video_profile profile);
|
||||
GUID
|
||||
|
|
|
|||
|
|
@ -102,13 +102,11 @@ if _codecs.contains('h265enc')
|
|||
endif
|
||||
|
||||
if _codecs.contains('av1enc')
|
||||
if (dep_dxheaders.version().version_compare('>= 1.611.0') and dep_dxheaders.version().version_compare('< 1.700.0')) or dep_dxheaders.version().version_compare('>= 1.712.0')
|
||||
files_libd3d12 += [
|
||||
'd3d12_video_enc_av1.cpp',
|
||||
'd3d12_video_encoder_references_manager_av1.cpp',
|
||||
'd3d12_video_encoder_bitstream_builder_av1.cpp',
|
||||
]
|
||||
endif
|
||||
files_libd3d12 += [
|
||||
'd3d12_video_enc_av1.cpp',
|
||||
'd3d12_video_encoder_references_manager_av1.cpp',
|
||||
'd3d12_video_encoder_bitstream_builder_av1.cpp',
|
||||
]
|
||||
endif
|
||||
|
||||
endif # with_gallium_d3d12_video
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue