diff options
author | Martin Vignali <martin.vignali@gmail.com> | 2017-12-18 11:18:51 +0100 |
---|---|---|
committer | Martin Vignali <martin.vignali@gmail.com> | 2017-12-19 20:59:51 +0100 |
commit | adff97be5e2ff51c0bb66080c2f904ed40b6c571 (patch) | |
tree | 81b92f4d26348c18514f1fc2d278aa9e5b39f052 /tests | |
parent | d31770d9a603596a0ae970328a34c1bf5cff1715 (diff) | |
download | ffmpeg-adff97be5e2ff51c0bb66080c2f904ed40b6c571.tar.gz |
checkasm/vf_interlace : add test for lowpass_line 8 and 16
Diffstat (limited to 'tests')
-rw-r--r-- | tests/checkasm/Makefile | 1 | ||||
-rw-r--r-- | tests/checkasm/checkasm.c | 3 | ||||
-rw-r--r-- | tests/checkasm/checkasm.h | 1 | ||||
-rw-r--r-- | tests/checkasm/vf_interlace.c | 78 | ||||
-rw-r--r-- | tests/fate/checkasm.mak | 1 |
5 files changed, 84 insertions, 0 deletions
diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile index 3525094545..6b5b1684a7 100644 --- a/tests/checkasm/Makefile +++ b/tests/checkasm/Makefile @@ -33,6 +33,7 @@ CHECKASMOBJS-$(CONFIG_AVCODEC) += $(AVCODECOBJS-yes) AVFILTEROBJS-$(CONFIG_BLEND_FILTER) += vf_blend.o AVFILTEROBJS-$(CONFIG_COLORSPACE_FILTER) += vf_colorspace.o AVFILTEROBJS-$(CONFIG_HFLIP_FILTER) += vf_hflip.o +AVFILTEROBJS-$(CONFIG_INTERLACE_FILTER) += vf_interlace.o AVFILTEROBJS-$(CONFIG_THRESHOLD_FILTER) += vf_threshold.o CHECKASMOBJS-$(CONFIG_AVFILTER) += $(AVFILTEROBJS-yes) diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index 45a70aa87f..8a9480c3ca 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -155,6 +155,9 @@ static const struct { #if CONFIG_HFLIP_FILTER { "vf_hflip", checkasm_check_vf_hflip }, #endif + #if CONFIG_INTERLACE_FILTER + { "vf_interlace", checkasm_check_vf_interlace }, + #endif #if CONFIG_THRESHOLD_FILTER { "vf_threshold", checkasm_check_vf_threshold }, #endif diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h index cfe9bfb355..ec57c8a26f 100644 --- a/tests/checkasm/checkasm.h +++ b/tests/checkasm/checkasm.h @@ -66,6 +66,7 @@ void checkasm_check_synth_filter(void); void checkasm_check_utvideodsp(void); void checkasm_check_v210enc(void); void checkasm_check_vf_hflip(void); +void checkasm_check_vf_interlace(void); void checkasm_check_vf_threshold(void); void checkasm_check_vp8dsp(void); void checkasm_check_vp9dsp(void); diff --git a/tests/checkasm/vf_interlace.c b/tests/checkasm/vf_interlace.c new file mode 100644 index 0000000000..d5984c0fc1 --- /dev/null +++ b/tests/checkasm/vf_interlace.c @@ -0,0 +1,78 @@ +/* + * 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/interlace.h" +#include "libavutil/intreadwrite.h" + +#define WIDTH 256 +#define WIDTH_PADDED 256 + 32 +#define SRC_SIZE WIDTH_PADDED*3 + +#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_lowpass_line(int depth){ + LOCAL_ALIGNED_32(uint8_t, src, [SRC_SIZE]); + LOCAL_ALIGNED_32(uint8_t, dst_ref, [WIDTH_PADDED]); + LOCAL_ALIGNED_32(uint8_t, dst_new, [WIDTH_PADDED]); + int w = WIDTH; + int mref = WIDTH_PADDED * -1; + int pref = WIDTH_PADDED; + int i, depth_byte; + InterlaceContext s; + + declare_func(void, uint8_t *dstp, ptrdiff_t linesize, const uint8_t *srcp, + ptrdiff_t mref, ptrdiff_t pref, int clip_max); + + s.lowpass = 1; + s.lowpass = VLPF_LIN; + depth_byte = depth >> 3; + w /= depth_byte; + + memset(src, 0, SRC_SIZE); + memset(dst_ref, 0, WIDTH_PADDED); + memset(dst_new, 0, WIDTH_PADDED); + randomize_buffers(src, SRC_SIZE); + + ff_interlace_init(&s, depth); + + if (check_func(s.lowpass_line, "lowpass_line_%d", depth)) { + for (i = 0; i < 32; i++) { /* simulate crop */ + call_ref(dst_ref, w, src + WIDTH_PADDED, mref - i*depth_byte, pref, 0); + call_new(dst_new, w, src + WIDTH_PADDED, mref - i*depth_byte, pref, 0); + if (memcmp(dst_ref, dst_new, WIDTH - i)) + fail(); + } + bench_new(dst_new, w, src + WIDTH_PADDED, mref, pref, 0); + } +} +void checkasm_check_vf_interlace(void) +{ + check_lowpass_line(8); + report("lowpass_line_8"); + + check_lowpass_line(16); + report("lowpass_line_16"); +} diff --git a/tests/fate/checkasm.mak b/tests/fate/checkasm.mak index 9216c71cb8..03f640b31f 100644 --- a/tests/fate/checkasm.mak +++ b/tests/fate/checkasm.mak @@ -23,6 +23,7 @@ FATE_CHECKASM = fate-checkasm-aacpsdsp \ fate-checkasm-vf_blend \ fate-checkasm-vf_colorspace \ fate-checkasm-vf_hflip \ + fate-checkasm-vf_interlace \ fate-checkasm-vf_threshold \ fate-checkasm-videodsp \ fate-checkasm-vp8dsp \ |