Re: [FFmpeg-devel] [PATCH] checkasm: add fixed_dsp tests

2017-04-11 Thread James Almer
On 1/19/2016 7:33 PM, Michael Niedermayer wrote:
> On Tue, Jan 19, 2016 at 01:43:45PM -0300, James Almer wrote:
>> Signed-off-by: James Almer 
>> ---
>>  tests/checkasm/Makefile|   3 +
>>  tests/checkasm/checkasm.c  |   3 +
>>  tests/checkasm/checkasm.h  |   1 +
>>  tests/checkasm/fixed_dsp.c | 184 
>> +
>>  4 files changed, 191 insertions(+)
>>  create mode 100644 tests/checkasm/fixed_dsp.c
> 
> seems woking fine

Pushed (a year late).

Thanks.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] checkasm: add fixed_dsp tests

2016-01-19 Thread Michael Niedermayer
On Tue, Jan 19, 2016 at 02:01:58AM -0300, James Almer wrote:
> Signed-off-by: James Almer 
> ---
>  tests/checkasm/Makefile|   3 +
>  tests/checkasm/checkasm.c  |   3 +
>  tests/checkasm/checkasm.h  |   1 +
>  tests/checkasm/fixed_dsp.c | 169 
> +
>  4 files changed, 176 insertions(+)
>  create mode 100644 tests/checkasm/fixed_dsp.c

fails to build

make distclean ; ./configure && make -j12 fate-checkasm
tests/checkasm/fixed_dsp.c: In function ‘check_vector_fmul’:
tests/checkasm/fixed_dsp.c:53:5: error: format not a string literal and no 
format arguments [-Werror=format-security]
cc1: some warnings being treated as errors
make: *** [tests/checkasm/fixed_dsp.o] Error 1

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

It is dangerous to be right in matters on which the established authorities
are wrong. -- Voltaire


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] checkasm: add fixed_dsp tests

2016-01-19 Thread Michael Niedermayer
On Tue, Jan 19, 2016 at 01:43:45PM -0300, James Almer wrote:
> Signed-off-by: James Almer 
> ---
>  tests/checkasm/Makefile|   3 +
>  tests/checkasm/checkasm.c  |   3 +
>  tests/checkasm/checkasm.h  |   1 +
>  tests/checkasm/fixed_dsp.c | 184 
> +
>  4 files changed, 191 insertions(+)
>  create mode 100644 tests/checkasm/fixed_dsp.c

seems woking fine

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] checkasm: add fixed_dsp tests

2016-01-19 Thread James Almer
Signed-off-by: James Almer 
---
 tests/checkasm/Makefile|   3 +
 tests/checkasm/checkasm.c  |   3 +
 tests/checkasm/checkasm.h  |   1 +
 tests/checkasm/fixed_dsp.c | 184 +
 4 files changed, 191 insertions(+)
 create mode 100644 tests/checkasm/fixed_dsp.c

diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile
index e38d15b..698ceef 100644
--- a/tests/checkasm/Makefile
+++ b/tests/checkasm/Makefile
@@ -11,7 +11,10 @@ AVCODECOBJS-$(CONFIG_PIXBLOCKDSP) += pixblockdsp.o
 AVCODECOBJS-$(CONFIG_V210_ENCODER) += v210enc.o
 AVCODECOBJS-$(CONFIG_VP9_DECODER) += vp9dsp.o
 
+AVUTILOBJS += fixed_dsp.o
+
 CHECKASMOBJS-$(CONFIG_AVCODEC) += $(AVCODECOBJS-yes)
+CHECKASMOBJS-$(CONFIG_AVUTIL)  += $(AVUTILOBJS)
 
 
 -include $(SRC_PATH)/tests/checkasm/$(ARCH)/Makefile
diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
index 33c6d8c..0ae8d4c 100644
--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -64,6 +64,9 @@ static const struct {
 const char *name;
 void (*func)(void);
 } tests[] = {
+#if CONFIG_AVUTIL
+{ "fixed_dsp", checkasm_check_fixed_dsp },
+#endif
 #if CONFIG_AVCODEC
 #if CONFIG_ALAC_DECODER
 { "alacdsp", checkasm_check_alacdsp },
diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h
index bd17156..71d95f5 100644
--- a/tests/checkasm/checkasm.h
+++ b/tests/checkasm/checkasm.h
@@ -33,6 +33,7 @@
 void checkasm_check_alacdsp(void);
 void checkasm_check_bswapdsp(void);
 void checkasm_check_dcadsp(void);
+void checkasm_check_fixed_dsp(void);
 void checkasm_check_flacdsp(void);
 void checkasm_check_fmtconvert(void);
 void checkasm_check_h264pred(void);
diff --git a/tests/checkasm/fixed_dsp.c b/tests/checkasm/fixed_dsp.c
new file mode 100644
index 000..b3ea500
--- /dev/null
+++ b/tests/checkasm/fixed_dsp.c
@@ -0,0 +1,184 @@
+/*
+ * Copyright (c) 2015 James Almer
+ *
+ * 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 "checkasm.h"
+#include "libavutil/common.h"
+#include "libavutil/fixed_dsp.h"
+#include "libavutil/internal.h"
+#include "libavutil/mem.h"
+
+#define BUF_SIZE 256
+
+#define randomize_buffers()   \
+do {  \
+int i;\
+for (i = 0; i < BUF_SIZE; i++) {  \
+src0[i] = sign_extend(rnd(), 24); \
+src1[i] = sign_extend(rnd(), 24); \
+src2[i] = sign_extend(rnd(), 24); \
+} \
+} while (0)
+
+static void check_vector_fmul(const int *src0, const int *src1)
+{
+LOCAL_ALIGNED_32(int, ref, [BUF_SIZE]);
+LOCAL_ALIGNED_32(int, new, [BUF_SIZE]);
+
+declare_func(void, int *dst, const int *src0, const int *src1, int len);
+
+call_ref(ref, src0, src1, BUF_SIZE);
+call_new(new, src0, src1, BUF_SIZE);
+if (memcmp(ref, new, BUF_SIZE * sizeof(int)))
+fail();
+bench_new(new, src0, src1, BUF_SIZE);
+
+report("vector_fmul");
+}
+
+static void check_vector_fmul_add(const int *src0, const int *src1, const int 
*src2)
+{
+LOCAL_ALIGNED_32(int, ref, [BUF_SIZE]);
+LOCAL_ALIGNED_32(int, new, [BUF_SIZE]);
+
+declare_func(void, int *dst, const int *src0, const int *src1, const int 
*src2, int len);
+
+call_ref(ref, src0, src1, src2, BUF_SIZE);
+call_new(new, src0, src1, src2, BUF_SIZE);
+if (memcmp(ref, new, BUF_SIZE * sizeof(int)))
+fail();
+bench_new(new, src0, src1, src2, BUF_SIZE);
+
+report("vector_fmul_add");
+}
+
+static void check_vector_fmul_reverse(const int *src0, const int *src1)
+{
+LOCAL_ALIGNED_32(int, ref, [BUF_SIZE]);
+LOCAL_ALIGNED_32(int, new, [BUF_SIZE]);
+
+declare_func(void, int *dst, const int *src0, const int *src1, int len);
+
+call_ref(ref, src0, src1, BUF_SIZE);
+call_new(new, src0, src1, BUF_SIZE);
+if (memcmp(ref, new, BUF_SIZE * sizeof(int)))
+fail();
+bench_new(new, src0, src1, BUF_SIZE);
+
+report("vector_fmul_reverse");
+}
+
+static void check_vector_fmul_window(const int32_t *src0, const int32_t *src1, 
const int32_t *win)
+{
+LOCAL_ALIGNED_32(int32_t, ref, [BUF_SIZE]);
+LOCAL_ALIGNED_32(int32_t, new, [BUF_SIZE]);
+
+declare_func(void, int32_t 

Re: [FFmpeg-devel] [PATCH] checkasm: add fixed_dsp tests

2016-01-19 Thread Ronald S. Bultje
Hi,

On Tue, Jan 19, 2016 at 11:43 AM, James Almer  wrote:

> +report("vector_fmul_add");


grep suggests you may be able to do report("%s", name); to get the _reverse
suffix as appropriate.

Ronald
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] checkasm: add fixed_dsp tests

2016-01-18 Thread James Almer
Signed-off-by: James Almer 
---
 tests/checkasm/Makefile|   3 +
 tests/checkasm/checkasm.c  |   3 +
 tests/checkasm/checkasm.h  |   1 +
 tests/checkasm/fixed_dsp.c | 169 +
 4 files changed, 176 insertions(+)
 create mode 100644 tests/checkasm/fixed_dsp.c

diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile
index e38d15b..698ceef 100644
--- a/tests/checkasm/Makefile
+++ b/tests/checkasm/Makefile
@@ -11,7 +11,10 @@ AVCODECOBJS-$(CONFIG_PIXBLOCKDSP) += pixblockdsp.o
 AVCODECOBJS-$(CONFIG_V210_ENCODER) += v210enc.o
 AVCODECOBJS-$(CONFIG_VP9_DECODER) += vp9dsp.o
 
+AVUTILOBJS += fixed_dsp.o
+
 CHECKASMOBJS-$(CONFIG_AVCODEC) += $(AVCODECOBJS-yes)
+CHECKASMOBJS-$(CONFIG_AVUTIL)  += $(AVUTILOBJS)
 
 
 -include $(SRC_PATH)/tests/checkasm/$(ARCH)/Makefile
diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
index 7f2cf8e..1da085c 100644
--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -58,6 +58,9 @@ static const struct {
 const char *name;
 void (*func)(void);
 } tests[] = {
+#if CONFIG_AVUTIL
+{ "fixed_dsp", checkasm_check_fixed_dsp },
+#endif
 #if CONFIG_AVCODEC
 #if CONFIG_ALAC_DECODER
 { "alacdsp", checkasm_check_alacdsp },
diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h
index 69416e9..dc3519d 100644
--- a/tests/checkasm/checkasm.h
+++ b/tests/checkasm/checkasm.h
@@ -33,6 +33,7 @@
 void checkasm_check_alacdsp(void);
 void checkasm_check_bswapdsp(void);
 void checkasm_check_dcadsp(void);
+void checkasm_check_fixed_dsp(void);
 void checkasm_check_flacdsp(void);
 void checkasm_check_fmtconvert(void);
 void checkasm_check_h264pred(void);
diff --git a/tests/checkasm/fixed_dsp.c b/tests/checkasm/fixed_dsp.c
new file mode 100644
index 000..ac7a0b4
--- /dev/null
+++ b/tests/checkasm/fixed_dsp.c
@@ -0,0 +1,169 @@
+/*
+ * Copyright (c) 2015 James Almer
+ *
+ * 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 "checkasm.h"
+#include "libavutil/common.h"
+#include "libavutil/fixed_dsp.h"
+#include "libavutil/internal.h"
+#include "libavutil/intreadwrite.h"
+#include "libavutil/mem.h"
+
+#define BUF_SIZE 256
+
+#define randomize_buffers()   \
+do {  \
+int i;\
+for (i = 0; i < BUF_SIZE; i++) {  \
+src0[i] = sign_extend(rnd(), 24); \
+src1[i] = sign_extend(rnd(), 24); \
+src2[i] = sign_extend(rnd(), 24); \
+} \
+} while (0)
+
+static void check_vector_fmul(const int *src0, const int *src1, const char 
*name)
+{
+LOCAL_ALIGNED_32(int, ref, [BUF_SIZE]);
+LOCAL_ALIGNED_32(int, new, [BUF_SIZE]);
+
+declare_func(void, int *dst, const int *src0, const int *src1, int len);
+
+call_ref(ref, src0, src1, BUF_SIZE);
+call_new(new, src0, src1, BUF_SIZE);
+if (memcmp(ref, new, BUF_SIZE * sizeof(int)))
+fail();
+bench_new(new, src0, src1, BUF_SIZE);
+
+report(name);
+}
+
+static void check_vector_fmul_window_scaled(const int32_t *src0, const int32_t 
*src1, const int32_t *win)
+{
+LOCAL_ALIGNED_16(int16_t, ref, [BUF_SIZE]);
+LOCAL_ALIGNED_16(int16_t, new, [BUF_SIZE]);
+
+declare_func(void, int16_t *dst, const int32_t *src0, const int32_t *src1, 
const int32_t *win, int len, uint8_t bits);
+
+call_ref(ref, src0, src1, win, BUF_SIZE / 2, 2);
+call_new(new, src0, src1, win, BUF_SIZE / 2, 2);
+if (memcmp(ref, new, BUF_SIZE * sizeof(int16_t)))
+fail();
+bench_new(new, src0, src1, win, BUF_SIZE / 2, 2);
+
+report("vector_fmul_window_scaled");
+}
+
+static void check_vector_fmul_window(const int32_t *src0, const int32_t *src1, 
const int32_t *win)
+{
+LOCAL_ALIGNED_32(int32_t, ref, [BUF_SIZE]);
+LOCAL_ALIGNED_32(int32_t, new, [BUF_SIZE]);
+
+declare_func(void, int32_t *dst, const int32_t *src0, const int32_t *src1, 
const int32_t *win, int len);
+
+call_ref(ref, src0, src1, win, BUF_SIZE / 2);
+call_new(new, src0, src1, win, BUF_SIZE / 2);
+if (memcmp(ref, new, BUF_SIZE * sizeof(int32_t)))
+fail();
+bench_new(new, src0, src1, win, BUF_SIZE / 2);
+
+report("vector_fmul_window");
+}
+