From patchwork Sun Mar 19 14:33:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgQsWTc2No?= X-Patchwork-Id: 3018 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.50.79 with SMTP id y76csp1037955vsy; Sun, 19 Mar 2017 07:34:38 -0700 (PDT) X-Received: by 10.28.198.134 with SMTP id w128mr6073535wmf.80.1489934078444; Sun, 19 Mar 2017 07:34:38 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id p199si11164364wmd.130.2017.03.19.07.34.37; Sun, 19 Mar 2017 07:34:38 -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 9ED646891D4; Sun, 19 Mar 2017 16:33:46 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from golem.pkh.me (LStLambert-657-1-117-164.w92-154.abo.wanadoo.fr [92.154.28.164]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id F1CDC688329 for ; Sun, 19 Mar 2017 16:33:38 +0200 (EET) Received: from localhost (golem.pkh.me [local]) by golem.pkh.me (OpenSMTPD) with ESMTPA id fd7686be; Sun, 19 Mar 2017 14:33:46 +0000 (UTC) From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= To: ffmpeg-devel@ffmpeg.org Date: Sun, 19 Mar 2017 15:33:43 +0100 Message-Id: <20170319143343.7298-6-u@pkh.me> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170319143343.7298-1-u@pkh.me> References: <20170319143343.7298-1-u@pkh.me> Subject: [FFmpeg-devel] [PATCH 5/5] swscale: use a (more correct) function for isPacked 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: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- libswscale/swscale_internal.h | 21 +++------------------ tests/ref/fate/sws-pixdesc-query | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index 9a28d180f1..2c2329ae56 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -784,30 +784,15 @@ static av_always_inline int isALPHA(enum AVPixelFormat pix_fmt) return desc->flags & AV_PIX_FMT_FLAG_ALPHA; } -#if 1 -#define isPacked(x) ( \ - (x)==AV_PIX_FMT_PAL8 \ - || (x)==AV_PIX_FMT_YUYV422 \ - || (x)==AV_PIX_FMT_YVYU422 \ - || (x)==AV_PIX_FMT_UYVY422 \ - || (x)==AV_PIX_FMT_YA8 \ - || (x)==AV_PIX_FMT_YA16LE \ - || (x)==AV_PIX_FMT_YA16BE \ - || (x)==AV_PIX_FMT_AYUV64LE \ - || (x)==AV_PIX_FMT_AYUV64BE \ - || isRGBinInt(x) \ - || isBGRinInt(x) \ - ) -#else static av_always_inline int isPacked(enum AVPixelFormat pix_fmt) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); av_assert0(desc); - return ((desc->nb_components >= 2 && !(desc->flags & AV_PIX_FMT_FLAG_PLANAR)) || - pix_fmt == AV_PIX_FMT_PAL8); + return (desc->nb_components >= 2 && !(desc->flags & AV_PIX_FMT_FLAG_PLANAR)) || + pix_fmt == AV_PIX_FMT_PAL8 || + pix_fmt == AV_PIX_FMT_MONOBLACK || pix_fmt == AV_PIX_FMT_MONOWHITE; } -#endif static av_always_inline int isPlanar(enum AVPixelFormat pix_fmt) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); diff --git a/tests/ref/fate/sws-pixdesc-query b/tests/ref/fate/sws-pixdesc-query index 1f0584474b..d23b4f5a11 100644 --- a/tests/ref/fate/sws-pixdesc-query +++ b/tests/ref/fate/sws-pixdesc-query @@ -594,6 +594,7 @@ Packed: monob pal8 uyvy422 + uyyvyy411 bgr8 bgr4 bgr4_byte @@ -621,6 +622,8 @@ Packed: ya8 bgr48be bgr48le + xyz12le + xyz12be rgba64be rgba64le bgra64be @@ -628,6 +631,22 @@ Packed: yvyu422 ya16be ya16le + 0rgb + rgb0 + 0bgr + bgr0 + bayer_bggr8 + bayer_rggb8 + bayer_gbrg8 + bayer_grbg8 + bayer_bggr16le + bayer_bggr16be + bayer_rggb16le + bayer_rggb16be + bayer_gbrg16le + bayer_gbrg16be + bayer_grbg16le + bayer_grbg16be ayuv64le ayuv64be