summaryrefslogtreecommitdiff
path: root/tests/checkasm
diff options
context:
space:
mode:
Diffstat (limited to 'tests/checkasm')
-rw-r--r--tests/checkasm/Makefile10
-rw-r--r--tests/checkasm/aarch64/checkasm.S6
-rw-r--r--tests/checkasm/alacdsp.c119
-rw-r--r--tests/checkasm/arm/checkasm.S6
-rw-r--r--tests/checkasm/bswapdsp.c8
-rw-r--r--tests/checkasm/checkasm.c70
-rw-r--r--tests/checkasm/checkasm.h14
-rw-r--r--tests/checkasm/dcadsp.c8
-rw-r--r--tests/checkasm/flacdsp.c90
-rw-r--r--tests/checkasm/fmtconvert.c8
-rw-r--r--tests/checkasm/h264pred.c8
-rw-r--r--tests/checkasm/h264qpel.c8
-rw-r--r--tests/checkasm/hevc_mc.c320
-rw-r--r--tests/checkasm/jpeg2000dsp.c71
-rw-r--r--tests/checkasm/pixblockdsp.c107
-rw-r--r--tests/checkasm/synth_filter.c8
-rw-r--r--tests/checkasm/v210enc.c8
-rw-r--r--tests/checkasm/vp9dsp.c623
-rw-r--r--tests/checkasm/x86/Makefile2
-rw-r--r--tests/checkasm/x86/checkasm.asm6
20 files changed, 1108 insertions, 392 deletions
diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile
index a66fc73d0e..e38d15b880 100644
--- a/tests/checkasm/Makefile
+++ b/tests/checkasm/Makefile
@@ -1,11 +1,15 @@
# libavcodec tests
+AVCODECOBJS-$(CONFIG_ALAC_DECODER) += alacdsp.o
AVCODECOBJS-$(CONFIG_BSWAPDSP) += bswapdsp.o
AVCODECOBJS-$(CONFIG_DCA_DECODER) += dcadsp.o synth_filter.o
+AVCODECOBJS-$(CONFIG_FLACDSP) += flacdsp.o
AVCODECOBJS-$(CONFIG_FMTCONVERT) += fmtconvert.o
AVCODECOBJS-$(CONFIG_H264PRED) += h264pred.o
AVCODECOBJS-$(CONFIG_H264QPEL) += h264qpel.o
-AVCODECOBJS-$(CONFIG_HEVC_DECODER) += hevc_mc.o
+AVCODECOBJS-$(CONFIG_JPEG2000_DECODER) += jpeg2000dsp.o
+AVCODECOBJS-$(CONFIG_PIXBLOCKDSP) += pixblockdsp.o
AVCODECOBJS-$(CONFIG_V210_ENCODER) += v210enc.o
+AVCODECOBJS-$(CONFIG_VP9_DECODER) += vp9dsp.o
CHECKASMOBJS-$(CONFIG_AVCODEC) += $(AVCODECOBJS-yes)
@@ -21,6 +25,8 @@ CHECKASMDIRS := $(sort $(dir $(CHECKASMOBJS)))
$(CHECKASMOBJS): | $(CHECKASMDIRS)
OBJDIRS += $(CHECKASMDIRS)
+tests/checkasm/checkasm.o: CFLAGS += -Umain
+
CHECKASM := tests/checkasm/checkasm$(EXESUF)
$(CHECKASM): $(EXEOBJS) $(CHECKASMOBJS) $(FF_STATIC_DEP_LIBS)
@@ -28,7 +34,7 @@ $(CHECKASM): $(EXEOBJS) $(CHECKASMOBJS) $(FF_STATIC_DEP_LIBS)
checkasm: $(CHECKASM)
-clean:: checkasmclean
+testclean:: checkasmclean
checkasmclean:
$(RM) $(CHECKASM) $(CLEANSUFFIXES:%=tests/checkasm/%) $(CLEANSUFFIXES:%=tests/checkasm/$(ARCH)/%)
diff --git a/tests/checkasm/aarch64/checkasm.S b/tests/checkasm/aarch64/checkasm.S
index 9668518c9b..6317d80611 100644
--- a/tests/checkasm/aarch64/checkasm.S
+++ b/tests/checkasm/aarch64/checkasm.S
@@ -3,14 +3,14 @@
* Copyright (c) 2015 Martin Storsjo
* Copyright (c) 2015 Janne Grunau
*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
*
- * Libav is free software; you can redistribute it and/or modify
+ * 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.
*
- * Libav is distributed in the hope that it will be useful,
+ * 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.
diff --git a/tests/checkasm/alacdsp.c b/tests/checkasm/alacdsp.c
new file mode 100644
index 0000000000..cbf03f82e8
--- /dev/null
+++ b/tests/checkasm/alacdsp.c
@@ -0,0 +1,119 @@
+/*
+ * 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 <string.h>
+#include "checkasm.h"
+#include "libavcodec/alacdsp.h"
+#include "libavcodec/mathops.h"
+#include "libavutil/common.h"
+#include "libavutil/internal.h"
+
+#define BUF_SIZE 256
+#define MAX_CHANNELS 2
+
+#define randomize_buffers() \
+ do { \
+ int i; \
+ for (i = 0; i < BUF_SIZE*MAX_CHANNELS; i++) { \
+ int32_t r = sign_extend(rnd(), 24); \
+ ref_buf[i] = r; \
+ new_buf[i] = r; \
+ } \
+ } while (0)
+
+static void check_decorrelate_stereo(void)
+{
+ LOCAL_ALIGNED_16(int32_t, ref_buf, [BUF_SIZE*MAX_CHANNELS]);
+ LOCAL_ALIGNED_16(int32_t, new_buf, [BUF_SIZE*MAX_CHANNELS]);
+ int32_t *ref[2] = { &ref_buf[BUF_SIZE*0], &ref_buf[BUF_SIZE*1] };
+ int32_t *new[2] = { &new_buf[BUF_SIZE*0], &new_buf[BUF_SIZE*1] };
+ ALACDSPContext c;
+
+ ff_alacdsp_init(&c);
+ if (check_func(c.decorrelate_stereo, "alac_decorrelate_stereo")) {
+ int len = (rnd() & 0xFF) + 1;
+ int shift = rnd() & 0x1F;
+ int weight = rnd() & 0xFF;
+ declare_func(void, int32_t *buf[2], int len, int shift, int weight);
+
+ randomize_buffers();
+ call_ref(ref, len, shift, weight);
+ call_new(new, len, shift, weight);
+ if (memcmp(ref[0], new[0], len * sizeof(int32_t)) ||
+ memcmp(ref[1], new[1], len * sizeof(int32_t)))
+ fail();
+ bench_new(new, BUF_SIZE, shift, weight);
+ }
+
+ report("decorrelate_stereo");
+}
+
+#undef randomize_buffers
+#define randomize_buffers() \
+ do { \
+ int i, j; \
+ for (i = 0; i < BUF_SIZE; i++) { \
+ for (j = 0; j < ch; j++) { \
+ int32_t r = sign_extend(rnd(), 24); \
+ ref[j][i] = r; \
+ new[j][i] = r; \
+ r = rnd() & 0xFF; \
+ ref_ebb[j][i] = r; \
+ new_ebb[j][i] = r; \
+ } \
+ } \
+ } while (0)
+
+static void check_append_extra_bits(void)
+{
+ LOCAL_ALIGNED_16(int32_t, ref_buf, [BUF_SIZE*MAX_CHANNELS*2]);
+ LOCAL_ALIGNED_16(int32_t, new_buf, [BUF_SIZE*MAX_CHANNELS*2]);
+ int32_t *ref[2] = { &ref_buf[BUF_SIZE*0], &ref_buf[BUF_SIZE*1] };
+ int32_t *new[2] = { &new_buf[BUF_SIZE*0], &new_buf[BUF_SIZE*1] };
+ int32_t *ref_ebb[2] = { &ref_buf[BUF_SIZE*2], &ref_buf[BUF_SIZE*3] };
+ int32_t *new_ebb[2] = { &new_buf[BUF_SIZE*2], &new_buf[BUF_SIZE*3] };
+ ALACDSPContext c;
+ static const char * const channels[2] = { "mono", "stereo" };
+ int ch;
+
+ ff_alacdsp_init(&c);
+ for (ch = 1; ch <= 2; ch++) {
+ if (check_func(c.append_extra_bits[ch-1], "alac_append_extra_bits_%s", channels[ch-1])) {
+ int len = (rnd() & 0xFF) + 1;
+ declare_func(void, int32_t *buf[2], int32_t *ebb[2], int ebits, int ch, int len);
+
+ randomize_buffers();
+ call_ref(ref, ref_ebb, 8, ch, len);
+ call_new(new, new_ebb, 8, ch, len);
+ if ( memcmp(ref[0], new[0], len * sizeof(int32_t)) ||
+ (ch == 2 && memcmp(ref[1], new[1], len * sizeof(int32_t))))
+ fail();
+ bench_new(new, new_ebb, 8, ch, BUF_SIZE);
+ }
+ }
+
+ report("append_extra_bits");
+}
+
+void checkasm_check_alacdsp(void)
+{
+ check_decorrelate_stereo();
+ check_append_extra_bits();
+}
diff --git a/tests/checkasm/arm/checkasm.S b/tests/checkasm/arm/checkasm.S
index 160dba4a1a..3e3806b2a7 100644
--- a/tests/checkasm/arm/checkasm.S
+++ b/tests/checkasm/arm/checkasm.S
@@ -3,14 +3,14 @@
* Copyright (c) 2015 Martin Storsjo
* Copyright (c) 2015 Janne Grunau
*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
*
- * Libav is free software; you can redistribute it and/or modify
+ * 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.
*
- * Libav is distributed in the hope that it will be useful,
+ * 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.
diff --git a/tests/checkasm/bswapdsp.c b/tests/checkasm/bswapdsp.c
index 829ebaa8a8..5f7555037d 100644
--- a/tests/checkasm/bswapdsp.c
+++ b/tests/checkasm/bswapdsp.c
@@ -1,20 +1,20 @@
/*
* Copyright (c) 2015 Henrik Gramner
*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
*
- * Libav is free software; you can redistribute it and/or modify
+ * 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.
*
- * Libav is distributed in the hope that it will be useful,
+ * 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 Libav; if not, write to the Free Software Foundation, Inc.,
+ * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
index c75e431d50..33c6d8c7af 100644
--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -3,20 +3,20 @@
* Copyright (c) 2015 Henrik Gramner
* Copyright (c) 2008 Loren Merritt
*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
*
- * Libav is free software; you can redistribute it and/or modify
+ * 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.
*
- * Libav is distributed in the hope that it will be useful,
+ * 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 Libav; if not, write to the Free Software Foundation, Inc.,
+ * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
@@ -64,27 +64,41 @@ static const struct {
const char *name;
void (*func)(void);
} tests[] = {
-#if CONFIG_BSWAPDSP
- { "bswapdsp", checkasm_check_bswapdsp },
-#endif
-#if CONFIG_DCA_DECODER
- { "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
-#if CONFIG_H264QPEL
- { "h264qpel", checkasm_check_h264qpel },
-#endif
-#if CONFIG_HEVC_DECODER
- { "hevc_mc", checkasm_check_hevc_mc },
-#endif
-#if CONFIG_V210_ENCODER
- { "v210enc", checkasm_check_v210enc },
+#if CONFIG_AVCODEC
+ #if CONFIG_ALAC_DECODER
+ { "alacdsp", checkasm_check_alacdsp },
+ #endif
+ #if CONFIG_BSWAPDSP
+ { "bswapdsp", checkasm_check_bswapdsp },
+ #endif
+ #if CONFIG_DCA_DECODER
+ { "dcadsp", checkasm_check_dcadsp },
+ { "synth_filter", checkasm_check_synth_filter },
+ #endif
+ #if CONFIG_FLACDSP
+ { "flacdsp", checkasm_check_flacdsp },
+ #endif
+ #if CONFIG_FMTCONVERT
+ { "fmtconvert", checkasm_check_fmtconvert },
+ #endif
+ #if CONFIG_H264PRED
+ { "h264pred", checkasm_check_h264pred },
+ #endif
+ #if CONFIG_H264QPEL
+ { "h264qpel", checkasm_check_h264qpel },
+ #endif
+ #if CONFIG_JPEG2000_DECODER
+ { "jpeg2000dsp", checkasm_check_jpeg2000dsp },
+ #endif
+ #if CONFIG_PIXBLOCKDSP
+ { "pixblockdsp", checkasm_check_pixblockdsp },
+ #endif
+ #if CONFIG_V210_ENCODER
+ { "v210enc", checkasm_check_v210enc },
+ #endif
+ #if CONFIG_VP9_DECODER
+ { "vp9dsp", checkasm_check_vp9dsp },
+ #endif
#endif
{ NULL }
};
@@ -121,6 +135,7 @@ static const struct {
{ "SSSE3", "ssse3", AV_CPU_FLAG_SSSE3|AV_CPU_FLAG_ATOM },
{ "SSE4.1", "sse4", AV_CPU_FLAG_SSE4 },
{ "SSE4.2", "sse42", AV_CPU_FLAG_SSE42 },
+ { "AES-NI", "aesni", AV_CPU_FLAG_AESNI },
{ "AVX", "avx", AV_CPU_FLAG_AVX },
{ "XOP", "xop", AV_CPU_FLAG_XOP },
{ "FMA3", "fma3", AV_CPU_FLAG_FMA3 },
@@ -442,8 +457,9 @@ static void check_cpu_flag(const char *name, int flag)
int old_cpu_flag = state.cpu_flag;
flag |= old_cpu_flag;
- av_set_cpu_flags_mask(flag);
- state.cpu_flag = av_get_cpu_flags();
+ av_force_cpu_flags(-1);
+ state.cpu_flag = flag & av_get_cpu_flags();
+ av_force_cpu_flags(state.cpu_flag);
if (!flag || state.cpu_flag != old_cpu_flag) {
int i;
diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h
index 543856c37a..bd17156334 100644
--- a/tests/checkasm/checkasm.h
+++ b/tests/checkasm/checkasm.h
@@ -3,20 +3,20 @@
* Copyright (c) 2015 Henrik Gramner
* Copyright (c) 2008 Loren Merritt
*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
*
- * Libav is free software; you can redistribute it and/or modify
+ * 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.
*
- * Libav is distributed in the hope that it will be useful,
+ * 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 Libav; if not, write to the Free Software Foundation, Inc.,
+ * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
@@ -30,14 +30,18 @@
#include "libavutil/lfg.h"
#include "libavutil/timer.h"
+void checkasm_check_alacdsp(void);
void checkasm_check_bswapdsp(void);
void checkasm_check_dcadsp(void);
+void checkasm_check_flacdsp(void);
void checkasm_check_fmtconvert(void);
void checkasm_check_h264pred(void);
void checkasm_check_h264qpel(void);
-void checkasm_check_hevc_mc(void);
+void checkasm_check_jpeg2000dsp(void);
+void checkasm_check_pixblockdsp(void);
void checkasm_check_synth_filter(void);
void checkasm_check_v210enc(void);
+void checkasm_check_vp9dsp(void);
void *checkasm_check_func(void *func, const char *name, ...) av_printf_format(2, 3);
int checkasm_bench_func(void);
diff --git a/tests/checkasm/dcadsp.c b/tests/checkasm/dcadsp.c
index 7251362a1e..5c7ff6f2d1 100644
--- a/tests/checkasm/dcadsp.c
+++ b/tests/checkasm/dcadsp.c
@@ -1,20 +1,20 @@
/*
* Copyright (c) 2015 Janne Grunau
*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
*
- * Libav is free software; you can redistribute it and/or modify
+ * 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.
*
- * Libav is distributed in the hope that it will be useful,
+ * 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 Libav; if not, write to the Free Software Foundation, Inc.,
+ * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
diff --git a/tests/checkasm/flacdsp.c b/tests/checkasm/flacdsp.c
new file mode 100644
index 0000000000..dccb54d672
--- /dev/null
+++ b/tests/checkasm/flacdsp.c
@@ -0,0 +1,90 @@
+/*
+ * 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 <string.h>
+#include "checkasm.h"
+#include "libavcodec/flacdsp.h"
+#include "libavutil/common.h"
+#include "libavutil/internal.h"
+#include "libavutil/intreadwrite.h"
+
+#define BUF_SIZE 256
+#define MAX_CHANNELS 8
+
+#define randomize_buffers() \
+ do { \
+ int i, j; \
+ for (i = 0; i < BUF_SIZE; i += 4) { \
+ for (j = 0; j < channels; j++) { \
+ uint32_t r = rnd() & (1 << (bits - 2)) - 1; \
+ AV_WN32A(ref_src[j] + i, r); \
+ AV_WN32A(new_src[j] + i, r); \
+ } \
+ } \
+ } while (0)
+
+static void check_decorrelate(uint8_t **ref_dst, uint8_t **ref_src, uint8_t **new_dst, uint8_t **new_src,
+ int channels, int bits) {
+ declare_func(void, uint8_t **out, int32_t **in, int channels, int len, int shift);
+
+ randomize_buffers();
+ call_ref(ref_dst, (int32_t **)ref_src, channels, BUF_SIZE / sizeof(int32_t), 8);
+ call_new(new_dst, (int32_t **)new_src, channels, BUF_SIZE / sizeof(int32_t), 8);
+ if (memcmp(*ref_dst, *new_dst, bits == 16 ? BUF_SIZE * (channels/2) : BUF_SIZE * channels) ||
+ memcmp(*ref_src, *new_src, BUF_SIZE * channels))
+ fail();
+ bench_new(new_dst, (int32_t **)new_src, channels, BUF_SIZE / sizeof(int32_t), 8);
+}
+
+void checkasm_check_flacdsp(void)
+{
+ LOCAL_ALIGNED_16(uint8_t, ref_dst, [BUF_SIZE*MAX_CHANNELS]);
+ LOCAL_ALIGNED_16(uint8_t, ref_buf, [BUF_SIZE*MAX_CHANNELS]);
+ LOCAL_ALIGNED_16(uint8_t, new_dst, [BUF_SIZE*MAX_CHANNELS]);
+ LOCAL_ALIGNED_16(uint8_t, new_buf, [BUF_SIZE*MAX_CHANNELS]);
+ uint8_t *ref_src[] = { &ref_buf[BUF_SIZE*0], &ref_buf[BUF_SIZE*1], &ref_buf[BUF_SIZE*2], &ref_buf[BUF_SIZE*3],
+ &ref_buf[BUF_SIZE*4], &ref_buf[BUF_SIZE*5], &ref_buf[BUF_SIZE*6], &ref_buf[BUF_SIZE*7] };
+ uint8_t *new_src[] = { &new_buf[BUF_SIZE*0], &new_buf[BUF_SIZE*1], &new_buf[BUF_SIZE*2], &new_buf[BUF_SIZE*3],
+ &new_buf[BUF_SIZE*4], &new_buf[BUF_SIZE*5], &new_buf[BUF_SIZE*6], &new_buf[BUF_SIZE*7] };
+ static const char * const names[3] = { "ls", "rs", "ms" };
+ static const struct {
+ enum AVSampleFormat fmt;
+ int bits;
+ } fmts[] = {
+ { AV_SAMPLE_FMT_S16, 16 },
+ { AV_SAMPLE_FMT_S32, 32 },
+ };
+ FLACDSPContext h;
+ int i, j;
+
+ for (i = 0; i < 2; i++) {
+ ff_flacdsp_init(&h, fmts[i].fmt, 2, 0);
+ for (j = 0; j < 3; j++)
+ if (check_func(h.decorrelate[j], "flac_decorrelate_%s_%d", names[j], fmts[i].bits))
+ check_decorrelate(&ref_dst, ref_src, &new_dst, new_src, 2, fmts[i].bits);
+ for (j = 2; j <= MAX_CHANNELS; j += 2) {
+ ff_flacdsp_init(&h, fmts[i].fmt, j, 0);
+ if (check_func(h.decorrelate[0], "flac_decorrelate_indep%d_%d", j, fmts[i].bits))
+ check_decorrelate(&ref_dst, ref_src, &new_dst, new_src, j, fmts[i].bits);
+ }
+ }
+
+ report("decorrelate");
+}
diff --git a/tests/checkasm/fmtconvert.c b/tests/checkasm/fmtconvert.c
index 1a843b0b02..50ad3ca2ea 100644
--- a/tests/checkasm/fmtconvert.c
+++ b/tests/checkasm/fmtconvert.c
@@ -1,20 +1,20 @@
/*
* Copyright (c) 2015 Janne Grunau
*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
*
- * Libav is free software; you can redistribute it and/or modify
+ * 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.
*
- * Libav is distributed in the hope that it will be useful,
+ * 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 Libav; if not, write to the Free Software Foundation, Inc.,
+ * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
diff --git a/tests/checkasm/h264pred.c b/tests/checkasm/h264pred.c
index 6dffa3484d..4028405006 100644
--- a/tests/checkasm/h264pred.c
+++ b/tests/checkasm/h264pred.c
@@ -1,20 +1,20 @@
/*
* Copyright (c) 2015 Henrik Gramner
*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
*
- * Libav is free software; you can redistribute it and/or modify
+ * 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.
*
- * Libav is distributed in the hope that it will be useful,
+ * 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 Libav; if not, write to the Free Software Foundation, Inc.,
+ * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
diff --git a/tests/checkasm/h264qpel.c b/tests/checkasm/h264qpel.c
index d92f223ba1..ba069f1259 100644
--- a/tests/checkasm/h264qpel.c
+++ b/tests/checkasm/h264qpel.c
@@ -1,20 +1,20 @@
/*
* Copyright (c) 2015 Henrik Gramner
*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
*
- * Libav is free software; you can redistribute it and/or modify
+ * 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.
*
- * Libav is distributed in the hope that it will be useful,
+ * 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 Libav; if not, write to the Free Software Foundation, Inc.,
+ * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
diff --git a/tests/checkasm/hevc_mc.c b/tests/checkasm/hevc_mc.c
deleted file mode 100644
index 7139369b1d..0000000000
--- a/tests/checkasm/hevc_mc.c
+++ /dev/null
@@ -1,320 +0,0 @@
-/*
- * Copyright (c) 2015 Anton Khirnov
- *
- * 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 <string.h>
-
-#include "checkasm.h"
-
-#include "libavcodec/avcodec.h"
-#include "libavcodec/hevcdsp.h"
-
-#include "libavutil/common.h"
-#include "libavutil/intreadwrite.h"
-
-// max PU size + interpolation stencil
-#define BUF_SIZE (FFALIGN(64 + 7, 16) * (64 + 7) * 2)
-
-#define PIXEL_SIZE(depth) ((depth + 7) / 8)
-
-#define randomize_buffers(buf, size, depth) \
- do { \
- uint32_t mask = pixel_mask[depth - 8]; \
- int i; \
- for (i = 0; i < size; i += 4) { \
- uint32_t r = rnd() & mask; \
- AV_WN32A(buf + i, r); \
- } \
- } while (0)
-
-static const uint32_t pixel_mask[3] = { 0xffffffff, 0x01ff01ff, 0x03ff03ff };
-
-static const int pred_heights[][7] = {
- [2] = { 8, 4, 2, 0 },
- [4] = { 16, 8, 4, 2, 0 },
- [6] = { 8, 0 },
- [8] = { 32, 16, 8, 4, 2, 0 },
- [12] = { 16, 0 },
- [16] = { 64, 32, 16, 12, 8, 4, 0 },
- [24] = { 32, 0 },
- [32] = { 64, 32, 24, 16, 8, 0 },
- [48] = { 64, 0 },
- [64] = { 64, 48, 32, 16, 0 },
-};
-
-static const int pred_widths[] = { 4, 8, 12, 16, 24, 32, 48, 64 };
-
-static const char *interp_names[2][2] = { { "pixels", "h" }, { "v", "hv" } };
-
-#define UNWEIGHTED_PRED(dst0, dst1, src0, width, bit_depth) \
-do { \
- int i; \
- for (i = 0; i < FF_ARRAY_ELEMS(pred_heights[i]); i++) { \
- int height = pred_heights[width][i]; \
- if (!height) \
- break; \
- call_ref(dst0, dststride, src0, srcstride, height); \
- call_new(dst1, dststride, src0, srcstride, height); \
- if (memcmp(dst0, dst1, dststride * height)) \
- fail(); \
- bench_new(dst1, dststride, src0, srcstride, height); \
- } \
-} while (0)
-
-#define UNWEIGHTED_PRED_AVG(dst0, dst1, src0, src1, width, bit_depth) \
-do { \
- int i; \
- for (i = 0; i < FF_ARRAY_ELEMS(pred_heights[i]); i++) { \
- int height = pred_heights[width][i]; \
- if (!height) \
- break; \
- call_ref(dst0, dststride, src0, src1, srcstride, height); \
- call_new(dst1, dststride, src0, src1, srcstride, height); \
- if (memcmp(dst0, dst1, dststride * height)) \
- fail(); \
- bench_new(dst1, dststride, src0, src1, srcstride, height); \
- } \
-} while (0)
-
-static void check_unweighted_pred(HEVCDSPContext *h, uint8_t *dst0, uint8_t *dst1,
- int16_t *src0, int16_t *src1, int bit_depth)
-{
- int i;
-
- randomize_buffers(src0, BUF_SIZE, 8);
- randomize_buffers(src1, BUF_SIZE, 8);
-
- memset(dst0, 0, BUF_SIZE * sizeof(*dst0));
- memset(dst1, 0, BUF_SIZE * sizeof(*dst1));
-
- for (i = 0; i < FF_ARRAY_ELEMS(pred_widths); i++) {
- const int width = pred_widths[i];
- const int srcstride = FFALIGN(width, 16) * sizeof(*src0);
- const int dststride = FFALIGN(width, 16) * PIXEL_SIZE(bit_depth);
-
- {
- declare_func(void, uint8_t *dst, ptrdiff_t dststride, int16_t *src, ptrdiff_t srcstride, int height);
- if (check_func(h->put_unweighted_pred[i], "put_unweighted_pred_%d_%d", width, bit_depth))
- UNWEIGHTED_PRED(dst0, dst1, src0, width, bit_depth);
- if (check_func(h->put_unweighted_pred_chroma[i], "put_unweighted_pred_%d_%d", width / 2, bit_depth))
- UNWEIGHTED_PRED(dst0, dst1, src0, width, bit_depth);
- }
- {
- declare_func(void, uint8_t *dst, ptrdiff_t dststride,
- int16_t *src0, int16_t *src1, ptrdiff_t srcstride, int height);
- if (check_func(h->put_unweighted_pred_avg[i], "put_unweighted_pred_avg_%d_%d", width, bit_depth))
- UNWEIGHTED_PRED_AVG(dst0, dst1, src0, src1, width, bit_depth);
- if (check_func(h->put_unweighted_pred_avg_chroma[i], "put_unweighted_pred_avg_%d_%d", width / 2, bit_depth))
- UNWEIGHTED_PRED_AVG(dst0, dst1, src0, src1, width, bit_depth);
- }
- }
-}
-
-#define WEIGHTED_PRED(dst0, dst1, src0, width, bit_depth) \
-do { \
- int i; \
- for (i = 0; i < FF_ARRAY_ELEMS(pred_heights[i]); i++) { \
- int height = pred_heights[width][i]; \
- if (!height) \
- break; \
- call_ref(denom, weight0, offset0, dst0, dststride, src0, srcstride, height); \
- call_new(denom, weight0, offset0, dst1, dststride, src0, srcstride, height); \
- if (memcmp(dst0, dst1, dststride * height)) \
- fail(); \
- bench_new(denom, weight0, offset0, dst1, dststride, src0, srcstride, height); \
- } \
-} while (0)
-
-#define WEIGHTED_PRED_AVG(dst0, dst1, src0, src1, width, bit_depth) \
-do { \
- int i; \
- for (i = 0; i < FF_ARRAY_ELEMS(pred_heights[i]); i++) { \
- int height = pred_heights[width][i]; \
- if (!height) \
- break; \
- call_ref(denom, weight0, weight1, offset0, offset1, dst0, dststride, src0, src1, srcstride, height); \
- call_new(denom, weight0, weight1, offset0, offset1, dst1, dststride, src0, src1, srcstride, height); \
- if (memcmp(dst0, dst1, dststride * height)) \
- fail(); \
- bench_new(denom, weight0, weight1, offset0, offset1, dst1, dststride, src0, src1, srcstride, height); \
- } \
-} while (0)
-
-static void check_weighted_pred(HEVCDSPContext *h, uint8_t *dst0, uint8_t *dst1,
- int16_t *src0, int16_t *src1, int bit_depth)
-{
- uint8_t denom;
- int16_t weight0, weight1, offset0, offset1;
- int i;
-
- randomize_buffers(src0, BUF_SIZE, 8);
- randomize_buffers(src1, BUF_SIZE, 8);
-
- denom = rnd() & 7;
- weight0 = denom + ((rnd() & 255) - 128);
- weight1 = denom + ((rnd() & 255) - 128);
- offset0 = (rnd() & 255) - 128;
- offset1 = (rnd() & 255) - 128;
-
- memset(dst0, 0, BUF_SIZE * sizeof(*dst0));
- memset(dst1, 0, BUF_SIZE * sizeof(*dst1));
-
- for (i = 0; i < FF_ARRAY_ELEMS(pred_widths); i++) {
- const int width = pred_widths[i];
- const int srcstride = FFALIGN(width, 16) * sizeof(*src0);
- const int dststride = FFALIGN(width, 16) * PIXEL_SIZE(bit_depth);
-
- {
- declare_func(void, uint8_t denom, int16_t weight, int16_t offset,
- uint8_t *dst, ptrdiff_t dststride, int16_t *src, ptrdiff_t srcstride, int height);
- if (check_func(h->weighted_pred[i], "weighted_pred_%d_%d", width, bit_depth))
- WEIGHTED_PRED(dst0, dst1, src0, width, bit_depth);
- if (check_func(h->weighted_pred_chroma[i], "weighted_pred_%d_%d", width / 2, bit_depth))
- WEIGHTED_PRED(dst0, dst1, src0, width, bit_depth);
- }
- {
- declare_func(void, uint8_t denom, int16_t weight0, int16_t weight1, int16_t offset0, int16_t offset1,
- uint8_t *dst, ptrdiff_t dststride, int16_t *src0, int16_t *src1, ptrdiff_t srcstride, int height);
- if (check_func(h->weighted_pred_avg[i], "weighted_pred_avg_%d_%d", width, bit_depth))
- WEIGHTED_PRED_AVG(dst0, dst1, src0, src1, width, bit_depth);
- if (check_func(h->weighted_pred_avg_chroma[i], "weighted_pred_avg_%d_%d", width / 2, bit_depth))
- WEIGHTED_PRED_AVG(dst0, dst1, src0, src1, width, bit_depth);
- }
- }
-}
-
-static void check_epel(HEVCDSPContext *h, int16_t *dst0, int16_t *dst1,
- uint8_t *src, int16_t *mcbuffer, int bit_depth)
-{
- int i, j, k, l, mx, my;
-
- declare_func(void, int16_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride,
- int height, int mx, int my, int16_t *mcbuffer);
-
- randomize_buffers(src, BUF_SIZE, bit_depth);
-
- memset(dst0, 0, BUF_SIZE * sizeof(*dst0));
- memset(dst1, 0, BUF_SIZE * sizeof(*dst1));
-
- for (i = 0; i < 2; i++) {
- for (j = 0; j < 2; j++) {
- for (k = 0; k < FF_ARRAY_ELEMS(h->put_hevc_epel[i][j]); k++) {
- int width = pred_widths[k] / 2;
- int dststride = FFALIGN(width, 16) * sizeof(*dst0);
- int srcstride = FFALIGN(width + 3, 8) * PIXEL_SIZE(bit_depth);
-
- if (!check_func(h->put_hevc_epel[i][j][k], "epel_%s_%d_%d", interp_names[i][j], width, bit_depth))
- continue;
-
- for (l = 0; l < FF_ARRAY_ELEMS(pred_heights[0]); l++) {
- int height = pred_heights[width][l];
-
- if (!height)
- continue;
-
- for (my = i; my < (i ? 8 : 1); my++)
- for (mx = j; mx < (j ? 8 : 1); mx++) {
- call_ref(dst0, dststride, src + srcstride + PIXEL_SIZE(bit_depth), srcstride, height, mx, my, mcbuffer);
- call_new(dst1, dststride, src + srcstride + PIXEL_SIZE(bit_depth), srcstride, height, mx, my, mcbuffer);
-
- if (memcmp(dst0, dst1, dststride * height * sizeof(*dst0)))
- fail();
-
- bench_new(dst1, dststride, src + srcstride + PIXEL_SIZE(bit_depth), srcstride, height, mx, my, mcbuffer);
- }
- }
- }
- }
- }
-}
-
-static void check_qpel(HEVCDSPContext *h, int16_t *dst0, int16_t *dst1,
- uint8_t *src, int16_t *mcbuffer, int bit_depth)
-{
- int i, j, k, l, mx, my;
-
- declare_func(void, int16_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride,
- int height, int mx, int my, int16_t *mcbuffer);
-
- randomize_buffers(src, BUF_SIZE, bit_depth);
-
- memset(dst0, 0, BUF_SIZE * sizeof(*dst0));
- memset(dst1, 0, BUF_SIZE * sizeof(*dst1));
-
- for (i = 0; i < 2; i++) {
- for (j = 0; j < 2; j++) {
- for (k = 0; k < FF_ARRAY_ELEMS(h->put_hevc_qpel[i][j]); k++) {
- int width = pred_widths[k];
- int dststride = FFALIGN(width, 16) * sizeof(*dst0);
- int srcstride = FFALIGN(width + 7, 8) * PIXEL_SIZE(bit_depth);
-
- if (!check_func(h->put_hevc_qpel[i][j][k], "qpel_%s_%d_%d", interp_names[i][j], width, bit_depth))
- continue;
-
- for (l = 0; l < FF_ARRAY_ELEMS(pred_heights[0]); l++) {
- int height = pred_heights[width][l];
-
- if (!height)
- continue;
-
- for (my = i; my < (i ? 2 : 1); my++)
- for (mx = j; mx < (j ? 2 : 1); mx++) {
- call_ref(dst0, dststride, src + 3 * srcstride + 3 * PIXEL_SIZE(bit_depth), srcstride, height, mx, my, mcbuffer);
- call_new(dst1, dststride, src + 3 * srcstride + 3 * PIXEL_SIZE(bit_depth), srcstride, height, mx, my, mcbuffer);
-
- if (memcmp(dst0, dst1, dststride * height * sizeof(*dst0)))
- fail();
-
- bench_new(dst1, dststride, src + 3 * srcstride + 3 * PIXEL_SIZE(bit_depth), srcstride, height, mx, my, mcbuffer);
- }
- }
- }
- }
- }
-}
-
-void checkasm_check_hevc_mc(void)
-{
- DECLARE_ALIGNED(16, uint8_t, buf8_0)[BUF_SIZE];
- DECLARE_ALIGNED(16, uint8_t, buf8_1)[BUF_SIZE];
-
- DECLARE_ALIGNED(16, int16_t, buf16_0)[BUF_SIZE];
- DECLARE_ALIGNED(16, int16_t, buf16_1)[BUF_SIZE];
-
- DECLARE_ALIGNED(16, int16_t, mcbuffer)[BUF_SIZE];
-
- HEVCDSPContext h;
- int bit_depth;
-
- for (bit_depth = 8; bit_depth <= 10; bit_depth++) {
- ff_hevc_dsp_init(&h, bit_depth);
-
- check_qpel(&h, buf16_0, buf16_1, buf8_0, mcbuffer, bit_depth);
- report("qpel");
-
- check_epel(&h, buf16_0, buf16_1, buf8_0, mcbuffer, bit_depth);
- report("epel");
-
- check_unweighted_pred(&h, buf8_0, buf8_1, buf16_0, buf16_1, bit_depth);
- report("unweighted_pred");
-
- check_weighted_pred(&h, buf8_0, buf8_1, buf16_0, buf16_1, bit_depth);
- report("weighted_pred");
- }
-}
diff --git a/tests/checkasm/jpeg2000dsp.c b/tests/checkasm/jpeg2000dsp.c
new file mode 100644
index 0000000000..48559df085
--- /dev/null
+++ b/tests/checkasm/jpeg2000dsp.c
@@ -0,0 +1,71 @@
+/*
+ * 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 "libavcodec/jpeg2000dsp.h"
+#include "libavutil/common.h"
+#include "libavutil/internal.h"
+#include "libavutil/intreadwrite.h"
+
+#define BUF_SIZE 512
+
+#define randomize_buffers() \
+ do { \
+ int i; \
+ for (i = 0; i < BUF_SIZE; i += 4) { \
+ uint32_t r = rnd(); \
+ AV_WN32A(ref0 + i, r); \
+ AV_WN32A(new0 + i, r); \
+ r = rnd(); \
+ AV_WN32A(ref1 + i, r); \
+ AV_WN32A(new1 + i, r); \
+ r = rnd(); \
+ AV_WN32A(ref2 + i, r); \
+ AV_WN32A(new2 + i, r); \
+ } \
+ } while (0)
+
+static void check_mct(uint8_t *ref0, uint8_t *ref1, uint8_t *ref2,
+ uint8_t *new0, uint8_t *new1, uint8_t *new2) {
+ declare_func(void, void *src0, void *src1, void *src2, int csize);
+
+ randomize_buffers();
+ call_ref(ref0, ref1, ref2, BUF_SIZE / sizeof(int32_t));
+ call_new(new0, new1, new2, BUF_SIZE / sizeof(int32_t));
+ if (memcmp(ref0, new0, BUF_SIZE) || memcmp(ref1, new1, BUF_SIZE) ||
+ memcmp(ref2, new2, BUF_SIZE))
+ fail();
+ bench_new(new0, new1, new2, BUF_SIZE / sizeof(int32_t));
+}
+
+void checkasm_check_jpeg2000dsp(void)
+{
+ LOCAL_ALIGNED_32(uint8_t, ref, [BUF_SIZE*3]);
+ LOCAL_ALIGNED_32(uint8_t, new, [BUF_SIZE*3]);
+ Jpeg2000DSPContext h;
+
+ ff_jpeg2000dsp_init(&h);
+
+ if (check_func(h.mct_decode[FF_DWT53], "jpeg2000_rct_int"))
+ check_mct(&ref[BUF_SIZE*0], &ref[BUF_SIZE*1], &ref[BUF_SIZE*2],
+ &new[BUF_SIZE*0], &new[BUF_SIZE*1], &new[BUF_SIZE*2]);
+
+ report("mct_decode");
+}
diff --git a/tests/checkasm/pixblockdsp.c b/tests/checkasm/pixblockdsp.c
new file mode 100644
index 0000000000..66bfdb7db8
--- /dev/null
+++ b/tests/checkasm/pixblockdsp.c
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2015 Tiancheng "Timothy" Gu
+ *
+ * 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 <string.h>
+#include "checkasm.h"
+#include "libavcodec/pixblockdsp.h"
+#include "libavutil/common.h"
+#include "libavutil/internal.h"
+#include "libavutil/intreadwrite.h"
+
+#define BUF_UNITS 8
+#define BUF_SIZE (BUF_UNITS * 128 + BUF_UNITS)
+
+#define randomize_buffers() \
+ do { \
+ int i; \
+ for (i = 0; i < BUF_SIZE; i += 4) { \
+ uint32_t r = rnd(); \
+ AV_WN32A(src10 + i, r); \
+ AV_WN32A(src11 + i, r); \
+ r = rnd(); \
+ AV_WN32A(src20 + i, r); \
+ AV_WN32A(src21 + i, r); \
+ r = rnd(); \
+ AV_WN32A(dst0_ + i, r); \
+ AV_WN32A(dst1_ + i, r); \
+ } \
+ } while (0)
+
+#define check_get_pixels(type) \
+ do { \
+ int i; \
+ declare_func_emms(AV_CPU_FLAG_MMX, void, int16_t *block, const uint8_t *pixels, ptrdiff_t line_size); \
+ \
+ for (i = 0; i < BUF_UNITS; i++) { \
+ int src_offset = i * 64 * sizeof(type) + i; /* Test various alignments */ \
+ int dst_offset = i * 64; /* dst must be aligned */ \
+ randomize_buffers(); \
+ call_ref(dst0 + dst_offset, src10 + src_offset, 8); \
+ call_new(dst1 + dst_offset, src11 + src_offset, 8); \
+ if (memcmp(src10, src11, BUF_SIZE)|| memcmp(dst0, dst1, BUF_SIZE)) \
+ fail(); \
+ bench_new(dst1 + dst_offset, src11 + src_offset, 8); \
+ } \
+ } while (0)
+
+#define check_diff_pixels(type) \
+ do { \
+ int i; \
+ declare_func_emms(AV_CPU_FLAG_MMX, void, int16_t *av_restrict block, const uint8_t *s1, const uint8_t *s2, int stride); \
+ \
+ for (i = 0; i < BUF_UNITS; i++) { \
+ int src_offset = i * 64 * sizeof(type) + i; /* Test various alignments */ \
+ int dst_offset = i * 64; /* dst must be aligned */ \
+ randomize_buffers(); \
+ call_ref(dst0 + dst_offset, src10 + src_offset, src20 + src_offset, 8); \
+ call_new(dst1 + dst_offset, src11 + src_offset, src21 + src_offset, 8); \
+ if (memcmp(src10, src11, BUF_SIZE) || memcmp(src20, src21, BUF_SIZE) || memcmp(dst0, dst1, BUF_SIZE)) \
+ fail(); \
+ bench_new(dst1 + dst_offset, src11 + src_offset, src21 + src_offset, 8); \
+ } \
+ } while (0)
+
+void checkasm_check_pixblockdsp(void)
+{
+ LOCAL_ALIGNED_16(uint8_t, src10, [BUF_SIZE]);
+ LOCAL_ALIGNED_16(uint8_t, src11, [BUF_SIZE]);
+ LOCAL_ALIGNED_16(uint8_t, src20, [BUF_SIZE]);
+ LOCAL_ALIGNED_16(uint8_t, src21, [BUF_SIZE]);
+ LOCAL_ALIGNED_16(uint8_t, dst0_, [BUF_SIZE]);
+ LOCAL_ALIGNED_16(uint8_t, dst1_, [BUF_SIZE]);
+ uint16_t *dst0 = (uint16_t *)dst0_;
+ uint16_t *dst1 = (uint16_t *)dst1_;
+ PixblockDSPContext h;
+ AVCodecContext avctx = {
+ .bits_per_raw_sample = 8,
+ };
+
+ ff_pixblockdsp_init(&h, &avctx);
+
+ if (check_func(h.get_pixels, "get_pixels"))
+ check_get_pixels(uint8_t);
+
+ report("get_pixels");
+
+ if (check_func(h.diff_pixels, "diff_pixels"))
+ check_diff_pixels(uint8_t);
+
+ report("diff_pixels");
+}
diff --git a/tests/checkasm/synth_filter.c b/tests/checkasm/synth_filter.c
index 157400b570..87e32ebc0e 100644
--- a/tests/checkasm/synth_filter.c
+++ b/tests/checkasm/synth_filter.c
@@ -1,20 +1,20 @@
/*
* Copyright (c) 2015 Janne Grunau
*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
*
- * Libav is free software; you can redistribute it and/or modify
+ * 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.
*
- * Libav is distributed in the hope that it will be useful,
+ * 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 Libav; if not, write to the Free Software Foundation, Inc.,
+ * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
diff --git a/tests/checkasm/v210enc.c b/tests/checkasm/v210enc.c
index 4f5f6ba4ba..ed3677659d 100644
--- a/tests/checkasm/v210enc.c
+++ b/tests/checkasm/v210enc.c
@@ -1,20 +1,20 @@
/*
* Copyright (c) 2015 Henrik Gramner
*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
*
- * Libav is free software; you can redistribute it and/or modify
+ * 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.
*
- * Libav is distributed in the hope that it will be useful,
+ * 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 Libav; if not, write to the Free Software Foundation, Inc.,
+ * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
diff --git a/tests/checkasm/vp9dsp.c b/tests/checkasm/vp9dsp.c
new file mode 100644
index 0000000000..931f7882b5
--- /dev/null
+++ b/tests/checkasm/vp9dsp.c
@@ -0,0 +1,623 @@
+/*
+ * Copyright (c) 2015 Ronald S. Bultje <rsbultje@gmail.com>
+ *
+ * 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 <math.h>
+#include <string.h>
+#include "checkasm.h"
+#include "libavcodec/vp9data.h"
+#include "libavcodec/vp9dsp.h"
+#include "libavutil/common.h"
+#include "libavutil/internal.h"
+#include "libavutil/intreadwrite.h"
+#include "libavutil/mathematics.h"
+
+static const uint32_t pixel_mask[3] = { 0xffffffff, 0x03ff03ff, 0x0fff0fff };
+#define SIZEOF_PIXEL ((bit_depth + 7) / 8)
+
+#define randomize_buffers() \
+ do { \
+ uint32_t mask = pixel_mask[(bit_depth - 8) >> 1]; \
+ int k; \
+ for (k = -4; k < SIZEOF_PIXEL * FFMAX(8, size); k += 4) { \
+ uint32_t r = rnd() & mask; \
+ AV_WN32A(a + k, r); \
+ } \
+ for (k = 0; k < size * SIZEOF_PIXEL; k += 4) { \
+ uint32_t r = rnd() & mask; \
+ AV_WN32A(l + k, r); \
+ } \
+ } while (0)
+
+static void check_ipred(void)
+{
+ LOCAL_ALIGNED_32(uint8_t, a_buf, [64 * 2]);
+ uint8_t *a = &a_buf[32 * 2];
+ LOCAL_ALIGNED_32(uint8_t, l, [32 * 2]);
+ LOCAL_ALIGNED_32(uint8_t, dst0, [32 * 32 * 2]);
+ LOCAL_ALIGNED_32(uint8_t, dst1, [32 * 32 * 2]);
+ VP9DSPContext dsp;
+ int tx, mode, bit_depth;
+ declare_func_emms(AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMXEXT, void, uint8_t *dst, ptrdiff_t stride,
+ const uint8_t *left, const uint8_t *top);
+ static const char *const mode_names[N_INTRA_PRED_MODES] = {
+ [VERT_PRED] = "vert",
+ [HOR_PRED] = "hor",
+ [DC_PRED] = "dc",
+ [DIAG_DOWN_LEFT_PRED] = "diag_downleft",
+ [DIAG_DOWN_RIGHT_PRED] = "diag_downright",
+ [VERT_RIGHT_PRED] = "vert_right",
+ [HOR_DOWN_PRED] = "hor_down",
+ [VERT_LEFT_PRED] = "vert_left",
+ [HOR_UP_PRED] = "hor_up",
+ [TM_VP8_PRED] = "tm",
+ [LEFT_DC_PRED] = "dc_left",
+ [TOP_DC_PRED] = "dc_top",
+ [DC_128_PRED] = "dc_128",
+ [DC_127_PRED] = "dc_127",
+ [DC_129_PRED] = "dc_129",
+ };
+
+ for (bit_depth = 8; bit_depth <= 12; bit_depth += 2) {
+ ff_vp9dsp_init(&dsp, bit_depth, 0);
+ for (tx = 0; tx < 4; tx++) {
+ int size = 4 << tx;
+
+ for (mode = 0; mode < N_INTRA_PRED_MODES; mode++) {
+ if (check_func(dsp.intra_pred[tx][mode], "vp9_%s_%dx%d_%dbpp",
+ mode_names[mode], size, size, bit_depth)) {
+ randomize_buffers();
+ call_ref(dst0, size * SIZEOF_PIXEL, l, a);
+ call_new(dst1, size * SIZEOF_PIXEL, l, a);
+ if (memcmp(dst0, dst1, size * size * SIZEOF_PIXEL))
+ fail();
+ bench_new(dst1, size * SIZEOF_PIXEL,l, a);
+ }
+ }
+ }
+ }
+ report("ipred");
+}
+
+#undef randomize_buffers
+
+#define randomize_buffers() \
+ do { \
+ uint32_t mask = pixel_mask[(bit_depth - 8) >> 1]; \
+ for (y = 0; y < sz; y++) { \
+ for (x = 0; x < sz * SIZEOF_PIXEL; x += 4) { \
+ uint32_t r = rnd() & mask; \
+ AV_WN32A(dst + y * sz * SIZEOF_PIXEL + x, r); \
+ AV_WN32A(src + y * sz * SIZEOF_PIXEL + x, rnd() & mask); \
+ } \
+ for (x = 0; x < sz; x++) { \
+ if (bit_depth == 8) { \
+ coef[y * sz + x] = src[y * sz + x] - dst[y * sz + x]; \
+ } else { \
+ ((int32_t *) coef)[y * sz + x] = \
+ ((uint16_t *) src)[y * sz + x] - \
+ ((uint16_t *) dst)[y * sz + x]; \
+ } \
+ } \
+ } \
+ } while(0)
+
+// wht function copied from libvpx
+static void fwht_1d(double *out, const double *in, int sz)
+{
+ double t0 = in[0] + in[1];
+ double t3 = in[3] - in[2];
+ double t4 = trunc((t0 - t3) * 0.5);
+ double t1 = t4 - in[1];
+ double t2 = t4 - in[2];
+
+ out[0] = t0 - t2;
+ out[1] = t2;
+ out[2] = t3 + t1;
+ out[3] = t1;
+}
+
+// standard DCT-II
+static void fdct_1d(double *out, const double *in, int sz)
+{
+ int k, n;
+
+ for (k = 0; k < sz; k++) {
+ out[k] = 0.0;
+ for (n = 0; n < sz; n++)
+ out[k] += in[n] * cos(M_PI * (2 * n + 1) * k / (sz * 2.0));
+ }
+ out[0] *= M_SQRT1_2;
+}
+
+// see "Towards jointly optimal spatial prediction and adaptive transform in
+// video/image coding", by J. Han, A. Saxena, and K. Rose
+// IEEE Proc. ICASSP, pp. 726-729, Mar. 2010.
+static void fadst4_1d(double *out, const double *in, int sz)
+{
+ int k, n;
+
+ for (k = 0; k < sz; k++) {
+ out[k] = 0.0;
+ for (n = 0; n < sz; n++)
+ out[k] += in[n] * sin(M_PI * (n + 1) * (2 * k + 1) / (sz * 2.0 + 1.0));
+ }
+}
+
+// see "A Butterfly Structured Design of The Hybrid Transform Coding Scheme",
+// by Jingning Han, Yaowu Xu, and Debargha Mukherjee
+// http://static.googleusercontent.com/media/research.google.com/en//pubs/archive/41418.pdf
+static void fadst_1d(double *out, const double *in, int sz)
+{
+ int k, n;
+
+ for (k = 0; k < sz; k++) {
+ out[k] = 0.0;
+ for (n = 0; n < sz; n++)
+ out[k] += in[n] * sin(M_PI * (2 * n + 1) * (2 * k + 1) / (sz * 4.0));
+ }
+}
+
+typedef void (*ftx1d_fn)(double *out, const double *in, int sz);
+static void ftx_2d(double *out, const double *in, enum TxfmMode tx,
+ enum TxfmType txtp, int sz)
+{
+ static const double scaling_factors[5][4] = {
+ { 4.0, 16.0 * M_SQRT1_2 / 3.0, 16.0 * M_SQRT1_2 / 3.0, 32.0 / 9.0 },
+ { 2.0, 2.0, 2.0, 2.0 },
+ { 1.0, 1.0, 1.0, 1.0 },
+ { 0.25 },
+ { 4.0 }
+ };
+ static const ftx1d_fn ftx1d_tbl[5][4][2] = {
+ {
+ { fdct_1d, fdct_1d },
+ { fadst4_1d, fdct_1d },
+ { fdct_1d, fadst4_1d },
+ { fadst4_1d, fadst4_1d },
+ }, {
+ { fdct_1d, fdct_1d },
+ { fadst_1d, fdct_1d },
+ { fdct_1d, fadst_1d },
+ { fadst_1d, fadst_1d },
+ }, {
+ { fdct_1d, fdct_1d },
+ { fadst_1d, fdct_1d },
+ { fdct_1d, fadst_1d },
+ { fadst_1d, fadst_1d },
+ }, {
+ { fdct_1d, fdct_1d },
+ }, {
+ { fwht_1d, fwht_1d },
+ },
+ };
+ double temp[1024];
+ double scaling_factor = scaling_factors[tx][txtp];
+ int i, j;
+
+ // cols
+ for (i = 0; i < sz; ++i) {
+ double temp_out[32];
+
+ ftx1d_tbl[tx][txtp][0](temp_out, &in[i * sz], sz);
+ // scale and transpose
+ for (j = 0; j < sz; ++j)
+ temp[j * sz + i] = temp_out[j] * scaling_factor;
+ }
+
+ // rows
+ for (i = 0; i < sz; i++)
+ ftx1d_tbl[tx][txtp][1](&out[i * sz], &temp[i * sz], sz);
+}
+
+static void ftx(int16_t *buf, enum TxfmMode tx,
+ enum TxfmType txtp, int sz, int bit_depth)
+{
+ double ind[1024], outd[1024];
+ int n;
+
+ emms_c();
+ for (n = 0; n < sz * sz; n++) {
+ if (bit_depth == 8)
+ ind[n] = buf[n];
+ else
+ ind[n] = ((int32_t *) buf)[n];
+ }
+ ftx_2d(outd, ind, tx, txtp, sz);
+ for (n = 0; n < sz * sz; n++) {
+ if (bit_depth == 8)
+ buf[n] = lrint(outd[n]);
+ else
+ ((int32_t *) buf)[n] = lrint(outd[n]);
+ }
+}
+
+static int copy_subcoefs(int16_t *out, const int16_t *in, enum TxfmMode tx,
+ enum TxfmType txtp, int sz, int sub, int bit_depth)
+{
+ // copy the topleft coefficients such that the return value (being the
+ // coefficient scantable index for the eob token) guarantees that only
+ // the topleft $sub out of $sz (where $sz >= $sub) coefficients in both
+ // dimensions are non-zero. This leads to braching to specific optimized
+ // simd versions (e.g. dc-only) so that we get full asm coverage in this
+ // test
+
+ int n;
+ const int16_t *scan = vp9_scans[tx][txtp];
+ int eob;
+
+ for (n = 0; n < sz * sz; n++) {
+ int rc = scan[n], rcx = rc % sz, rcy = rc / sz;
+
+ // find eob for this sub-idct
+ if (rcx >= sub || rcy >= sub)
+ break;
+
+ // copy coef
+ if (bit_depth == 8) {
+ out[rc] = in[rc];
+ } else {
+ AV_COPY32(&out[rc * 2], &in[rc * 2]);
+ }
+ }
+
+ eob = n;
+
+ for (; n < sz * sz; n++) {
+ int rc = scan[n];
+
+ // zero
+ if (bit_depth == 8) {
+ out[rc] = 0;
+ } else {
+ AV_ZERO32(&out[rc * 2]);
+ }
+ }
+
+ return eob;
+}
+
+static int iszero(const int16_t *c, int sz)
+{
+ int n;
+
+ for (n = 0; n < sz / sizeof(int16_t); n += 2)
+ if (AV_RN32A(&c[n]))
+ return 0;
+
+ return 1;
+}
+
+#define SIZEOF_COEF (2 * ((bit_depth + 7) / 8))
+
+static void check_itxfm(void)
+{
+ LOCAL_ALIGNED_32(uint8_t, src, [32 * 32 * 2]);
+ LOCAL_ALIGNED_32(uint8_t, dst, [32 * 32 * 2]);
+ LOCAL_ALIGNED_32(uint8_t, dst0, [32 * 32 * 2]);
+ LOCAL_ALIGNED_32(uint8_t, dst1, [32 * 32 * 2]);
+ LOCAL_ALIGNED_32(int16_t, coef, [32 * 32 * 2]);
+ LOCAL_ALIGNED_32(int16_t, subcoef0, [32 * 32 * 2]);
+ LOCAL_ALIGNED_32(int16_t, subcoef1, [32 * 32 * 2]);
+ declare_func_emms(AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMXEXT, void, uint8_t *dst, ptrdiff_t stride, int16_t *block, int eob);
+ VP9DSPContext dsp;
+ int y, x, tx, txtp, bit_depth, sub;
+ static const char *const txtp_types[N_TXFM_TYPES] = {
+ [DCT_DCT] = "dct_dct", [DCT_ADST] = "adst_dct",
+ [ADST_DCT] = "dct_adst", [ADST_ADST] = "adst_adst"
+ };
+
+ for (bit_depth = 8; bit_depth <= 12; bit_depth += 2) {
+ ff_vp9dsp_init(&dsp, bit_depth, 0);
+
+ for (tx = TX_4X4; tx <= N_TXFM_SIZES /* 4 = lossless */; tx++) {
+ int sz = 4 << (tx & 3);
+ int n_txtps = tx < TX_32X32 ? N_TXFM_TYPES : 1;
+
+ for (txtp = 0; txtp < n_txtps; txtp++) {
+ if (check_func(dsp.itxfm_add[tx][txtp], "vp9_inv_%s_%dx%d_add_%d",
+ tx == 4 ? "wht_wht" : txtp_types[txtp], sz, sz,
+ bit_depth)) {
+ randomize_buffers();
+ ftx(coef, tx, txtp, sz, bit_depth);
+
+ for (sub = (txtp == 0) ? 1 : 2; sub <= sz; sub <<= 1) {
+ int eob;
+
+ if (sub < sz) {
+ eob = copy_subcoefs(subcoef0, coef, tx, txtp,
+ sz, sub, bit_depth);
+ } else {
+ eob = sz * sz;
+ memcpy(subcoef0, coef, sz * sz * SIZEOF_COEF);
+ }
+
+ memcpy(dst0, dst, sz * sz * SIZEOF_PIXEL);
+ memcpy(dst1, dst, sz * sz * SIZEOF_PIXEL);
+ memcpy(subcoef1, subcoef0, sz * sz * SIZEOF_COEF);
+ call_ref(dst0, sz * SIZEOF_PIXEL, subcoef0, eob);
+ call_new(dst1, sz * SIZEOF_PIXEL, subcoef1, eob);
+ if (memcmp(dst0, dst1, sz * sz * SIZEOF_PIXEL) ||
+ !iszero(subcoef0, sz * sz * SIZEOF_COEF) ||
+ !iszero(subcoef1, sz * sz * SIZEOF_COEF))
+ fail();
+ }
+ bench_new(dst, sz * SIZEOF_PIXEL, coef, sz * sz);
+ }
+ }
+ }
+ }
+ report("itxfm");
+}
+
+#undef randomize_buffers
+
+#define setpx(a,b,c) \
+ do { \
+ if (SIZEOF_PIXEL == 1) { \
+ buf0[(a) + (b) * jstride] = av_clip_uint8(c); \
+ } else { \
+ ((uint16_t *)buf0)[(a) + (b) * jstride] = av_clip_uintp2(c, bit_depth); \
+ } \
+ } while (0)
+
+// c can be an assignment and must not be put under ()
+#define setdx(a,b,c,d) setpx(a,b,c-(d)+(rnd()%((d)*2+1)))
+#define setsx(a,b,c,d) setdx(a,b,c,(d) << (bit_depth - 8))
+static void randomize_loopfilter_buffers(int bidx, int lineoff, int str,
+ int bit_depth, int dir, const int *E,
+ const int *F, const int *H, const int *I,
+ uint8_t *buf0, uint8_t *buf1)
+{
+ uint32_t mask = (1 << bit_depth) - 1;
+ int off = dir ? lineoff : lineoff * 16;
+ int istride = dir ? 1 : 16;
+ int jstride = dir ? str : 1;
+ int i, j;
+ for (i = 0; i < 2; i++) /* flat16 */ {
+ int idx = off + i * istride, p0, q0;
+ setpx(idx, 0, q0 = rnd() & mask);
+ setsx(idx, -1, p0 = q0, E[bidx] >> 2);
+ for (j = 1; j < 8; j++) {
+ setsx(idx, -1 - j, p0, F[bidx]);
+ setsx(idx, j, q0, F[bidx]);
+ }
+ }
+ for (i = 2; i < 4; i++) /* flat8 */ {
+ int idx = off + i * istride, p0, q0;
+ setpx(idx, 0, q0 = rnd() & mask);
+ setsx(idx, -1, p0 = q0, E[bidx] >> 2);
+ for (j = 1; j < 4; j++) {
+ setsx(idx, -1 - j, p0, F[bidx]);
+ setsx(idx, j, q0, F[bidx]);
+ }
+ for (j = 4; j < 8; j++) {
+ setpx(idx, -1 - j, rnd() & mask);
+ setpx(idx, j, rnd() & mask);
+ }
+ }
+ for (i = 4; i < 6; i++) /* regular */ {
+ int idx = off + i * istride, p2, p1, p0, q0, q1, q2;
+ setpx(idx, 0, q0 = rnd() & mask);
+ setsx(idx, 1, q1 = q0, I[bidx]);
+ setsx(idx, 2, q2 = q1, I[bidx]);
+ setsx(idx, 3, q2, I[bidx]);
+ setsx(idx, -1, p0 = q0, E[bidx] >> 2);
+ setsx(idx, -2, p1 = p0, I[bidx]);
+ setsx(idx, -3, p2 = p1, I[bidx]);
+ setsx(idx, -4, p2, I[bidx]);
+ for (j = 4; j < 8; j++) {
+ setpx(idx, -1 - j, rnd() & mask);
+ setpx(idx, j, rnd() & mask);
+ }
+ }
+ for (i = 6; i < 8; i++) /* off */ {
+ int idx = off + i * istride;
+ for (j = 0; j < 8; j++) {
+ setpx(idx, -1 - j, rnd() & mask);
+ setpx(idx, j, rnd() & mask);
+ }
+ }
+}
+#define randomize_buffers(bidx, lineoff, str) \
+ randomize_loopfilter_buffers(bidx, lineoff, str, bit_depth, dir, \
+ E, F, H, I, buf0, buf1)
+
+static void check_loopfilter(void)
+{
+ LOCAL_ALIGNED_32(uint8_t, base0, [32 + 16 * 16 * 2]);
+ LOCAL_ALIGNED_32(uint8_t, base1, [32 + 16 * 16 * 2]);
+ VP9DSPContext dsp;
+ int dir, wd, wd2, bit_depth;
+ static const char *const dir_name[2] = { "h", "v" };
+ static const int E[2] = { 20, 28 }, I[2] = { 10, 16 };
+ static const int H[2] = { 7, 11 }, F[2] = { 1, 1 };
+ declare_func(void, uint8_t *dst, ptrdiff_t stride, int E, int I, int H);
+
+ for (bit_depth = 8; bit_depth <= 12; bit_depth += 2) {
+ ff_vp9dsp_init(&dsp, bit_depth, 0);
+
+ for (dir = 0; dir < 2; dir++) {
+ int midoff = (dir ? 8 * 8 : 8) * SIZEOF_PIXEL;
+ int midoff_aligned = (dir ? 8 * 8 : 16) * SIZEOF_PIXEL;
+ uint8_t *buf0 = base0 + midoff_aligned;
+ uint8_t *buf1 = base1 + midoff_aligned;
+
+ for (wd = 0; wd < 3; wd++) {
+ // 4/8/16wd_8px
+ if (check_func(dsp.loop_filter_8[wd][dir],
+ "vp9_loop_filter_%s_%d_8_%dbpp",
+ dir_name[dir], 4 << wd, bit_depth)) {
+ randomize_buffers(0, 0, 8);
+ memcpy(buf1 - midoff, buf0 - midoff,
+ 16 * 8 * SIZEOF_PIXEL);
+ call_ref(buf0, 16 * SIZEOF_PIXEL >> dir, E[0], I[0], H[0]);
+ call_new(buf1, 16 * SIZEOF_PIXEL >> dir, E[0], I[0], H[0]);
+ if (memcmp(buf0 - midoff, buf1 - midoff, 16 * 8 * SIZEOF_PIXEL))
+ fail();
+ bench_new(buf1, 16 * SIZEOF_PIXEL >> dir, E[0], I[0], H[0]);
+ }
+ }
+
+ midoff = (dir ? 16 * 8 : 8) * SIZEOF_PIXEL;
+ midoff_aligned = (dir ? 16 * 8 : 16) * SIZEOF_PIXEL;
+
+ buf0 = base0 + midoff_aligned;
+ buf1 = base1 + midoff_aligned;
+
+ // 16wd_16px loopfilter
+ if (check_func(dsp.loop_filter_16[dir],
+ "vp9_loop_filter_%s_16_16_%dbpp",
+ dir_name[dir], bit_depth)) {
+ randomize_buffers(0, 0, 16);
+ randomize_buffers(0, 8, 16);
+ memcpy(buf1 - midoff, buf0 - midoff, 16 * 16 * SIZEOF_PIXEL);
+ call_ref(buf0, 16 * SIZEOF_PIXEL, E[0], I[0], H[0]);
+ call_new(buf1, 16 * SIZEOF_PIXEL, E[0], I[0], H[0]);
+ if (memcmp(buf0 - midoff, buf1 - midoff, 16 * 16 * SIZEOF_PIXEL))
+ fail();
+ bench_new(buf1, 16 * SIZEOF_PIXEL, E[0], I[0], H[0]);
+ }
+
+ for (wd = 0; wd < 2; wd++) {
+ for (wd2 = 0; wd2 < 2; wd2++) {
+ // mix2 loopfilter
+ if (check_func(dsp.loop_filter_mix2[wd][wd2][dir],
+ "vp9_loop_filter_mix2_%s_%d%d_16_%dbpp",
+ dir_name[dir], 4 << wd, 4 << wd2, bit_depth)) {
+ randomize_buffers(0, 0, 16);
+ randomize_buffers(1, 8, 16);
+ memcpy(buf1 - midoff, buf0 - midoff, 16 * 16 * SIZEOF_PIXEL);
+#define M(a) (((a)[1] << 8) | (a)[0])
+ call_ref(buf0, 16 * SIZEOF_PIXEL, M(E), M(I), M(H));
+ call_new(buf1, 16 * SIZEOF_PIXEL, M(E), M(I), M(H));
+ if (memcmp(buf0 - midoff, buf1 - midoff, 16 * 16 * SIZEOF_PIXEL))
+ fail();
+ bench_new(buf1, 16 * SIZEOF_PIXEL, M(E), M(I), M(H));
+#undef M
+ }
+ }
+ }
+ }
+ }
+ report("loopfilter");
+}
+
+#undef setsx
+#undef setpx
+#undef setdx
+#undef randomize_buffers
+
+#define DST_BUF_SIZE (size * size * SIZEOF_PIXEL)
+#define SRC_BUF_STRIDE 72
+#define SRC_BUF_SIZE ((size + 7) * SRC_BUF_STRIDE * SIZEOF_PIXEL)
+#define src (buf + 3 * SIZEOF_PIXEL * (SRC_BUF_STRIDE + 1))
+
+#define randomize_buffers() \
+ do { \
+ uint32_t mask = pixel_mask[(bit_depth - 8) >> 1]; \
+ int k; \
+ for (k = 0; k < SRC_BUF_SIZE; k += 4) { \
+ uint32_t r = rnd() & mask; \
+ AV_WN32A(buf + k, r); \
+ } \
+ if (op == 1) { \
+ for (k = 0; k < DST_BUF_SIZE; k += 4) { \
+ uint32_t r = rnd() & mask; \
+ AV_WN32A(dst0 + k, r); \
+ AV_WN32A(dst1 + k, r); \
+ } \
+ } \
+ } while (0)
+
+static void check_mc(void)
+{
+ LOCAL_ALIGNED_32(uint8_t, buf, [72 * 72 * 2]);
+ LOCAL_ALIGNED_32(uint8_t, dst0, [64 * 64 * 2]);
+ LOCAL_ALIGNED_32(uint8_t, dst1, [64 * 64 * 2]);
+ VP9DSPContext dsp;
+ int op, hsize, bit_depth, filter, dx, dy;
+ declare_func_emms(AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMXEXT, void, uint8_t *dst, ptrdiff_t dst_stride,
+ const uint8_t *ref, ptrdiff_t ref_stride,
+ int h, int mx, int my);
+ static const char *const filter_names[4] = {
+ "8tap_smooth", "8tap_regular", "8tap_sharp", "bilin"
+ };
+ static const char *const subpel_names[2][2] = { { "", "h" }, { "v", "hv" } };
+ static const char *const op_names[2] = { "put", "avg" };
+ char str[256];
+
+ for (op = 0; op < 2; op++) {
+ for (bit_depth = 8; bit_depth <= 12; bit_depth += 2) {
+ ff_vp9dsp_init(&dsp, bit_depth, 0);
+ for (hsize = 0; hsize < 5; hsize++) {
+ int size = 64 >> hsize;
+
+ for (filter = 0; filter < 4; filter++) {
+ for (dx = 0; dx < 2; dx++) {
+ for (dy = 0; dy < 2; dy++) {
+ if (dx || dy) {
+ snprintf(str, sizeof(str),
+ "%s_%s_%d%s", op_names[op],
+ filter_names[filter], size,
+ subpel_names[dy][dx]);
+ } else {
+ snprintf(str, sizeof(str),
+ "%s%d", op_names[op], size);
+ }
+ if (check_func(dsp.mc[hsize][filter][op][dx][dy],
+ "vp9_%s_%dbpp", str, bit_depth)) {
+ int mx = dx ? 1 + (rnd() % 14) : 0;
+ int my = dy ? 1 + (rnd() % 14) : 0;
+ randomize_buffers();
+ call_ref(dst0, size * SIZEOF_PIXEL,
+ src, SRC_BUF_STRIDE * SIZEOF_PIXEL,
+ size, mx, my);
+ call_new(dst1, size * SIZEOF_PIXEL,
+ src, SRC_BUF_STRIDE * SIZEOF_PIXEL,
+ size, mx, my);
+ if (memcmp(dst0, dst1, DST_BUF_SIZE))
+ fail();
+
+ // simd implementations for each filter of subpel
+ // functions are identical
+ if (filter >= 1 && filter <= 2) continue;
+ // 10/12 bpp for bilin are identical
+ if (bit_depth == 12 && filter == 3) continue;
+
+ bench_new(dst1, size * SIZEOF_PIXEL,
+ src, SRC_BUF_STRIDE * SIZEOF_PIXEL,
+ size, mx, my);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ report("mc");
+}
+
+void checkasm_check_vp9dsp(void)
+{
+ check_ipred();
+ check_itxfm();
+ check_loopfilter();
+ check_mc();
+}
diff --git a/tests/checkasm/x86/Makefile b/tests/checkasm/x86/Makefile
index 0254c61935..befe088dcf 100644
--- a/tests/checkasm/x86/Makefile
+++ b/tests/checkasm/x86/Makefile
@@ -3,4 +3,4 @@ CHECKASMOBJS-$(HAVE_YASM) += x86/checkasm.o
tests/checkasm/x86/%.o: tests/checkasm/x86/%.asm
$(DEPYASM) $(YASMFLAGS) -I $(<D)/ -M -o $@ $< > $(@:.o=.d)
$(YASM) $(YASMFLAGS) -I $(<D)/ -o $@ $<
- -$(STRIP) $(STRIPFLAGS) $@
+ -$(STRIP) $(ASMSTRIPFLAGS) $@
diff --git a/tests/checkasm/x86/checkasm.asm b/tests/checkasm/x86/checkasm.asm
index 52d10aec5c..e1dde6e60a 100644
--- a/tests/checkasm/x86/checkasm.asm
+++ b/tests/checkasm/x86/checkasm.asm
@@ -3,14 +3,14 @@
;* Copyright (c) 2008 Loren Merritt
;* Copyright (c) 2012 Henrik Gramner
;*
-;* This file is part of Libav.
+;* This file is part of FFmpeg.
;*
-;* Libav is free software; you can redistribute it and/or modify
+;* 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.
;*
-;* Libav is distributed in the hope that it will be useful,
+;* 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.