[FFmpeg-cvslog] checkasm/swscale : add test for rgb shuffle_bytes func
Martin Vignali
git at videolan.org
Sat Mar 24 21:24:59 EET 2018
ffmpeg | branch: master | Martin Vignali <martin.vignali at gmail.com> | Sat Mar 24 20:19:00 2018 +0100| [a9a7ed4f27d036a7719a46f3020a8faac96d0ffb] | committer: Martin Vignali
checkasm/swscale : add test for rgb shuffle_bytes func
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a9a7ed4f27d036a7719a46f3020a8faac96d0ffb
---
tests/checkasm/Makefile | 6 ++++
tests/checkasm/checkasm.c | 3 ++
tests/checkasm/checkasm.h | 1 +
tests/checkasm/sw_rgb.c | 85 +++++++++++++++++++++++++++++++++++++++++++++++
tests/fate/checkasm.mak | 1 +
5 files changed, 96 insertions(+)
diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile
index 0520e264e2..97fbf59636 100644
--- a/tests/checkasm/Makefile
+++ b/tests/checkasm/Makefile
@@ -38,6 +38,12 @@ AVFILTEROBJS-$(CONFIG_THRESHOLD_FILTER) += vf_threshold.o
CHECKASMOBJS-$(CONFIG_AVFILTER) += $(AVFILTEROBJS-yes)
+# swscale tests
+SWSCALEOBJS += sw_rgb.o
+
+CHECKASMOBJS-$(CONFIG_SWSCALE) += $(SWSCALEOBJS)
+
+# libavutil tests
AVUTILOBJS += fixed_dsp.o
AVUTILOBJS += float_dsp.o
diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
index fe81d139c6..20ce56932f 100644
--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -163,6 +163,9 @@ static const struct {
{ "vf_threshold", checkasm_check_vf_threshold },
#endif
#endif
+#if CONFIG_SWSCALE
+ { "sw_rgb", checkasm_check_sw_rgb },
+#endif
#if CONFIG_AVUTIL
{ "fixed_dsp", checkasm_check_fixed_dsp },
{ "float_dsp", checkasm_check_float_dsp },
diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h
index 8b9d96bc15..dcab74de06 100644
--- a/tests/checkasm/checkasm.h
+++ b/tests/checkasm/checkasm.h
@@ -65,6 +65,7 @@ void checkasm_check_llviddspenc(void);
void checkasm_check_pixblockdsp(void);
void checkasm_check_sbrdsp(void);
void checkasm_check_synth_filter(void);
+void checkasm_check_sw_rgb(void);
void checkasm_check_utvideodsp(void);
void checkasm_check_v210enc(void);
void checkasm_check_vf_hflip(void);
diff --git a/tests/checkasm/sw_rgb.c b/tests/checkasm/sw_rgb.c
new file mode 100644
index 0000000000..8fc2cfee9e
--- /dev/null
+++ b/tests/checkasm/sw_rgb.c
@@ -0,0 +1,85 @@
+/*
+ *
+ * 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 "libavutil/common.h"
+#include "libavutil/intreadwrite.h"
+#include "libavutil/mem.h"
+
+#include "libswscale/rgb2rgb.h"
+
+#include "checkasm.h"
+
+#define randomize_buffers(buf, size) \
+ do { \
+ int j; \
+ for (j = 0; j < size; j+=4) \
+ AV_WN32(buf + j, rnd()); \
+ } while (0)
+
+static const uint8_t width[] = {12, 16, 20, 32, 36, 128};
+
+#define MAX_STRIDE 128
+
+static void check_shuffle_bytes(void * func, const char * report)
+{
+ int i;
+ LOCAL_ALIGNED_32(uint8_t, src0, [MAX_STRIDE]);
+ LOCAL_ALIGNED_32(uint8_t, src1, [MAX_STRIDE]);
+ LOCAL_ALIGNED_32(uint8_t, dst0, [MAX_STRIDE]);
+ LOCAL_ALIGNED_32(uint8_t, dst1, [MAX_STRIDE]);
+
+ declare_func_emms(AV_CPU_FLAG_MMX, void, const uint8_t *src, uint8_t *dst, int src_size);
+
+ memset(dst0, 0, MAX_STRIDE);
+ memset(dst1, 0, MAX_STRIDE);
+ randomize_buffers(src0, MAX_STRIDE);
+ memcpy(src1, src0, MAX_STRIDE);
+
+ if (check_func(func, "%s", report)) {
+ for (i = 0; i < 6; i ++) {
+ call_ref(src0, dst0, width[i]);
+ call_new(src1, dst1, width[i]);
+ if (memcmp(dst0, dst1, MAX_STRIDE))
+ fail();
+ }
+ bench_new(src0, dst0, width[5]);
+ }
+}
+
+void checkasm_check_sw_rgb(void)
+{
+ ff_sws_rgb2rgb_init();
+
+ check_shuffle_bytes(shuffle_bytes_2103, "shuffle_bytes_2103");
+ report("shuffle_bytes_2103");
+
+ check_shuffle_bytes(shuffle_bytes_0321, "shuffle_bytes_0321");
+ report("shuffle_bytes_0321");
+
+ check_shuffle_bytes(shuffle_bytes_1230, "shuffle_bytes_1230");
+ report("shuffle_bytes_1230");
+
+ check_shuffle_bytes(shuffle_bytes_3012, "shuffle_bytes_3012");
+ report("shuffle_bytes_3012");
+
+ check_shuffle_bytes(shuffle_bytes_3210, "shuffle_bytes_3210");
+ report("shuffle_bytes_3210");
+}
diff --git a/tests/fate/checkasm.mak b/tests/fate/checkasm.mak
index cf62f9b119..a722b4a917 100644
--- a/tests/fate/checkasm.mak
+++ b/tests/fate/checkasm.mak
@@ -21,6 +21,7 @@ FATE_CHECKASM = fate-checkasm-aacpsdsp \
fate-checkasm-pixblockdsp \
fate-checkasm-sbrdsp \
fate-checkasm-synth_filter \
+ fate-checkasm-sw_rgb \
fate-checkasm-v210enc \
fate-checkasm-vf_blend \
fate-checkasm-vf_colorspace \
More information about the ffmpeg-cvslog
mailing list