summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTing Fu <ting.fu@intel.com>2019-09-18 15:05:33 +0800
committerRuiling Song <ruiling.song@intel.com>2019-09-26 08:10:31 +0800
commit9691e2a4264b9859061efaaf818b528add45656f (patch)
tree08c67cd833743a851f92492bd1248e03f4b775b0 /tests
parentfc20ba9e049e5dde25643bffb2565a5477e6e5f6 (diff)
downloadffmpeg-streaming-9691e2a4264b9859061efaaf818b528add45656f.zip
ffmpeg-streaming-9691e2a4264b9859061efaaf818b528add45656f.tar.gz
checkasm/vf_eq: add test for vf_eq
Signed-off-by: Ting Fu <ting.fu@intel.com> Signed-off-by: Ruiling Song <ruiling.song@intel.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/checkasm/Makefile1
-rw-r--r--tests/checkasm/checkasm.c3
-rw-r--r--tests/checkasm/checkasm.h1
-rw-r--r--tests/checkasm/vf_eq.c79
-rw-r--r--tests/fate/checkasm.mak1
5 files changed, 85 insertions, 0 deletions
diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile
index 0112ff6..de850c0 100644
--- a/tests/checkasm/Makefile
+++ b/tests/checkasm/Makefile
@@ -36,6 +36,7 @@ CHECKASMOBJS-$(CONFIG_AVCODEC) += $(AVCODECOBJS-yes)
AVFILTEROBJS-$(CONFIG_AFIR_FILTER) += af_afir.o
AVFILTEROBJS-$(CONFIG_BLEND_FILTER) += vf_blend.o
AVFILTEROBJS-$(CONFIG_COLORSPACE_FILTER) += vf_colorspace.o
+AVFILTEROBJS-$(CONFIG_EQ_FILTER) += vf_eq.o
AVFILTEROBJS-$(CONFIG_GBLUR_FILTER) += vf_gblur.o
AVFILTEROBJS-$(CONFIG_HFLIP_FILTER) += vf_hflip.o
AVFILTEROBJS-$(CONFIG_THRESHOLD_FILTER) += vf_threshold.o
diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
index d9a5c7f..bcbe775 100644
--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -165,6 +165,9 @@ static const struct {
#if CONFIG_COLORSPACE_FILTER
{ "vf_colorspace", checkasm_check_colorspace },
#endif
+ #if CONFIG_EQ_FILTER
+ { "vf_eq", checkasm_check_vf_eq },
+ #endif
#if CONFIG_GBLUR_FILTER
{ "vf_gblur", checkasm_check_vf_gblur },
#endif
diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h
index fdf9eeb..0a7f9f2 100644
--- a/tests/checkasm/checkasm.h
+++ b/tests/checkasm/checkasm.h
@@ -72,6 +72,7 @@ void checkasm_check_sw_rgb(void);
void checkasm_check_utvideodsp(void);
void checkasm_check_v210dec(void);
void checkasm_check_v210enc(void);
+void checkasm_check_vf_eq(void);
void checkasm_check_vf_gblur(void);
void checkasm_check_vf_hflip(void);
void checkasm_check_vf_threshold(void);
diff --git a/tests/checkasm/vf_eq.c b/tests/checkasm/vf_eq.c
new file mode 100644
index 0000000..48dccdd
--- /dev/null
+++ b/tests/checkasm/vf_eq.c
@@ -0,0 +1,79 @@
+/*
+ * 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 "libavfilter/avfilter.h"
+#include "libavfilter/vf_eq.h"
+#include "libavutil/intreadwrite.h"
+
+#define WIDTH 256
+#define HEIGHT 256
+#define SRC_STRIDE 256
+#define PIXELS (WIDTH * HEIGHT)
+#define RANDOM_RANGE 80000
+#define SCALE 10000
+
+#define randomize_buffers(buf, size) \
+ do { \
+ int j; \
+ uint8_t *tmp_buf = (uint8_t *)buf;\
+ for (j = 0; j< size; j++) \
+ tmp_buf[j] = rnd() & 0xFF; \
+ } while (0)
+
+static void check_eq(void)
+{
+ LOCAL_ALIGNED_32(uint8_t, src, [PIXELS]);
+ LOCAL_ALIGNED_32(uint8_t, dst_ref, [PIXELS]);
+ LOCAL_ALIGNED_32(uint8_t, dst_new, [PIXELS]);
+ int w = WIDTH;
+ int h = HEIGHT;
+ int src_stride = SRC_STRIDE;
+ int dst_stride = SRC_STRIDE;
+ EQParameters pa;
+ EQContext eq;
+ declare_func(void, EQParameters *param, uint8_t *dst, int dst_stride,
+ const uint8_t *src, int src_stride, int w, int h);
+
+ double rand_contrast = (int)(rnd() % (RANDOM_RANGE * 2) - RANDOM_RANGE) /
+ (SCALE * 1.0);
+ double rand_brightness = (int)(rnd() % (SCALE * 2) - SCALE) /
+ (SCALE * 1.0);
+ pa.contrast = rand_contrast;
+ pa.brightness = rand_brightness;
+
+ memset(dst_ref, 0, PIXELS);
+ memset(dst_new, 0, PIXELS);
+ randomize_buffers(src, PIXELS);
+ ff_eq_init(&eq);
+
+ if (check_func(eq.process, "process")) {
+ call_ref(&pa, dst_ref, dst_stride, src, src_stride, w, h);
+ call_new(&pa, dst_new, dst_stride, src, src_stride, w, h);
+ if (memcmp(dst_ref, dst_new, PIXELS))
+ fail();
+ bench_new(&pa, dst_new, dst_stride, src, src_stride, w, h);
+ }
+}
+
+void checkasm_check_vf_eq(void)
+{
+ check_eq();
+ report("eq");
+}
diff --git a/tests/fate/checkasm.mak b/tests/fate/checkasm.mak
index 3893245..b391717 100644
--- a/tests/fate/checkasm.mak
+++ b/tests/fate/checkasm.mak
@@ -28,6 +28,7 @@ FATE_CHECKASM = fate-checkasm-aacpsdsp \
fate-checkasm-v210enc \
fate-checkasm-vf_blend \
fate-checkasm-vf_colorspace \
+ fate-checkasm-vf_eq \
fate-checkasm-vf_gblur \
fate-checkasm-vf_hflip \
fate-checkasm-vf_threshold \
OpenPOWER on IntegriCloud