diff options
author | Paul B Mahol <onemda@gmail.com> | 2018-12-28 18:07:13 +0100 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2018-12-29 08:35:23 +0100 |
commit | e57053417a090bbdc5cad73d7fa88f72efaf854c (patch) | |
tree | 4b9635bb5c76267824bf3a942783ea65ab30be34 | |
parent | 7312e027d6d3b8aa8220cceacd29c85c87292906 (diff) | |
download | ffmpeg-e57053417a090bbdc5cad73d7fa88f72efaf854c.tar.gz |
avfilter/af_afir: move allocation stuff where it belongs
-rw-r--r-- | libavfilter/af_afir.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/libavfilter/af_afir.c b/libavfilter/af_afir.c index 89d7ed6c85..077c64cd6a 100644 --- a/libavfilter/af_afir.c +++ b/libavfilter/af_afir.c @@ -286,6 +286,13 @@ static int convert_coeffs(AVFilterContext *ctx) for (n = av_log2(s->minp); (1 << n) < s->nb_taps; n++); N = FFMIN(n, av_log2(s->maxp)); + + s->seg.coeff = av_calloc(ctx->inputs[1]->channels, sizeof(*s->seg.coeff)); + s->seg.rdft = av_calloc(ctx->inputs[0]->channels, sizeof(*s->seg.rdft)); + s->seg.irdft = av_calloc(ctx->inputs[0]->channels, sizeof(*s->seg.irdft)); + if (!s->seg.coeff || !s->seg.rdft || !s->seg.irdft) + return AVERROR(ENOMEM); + s->seg.fft_length = (1 << (N + 1)) + 1; s->seg.part_size = 1 << (N - 1); s->seg.block_size = FFALIGN(s->seg.fft_length, 32); @@ -570,12 +577,6 @@ static int config_output(AVFilterLink *outlink) outlink->channel_layout = ctx->inputs[0]->channel_layout; outlink->channels = ctx->inputs[0]->channels; - s->seg.coeff = av_calloc(ctx->inputs[1]->channels, sizeof(*s->seg.coeff)); - s->seg.rdft = av_calloc(outlink->channels, sizeof(*s->seg.rdft)); - s->seg.irdft = av_calloc(outlink->channels, sizeof(*s->seg.irdft)); - if (!s->seg.coeff || !s->seg.rdft || !s->seg.irdft) - return AVERROR(ENOMEM); - s->nb_channels = outlink->channels; s->nb_coef_channels = ctx->inputs[1]->channels; s->pts = AV_NOPTS_VALUE; |