From patchwork Fri Sep 2 15:14:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carl Eugen Hoyos X-Patchwork-Id: 399 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.140.134 with SMTP id o128csp1510439vsd; Fri, 2 Sep 2016 08:14:21 -0700 (PDT) X-Received: by 10.194.23.166 with SMTP id n6mr18936033wjf.36.1472829261203; Fri, 02 Sep 2016 08:14:21 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id bf8si12138177wjb.121.2016.09.02.08.14.20; Fri, 02 Sep 2016 08:14:21 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6CFDC689D8B; Fri, 2 Sep 2016 18:14:10 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe04-3.mx.upcmail.net (vie01a-dmta-pe04-3.mx.upcmail.net [62.179.121.165]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EF003689D72 for ; Fri, 2 Sep 2016 18:14:04 +0300 (EEST) Received: from [172.31.216.44] (helo=vie01a-pemc-psmtp-pe02) by vie01a-dmta-pe04.mx.upcmail.net with esmtp (Exim 4.87) (envelope-from ) id 1bfqAV-0003iR-Pd for ffmpeg-devel@ffmpeg.org; Fri, 02 Sep 2016 17:14:11 +0200 Received: from [192.168.1.3] ([80.110.104.34]) by vie01a-pemc-psmtp-pe02 with SMTP @ mailcloud.upcmail.net id efEA1t01G0kYYbU01fEBxh; Fri, 02 Sep 2016 17:14:11 +0200 X-SourceIP: 80.110.104.34 From: Carl Eugen Hoyos To: FFmpeg development discussions and patches Date: Fri, 2 Sep 2016 17:14:10 +0200 User-Agent: KMail/1.9.10 MIME-Version: 1.0 Message-Id: <201609021714.10524.cehoyos@ag.or.at> Subject: [FFmpeg-devel] [PATCH]lavc/mjpegdec: Do not skip reading quantization tables X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" 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 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");