From patchwork Thu Apr 19 19:32:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 8506 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:155:0:0:0:0:0 with SMTP id c82-v6csp1044076jad; Thu, 19 Apr 2018 12:32:54 -0700 (PDT) X-Google-Smtp-Source: AIpwx49wQ++5stox2IWmgkQyWi/UC9YTNmriJqPra+XTctfJ2R0KNUzqJ4rmBZZEKe7E4B4wCPPs X-Received: by 2002:adf:96c2:: with SMTP id u60-v6mr5832877wrb.204.1524166374153; Thu, 19 Apr 2018 12:32:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524166374; cv=none; d=google.com; s=arc-20160816; b=CRzwx7ubvkFFZNwTudO1QcM1BH2W2hIINcSw13Vm4gNUaNGxHwOL4IY2VSH4xDBXGE fNeJq5Mo78CwDRpNc8fOeq5/7YpEOr8IaiClw1dR66YopJppdCmHcuBVDNwTyA6rEyvV Co5L6f+ubsvnHCwniXuCY7w6Ciin0qujkcfUt/odoX/khczRlO0d7pTot270FS7CenXm bMRtDsfAL0qsvv2cZX6a3qiLKE7Sq1k7QxPiB2CcnKW7TDF+odIa+OlQsQvN2BLdWhpq LYIdxHastZHEGuHddFoXGLjPOI3OoVPRD2+N5bOwf45gxhRB6vL1wIfFMNW6zGUkmdQu TIZQ== 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=uaXBxiWiFXHXrJvJ3oYg480PB2nR7FtGXlFOAhxxXtc=; b=hUceZ90XArAMImZp8CcsIeMDcxvVl+4dBy+EFHMOFMph8+yJhsmOC09yU8b6w8+ZGM nDw9RkZu7eNFZj5r5ewvtVdFKsz5HDnRsYFMMLVXUBz+82lIVFgb4Ri06tZALJNb8mFl eMQULvEe2aH4095IhzDTLwhjG5eg5QCq2DF+ztxN7BK2V0WFVYv9pVR+lFvmgdXvxxEB O8iMX6Nfq5xop6Mmt14yjP602x2dZMRREarei3txUQt7TL0Hb4J44As8EfZ/u7YvQGev YC7gJClI6BlQtCrJcRqgrZoC6Jw/U7912COvBFc49IUAoD49NjzvAdPm5IKYFKO7eRpc R0Mw== 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 b4si1644001wmi.173.2018.04.19.12.32.53; Thu, 19 Apr 2018 12:32: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 640E6689F57; Thu, 19 Apr 2018 22:32:10 +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 52F3B689F17 for ; Thu, 19 Apr 2018 22:32:03 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 177E3E1145; Thu, 19 Apr 2018 21:32:31 +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 lEGtJi9Rp1Eh; Thu, 19 Apr 2018 21:32:30 +0200 (CEST) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 3FB3AE1144; Thu, 19 Apr 2018 21:32:30 +0200 (CEST) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Thu, 19 Apr 2018 21:32:20 +0200 Message-Id: <20180419193221.21712-3-cus@passwd.hu> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180419193221.21712-1-cus@passwd.hu> References: <20180419193221.21712-1-cus@passwd.hu> Subject: [FFmpeg-devel] [PATCH 3/4] avutil/pixdesc: add av_pix_fmt_desc_has_alpha() 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 +++ libavutil/pixdesc.h | 11 +++++++++++ libavutil/version.h | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index 4f6ac2a031..2a0b6f057a 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_desc_has_alpha(). + -------- 8< --------- FFmpeg 4.0 was cut here -------- 8< --------- 2018-04-03 - d6fc031caf - lavu 56.13.100 - pixdesc.h diff --git a/libavutil/pixdesc.h b/libavutil/pixdesc.h index 1ab372782a..aef4313ccb 100644 --- a/libavutil/pixdesc.h +++ b/libavutil/pixdesc.h @@ -430,4 +430,15 @@ int av_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt, enum AVPixelFormat av_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2, enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr); +/** + * Return true if a pixel format descriptor has alpha channel. + * + * @param desc the pixel format descriptor + * @return 1 if the pixel format descriptor has alpha, 0 otherwise. + */ +static inline int av_pix_fmt_desc_has_alpha(const AVPixFmtDescriptor *desc) +{ + return desc->nb_components == 2 || desc->nb_components == 4 || (desc->flags & AV_PIX_FMT_FLAG_PAL); +} + #endif /* AVUTIL_PIXDESC_H */ 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, \