none
fps too slow when using direct draw (WEC7 on i.MX53) RRS feed

  • Question

  • I'm using a freescale i.MX53 with all the freescale codec installed under WEC7.
     I need to use an USB camera to viualize a video and to record a video.
     I use the USB WebCam driver from codepkex (  http://cewebcam.codeplex.com/ ) compiled under WEC7.
     When I try to visualize the video stream using DirectDraw all it's fine, but when I try to stast to record a video, The fps is around 3/5 Fps and the CPU usage rise up at 100%.
     I notice that the IOCTL that take the buffer from the USB driver is called every 300 milliseconds.
     If I try to call directly the IOCTL, I can read the buffer immediately, so it seems that the problem is between direct draw and the codec.

    Any help is appeciated!


    Beppe Platania Windows Embedded MVP http://blog.bepseng.it

    Monday, January 27, 2014 2:31 PM

All replies

  • Hi Beppe,

    Are you using the VPU codecs for recording the video or just using the Microsoft wmv software encoder?


    Please mark it as answer or vote as helpful if my reply helps.

    Regards,

    Prabu[eMVP]

    http://prabukumar.wordpress.com

    Tuesday, January 28, 2014 6:14 AM
  • Hi Prabu,<o:p></o:p>

    I used both, but with more or less the same results.<o:p></o:p>

    I'm afraid the VPU codecs do not use the graphics HW accelerator because the CPU consuming is high.<o:p></o:p>



    Beppe Platania Windows Embedded MVP http://blog.bepseng.it

    Tuesday, January 28, 2014 12:27 PM
  • Hi Beppe,

    If i understand correctly,usually freescale provides the VPU encoder as a DirectShow Filters.But cewebcam driver is a Stream interface driver,so your application also might be IOCTL based.

    How did you make sure to use the VPU encoder for recording? Are you integrating the VPU APIs in your camera application?


    Please mark it as answer or vote as helpful if my reply helps.

    Regards,

    Prabu[eMVP]

    http://prabukumar.wordpress.com

    Tuesday, January 28, 2014 12:58 PM
  • Hi Prabu,

    i wrote a program that use directshow.

    I use as encoder the mx53_vpu_enc_dshow.dll that is configured in the registry as follow:

    [HKEY_CLASSES_ROOT\CLSID\{27CC5ADB-44F3-4ab8-84BA-32E695CA7D41}]
        @="FSL VPU Encoder DMO"

    [HKEY_CLASSES_ROOT\CLSID\{27CC5ADB-44F3-4ab8-84BA-32E695CA7D41}\InprocServer32]
    @="mx53_vpu_enc_dshow.dll"
    "ThreadingModel"="Both"

    Then I use the filter in this way (these are some snippets) :

    GUID encoder = {  0x27CC5ADB, 0x44F3, 0x4ab8, 0x84, 0xBA, 0x32, 0xE6, 0x95, 0xCA, 0x7D, 0x41};

    pVideoEncoder.CoCreateInstance( encoder, NULL, CLSCTX_INPROC);

    ...

    pFilterGraph->AddFilter(pVideoEncoder, TEXT("Video Encoder Filter"));

    ...

    pCaptureGraphBuilder->SetFiltergraph( pFilterGraph );

    ...

    pCaptureGraphBuilder->RenderStream( 
                &PIN_CATEGORY_CAPTURE,
                &MEDIATYPE_Video,
                pVideoCapture,
                pIntermediate,
                pSink
                );

    I hope this can help you to understand how the encoder is used.

    In my tests I add a RETAILMSG in the IOCTL_CS_BUFFERS and I see that is called more less every 300 milliseconds.



    Beppe Platania Windows Embedded MVP http://blog.bepseng.it

    Monday, February 17, 2014 11:56 AM
  • Hello everybody,

    we have been struggling for a while with the WEC7 Freescale MDK for i.MX53 with no relevant result. The demo applications included in the MDK are not working on our platform and unfortunately there's no source code include in the MDK, so we are getting a bit confused.

    Our primary target is to capture compressed video and store it to a file, but so far any tentative to use the VPU encoder within a DirectShow graph led to no result - we are always getting E_NOINTERFACE when trying to query the interface for either the DMO wrapper filter or the encoder (we are currently working with a port of the CameraApp from CE 6.0 R3)

    Sure our knowledge of DirectShow is still too basic and probably we are missing some important point in the procedure of building a graph. Can anyone please help us in bringing to life the VPU-accelerated encoder (mx53_vpu_enc_dshow.dll)contained in the MDK?

    Thank you in advance and best regards,

    Stefano Voulaz

    Friday, June 6, 2014 1:22 PM
  • Hi Stefano,

    To use the Dshow encoder filter on your application,it should be first registered in the OS using the registry.I had taken the below registry from the freescale default BSP. Verify in your platform whether this kind of registry is included.

    ;------------------------------------------------------------------------------
    ; MX53 VPU Encoder Filter 
    ;------------------------------------------------------------------------------
    IF FSL_MMF_VPU_ENC
    	;Register "FSL VPU Encoder DMO", can be done by "regsvr32.exe mx53_vpu_enc_dshow.dll"
    	[HKEY_CLASSES_ROOT\CLSID\{27CC5ADB-44F3-4ab8-84BA-32E695CA7D41}]
        @="FSL VPU Encoder DMO"
    		                  
    	[HKEY_CLASSES_ROOT\CLSID\{27CC5ADB-44F3-4ab8-84BA-32E695CA7D41}\InprocServer32]
    	@="mx53_vpu_enc_dshow.dll"
    	"ThreadingModel"="Both"
    		
    	[HKEY_CLASSES_ROOT\DirectShow\MediaObjects\27CC5ADB-44F3-4ab8-84BA-32E695CA7D41]
    	@="FSL VPU Encoder DMO"
    	;"InputTypes"=hex \
        	    ;61,75,64,73,00,00,10,00,80,00,00,aa,00,38,9b,71,01,00,00,00,00,00,10,00,80,\
                ;00,00,aa,00,38,9b,71
        ;"OutputTypes"=hex\
                ;61,75,64,73,00,00,10,00,80,00,00,aa,00,38,9b,71,55,00,00,00,00,00,10,00,80,\
                ;00,00,aa,00,38,9b,71
    		
    	[HKEY_CLASSES_ROOT\DirectShow\MediaObjects\Categories\33D9A760-90C8-11d0-BD43-00A0C911CE86\27CC5ADB-44F3-4ab8-84BA-32E695CA7D41]
    	
    	;Add a wrapper filter for our VPU encoder DMO
    	[HKEY_CLASSES_ROOT\CLSID\{75FB277F-41FC-4773-9611-F2AC8EB507BA}]
    	@="FSL VPU Encoder DMO wrapper filter"
    	"Merit"=dword:00200000
    	"DMOCategory"="33D9A760-90C8-11d0-BD43-00A0C911CE86"
    	"DMOGuid"="27CC5ADB-44F3-4ab8-84BA-32E695CA7D41"
    		
    	[HKEY_CLASSES_ROOT\CLSID\{75FB277F-41FC-4773-9611-F2AC8EB507BA}\InprocServer32]
    	@="msdmo.dll"
    	"ThreadingModel"="Both"
    		
    	[HKEY_CLASSES_ROOT\CLSID\{75FB277F-41FC-4773-9611-F2AC8EB507BA}\Pins]
        [HKEY_CLASSES_ROOT\CLSID\{75FB277F-41FC-4773-9611-F2AC8EB507BA}\Pins\Input]
        "ConnectsToPin"="Output"
        [HKEY_CLASSES_ROOT\CLSID\{75FB277F-41FC-4773-9611-F2AC8EB507BA}\Pins\Input\Types]  
        [HKEY_CLASSES_ROOT\CLSID\{75FB277F-41FC-4773-9611-F2AC8EB507BA}\Pins\Input\Types\{73646976-0000-0010-8000-00AA00389B71}]      
        [HKEY_CLASSES_ROOT\CLSID\{75FB277F-41FC-4773-9611-F2AC8EB507BA}\Pins\Input\Types\{73646976-0000-0010-8000-00AA00389B71}\{32315659-0000-0010-8000-00AA00389B71}]    
        
        [HKEY_CLASSES_ROOT\CLSID\{75FB277F-41FC-4773-9611-F2AC8EB507BA}\Pins\Output]
        "Direction"=dword:00000001
        "ConnectsToPin"="Input"
        [HKEY_CLASSES_ROOT\CLSID\{75FB277F-41FC-4773-9611-F2AC8EB507BA}\Pins\Output\Types]  
        [HKEY_CLASSES_ROOT\CLSID\{75FB277F-41FC-4773-9611-F2AC8EB507BA}\Pins\Output\Types\{73646976-0000-0010-8000-00AA00389B71}]      
        [HKEY_CLASSES_ROOT\CLSID\{75FB277F-41FC-4773-9611-F2AC8EB507BA}\Pins\Output\Types\{73646976-0000-0010-8000-00AA00389B71}\{1776908E-8D3B-46c5-9E58-914FAE67C96E}]    
        [HKEY_CLASSES_ROOT\CLSID\{75FB277F-41FC-4773-9611-F2AC8EB507BA}\Pins\Output\Types\{73646976-0000-0010-8000-00AA00389B71}\{38B76E09-0DB4-427c-9960-27942D4EA356}] 
        [HKEY_CLASSES_ROOT\CLSID\{75FB277F-41FC-4773-9611-F2AC8EB507BA}\Pins\Output\Types\{73646976-0000-0010-8000-00AA00389B71}\{33363248-0000-0010-8000-00AA00389B71}] 
        [HKEY_CLASSES_ROOT\CLSID\{75FB277F-41FC-4773-9611-F2AC8EB507BA}\Pins\Output\Types\{73646976-0000-0010-8000-00AA00389B71}\{47504A4D-0000-0010-8000-00AA00389B71}] 
        [HKEY_CLASSES_ROOT\CLSID\{75FB277F-41FC-4773-9611-F2AC8EB507BA}\Pins\Output\Types\{73646976-0000-0010-8000-00AA00389B71}\{7634706d-0000-0010-8000-00aa00389b71}]
        ; MEDIATYPE_Video\MEDIASUBTYPE_MP4V;          
                             
    	;Register the wrapper as a filter
    	[HKEY_CLASSES_ROOT\Filter\{75FB277F-41FC-4773-9611-F2AC8EB507BA}]
    	@="FSL VPU Encoder DMO wrapper filter"
    	"DMOGuid"="27CC5ADB-44F3-4ab8-84BA-32E695CA7D41"
    
        ;VPU encoder only support Not interleved format		
        [HKEY_LOCAL_MACHINE\Drivers\VPU\Decoder]
        "EnableCbCrInterleavedOutput"=dword:0  ; FALSE		
        
    ENDIF ;FSL_MMF_VPU_ENC
    


    Please mark it as answer or vote as helpful if my reply helps.

    Regards,

    Prabu[eMVP]

    http://prabukumar.wordpress.com

    Wednesday, June 11, 2014 3:17 PM