diff options
author | Clément Bœsch <u@pkh.me> | 2017-03-22 16:29:44 +0100 |
---|---|---|
committer | Clément Bœsch <u@pkh.me> | 2017-03-22 16:31:38 +0100 |
commit | 7c2a7f9c11ab11c4a39cb5cd9fd7f5d8aa34d7cf (patch) | |
tree | ed9dd904e96149a9563b5295f572cd663f9bc5d1 /tests/checkasm/llviddsp.c | |
parent | af607b7e0787a8d3af418ed2a03c48669ba3397c (diff) | |
parent | 22c3ab18646924ce24dc6017a9e882ff69689e40 (diff) | |
download | ffmpeg-7c2a7f9c11ab11c4a39cb5cd9fd7f5d8aa34d7cf.tar.gz |
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 <u@pkh.me>
Diffstat (limited to 'tests/checkasm/llviddsp.c')
-rw-r--r-- | tests/checkasm/llviddsp.c | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/tests/checkasm/llviddsp.c b/tests/checkasm/llviddsp.c new file mode 100644 index 0000000000..e42873bd20 --- /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"); +} |