This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit d728f3c808ce244cd8f4099214f77d14b1462138
Author:     Andreas Rheinhardt <[email protected]>
AuthorDate: Fri Apr 3 17:32:11 2026 +0200
Commit:     Andreas Rheinhardt <[email protected]>
CommitDate: Wed Apr 8 20:59:56 2026 +0200

    tests/checkasm/rv34dsp: Add test for rv34_idct_add
    
    Reviewed-by: Lynne <[email protected]>
    Signed-off-by: Andreas Rheinhardt <[email protected]>
---
 tests/checkasm/rv34dsp.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 51 insertions(+), 1 deletion(-)

diff --git a/tests/checkasm/rv34dsp.c b/tests/checkasm/rv34dsp.c
index efb4ce913b..dc4cc2f31a 100644
--- a/tests/checkasm/rv34dsp.c
+++ b/tests/checkasm/rv34dsp.c
@@ -18,9 +18,15 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#include "libavutil/mem.h"
+#include <stddef.h>
+#include <stdint.h>
+#include <string.h>
+
+#include "libavutil/intreadwrite.h"
+#include "libavutil/macros.h"
 #include "libavutil/mem_internal.h"
 
+#include "libavcodec/mathops.h"
 #include "libavcodec/rv34dsp.h"
 
 #include "checkasm.h"
@@ -77,6 +83,49 @@ static void test_rv34_idct_dc_add(RV34DSPContext *s) {
     report("rv34_idct_dc_add");
 }
 
+static void test_rv34_idct_add(const RV34DSPContext *const s)
+{
+    enum {
+        MAX_STRIDE = 256, ///< arbitrary, should be divisible by four
+    };
+    declare_func_emms(AV_CPU_FLAG_MMXEXT, void, uint8_t *dst, ptrdiff_t 
stride, int16_t *block);
+
+    if (check_func(s->rv34_idct_add, "rv34_idct_add")) {
+        DECLARE_ALIGNED_16(int16_t, block_ref)[4*4];
+        DECLARE_ALIGNED_16(int16_t, block_new)[4*4];
+
+        DECLARE_ALIGNED_4(uint8_t, dst_ref)[4*MAX_STRIDE + 4];
+        DECLARE_ALIGNED_4(uint8_t, dst_new)[4*MAX_STRIDE + 4];
+
+        ptrdiff_t stride = FFALIGN(1 + rnd() % MAX_STRIDE, 4);
+        uint8_t *dst_refp = dst_ref, *dst_newp = dst_new;
+
+        if (rnd() & 1) { // negate stride
+            dst_refp += 3 * stride;
+            dst_newp += 3 * stride;
+            stride    = -stride;
+        }
+
+        for (size_t i = 0; i < FF_ARRAY_ELEMS(block_ref); ++i)
+            block_ref[i] = sign_extend(rnd(), 10);
+        for (size_t i = 0; i < sizeof(dst_ref); i += 4)
+            AV_WN32A(dst_ref + i, rnd());
+        memcpy(block_new, block_ref, sizeof(block_new));
+        memcpy(dst_new, dst_ref, sizeof(dst_new));
+
+        call_ref(dst_refp, stride, block_ref);
+        call_new(dst_newp, stride, block_new);
+
+        if (memcmp(dst_ref, dst_new, sizeof(dst_new)) ||
+            memcmp(block_ref, block_new, sizeof(block_new)))
+            fail();
+
+        bench_new(dst_new, stride, block_new);
+    }
+
+    report("rv34_idct_add");
+}
+
 void checkasm_check_rv34dsp(void)
 {
     RV34DSPContext s = { 0 };
@@ -84,4 +133,5 @@ void checkasm_check_rv34dsp(void)
 
     test_rv34_inv_transform_dc(&s);
     test_rv34_idct_dc_add(&s);
+    test_rv34_idct_add(&s);
 }

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

Reply via email to