简体   繁体   English

视频处理器MFT和颜色转换

[英]Video Processor MFT and color conversion

MSDN Video Processor MFT indicates that it can be used for colorspace conversion. MSDN 视频处理器MFT表示它可用于色彩空间转换。 So, I am trying to use this MFT to do conversion from NV12 format to I420 format. 因此,我正在尝试使用此MFT进行从NV12格式到I420格式的转换。

I am getting "MF_E_UNSUPPORTED_D3D_TYPE" error when I tried to set the output Media type to I420 (rest all other attributes are same as Input). 尝试将输出媒体类型设置为I420时收到“ MF_E_UNSUPPORTED_D3D_TYPE”错误(其余所有其他属性与“输入”相同)。

        CComPtr<IMFMediaType> outputVideoType;
        hr = createVideoTypeFromSource(inputMediaType, MFVideoFormat_I420, TRUE, TRUE, &outputVideoType);
        ERROR_CHECK(hr);

        hr = vpTransform->SetOutputType(0, outputVideoType, 0); // this gives error

But if I set output format as NV12, it doesn't return any error. 但是,如果我将输出格式设置为NV12,则不会返回任何错误。 Here, I am trying with GPU-accelerated video processing, using Microsoft Direct3D 11. 在这里,我正在尝试使用Microsoft Direct3D 11进行GPU加速的视频处理。

One other point to note here is, the available output type returned when I queried using below piece of code is not NV12. 这里要注意的另一点是,当我使用下面的代码查询时返回的可用输出类型不是NV12。 But it returns "MFVideoFormat_RGB32" 但它返回“ MFVideoFormat_RGB32”

        IMFMediaType* pMediaTypeOutput = NULL;
        hr = MFCreateMediaType(&pMediaTypeOutput);
        if (FAILED(hr)) return hr;

        hr = vpTransform->GetOutputAvailableType(0, 0, &pMediaTypeOutput);

        GUID majorType;
        hr = pMediaTypeOutput->GetMajorType(&majorType);

        if (IsEqualGUID(majorType, MFMediaType_Video))
        {
            GUID subtype;
            hr = pMediaTypeOutput->GetGUID(MF_MT_SUBTYPE, &subtype);
            if (subtype == MFVideoFormat_IYUV)
            {
                printf("Format: IYUV\n");
            }
            else if (subtype == MFVideoFormat_NV12)
            {
                printf("Format: NV12\n");
            }
            else if (subtype == MFVideoFormat_I420)
            {
                printf("Format: I420\n");
            }
        }

Any ideas why D3D11 based VP MFT doesn't support NV12 to I420 color conversion? 有什么想法为什么基于D3D11的VP MFT不支持从NV12到I420的颜色转换? or Is there any thing else to be configured before I request this functionality? 或在我请求此功能之前还有什么要配置的吗?

Background: 背景:

Initially I tried using VP MFT with D3D9, where it doesn't enable GPU acceleration. 最初,我尝试将VP MFT与D3D9结合使用,因为它无法启用GPU加速。 In this case, it was fine for NV12 to I420 conversion. 在这种情况下,可以将NV12转换为I420。 Since D3D9 doesn't make use of GPU acceleration, I am trying migration to D3D11. 由于D3D9没有利用GPU加速,因此我尝试迁移到D3D11。

It's possible that your GPU doesn't handle NV12 to I420 color conversion. 您的GPU可能无法处理从NV12到I420的颜色转换。

In software mode it is usually possible (for not say always possible), but in hardware mode (GPU), it is possible that your GPU can't do it. 在软件模式下,通常是可能的(并非总是如此),但是在硬件模式(GPU)下,GPU可能无法做到这一点。

Check your GPU capabilities at first. 首先检查您的GPU功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM