diff options
author | Paul B Mahol <onemda@gmail.com> | 2022-03-15 19:08:43 +0100 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2022-03-16 22:28:14 +0100 |
commit | 77d20a0f7456b7020c403e5e1b81132ee56653e1 (patch) | |
tree | 1a131d4ab9e27113ed65cc641615d5dbe1afc57e | |
parent | ffff5bb740b09dafa75b880b7a1e85a793604623 (diff) | |
download | ffmpeg-77d20a0f7456b7020c403e5e1b81132ee56653e1.tar.gz |
avfilter/af_afftdn: remove excessive operations
-rw-r--r-- | libavfilter/af_afftdn.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/libavfilter/af_afftdn.c b/libavfilter/af_afftdn.c index b1b3402bf2..ac2a499c7f 100644 --- a/libavfilter/af_afftdn.c +++ b/libavfilter/af_afftdn.c @@ -363,7 +363,7 @@ static void process_frame(AVFilterContext *ctx, int n = 0, i1; for (int i = 0; i < s->fft_length2; i++) { - double new_gain, mag, mag_abs_var, new_mag_abs_var; + double sqr_new_gain, new_gain, mag, mag_abs_var, new_mag_abs_var; mag = fft_data[i].re * fft_data[i].re + fft_data[i].im * fft_data[i].im; if (mag > sample_floor) @@ -373,10 +373,9 @@ static void process_frame(AVFilterContext *ctx, mag_abs_var = mag / abs_var[i]; new_mag_abs_var = ratio * prior[i] + rratio * fmax(mag_abs_var - 1.0, 0.0); new_gain = new_mag_abs_var / (1.0 + new_mag_abs_var); - new_gain *= (new_gain + M_PI_4 / fmax(mag_abs_var, 1.0E-6)); - prior[i] = mag_abs_var * new_gain; - dnch->clean_data[i] = mag * new_gain; - new_gain = sqrt(new_gain); + sqr_new_gain = new_gain * new_gain; + prior[i] = mag_abs_var * sqr_new_gain; + dnch->clean_data[i] = mag * sqr_new_gain; gain[i] = new_gain; } |