[FFmpeg-devel] [PATCH] checkasm/huffyuvdsp: test for add_hfyu_left_pred_bgr32

Rémi Denis-Courmont remi at remlab.net
Sun Nov 12 15:42:02 EET 2023


---
 tests/checkasm/huffyuvdsp.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/tests/checkasm/huffyuvdsp.c b/tests/checkasm/huffyuvdsp.c
index 6ba27e267f..a08f5a8391 100644
--- a/tests/checkasm/huffyuvdsp.c
+++ b/tests/checkasm/huffyuvdsp.c
@@ -64,6 +64,34 @@ static void check_add_int16(HuffYUVDSPContext *c, unsigned mask, int width, cons
     av_free(dst1);
 }
 
+static void check_add_hfyu_left_pred_bgr32(HuffYUVDSPContext *c)
+{
+#define BUF_SIZE 1080
+    uint8_t src[4 * BUF_SIZE], dst0[4 * BUF_SIZE], dst1[4 * BUF_SIZE];
+    uint8_t left[4], left0[4], left1[4];
+
+    declare_func(void, uint8_t *d, const uint8_t *s, intptr_t w, uint8_t *l);
+
+    randomize_buffers(src, sizeof (src));
+    randomize_buffers(left, sizeof (left));
+    memcpy(left0, left, sizeof (left));
+    memcpy(left1, left, sizeof (left));
+
+    if (check_func(c->add_hfyu_left_pred_bgr32, "add_hfyu_left_pred_bgr32")) {
+        call_ref(dst0, src, BUF_SIZE, left0);
+        call_new(dst1, src, BUF_SIZE, left1);
+
+        if (memcmp(dst0, dst1, sizeof (dst0)) != 0 ||
+            memcmp(left0, left1, sizeof (left0)) != 0) {
+            fail();
+        }
+
+        bench_new(dst1, src, BUF_SIZE, left);
+    }
+
+    report("add_hfyu_left_pred_bgr32");
+}
+
 void checkasm_check_huffyuvdsp(void)
 {
     HuffYUVDSPContext c;
@@ -78,4 +106,6 @@ void checkasm_check_huffyuvdsp(void)
     /*! test always with the same size (for perf test) */
     check_add_int16(&c, 65535, 16*128, "add_int16_128");
     report("add_int16_128");
+
+    check_add_hfyu_left_pred_bgr32(&c);
 }
-- 
2.42.0



More information about the ffmpeg-devel mailing list