diff mbox series

[FFmpeg-devel,02/10] avfilter/af_afir: Move ff_afir_init() to header

Message ID AS8PR01MB7944B78024DD5382C1CA51AF8FC09@AS8PR01MB7944.eurprd01.prod.exchangelabs.com
State Accepted
Commit ea398201f9db227ee5ff19158b34448aae0a3b5c
Headers show
Series [FFmpeg-devel,01/10] avfilter/af_afir: Only keep DSP stuff in header | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt May 3, 2022, 6:37 a.m. UTC
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@outlook.com>
---
 libavfilter/af_afir.c    | 25 -------------------------
 libavfilter/af_afirdsp.h | 29 ++++++++++++++++++++++++++++-
 2 files changed, 28 insertions(+), 26 deletions(-)
diff mbox series

Patch

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 */