diff --git a/src/gallium/frontends/mediafoundation/codecapi.cpp b/src/gallium/frontends/mediafoundation/codecapi.cpp index cc8b861db48..14b233d5cad 100644 --- a/src/gallium/frontends/mediafoundation/codecapi.cpp +++ b/src/gallium/frontends/mediafoundation/codecapi.cpp @@ -304,6 +304,10 @@ StringFromVariant( VARIANT *Value ) { return std::to_string( Value->boolVal ); } + else if ( (Value->vt & (VT_ARRAY | VT_UI1)) == (VT_ARRAY | VT_UI1) && Value->parray ) + { + return "Array Blob mapping"; + } return "Unsupported Variant"; } @@ -398,7 +402,7 @@ CDX12EncHMFT::IsSupported( const GUID *Api ) { hr = S_OK; return hr; - } + } } if( m_EncoderCapabilities.m_TwoPassSupport.bits.supports_1pass_recon_writing_skip ) @@ -410,6 +414,15 @@ CDX12EncHMFT::IsSupported( const GUID *Api ) } } + if (m_EncoderCapabilities.m_HWSupportsVideoEncodeROI.bits.roi_rc_qp_delta_support ) + { + if (*Api == CODECAPI_AVEncVideoInputDeltaQPBlockSettings ) + { + hr = S_OK; + return hr; + } + } + done: return hr; } @@ -877,6 +890,38 @@ CDX12EncHMFT::GetValue( const GUID *Api, VARIANT *Value ) Value->vt = VT_BOOL; Value->boolVal = m_bRateControlFramePreAnalysisExternalReconDownscale ? VARIANT_TRUE : VARIANT_FALSE; } + else if ( *Api == CODECAPI_AVEncVideoInputDeltaQPBlockSettings ) + { + InputQPSettings hevcDeltaQPSettings; + hevcDeltaQPSettings.minBlockSize = 1 << m_EncoderCapabilities.m_HWSupportsVideoEncodeROI.bits.log2_roi_min_block_pixel_size; + hevcDeltaQPSettings.maxBlockSize = hevcDeltaQPSettings.minBlockSize; + hevcDeltaQPSettings.stepsBlockSize = 1; + hevcDeltaQPSettings.dataType = CODEC_API_QP_MAP_INT8; + hevcDeltaQPSettings.minValue = static_cast(m_uiMinQP); + hevcDeltaQPSettings.maxValue = static_cast(m_uiMaxQP); + hevcDeltaQPSettings.step = 1; + + SAFEARRAYBOUND bound = {static_cast(sizeof(hevcDeltaQPSettings)), static_cast(0)}; // cElements , lower bound + SAFEARRAY* psa = SafeArrayCreate(VT_UI1, 1, &bound); // dims == 1 + if (!psa) { + hr = E_OUTOFMEMORY; + CHECKHR_GOTO( hr, done ); + } + void* pData = nullptr; + hr = SafeArrayAccessData(psa, &pData); + if (SUCCEEDED(hr) && pData) + { + memcpy(pData, &hevcDeltaQPSettings, sizeof(hevcDeltaQPSettings)); + SafeArrayUnaccessData(psa); + } + else + { + SafeArrayDestroy(psa); + CHECKHR_GOTO( hr, done ); + } + Value->vt = VT_ARRAY | VT_UI1; + Value->parray = psa; + } else { hr = E_NOTIMPL; diff --git a/src/gallium/frontends/mediafoundation/hmft_entrypoints.h b/src/gallium/frontends/mediafoundation/hmft_entrypoints.h index 40fa35d6585..cec6b941b0f 100644 --- a/src/gallium/frontends/mediafoundation/hmft_entrypoints.h +++ b/src/gallium/frontends/mediafoundation/hmft_entrypoints.h @@ -407,7 +407,7 @@ typedef struct _inputQPSettings { eAVEncVideoQPMapElementDataType dataType; INT16 minValue; INT16 maxValue; - UINT16 steps; + UINT16 step; } InputQPSettings; // MFSampleExtension_VideoEncodeInputDeltaQPMap {DAB419C3-BF21-4B46-8692-9A7BF0A71769}