[FFmpeg-cvslog] afilter/af_afir: remove invalid delay
Paul B Mahol
git at videolan.org
Thu Dec 27 19:05:45 EET 2018
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Thu Dec 27 18:00:20 2018 +0100| [dbf43ace214fdc17c3b6423d7087ed15f9282520] | committer: Paul B Mahol
afilter/af_afir: remove invalid delay
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dbf43ace214fdc17c3b6423d7087ed15f9282520
---
libavfilter/af_afir.c | 26 +++++++-------------------
libavfilter/af_afir.h | 1 -
2 files changed, 7 insertions(+), 20 deletions(-)
diff --git a/libavfilter/af_afir.c b/libavfilter/af_afir.c
index bcee3beed8..65737e05b1 100644
--- a/libavfilter/af_afir.c
+++ b/libavfilter/af_afir.c
@@ -60,12 +60,9 @@ static int fir_channel(AVFilterContext *ctx, void *arg, int ch, int nb_jobs)
{
AudioFIRContext *s = ctx->priv;
const float *src = (const float *)s->in[0]->extended_data[ch];
- int index1 = (s->index + 1) % 3;
- int index2 = (s->index + 2) % 3;
float *sum = s->sum[ch];
AVFrame *out = arg;
- float *block;
- float *dst;
+ float *block, *dst, *ptr;
int n, i, j;
memset(sum, 0, sizeof(*sum) * s->fft_length);
@@ -96,23 +93,18 @@ static int fir_channel(AVFilterContext *ctx, void *arg, int ch, int nb_jobs)
sum[1] = sum[2 * s->part_size];
av_rdft_calc(s->irdft[ch], sum);
- dst = (float *)s->buffer->extended_data[ch] + index1 * s->part_size;
+ dst = (float *)s->buffer->extended_data[ch];
for (n = 0; n < s->part_size; n++) {
dst[n] += sum[n];
}
- dst = (float *)s->buffer->extended_data[ch] + index2 * s->part_size;
+ ptr = (float *)out->extended_data[ch];
+ s->fdsp->vector_fmul_scalar(ptr, dst, s->wet_gain, FFALIGN(out->nb_samples, 4));
+ emms_c();
+ dst = (float *)s->buffer->extended_data[ch];
memcpy(dst, sum + s->part_size, s->part_size * sizeof(*dst));
- dst = (float *)s->buffer->extended_data[ch] + s->index * s->part_size;
-
- if (out) {
- float *ptr = (float *)out->extended_data[ch];
- s->fdsp->vector_fmul_scalar(ptr, dst, s->wet_gain, FFALIGN(out->nb_samples, 4));
- emms_c();
- }
-
return 0;
}
@@ -138,10 +130,6 @@ static int fir_frame(AudioFIRContext *s, AVFrame *in, AVFilterLink *outlink)
if (s->pts != AV_NOPTS_VALUE)
s->pts += av_rescale_q(out->nb_samples, (AVRational){1, outlink->sample_rate}, outlink->time_base);
- s->index++;
- if (s->index == 3)
- s->index = 0;
-
av_frame_free(&in);
s->in[0] = NULL;
@@ -329,7 +317,7 @@ static int convert_coeffs(AVFilterContext *ctx)
return AVERROR(ENOMEM);
}
- s->buffer = ff_get_audio_buffer(ctx->inputs[0], s->part_size * 3);
+ s->buffer = ff_get_audio_buffer(ctx->inputs[0], s->part_size);
if (!s->buffer)
return AVERROR(ENOMEM);
diff --git a/libavfilter/af_afir.h b/libavfilter/af_afir.h
index 1889bada4e..9186e2cfdc 100644
--- a/libavfilter/af_afir.h
+++ b/libavfilter/af_afir.h
@@ -72,7 +72,6 @@ typedef struct AudioFIRContext {
AVFrame *buffer;
AVFrame *video;
int64_t pts;
- int index;
AVFloatDSPContext *fdsp;
void (*fcmul_add)(float *sum, const float *t, const float *c,
More information about the ffmpeg-cvslog
mailing list