diff options
author | James Almer <jamrial@gmail.com> | 2019-01-02 20:54:18 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2019-01-03 10:12:18 -0300 |
commit | 82043dfd2e50dd02d40ac7cb023f09090318e479 (patch) | |
tree | 87ca47e053e8d3e16ba4c527f5ad16e4bea704d0 | |
parent | 9b5bd665e105894919cdcfa0ed9818919538e5f6 (diff) | |
download | ffmpeg-82043dfd2e50dd02d40ac7cb023f09090318e479.tar.gz |
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>
-rw-r--r-- | libavfilter/af_afir.c | 15 | ||||
-rw-r--r-- | libavfilter/af_afir.h | 12 | ||||
-rw-r--r-- | libavfilter/x86/af_afir_init.c | 2 |
3 files changed, 20 insertions, 9 deletions
diff --git a/libavfilter/af_afir.c b/libavfilter/af_afir.c index c4baf63c02..c755dc1f6f 100644 --- a/libavfilter/af_afir.c +++ b/libavfilter/af_afir.c @@ -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; } diff --git a/libavfilter/af_afir.h b/libavfilter/af_afir.h index f9bec54b8c..f665c0ef80 100644 --- a/libavfilter/af_afir.h +++ b/libavfilter/af_afir.h @@ -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 */ diff --git a/libavfilter/x86/af_afir_init.c b/libavfilter/x86/af_afir_init.c index 6a652b9b83..29e6f976b2 100644 --- a/libavfilter/x86/af_afir_init.c +++ b/libavfilter/x86/af_afir_init.c @@ -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(); |