From 3b298640e1b9565b24a01162ef60742612198fb4 Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Wed, 4 Aug 2021 10:13:46 +0200 Subject: avfilter/af_afftfilt: make sure that tx buffers size are always aligned --- libavfilter/af_afftfilt.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'libavfilter/af_afftfilt.c') diff --git a/libavfilter/af_afftfilt.c b/libavfilter/af_afftfilt.c index 81505f0935..3e69c636c8 100644 --- a/libavfilter/af_afftfilt.c +++ b/libavfilter/af_afftfilt.c @@ -130,6 +130,7 @@ static int config_input(AVFilterLink *inlink) float overlap, scale; char *args; const char *last_expr = "1"; + int buf_size; s->channels = inlink->channels; s->pts = AV_NOPTS_VALUE; @@ -142,6 +143,7 @@ static int config_input(AVFilterLink *inlink) return ret; s->window_size = s->fft_size; + buf_size = FFALIGN(s->window_size, av_cpu_max_align()); s->fft_in = av_calloc(inlink->channels, sizeof(*s->fft_in)); if (!s->fft_in) @@ -156,15 +158,15 @@ static int config_input(AVFilterLink *inlink) return AVERROR(ENOMEM); for (ch = 0; ch < inlink->channels; ch++) { - s->fft_in[ch] = av_calloc(s->window_size, sizeof(**s->fft_in)); + s->fft_in[ch] = av_calloc(buf_size, sizeof(**s->fft_in)); if (!s->fft_in[ch]) return AVERROR(ENOMEM); - s->fft_out[ch] = av_calloc(s->window_size, sizeof(**s->fft_out)); + s->fft_out[ch] = av_calloc(buf_size, sizeof(**s->fft_out)); if (!s->fft_out[ch]) return AVERROR(ENOMEM); - s->fft_temp[ch] = av_calloc(s->window_size, sizeof(**s->fft_temp)); + s->fft_temp[ch] = av_calloc(buf_size, sizeof(**s->fft_temp)); if (!s->fft_temp[ch]) return AVERROR(ENOMEM); } -- cgit v1.2.3