From patchwork Wed Feb 22 14:34:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul B Mahol X-Patchwork-Id: 2639 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.65.149 with SMTP id x21csp911963vsf; Wed, 22 Feb 2017 06:34:51 -0800 (PST) X-Received: by 10.223.152.171 with SMTP id w40mr26546126wrb.72.1487774090953; Wed, 22 Feb 2017 06:34:50 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 187si2858348wmx.37.2017.02.22.06.34.50; Wed, 22 Feb 2017 06:34:50 -0800 (PST) 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; dkim=neutral (body hash did not verify) header.i=@gmail.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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3797268836C; Wed, 22 Feb 2017 16:34:27 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8E1DD68835A for ; Wed, 22 Feb 2017 16:34:20 +0200 (EET) Received: by mail-wm0-f67.google.com with SMTP id 134so24731wmj.1 for ; Wed, 22 Feb 2017 06:34:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=RMjneffOzU1VCbIPmVA9nqJa3m/xNa18Hfo+d1KoJ9k=; b=EEfDlMNsMbt09IXIt01IWuuJcDe+n1cq8cs/D0FZG9MfKZbMUpKnjmzxjgXo5QT3zo vthQaru94kkscgMN036KRbc78/bLYdQTjVl5EjzXJOUn1Ri7nrWg5B1oZ20mj7R57V5b WVYWAAZ6rqg8XR0rKBWKj8pKQHOA1rrWATgjFz51Sqaw4I/ZU0U+EjVNXieuxkn0m0Yb rcPdler7QbardgFlyhOEzNv2WB6QePIVymUNaSwG+iHH1cf8i3tPgwnegtD0M9pfIBRy R2iWMr9GJOrVdDxfAqBHuQCXqzlOmmiIlFgwmJa0eXHLxeMmSGcApaC6xlMkTkLXovhM 7zCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=RMjneffOzU1VCbIPmVA9nqJa3m/xNa18Hfo+d1KoJ9k=; b=V2F99s+oXpjUWQKAPTNnTywU/kNGSWcON/s7AKtbfy8ahye/DIZCMEOB0SL9myZ9vh BWS6YsjUz83zB622s9wws3T9TQvVl/f4E/FLEMuP+r0TNXFIAwkXEx+dO0wm/lvIrxtT 30umAdiTp4KHBwc0kQ2F8Xs8q8BUKkocR39Oe74HhDJowpHWFDdkb6RlAboaLRgLaIpU PTwrva4dNfeqgy+z5RoyvDuW4BUehnWZLvrLsMf6XzEJSWaqT1SWPPXKO63W86DEci47 ZyPowtbjQIsvDBwgtXAmFe/9g9bW0TVrdbsvjRJU7fFcLhzlicL667lejvORwB0CNRhf N24w== X-Gm-Message-State: AMke39mzYXVnUikFR/z1TAzBEcaDDElkEQQFZrWLllMVpfE+rgQZT6zM+c2BXd8ykfjRUA== X-Received: by 10.28.203.75 with SMTP id b72mr3003860wmg.110.1487774067832; Wed, 22 Feb 2017 06:34:27 -0800 (PST) Received: from localhost.localdomain ([94.250.174.60]) by smtp.gmail.com with ESMTPSA id h75sm1974797wrh.37.2017.02.22.06.34.26 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Feb 2017 06:34:27 -0800 (PST) From: Paul B Mahol To: ffmpeg-devel@ffmpeg.org Date: Wed, 22 Feb 2017 15:34:16 +0100 Message-Id: <20170222143416.9688-1-onemda@gmail.com> X-Mailer: git-send-email 2.9.3 Subject: [FFmpeg-devel] [PATCH] avcodec/qdrw: add support for 0x0001 code 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Fixes decoding of files which sets frame width/height this way. Signed-off-by: Paul B Mahol --- libavcodec/qdrw.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/libavcodec/qdrw.c b/libavcodec/qdrw.c index e3d69c2..2462e2f 100644 --- a/libavcodec/qdrw.c +++ b/libavcodec/qdrw.c @@ -33,6 +33,7 @@ #include "internal.h" enum QuickdrawOpcodes { + CLIP = 0x0001, PACKBITSRECT = 0x0098, PACKBITSRGN, DIRECTBITSRECT, @@ -309,7 +310,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame * const p = data; GetByteContext gbc; int colors; - int w, h, ret; + int w, h, x0, y0, x1, y1, ret; int ver; bytestream2_init(&gbc, avpkt->data, avpkt->size); @@ -353,6 +354,16 @@ static int decode_frame(AVCodecContext *avctx, int opcode = bytestream2_get_be16(&gbc); switch(opcode) { + case CLIP: + bytestream2_get_be16(&gbc); + y0 = bytestream2_get_be16(&gbc); + x0 = bytestream2_get_be16(&gbc); + y1 = bytestream2_get_be16(&gbc); + x1 = bytestream2_get_be16(&gbc); + ret = ff_set_dimensions(avctx, x1 - x0, y1 - y0); + if (ret < 0) + return ret; + break; case PACKBITSRECT: case PACKBITSRGN: av_log(avctx, AV_LOG_DEBUG, "Parsing Packbit opcode\n");