[FFmpeg-cvslog] avfilter/af_afftdn: fix invalid duplicated use of sizeof()

Paul B Mahol git at videolan.org
Sat Dec 3 22:25:17 EET 2022


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sat Dec  3 21:25:32 2022 +0100| [7bf74f909dccbf49012d9c66adfdec4913065ef5] | committer: Paul B Mahol

avfilter/af_afftdn: fix invalid duplicated use of sizeof()

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

 libavfilter/af_afftdn.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/libavfilter/af_afftdn.c b/libavfilter/af_afftdn.c
index 2b465afcef..aa30e35d57 100644
--- a/libavfilter/af_afftdn.c
+++ b/libavfilter/af_afftdn.c
@@ -107,6 +107,7 @@ typedef struct AudioFFTDeNoiseContext {
 
     int     format;
     size_t  sample_size;
+    size_t  complex_sample_size;
 
     float   noise_reduction;
     float   noise_floor;
@@ -627,7 +628,6 @@ static int config_input(AVFilterLink *inlink)
 {
     AVFilterContext *ctx = inlink->dst;
     AudioFFTDeNoiseContext *s = ctx->priv;
-    size_t complex_sample_size;
     double wscale, sar, sum, sdiv;
     int i, j, k, m, n, ret, tx_type;
     double dscale = 1.;
@@ -639,13 +639,13 @@ static int config_input(AVFilterLink *inlink)
     switch (s->format) {
     case AV_SAMPLE_FMT_FLTP:
         s->sample_size = sizeof(float);
-        complex_sample_size = sizeof(AVComplexFloat);
+        s->complex_sample_size = sizeof(AVComplexFloat);
         tx_type = AV_TX_FLOAT_RDFT;
         scale = &fscale;
         break;
     case AV_SAMPLE_FMT_DBLP:
         s->sample_size = sizeof(double);
-        complex_sample_size = sizeof(AVComplexDouble);
+        s->complex_sample_size = sizeof(AVComplexDouble);
         tx_type = AV_TX_DOUBLE_RDFT;
         scale = &dscale;
         break;
@@ -753,7 +753,7 @@ static int config_input(AVFilterLink *inlink)
         dnch->rel_var = av_calloc(s->bin_count, sizeof(*dnch->rel_var));
         dnch->min_abs_var = av_calloc(s->bin_count, sizeof(*dnch->min_abs_var));
         dnch->fft_in = av_calloc(s->fft_length2, s->sample_size);
-        dnch->fft_out = av_calloc(s->fft_length2 + 1, complex_sample_size);
+        dnch->fft_out = av_calloc(s->fft_length2 + 1, s->complex_sample_size);
         ret = av_tx_init(&dnch->fft, &dnch->tx_fn, tx_type, 0, s->fft_length2, scale, 0);
         if (ret < 0)
             return ret;
@@ -931,7 +931,7 @@ static void sample_noise_block(AudioFFTDeNoiseContext *s,
         break;
     }
 
-    dnch->tx_fn(dnch->fft, dnch->fft_out, dnch->fft_in, sizeof(s->sample_size));
+    dnch->tx_fn(dnch->fft, dnch->fft_out, dnch->fft_in, s->sample_size);
 
     edge = s->noise_band_edge[0];
     j = edge;
@@ -1074,14 +1074,14 @@ static int filter_channel(AVFilterContext *ctx, void *arg, int jobnr, int nb_job
             break;
         }
 
-        dnch->tx_fn(dnch->fft, dnch->fft_out, dnch->fft_in, sizeof(s->sample_size));
+        dnch->tx_fn(dnch->fft, dnch->fft_out, dnch->fft_in, s->sample_size);
 
         process_frame(ctx, s, dnch,
                       dnch->prior,
                       dnch->prior_band_excit,
                       s->track_noise);
 
-        dnch->itx_fn(dnch->ifft, dnch->fft_in, dnch->fft_out, sizeof(s->sample_size));
+        dnch->itx_fn(dnch->ifft, dnch->fft_in, dnch->fft_out, s->complex_sample_size);
 
         switch (s->format) {
         case AV_SAMPLE_FMT_FLTP:



More information about the ffmpeg-cvslog mailing list