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

This commit is contained in:
Paul B Mahol 2022-12-03 21:25:32 +01:00
parent 710d83bdde
commit 7bf74f909d

View File

@ -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: