[FFmpeg-cvslog] x86/synth_filter: add synth_filter_fma3

James Almer git at videolan.org
Sat Apr 5 00:13:47 CEST 2014


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Thu Mar 20 15:37:56 2014 -0300| [c74b86699c86bdf62e8570f41d8a38be5710baa3] | committer: Anton Khirnov

x86/synth_filter: add synth_filter_fma3

Signed-off-by: James Almer <jamrial at gmail.com>
Signed-off-by: Anton Khirnov <anton at khirnov.net>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c74b86699c86bdf62e8570f41d8a38be5710baa3
---

 libavcodec/x86/dcadsp.asm    |   22 ++++++++++++++++++++++
 libavcodec/x86/dcadsp_init.c |    6 ++++++
 2 files changed, 28 insertions(+)

diff --git a/libavcodec/x86/dcadsp.asm b/libavcodec/x86/dcadsp.asm
index 662cb96..59d96bf 100644
--- a/libavcodec/x86/dcadsp.asm
+++ b/libavcodec/x86/dcadsp.asm
@@ -230,6 +230,14 @@ DCA_LFE_FIR 1
     SHUF         m11,  ptr2 + j + (15 - 3) * 4 - mmsize, m12
     mova         m12, [ptr1 + j + mmsize]
 %endif
+%if cpuflag(fma3)
+    fmaddps       m2, m6,  [win + %1 + j + 16 * 4], m2
+    fnmaddps      m1, m5,  [win + %1 + j], m1
+%if ARCH_X86_64
+    fmaddps       m8, m12, [win + %1 + j + mmsize + 16 * 4], m8
+    fnmaddps      m7, m11, [win + %1 + j + mmsize], m7
+%endif
+%else ; non-FMA
     mulps         m6, m6,  [win + %1 + j + 16 * 4]
     mulps         m5, m5,  [win + %1 + j]
 %if ARCH_X86_64
@@ -242,6 +250,7 @@ DCA_LFE_FIR 1
     addps         m8, m8, m12
     subps         m7, m7, m11
 %endif
+%endif ; cpuflag(fma3)
     ;~ c += window[i + j + 32] * (synth_buf[16 + i + j])
     ;~ d += window[i + j + 48] * (synth_buf[31 - i + j])
     SHUF          m6,  ptr2 + j + (31 - 3) * 4, m5
@@ -250,6 +259,14 @@ DCA_LFE_FIR 1
     SHUF         m12,  ptr2 + j + (31 - 3) * 4 - mmsize, m11
     mova         m11, [ptr1 + j + mmsize + 16 * 4]
 %endif
+%if cpuflag(fma3)
+    fmaddps       m3, m5,  [win + %1 + j + 32 * 4], m3
+    fmaddps       m4, m6,  [win + %1 + j + 48 * 4], m4
+%if ARCH_X86_64
+    fmaddps       m9, m11, [win + %1 + j + mmsize + 32 * 4], m9
+    fmaddps      m10, m12, [win + %1 + j + mmsize + 48 * 4], m10
+%endif
+%else ; non-FMA
     mulps         m5, m5,  [win + %1 + j + 32 * 4]
     mulps         m6, m6,  [win + %1 + j + 48 * 4]
 %if ARCH_X86_64
@@ -262,6 +279,7 @@ DCA_LFE_FIR 1
     addps         m9, m9, m11
     addps        m10, m10, m12
 %endif
+%endif ; cpuflag(fma3)
     sub            j, 64 * 4
 %endmacro
 
@@ -400,3 +418,7 @@ INIT_XMM sse2
 SYNTH_FILTER
 INIT_YMM avx
 SYNTH_FILTER
+%if HAVE_FMA3_EXTERNAL
+INIT_YMM fma3
+SYNTH_FILTER
+%endif
diff --git a/libavcodec/x86/dcadsp_init.c b/libavcodec/x86/dcadsp_init.c
index d7e0d65..beef288 100644
--- a/libavcodec/x86/dcadsp_init.c
+++ b/libavcodec/x86/dcadsp_init.c
@@ -82,6 +82,9 @@ SYNTH_FILTER_FUNC(sse)
 #endif
 SYNTH_FILTER_FUNC(sse2)
 SYNTH_FILTER_FUNC(avx)
+#if HAVE_FMA3_EXTERNAL
+SYNTH_FILTER_FUNC(fma3)
+#endif
 #endif /* HAVE_YASM */
 
 av_cold void ff_synth_filter_init_x86(SynthFilterContext *s)
@@ -100,5 +103,8 @@ av_cold void ff_synth_filter_init_x86(SynthFilterContext *s)
     if (EXTERNAL_AVX(cpu_flags)) {
         s->synth_filter_float = synth_filter_avx;
     }
+    if (EXTERNAL_FMA3(cpu_flags)) {
+        s->synth_filter_float = synth_filter_fma3;
+    }
 #endif /* HAVE_YASM */
 }



More information about the ffmpeg-cvslog mailing list