aboutsummaryrefslogtreecommitdiffstats
path: root/tests/checkasm/h264dsp.c
diff options
context:
space:
mode:
authorTristan Matthews <tmatth@videolan.org>2025-06-13 10:04:46 -0400
committerMichael Niedermayer <michael@niedermayer.cc>2025-06-16 01:31:45 +0200
commit0d9f680b698b12f89d76ea5848cc2af24373dd18 (patch)
tree45773c14d570a8819aaf6516e6e36fb50393cb6e /tests/checkasm/h264dsp.c
parent5ea3adfcf92a7e229e740a4853893756b802d664 (diff)
downloadffmpeg-0d9f680b698b12f89d76ea5848cc2af24373dd18.tar.gz
checkasm: h264dsp: test luma_dc_dequant
Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'tests/checkasm/h264dsp.c')
-rw-r--r--tests/checkasm/h264dsp.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/checkasm/h264dsp.c b/tests/checkasm/h264dsp.c
index d1228ed985..f5f9650224 100644
--- a/tests/checkasm/h264dsp.c
+++ b/tests/checkasm/h264dsp.c
@@ -22,6 +22,7 @@
#include "checkasm.h"
#include "libavcodec/h264dsp.h"
#include "libavcodec/h264data.h"
+#include "libavcodec/h264idct.h"
#include "libavcodec/h264_parse.h"
#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
@@ -324,6 +325,41 @@ static void check_idct_multiple(void)
}
}
+static void check_idct_dequant(void)
+{
+ static const int depths[5] = { 8, 9, 10, 12, 14 };
+ LOCAL_ALIGNED_16(int16_t, src, [16]);
+ /* Ensure dst buffers are large enough to hold dctcoefs of all bit-depths. */
+ LOCAL_ALIGNED_16(uint8_t, dst0, [16 * 16 * sizeof(int32_t)]);
+ LOCAL_ALIGNED_16(uint8_t, dst1, [16 * 16 * sizeof(int32_t)]);
+ int16_t *dst_ref = (int16_t *)dst0;
+ int16_t *dst_new = (int16_t *)dst1;
+ H264DSPContext h;
+ int bit_depth, i, qmul;
+ declare_func_emms(AV_CPU_FLAG_MMX | AV_CPU_FLAG_SSE2, void, int16_t *output, int16_t *input, int qmul);
+
+ for (int j = 0; j < 16; j++)
+ src[j] = (rnd() % 512) - 256;
+
+ qmul = rnd() % 4096;
+
+ for (i = 0; i < FF_ARRAY_ELEMS(depths); i++) {
+ bit_depth = depths[i];
+ ff_h264dsp_init(&h, bit_depth, 1);
+
+ memset(dst0, 0, 16 * 16 * SIZEOF_COEF);
+ memset(dst1, 0, 16 * 16 * SIZEOF_COEF);
+
+ if (check_func(h.h264_luma_dc_dequant_idct, "h264_luma_dc_dequant_idct_%d", bit_depth)) {
+
+ call_ref(dst_ref, src, qmul);
+ call_new(dst_new, src, qmul);
+ checkasm_check_dctcoef(dst_ref, 16*SIZEOF_COEF, dst_new, 16*SIZEOF_COEF, 16, 16, "dst");
+ bench_new(dst_new, src, qmul);
+ }
+ }
+}
+
static void check_loop_filter(void)
{
@@ -453,6 +489,7 @@ void checkasm_check_h264dsp(void)
{
check_idct();
check_idct_multiple();
+ check_idct_dequant();
report("idct");
check_loop_filter();