mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-03 18:00:10 +01:00
mediafoundation: Implement video encode spatial adaptive quantization interface
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com> Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37581>
This commit is contained in:
parent
3ba07819aa
commit
700ccea319
5 changed files with 23 additions and 0 deletions
|
|
@ -449,6 +449,15 @@ CDX12EncHMFT::IsSupported( const GUID *Api )
|
|||
}
|
||||
}
|
||||
|
||||
if( m_EncoderCapabilities.m_HWSupportSpatialAdaptiveQuantization.bits.max_spatial_adaptive_quantization_strength > 0 )
|
||||
{
|
||||
if( *Api == CODECAPI_AVEncVideoEnableSpatialAdaptiveQuantization )
|
||||
{
|
||||
hr = S_OK;
|
||||
return hr;
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
return hr;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -626,6 +626,10 @@ CDX12EncHMFT::PrepareForEncodeHelper( LPDX12EncodeContext pDX12EncodeContext, bo
|
|||
pPicInfo->rate_ctrl[rate_ctrl_active_layer_index].frame_rate_num = m_FrameRate.Numerator;
|
||||
pPicInfo->rate_ctrl[rate_ctrl_active_layer_index].frame_rate_den = m_FrameRate.Denominator;
|
||||
|
||||
// Spatial Quantization
|
||||
pPicInfo->rate_ctrl[rate_ctrl_active_layer_index].spatial_adaptive_quantization_strength =
|
||||
m_bVideoEnableSpatialAdaptiveQuantization ? 1u : 0u;
|
||||
|
||||
debug_printf( "[dx12 hmft 0x%p] MFT frontend submission - POC %d picture_type %s num_slice_descriptors %d\n",
|
||||
this,
|
||||
pPicInfo->pic_order_cnt,
|
||||
|
|
|
|||
|
|
@ -609,6 +609,10 @@ CDX12EncHMFT::PrepareForEncodeHelper( LPDX12EncodeContext pDX12EncodeContext, bo
|
|||
pPicInfo->rc[rate_ctrl_active_layer_index].vbv_buf_initial_size = m_uiBufferInLevel;
|
||||
}
|
||||
|
||||
// Spatial Quantization
|
||||
pPicInfo->rc[rate_ctrl_active_layer_index].spatial_adaptive_quantization_strength =
|
||||
m_bVideoEnableSpatialAdaptiveQuantization ? 1u : 0u;
|
||||
|
||||
// Frame Rate
|
||||
pPicInfo->rc[rate_ctrl_active_layer_index].frame_rate_num = m_FrameRate.Numerator;
|
||||
pPicInfo->rc[rate_ctrl_active_layer_index].frame_rate_den = m_FrameRate.Denominator;
|
||||
|
|
|
|||
|
|
@ -161,4 +161,7 @@ encoder_capabilities::initialize( pipe_screen *pScreen, pipe_video_profile video
|
|||
d3d12_interop_device_info1 screen_interop_info = {};
|
||||
bool successQuery = pScreen->interop_query_device_info(pScreen, sizeof(d3d12_interop_device_info1), &screen_interop_info) != 0;
|
||||
m_bHWSupportsQueuePriorityManagement = successQuery && screen_interop_info.set_context_queue_priority_manager != NULL;
|
||||
|
||||
m_HWSupportSpatialAdaptiveQuantization.value =
|
||||
pScreen->get_video_param( pScreen, videoProfile, PIPE_VIDEO_ENTRYPOINT_ENCODE, PIPE_VIDEO_CAP_ENC_SPATIAL_ADAPTIVE_QUANTIZATION );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -137,4 +137,7 @@ class encoder_capabilities
|
|||
|
||||
// Driver supports queue priority management
|
||||
bool m_bHWSupportsQueuePriorityManagement = false;
|
||||
|
||||
// Spatial Adaptive Quantization
|
||||
union pipe_enc_cap_spatial_adaptive_quantization m_HWSupportSpatialAdaptiveQuantization = {};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue