diff options
author | Paul B Mahol <onemda@gmail.com> | 2020-08-23 17:50:00 +0200 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2020-08-23 17:52:58 +0200 |
commit | e2589ac65010f86fc2e6c3b4419cb1dc62f82d1a (patch) | |
tree | 44242f9bc02ce833f835364b328f52d327611161 /libavfilter | |
parent | 751f2a27f7d2efe5091ef54d73e5428160a85578 (diff) | |
download | ffmpeg-e2589ac65010f86fc2e6c3b4419cb1dc62f82d1a.tar.gz |
avfilter/af_afir: make use of vector_fmac_scalar() too
Diffstat (limited to 'libavfilter')
-rw-r--r-- | libavfilter/af_afir.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/libavfilter/af_afir.c b/libavfilter/af_afir.c index 6cbc7a00a1..4e76bda4a3 100644 --- a/libavfilter/af_afir.c +++ b/libavfilter/af_afir.c @@ -64,6 +64,16 @@ static void direct(const float *in, const FFTComplex *ir, int len, float *out) out[n] += ir[m].re * in[n - m]; } +static void fir_fadd(AudioFIRContext *s, float *dst, const float *src, int nb_samples) +{ + if ((nb_samples & 15) == 0 && nb_samples >= 16) { + s->fdsp->vector_fmac_scalar(dst, src, 1.f, nb_samples); + } else { + for (int n = 0; n < nb_samples; n++) + dst[n] += src[n]; + } +} + static int fir_quantum(AVFilterContext *ctx, AVFrame *out, int ch, int offset) { AudioFIRContext *s = ctx->priv; @@ -93,9 +103,7 @@ static int fir_quantum(AVFilterContext *ctx, AVFrame *out, int ch, int offset) memmove(src, src + s->min_part_size, (seg->input_size - s->min_part_size) * sizeof(*src)); dst += seg->output_offset[ch]; - for (n = 0; n < nb_samples; n++) { - ptr[n] += dst[n]; - } + fir_fadd(s, ptr, dst, nb_samples); continue; } @@ -153,9 +161,7 @@ static int fir_quantum(AVFilterContext *ctx, AVFrame *out, int ch, int offset) av_rdft_calc(seg->irdft[ch], sum); buf = (float *)seg->buffer->extended_data[ch]; - for (n = 0; n < seg->part_size; n++) { - buf[n] += sum[n]; - } + fir_fadd(s, buf, sum, seg->part_size); memcpy(dst, buf, seg->part_size * sizeof(*dst)); @@ -166,9 +172,7 @@ static int fir_quantum(AVFilterContext *ctx, AVFrame *out, int ch, int offset) memmove(src, src + s->min_part_size, (seg->input_size - s->min_part_size) * sizeof(*src)); - for (n = 0; n < nb_samples; n++) { - ptr[n] += dst[n]; - } + fir_fadd(s, ptr, dst, nb_samples); } if (s->min_part_size >= 8) { |