From 2eb3b397bfcaada8023a49e5125b9a6babaa2ba1 Mon Sep 17 00:00:00 2001 From: "Pohsiang (John) Hsu" Date: Fri, 9 Jan 2026 14:33:08 -0800 Subject: [PATCH] mediafoundation: rename VideoEncodeReconstructedPicture to VideoEncodeD3D12ReconstructedPicture Reviewed-by: Yubo Xie Part-of: --- .../frontends/mediafoundation/codecapi.cpp | 10 ++--- .../frontends/mediafoundation/encode.cpp | 2 +- .../mediafoundation/hmft_entrypoints.h | 42 ++++++++++++++----- .../frontends/mediafoundation/mftransform.cpp | 2 +- 4 files changed, 38 insertions(+), 18 deletions(-) diff --git a/src/gallium/frontends/mediafoundation/codecapi.cpp b/src/gallium/frontends/mediafoundation/codecapi.cpp index 3746d98955a..816ec5ad7c6 100644 --- a/src/gallium/frontends/mediafoundation/codecapi.cpp +++ b/src/gallium/frontends/mediafoundation/codecapi.cpp @@ -266,9 +266,9 @@ StringFromCodecAPI( const GUID *Api ) { return "CODECAPI_AVEncVideoSatdMapBlockSize"; } - else if( *Api == CODECAPI_AVEncVideoReconstructedPictureOutputMode ) + else if( *Api == CODECAPI_AVEncVideoD3D12ReconstructedPictureOutputMode ) { - return "CODECAPI_AVEncVideoReconstructedPictureOutputMode"; + return "CODECAPI_AVEncVideoD3D12ReconstructedPictureOutputMode"; } else if( *Api == CODECAPI_AVEncVideoRateControlFramePreAnalysis ) { @@ -450,7 +450,7 @@ CDX12EncHMFT::IsSupported( const GUID *Api ) if( m_EncoderCapabilities.m_bHWSupportReadableReconstructedPicture ) { - if( *Api == CODECAPI_AVEncVideoReconstructedPictureOutputMode ) + if( *Api == CODECAPI_AVEncVideoD3D12ReconstructedPictureOutputMode ) { hr = S_OK; return hr; @@ -919,7 +919,7 @@ CDX12EncHMFT::GetValue( const GUID *Api, VARIANT *Value ) Value->vt = VT_UI4; Value->ulVal = m_bVideoEnableFramePsnrYuv; } - else if( *Api == CODECAPI_AVEncVideoReconstructedPictureOutputMode ) + else if( *Api == CODECAPI_AVEncVideoD3D12ReconstructedPictureOutputMode ) { Value->vt = VT_UI4; Value->ulVal = (UINT32) m_VideoReconstructedPictureMode; @@ -1688,7 +1688,7 @@ CDX12EncHMFT::SetValue( const GUID *Api, VARIANT *Value ) } m_bVideoEnableFramePsnrYuv = Value->ulVal ? TRUE : FALSE; } - else if( *Api == CODECAPI_AVEncVideoReconstructedPictureOutputMode ) + else if( *Api == CODECAPI_AVEncVideoD3D12ReconstructedPictureOutputMode ) { debug_printf( "[dx12 hmft 0x%p] SET CODECAPI_AVEncVideoReconstructedPictureOutputMode - %u\n", this, Value->ulVal ); if( Value->vt != VT_UI4 ) diff --git a/src/gallium/frontends/mediafoundation/encode.cpp b/src/gallium/frontends/mediafoundation/encode.cpp index 3faaa7fe172..420d70abac1 100644 --- a/src/gallium/frontends/mediafoundation/encode.cpp +++ b/src/gallium/frontends/mediafoundation/encode.cpp @@ -548,7 +548,7 @@ CDX12EncHMFT::PrepareForEncode( IMFSample *pSample, LPDX12EncodeContext *ppDX12E { CHECKHR_GOTO( stats_buffer_manager::Create( this, m_spDevice.Get(), - MFSampleExtension_VideoEncodeReconstructedPicture, + MFSampleExtension_VideoEncodeD3D12ReconstructedPicture, pDX12EncodeContext->pPipeVideoBuffer->width, static_cast( pDX12EncodeContext->pPipeVideoBuffer->height ), pDX12EncodeContext->pPipeVideoBuffer->buffer_format, diff --git a/src/gallium/frontends/mediafoundation/hmft_entrypoints.h b/src/gallium/frontends/mediafoundation/hmft_entrypoints.h index ceae49d6583..5c5100ef9c2 100644 --- a/src/gallium/frontends/mediafoundation/hmft_entrypoints.h +++ b/src/gallium/frontends/mediafoundation/hmft_entrypoints.h @@ -350,17 +350,37 @@ DEFINE_GUID( MFSampleExtension_VideoEncodeSatdMap, 0xadf61d96, 0xc2d3, 0x4b57, 0 #endif -// MFSampleExtension_VideoEncodeReconstructedPicture {3E8A1B7F-5C92-4D6E-B834-F0A729E65C48} -// Type: IMFMediaBuffer -// The reconstructed picture data of an encoded video frame (Experimental). -DEFINE_GUID( - MFSampleExtension_VideoEncodeReconstructedPicture, 0x3e8a1b7f, 0x5c92, 0x4d6e, 0xb8, 0x34, 0xf0, 0xa7, 0x29, 0xe6, 0x5c, 0x48 ); +#ifndef CODECAPI_AVEncVideoD3D12ReconstructedPictureOutputMode -#ifndef CODECAPI_AVEncVideoReconstructedPictureOutputMode -// AVEncVideoReconstructedPictureOutputMode (VT_UI4) (Experimental, Testing only) -// Specifies the reconstructed picture output mode for video encoding. -// 0: disable; 1: blit copy; 2: read-only shared resource -DEFINE_CODECAPI_GUID( AVEncVideoReconstructedPictureOutputMode, +// MFSampleExtension_VideoEncodeD3D12ReconstructedPicture {3E8A1B7F-5C92-4D6E-B834-F0A729E65C48} +// Type: IMFMediaBuffer +// The reconstructed picture data of an encoded video frame from a D3D12-based MFT (Experimental). +DEFINE_GUID( MFSampleExtension_VideoEncodeD3D12ReconstructedPicture, + 0x3e8a1b7f, + 0x5c92, + 0x4d6e, + 0xb8, + 0x34, + 0xf0, + 0xa7, + 0x29, + 0xe6, + 0x5c, + 0x48 ); + +enum eAVEncVideoD3D12ReconstructedPictureOutputMode +{ + eAVEncVideoEncodeD3D12ReconstructedPictureMode_None = 0, // Does not return a D3D12 reconstructed buffer. + eAVEncVideoEncodeD3D12ReconstructedPictureMode_Copy = + 1, // Returns a copy of the D3D12 reconstructed buffer used by the encoder. + eAVEncVideoEncodeD3D12ReconstructedPictureMode_Shared = + 2 // Returns the D3D12 reconstructed buffer written by the encoder without a copy. +}; + +// AVEncVideoD3D12ReconstructedPictureOutputMode (VT_UI4) (Experimental, Testing only) +// This property controls the output of D3D12 reconstructed picture data from a D3D12-based encoder. +// ulVal must be a value from the eAVEncVideoD3D12ReconstructedPictureOutputMode enumeration. +DEFINE_CODECAPI_GUID( AVEncVideoD3D12ReconstructedPictureOutputMode, "4A7B2E8F-1D93-4C6A-B548-91E2F8C5A7D3", 0x4a7b2e8f, 0x1d93, @@ -373,7 +393,7 @@ DEFINE_CODECAPI_GUID( AVEncVideoReconstructedPictureOutputMode, 0xc5, 0xa7, 0xd3 ) -#define CODECAPI_AVEncVideoReconstructedPictureOutputMode DEFINE_CODECAPI_GUIDNAMED( AVEncVideoReconstructedPictureOutputMode ) +#define CODECAPI_AVEncVideoD3D12ReconstructedPictureOutputMode DEFINE_CODECAPI_GUIDNAMED( AVEncVideoD3D12ReconstructedPictureOutputMode ) #endif diff --git a/src/gallium/frontends/mediafoundation/mftransform.cpp b/src/gallium/frontends/mediafoundation/mftransform.cpp index c1a10a92c87..7dee27fb05d 100644 --- a/src/gallium/frontends/mediafoundation/mftransform.cpp +++ b/src/gallium/frontends/mediafoundation/mftransform.cpp @@ -1225,7 +1225,7 @@ CDX12EncHMFT::ConfigureAsyncStatsMetadataOutputSampleAttributes( IMFSample *pSam pPipeResourceReconstructedPicture, PipeResourceReconstructedPictureSubresource, pSyncObjectQueue, - MFSampleExtension_VideoEncodeReconstructedPicture, + MFSampleExtension_VideoEncodeD3D12ReconstructedPicture, pSample ), done ); }