This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

V4L2: reads capture buffer is significantly slow [V4L2 DM816x Eva board]

Hi,

   I just ran the saLoopBack example. It is good.

  But when I tried to read  the capture buffer.  It took so long.  For example when I got the  capt.buf.m.userptr, I copy the whole buffer to another buffer. Then frame rate drop from 64Fps to 17Fps. Is that because of mmap? Is there any way to make it better?

Thank

Wayne

  • Are you trying to copy the captured video buffer to another buffer using CPU (A8)? Since it will be pretty large buffer, its going to take quite a while to copy that. And this copy will hold your buffers  and you will not be feeding the buffers back to V4L2 driver fast enough to capture at 60fps and hence you see the drop in frame rate. Its generally not a good idea to copy raw video frames using CPU copy; consider passing on the same buffer pointer to next processing element rather than introducing a buffer copy.

    Thanks,

    Satish 

  • Hi,

    Any reason why you want to copy buffer. This is not required in case of V4L2 capture to display of fbdev or any encode/decode.  You can try using EDMA which will certainly improve performance but wont be able to match real time 60FPS requirement.

    Regards,

    Hardik Shah

  • Hi, 

       Thank yo for the reply.  The main reason I need read the capture buffer is that I need do some image processing such as distortion.  

       I understand that  reading capture buffer will drop down the FPS, but my question is it should not like 60FPS to 17FPS.  If I rewrite the capture buffer  to all 0x00 then display, the FPS only drop from 64 to 62. So why does it have huge different between the read operation and write operation. 

       For example:

       "  memset((long unsigned int * )disp.buf.m.userptr,0xffff20ff,disp.buf.length); "  it is around 62fps;

       "  memcpy(ptr,(long unsigned int * )disp.buf.m.userptr,disp.buf.length);"  it is around 17fps. 

      Thank you very much.

    Wayne

  • Hi

      Anyone can answer the question? Because V4L2 doesn't support upscaling and distortion. I have to get the capture data, do it by software then display. Or  the board cannot support that? It cannot support 1080P60 with that? 

      Thank you 

  • Hi,

    V4L2 capture and display driver doesn't support upscaling and noise filtering. But once you get buffer out of V4L2 capture driver you can connect that buffer to VFPC component to get it scaled and noise filtered. This is possible with SNT mode of open max components. VFPC directly runs on hardware so it will support 1080P easily.

    Regards,

    Hardik Shah

  • If you can explain your processing pipeline (like capture=> scale up => ?? =?? ), we can perhaps suggest the ways to achieve that .

    Thanks,

    Satish


  • Hi, 

      Thank you for the reply. My processing pipeline should be capture->distortion->crop->upscale, if possible  capture->distortion->rotation->crop->upscale.

    Thank you. 

  • Hi,

      Can the DSP do those image processing and user can modify the DSP code?

    Thank you.

  • Hi,

    DSP could do image processing. And its open for implementing any proprietary algorithm. But you need to pass directly the captured buffer address to DSP using some IPC calls instead of copying in another buffer. Buffer copy will never be able to scaleup for 1080P60 and it will eat your memory bandwidth badly.

    Regards,

    Hardik Shah

  • HardikShah said:

    Hi,

    DSP could do image processing. And its open for implementing any proprietary algorithm. But you need to pass directly the captured buffer address to DSP using some IPC calls instead of copying in another buffer. Buffer copy will never be able to scaleup for 1080P60 and it will eat your memory bandwidth badly.

    Regards,

    Hardik Shah

    HI, 

      Can DSP's image processing match real time 60FPS requirement? I mean the whole process of "video capture-> DSP image processing(distorting, cropping, upscale) -> video output"

    can match real time 60FPS requirement?

      Thank you.


  • wayne zhang said:
    Can DSP's image processing match real time 60FPS requirement? I mean the whole process of "video capture-> DSP image processing(distorting, cropping, upscale) -> video output"

    That really depends on what processing you are trying to do and the algorithm you implement. But most of the features are supported in HDVPSS in hardware accelerated fashion like upscale, cropping, and noise filtering. I am not sure about distortion. But are you trying to correct lens distortion with some DSP algorithm?

    Regards,

    Hardik Shah

  • HardikShah said:

    Can DSP's image processing match real time 60FPS requirement? I mean the whole process of "video capture-> DSP image processing(distorting, cropping, upscale) -> video output"

    That really depends on what processing you are trying to do and the algorithm you implement. But most of the features are supported in HDVPSS in hardware accelerated fashion like upscale, cropping, and noise filtering. I am not sure about distortion. But are you trying to correct lens distortion with some DSP algorithm?

    Regards,

    Hardik Shah

    [/quote]

    Yes, for now we are trying to correct lens distortion with EVA board for live1080P60.  It can be DSP or ARM. May you give us some advices? 

    Thank you.

    Wayne

  • wayne zhang said:
    Yes, for now we are trying to correct lens distortion with EVA board for live1080P60.  It can be DSP or ARM. May you give us some advices? 

    Hi,

    DSP will always be good for any image processing as it has special instructions for image processing.  Further you may also want to keep your ARM free for user apps. But again you will get realtime 1080P60 depends on algorithm running.

    Regards,

    Hardik Shah

  • Hi,I got this issues also, and i need do image process using opencv. The frame-rate is too low????
    Read frame buffer using V4L2-MMAP. And how can i increase the speed?
    Thank you.
  • Hi,

    V4L2 does not affect/change frame rate of the input. If it is slower, your decoder itself would be providing frame slower to the VIP port. V4L2 cannot do anything in that case..

    Rgds,

    Brijesh