mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-10 08:10:14 +01:00
d3d12: Support QVBR rate control mode
Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22530>
This commit is contained in:
parent
9c4969a249
commit
358fea01a6
3 changed files with 44 additions and 0 deletions
|
|
@ -52,6 +52,16 @@ d3d12_video_encoder_update_current_rate_control_h264(struct d3d12_video_encoder
|
|||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Config.m_Configuration_VBR.PeakBitRate =
|
||||
picture->rate_ctrl[0].peak_bitrate;
|
||||
} break;
|
||||
case PIPE_H2645_ENC_RATE_CONTROL_METHOD_QUALITY_VARIABLE:
|
||||
{
|
||||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Mode = D3D12_VIDEO_ENCODER_RATE_CONTROL_MODE_QVBR;
|
||||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Config.m_Configuration_QVBR.TargetAvgBitRate =
|
||||
picture->rate_ctrl[0].target_bitrate;
|
||||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Config.m_Configuration_QVBR.PeakBitRate =
|
||||
picture->rate_ctrl[0].peak_bitrate;
|
||||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Config.m_Configuration_QVBR.ConstantQualityTarget =
|
||||
picture->rate_ctrl[0].vbr_quality_factor;
|
||||
} break;
|
||||
case PIPE_H2645_ENC_RATE_CONTROL_METHOD_CONSTANT_SKIP:
|
||||
case PIPE_H2645_ENC_RATE_CONTROL_METHOD_CONSTANT:
|
||||
{
|
||||
|
|
|
|||
|
|
@ -52,6 +52,16 @@ d3d12_video_encoder_update_current_rate_control_hevc(struct d3d12_video_encoder
|
|||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Config.m_Configuration_VBR.PeakBitRate =
|
||||
picture->rc.peak_bitrate;
|
||||
} break;
|
||||
case PIPE_H2645_ENC_RATE_CONTROL_METHOD_QUALITY_VARIABLE:
|
||||
{
|
||||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Mode = D3D12_VIDEO_ENCODER_RATE_CONTROL_MODE_QVBR;
|
||||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Config.m_Configuration_QVBR.TargetAvgBitRate =
|
||||
picture->rc.target_bitrate;
|
||||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Config.m_Configuration_QVBR.PeakBitRate =
|
||||
picture->rc.peak_bitrate;
|
||||
pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Config.m_Configuration_QVBR.ConstantQualityTarget =
|
||||
picture->rc.vbr_quality_factor;
|
||||
} break;
|
||||
case PIPE_H2645_ENC_RATE_CONTROL_METHOD_CONSTANT_SKIP:
|
||||
case PIPE_H2645_ENC_RATE_CONTROL_METHOD_CONSTANT:
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1112,6 +1112,30 @@ d3d12_screen_get_video_param_encode(struct pipe_screen *pscreen,
|
|||
return true;
|
||||
case PIPE_VIDEO_CAP_SUPPORTS_CONTIGUOUS_PLANES_MAP:
|
||||
return true;
|
||||
case PIPE_VIDEO_CAP_ENC_RATE_CONTROL_QVBR:
|
||||
{
|
||||
D3D12_FEATURE_DATA_VIDEO_ENCODER_RATE_CONTROL_MODE capRateControlModeData =
|
||||
{
|
||||
0,
|
||||
d3d12_video_encoder_convert_codec_to_d3d12_enc_codec(profile),
|
||||
D3D12_VIDEO_ENCODER_RATE_CONTROL_MODE_QVBR,
|
||||
false
|
||||
};
|
||||
|
||||
ComPtr<ID3D12VideoDevice3> spD3D12VideoDevice;
|
||||
struct d3d12_screen *pD3D12Screen = (struct d3d12_screen *) pscreen;
|
||||
if (FAILED(pD3D12Screen->dev->QueryInterface(IID_PPV_ARGS(spD3D12VideoDevice.GetAddressOf())))) {
|
||||
// No video encode support in underlying d3d12 device (needs ID3D12VideoDevice3)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (SUCCEEDED(spD3D12VideoDevice->CheckFeatureSupport(D3D12_FEATURE_VIDEO_ENCODER_RATE_CONTROL_MODE, &capRateControlModeData, sizeof(capRateControlModeData)))
|
||||
&& capRateControlModeData.IsSupported)
|
||||
return 1; // Driver returns QVBR support OK
|
||||
|
||||
// No QVBR support
|
||||
return 0;
|
||||
} break;
|
||||
default:
|
||||
debug_printf("[d3d12_screen_get_video_param] unknown video param: %d\n", param);
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue