avfilter/af_afftdn: allow user to control number of bands

This commit is contained in:
Paul B Mahol 2022-03-14 11:20:23 +01:00
parent deffacb6b4
commit c0f49378a9
2 changed files with 8 additions and 1 deletions

View File

@ -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

View File

@ -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));