]> git.sesse.net Git - ffmpeg/commitdiff
avfilter/af_asubboost: make wet option apply to final output
authorPaul B Mahol <onemda@gmail.com>
Sat, 28 Nov 2020 20:59:14 +0000 (21:59 +0100)
committerPaul B Mahol <onemda@gmail.com>
Sat, 28 Nov 2020 21:07:18 +0000 (22:07 +0100)
Also changes some default values for options after this change.
This makes distinction between feedback and wet option.
Before they would produce same output if values were swapped.

doc/filters.texi
libavfilter/af_asubboost.c

index b927ddbfbb85ef757f35b4c0776272383c333338..a658faf8b27f6c1663ceb46d659fee4f02aad8a1 100644 (file)
@@ -2605,11 +2605,11 @@ The filter accepts the following options:
 @table @option
 @item dry
 Set dry gain, how much of original signal is kept. Allowed range is from 0 to 1.
-Default value is 0.5.
+Default value is 0.7.
 
 @item wet
 Set wet gain, how much of filtered signal is kept. Allowed range is from 0 to 1.
-Default value is 0.8.
+Default value is 0.7.
 
 @item decay
 Set delay line decay gain value. Allowed range is from 0 to 1.
@@ -2617,7 +2617,7 @@ Default value is 0.7.
 
 @item feedback
 Set delay line feedback gain value. Allowed range is from 0 to 1.
-Default value is 0.5.
+Default value is 0.9.
 
 @item cutoff
 Set cutoff frequency in Hertz. Allowed range is 50 to 900.
index 7345d3b404a11df2d74d2849e2bcf57f1598d458..4b30c67461f2e5c309ebe4e882ae15e778556699 100644 (file)
@@ -122,7 +122,8 @@ static int filter_channels(AVFilterContext *ctx, void *arg, int jobnr, int nb_jo
     ThreadData *td = arg;
     AVFrame *out = td->out;
     AVFrame *in = td->in;
-    const double wet = ctx->is_disabled ? 0. : s->wet_gain;
+    const double mix = ctx->is_disabled ? 0. : 1.;
+    const double wet = ctx->is_disabled ? 1. : s->wet_gain;
     const double dry = ctx->is_disabled ? 1. : s->dry_gain;
     const double feedback = s->feedback, decay = s->decay;
     const double b0 = s->b0;
@@ -149,7 +150,7 @@ static int filter_channels(AVFilterContext *ctx, void *arg, int jobnr, int nb_jo
             w[1] = b2 * src[n] + a2 * out_sample;
 
             buffer[write_pos] = buffer[write_pos] * decay + out_sample * feedback;
-            dst[n] = src[n] * dry + buffer[write_pos] * wet;
+            dst[n] = (src[n] * dry + buffer[write_pos] * mix) * wet;
 
             if (++write_pos >= buffer_samples)
                 write_pos = 0;
@@ -213,10 +214,10 @@ static int process_command(AVFilterContext *ctx, const char *cmd, const char *ar
 #define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
 
 static const AVOption asubboost_options[] = {
-    { "dry",      "set dry gain", OFFSET(dry_gain), AV_OPT_TYPE_DOUBLE, {.dbl=0.5},      0,   1, FLAGS },
-    { "wet",      "set wet gain", OFFSET(wet_gain), AV_OPT_TYPE_DOUBLE, {.dbl=0.8},      0,   1, FLAGS },
+    { "dry",      "set dry gain", OFFSET(dry_gain), AV_OPT_TYPE_DOUBLE, {.dbl=0.7},      0,   1, FLAGS },
+    { "wet",      "set wet gain", OFFSET(wet_gain), AV_OPT_TYPE_DOUBLE, {.dbl=0.7},      0,   1, FLAGS },
     { "decay",    "set decay",    OFFSET(decay),    AV_OPT_TYPE_DOUBLE, {.dbl=0.7},      0,   1, FLAGS },
-    { "feedback", "set feedback", OFFSET(feedback), AV_OPT_TYPE_DOUBLE, {.dbl=0.5},      0,   1, FLAGS },
+    { "feedback", "set feedback", OFFSET(feedback), AV_OPT_TYPE_DOUBLE, {.dbl=0.9},      0,   1, FLAGS },
     { "cutoff",   "set cutoff",   OFFSET(cutoff),   AV_OPT_TYPE_DOUBLE, {.dbl=100},     50, 900, FLAGS },
     { "slope",    "set slope",    OFFSET(slope),    AV_OPT_TYPE_DOUBLE, {.dbl=0.5}, 0.0001,   1, FLAGS },
     { "delay",    "set delay",    OFFSET(delay),    AV_OPT_TYPE_DOUBLE, {.dbl=20},       1, 100, FLAGS },