From patchwork Tue Apr 24 19:04:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 8633 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:155:0:0:0:0:0 with SMTP id c82-v6csp2189977jad; Tue, 24 Apr 2018 12:05:31 -0700 (PDT) X-Google-Smtp-Source: AIpwx49tv889X3VG82uu90aLKzPTdDg+iNgcMqq7bEx0CwUcCoWkRtDEtKPe4fPNub11w9EbzX8m X-Received: by 2002:adf:9444:: with SMTP id 62-v6mr14151280wrq.264.1524596731627; Tue, 24 Apr 2018 12:05:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524596731; cv=none; d=google.com; s=arc-20160816; b=S6qXcFnrLq4VBXgI86gC5CTU9mpKY8GuFCR2XF293AXsb8U36PLUH/8PyyiBffE952 NrE/di0tjJS9poISXQAWMNg8rul+qYWBKAhCJ+mRjFC4MJ8ZVzBCDm/v5F5hfdiwDzJv dxWnxYNINZQybjvswS0gvMX7bfi4IrFfX3RvjAok7Dl2DvyUPuwJAs3g7JmTX66awWJr JNMbDtCmUVkYt6abGuDzpeIxnrIot3Us5oFtS2FSt9ubR6WaHPl6U7nkTkT3wZsir0G9 ocqM3fFs1XOvYYoYovUecxcSyWhyYzCJLQDsGTp1jij0DPMV9ZZ9ZUzErHB5gO4Ji4+b LNQg== 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=WSeiQeH9RLcBHQFIYDIFJPpE6pHYQsMSSc2SiggEAERRNQaju1tAQ0HbNMd/B98OOC 30pbu0aUH5sCoSawl/r4i4btkgfL14pWagknc344Vu7tFzV8UUoPhdh2p1OAVvYBbKq8 dO7fF+eZuPKrFSODJfXVNRH6Sqq19Jcg6lLveVLKjBVDFjST6dw5luJU///++m7jrq8T yNuByoQysaeXd/DAZfAOURiVLolblJn8O+uLoqjwg+GoVXUrIq7UzIShrJF5ww4jfSoM 0T+wNXlkTNestdPDVsuPC9lkuIrlSaA5NTObPNu8ucbhiiQkA8YKBk56XQBJwr9odaSC psCw== 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 b8-v6si12445471wrg.313.2018.04.24.12.05.31; Tue, 24 Apr 2018 12:05:31 -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 231BE68A24C; Tue, 24 Apr 2018 22:05:00 +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 B8A2168A1D6 for ; Tue, 24 Apr 2018 22:04:53 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 9212FE104D; Tue, 24 Apr 2018 21:05:23 +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 gNlyjuReut8k; Tue, 24 Apr 2018 21:05:21 +0200 (CEST) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 976F4E0742; Tue, 24 Apr 2018 21:05:21 +0200 (CEST) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Tue, 24 Apr 2018 21:04:57 +0200 Message-Id: <20180424190501.23908-1-cus@passwd.hu> X-Mailer: git-send-email 2.13.6 Subject: [FFmpeg-devel] [PATCH 1/5] 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