diff options
author | Paul B Mahol <onemda@gmail.com> | 2022-03-12 17:56:52 +0100 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2022-03-12 18:58:24 +0100 |
commit | b8af574477a1aa3ceaa29792c35468bdd42bd21c (patch) | |
tree | bbadb3d8e671a5fb83fcc6fd303a5478d4745fa8 | |
parent | 0bebff0c18a6fff7900ffaea6342577b6b5533a5 (diff) | |
download | ffmpeg-b8af574477a1aa3ceaa29792c35468bdd42bd21c.tar.gz |
avfilter/af_afftdn: reduce code duplication
-rw-r--r-- | libavfilter/af_afftdn.c | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/libavfilter/af_afftdn.c b/libavfilter/af_afftdn.c index 04739ee4c2..b371bd7fc7 100644 --- a/libavfilter/af_afftdn.c +++ b/libavfilter/af_afftdn.c @@ -433,24 +433,7 @@ static void process_frame(AudioFFTDeNoiseContext *s, DeNoiseChannel *dnch, for (int i = 0; i < s->bin_count; i++) dnch->amt[i] = dnch->band_amt[s->bin2band[i]]; - if (dnch->amt[0] > dnch->abs_var[0]) { - dnch->gain[0] = 1.0; - } else if (dnch->amt[0] > dnch->min_abs_var[0]) { - double limit = sqrt(dnch->abs_var[0] / dnch->amt[0]); - dnch->gain[0] = limit_gain(dnch->gain[0], limit); - } else { - dnch->gain[0] = limit_gain(dnch->gain[0], s->max_gain); - } - if (dnch->amt[s->fft_length2] > dnch->abs_var[s->fft_length2]) { - dnch->gain[s->fft_length2] = 1.0; - } else if (dnch->amt[s->fft_length2] > dnch->min_abs_var[s->fft_length2]) { - double limit = sqrt(dnch->abs_var[s->fft_length2] / dnch->amt[s->fft_length2]); - dnch->gain[s->fft_length2] = limit_gain(dnch->gain[s->fft_length2], limit); - } else { - dnch->gain[s->fft_length2] = limit_gain(dnch->gain[s->fft_length2], s->max_gain); - } - - for (int i = 0; i < s->fft_length2; i++) { + for (int i = 0; i <= s->fft_length2; i++) { if (dnch->amt[i] > dnch->abs_var[i]) { dnch->gain[i] = 1.0; } else if (dnch->amt[i] > dnch->min_abs_var[i]) { |