checkasm/vf_hflip : add test for vf_hflip SIMD
Hello, Patch in attach add a checkasm test for vf_hflip (byte and short) Martin
On 12/7/17, Martin Vignali <martin.vignali@gmail.com> wrote:
Hello,
Patch in attach add a checkasm test for vf_hflip (byte and short)
Martin
probably ok
On Thu, Dec 07, 2017 at 09:40:41PM +0100, Martin Vignali wrote:
Hello,
Patch in attach add a checkasm test for vf_hflip (byte and short)
Martin
hflip.h | 1 + vf_hflip.c | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) cac8c66112fd43e63d2fc734a66a156ad37e3d0d 0001-avfilter-vf_hflip-move-context-func-init-in.patch From 16dde326c4ffd8ddf22dbf891c5fc3c093ad8a28 Mon Sep 17 00:00:00 2001 From: Martin Vignali <martin.vignali@gmail.com> Date: Thu, 7 Dec 2017 21:35:42 +0100 Subject: [PATCH 1/2] avfilter/vf_hflip : move context func init in ff_hflip_init
--- libavfilter/hflip.h | 1 + libavfilter/vf_hflip.c | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/libavfilter/hflip.h b/libavfilter/hflip.h index cbe1fb3d8c..204090dbb4 100644 --- a/libavfilter/hflip.h +++ b/libavfilter/hflip.h @@ -33,6 +33,7 @@ typedef struct FlipContext { void (*flip_line[4])(const uint8_t *src, uint8_t *dst, int w); } FlipContext;
+int ff_hflip_init(FlipContext *s, int step[4], int nb_planes); void ff_hflip_init_x86(FlipContext *s, int step[4], int nb_planes);
#endif /* AVFILTER_HFLIP_H */ diff --git a/libavfilter/vf_hflip.c b/libavfilter/vf_hflip.c index 957ddd9900..b77afc77fc 100644 --- a/libavfilter/vf_hflip.c +++ b/libavfilter/vf_hflip.c @@ -131,7 +131,7 @@ static int config_props(AVFilterLink *inlink) const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(inlink->format); const int hsub = pix_desc->log2_chroma_w; const int vsub = pix_desc->log2_chroma_h; - int nb_planes, i; + int nb_planes;
av_image_fill_max_pixsteps(s->max_step, NULL, pix_desc); s->planewidth[0] = s->planewidth[3] = inlink->w; @@ -141,8 +141,15 @@ static int config_props(AVFilterLink *inlink)
nb_planes = av_pix_fmt_count_planes(inlink->format);
+ return ff_hflip_init(s, s->max_step, nb_planes); +} + +int ff_hflip_init(FlipContext *s, int step[4], int nb_planes) +{ + int i; + for (i = 0; i < nb_planes; i++) { - switch (s->max_step[i]) { + switch (step[i]) { case 1: s->flip_line[i] = hflip_byte_c; break; case 2: s->flip_line[i] = hflip_short_c; break; case 3: s->flip_line[i] = hflip_b24_c; break; @@ -153,9 +160,8 @@ static int config_props(AVFilterLink *inlink) return AVERROR_BUG; } } - if (ARCH_X86) - ff_hflip_init_x86(s, s->max_step, nb_planes); + ff_hflip_init_x86(s, step, nb_planes);
return 0; } -- 2.11.0 (Apple Git-81)
checkasm/Makefile | 1 checkasm/checkasm.c | 3 ++ checkasm/checkasm.h | 1 checkasm/vf_hflip.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++ fate/checkasm.mak | 1 5 files changed, 80 insertions(+) 8e11138c838a238905257fd6d1ed47be49ee1d37 0002-checkasm-vf_hflip-add-test-for-vf_hflip-byte-and-sho.patch From 1012af32158bc1d387afdc9fc5cacd83894b77d0 Mon Sep 17 00:00:00 2001 From: Martin Vignali <martin.vignali@gmail.com> Date: Thu, 7 Dec 2017 21:38:20 +0100 Subject: [PATCH 2/2] checkasm/vf_hflip : add test for vf_hflip byte and short simd
maybe iam missing something but my box doesnt like your test: TEST checkasm-vf_hflip Test checkasm-vf_hflip failed. Look at tests/data/fate/checkasm-vf_hflip.err for details. make: *** [fate-checkasm-vf_hflip] Error 1 michael@sandybox:~/ffmpeg-git/ffmpeg$ cat tests/data/fate/checkasm-vf_hflip.err checkasm: using random seed 358531722 SSSE3: hflip_byte_ssse3 (vf_hflip.c:63) - vf_hflip.hflip_byte [FAILED] hflip_short_ssse3 (vf_hflip.c:63) - vf_hflip.hflip_short [FAILED] checkasm: 2 of 2 tests have failed [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If a bugfix only changes things apparently unrelated to the bug with no further explanation, that is a good sign that the bugfix is wrong.
maybe iam missing something but my box doesnt like your test:
Is there a link to these recent commit :
https://github.com/FFmpeg/FFmpeg/commit/dc33fe1d0080e932faa9fe3c7fb4850dfde1... https://github.com/FFmpeg/FFmpeg/commit/f2aa0ce5a059cf02ee4cbd68111dd2ad622e... ? Martin
On Fri, Dec 08, 2017 at 12:34:07PM +0100, Martin Vignali wrote:
maybe iam missing something but my box doesnt like your test:
Is there a link to these recent commit :
https://github.com/FFmpeg/FFmpeg/commit/dc33fe1d0080e932faa9fe3c7fb4850dfde1... https://github.com/FFmpeg/FFmpeg/commit/f2aa0ce5a059cf02ee4cbd68111dd2ad622e... ?
issue still happens with both reverted checkasm: using random seed 1616253308 SSSE3: hflip_byte_ssse3 (vf_hflip.c:63) - vf_hflip.hflip_byte [FAILED] hflip_short_ssse3 (vf_hflip.c:63) - vf_hflip.hflip_short [FAILED] checkasm: 2 of 2 tests have failed [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB No snowflake in an avalanche ever feels responsible. -- Voltaire
issue still happens with both reverted
checkasm: using random seed 1616253308 SSSE3: hflip_byte_ssse3 (vf_hflip.c:63) - vf_hflip.hflip_byte [FAILED] hflip_short_ssse3 (vf_hflip.c:63) - vf_hflip.hflip_short [FAILED] checkasm: 2 of 2 tests have failed
Thanks for testing,
rereading the patch, i found one mistake (for the bench_new part (i use WIDTH instead of w for the short version) But the fail is before. Do you test on X86_32 or x86_64 ? Nasm or Yasm ? I will try to reproduce. Martin
On Fri, Dec 08, 2017 at 06:05:27PM +0100, Martin Vignali wrote:
issue still happens with both reverted
checkasm: using random seed 1616253308 SSSE3: hflip_byte_ssse3 (vf_hflip.c:63) - vf_hflip.hflip_byte [FAILED] hflip_short_ssse3 (vf_hflip.c:63) - vf_hflip.hflip_short [FAILED] checkasm: 2 of 2 tests have failed
Thanks for testing,
rereading the patch, i found one mistake (for the bench_new part (i use WIDTH instead of w for the short version) But the fail is before.
Do you test on X86_32 or x86_64 ?
failure occurs on both
Nasm or Yasm ?
NASM version 2.10.09 compiled on Dec 29 2013 [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB "You are 36 times more likely to die in a bathtub than at the hands of a terrorist. Also, you are 2.5 times more likely to become a president and 2 times more likely to become an astronaut, than to die in a terrorist attack." -- Thoughty2
Do you test on X86_32 or x86_64 ?
failure occurs on both
Nasm or Yasm ?
NASM version 2.10.09 compiled on Dec 29 2013
I try to compile with the same nasm version (on os X, X86_64)
using --x86asmexe=nasm_exe_path2.10rc9 in the configure And the checkasm also pass ./tests/checkasm/checkasm --test=vf_hflip --bench --seed 1616253308 benchmarking with native FFmpeg timers nop: 34.9 checkasm: using random seed 1616253308 SSSE3: - vf_hflip.hflip_byte [OK] - vf_hflip.hflip_short [OK] checkasm: all 2 tests passed hflip_byte_c: 28.0 hflip_byte_ssse3: 27.0 hflip_short_c: 277.7 hflip_short_ssse3: 71.0 Any ideas, why it fail for you ? In attach new patch (who probably doesn't fix the problem in your sandybox) 001 : unchanged 002 : add test for various width, change bench new, to use w variable and remove the fate-checkasm. Don't know if it's ok, to add a checkasm, without adding it to fate/checkasm (because it fails). It's convenient to have this kind of test to improve the asm (instead of not having a test at all) Martin
W dniu 09.12.2017 o 15:46, Martin Vignali pisze:
Do you test on X86_32 or x86_64 ?
failure occurs on both
Nasm or Yasm ?
NASM version 2.10.09 compiled on Dec 29 2013
I try to compile with the same nasm version (on os X, X86_64)
using --x86asmexe=nasm_exe_path2.10rc9 in the configure
And the checkasm also pass
./tests/checkasm/checkasm --test=vf_hflip --bench --seed 1616253308 benchmarking with native FFmpeg timers nop: 34.9 checkasm: using random seed 1616253308 SSSE3: - vf_hflip.hflip_byte [OK] - vf_hflip.hflip_short [OK] checkasm: all 2 tests passed hflip_byte_c: 28.0 hflip_byte_ssse3: 27.0 hflip_short_c: 277.7 hflip_short_ssse3: 71.0
Any ideas, why it fail for you ?
For me it fails too. Please look at part from libavfilter/vf_hfilp.c: outrow = out->data[plane] + start * out->linesize[plane]; inrow = in ->data[plane] + start * in->linesize[plane] + (width - 1) * step; for (i = start; i < end; i++) { s->flip_line[plane](inrow, outrow, width); and now at part from tests/checkasm/vf_hflip.c: call_ref(src, dst_ref, w); call_new(src, dst_new, w); For me there is no "src + (width - 1) * step" in tests/checkasm/vf_hflip.c You pass start of the src buffer but you should pass end of the buffer. Mateusz
For me there is no "src + (width - 1) * step" in tests/checkasm/vf_hflip.c
You pass start of the src buffer but you should pass end of the buffer.
Thanks !
New patch in attach. Martin
W dniu 10.12.2017 o 21:13, Martin Vignali pisze:
For me there is no "src + (width - 1) * step" in tests/checkasm/vf_hflip.c
You pass start of the src buffer but you should pass end of the buffer.
Thanks !
New patch in attach.
Now it is OK in my system (mingw 32/64-bit, VS 2017 64-bit). Thanks! Mateusz
W dniu 11.12.2017 o 00:51, Mateusz pisze:
W dniu 10.12.2017 o 21:13, Martin Vignali pisze:
For me there is no "src + (width - 1) * step" in tests/checkasm/vf_hflip.c
You pass start of the src buffer but you should pass end of the buffer.
Thanks !
New patch in attach.
Now it is OK in my system (mingw 32/64-bit, VS 2017 64-bit). Thanks!
VS 2017 32-bit doesn't run this test: CC tests/checkasm/vf_colorspace.o vf_colorspace.c CC tests/checkasm/vf_hflip.o vf_hflip.c CC tests/checkasm/vf_threshold.o vf_threshold.c CC tests/checkasm/videodsp.o videodsp.c CC tests/checkasm/vp8dsp.o vp8dsp.c CC tests/checkasm/vp9dsp.o vp9dsp.c f:\ffmpeg\libavcodec\get_bits.h(308): warning C4101: 're_cache': unreferenced local variable X86ASM tests/checkasm/x86/checkasm.o STRIP tests/checkasm/x86/checkasm.o skipping strip -x tests/checkasm/x86/checkasm.o LD tests/checkasm/checkasm.exe TEST checkasm-aacpsdsp TEST checkasm-alacdsp TEST checkasm-audiodsp TEST checkasm-blockdsp TEST checkasm-bswapdsp TEST checkasm-exrdsp TEST checkasm-fixed_dsp TEST checkasm-flacdsp TEST checkasm-float_dsp TEST checkasm-fmtconvert TEST checkasm-g722dsp TEST checkasm-h264dsp TEST checkasm-h264pred TEST checkasm-h264qpel TEST checkasm-hevc_add_res TEST checkasm-hevc_idct TEST checkasm-jpeg2000dsp TEST checkasm-llviddsp TEST checkasm-pixblockdsp TEST checkasm-sbrdsp TEST checkasm-synth_filter TEST checkasm-v210enc TEST checkasm-vf_blend TEST checkasm-vf_colorspace TEST checkasm-vf_threshold TEST checkasm-videodsp I don't know why. 64-bit VS 2017 tests vf_hflip, 32/64-bit mingw also. If I run this test from command line it works (in 32-bit VS 2017): $ tests/checkasm/checkasm --test=vf_hflip --bench --seed 1616253308 benchmarking with native FFmpeg timers nop: 19.3 checkasm: using random seed 1616253308 SSSE3: - vf_hflip.hflip_byte [OK] - vf_hflip.hflip_short [OK] checkasm: all 2 tests passed hflip_byte_c: 274.1 hflip_byte_ssse3: 18.1 hflip_short_c: 194.1 hflip_short_ssse3: 18.9 Any ideas? Mateusz
2017-12-11 10:49 GMT+01:00 Mateusz <mateuszb@poczta.onet.pl>:
W dniu 11.12.2017 o 00:51, Mateusz pisze:
W dniu 10.12.2017 o 21:13, Martin Vignali pisze:
For me there is no "src + (width - 1) * step" in
tests/checkasm/vf_hflip.c
You pass start of the src buffer but you should pass end of the buffer.
Thanks !
New patch in attach.
Now it is OK in my system (mingw 32/64-bit, VS 2017 64-bit). Thanks!
VS 2017 32-bit doesn't run this test: CC tests/checkasm/vf_colorspace.o vf_colorspace.c CC tests/checkasm/vf_hflip.o vf_hflip.c CC tests/checkasm/vf_threshold.o vf_threshold.c CC tests/checkasm/videodsp.o videodsp.c CC tests/checkasm/vp8dsp.o vp8dsp.c CC tests/checkasm/vp9dsp.o vp9dsp.c f:\ffmpeg\libavcodec\get_bits.h(308): warning C4101: 're_cache': unreferenced local variable X86ASM tests/checkasm/x86/checkasm.o STRIP tests/checkasm/x86/checkasm.o skipping strip -x tests/checkasm/x86/checkasm.o LD tests/checkasm/checkasm.exe TEST checkasm-aacpsdsp TEST checkasm-alacdsp TEST checkasm-audiodsp TEST checkasm-blockdsp TEST checkasm-bswapdsp TEST checkasm-exrdsp TEST checkasm-fixed_dsp TEST checkasm-flacdsp TEST checkasm-float_dsp TEST checkasm-fmtconvert TEST checkasm-g722dsp TEST checkasm-h264dsp TEST checkasm-h264pred TEST checkasm-h264qpel TEST checkasm-hevc_add_res TEST checkasm-hevc_idct TEST checkasm-jpeg2000dsp TEST checkasm-llviddsp TEST checkasm-pixblockdsp TEST checkasm-sbrdsp TEST checkasm-synth_filter TEST checkasm-v210enc TEST checkasm-vf_blend TEST checkasm-vf_colorspace TEST checkasm-vf_threshold TEST checkasm-videodsp
I don't know why. 64-bit VS 2017 tests vf_hflip, 32/64-bit mingw also.
If I run this test from command line it works (in 32-bit VS 2017): $ tests/checkasm/checkasm --test=vf_hflip --bench --seed 1616253308 benchmarking with native FFmpeg timers nop: 19.3 checkasm: using random seed 1616253308 SSSE3: - vf_hflip.hflip_byte [OK] - vf_hflip.hflip_short [OK] checkasm: all 2 tests passed hflip_byte_c: 274.1 hflip_byte_ssse3: 18.1 hflip_short_c: 194.1 hflip_short_ssse3: 18.9
Any ideas?
Do you mean, it's not run when you use make fate-checkasm ? or not run when you use ./tests/checkasm/checkasm ?
If it's for the fate, i not put in the latest patch, the fate line, to run this test need to add in ./tests/fate/checkasm.mak : fate-checkasm-vf_hflip in the fate-checkasm part Martin
W dniu 11.12.2017 o 11:00, Martin Vignali pisze:
2017-12-11 10:49 GMT+01:00 Mateusz <mateuszb@poczta.onet.pl>:
W dniu 11.12.2017 o 00:51, Mateusz pisze:
W dniu 10.12.2017 o 21:13, Martin Vignali pisze:
For me there is no "src + (width - 1) * step" in
tests/checkasm/vf_hflip.c
You pass start of the src buffer but you should pass end of the buffer.
Thanks !
New patch in attach.
Now it is OK in my system (mingw 32/64-bit, VS 2017 64-bit). Thanks!
VS 2017 32-bit doesn't run this test: CC tests/checkasm/vf_colorspace.o vf_colorspace.c CC tests/checkasm/vf_hflip.o vf_hflip.c CC tests/checkasm/vf_threshold.o vf_threshold.c CC tests/checkasm/videodsp.o videodsp.c CC tests/checkasm/vp8dsp.o vp8dsp.c CC tests/checkasm/vp9dsp.o vp9dsp.c f:\ffmpeg\libavcodec\get_bits.h(308): warning C4101: 're_cache': unreferenced local variable X86ASM tests/checkasm/x86/checkasm.o STRIP tests/checkasm/x86/checkasm.o skipping strip -x tests/checkasm/x86/checkasm.o LD tests/checkasm/checkasm.exe TEST checkasm-aacpsdsp TEST checkasm-alacdsp TEST checkasm-audiodsp TEST checkasm-blockdsp TEST checkasm-bswapdsp TEST checkasm-exrdsp TEST checkasm-fixed_dsp TEST checkasm-flacdsp TEST checkasm-float_dsp TEST checkasm-fmtconvert TEST checkasm-g722dsp TEST checkasm-h264dsp TEST checkasm-h264pred TEST checkasm-h264qpel TEST checkasm-hevc_add_res TEST checkasm-hevc_idct TEST checkasm-jpeg2000dsp TEST checkasm-llviddsp TEST checkasm-pixblockdsp TEST checkasm-sbrdsp TEST checkasm-synth_filter TEST checkasm-v210enc TEST checkasm-vf_blend TEST checkasm-vf_colorspace TEST checkasm-vf_threshold TEST checkasm-videodsp
I don't know why. 64-bit VS 2017 tests vf_hflip, 32/64-bit mingw also.
If I run this test from command line it works (in 32-bit VS 2017): $ tests/checkasm/checkasm --test=vf_hflip --bench --seed 1616253308 benchmarking with native FFmpeg timers nop: 19.3 checkasm: using random seed 1616253308 SSSE3: - vf_hflip.hflip_byte [OK] - vf_hflip.hflip_short [OK] checkasm: all 2 tests passed hflip_byte_c: 274.1 hflip_byte_ssse3: 18.1 hflip_short_c: 194.1 hflip_short_ssse3: 18.9
Any ideas?
Do you mean, it's not run when you use make fate-checkasm ? or not run when you use ./tests/checkasm/checkasm ?
If it's for the fate, i not put in the latest patch, the fate line, to run this test need to add in ./tests/fate/checkasm.mak : fate-checkasm-vf_hflip in the fate-checkasm part
It doesn't run (the test is skipped) on 32-bit VS 2017 with command: configure --enable-gpl --toolchain=msvc && make fate-rsync SAMPLES=../fate-suite && make fate SAMPLES=../fate-suite With exactly the same command it runs on 64-bit VS 2017. With similar command line (without '--toolchain=msvc') it runs on 32-bit and 64-bit mingw/GCC. Mateusz
It doesn't run (the test is skipped) on 32-bit VS 2017 with command: configure --enable-gpl --toolchain=msvc && make fate-rsync SAMPLES=../fate-suite && make fate SAMPLES=../fate-suite
With exactly the same command it runs on 64-bit VS 2017. With similar command line (without '--toolchain=msvc') it runs on 32-bit and 64-bit mingw/GCC.
Strange, the test is not supposed to be run with fate, using the previous patch. New patch in attach, with an add in fate/checkasm.mak Martin
W dniu 11.12.2017 o 11:28, Martin Vignali pisze:
It doesn't run (the test is skipped) on 32-bit VS 2017 with command: configure --enable-gpl --toolchain=msvc && make fate-rsync SAMPLES=../fate-suite && make fate SAMPLES=../fate-suite
With exactly the same command it runs on 64-bit VS 2017. With similar command line (without '--toolchain=msvc') it runs on 32-bit and 64-bit mingw/GCC.
Strange, the test is not supposed to be run with fate, using the previous patch.
New patch in attach, with an add in fate/checkasm.mak
My bad, sorry for misinformation. The old patch that broke fate was in fate, next wasn't and I checked only end of fate tests (I wrongly assume that it passes fate) but 32-bit VS 2017 hangs at 'fate-api-png-codec-param' and I saw that it was no vf_hflip in checkasm. Mateusz
On Mon, Dec 11, 2017 at 11:28:53AM +0100, Martin Vignali wrote:
It doesn't run (the test is skipped) on 32-bit VS 2017 with command: configure --enable-gpl --toolchain=msvc && make fate-rsync SAMPLES=../fate-suite && make fate SAMPLES=../fate-suite
With exactly the same command it runs on 64-bit VS 2017. With similar command line (without '--toolchain=msvc') it runs on 32-bit and 64-bit mingw/GCC.
Strange, the test is not supposed to be run with fate, using the previous patch.
New patch in attach, with an add in fate/checkasm.mak
Martin
hflip.h | 1 + vf_hflip.c | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) b772a922ec6882c3954caae6fca47d74ba9f1939 0001-avfilter-vf_hflip-move-context-func-init-in.patch From c3e8eaa7f9cd40a833cd679e975f48d1763287f9 Mon Sep 17 00:00:00 2001 From: Martin Vignali <martin.vignali@gmail.com> Date: Mon, 11 Dec 2017 11:22:56 +0100 Subject: [PATCH 1/2] avfilter/vf_hflip : move context func init in ff_hflip_init
Tested on linux/mingw 32/64 x86 and linux mips/arm thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB While the State exists there can be no freedom; when there is freedom there will be no State. -- Vladimir Lenin
participants (4)
-
Martin Vignali -
Mateusz -
Michael Niedermayer -
Paul B Mahol