diff options
author | Paul B Mahol <onemda@gmail.com> | 2022-03-17 09:34:24 +0100 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2022-03-17 11:02:07 +0100 |
commit | 1636f9f599264450671b9c7052eae55ec97e54cd (patch) | |
tree | 29b70384557b535a66f1116340665f62127f48e8 /libavfilter/af_afftdn.c | |
parent | bea841a7430c34c99817a056b408c58a73034e58 (diff) |
avfilter/af_afftdn: expose floor offset factor option
Diffstat (limited to 'libavfilter/af_afftdn.c')
-rw-r--r-- | libavfilter/af_afftdn.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libavfilter/af_afftdn.c b/libavfilter/af_afftdn.c index 687a1691a1..9587885627 100644 --- a/libavfilter/af_afftdn.c +++ b/libavfilter/af_afftdn.c @@ -117,6 +117,7 @@ typedef struct AudioFFTDeNoiseContext { int noise_floor_link; float ratio; float band_multiplier; + float floor_offset; float last_residual_floor; float last_noise_floor; @@ -196,6 +197,8 @@ static const AVOption afftdn_options[] = { { "n", "noise", 0, AV_OPT_TYPE_CONST, {.i64 = NOISE_MODE}, 0, 0, AFR, "mode" }, { "adaptivity", "set adaptivity factor",OFFSET(ratio), AV_OPT_TYPE_FLOAT, {.dbl = 0.5}, 0, 1, AFR }, { "ad", "set adaptivity factor",OFFSET(ratio), AV_OPT_TYPE_FLOAT, {.dbl = 0.5}, 0, 1, AFR }, + { "floor_offset", "set noise floor offset factor",OFFSET(floor_offset), AV_OPT_TYPE_FLOAT, {.dbl = 1.0}, -2, 2, AFR }, + { "fo", "set noise floor offset factor",OFFSET(floor_offset), AV_OPT_TYPE_FLOAT, {.dbl = 1.0}, -2, 2, AFR }, { "noise_link", "set the noise floor link",OFFSET(noise_floor_link),AV_OPT_TYPE_INT,{.i64 = MIN_LINK}, 0, NB_LINK-1, AFR, "link" }, { "nl", "set the noise floor link", OFFSET(noise_floor_link),AV_OPT_TYPE_INT,{.i64 = MIN_LINK}, 0, NB_LINK-1, AFR, "link" }, { "none", "none", 0, AV_OPT_TYPE_CONST, {.i64 = NONE_LINK}, 0, 0, AFR, "link" }, @@ -381,11 +384,11 @@ static void process_frame(AVFilterContext *ctx, flatness = num / den; if (flatness > 0.8) { - const double offset = floor_offset(noisy_data, s->bin_count, den); + const double offset = s->floor_offset * floor_offset(noisy_data, s->bin_count, den); const double new_floor = av_clipd(10.0 * log10(den) - 100.0 + offset, -90., -20.); dnch->noise_floor = 0.1 * new_floor + dnch->noise_floor * 0.9; - set_parameters(s, dnch, 1, 0); + set_parameters(s, dnch, 1, 1); } } |