diff mbox series

[FFmpeg-devel,1/7] swscale/tests/swscale: Implement isALPHA() using AVPixFmtDescriptor

Message ID 20240214220631.9641-1-michael@niedermayer.cc
State Accepted
Commit 1055ece30b9d1d0b457306441837dadcc22e727d
Headers show
Series [FFmpeg-devel,1/7] swscale/tests/swscale: Implement isALPHA() using AVPixFmtDescriptor | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Michael Niedermayer Feb. 14, 2024, 10:06 p.m. UTC
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libswscale/tests/swscale.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Anton Khirnov Feb. 15, 2024, 6:20 a.m. UTC | #1
I remember wondering why was this not run as a FATE test.
Michael Niedermayer Feb. 15, 2024, 5:55 p.m. UTC | #2
On Thu, Feb 15, 2024 at 07:20:32AM +0100, Anton Khirnov wrote:
> I remember wondering why was this not run as a FATE test.

the full reference file is > 100mb and the full test takes longer than the
full fate test.

This patchset makes it possibly to run random subsets of the test
so its a step toward enabling this for fate

i will apply it

thx


[...]
diff mbox series

Patch

diff --git a/libswscale/tests/swscale.c b/libswscale/tests/swscale.c
index 6c38041ddb8..f853bc4c913 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)