./ffmpeg -threads 1 -f lavfi -i anoisesrc -f lavfi -t 30 -i anoisesrc  -t 600  
-lavfi afir -benchmark  -f null -

Test results on Snapdragon 845:
    Without SIMD:
        size=N/A time=00:10:00.00 bitrate=N/A speed=32.2x
        bench: utime=21.900s stime=1.000s rtime=18.607s
        bench: maxrss=46708kB
    With SIMD:
        size=N/A time=00:10:00.00 bitrate=N/A speed=46.6x
        bench: utime=16.150s stime=1.040s rtime=12.867s
        bench: maxrss=46608kB

Test results on HiSilicon Kirin 970:
    Without SIMD:
        size=N/A time=00:10:00.00 bitrate=N/A speed=20.7x
        bench: utime=32.292s stime=1.032s rtime=28.963s
        bench: maxrss=42412kB
    With SIMD:
        size=N/A time=00:10:00.00 bitrate=N/A speed=27.6x
        bench: utime=24.964s stime=0.952s rtime=21.703s
        bench: maxrss=42368kB

---
 libavfilter/aarch64/Makefile       |  2 ++
 libavfilter/aarch64/af_afir_init.c | 31 +++++++++++++++++++++
 libavfilter/aarch64/af_afir_neon.S | 43 ++++++++++++++++++++++++++++++
 libavfilter/af_afir.c              |  2 ++
 libavfilter/af_afir.h              |  1 +
 5 files changed, 79 insertions(+)
 create mode 100644 libavfilter/aarch64/af_afir_init.c
 create mode 100644 libavfilter/aarch64/af_afir_neon.S

diff --git a/libavfilter/aarch64/Makefile b/libavfilter/aarch64/Makefile
index b58daa3a3f..f52d7a4842 100644
--- a/libavfilter/aarch64/Makefile
+++ b/libavfilter/aarch64/Makefile
@@ -1,3 +1,5 @@
+OBJS-$(CONFIG_NLMEANS_FILTER)                += aarch64/af_afir_init.o
 OBJS-$(CONFIG_NLMEANS_FILTER)                += aarch64/vf_nlmeans_init.o
 
+NEON-OBJS-$(CONFIG_NLMEANS_FILTER)           += aarch64/af_afir_neon.o
 NEON-OBJS-$(CONFIG_NLMEANS_FILTER)           += aarch64/vf_nlmeans_neon.o
diff --git a/libavfilter/aarch64/af_afir_init.c 
b/libavfilter/aarch64/af_afir_init.c
new file mode 100644
index 0000000000..db06536380
--- /dev/null
+++ b/libavfilter/aarch64/af_afir_init.c
@@ -0,0 +1,31 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/aarch64/cpu.h"
+#include "libavfilter/af_afir.h"
+
+void ff_fcmul_add_neon(float *sum, const float *t, const float *c,
+                      ptrdiff_t len);
+
+av_cold void ff_afir_init_aarch64(AudioFIRDSPContext *s)
+{
+    int cpu_flags = av_get_cpu_flags();
+
+    if (have_neon(cpu_flags))
+        s->fcmul_add = ff_fcmul_add_neon;
+}
diff --git a/libavfilter/aarch64/af_afir_neon.S 
b/libavfilter/aarch64/af_afir_neon.S
new file mode 100644
index 0000000000..60583f9591
--- /dev/null
+++ b/libavfilter/aarch64/af_afir_neon.S
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2020 Zhao Zhili
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/aarch64/asm.S"
+
+// void ff_fcmul_add_neon(float *sum, const float *t, const float *c, 
ptrdiff_t len);
+function ff_fcmul_add_neon, export=1
+1:
+       ld2     {v0.4S, v1.4S}, [x1], #32       // load t
+       ld2     {v2.4S, v3.4S}, [x2], #32       // load c
+       ld2     {v4.4S, v5.4S}, [x0]            // load sum
+       fmla    v4.4S, v0.4S, v2.4S
+       fmls    v4.4S, v1.4S, v3.4S
+       fmla    v5.4S, v0.4S, v3.4S
+       fmla    v5.4S, v1.4S, v2.4S
+       st2     {v4.4S, v5.4S}, [x0], #32       // store sum
+       subs    x3, x3, #4
+       b.ne    1b
+       ldr     s0, [x1]        // load t
+       ldr     s1, [x2]        // load c
+       ldr     s2, [x0]        // load sum
+       fmul    s0, s0, s1
+       fadd    s2, s2, s0
+       str     s2, [x0]        // store sum
+       ret
+endfunc
diff --git a/libavfilter/af_afir.c b/libavfilter/af_afir.c
index 7c7e8458d4..25dddc8c6b 100644
--- a/libavfilter/af_afir.c
+++ b/libavfilter/af_afir.c
@@ -829,6 +829,8 @@ void ff_afir_init(AudioFIRDSPContext *dsp)
 
     if (ARCH_X86)
         ff_afir_init_x86(dsp);
+    if (ARCH_AARCH64)
+        ff_afir_init_aarch64(dsp);
 }
 
 static av_cold int init(AVFilterContext *ctx)
diff --git a/libavfilter/af_afir.h b/libavfilter/af_afir.h
index 4f44675848..d5f32f50a4 100644
--- a/libavfilter/af_afir.h
+++ b/libavfilter/af_afir.h
@@ -101,6 +101,7 @@ typedef struct AudioFIRContext {
 } AudioFIRContext;
 
 void ff_afir_init(AudioFIRDSPContext *s);
+void ff_afir_init_aarch64(AudioFIRDSPContext *s);
 void ff_afir_init_x86(AudioFIRDSPContext *s);
 
 #endif /* AVFILTER_AFIR_H */
-- 
2.24.0

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

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

Reply via email to