locked
Problem with WARP mode when using NV12 format in MFT

    Question

  • Hello,

       I am using an MFT in conjunction with MediaComposition on Windows Phone 8.1, and MediaTrannscoder for Windows 8.1. The MFT operates in the NV12 color space. The new laptops and tablets supposedly work in the NV12 color space, whereas the olders ones don't. To keep the code changes absolutely minimal, I tried the WARP mode. but there is a problem with the image. 

    The top 1/4th of the image i.e. from (0, 0) to (width/2, height/2) is as expected. but the rest of the image i.e. 3/4th of the image is green indicating Y = 0. U = 0, V = 0.

    Can you please give me some lead on this problem?
    Tuesday, August 26, 2014 4:48 AM

Answers

  • Hello,

    NV12 is the default format for WDDM 1.2 devices. All devices capable of WDDM 1.2 will support NV12. If the device does not support WDDM 1.2 you should specify the D3D11_CREATE_DEVICE_VIDEO_SUPPORT flag to lock to feature level to 9_x. Using the WARP driver within a shipping product is not recommended due to performance problems.

    The issue that you are describing (i.e. video frame green on the bottom) is likely due to a problem decoding the frame. Mixing WARP and DXVA is not a supported scenario and may cause undefined behavior such as you are describing. This is due to the fact that DXVA assumes that the D3D device is implemented in hardware and WARP is a strictly software renderer.

    I hope this helps,

    James


    Windows SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

    Thursday, August 28, 2014 9:28 PM
    Moderator

All replies

  • I'll ask our Media guru to check this out.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Thursday, August 28, 2014 7:33 PM
    Moderator
  • Hello,

    NV12 is the default format for WDDM 1.2 devices. All devices capable of WDDM 1.2 will support NV12. If the device does not support WDDM 1.2 you should specify the D3D11_CREATE_DEVICE_VIDEO_SUPPORT flag to lock to feature level to 9_x. Using the WARP driver within a shipping product is not recommended due to performance problems.

    The issue that you are describing (i.e. video frame green on the bottom) is likely due to a problem decoding the frame. Mixing WARP and DXVA is not a supported scenario and may cause undefined behavior such as you are describing. This is due to the fact that DXVA assumes that the D3D device is implemented in hardware and WARP is a strictly software renderer.

    I hope this helps,

    James


    Windows SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

    Thursday, August 28, 2014 9:28 PM
    Moderator
  • Hello James,

       Thanks a lot for the answer. I checked and found that the hardware does support NV12. The reason I thought NV12 is not supported was that call to UpdateSubresource for updating the texture was giving me an Access Violation exception despite the same code working on Windows Phone 8.1. However on further investigation I found that when I copy the buffer to a staging texture by using Map, and then do a CopyResource on my input texture, everything works fine. Any idea why this is happening? If it is working with Map and CopyResource, it should work directly with UpdateSubresource; it is funny that this is not happening...

    Regards

    Haresh

    Saturday, August 30, 2014 5:39 AM
  • Hello Matt,

       Thank you for the help!

    Regards

    Haresh

    Saturday, August 30, 2014 5:40 AM