Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Paul B Mahol <onemda@gmail.com>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH] avfilter/x86/af_afir: add FMA3 SIMD
Date: Sun, 10 Sep 2023 21:03:27 +0200
Message-ID: <CAPYw7P450pS5M+Bs=7sycA=dANabn6mBE_DxKDev9CvVd+dRDQ@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 10 bytes --]

Attached.

[-- Attachment #2: 0001-avfilter-x86-af_afir-add-FMA3-SIMD.patch --]
[-- Type: text/x-patch, Size: 2150 bytes --]

From 7735a84fd0fdae731955f50bddba8dfef395713b Mon Sep 17 00:00:00 2001
From: Paul B Mahol <onemda@gmail.com>
Date: Sun, 10 Sep 2023 19:25:20 +0200
Subject: [PATCH] avfilter/x86/af_afir: add FMA3 SIMD

Signed-off-by: Paul B Mahol <onemda@gmail.com>
---
 libavfilter/x86/af_afir.asm    | 27 +++++++++++++++++++++++++++
 libavfilter/x86/af_afir_init.c |  5 +++++
 2 files changed, 32 insertions(+)

diff --git a/libavfilter/x86/af_afir.asm b/libavfilter/x86/af_afir.asm
index 2cc09709a2..ed0276c7b9 100644
--- a/libavfilter/x86/af_afir.asm
+++ b/libavfilter/x86/af_afir.asm
@@ -67,3 +67,30 @@ INIT_XMM sse3
 FCMUL_ADD
 INIT_YMM avx
 FCMUL_ADD
+
+%if HAVE_FMA3_EXTERNAL
+INIT_YMM fma3
+cglobal fcmul_add, 4,4,4, sum, t, c, len
+    shl       lend, 3
+    add         tq, lenq
+    add         cq, lenq
+    add       sumq, lenq
+    neg       lenq
+.loop:
+    movaps    m0, [tq + lenq]
+    movaps    m1, [cq + lenq]
+    vpermilps m3, m0, 177
+    vpermilps m2, m1, 160
+    vpermilps m1, m1, 245
+    mulps     m1, m1, m3
+    vfmaddsub132ps m0, m1, m2
+    addps     m0, m0, [sumq + lenq]
+    movaps    [sumq + lenq], m0
+    add       lenq, mmsize
+    jl .loop
+    movss xm0, [tq + lenq]
+    mulss xm0, [cq + lenq]
+    addss xm0, [sumq + lenq]
+    movss [sumq + lenq], xm0
+    RET
+%endif
diff --git a/libavfilter/x86/af_afir_init.c b/libavfilter/x86/af_afir_init.c
index e53817b9c0..d573acf10b 100644
--- a/libavfilter/x86/af_afir_init.c
+++ b/libavfilter/x86/af_afir_init.c
@@ -26,6 +26,8 @@ void ff_fcmul_add_sse3(float *sum, const float *t, const float *c,
                        ptrdiff_t len);
 void ff_fcmul_add_avx(float *sum, const float *t, const float *c,
                       ptrdiff_t len);
+void ff_fcmul_add_fma3(float *sum, const float *t, const float *c,
+                       ptrdiff_t len);
 
 av_cold void ff_afir_init_x86(AudioFIRDSPContext *s)
 {
@@ -37,4 +39,7 @@ av_cold void ff_afir_init_x86(AudioFIRDSPContext *s)
     if (EXTERNAL_AVX_FAST(cpu_flags)) {
         s->fcmul_add = ff_fcmul_add_avx;
     }
+    if (EXTERNAL_FMA3_FAST(cpu_flags)) {
+        s->fcmul_add = ff_fcmul_add_fma3;
+    }
 }
-- 
2.39.1


[-- Attachment #3: Type: text/plain, Size: 251 bytes --]

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

             reply	other threads:[~2023-09-10 18:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-10 19:03 Paul B Mahol [this message]
2023-09-16 12:22 ` Paul B Mahol

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAPYw7P450pS5M+Bs=7sycA=dANabn6mBE_DxKDev9CvVd+dRDQ@mail.gmail.com' \
    --to=onemda@gmail.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git