[FFmpeg-cvslog] avfilter/af_afftdn: reduce code duplication

Paul B Mahol git at videolan.org
Sat Mar 12 19:57:17 EET 2022


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sat Mar 12 17:56:52 2022 +0100| [b8af574477a1aa3ceaa29792c35468bdd42bd21c] | committer: Paul B Mahol

avfilter/af_afftdn: reduce code duplication

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

 libavfilter/af_afftdn.c | 19 +------------------
 1 file changed, 1 insertion(+), 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]) {



More information about the ffmpeg-cvslog mailing list