locked
Using hardware accelerated MFT RRS feed

  • Question

  • I have some inherited code that I would like to optimize.  The current code uses MF to convert MJPEG frames into YUY2 frames.  Using Concurrency Visualizer I can see that the decode activity is performed on the CPU.  I would like to convert the code such that the decode is performed on the GPU.

    If I enumerate all the MFTs using the MFT_ENUM_FLAG_HARDWARE flag, I see that there is a hardware accelerated MFT:

    -- Video decoders ({D6C02D4B-6833-45B4-971A-05A4B04BAB91}) --
    Intel« Hardware M-JPEG Decoder MFT ({00C69F81-0524-48C0-A353-4DD9D54F9A6E})

    If I simply replace my setup code to use the MFT_ENUM_FLAG_HARDWARE, then eventually the setup code fails during the call to

    SetInputType(0, pVideoMediaTypeInput, 0);

    With the error

    // The caller does not appear to support this transform's asynchronous capabilities
    MF_E_TRANSFORM_ASYNC_LOCKED

    Again, the current code is very simple

    // Initialize COM
    //
    // Setup pointers with MF

    // Loop
    //    ProcessMessage
    //    ProcessInput
    //    ProcessOutput
    //    ProcessMessage
    //    Lock
    //    memcpy
    //    Unlock


    So yes, the current implementation is synchronous, and based on the error, It looks like I need to supply asynchronous event handlers.  Is there a good example/sample that shows this?

    Thanks.

    Thursday, July 10, 2014 6:31 PM

All replies

  • Hello.

    You should read this : Unlocking Asynchronous MFTs

    "Until the client unlocks the MFT, all IMFTransform methods should return MF_E_TRANSFORM_ASYNC_LOCKED, with the following exceptions:"...

    It seems you need to unlock the MFT.

    PS: i don't think you will get some optimization, because even if the decoding is hardware, the decoding's result will be return from the GPU to the CPU, and then return to the GPU. Usually a CPU perform better than "GPU/Back to CPU".


    • Edited by Miaou77 Thursday, July 10, 2014 7:41 PM
    Thursday, July 10, 2014 7:40 PM
  • Hello,

    Yes, I did need to unlock the MFT.  Which gets me a little farther along, but not all the way.

    After unlocking, I get an error when calling SetInputType on the MFT.  I need to set the media format and the media dimensions.  The call returns E_FAIL.

    I commented out the call to SetInputType to see how much farther I could go, and implemented the Asynchronous calls off the  IMFMediaEventGenerator, but my Invoke method is never called.  It would appear there is something else that needs to be setup.    And yes, eventually, I'd like to render on the GPU using the decoded image, I already have a D3D surface where my code renders other image data.

    Monday, July 21, 2014 9:54 PM
  • Were you able to solve the problem with SetInputType? I am using this exact same hardware decoder and running to the same problem.
    Wednesday, July 30, 2014 2:24 PM
  • mark
    Thursday, August 14, 2014 8:54 PM