简体   繁体   中英

Video Processor MFT and color conversion

MSDN Video Processor MFT indicates that it can be used for colorspace conversion. So, I am trying to use this MFT to do conversion from NV12 format to I420 format.

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).

        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. Here, I am trying with GPU-accelerated video processing, using Microsoft Direct3D 11.

One other point to note here is, the available output type returned when I queried using below piece of code is not NV12. But it returns "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? 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. In this case, it was fine for NV12 to I420 conversion. Since D3D9 doesn't make use of GPU acceleration, I am trying migration to D3D11.

It's possible that your GPU doesn't handle NV12 to I420 color conversion.

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.

Check your GPU capabilities at first.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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