diff options
author | James Almer <jamrial@gmail.com> | 2017-11-19 00:32:25 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2017-11-20 18:33:58 -0300 |
commit | aea0f06db74c1f924429d3cf9ff9f803d00feaf5 (patch) | |
tree | 3d167d59409fb4bbcb9580f64d4c798234b21284 | |
parent | 501435e5e6459643f37596f7ab849242d0227c23 (diff) | |
download | ffmpeg-aea0f06db74c1f924429d3cf9ff9f803d00feaf5.tar.gz |
x86/jpeg2000dsp: add ff_ict_float_{fma3,fma4}
jpeg2000_ict_float_c: 2296.0
jpeg2000_ict_float_sse: 628.0
jpeg2000_ict_float_avx: 317.0
jpeg2000_ict_float_fma3: 262.0
Signed-off-by: James Almer <jamrial@gmail.com>
-rw-r--r-- | libavcodec/x86/jpeg2000dsp.asm | 20 | ||||
-rw-r--r-- | libavcodec/x86/jpeg2000dsp_init.c | 10 |
2 files changed, 30 insertions, 0 deletions
diff --git a/libavcodec/x86/jpeg2000dsp.asm b/libavcodec/x86/jpeg2000dsp.asm index 56b5fbd606..61dfdd4f71 100644 --- a/libavcodec/x86/jpeg2000dsp.asm +++ b/libavcodec/x86/jpeg2000dsp.asm @@ -74,6 +74,19 @@ align 16 movaps m1, [src1q+csizeq] movaps m2, [src2q+csizeq] +%if cpuflag(fma4) || cpuflag(fma3) +%if cpuflag(fma4) + fnmaddps m5, m1, ICT1, m0 + fmaddps m4, m2, ICT0, m0 +%else ; fma3 + movaps m5, m1 + movaps m4, m2 + fnmaddps m5, m5, ICT1, m0 + fmaddps m4, m4, ICT0, m0 +%endif + fmaddps m0, m1, ICT3, m0 + fnmaddps m5, m2, ICT2, m5 +%else ; non FMA %if cpuflag(avx) mulps m5, m1, ICT1 mulps m4, m2, ICT0 @@ -93,6 +106,7 @@ align 16 addps m4, m4, m0 addps m0, m0, m1 subps m5, m5, m2 +%endif movaps [src0q+csizeq], m4 movaps [src2q+csizeq], m0 @@ -106,6 +120,12 @@ INIT_XMM sse ICT_FLOAT 10 INIT_YMM avx ICT_FLOAT 9 +%if HAVE_FMA4_EXTERNAL +INIT_XMM fma4 +ICT_FLOAT 9 +%endif +INIT_YMM fma3 +ICT_FLOAT 9 ;*************************************************************************** ; ff_rct_int_<opt>(int32_t *src0, int32_t *src1, int32_t *src2, int csize) diff --git a/libavcodec/x86/jpeg2000dsp_init.c b/libavcodec/x86/jpeg2000dsp_init.c index baa81383ea..7310a1d0e1 100644 --- a/libavcodec/x86/jpeg2000dsp_init.c +++ b/libavcodec/x86/jpeg2000dsp_init.c @@ -26,6 +26,8 @@ void ff_ict_float_sse(void *src0, void *src1, void *src2, int csize); void ff_ict_float_avx(void *src0, void *src1, void *src2, int csize); +void ff_ict_float_fma3(void *src0, void *src1, void *src2, int csize); +void ff_ict_float_fma4(void *src0, void *src1, void *src2, int csize); void ff_rct_int_sse2 (void *src0, void *src1, void *src2, int csize); void ff_rct_int_avx2 (void *src0, void *src1, void *src2, int csize); @@ -44,6 +46,14 @@ av_cold void ff_jpeg2000dsp_init_x86(Jpeg2000DSPContext *c) c->mct_decode[FF_DWT97] = ff_ict_float_avx; } + if (EXTERNAL_FMA4(cpu_flags)) { + c->mct_decode[FF_DWT97] = ff_ict_float_fma4; + } + + if (EXTERNAL_FMA3_FAST(cpu_flags)) { + c->mct_decode[FF_DWT97] = ff_ict_float_fma3; + } + if (EXTERNAL_AVX2_FAST(cpu_flags)) { c->mct_decode[FF_DWT53] = ff_rct_int_avx2; } |