mirror of
https://gitee.com/openharmony/third_party_ffmpeg
synced 2024-11-23 19:30:05 +00:00
avfilter/af_afir: split off fcmul_add into a DSP context
Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
parent
9b5bd665e1
commit
82043dfd2e
@ -103,7 +103,7 @@ static int fir_quantum(AVFilterContext *ctx, AVFrame *out, int ch, int offset)
|
||||
const float *block = (const float *)seg->block->extended_data[ch] + i * seg->block_size;
|
||||
const FFTComplex *coeff = (const FFTComplex *)seg->coeff->extended_data[ch * !s->one2many] + coffset;
|
||||
|
||||
s->fcmul_add(sum, block, (const float *)coeff, seg->part_size);
|
||||
s->afirdsp.fcmul_add(sum, block, (const float *)coeff, seg->part_size);
|
||||
|
||||
if (j == 0)
|
||||
j = seg->nb_partitions;
|
||||
@ -753,6 +753,14 @@ 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;
|
||||
@ -792,14 +800,11 @@ static av_cold int init(AVFilterContext *ctx)
|
||||
}
|
||||
}
|
||||
|
||||
s->fcmul_add = fcmul_add_c;
|
||||
|
||||
s->fdsp = avpriv_float_dsp_alloc(0);
|
||||
if (!s->fdsp)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
if (ARCH_X86)
|
||||
ff_afir_init_x86(s);
|
||||
ff_afir_init(&s->afirdsp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -53,6 +53,11 @@ typedef struct AudioFIRSegment {
|
||||
RDFTContext **rdft, **irdft;
|
||||
} AudioFIRSegment;
|
||||
|
||||
typedef struct AudioFIRDSPContext {
|
||||
void (*fcmul_add)(float *sum, const float *t, const float *c,
|
||||
ptrdiff_t len);
|
||||
} AudioFIRDSPContext;
|
||||
|
||||
typedef struct AudioFIRContext {
|
||||
const AVClass *class;
|
||||
|
||||
@ -87,11 +92,12 @@ typedef struct AudioFIRContext {
|
||||
int min_part_size;
|
||||
int64_t pts;
|
||||
|
||||
AudioFIRDSPContext afirdsp;
|
||||
AVFloatDSPContext *fdsp;
|
||||
void (*fcmul_add)(float *sum, const float *t, const float *c,
|
||||
ptrdiff_t len);
|
||||
|
||||
} AudioFIRContext;
|
||||
|
||||
void ff_afir_init_x86(AudioFIRContext *s);
|
||||
void ff_afir_init(AudioFIRDSPContext *s);
|
||||
void ff_afir_init_x86(AudioFIRDSPContext *s);
|
||||
|
||||
#endif /* AVFILTER_AFIR_H */
|
||||
|
@ -25,7 +25,7 @@
|
||||
void ff_fcmul_add_sse3(float *sum, const float *t, const float *c,
|
||||
ptrdiff_t len);
|
||||
|
||||
av_cold void ff_afir_init_x86(AudioFIRContext *s)
|
||||
av_cold void ff_afir_init_x86(AudioFIRDSPContext *s)
|
||||
{
|
||||
int cpu_flags = av_get_cpu_flags();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user