[FFmpeg-cvslog] avfilter/af_afir: Move ff_afir_init() to header

Andreas Rheinhardt git at videolan.org
Fri May 6 06:36:42 EEST 2022


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Tue May  3 07:12:06 2022 +0200| [ea398201f9db227ee5ff19158b34448aae0a3b5c] | committer: Andreas Rheinhardt

avfilter/af_afir: Move ff_afir_init() to header

This allows to inline it in af_afir.c (regardless of interposing);
moreover it removes a dependency of the checkasm test on
lavfi/af_afir.o.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

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

 libavfilter/af_afir.c    | 25 -------------------------
 libavfilter/af_afirdsp.h | 29 ++++++++++++++++++++++++++++-
 2 files changed, 28 insertions(+), 26 deletions(-)

diff --git a/libavfilter/af_afir.c b/libavfilter/af_afir.c
index d7ae468428..301553575f 100644
--- a/libavfilter/af_afir.c
+++ b/libavfilter/af_afir.c
@@ -110,23 +110,6 @@ typedef struct AudioFIRContext {
     AVFloatDSPContext *fdsp;
 } AudioFIRContext;
 
-static void fcmul_add_c(float *sum, const float *t, const float *c, ptrdiff_t len)
-{
-    int n;
-
-    for (n = 0; n < len; n++) {
-        const float cre = c[2 * n    ];
-        const float cim = c[2 * n + 1];
-        const float tre = t[2 * n    ];
-        const float tim = t[2 * n + 1];
-
-        sum[2 * n    ] += tre * cre - tim * cim;
-        sum[2 * n + 1] += tre * cim + tim * cre;
-    }
-
-    sum[2 * n] += t[2 * n] * c[2 * n];
-}
-
 static void direct(const float *in, const AVComplexFloat *ir, int len, float *out)
 {
     for (int n = 0; n < len; n++)
@@ -884,14 +867,6 @@ static int config_video(AVFilterLink *outlink)
     return 0;
 }
 
-void ff_afir_init(AudioFIRDSPContext *dsp)
-{
-    dsp->fcmul_add = fcmul_add_c;
-
-    if (ARCH_X86)
-        ff_afir_init_x86(dsp);
-}
-
 static av_cold int init(AVFilterContext *ctx)
 {
     AudioFIRContext *s = ctx->priv;
diff --git a/libavfilter/af_afirdsp.h b/libavfilter/af_afirdsp.h
index f72ab7cd02..05182bebb4 100644
--- a/libavfilter/af_afirdsp.h
+++ b/libavfilter/af_afirdsp.h
@@ -23,12 +23,39 @@
 
 #include <stddef.h>
 
+#include "config.h"
+#include "libavutil/attributes.h"
+
 typedef struct AudioFIRDSPContext {
     void (*fcmul_add)(float *sum, const float *t, const float *c,
                       ptrdiff_t len);
 } AudioFIRDSPContext;
 
-void ff_afir_init(AudioFIRDSPContext *s);
 void ff_afir_init_x86(AudioFIRDSPContext *s);
 
+static void fcmul_add_c(float *sum, const float *t, const float *c, ptrdiff_t len)
+{
+    int n;
+
+    for (n = 0; n < len; n++) {
+        const float cre = c[2 * n    ];
+        const float cim = c[2 * n + 1];
+        const float tre = t[2 * n    ];
+        const float tim = t[2 * n + 1];
+
+        sum[2 * n    ] += tre * cre - tim * cim;
+        sum[2 * n + 1] += tre * cim + tim * cre;
+    }
+
+    sum[2 * n] += t[2 * n] * c[2 * n];
+}
+
+static av_unused void ff_afir_init(AudioFIRDSPContext *dsp)
+{
+    dsp->fcmul_add = fcmul_add_c;
+
+    if (ARCH_X86)
+        ff_afir_init_x86(dsp);
+}
+
 #endif /* AVFILTER_AFIRDSP_H */



More information about the ffmpeg-cvslog mailing list