mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 09:08:10 +02:00
mediafoundation: enable new CODECAPI properties for frame stats
CODECAPI_AVEncVideoEnableFramePsnrYuv CODECAPI_AVEncVideoEnableSpatialAdaptiveQuantization CODECAPI_AVEncVideoOutputQPMapBlockSize CODECAPI_AVEncVideoOutputBitsUsedMapBlockSize Reviewed-By: Sil Vilerino <sivileri@microsoft.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35264>
This commit is contained in:
parent
9f22e3f98c
commit
c4dd9027db
2 changed files with 22 additions and 12 deletions
|
|
@ -246,6 +246,22 @@ StringFromCodecAPI( const GUID *Api )
|
|||
{
|
||||
return "CODECAPI_AVEncSliceGenerationMode";
|
||||
}
|
||||
else if( *Api == CODECAPI_AVEncVideoEnableFramePsnrYuv )
|
||||
{
|
||||
return "CODECAPI_AVEncVideoEnableFramePsnrYuv";
|
||||
}
|
||||
else if( *Api == CODECAPI_AVEncVideoEnableSpatialAdaptiveQuantization )
|
||||
{
|
||||
return "CODECAPI_AVEncVideoEnableSpatialAdaptiveQuantization";
|
||||
}
|
||||
else if( *Api == CODECAPI_AVEncVideoOutputQPMapBlockSize )
|
||||
{
|
||||
return "CODECAPI_AVEncVideoOutputQPMapBlockSize";
|
||||
}
|
||||
else if( *Api == CODECAPI_AVEncVideoOutputBitsUsedMapBlockSize )
|
||||
{
|
||||
return "CODECAPI_AVEncVideoOutputBitsUsedMapBlockSize";
|
||||
}
|
||||
return "Unknown CodecAPI";
|
||||
}
|
||||
|
||||
|
|
@ -296,7 +312,9 @@ CDX12EncHMFT::IsSupported( const GUID *Api )
|
|||
*Api == CODECAPI_AVEncVideoMaxNumRefFrame || *Api == CODECAPI_AVEncVideoMeanAbsoluteDifference ||
|
||||
*Api == CODECAPI_AVEncVideoMaxQP || *Api == CODECAPI_AVEncVideoGradualIntraRefresh || *Api == CODECAPI_AVScenarioInfo ||
|
||||
*Api == CODECAPI_AVEncVideoROIEnabled || *Api == CODECAPI_AVEncVideoLTRBufferControl ||
|
||||
*Api == CODECAPI_AVEncVideoMarkLTRFrame || *Api == CODECAPI_AVEncVideoUseLTRFrame )
|
||||
*Api == CODECAPI_AVEncVideoMarkLTRFrame || *Api == CODECAPI_AVEncVideoUseLTRFrame ||
|
||||
*Api == CODECAPI_AVEncVideoEnableFramePsnrYuv || *Api == CODECAPI_AVEncVideoEnableSpatialAdaptiveQuantization ||
|
||||
*Api == CODECAPI_AVEncVideoOutputQPMapBlockSize || *Api == CODECAPI_AVEncVideoOutputBitsUsedMapBlockSize )
|
||||
{
|
||||
hr = S_OK;
|
||||
return hr;
|
||||
|
|
|
|||
|
|
@ -309,10 +309,6 @@ CDX12EncHMFT::PrepareForEncode( IMFSample *pSample, LPDX12EncodeContext *ppDX12E
|
|||
}
|
||||
}
|
||||
|
||||
//
|
||||
// TODO: Just to test the backend, needs proper plumbing to CodecAPI
|
||||
//
|
||||
#if 0 // TODO: Enable me
|
||||
{
|
||||
//
|
||||
// Create resources for output GPU frame stats
|
||||
|
|
@ -329,9 +325,7 @@ CDX12EncHMFT::PrepareForEncode( IMFSample *pSample, LPDX12EncodeContext *ppDX12E
|
|||
templ.depth0 = 1;
|
||||
templ.array_size = 1;
|
||||
|
||||
// TODO: Only allocate these if CodecAPi requested these stats, since there's a perf impact to request them in DX12 driver
|
||||
|
||||
if (m_EncoderCapabilities.m_HWSupportStatsQPMapOutput.bits.supported)
|
||||
if( m_EncoderCapabilities.m_HWSupportStatsQPMapOutput.bits.supported && m_uiVideoOutputQPMapBlockSize > 0 )
|
||||
{
|
||||
uint32_t block_size = (1 << m_EncoderCapabilities.m_HWSupportStatsQPMapOutput.bits.log2_values_block_size);
|
||||
templ.format = (enum pipe_format) m_EncoderCapabilities.m_HWSupportStatsQPMapOutput.bits.pipe_pixel_format;
|
||||
|
|
@ -355,7 +349,7 @@ CDX12EncHMFT::PrepareForEncode( IMFSample *pSample, LPDX12EncodeContext *ppDX12E
|
|||
done);
|
||||
}
|
||||
|
||||
if (m_EncoderCapabilities.m_HWSupportStatsRCBitAllocationMapOutput.bits.supported)
|
||||
if( m_EncoderCapabilities.m_HWSupportStatsRCBitAllocationMapOutput.bits.supported && m_uiVideoOutputBitsUsedMapBlockSize > 0 )
|
||||
{
|
||||
uint32_t block_size = (1 << m_EncoderCapabilities.m_HWSupportStatsRCBitAllocationMapOutput.bits.log2_values_block_size);
|
||||
templ.format = (enum pipe_format) m_EncoderCapabilities.m_HWSupportStatsRCBitAllocationMapOutput.bits.pipe_pixel_format;
|
||||
|
|
@ -367,7 +361,7 @@ CDX12EncHMFT::PrepareForEncode( IMFSample *pSample, LPDX12EncodeContext *ppDX12E
|
|||
done);
|
||||
}
|
||||
|
||||
if (m_EncoderCapabilities.m_PSNRStatsSupport.bits.supports_y_channel)
|
||||
if( m_EncoderCapabilities.m_PSNRStatsSupport.bits.supports_y_channel && m_bVideoEnableFramePsnrYuv )
|
||||
{
|
||||
struct pipe_resource buffer_templ = {};
|
||||
buffer_templ.width0 = 3 * sizeof(float); // Up to 3 float components Y, U, V
|
||||
|
|
@ -389,8 +383,6 @@ CDX12EncHMFT::PrepareForEncode( IMFSample *pSample, LPDX12EncodeContext *ppDX12E
|
|||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
memset( &pDX12EncodeContext->encoderPicInfo, 0, sizeof( pDX12EncodeContext->encoderPicInfo ) );
|
||||
pDX12EncodeContext->encoderPicInfo.base.profile = m_outputPipeProfile;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue