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

Lluís Batlle i Rossel viric at viric.name
Thu Feb 11 23:48:18 EET 2021


From: Lluís Batlle i Rossell <viric at 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(-)

-- 
2.29.2



More information about the ffmpeg-devel mailing list