[PATCH 1/2] tests/checkasm: add vvc_intra test for pred_planar

Gudikandula Samith via ffmpeg-devel <[email protected]> Sat, 25 Jul 2026 21:36:57 +0000
Newsgroups gmane.comp.video.ffmpeg.devel
Message-ID <[email protected]>
Adds a checkasm test for the VVC planar intra prediction kernel,
covering block sizes from 4x4 to 64x64 at 8, 10 and 12 bit.

There is currently no SIMD implementation of this kernel on any
architecture; this test is a prerequisite for adding one.

Signed-off-by: Gudikandula Samith <[email protected]>
---
 tests/checkasm/Makefile    |  2 +-
 tests/checkasm/checkasm.c  |  7 +--
 tests/checkasm/checkasm.h  |  1 +
 tests/checkasm/vvc_intra.c | 87 ++++++++++++++++++++++++++++++++++++++
 4 files changed, 93 insertions(+), 4 deletions(-)
 create mode 100644 tests/checkasm/vvc_intra.c

diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile
index c154d19ed4..b28530fbd2 100644
--- a/tests/checkasm/Makefile
+++ b/tests/checkasm/Makefile
@@ -61,7 +61,7 @@ AVCODECOBJS-$(CONFIG_V210_ENCODER)      += v210enc.o
 AVCODECOBJS-$(CONFIG_VORBIS_DECODER)    += vorbisdsp.o
 AVCODECOBJS-$(CONFIG_VP6_DECODER)       += vp6dsp.o
 AVCODECOBJS-$(CONFIG_VP9_DECODER)       += vp9dsp.o
-AVCODECOBJS-$(CONFIG_VVC_DECODER)       += vvc_alf.o vvc_mc.o vvc_sao.o
+AVCODECOBJS-$(CONFIG_VVC_DECODER)       += vvc_alf.o vvc_intra.o vvc_mc.o vvc_sao.o
 
 CHECKASMOBJS-$(CONFIG_AVCODEC)          += $(AVCODECOBJS-yes)
 
diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
index a8cad59d4c..a565117630 100644
--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -233,9 +233,10 @@ static const CheckasmTest tests[] = {
         { "vorbisdsp", checkasm_check_vorbisdsp },
     #endif
     #if CONFIG_VVC_DECODER
-        { "vvc_alf", checkasm_check_vvc_alf },
-        { "vvc_mc",  checkasm_check_vvc_mc  },
-        { "vvc_sao", checkasm_check_vvc_sao },
+        { "vvc_alf",   checkasm_check_vvc_alf   },
+        { "vvc_intra", checkasm_check_vvc_intra },
+        { "vvc_mc",    checkasm_check_vvc_mc    },
+        { "vvc_sao",   checkasm_check_vvc_sao   },
     #endif
 #endif
 #if CONFIG_AVFILTER
diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h
index b473c5d711..8617ae54f7 100644
--- a/tests/checkasm/checkasm.h
+++ b/tests/checkasm/checkasm.h
@@ -130,6 +130,7 @@ void checkasm_check_vp9dsp(void);
 void checkasm_check_videodsp(void);
 void checkasm_check_vorbisdsp(void);
 void checkasm_check_vvc_alf(void);
+void checkasm_check_vvc_intra(void);
 void checkasm_check_vvc_mc(void);
 void checkasm_check_vvc_sao(void);
 
diff --git a/tests/checkasm/vvc_intra.c b/tests/checkasm/vvc_intra.c
new file mode 100644
index 0000000000..eba474dbef
--- /dev/null
+++ b/tests/checkasm/vvc_intra.c
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2026 Gudikandula Samith <[email protected]>
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <string.h>
+
+#include "checkasm.h"
+#include "libavcodec/vvc/ctu.h"
+#include "libavcodec/vvc/dsp.h"
+
+#include "libavutil/common.h"
+#include "libavutil/intreadwrite.h"
+#include "libavutil/mem_internal.h"
+
+static const uint32_t pixel_mask[3] = { 0xffffffff, 0x03ff03ff, 0x0fff0fff };
+
+#define SIZEOF_PIXEL ((bit_depth + 7) / 8)
+#define BUF_STRIDE   (MAX_TB_SIZE * 2)
+#define BUF_SIZE     (BUF_STRIDE * MAX_TB_SIZE)
+
+#define randomize_buffers(buf0, buf1, size)                 \
+    do {                                                    \
+        uint32_t mask = pixel_mask[(bit_depth - 8) >> 1];   \
+        for (int k = 0; k < size; k += 4) {                 \
+            uint32_t r = rnd() & mask;                      \
+            AV_WN32A(buf0 + k, r);                          \
+            AV_WN32A(buf1 + k, r);                          \
+        }                                                   \
+    } while (0)
+
+static void check_pred_planar(VVCDSPContext *c, const int bit_depth)
+{
+    LOCAL_ALIGNED_32(uint8_t, dst0, [BUF_SIZE]);
+    LOCAL_ALIGNED_32(uint8_t, dst1, [BUF_SIZE]);
+    LOCAL_ALIGNED_32(uint8_t, top,  [(MAX_TB_SIZE + 1) * 2]);
+    LOCAL_ALIGNED_32(uint8_t, left, [(MAX_TB_SIZE + 1) * 2]);
+
+    const ptrdiff_t stride = BUF_STRIDE / SIZEOF_PIXEL;
+
+    declare_func(void, uint8_t *src, const uint8_t *top, const uint8_t *left,
+                 int w, int h, ptrdiff_t stride);
+
+    randomize_buffers(top,  top,  (MAX_TB_SIZE + 1) * 2);
+    randomize_buffers(left, left, (MAX_TB_SIZE + 1) * 2);
+
+    for (int h = 4; h <= 64; h <<= 1) {
+        for (int w = 4; w <= 64; w <<= 1) {
+            if (check_func(c->intra.pred_planar,
+                           "vvc_pred_planar_%dx%d_%d", w, h, bit_depth)) {
+                memset(dst0, 0, BUF_SIZE);
+                memset(dst1, 0, BUF_SIZE);
+                call_ref(dst0, top, left, w, h, stride);
+                call_new(dst1, top, left, w, h, stride);
+                if (memcmp(dst0, dst1, BUF_SIZE))
+                    fail();
+                bench_new(dst1, top, left, w, h, stride);
+            }
+        }
+    }
+}
+
+void checkasm_check_vvc_intra(void)
+{
+    VVCDSPContext h;
+
+    for (int bit_depth = 8; bit_depth <= 12; bit_depth += 2) {
+        ff_vvc_dsp_init(&h, bit_depth);
+        check_pred_planar(&h, bit_depth);
+    }
+    report("pred_planar");
+}
-- 
2.53.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]