ffmpeg | branch: master | Clément Bœsch <[email protected]> | Wed Mar 22 16:29:44 2017 +0100| [7c2a7f9c11ab11c4a39cb5cd9fd7f5d8aa34d7cf] | committer: Clément Bœsch
Merge commit '22c3ab18646924ce24dc6017a9e882ff69689e40' * commit '22c3ab18646924ce24dc6017a9e882ff69689e40': checkasm: Add test for huffyuvdsp add_bytes huffyuvdsp is renamed to llviddsp to be consistent with our codebase. Note: af607b7e07 wasn't actually required for this test since this commit is not actually testing huffyuvdsp. Merged-by: Clément Bœsch <[email protected]> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7c2a7f9c11ab11c4a39cb5cd9fd7f5d8aa34d7cf --- tests/checkasm/Makefile | 1 + tests/checkasm/checkasm.c | 3 ++ tests/checkasm/checkasm.h | 1 + tests/checkasm/llviddsp.c | 76 +++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 81 insertions(+) diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile index 5cd92c4..29b7761 100644 --- a/tests/checkasm/Makefile +++ b/tests/checkasm/Makefile @@ -8,6 +8,7 @@ AVCODECOBJS-$(CONFIG_FMTCONVERT) += fmtconvert.o AVCODECOBJS-$(CONFIG_H264DSP) += h264dsp.o AVCODECOBJS-$(CONFIG_H264PRED) += h264pred.o AVCODECOBJS-$(CONFIG_H264QPEL) += h264qpel.o +AVCODECOBJS-$(CONFIG_LLVIDDSP) += llviddsp.o AVCODECOBJS-$(CONFIG_VP8DSP) += vp8dsp.o AVCODECOBJS-$(CONFIG_VIDEODSP) += videodsp.o diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index 95e2ea3..165bb00 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -101,6 +101,9 @@ static const struct { #if CONFIG_JPEG2000_DECODER { "jpeg2000dsp", checkasm_check_jpeg2000dsp }, #endif + #if CONFIG_HUFFYUVDSP + { "llviddsp", checkasm_check_llviddsp }, + #endif #if CONFIG_PIXBLOCKDSP { "pixblockdsp", checkasm_check_pixblockdsp }, #endif diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h index e3dcf2c..18f65e3 100644 --- a/tests/checkasm/checkasm.h +++ b/tests/checkasm/checkasm.h @@ -44,6 +44,7 @@ void checkasm_check_h264pred(void); void checkasm_check_h264qpel(void); void checkasm_check_hevc_idct(void); void checkasm_check_jpeg2000dsp(void); +void checkasm_check_llviddsp(void); void checkasm_check_pixblockdsp(void); void checkasm_check_synth_filter(void); void checkasm_check_v210enc(void); diff --git a/tests/checkasm/llviddsp.c b/tests/checkasm/llviddsp.c new file mode 100644 index 0000000..e42873b --- /dev/null +++ b/tests/checkasm/llviddsp.c @@ -0,0 +1,76 @@ +/* + * 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_videodsp.h" + +#include "checkasm.h" + +#define randomize_buffers(buf, size) \ + do { \ + int j; \ + for (j = 0; j < size; j++) \ + buf[j] = rnd() & 0xFF; \ + } while (0) + +static void check_add_bytes(LLVidDSPContext c, int width) +{ + uint8_t *src0 = av_mallocz(width); + uint8_t *src1 = av_mallocz(width); + uint8_t *dst0 = av_mallocz(width); + uint8_t *dst1 = av_mallocz(width); + declare_func_emms(AV_CPU_FLAG_MMX, void, uint8_t *dst, uint8_t *src, int w); + + if (!src0 || !src1 || !dst0 || !dst1) + fail(); + + randomize_buffers(src0, width); + memcpy(src1, src0, width); + + if (check_func(c.add_bytes, "add_bytes")) { + call_ref(dst0, src0, width); + call_new(dst1, src1, width); + if (memcmp(dst0, dst1, width)) + fail(); + bench_new(dst1, src1, width); + } + + av_free(src0); + av_free(src1); + av_free(dst0); + av_free(dst1); +} + +void checkasm_check_llviddsp(void) +{ + LLVidDSPContext c; + int width = 16 * av_clip(rnd(), 16, 128); + + ff_llviddsp_init(&c); + + check_add_bytes(c, width); + + report("add_bytes"); +} ====================================================================== diff --cc tests/checkasm/Makefile index 5cd92c4,9b3df55..29b7761 --- a/tests/checkasm/Makefile +++ b/tests/checkasm/Makefile @@@ -8,15 -7,12 +8,16 @@@ AVCODECOBJS-$(CONFIG_FMTCONVERT AVCODECOBJS-$(CONFIG_H264DSP) += h264dsp.o AVCODECOBJS-$(CONFIG_H264PRED) += h264pred.o AVCODECOBJS-$(CONFIG_H264QPEL) += h264qpel.o ++AVCODECOBJS-$(CONFIG_LLVIDDSP) += llviddsp.o AVCODECOBJS-$(CONFIG_VP8DSP) += vp8dsp.o +AVCODECOBJS-$(CONFIG_VIDEODSP) += videodsp.o # decoders/encoders -AVCODECOBJS-$(CONFIG_DCA_DECODER) += dcadsp.o synth_filter.o -AVCODECOBJS-$(CONFIG_HEVC_DECODER) += hevc_mc.o hevc_idct.o +AVCODECOBJS-$(CONFIG_ALAC_DECODER) += alacdsp.o +AVCODECOBJS-$(CONFIG_DCA_DECODER) += synth_filter.o +AVCODECOBJS-$(CONFIG_JPEG2000_DECODER) += jpeg2000dsp.o +AVCODECOBJS-$(CONFIG_PIXBLOCKDSP) += pixblockdsp.o +AVCODECOBJS-$(CONFIG_HEVC_DECODER) += hevc_idct.o AVCODECOBJS-$(CONFIG_V210_ENCODER) += v210enc.o AVCODECOBJS-$(CONFIG_VP9_DECODER) += vp9dsp.o diff --cc tests/checkasm/checkasm.c index 95e2ea3,040c4eb..165bb00 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@@ -64,66 -64,46 +64,69 @@@ static const struct const char *name; void (*func)(void); } tests[] = { -#if CONFIG_AUDIODSP - { "audiodsp", checkasm_check_audiodsp }, +#if CONFIG_AVCODEC + #if CONFIG_ALAC_DECODER + { "alacdsp", checkasm_check_alacdsp }, + #endif + #if CONFIG_AUDIODSP + { "audiodsp", checkasm_check_audiodsp }, + #endif + #if CONFIG_BLOCKDSP + { "blockdsp", checkasm_check_blockdsp }, + #endif + #if CONFIG_BSWAPDSP + { "bswapdsp", checkasm_check_bswapdsp }, + #endif + #if CONFIG_DCA_DECODER + { "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_H264DSP + { "h264dsp", checkasm_check_h264dsp }, + #endif + #if CONFIG_H264PRED + { "h264pred", checkasm_check_h264pred }, + #endif + #if CONFIG_H264QPEL + { "h264qpel", checkasm_check_h264qpel }, + #endif + #if CONFIG_HEVC_DECODER + { "hevc_idct", checkasm_check_hevc_idct }, + #endif + #if CONFIG_JPEG2000_DECODER + { "jpeg2000dsp", checkasm_check_jpeg2000dsp }, + #endif ++ #if CONFIG_HUFFYUVDSP ++ { "llviddsp", checkasm_check_llviddsp }, ++ #endif + #if CONFIG_PIXBLOCKDSP + { "pixblockdsp", checkasm_check_pixblockdsp }, + #endif + #if CONFIG_V210_ENCODER + { "v210enc", checkasm_check_v210enc }, + #endif + #if CONFIG_VP8DSP + { "vp8dsp", checkasm_check_vp8dsp }, + #endif + #if CONFIG_VP9_DECODER + { "vp9dsp", checkasm_check_vp9dsp }, + #endif + #if CONFIG_VIDEODSP + { "videodsp", checkasm_check_videodsp }, + #endif #endif -#if CONFIG_BLOCKDSP - { "blockdsp", checkasm_check_blockdsp }, -#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_FMTCONVERT - { "fmtconvert", checkasm_check_fmtconvert }, -#endif -#if CONFIG_H264DSP - { "h264dsp", checkasm_check_h264dsp }, -#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 }, - { "hevc_idct", checkasm_check_hevc_idct }, -#endif -#if CONFIG_HUFFYUVDSP - { "huffyuvdsp", checkasm_check_huffyuvdsp }, -#endif -#if CONFIG_V210_ENCODER - { "v210enc", checkasm_check_v210enc }, -#endif -#if CONFIG_VP8DSP - { "vp8dsp", checkasm_check_vp8dsp }, -#endif -#if CONFIG_VP9_DECODER - { "vp9dsp", checkasm_check_vp9dsp }, +#if CONFIG_AVFILTER + #if CONFIG_BLEND_FILTER + { "vf_blend", checkasm_check_blend }, + #endif + #if CONFIG_COLORSPACE_FILTER + { "vf_colorspace", checkasm_check_colorspace }, + #endif #endif { NULL } }; diff --cc tests/checkasm/checkasm.h index e3dcf2c,5a4c056..18f65e3 --- a/tests/checkasm/checkasm.h +++ b/tests/checkasm/checkasm.h @@@ -43,8 -40,8 +43,9 @@@ void checkasm_check_h264dsp(void) void checkasm_check_h264pred(void); void checkasm_check_h264qpel(void); void checkasm_check_hevc_idct(void); -void checkasm_check_hevc_mc(void); -void checkasm_check_huffyuvdsp(void); +void checkasm_check_jpeg2000dsp(void); ++void checkasm_check_llviddsp(void); +void checkasm_check_pixblockdsp(void); void checkasm_check_synth_filter(void); void checkasm_check_v210enc(void); void checkasm_check_vp8dsp(void); diff --cc tests/checkasm/llviddsp.c index 0000000,0000000..e42873b new file mode 100644 --- /dev/null +++ b/tests/checkasm/llviddsp.c @@@ -1,0 -1,0 +1,76 @@@ ++/* ++ * 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_videodsp.h" ++ ++#include "checkasm.h" ++ ++#define randomize_buffers(buf, size) \ ++ do { \ ++ int j; \ ++ for (j = 0; j < size; j++) \ ++ buf[j] = rnd() & 0xFF; \ ++ } while (0) ++ ++static void check_add_bytes(LLVidDSPContext c, int width) ++{ ++ uint8_t *src0 = av_mallocz(width); ++ uint8_t *src1 = av_mallocz(width); ++ uint8_t *dst0 = av_mallocz(width); ++ uint8_t *dst1 = av_mallocz(width); ++ declare_func_emms(AV_CPU_FLAG_MMX, void, uint8_t *dst, uint8_t *src, int w); ++ ++ if (!src0 || !src1 || !dst0 || !dst1) ++ fail(); ++ ++ randomize_buffers(src0, width); ++ memcpy(src1, src0, width); ++ ++ if (check_func(c.add_bytes, "add_bytes")) { ++ call_ref(dst0, src0, width); ++ call_new(dst1, src1, width); ++ if (memcmp(dst0, dst1, width)) ++ fail(); ++ bench_new(dst1, src1, width); ++ } ++ ++ av_free(src0); ++ av_free(src1); ++ av_free(dst0); ++ av_free(dst1); ++} ++ ++void checkasm_check_llviddsp(void) ++{ ++ LLVidDSPContext c; ++ int width = 16 * av_clip(rnd(), 16, 128); ++ ++ ff_llviddsp_init(&c); ++ ++ check_add_bytes(c, width); ++ ++ report("add_bytes"); ++} _______________________________________________ ffmpeg-cvslog mailing list [email protected] http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
