diff mbox

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

Message ID 201609021714.10524.cehoyos@ag.or.at
State Accepted
Commit cef5bc0e6e2320d3903cf063d59cef83e91dbc3c
Headers show

Commit Message

Carl Eugen Hoyos Sept. 2, 2016, 3:14 p.m. UTC
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
From 9ddca61b0feeae5ce682758fb12d8bb05cf72558 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <cehoyos@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(-)

Comments

Michael Niedermayer Sept. 2, 2016, 8:53 p.m. UTC | #1
On Fri, Sep 02, 2016 at 05:14:10PM +0200, Carl Eugen Hoyos wrote:
> 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.

they are valid
LGTM

thx

[...]
Carl Eugen Hoyos Sept. 3, 2016, 11:40 a.m. UTC | #2
Hi!

2016-09-02 22:53 GMT+02:00 Michael Niedermayer <michael@niedermayer.cc>:
> On Fri, Sep 02, 2016 at 05:14:10PM +0200, Carl Eugen Hoyos wrote:
>>
>> 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.
>
> they are valid
> LGTM

Patches applied.

Thank you, Carl Eugen
diff mbox

Patch

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");