summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2022-03-14 11:20:23 +0100
committerPaul B Mahol <onemda@gmail.com>2022-03-14 17:43:12 +0100
commitc0f49378a9520ccd9ee4398bf3e1721a76b0569b (patch)
treef272ee7a17c532844f65a3f3ff29971b4bf2b513
parentdeffacb6b4b79a375132f078115beb72ee6acb1f (diff)
avfilter/af_afftdn: allow user to control number of bands
-rw-r--r--doc/filters.texi4
-rw-r--r--libavfilter/af_afftdn.c5
2 files changed, 8 insertions, 1 deletions
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));