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

Frank Plowman via ffmpeg-devel <[email protected]>
Newsgroups gmane.comp.video.ffmpeg.devel
Message-ID <[email protected]>
On 25/07/2026 22:36, Gudikandula Samith via ffmpeg-devel wrote:
> 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);

We should declare top0, top1, left0 and left1 instead of calling
randomize_buffers with buf0 == buf1, so that call_ref can't modify
call_new's input, even though pred_planar doesn't act in-place.

> +
> +    for (int h = 4; h <= 64; h <<= 1) {
> +        for (int w = 4; w <= 64; w <<= 1) {

Could we use MIN_TU_TIZE/MAX_TB_SIZE here instead of magic constants.

> +            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();

This can be replaced with checkasm_check_pixel for a better readout in
the checkasm CLI.

> +                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");
> +}


_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.