diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-05-03 07:12:06 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-05-06 05:19:49 +0200 |
commit | ea398201f9db227ee5ff19158b34448aae0a3b5c (patch) | |
tree | ff4976bb3930cbc54a061c9a6fbe7b8d01291418 | |
parent | 0df18f29ae218f30b3ecff7c930176b8ebee56aa (diff) | |
download | ffmpeg-ea398201f9db227ee5ff19158b34448aae0a3b5c.tar.gz |
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@outlook.com>
-rw-r--r-- | libavfilter/af_afir.c | 25 | ||||
-rw-r--r-- | 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 */ |