From 672c26535aa24d6e108cf281c460428571c552a2 Mon Sep 17 00:00:00 2001 From: "Pohsiang (John) Hsu" Date: Thu, 6 Nov 2025 18:15:38 -0800 Subject: [PATCH] mediafoundation: remove unused code Part-of: --- .../mediafoundation/hmft_entrypoints.h | 11 ---- .../frontends/mediafoundation/mftransform.cpp | 59 ------------------- 2 files changed, 70 deletions(-) diff --git a/src/gallium/frontends/mediafoundation/hmft_entrypoints.h b/src/gallium/frontends/mediafoundation/hmft_entrypoints.h index ecb1cf49799..de9cbf5df76 100644 --- a/src/gallium/frontends/mediafoundation/hmft_entrypoints.h +++ b/src/gallium/frontends/mediafoundation/hmft_entrypoints.h @@ -248,11 +248,6 @@ typedef enum IntraRefreshMode HMFT_INTRA_REFRESH_MODE_MAX } IntraRefreshMode; -// IMFVideoSampleAllocatorEx only works with MFVideoFormat. -#ifndef MFVideoFormat_L32 -DEFINE_MEDIATYPE_GUID( MFVideoFormat_L32, D3DFMT_INDEX32 ); -#endif - #ifndef CODECAPI_AVEncVideoEnableSpatialAdaptiveQuantization // AVEncVideoEnableSpatialAdaptiveQuantization (BOOL) // Indicates whether to enable or disable spatial adaptive quantization for video encoding. @@ -596,12 +591,6 @@ class __declspec( uuid( HMFT_GUID ) ) CDX12EncHMFT : CMFD3DManager, HRESULT OnFlush(); HRESULT ConfigureSampleAllocator(); - HRESULT ConfigureMapSampleAllocator( - IMFVideoSampleAllocatorEx *spAllocator, UINT32 width, UINT32 height, GUID subtype, UINT32 poolSize ); - void ConfigureMapSampleAllocatorHelper( ComPtr &allocator, - const union pipe_enc_cap_gpu_stats_map &outputStatsMap, - uint32_t blockSize, - BOOL &useAllocatorFlag ); HRESULT ConfigureBitstreamOutputSampleAttributes( IMFSample *pSample, const LPDX12EncodeContext pDX12EncodeContext, DWORD dwReceivedInput, diff --git a/src/gallium/frontends/mediafoundation/mftransform.cpp b/src/gallium/frontends/mediafoundation/mftransform.cpp index ea491bdc7f5..0a3684d1abc 100644 --- a/src/gallium/frontends/mediafoundation/mftransform.cpp +++ b/src/gallium/frontends/mediafoundation/mftransform.cpp @@ -1064,65 +1064,6 @@ done: return hr; } -// Utility function to configure the sample allocator to allocate map samples -HRESULT -CDX12EncHMFT::ConfigureMapSampleAllocator( - IMFVideoSampleAllocatorEx *spAllocator, UINT32 width, UINT32 height, GUID subtype, UINT32 poolSize ) -{ - if( !spAllocator ) - return E_POINTER; - - spAllocator->UninitializeSampleAllocator(); - HRESULT hr = spAllocator->SetDirectXManager( m_spDeviceManager.Get() ); - if( FAILED( hr ) ) - return hr; - - ComPtr spAttrs; - ComPtr spMapType; - - // Attributes for allocator - CHECKHR_GOTO( MFCreateAttributes( &spAttrs, 2 ), done ); - CHECKHR_GOTO( spAttrs->SetUINT32( MF_SA_BUFFERS_PER_SAMPLE, 1 ), done ); - CHECKHR_GOTO( spAttrs->SetUINT32( MF_MT_D3D_RESOURCE_VERSION, MF_D3D12_RESOURCE ), done ); - - // Media type for the map - CHECKHR_GOTO( MFCreateMediaType( &spMapType ), done ); - CHECKHR_GOTO( spMapType->SetGUID( MF_MT_MAJOR_TYPE, MFMediaType_Video ), done ); - CHECKHR_GOTO( spMapType->SetGUID( MF_MT_SUBTYPE, subtype ), done ); - MFSetAttributeSize( spMapType.Get(), MF_MT_FRAME_SIZE, width, height ); - CHECKHR_GOTO( spMapType->SetUINT32( MF_MT_D3D_RESOURCE_VERSION, MF_D3D12_RESOURCE ), done ); - - // Initialize the allocator - CHECKHR_GOTO( spAllocator->InitializeSampleAllocatorEx( 1, poolSize, spAttrs.Get(), spMapType.Get() ), done ); - -done: - return hr; -} - -// Helper function to configure map sample allocator. -void -CDX12EncHMFT::ConfigureMapSampleAllocatorHelper( ComPtr &allocator, - const union pipe_enc_cap_gpu_stats_map &outputStatsMap, - uint32_t blockSize, - BOOL &useAllocatorFlag ) -{ - if( allocator != nullptr && outputStatsMap.bits.supported && blockSize > 0 ) - { - uint32_t actualBlockSize = ( 1u << outputStatsMap.bits.log2_values_block_size ); - uint32_t width = static_cast( std::ceil( m_uiOutputWidth / static_cast( actualBlockSize ) ) ); - uint32_t height = static_cast( std::ceil( m_uiOutputHeight / static_cast( actualBlockSize ) ) ); - - if( SUCCEEDED( ConfigureMapSampleAllocator( allocator.Get(), width, height, MFVideoFormat_L32, 10 ) ) ) - { - useAllocatorFlag = TRUE; - } - else - { - useAllocatorFlag = FALSE; - } - } -} - HRESULT CDX12EncHMFT::ConfigureBitstreamOutputSampleAttributes( IMFSample *pSample, const LPDX12EncodeContext pDX12EncodeContext,