[FFmpeg-cvslog] swscale/tests/swscale: Implement isALPHA() using AVPixFmtDescriptor

Michael Niedermayer git at videolan.org
Fri Feb 16 00:08:53 EET 2024


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Wed Feb 14 21:43:27 2024 +0100| [1055ece30b9d1d0b457306441837dadcc22e727d] | committer: Michael Niedermayer

swscale/tests/swscale: Implement isALPHA() using AVPixFmtDescriptor

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1055ece30b9d1d0b457306441837dadcc22e727d
---

 libswscale/tests/swscale.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/libswscale/tests/swscale.c b/libswscale/tests/swscale.c
index 6c38041ddb..f853bc4c91 100644
--- a/libswscale/tests/swscale.c
+++ b/libswscale/tests/swscale.c
@@ -48,12 +48,12 @@
     (!(isGray(x)                ||     \
        (x) == AV_PIX_FMT_MONOBLACK ||     \
        (x) == AV_PIX_FMT_MONOWHITE))
-#define isALPHA(x)                     \
-    ((x) == AV_PIX_FMT_BGR32   ||         \
-     (x) == AV_PIX_FMT_BGR32_1 ||         \
-     (x) == AV_PIX_FMT_RGB32   ||         \
-     (x) == AV_PIX_FMT_RGB32_1 ||         \
-     (x) == AV_PIX_FMT_YUVA420P)
+
+static av_always_inline int isALPHA(enum AVPixelFormat pix_fmt)
+{
+    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+    return desc->flags & AV_PIX_FMT_FLAG_ALPHA;
+}
 
 static uint64_t getSSD(const uint8_t *src1, const uint8_t *src2,
                        int stride1, int stride2, int w, int h)



More information about the ffmpeg-cvslog mailing list