提交 dbf43ace 编写于 作者: P Paul B Mahol

afilter/af_afir: remove invalid delay

上级 f266d2ac
...@@ -60,12 +60,9 @@ static int fir_channel(AVFilterContext *ctx, void *arg, int ch, int nb_jobs) ...@@ -60,12 +60,9 @@ static int fir_channel(AVFilterContext *ctx, void *arg, int ch, int nb_jobs)
{ {
AudioFIRContext *s = ctx->priv; AudioFIRContext *s = ctx->priv;
const float *src = (const float *)s->in[0]->extended_data[ch]; 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]; float *sum = s->sum[ch];
AVFrame *out = arg; AVFrame *out = arg;
float *block; float *block, *dst, *ptr;
float *dst;
int n, i, j; int n, i, j;
memset(sum, 0, sizeof(*sum) * s->fft_length); 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) ...@@ -96,23 +93,18 @@ static int fir_channel(AVFilterContext *ctx, void *arg, int ch, int nb_jobs)
sum[1] = sum[2 * s->part_size]; sum[1] = sum[2 * s->part_size];
av_rdft_calc(s->irdft[ch], sum); 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++) { for (n = 0; n < s->part_size; n++) {
dst[n] += sum[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)); 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; return 0;
} }
...@@ -138,10 +130,6 @@ static int fir_frame(AudioFIRContext *s, AVFrame *in, AVFilterLink *outlink) ...@@ -138,10 +130,6 @@ static int fir_frame(AudioFIRContext *s, AVFrame *in, AVFilterLink *outlink)
if (s->pts != AV_NOPTS_VALUE) if (s->pts != AV_NOPTS_VALUE)
s->pts += av_rescale_q(out->nb_samples, (AVRational){1, outlink->sample_rate}, outlink->time_base); 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); av_frame_free(&in);
s->in[0] = NULL; s->in[0] = NULL;
...@@ -329,7 +317,7 @@ static int convert_coeffs(AVFilterContext *ctx) ...@@ -329,7 +317,7 @@ static int convert_coeffs(AVFilterContext *ctx)
return AVERROR(ENOMEM); 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) if (!s->buffer)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
......
...@@ -72,7 +72,6 @@ typedef struct AudioFIRContext { ...@@ -72,7 +72,6 @@ typedef struct AudioFIRContext {
AVFrame *buffer; AVFrame *buffer;
AVFrame *video; AVFrame *video;
int64_t pts; int64_t pts;
int index;
AVFloatDSPContext *fdsp; AVFloatDSPContext *fdsp;
void (*fcmul_add)(float *sum, const float *t, const float *c, void (*fcmul_add)(float *sum, const float *t, const float *c,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册