diff options
author | Paul B Mahol <onemda@gmail.com> | 2018-12-29 10:57:58 +0100 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2018-12-29 10:57:58 +0100 |
commit | 300dc45fdca43fe1e308d37be8cded550d7b3a1e (patch) | |
tree | da12c257ff4aa8197fdb213602421e0b4e53208e /libavfilter | |
parent | 3c3eb4930eb49b3eee76a3ff6f127a78af886345 (diff) | |
download | ffmpeg-300dc45fdca43fe1e308d37be8cded550d7b3a1e.tar.gz |
avfilter/af_afir: properly split IR into multiple segments
Diffstat (limited to 'libavfilter')
-rw-r--r-- | libavfilter/af_afir.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libavfilter/af_afir.c b/libavfilter/af_afir.c index 0d626063b5..3dda875e35 100644 --- a/libavfilter/af_afir.c +++ b/libavfilter/af_afir.c @@ -387,6 +387,7 @@ static int convert_coeffs(AVFilterContext *ctx) for (ch = 0; ch < ctx->inputs[1]->channels; ch++) { float *time = (float *)s->in[1]->extended_data[!s->one2many * ch]; + int toffset = 0; for (i = FFMAX(1, s->length * s->nb_taps); i < s->nb_taps; i++) time[i] = 0; @@ -402,9 +403,8 @@ static int convert_coeffs(AVFilterContext *ctx) for (i = 0; i < seg->nb_partitions; i++) { const float scale = 1.f / seg->part_size; - const int toffset = i * seg->part_size; const int coffset = i * seg->coeff_size; - const int remaining = s->nb_taps - (i * seg->part_size); + const int remaining = s->nb_taps - toffset; const int size = remaining >= seg->part_size ? seg->part_size : remaining; memset(block, 0, sizeof(*block) * seg->fft_length); @@ -420,6 +420,8 @@ static int convert_coeffs(AVFilterContext *ctx) } coeff[coffset + seg->part_size].re = block[1] * scale; coeff[coffset + seg->part_size].im = 0; + + toffset += size; } av_log(ctx, AV_LOG_DEBUG, "nb_partitions: %d\n", seg->nb_partitions); |