[FFmpeg-cvslog] avfilter/af_headphone: Remove unused arrays

Andreas Rheinhardt git at videolan.org
Wed Sep 9 15:59:58 EEST 2020


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Tue Aug 25 14:47:09 2020 +0200| [b2feca461611ab6146d2a275a2c82ec8c1bcb534] | committer: Andreas Rheinhardt

avfilter/af_headphone: Remove unused arrays

The delay arrays were never properly initialized, only zero-initialized;
furthermore these arrays duplicate fields in the headphone_inputs
struct. So remove them.
(Btw: The allocations for them have not been checked.)

Reviewed-by: Paul B Mahol <onemda at gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>

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

 libavfilter/af_headphone.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/libavfilter/af_headphone.c b/libavfilter/af_headphone.c
index 967f8ed5a6..f9799d8548 100644
--- a/libavfilter/af_headphone.c
+++ b/libavfilter/af_headphone.c
@@ -67,7 +67,6 @@ typedef struct HeadphoneContext {
     int size;
     int hrir_fmt;
 
-    int *delay[2];
     float *data_ir[2];
     float *temp_src[2];
     FFTComplex *temp_fft[2];
@@ -135,7 +134,6 @@ static void parse_map(AVFilterContext *ctx)
 typedef struct ThreadData {
     AVFrame *in, *out;
     int *write;
-    int **delay;
     float **ir;
     int *n_clippings;
     float **ringbuffer;
@@ -151,7 +149,6 @@ static int headphone_convolute(AVFilterContext *ctx, void *arg, int jobnr, int n
     AVFrame *in = td->in, *out = td->out;
     int offset = jobnr;
     int *write = &td->write[jobnr];
-    const int *const delay = td->delay[jobnr];
     const float *const ir = td->ir[jobnr];
     int *n_clippings = &td->n_clippings[jobnr];
     float *ringbuffer = td->ringbuffer[jobnr];
@@ -190,7 +187,7 @@ static int headphone_convolute(AVFilterContext *ctx, void *arg, int jobnr, int n
                 continue;
             }
 
-            read = (wr - *(delay + l) - (ir_len - 1) + buffer_length) & modulo;
+            read = (wr - (ir_len - 1) + buffer_length) & modulo;
 
             if (read + ir_len < buffer_length) {
                 memcpy(temp_src, bptr + read, ir_len * sizeof(*temp_src));
@@ -348,7 +345,7 @@ static int headphone_frame(HeadphoneContext *s, AVFrame *in, AVFilterLink *outli
     out->pts = in->pts;
 
     td.in = in; td.out = out; td.write = s->write;
-    td.delay = s->delay; td.ir = s->data_ir; td.n_clippings = n_clippings;
+    td.ir = s->data_ir; td.n_clippings = n_clippings;
     td.ringbuffer = s->ringbuffer; td.temp_src = s->temp_src;
     td.temp_fft = s->temp_fft;
     td.temp_afft = s->temp_afft;
@@ -415,8 +412,6 @@ static int convert_coeffs(AVFilterContext *ctx, AVFilterLink *inlink)
 
     s->data_ir[0] = av_calloc(s->air_len, sizeof(float) * s->nb_irs);
     s->data_ir[1] = av_calloc(s->air_len, sizeof(float) * s->nb_irs);
-    s->delay[0] = av_calloc(s->nb_irs, sizeof(float));
-    s->delay[1] = av_calloc(s->nb_irs, sizeof(float));
 
     if (s->type == TIME_DOMAIN) {
         s->ringbuffer[0] = av_calloc(s->buffer_length, sizeof(float) * nb_input_channels);
@@ -782,8 +777,6 @@ static av_cold void uninit(AVFilterContext *ctx)
     av_fft_end(s->ifft[1]);
     av_fft_end(s->fft[0]);
     av_fft_end(s->fft[1]);
-    av_freep(&s->delay[0]);
-    av_freep(&s->delay[1]);
     av_freep(&s->data_ir[0]);
     av_freep(&s->data_ir[1]);
     av_freep(&s->ringbuffer[0]);



More information about the ffmpeg-cvslog mailing list