On Wed, 9 Dec 2015, Janne Grunau wrote:

---
tests/checkasm/checkasm.h   |   1 +
tests/checkasm/checkasm.c   |   3 ++
tests/checkasm/fmtconvert.c | 107 ++++++++++++++++++++++++++++++++++++++++++++
tests/checkasm/Makefile     |   1 +
4 files changed, 112 insertions(+)
create mode 100644 tests/checkasm/fmtconvert.c

diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h
index 9d8e697..7785f91 100644
--- a/tests/checkasm/checkasm.h
+++ b/tests/checkasm/checkasm.h
@@ -31,6 +31,7 @@

void checkasm_check_bswapdsp(void);
void checkasm_check_dcadsp(void);
+void checkasm_check_fmtconvert(void);
void checkasm_check_h264pred(void);
void checkasm_check_h264qpel(void);
void checkasm_check_hevc_mc(void);
diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
index c61e4d4..d6f8ffc 100644
--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -65,6 +65,9 @@ static const struct {
    { "dcadsp", checkasm_check_dcadsp },
    { "synth_filter", checkasm_check_synth_filter },
#endif
+#if CONFIG_FMTCONVERT
+    { "fmtconvert", checkasm_check_fmtconvert },
+#endif
#if CONFIG_H264PRED
    { "h264pred", checkasm_check_h264pred },
#endif
diff --git a/tests/checkasm/fmtconvert.c b/tests/checkasm/fmtconvert.c
new file mode 100644
index 0000000..324c517
--- /dev/null
+++ b/tests/checkasm/fmtconvert.c
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2015 Janne Grunau
+ *
+ * This file is part of Libav.
+ *
+ * Libav 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.
+ *
+ * Libav 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 Libav; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <math.h>
+#include <stdint.h>
+#include <string.h>
+
+#include "libavutil/internal.h"
+#include "libavutil/common.h"
+#include "libavcodec/fmtconvert.h"
+
+#include "checkasm.h"
+
+#define BUF_SIZE 1024
+
+#define randomize_input(len)                                    \
+    do {                                                        \
+        int k;                                                  \
+        for (k = 0; k < len; k++) {                             \
+            in[k] = rnd() - INT32_MAX;                         \
+        }                                                       \
+        for (     ; k < BUF_SIZE; k++) {                        \
+            in[k] = INT32_MAX;                                  \
+        }                                                       \
+    } while (0)
+
+void checkasm_check_fmtconvert(void)
+{
+    FmtConvertContext c;
+    LOCAL_ALIGNED(32, float,   dst0, [BUF_SIZE]);
+    LOCAL_ALIGNED(32, float,   dst1, [BUF_SIZE]);
+    LOCAL_ALIGNED(32, int32_t, in,   [BUF_SIZE]);
+    float scale_arr[128];
+    int length[] = {8, 16, 24, 56, 72, 128, 512, 520, 656, 768, 992};
+    int i, j;
+
+    for (i = 0; i < FF_ARRAY_ELEMS(scale_arr); i++)
+        scale_arr[i] = (FF_ARRAY_ELEMS(scale_arr) - FF_ARRAY_ELEMS(scale_arr) 
/ 2) / 13;
+
+    ff_fmt_convert_init(&c, NULL);
+
+    memset(dst0, 0, sizeof(*dst0) * BUF_SIZE);
+    memset(dst1, 0, sizeof(*dst1) * BUF_SIZE);
+
+    if (1 && check_func(c.int32_to_float_fmul_scalar, 
"int32_to_float_fmul_scalar")) {

Leftover "1 &&"?

+
+        declare_func(void, float *, const int32_t *, float, int);
+
+        for (i = 0; i < FF_ARRAY_ELEMS(scale_arr); i++) {
+        for (j = 0; j < FF_ARRAY_ELEMS(length); j++) {

Indentation?

The rest seems good.

// Martin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to