[FFmpeg-cvslog] avfilter/af_afftfilt: make sure that tx buffers size are always aligned

Paul B Mahol git at videolan.org
Wed Aug 4 11:17:29 EEST 2021


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Wed Aug  4 10:13:46 2021 +0200| [3b298640e1b9565b24a01162ef60742612198fb4] | committer: Paul B Mahol

avfilter/af_afftfilt: make sure that tx buffers size are always aligned

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3b298640e1b9565b24a01162ef60742612198fb4
---

 libavfilter/af_afftfilt.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

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);
     }



More information about the ffmpeg-cvslog mailing list