From patchwork Thu Apr 19 19:32:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 8507 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:155:0:0:0:0:0 with SMTP id c82-v6csp1043880jad; Thu, 19 Apr 2018 12:32:36 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/JwSMvw75q/10qAC9R4GdxpWs2OBKsuiikdQhvV6HFnjes7Tp2QC6QHgPHJO0aueyYDfKU X-Received: by 10.28.134.17 with SMTP id i17mr33610wmd.107.1524166356626; Thu, 19 Apr 2018 12:32:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524166356; cv=none; d=google.com; s=arc-20160816; b=iZwM+BhZ/5B7iNShOuwuLz9Iu3b5mhItQ44mQGc8n6eQPjH5Emq2X5tTzGB/4cdagD S7fDKC7rcm/v+H/MIzMrsRafFN7IANACgXPQxo/jAlU/OyOKt1CrwxW2EaVAg1pCnhIx 7qm27jId75QyB7LVumAMVPiXahcMybm+UOuulfV7O57ZIu29acjjUE4zzfbgRBglMAUu n8NKJ8PaN93iHxdRc7D1gx72rL74r5Orl8qF8Ncd0KiEq8LbOnayn/YdYrvPkD3RzYBM CldX0jjLsjLQDvxY4j2aw57os65AcivUxYJRAggFZq1GykV9595XOWOZveu2l78UUFX5 XbJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:delivered-to :arc-authentication-results; bh=ZKzVKxK7p7qiL8vov6ZL/BbeXqpv0fvLcI8uGVx0KDU=; b=uDHD4gR4GMHiT7oHJlXnUMwJCXM2Qip0uhJWfp7wt16pop95UV/4Nhpi+zbqDcdExd rFMHzVIqeDHqSPi8E6ePySCjeQiSfrdt8E2sCu0bGBDdB4MEOsapRxYZck+Nn1zf01QD b55HngGHDLKwmShWCQIAC8PLaXi0yZEUgVl0it+ba8wixrld8hAGI1lDtCDiPVCTLuL2 ypXJnOapG5NQzg9qAInPWtzSrTYUF62Ndj5HA9F386MSRMAIb16xI7AeZd4/BfwSvkBw UgH4MnvQtyVBZGxfARg4LzNpe6HYznCQW10LDb/Nyt2BHY/J56JsT59uO5xlHdehzV+Z GzjQ== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id k7-v6si3266336wrg.148.2018.04.19.12.32.35; Thu, 19 Apr 2018 12:32:36 -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 2D194689DDE; Thu, 19 Apr 2018 22:32:06 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3E7AC689C57 for ; Thu, 19 Apr 2018 22:31:59 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 53D91E1050; Thu, 19 Apr 2018 21:32:26 +0200 (CEST) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wt3WBykZ60rC; Thu, 19 Apr 2018 21:32:25 +0200 (CEST) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 1DC01E052A; Thu, 19 Apr 2018 21:32:25 +0200 (CEST) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Thu, 19 Apr 2018 21:32:18 +0200 Message-Id: <20180419193221.21712-1-cus@passwd.hu> X-Mailer: git-send-email 2.13.6 Subject: [FFmpeg-devel] [PATCH 1/4] avformat/qtpalette: parse color table according to the QuickTime file format specs 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 Cc: Marton Balint MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" The specs says that the the first color component in the color array is not alpha, but simply 0. Fixes 0 alpha of fate-suite/cvid/catfight-cvid-pal8-partial.mov Signed-off-by: Marton Balint --- libavformat/qtpalette.c | 12 ++++++------ tests/ref/lavf-fate/mov_qtrle_mace6 | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libavformat/qtpalette.c b/libavformat/qtpalette.c index 666c6b7351..6833f0cea9 100644 --- a/libavformat/qtpalette.c +++ b/libavformat/qtpalette.c @@ -49,7 +49,7 @@ int ff_get_qtpalette(int codec_id, AVIOContext *pb, uint32_t *palette) /* If the depth is 1, 2, 4, or 8 bpp, file is palettized. */ if ((bit_depth == 1 || bit_depth == 2 || bit_depth == 4 || bit_depth == 8)) { uint32_t color_count, color_start, color_end; - uint32_t a, r, g, b; + uint32_t r, g, b; /* Ignore the greyscale bit for 1-bit video and sample * descriptions containing a color table. */ @@ -94,17 +94,17 @@ int ff_get_qtpalette(int codec_id, AVIOContext *pb, uint32_t *palette) color_end = avio_rb16(pb); if ((color_start <= 255) && (color_end <= 255)) { for (i = color_start; i <= color_end; i++) { - /* each A, R, G, or B component is 16 bits; - * only use the top 8 bits */ - a = avio_r8(pb); - avio_r8(pb); + /* Each color is made of four unsigned 16 bit integers. The + * first integer is 0, the remaining integers are the red, + * the green and the blue values. We only use the top 8 bit. */ + avio_skip(pb, 2); r = avio_r8(pb); avio_r8(pb); g = avio_r8(pb); avio_r8(pb); b = avio_r8(pb); avio_r8(pb); - palette[i] = (a << 24 ) | (r << 16) | (g << 8) | (b); + palette[i] = (0xFFU << 24) | (r << 16) | (g << 8) | (b); } } } diff --git a/tests/ref/lavf-fate/mov_qtrle_mace6 b/tests/ref/lavf-fate/mov_qtrle_mace6 index 30c705ee4c..f8428aaa49 100644 --- a/tests/ref/lavf-fate/mov_qtrle_mace6 +++ b/tests/ref/lavf-fate/mov_qtrle_mace6 @@ -1,3 +1,3 @@ dcc9c4c182a5809dee9a9366f4533797 *./tests/data/lavf-fate/lavf.mov 1270387 ./tests/data/lavf-fate/lavf.mov -./tests/data/lavf-fate/lavf.mov CRC=0x5ec66f68 +./tests/data/lavf-fate/lavf.mov CRC=0x9320cd26