CODECAPI_AVEncVideoOutputQPMapBlockSize 属性

指定用于从编码器生成输出元数据量化参数 (QP) 映射的块大小。

数据类型

ULONG (VT_UI4)

属性 GUID

CODECAPI_AVEncVideoOutputQPMapBlockSize

属性值

块大小。 该值必须是 2 的幂,例如 16 或 32。 将块大小设置为 0 会禁用 QP 映射块大小报告。 默认情况下禁用 QP 映射块大小报告。

注解

用于从编码器生成输出元数据 QP 映射的块大小。 使用块大小,应用程序可以通过视频帧宽度和高度除以块大小来派生输出元数据 QP 映射的列和行。 例如,如果块大小为 16,并且视频帧的大小为 1920x1080,则 QP 地图有 120 列和 68 行。 如果视频帧宽度/高度不是块大小的确切倍数,将宽度/高度向上舍入到块大小的下一个倍数。 例如,如果帧大小为 1916x1076,块大小为 16,则向上舍入的帧大小为 1920x1088。

使用 ICodecAPI::IsSupported 检查编码器是否支持此属性。 使用 ICodecAPI::GetValue 查询此属性的值。 使用 ICodecAPI::SetValue 配置此属性。 非幂 2 或 0 的值会导致 SetValue返回E_INVALIDARG值。

例子

以下示例演示如何使用 CODECAPI_AVEncVideoOutputQPMapBlockSize 属性配置编码器 MFT 以启用或禁用 QP 地图报告功能。 如果块大小值为零,则会禁用它。 如果块大小值不为零,则启用它。

#include <codecapi.h> 
#include <mfapi.h>
#include <wil.com.h>
#include <wil/result_macros.h>

//  Inform an encoder MFT to enable or disable the QP map reporting feature. 
//  This function assumes that the encoder MFT supports ICodecAPI interface. 
//  It checks whether the new property CODECAPI_AVEncVideoOutputQPMapBlockSize is supported. 
//  If not supported, it returns E_NOTIMPL. 
//  If CODECAPI_AVEncVideoOutputQPMapBlockSize is supported and block size is none zero, it is enabled. 
//  Otherwise, it is disabled. 

HRESULT ConfigureEncoderForQPMap(_In_ IMFTransform* encoder, uint32_t blockSize) 
{ 

    wil::com_ptr_nothrow<ICodecAPI> codecAPI; 
    RETURN_IF_FAILED(wil::com_query_to_nothrow(encoder, &codecAPI)); 

    // Check if the encoder supports the property for QP map 
    if (!codecAPI->IsSupported(&CODECAPI_AVEncVideoOutputQPMapBlockSize)) 
    { 
        return E_NOTIMPL; 
    } 

    // configure encoder 
    wil::unique_variant value; 
    value.vt = VT_UI4; 
    value.ulVal = blockSize; // zero: disable; non-zero: enable 

    return codecAPI->SetValue(&CODECAPI_AVEncVideoOutputQPMapBlockSize, &value); 
} 

要求

要求 价值
支持的最低客户端 Windows 11 内部版本 26100
支持的最低服务器 Windows Server 2025
标题 Codecapi.h

另请参阅