mediafoundation: periodic clang-format

Reviewed-by: Yubo Xie <yuboxie@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41279>
This commit is contained in:
Pohsiang (John) Hsu 2026-04-29 15:29:56 -07:00 committed by Marge Bot
parent b795a1a20c
commit ff1c171bae
6 changed files with 38 additions and 29 deletions

View file

@ -958,7 +958,7 @@ CDX12EncHMFT::GetValue( const GUID *Api, VARIANT *Value )
hevcDeltaQPSettings.dataType = CODEC_API_QP_MAP_INT8;
hevcDeltaQPSettings.minValue = static_cast<INT16>( m_uiMinQP );
hevcDeltaQPSettings.maxValue = static_cast<INT16>( m_uiMaxQP );
#if defined(INPUTQPSETTINGS_HAS_STEPS)
#if defined( INPUTQPSETTINGS_HAS_STEPS )
hevcDeltaQPSettings.steps = 1;
#else
hevcDeltaQPSettings.step = 1;

View file

@ -82,8 +82,8 @@ dpb_buffer_manager::dpb_buffer_manager( void *logId,
PIPE_VIDEO_ENTRYPOINT_ENCODE,
PIPE_VIDEO_CAP_ENC_READABLE_RECONSTRUCTED_PICTURE ) != 0 )
{
m_template.bind = PIPE_BIND_SHARED | // Indicate we want shared resource capabilities
PIPE_BIND_RENDER_TARGET; // This is also required for opening shared resources in D3D11
m_template.bind = PIPE_BIND_SHARED | // Indicate we want shared resource capabilities
PIPE_BIND_RENDER_TARGET; // This is also required for opening shared resources in D3D11
}
for( auto &entry : m_pool )

View file

@ -581,7 +581,7 @@ CDX12EncHMFT::PrepareForEncode( IMFSample *pSample, LPDX12EncodeContext *ppDX12E
if( m_bSliceGenerationModeSet && pDX12EncodeContext->IsSliceAutoModeEnabled() )
{
num_output_buffers = std::max(128u, m_EncoderCapabilities.m_uiMaxHWSupportedMaxSlices);
num_output_buffers = std::max( 128u, m_EncoderCapabilities.m_uiMaxHWSupportedMaxSlices );
}
// Minimum per-slice buffer size to prevent excessively small allocations.

View file

@ -1150,7 +1150,7 @@ CDX12EncHMFT::GetMaxReferences( unsigned int width, unsigned int height )
if( width != 0 && height != 0 )
{
int maxDPBSize = GetMaxDPBSize( width, height, m_uiLevel );
uiMaxReferences = std::min( (int) m_EncoderCapabilities.m_uiMaxHWSupportedDPBCapacity, maxDPBSize );
uiMaxReferences = std::min( (int) m_EncoderCapabilities.m_uiMaxHWSupportedDPBCapacity, maxDPBSize );
}
return uiMaxReferences;
}

View file

@ -153,7 +153,8 @@ CDX12EncHMFT::UpdateH265EncPictureDesc( pipe_h265_enc_picture_desc *pPicInfo,
pPicInfo->seq.sar_height = m_VUIInfo.stSARInfo.usHeight;
pPicInfo->seq.num_units_in_tick = m_FrameRate.Denominator;
pPicInfo->seq.time_scale = m_FrameRate.Numerator; // Table E.6 seq.vui_flags.frame_field_info_present_flag is 0, deltaToDivisor should be 1.
pPicInfo->seq.time_scale =
m_FrameRate.Numerator; // Table E.6 seq.vui_flags.frame_field_info_present_flag is 0, deltaToDivisor should be 1.
pPicInfo->seq.video_format = m_VUIInfo.stVidSigType.eVideoFormat;
pPicInfo->seq.colour_primaries = m_VUIInfo.stVidSigType.eColorPrimary;
@ -986,7 +987,8 @@ CDX12EncHMFT::GetMaxReferences( unsigned int width, unsigned int height )
UINT32 uiMaxReferences = m_EncoderCapabilities.m_uiMaxHWSupportedDPBCapacity;
if( width != 0 && height != 0 )
{
const int minCbSizeY = 1 << ( m_EncoderCapabilities.m_HWSupportH265BlockSizes.bits.log2_min_luma_coding_block_size_minus3 + 3 );
const int minCbSizeY =
1 << ( m_EncoderCapabilities.m_HWSupportH265BlockSizes.bits.log2_min_luma_coding_block_size_minus3 + 3 );
int maxDPBSize = GetMaxDPBSize( width, height, m_uiLevel, minCbSizeY );
uiMaxReferences = std::min( (int) m_EncoderCapabilities.m_uiMaxHWSupportedDPBCapacity, maxDPBSize );
}

View file

@ -1262,10 +1262,10 @@ CDX12EncHMFT::ProcessSliceBitstreamZeroCopy( LPDX12EncodeContext pDX12EncodeCont
return false;
}
uint64_t total_slice_size =
std::accumulate( mfsample_codec_unit_metadata.begin(), mfsample_codec_unit_metadata.end(), 0ull, []( uint64_t sum, const auto &nal ) {
return sum + nal.size;
} );
uint64_t total_slice_size = std::accumulate( mfsample_codec_unit_metadata.begin(),
mfsample_codec_unit_metadata.end(),
0ull,
[]( uint64_t sum, const auto &nal ) { return sum + nal.size; } );
// Create IMFMediaBuffer from the D3D12Resource (zero-copy)
spMediaBuffer.Attach(
@ -1593,10 +1593,11 @@ CDX12EncHMFT::xThreadProc( void *pCtx )
if( WaitForFence( pDX12EncodeContext->pSliceFences[slice_idx], OS_TIMEOUT_INFINITE ) )
{
if( !pThis->ProcessSliceBitstreamZeroCopy( pDX12EncodeContext,
slice_idx,
spMediaBuffer,
codec_unit_metadata ) ) // codec_unit_metadata.clear() will be called in this function
if( !pThis->ProcessSliceBitstreamZeroCopy(
pDX12EncodeContext,
slice_idx,
spMediaBuffer,
codec_unit_metadata ) ) // codec_unit_metadata.clear() will be called in this function
{
debug_printf( "[dx12 hmft 0x%p] Failed to process slice %u bitstream\n", pThis, slice_idx );
MFE_ERROR( "[dx12 hmft 0x%p] Failed to process slice %u bitstream", pThis, slice_idx );
@ -1633,16 +1634,19 @@ CDX12EncHMFT::xThreadProc( void *pCtx )
pendingMetadata.reserve( 16 );
uint32_t actual_slice_count = 0;
struct HandleCloser {
void operator()( void *h ) {
if(h) CloseHandle(h);
struct HandleCloser
{
void operator()( void *h )
{
if( h )
CloseHandle( h );
}
};
std::unique_ptr<void, HandleCloser> lastSliceFenceEvent(
pThis->m_pPipeContext->screen->fence_get_win32_event(
pThis->m_pPipeContext->screen, pDX12EncodeContext->pLastSliceFence ) );
assert(lastSliceFenceEvent);
pThis->m_pPipeContext->screen->fence_get_win32_event( pThis->m_pPipeContext->screen,
pDX12EncodeContext->pLastSliceFence ) );
assert( lastSliceFenceEvent );
// Pre-create all slice fence events to avoid per-iteration
// CreateEvent+SetEventOnCompletion kernel round-trips
@ -1651,8 +1655,9 @@ CDX12EncHMFT::xThreadProc( void *pCtx )
sliceFenceEvents.reserve( num_slice_buffers );
for( uint32_t i = 0; i < num_slice_buffers; i++ )
{
sliceFenceEvents.emplace_back( pThis->m_pPipeContext->screen->fence_get_win32_event(
pThis->m_pPipeContext->screen, pDX12EncodeContext->pSliceFences[i] ) );
sliceFenceEvents.emplace_back(
pThis->m_pPipeContext->screen->fence_get_win32_event( pThis->m_pPipeContext->screen,
pDX12EncodeContext->pSliceFences[i] ) );
assert( sliceFenceEvents[i] );
}
@ -1695,10 +1700,11 @@ CDX12EncHMFT::xThreadProc( void *pCtx )
pendingSample = std::move( preallocatedSamples[slice_idx] );
pendingBuffer.Reset();
if( !pThis->ProcessSliceBitstreamZeroCopy( pDX12EncodeContext,
slice_idx,
pendingBuffer,
pendingMetadata ) ) // pendingMetadata.clear() will be called in this function
if( !pThis->ProcessSliceBitstreamZeroCopy(
pDX12EncodeContext,
slice_idx,
pendingBuffer,
pendingMetadata ) ) // pendingMetadata.clear() will be called in this function
{
debug_printf( "[dx12 hmft 0x%p] Failed to process slice %u bitstream\n", pThis, slice_idx );
MFE_ERROR( "[dx12 hmft 0x%p] Failed to process slice %u bitstream", pThis, slice_idx );
@ -1723,7 +1729,8 @@ CDX12EncHMFT::xThreadProc( void *pCtx )
{
// Unexpected WaitForMultipleObjects result on waitResult
DWORD lastError = GetLastError();
debug_printf( "[dx12 hmft 0x%p] WaitForMultipleObjects failed for slice %" PRIu32 " (result=0x%" PRIx32 ", GetLastError=0x%" PRIx32 ")\n",
debug_printf( "[dx12 hmft 0x%p] WaitForMultipleObjects failed for slice %" PRIu32 " (result=0x%" PRIx32
", GetLastError=0x%" PRIx32 ")\n",
pThis,
slice_idx,
static_cast<uint32_t>( waitResult ),
@ -2839,7 +2846,7 @@ CDX12EncHMFT::ProcessOutput( DWORD dwFlags, DWORD cOutputBufferCount, MFT_OUTPUT
UINT32 isLastSlice = FALSE;
if( SUCCEEDED( pOutputSamples[0].pSample->GetUINT32( MFSampleExtension_LastSlice, &isLastSlice ) ) )
{
if (!isLastSlice)
if( !isLastSlice )
{
sendNeedInput = false;
}