Commit 821902ddf6 for ffmpeg
commit 821902ddf67e9a1e8c9c5da78d172074c23585d9
Author: Devin Heitmueller <dheitmueller@ltnglobal.com>
Date: Wed Sep 16 14:50:36 2026 -0400
checkasm: add bitpacked decoder test
Compare packed input and all three output planes across the NEON block sizes, scalar-tail widths, and a 3840-pixel benchmark case.
diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile
index 062058f778..05409adde0 100644
--- a/tests/checkasm/Makefile
+++ b/tests/checkasm/Makefile
@@ -36,6 +36,7 @@ AVCODECOBJS-$(CONFIG_AAC_DECODER) += aacpsdsp.o \
AVCODECOBJS-$(CONFIG_AAC_ENCODER) += aacencdsp.o
AVCODECOBJS-$(CONFIG_ALAC_DECODER) += alacdsp.o
AVCODECOBJS-$(CONFIG_APV_DECODER) += apv_dsp.o
+AVCODECOBJS-$(CONFIG_BITPACKED_DECODER) += bitpackeddec.o
AVCODECOBJS-$(CONFIG_CAVS_DECODER) += cavsdsp.o
AVCODECOBJS-$(CONFIG_DCA_DECODER) += dcadsp.o synth_filter.o
AVCODECOBJS-$(CONFIG_DIRAC_DECODER) += diracdsp.o
diff --git a/tests/checkasm/bitpackeddec.c b/tests/checkasm/bitpackeddec.c
new file mode 100644
index 0000000000..00b9a9e312
--- /dev/null
+++ b/tests/checkasm/bitpackeddec.c
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2026 Devin Heitmueller <dheitmueller@ltnglobal.com>
+ *
+ * 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 "libavutil/mem_internal.h"
+
+#include "checkasm.h"
+#include "libavcodec/bitpacked_dec_init.h"
+
+#define MAX_WIDTH 3840
+
+static void randomize_buffers(uint8_t *src0, uint8_t *src1, int len)
+{
+ for (int i = 0; i < len; i++) {
+ uint8_t value = rnd();
+ src0[i] = value;
+ src1[i] = value;
+ }
+}
+
+void checkasm_check_bitpackeddec(void)
+{
+ static const int widths[] = { 8, 16, 24, 32, 40, 48, 56, MAX_WIDTH };
+ static const int tail_widths[] = { 2, 6, 10, 14, 16 };
+ struct BitpackedContext h;
+
+ ff_bitpackeddec_init(&h);
+
+ if (check_func(h.unpack_yuv422p10, "bitpacked_unpack_yuv422p10")) {
+ LOCAL_ALIGNED_16(uint8_t, src0, [MAX_WIDTH * 5 / 2]);
+ LOCAL_ALIGNED_16(uint8_t, src1, [MAX_WIDTH * 5 / 2]);
+ LOCAL_ALIGNED_16(uint16_t, y0, [MAX_WIDTH]);
+ LOCAL_ALIGNED_16(uint16_t, y1, [MAX_WIDTH]);
+ LOCAL_ALIGNED_16(uint16_t, u0, [MAX_WIDTH / 2]);
+ LOCAL_ALIGNED_16(uint16_t, u1, [MAX_WIDTH / 2]);
+ LOCAL_ALIGNED_16(uint16_t, v0, [MAX_WIDTH / 2]);
+ LOCAL_ALIGNED_16(uint16_t, v1, [MAX_WIDTH / 2]);
+ declare_func(void, const uint8_t *src, uint16_t *y, uint16_t *u,
+ uint16_t *v, int width);
+
+ for (int i = 0; i < FF_ARRAY_ELEMS(widths); i++) {
+ const int width = widths[i];
+ const int src_size = width * 5 / 2;
+
+ randomize_buffers(src0, src1, src_size);
+ memset(y0, 0, width * sizeof(*y0));
+ memset(y1, 0, width * sizeof(*y1));
+ memset(u0, 0, width / 2 * sizeof(*u0));
+ memset(u1, 0, width / 2 * sizeof(*u1));
+ memset(v0, 0, width / 2 * sizeof(*v0));
+ memset(v1, 0, width / 2 * sizeof(*v1));
+
+ call_ref(src0, y0, u0, v0, width);
+ call_new(src1, y1, u1, v1, width);
+ if (memcmp(src0, src1, src_size) ||
+ memcmp(y0, y1, width * sizeof(*y0)) ||
+ memcmp(u0, u1, width / 2 * sizeof(*u0)) ||
+ memcmp(v0, v1, width / 2 * sizeof(*v0)))
+ fail();
+ }
+
+ for (int i = 0; i < FF_ARRAY_ELEMS(tail_widths); i++) {
+ const int width = tail_widths[i];
+ const int bulk = width & ~7;
+ const int src_size = width * 5 / 2;
+
+ randomize_buffers(src0, src1, src_size);
+ bitpacked_unpack_yuv422p10_c(src0, y0, u0, v0, width);
+ if (bulk)
+ h.unpack_yuv422p10(src1, y1, u1, v1, bulk);
+ bitpacked_unpack_yuv422p10_c(src1 + bulk * 5 / 2,
+ y1 + bulk, u1 + bulk / 2, v1 + bulk / 2,
+ width - bulk);
+ if (memcmp(src0, src1, src_size) ||
+ memcmp(y0, y1, width * sizeof(*y0)) ||
+ memcmp(u0, u1, width / 2 * sizeof(*u0)) ||
+ memcmp(v0, v1, width / 2 * sizeof(*v0)))
+ fail();
+ }
+
+ randomize_buffers(src0, src1, MAX_WIDTH * 5 / 2);
+ bench_new(src1, y1, u1, v1, MAX_WIDTH);
+ }
+ report("bitpacked_unpack_yuv422p10");
+}
diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
index 3d34df656e..84fed79ebb 100644
--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -78,6 +78,9 @@ static const CheckasmTest tests[] = {
#if CONFIG_AUDIODSP
{ "audiodsp", checkasm_check_audiodsp },
#endif
+ #if CONFIG_BITPACKED_DECODER
+ { "bitpackeddec", checkasm_check_bitpackeddec },
+ #endif
#if CONFIG_BLOCKDSP
{ "blockdsp", checkasm_check_blockdsp },
#endif
diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h
index e45befb05b..5f7187d0fa 100644
--- a/tests/checkasm/checkasm.h
+++ b/tests/checkasm/checkasm.h
@@ -40,6 +40,7 @@ void checkasm_check_apv_dsp(void);
void checkasm_check_audiodsp(void);
void checkasm_check_av_tx(void);
void checkasm_check_base64(void);
+void checkasm_check_bitpackeddec(void);
void checkasm_check_blackdetect(void);
void checkasm_check_blend(void);
void checkasm_check_blockdsp(void);
diff --git a/tests/fate/checkasm.mak b/tests/fate/checkasm.mak
index 0ceebbe3d1..5a58f9fcd2 100644
--- a/tests/fate/checkasm.mak
+++ b/tests/fate/checkasm.mak
@@ -9,6 +9,7 @@ FATE_CHECKASM = fate-checkasm-aacencdsp \
fate-checkasm-audiodsp \
fate-checkasm-av_tx \
fate-checkasm-base64 \
+ fate-checkasm-bitpackeddec \
fate-checkasm-blockdsp \
fate-checkasm-bswapdsp \
fate-checkasm-cavsdsp \