[FFmpeg-devel] [PATCH 2/2] x86/synth_filter: add synth_filter_fma3

James Almer jamrial at gmail.com
Sat Mar 1 19:26:51 CET 2014


Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavcodec/x86/dcadsp.asm    | 28 +++++++++++-----------------
 libavcodec/x86/dcadsp_init.c |  4 ++++
 2 files changed, 15 insertions(+), 17 deletions(-)

diff --git a/libavcodec/x86/dcadsp.asm b/libavcodec/x86/dcadsp.asm
index 972ce1e..a035d99 100644
--- a/libavcodec/x86/dcadsp.asm
+++ b/libavcodec/x86/dcadsp.asm
@@ -222,16 +222,12 @@ DCA_LFE_FIR 1
     SHUF         m11,  ptr2 + j + (15 - 3) * 4 - mmsize, m12
     mova         m12, [ptr1 + j + mmsize]
 %endif
-    mulps         m6, m6,  [win + %1 + j + 16 * 4]
+    FMULADD_PS    m2, m6,  [win + %1 + j + 16 * 4], m2, m6
     mulps         m5, m5,  [win + %1 + j]
-%if ARCH_X86_64
-    mulps        m12, m12, [win + %1 + j + mmsize + 16 * 4]
-    mulps        m11, m11, [win + %1 + j + mmsize]
-%endif
-    addps         m2, m2, m6
     subps         m1, m1, m5
 %if ARCH_X86_64
-    addps         m8, m8, m12
+    FMULADD_PS    m8, m12, [win + %1 + j + mmsize + 16 * 4], m8, m12
+    mulps        m11, m11, [win + %1 + j + mmsize]
     subps         m7, m7, m11
 %endif
     ;~ c += window[i + j + 32] * (synth_buf[16 + i + j])
@@ -242,17 +238,11 @@ DCA_LFE_FIR 1
     SHUF         m12,  ptr2 + j + (31 - 3) * 4 - mmsize, m11
     mova         m11, [ptr1 + j + mmsize + 16 * 4]
 %endif
-    mulps         m5, m5,  [win + %1 + j + 32 * 4]
-    mulps         m6, m6,  [win + %1 + j + 48 * 4]
+    FMULADD_PS    m3, m5,  [win + %1 + j + 32 * 4], m3, m5
+    FMULADD_PS    m4, m6,  [win + %1 + j + 48 * 4], m4, m6
 %if ARCH_X86_64
-    mulps        m11, m11, [win + %1 + j + mmsize + 32 * 4]
-    mulps        m12, m12, [win + %1 + j + mmsize + 48 * 4]
-%endif
-    addps         m3, m3, m5
-    addps         m4, m4, m6
-%if ARCH_X86_64
-    addps         m9, m9, m11
-    addps        m10, m10, m12
+    FMULADD_PS    m9, m11, [win + %1 + j + mmsize + 32 * 4], m9, m11
+    FMULADD_PS   m10, m12, [win + %1 + j + mmsize + 48 * 4], m10, m12
 %endif
     sub            j, 64 * 4
 %endmacro
@@ -378,3 +368,7 @@ SYNTH_FILTER
 INIT_YMM avx
 SYNTH_FILTER
 %endif
+%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 2e5c153..429f960 100644
--- a/libavcodec/x86/dcadsp_init.c
+++ b/libavcodec/x86/dcadsp_init.c
@@ -81,6 +81,7 @@ SYNTH_FILTER_FUNC(sse)
 #endif
 SYNTH_FILTER_FUNC(sse2)
 SYNTH_FILTER_FUNC(avx)
+SYNTH_FILTER_FUNC(fma3)
 
 av_cold void ff_synth_filter_init_x86(SynthFilterContext *s)
 {
@@ -97,4 +98,7 @@ 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;
+    }
 }
-- 
1.8.3.2



More information about the ffmpeg-devel mailing list