1
0
Fork 0

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>
This commit is contained in:
Andreas Rheinhardt 2022-05-03 07:12:06 +02:00
parent 0df18f29ae
commit ea398201f9
2 changed files with 28 additions and 26 deletions

View File

@ -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;

View File

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