diff mbox series

[FFmpeg-devel,12/25] avfilter/af_headphone: Remove unused arrays

Message ID 20200908211856.16290-12-andreas.rheinhardt@gmail.com
State Accepted
Commit b2feca461611ab6146d2a275a2c82ec8c1bcb534
Headers show
Series [FFmpeg-devel,01/25] avfilter/af_headphone: Don't use uninitialized buffer in log message | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Sept. 8, 2020, 9:18 p.m. UTC
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.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavfilter/af_headphone.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

Comments

Paul B Mahol Sept. 9, 2020, 1:19 a.m. UTC | #1
On Tue, Sep 08, 2020 at 11:18:43PM +0200, Andreas Rheinhardt wrote:
> 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.)
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavfilter/af_headphone.c | 11 ++---------
>  1 file changed, 2 insertions(+), 9 deletions(-)
> 

probably fine
diff mbox series

Patch

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