summaryrefslogtreecommitdiff
path: root/libavfilter/af_anlmdn.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2019-01-12 15:33:39 +0100
committerPaul B Mahol <onemda@gmail.com>2019-01-12 15:41:24 +0100
commitf4fd8ef725a805cfc8fd695f283b8bfe9bef1b5a (patch)
tree0785db240b7326b8a4d4c3737174835ad89fae8d /libavfilter/af_anlmdn.c
parentad0d5d7516dc3de7d1172c03920256b6a48fcd39 (diff)
avfilter/af_anlmdn: rework how denoising strength is used
Make into account patch size.
Diffstat (limited to 'libavfilter/af_anlmdn.c')
-rw-r--r--libavfilter/af_anlmdn.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavfilter/af_anlmdn.c b/libavfilter/af_anlmdn.c
index 7cd6f2c477..43ceab8e4a 100644
--- a/libavfilter/af_anlmdn.c
+++ b/libavfilter/af_anlmdn.c
@@ -66,7 +66,7 @@ typedef struct AudioNLMeansContext {
#define AF AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
static const AVOption anlmdn_options[] = {
- { "s", "set denoising strength", OFFSET(a), AV_OPT_TYPE_FLOAT, {.dbl=1}, 1, 9999, AF },
+ { "s", "set denoising strength", OFFSET(a), AV_OPT_TYPE_FLOAT, {.dbl=0.00001},0.00001, 10, AF },
{ "p", "set patch duration", OFFSET(pd), AV_OPT_TYPE_DURATION, {.i64=2000}, 1000, 100000, AF },
{ "r", "set research duration", OFFSET(rd), AV_OPT_TYPE_DURATION, {.i64=6000}, 2000, 300000, AF },
{ NULL }
@@ -186,7 +186,7 @@ static int filter_channel(AVFilterContext *ctx, void *arg, int ch, int nb_jobs)
const int K = s->K;
const float *f = (const float *)(s->in->extended_data[ch]) + K;
float *cache = (float *)s->cache->extended_data[ch];
- const float sw = 32768.f / s->a;
+ const float sw = (65536.f / (4 * K + 2)) / sqrtf(s->a);
float *dst = (float *)out->extended_data[ch] + s->offset;
for (int i = S; i < s->H + S; i++) {