From c0f49378a9520ccd9ee4398bf3e1721a76b0569b Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Mon, 14 Mar 2022 11:20:23 +0100 Subject: [PATCH] avfilter/af_afftdn: allow user to control number of bands --- doc/filters.texi | 4 ++++ libavfilter/af_afftdn.c | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/filters.texi b/doc/filters.texi index 73081bed4c..c4cf083526 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -1367,6 +1367,10 @@ Use measured average noise floor of all channels. Default value is @var{min}. @end table + +@item band_multiplier, bm +Set the band multiplier factor, used how much to spread bands across frequency bins. +Allowed range is from @var{0.2} to @var{5}. Default value is @var{1.25}. @end table @subsection Commands diff --git a/libavfilter/af_afftdn.c b/libavfilter/af_afftdn.c index a0af0c00da..29b9ffe6d8 100644 --- a/libavfilter/af_afftdn.c +++ b/libavfilter/af_afftdn.c @@ -113,6 +113,7 @@ typedef struct AudioFFTDeNoiseContext { int output_mode; int noise_floor_link; float ratio; + float band_multiplier; float last_residual_floor; float last_noise_floor; @@ -200,6 +201,8 @@ static const AVOption afftdn_options[] = { { "min", "min", 0, AV_OPT_TYPE_CONST, {.i64 = MIN_LINK}, 0, 0, AFR, "link" }, { "max", "max", 0, AV_OPT_TYPE_CONST, {.i64 = MAX_LINK}, 0, 0, AFR, "link" }, { "average", "average", 0, AV_OPT_TYPE_CONST, {.i64 = AVERAGE_LINK}, 0, 0, AFR, "link" }, + { "band_multiplier", "set band multiplier",OFFSET(band_multiplier), AV_OPT_TYPE_FLOAT,{.dbl = 1.25}, 0.2,5, AF }, + { "bm", "set band multiplier", OFFSET(band_multiplier), AV_OPT_TYPE_FLOAT,{.dbl = 1.25}, 0.2,5, AF }, { NULL } }; @@ -690,7 +693,7 @@ static int config_input(AVFilterLink *inlink) if (!s->window || !s->bin2band) return AVERROR(ENOMEM); - sdiv = s->sample_rate / 17640.0; + sdiv = s->band_multiplier; for (i = 0; i < s->bin_count; i++) s->bin2band[i] = lrint(sdiv * freq2bark((0.5 * i * s->sample_rate) / s->fft_length2));