[FFmpeg-devel] [PATCH]lavc/mjpegdec: Do not skip reading quantization tables

Carl Eugen Hoyos cehoyos at ag.or.at
Fri Sep 2 18:14:10 EEST 2016


Hi!

Attached patch fixes ticket #5819, I couldn't immediately find information 
if such quantization tables are valid.
If ok, I'll also fix this in the jpeg auto-detection.

Please comment, Carl Eugen
-------------- next part --------------
From 9ddca61b0feeae5ce682758fb12d8bb05cf72558 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <cehoyos at ag.or.at>
Date: Fri, 2 Sep 2016 17:10:57 +0200
Subject: [PATCH] lavc/mjpegdec: Do not skip reading quantization tables.

They may contain 0xFFs, confusing the start code finding algorithm.

Fixes ticket #5819.
---
 libavcodec/mjpegdec.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 633a8f0..0645a1d 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -2119,6 +2119,8 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
             ret = mjpeg_decode_com(s);
             if (ret < 0)
                 return ret;
+        } else if (start_code == DQT) {
+            ff_mjpeg_decode_dqt(s);
         }
 
         ret = -1;
@@ -2151,9 +2153,6 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
             s->restart_count    = 0;
             /* nothing to do on SOI */
             break;
-        case DQT:
-            ff_mjpeg_decode_dqt(s);
-            break;
         case DHT:
             if ((ret = ff_mjpeg_decode_dht(s)) < 0) {
                 av_log(avctx, AV_LOG_ERROR, "huffman table decode error\n");
-- 
1.7.10.4



More information about the ffmpeg-devel mailing list