[FFmpeg-cvslog] avfilter/af_afftdn: rename some variables to less cryptic name
Paul B Mahol
git at videolan.org
Sun Mar 13 18:27:30 EET 2022
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sun Mar 13 13:08:23 2022 +0100| [9e279c8c2d0ce36f20f7981ad0a771eaef4d1f44] | committer: Paul B Mahol
avfilter/af_afftdn: rename some variables to less cryptic name
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9e279c8c2d0ce36f20f7981ad0a771eaef4d1f44
---
libavfilter/af_afftdn.c | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/libavfilter/af_afftdn.c b/libavfilter/af_afftdn.c
index 2acae1a82a..03e55f893f 100644
--- a/libavfilter/af_afftdn.c
+++ b/libavfilter/af_afftdn.c
@@ -326,23 +326,22 @@ static void process_frame(AudioFFTDeNoiseContext *s, DeNoiseChannel *dnch,
double *band_excit = dnch->band_excit;
double *band_amt = dnch->band_amt;
double *gain = dnch->gain;
- double d1, d2, d3;
int n = 0, i1;
for (int i = 0; i < s->fft_length2; i++) {
- double new_gain;
+ double new_gain, mag, mag_abs_var, new_mag_abs_var;
- d1 = fft_data[i].re * fft_data[i].re + fft_data[i].im * fft_data[i].im;
- if (d1 > sample_floor)
+ mag = fft_data[i].re * fft_data[i].re + fft_data[i].im * fft_data[i].im;
+ if (mag > sample_floor)
n = i;
- dnch->noisy_data[i] = d1;
- d2 = d1 / abs_var[i];
- d3 = ratio * prior[i] + rratio * fmax(d2 - 1.0, 0.0);
- new_gain = d3 / (1.0 + d3);
- new_gain *= (new_gain + M_PI_4 / fmax(d2, 1.0E-6));
- prior[i] = d2 * new_gain;
- dnch->clean_data[i] = d1 * new_gain;
+ dnch->noisy_data[i] = mag;
+ 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);
gain[i] = new_gain;
}
More information about the ffmpeg-cvslog
mailing list