Commit 3b3d8a4baa for ffmpeg

commit 3b3d8a4baa3c88d6425dd077274f1c5e06488c5d
Author: Rainbaby <r@bgr.jp>
Date:   Tue Nov 10 18:49:13 2026 +0900

    checkasm/cavsdsp: test cavs_idct8_add

    Coefficients span the whole int16_t range, so the clip of the first
    pass is reached. The old SSE2 version fails this.

    Signed-off-by: Rainbaby <r@bgr.jp>

diff --git a/tests/checkasm/cavsdsp.c b/tests/checkasm/cavsdsp.c
index 47c2510687..1969dda3ce 100644
--- a/tests/checkasm/cavsdsp.c
+++ b/tests/checkasm/cavsdsp.c
@@ -25,6 +25,7 @@
 #include "libavutil/macros.h"
 #include "libavutil/mem_internal.h"
 #include "libavcodec/cavsdsp.h"
+#include "libavcodec/idctdsp.h"


 enum {
@@ -114,8 +115,45 @@ static void check_cavs_qpeldsp(void)
     }
 }

+static void check_cavs_idct8_add(void)
+{
+    DECLARE_ALIGNED(16, int16_t, block0)[64];
+    DECLARE_ALIGNED(16, int16_t, block1)[64];
+    DECLARE_ALIGNED(16, uint8_t, dstbuf0)[8 * 16];
+    DECLARE_ALIGNED(16, uint8_t, dstbuf1)[8 * 16];
+    uint8_t permutation[64];
+    CAVSDSPContext cavsdsp;
+    declare_func(void, uint8_t *dst, int16_t *block, ptrdiff_t stride);
+
+    ff_cavsdsp_init(&cavsdsp);
+    ff_init_scantable_permutation(permutation, cavsdsp.idct_perm);
+
+    if (check_func(cavsdsp.cavs_idct8_add, "cavs_idct8_add")) {
+        for (int iter = 0; iter < 64; iter++) {
+            int n = 1 + rnd() % 64;
+
+            memset(block0, 0, sizeof(block0));
+            /* magnitudes from the whole int16_t range down to single digits */
+            for (int k = 0; k < n; k++)
+                block0[rnd() % 64] = (int16_t)rnd() >> (rnd() % 16);
+            /* the reference is the C version, which takes natural order */
+            for (int i = 0; i < 64; i++)
+                block1[permutation[i]] = block0[i];
+
+            randomize_buffers(dstbuf0, dstbuf1);
+            call_ref(dstbuf0, block0, 16);
+            call_new(dstbuf1, block1, 16);
+            if (memcmp(dstbuf0, dstbuf1, sizeof(dstbuf0)))
+                fail();
+        }
+        bench_new(dstbuf1, block1, 16);
+    }
+}
+
 void checkasm_check_cavsdsp(void)
 {
     check_cavs_qpeldsp();
     report("qpeldsp");
+    check_cavs_idct8_add();
+    report("idct8");
 }