mbox series

[FFmpeg-devel,0/3] mjpeg_mmal and avoid a frame copy in mmaldec

Message ID bf4be08f.AUUAACKJBogAAAAAAAAAALF60VUAARpcY_sAAAAAAAeRJgBgJaZW@mailjet.com
Headers show
Series mjpeg_mmal and avoid a frame copy in mmaldec | expand

Message

Lluís Batlle i Rossell Feb. 11, 2021, 9:48 p.m. UTC
From: Lluís Batlle i Rossell <viric@viric.name>

I needed to acquire mjpeg from a v4l2 uvc webcam in a Raspberry pi,                                             
and I saw mmaldec lacked mjpeg and also was doing an unnecessary copy.                                          
                                                                                                                
I used two patches I found in the mailing list archives to enable mjpeg                                         
mmaldec and then wrote one that avoids the copy. It works fine for me but                                       
I have not run 'fate' yet. I'm in a cross-building situation and I have                                         
yet to learn how that works.                                                                                    
                                                                                                                
In a Raspberry Pi 1 Model B now it can 640x480 30fps mjpeg->h264_omx with                                       
25% of cpu (as "top" shows).                                                                                    
Before these three patches, 640x480 YUY2->h264_omx could do only 20fps and                                      
"top" showed 50% of cpu.                                                                                        
                                                                                                                
A Raspberry Pi 2 can do easily 30fps 1280x720 mjpeg->h264_omx as well.                                          
                                                                                                                
It'd be a lot easier for me if these patches were upstream so I'm                                               
interested in the code getting in. I'm new in ffmpeg so I may have missed                                       
customary details. I also thank the help #ffmpeg-devel that made my patch                                       
(3rd) simpler than I originally thought.                                                                        

Cosmin Gorgovan (2):
  libavcodec/mmaldec: enable MJPEG decoding
  libavcodec/mmaldec: continue after receiving EOS without having sent
    one

Lluís Batlle i Rossell (1):
  mmaldec with plain yuv420p without copy

 configure              |  1 +
 libavcodec/allcodecs.c |  1 +
 libavcodec/mmaldec.c   | 60 ++++++++++++++++++++++--------------------
 3 files changed, 34 insertions(+), 28 deletions(-)