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

Git pushed a commit to branch master
in repository ffmpeg.

commit fd44e277c84c349b18cbd41245587f9dd8a7261c
Author:     Andreas Rheinhardt <[email protected]>
AuthorDate: Wed Feb 25 21:38:30 2026 +0100
Commit:     Andreas Rheinhardt <[email protected]>
CommitDate: Sun Mar 1 11:56:57 2026 +0100

    tests/checkasm: Add huffyuvencdsp test
    
    Only covers sub_hfyu_median_pred_int16 for now.
    
    Signed-off-by: Andreas Rheinhardt <[email protected]>
---
 tests/checkasm/Makefile        |  1 +
 tests/checkasm/checkasm.c      |  3 ++
 tests/checkasm/checkasm.h      |  1 +
 tests/checkasm/huffyuvencdsp.c | 89 ++++++++++++++++++++++++++++++++++++++++++
 tests/fate/checkasm.mak        |  1 +
 5 files changed, 95 insertions(+)

diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile
index 48de4d22a0..491bde2a7a 100644
--- a/tests/checkasm/Makefile
+++ b/tests/checkasm/Makefile
@@ -13,6 +13,7 @@ AVCODECOBJS-$(CONFIG_H264DSP)           += h264dsp.o
 AVCODECOBJS-$(CONFIG_H264PRED)          += h264pred.o
 AVCODECOBJS-$(CONFIG_H264QPEL)          += h264qpel.o
 AVCODECOBJS-$(CONFIG_HPELDSP)           += hpeldsp.o
+AVCODECOBJS-$(CONFIG_HUFFYUVENCDSP)     += huffyuvencdsp.o
 AVCODECOBJS-$(CONFIG_IDCTDSP)           += idctdsp.o
 AVCODECOBJS-$(CONFIG_LLAUDDSP)          += llauddsp.o
 AVCODECOBJS-$(CONFIG_LLVIDDSP)          += llviddsp.o
diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
index bdaaa8695d..38bd1edce7 100644
--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -198,6 +198,9 @@ static const struct {
     #if CONFIG_HUFFYUV_DECODER
         { "huffyuvdsp", checkasm_check_huffyuvdsp },
     #endif
+    #if CONFIG_HUFFYUVENCDSP
+        { "huffyuvencdsp", checkasm_check_huffyuvencdsp },
+    #endif
     #if CONFIG_IDCTDSP
         { "idctdsp", checkasm_check_idctdsp },
     #endif
diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h
index 9495c9e19a..568b40530c 100644
--- a/tests/checkasm/checkasm.h
+++ b/tests/checkasm/checkasm.h
@@ -116,6 +116,7 @@ void checkasm_check_hevc_pel(void);
 void checkasm_check_hevc_sao(void);
 void checkasm_check_hpeldsp(void);
 void checkasm_check_huffyuvdsp(void);
+void checkasm_check_huffyuvencdsp(void);
 void checkasm_check_idctdsp(void);
 void checkasm_check_idet(void);
 void checkasm_check_jpeg2000dsp(void);
diff --git a/tests/checkasm/huffyuvencdsp.c b/tests/checkasm/huffyuvencdsp.c
new file mode 100644
index 0000000000..049a7d126b
--- /dev/null
+++ b/tests/checkasm/huffyuvencdsp.c
@@ -0,0 +1,89 @@
+/*
+ * 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 <stddef.h>
+#include <stdint.h>
+#include <string.h>
+
+#include "checkasm.h"
+#include "libavcodec/huffyuvencdsp.h"
+#include "libavutil/cpu.h"
+#include "libavutil/macros.h"
+#include "libavutil/mem_internal.h"
+
+enum {
+    MAX_WIDTH = 4096,   ///< maximum test width, must be a power of two 
smaller than the maximum alignment
+};
+
+#define randomize_buffers(buf, size, mask) \
+    do {                                   \
+        for (size_t j = 0; j < size; ++j)  \
+            buf[j] = rnd() & mask;         \
+    } while (0)
+
+
+static void check_sub_hfyu_median_pred_int16(const char *aligned, unsigned 
width)
+{
+    static const int bpps[] = { 9, 16, };
+    HuffYUVEncDSPContext c;
+
+    declare_func_emms(AV_CPU_FLAG_MMXEXT, void, uint16_t *dst, const uint16_t 
*src1,
+                      const uint16_t *src2, unsigned mask, int w, int *left, 
int *left_top);
+
+    for (size_t i = 0; i < FF_ARRAY_ELEMS(bpps); ++i) {
+        const int bpp = bpps[i];
+
+        ff_huffyuvencdsp_init(&c, bpp);
+
+        if (check_func(c.sub_hfyu_median_pred_int16, 
"sub_hfyu_median_pred_int16_%dbpp%s", bpp, aligned)) {
+            DECLARE_ALIGNED(32, uint16_t, dst0)[MAX_WIDTH];
+            DECLARE_ALIGNED(32, uint16_t, dst1)[MAX_WIDTH];
+            uint16_t src1[MAX_WIDTH];
+            uint16_t src2[MAX_WIDTH];
+            const unsigned mask = (1 << bpp) - 1;
+            int l1 = rnd() & mask, lt1 = rnd() & mask, l2 = l1, lt2 = lt1;
+
+            randomize_buffers(src1, width, mask);
+            randomize_buffers(src2, width, mask);
+
+            call_ref(dst0, src1, src2, mask, width, &l1, &lt1);
+            call_new(dst1, src1, src2, mask, width, &l2, &lt2);
+            if (l1 != l2 || lt1 != lt2 || memcmp(dst0, dst1, width * 
sizeof(dst0[0])))
+                fail();
+            bench_new(dst1, src1, src2, mask, width, &l2, &lt2);
+        }
+    }
+}
+
+void checkasm_check_huffyuvencdsp(void)
+{
+    static unsigned width = 0;
+
+    if (!width) {
+        width = rnd() % MAX_WIDTH;
+        width = width ? width : 1;
+    }
+
+    const size_t align = av_cpu_max_align();
+
+    check_sub_hfyu_median_pred_int16("_aligned", FFALIGN(width, align / 
sizeof(uint16_t)));
+    report("sub_hfyu_median_pred_int16_aligned");
+
+    check_sub_hfyu_median_pred_int16("", width);
+    report("sub_hfyu_median_pred_int16");
+}
diff --git a/tests/fate/checkasm.mak b/tests/fate/checkasm.mak
index 16c6f1f775..b05dc61f67 100644
--- a/tests/fate/checkasm.mak
+++ b/tests/fate/checkasm.mak
@@ -33,6 +33,7 @@ FATE_CHECKASM = fate-checkasm-aacencdsp                       
          \
                 fate-checkasm-hevc_sao                                  \
                 fate-checkasm-hpeldsp                                   \
                 fate-checkasm-huffyuvdsp                                \
+                fate-checkasm-huffyuvencdsp                             \
                 fate-checkasm-idctdsp                                   \
                 fate-checkasm-jpeg2000dsp                               \
                 fate-checkasm-llauddsp                                  \

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

Reply via email to