[FFmpeg-devel] [PATCH] lavf/img2dec: disable parsing if frame_size is specified

Matthieu Bouron matthieu.bouron at gmail.com
Mon Mar 7 12:55:09 CET 2016


From: Matthieu Bouron <matthieu.bouron at stupeflix.com>

---

Hello,

The following patch disable parsing if the frame_size option is specified. The
main purpose here is to disable the use of parsers (which have a huge
performance cost on embedded platforms) for single images when
their size is known in advance.

The patch sounds hackish to me though, but others might consider it OK (or not).

The performance of the jpeg parser still need to be addressed at some point.

Matthieu

---
 libavformat/img2dec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
index fe0e346..9aa6dd7 100644
--- a/libavformat/img2dec.c
+++ b/libavformat/img2dec.c
@@ -206,7 +206,7 @@ int ff_img_read_header(AVFormatContext *s1)
         s->is_pipe = 0;
     else {
         s->is_pipe       = 1;
-        st->need_parsing = AVSTREAM_PARSE_FULL;
+        st->need_parsing = s->frame_size > 0 ? AVSTREAM_PARSE_NONE : AVSTREAM_PARSE_FULL;
     }
 
     if (s->ts_from_file == 2) {
-- 
2.7.2



More information about the ffmpeg-devel mailing list