[FFmpeg-cvslog] checkasm : add test for losslessvideoencdsp for diff bytes and sub_left_pred
Martin Vignali
git at videolan.org
Sun Jan 28 21:24:58 EET 2018
ffmpeg | branch: master | Martin Vignali <martin.vignali at gmail.com> | Sun Jan 14 14:23:42 2018 +0100| [78b982d3b9f11877a5e4408146cc3cb82908862c] | committer: Martin Vignali
checkasm : add test for losslessvideoencdsp for diff bytes and sub_left_pred
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=78b982d3b9f11877a5e4408146cc3cb82908862c
---
tests/checkasm/Makefile | 1 +
tests/checkasm/checkasm.c | 3 ++
tests/checkasm/checkasm.h | 1 +
tests/checkasm/llviddspenc.c | 114 +++++++++++++++++++++++++++++++++++++++++++
tests/fate/checkasm.mak | 1 +
5 files changed, 120 insertions(+)
diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile
index 3525094545..afbd09b940 100644
--- a/tests/checkasm/Makefile
+++ b/tests/checkasm/Makefile
@@ -10,6 +10,7 @@ AVCODECOBJS-$(CONFIG_H264DSP) += h264dsp.o
AVCODECOBJS-$(CONFIG_H264PRED) += h264pred.o
AVCODECOBJS-$(CONFIG_H264QPEL) += h264qpel.o
AVCODECOBJS-$(CONFIG_LLVIDDSP) += llviddsp.o
+AVCODECOBJS-$(CONFIG_LLVIDENCDSP) += llviddspenc.o
AVCODECOBJS-$(CONFIG_VP8DSP) += vp8dsp.o
AVCODECOBJS-$(CONFIG_VIDEODSP) += videodsp.o
diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
index ff0ca5b68d..a4b8aff984 100644
--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -126,6 +126,9 @@ static const struct {
#if CONFIG_HUFFYUVDSP
{ "llviddsp", checkasm_check_llviddsp },
#endif
+ #if CONFIG_LLVIDENCDSP
+ { "llviddspenc", checkasm_check_llviddspenc },
+ #endif
#if CONFIG_PIXBLOCKDSP
{ "pixblockdsp", checkasm_check_pixblockdsp },
#endif
diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h
index cfe9bfb355..3de38e6717 100644
--- a/tests/checkasm/checkasm.h
+++ b/tests/checkasm/checkasm.h
@@ -60,6 +60,7 @@ void checkasm_check_hevc_idct(void);
void checkasm_check_huffyuvdsp(void);
void checkasm_check_jpeg2000dsp(void);
void checkasm_check_llviddsp(void);
+void checkasm_check_llviddspenc(void);
void checkasm_check_pixblockdsp(void);
void checkasm_check_sbrdsp(void);
void checkasm_check_synth_filter(void);
diff --git a/tests/checkasm/llviddspenc.c b/tests/checkasm/llviddspenc.c
new file mode 100644
index 0000000000..31eafd5526
--- /dev/null
+++ b/tests/checkasm/llviddspenc.c
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2016 Alexandra Hájková
+ *
+ * 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 "libavcodec/lossless_videoencdsp.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 struct {uint8_t w, h, s;} planes[] = {
+ {16,16,16}, {21,23,25}, {32,17,48}, {15,128,16}, {128,127,128}
+};
+
+#define MAX_STRIDE 128
+#define MAX_HEIGHT 127
+
+static void check_diff_bytes(LLVidEncDSPContext *c)
+{
+ int i;
+ LOCAL_ALIGNED_32(uint8_t, dst0, [MAX_STRIDE]);
+ LOCAL_ALIGNED_32(uint8_t, dst1, [MAX_STRIDE]);
+ LOCAL_ALIGNED_32(uint8_t, src0, [MAX_STRIDE]);
+ LOCAL_ALIGNED_32(uint8_t, src1, [MAX_STRIDE]);
+ LOCAL_ALIGNED_32(uint8_t, src2, [MAX_STRIDE]);
+ LOCAL_ALIGNED_32(uint8_t, src3, [MAX_STRIDE]);
+
+ declare_func_emms(AV_CPU_FLAG_MMX, void, uint8_t *dst, const uint8_t *src1,
+ const uint8_t *src2, intptr_t w);
+
+ memset(dst0, 0, MAX_STRIDE);
+ memset(dst1, 0, MAX_STRIDE);
+ randomize_buffers(src0, MAX_STRIDE);
+ memcpy(src1, src0, MAX_STRIDE);
+ randomize_buffers(src2, MAX_STRIDE);
+ memcpy(src3, src2, MAX_STRIDE);
+
+ if (check_func(c->diff_bytes, "diff_bytes")) {
+ for (i = 0; i < 5; i ++) {
+ call_ref(dst0, src0, src2, planes[i].w);
+ call_new(dst1, src1, src3, planes[i].w);
+ if (memcmp(dst0, dst1, planes[i].w))
+ fail();
+ }
+ bench_new(dst1, src0, src2, planes[4].w);
+ }
+}
+
+static void check_sub_left_pred(LLVidEncDSPContext *c)
+{
+ int i;
+ LOCAL_ALIGNED_32(uint8_t, dst0, [MAX_STRIDE * MAX_HEIGHT]);
+ LOCAL_ALIGNED_32(uint8_t, dst1, [MAX_STRIDE * MAX_HEIGHT]);
+ LOCAL_ALIGNED_32(uint8_t, src0, [MAX_STRIDE * MAX_HEIGHT]);
+ LOCAL_ALIGNED_32(uint8_t, src1, [MAX_STRIDE * MAX_HEIGHT]);
+
+ declare_func_emms(AV_CPU_FLAG_MMX, void, uint8_t *dst, const uint8_t *src,
+ ptrdiff_t stride, ptrdiff_t width, int height);
+
+ memset(dst0, 0, MAX_STRIDE * MAX_HEIGHT);
+ memset(dst1, 0, MAX_STRIDE * MAX_HEIGHT);
+ randomize_buffers(src0, MAX_STRIDE * MAX_HEIGHT);
+ memcpy(src1, src0, MAX_STRIDE * MAX_HEIGHT);
+
+ if (check_func(c->sub_left_predict, "sub_left_predict")) {
+ for (i = 0; i < 5; i ++) {
+ call_ref(dst0, src0, planes[i].s, planes[i].w, planes[i].h);
+ call_new(dst1, src1, planes[i].s, planes[i].w, planes[i].h);
+ if (memcmp(dst0, dst1, planes[i].w * planes[i].h))
+ fail();
+ break;
+ }
+ bench_new(dst1, src0, planes[4].s, planes[4].w, planes[4].h);
+ }
+}
+
+void checkasm_check_llviddspenc(void)
+{
+ LLVidEncDSPContext c;
+ ff_llvidencdsp_init(&c);
+
+ check_diff_bytes(&c);
+ report("diff_bytes");
+
+ check_sub_left_pred(&c);
+ report("sub_left_predict");
+}
diff --git a/tests/fate/checkasm.mak b/tests/fate/checkasm.mak
index 9216c71cb8..826ac16789 100644
--- a/tests/fate/checkasm.mak
+++ b/tests/fate/checkasm.mak
@@ -16,6 +16,7 @@ FATE_CHECKASM = fate-checkasm-aacpsdsp \
fate-checkasm-hevc_idct \
fate-checkasm-jpeg2000dsp \
fate-checkasm-llviddsp \
+ fate-checkasm-llviddspenc \
fate-checkasm-pixblockdsp \
fate-checkasm-sbrdsp \
fate-checkasm-synth_filter \
More information about the ffmpeg-cvslog
mailing list