From patchwork Tue Apr 24 19:05:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 8632 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:155:0:0:0:0:0 with SMTP id c82-v6csp2190333jad; Tue, 24 Apr 2018 12:05:54 -0700 (PDT) X-Google-Smtp-Source: AIpwx483+SeKA3BhcG1oglOhAth0cx1qOqEkc7bZO7k2Z4NmKEEeaZVwPR32LG80gM/GL5eNe2XB X-Received: by 2002:adf:b741:: with SMTP id n1-v6mr21611572wre.203.1524596754318; Tue, 24 Apr 2018 12:05:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524596754; cv=none; d=google.com; s=arc-20160816; b=RkkixGlr9gb1Q15yivZKa06/oDtmRJDMDSTlBz0NMp0yvhhNkquZDeremmb1Q9ucun dr8643t8wPx/BlVTWPcMYCBcggDRLy6HjwP5yxTnUCwyu8btlG6Gk3TtfuKRvfuMKRcK grtTqaPPfI8M/cmmSIjrMwhqIBen/8xyTnRW//70SO/itv8UOF1hjFnIaCvSMm1gx+j3 u62wSB8xRe/653Slm53JK2q33gKxGDkx8P7peXElGZUwVCTUV4a72BP4abLafbspBM3r mmL3SP2zHMrAda3BPPvJJ0A9DpiBpGOO5kpXHE05/uCmhg10oubYuoH07AD3rFRFjZtB prrQ== 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:references:in-reply-to:message-id:date :to:from:delivered-to:arc-authentication-results; bh=oGR0Oe5x5dY7uyS8zh99ay2QwymDLaRXTDqDyljwOJM=; b=1GOYTUoG/u/OSRSmlPprU9Cm8esO5JuDHe5feS9t586IVEBJ13Xf6w7zGC5tJIAJ9S YtBVYGVnbjY1r3eFGbl2Tx0KzevQy3+RoyM1UabE2ApMkF9lPaOkwSyXf3VLCY8LMAv2 qGR8uu5GK/vgGVvG4Bg+I5Y4Hb122iZhPt84Q36z0AaN+tgGK8eML3Mi9UPnS8J9a0Oo JjvsNxxwp5/HVvATXxvEr7orUVk9nCzKnl+OP0CKl4KFQ2kBbT0t/2I3kwjWa5+IMf9i bhPp/d/cNbURLI7z6OIOmwevaIl2SFudZdfnpBMJ8TkUyHolSu2wMOH29/g6xtA6O+SH VY9Q== 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 o4si1926999wme.154.2018.04.24.12.05.53; Tue, 24 Apr 2018 12:05:54 -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 3ABC368A2BE; Tue, 24 Apr 2018 22:05:07 +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 9B59168A290 for ; Tue, 24 Apr 2018 22:05:00 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 69790E104D; Tue, 24 Apr 2018 21:05:30 +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 4nbPELl-UJQA; Tue, 24 Apr 2018 21:05:29 +0200 (CEST) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 2E340E0742; Tue, 24 Apr 2018 21:05:29 +0200 (CEST) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Tue, 24 Apr 2018 21:05:00 +0200 Message-Id: <20180424190501.23908-4-cus@passwd.hu> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180424190501.23908-1-cus@passwd.hu> References: <20180424190501.23908-1-cus@passwd.hu> Subject: [FFmpeg-devel] [PATCH 4/5] avutil/pixdesc: add AV_PIX_FMT_FLAG_ALPHA to AV_PIX_FMT_PAL8 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" Signed-off-by: Marton Balint --- doc/APIchanges | 3 +++ libavcodec/tests/imgconvert.c | 4 ---- libavutil/pixdesc.c | 3 +-- libavutil/pixdesc.h | 8 ++------ libavutil/tests/pixdesc.c | 4 ---- libavutil/version.h | 2 +- 6 files changed, 7 insertions(+), 17 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 4f6ac2a031..d9b457e080 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,6 +15,9 @@ libavutil: 2017-10-21 API changes, most recent first: +2018-04-xx - xxxxxxxxxx - lavu 56.16.100 - pixdesc.h + Add AV_PIX_FMT_FLAG_ALPHA to AV_PIX_FMT_PAL8. + -------- 8< --------- FFmpeg 4.0 was cut here -------- 8< --------- 2018-04-03 - d6fc031caf - lavu 56.13.100 - pixdesc.h diff --git a/libavcodec/tests/imgconvert.c b/libavcodec/tests/imgconvert.c index c598d461d3..aefc324bf5 100644 --- a/libavcodec/tests/imgconvert.c +++ b/libavcodec/tests/imgconvert.c @@ -39,10 +39,6 @@ int main(void){ skip = 0; } av_log(NULL, AV_LOG_INFO, "pix fmt %s yuv_plan:%d avg_bpp:%d\n", desc->name, is_yuv_planar(desc), av_get_padded_bits_per_pixel(desc)); - if ((!(desc->flags & AV_PIX_FMT_FLAG_ALPHA)) != (desc->nb_components != 2 && desc->nb_components != 4)) { - av_log(NULL, AV_LOG_ERROR, "Alpha flag mismatch\n"); - err = 1; - } } return err; } diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index 8ed52751c1..a8be7b66e6 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c @@ -288,7 +288,7 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { .comp = { { 0, 1, 0, 0, 8, 0, 7, 1 }, }, - .flags = AV_PIX_FMT_FLAG_PAL, + .flags = AV_PIX_FMT_FLAG_PAL | AV_PIX_FMT_FLAG_ALPHA, }, [AV_PIX_FMT_YUVJ420P] = { .name = "yuvj420p", @@ -2432,7 +2432,6 @@ void ff_check_pixfmt_descriptors(void){ av_assert0(d->log2_chroma_h <= 3); av_assert0(d->nb_components <= 4); av_assert0(d->name && d->name[0]); - av_assert0((d->nb_components==4 || d->nb_components==2) == !!(d->flags & AV_PIX_FMT_FLAG_ALPHA)); av_assert2(av_get_pix_fmt(d->name) == i); for (j=0; jcomp); j++) { diff --git a/libavutil/pixdesc.h b/libavutil/pixdesc.h index 1ab372782a..4f9c5a271f 100644 --- a/libavutil/pixdesc.h +++ b/libavutil/pixdesc.h @@ -167,12 +167,8 @@ typedef struct AVPixFmtDescriptor { /** * The pixel format has an alpha channel. This is set on all formats that - * support alpha in some way. The exception is AV_PIX_FMT_PAL8, which can - * carry alpha as part of the palette. Details are explained in the - * AVPixelFormat enum, and are also encoded in the corresponding - * AVPixFmtDescriptor. - * - * The alpha is always straight, never pre-multiplied. + * support alpha in some way, including AV_PIX_FMT_PAL8. The alpha is always + * straight, never pre-multiplied. * * If a codec or a filter does not support alpha, it should set all alpha to * opaque, or use the equivalent pixel formats without alpha component, e.g. diff --git a/libavutil/tests/pixdesc.c b/libavutil/tests/pixdesc.c index 7fbfeea96c..34e2bea932 100644 --- a/libavutil/tests/pixdesc.c +++ b/libavutil/tests/pixdesc.c @@ -37,10 +37,6 @@ int main(void){ skip = 0; } av_log(NULL, AV_LOG_INFO, "pix fmt %s avg_bpp:%d colortype:%d\n", desc->name, av_get_padded_bits_per_pixel(desc), get_color_type(desc)); - if ((!(desc->flags & AV_PIX_FMT_FLAG_ALPHA)) != (desc->nb_components != 2 && desc->nb_components != 4)) { - av_log(NULL, AV_LOG_ERROR, "Alpha flag mismatch\n"); - err = 1; - } } return err; } diff --git a/libavutil/version.h b/libavutil/version.h index 387421775f..23567000a3 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -79,7 +79,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 56 -#define LIBAVUTIL_VERSION_MINOR 15 +#define LIBAVUTIL_VERSION_MINOR 16 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \