aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2014-03-20 15:37:56 -0300
committerAnton Khirnov <anton@khirnov.net>2014-04-04 17:40:51 +0200
commitc74b86699c86bdf62e8570f41d8a38be5710baa3 (patch)
tree3a1a3af5ba5fdee557eb4adbf02f08169ae74500
parent81e02fae6ec12ae85f052bd74aa9506cbebe4517 (diff)
downloadffmpeg-c74b86699c86bdf62e8570f41d8a38be5710baa3.tar.gz
x86/synth_filter: add synth_filter_fma3
Signed-off-by: James Almer <jamrial@gmail.com> Signed-off-by: Anton Khirnov <anton@khirnov.net>
-rw-r--r--libavcodec/x86/dcadsp.asm22
-rw-r--r--libavcodec/x86/dcadsp_init.c6
2 files changed, 28 insertions, 0 deletions
diff --git a/libavcodec/x86/dcadsp.asm b/libavcodec/x86/dcadsp.asm
index 662cb96f66..59d96bf241 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 d7e0d65917..beef288b13 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 */
}