[FFmpeg-cvslog] avfilter/af_asubboost: make wet option apply to final output

Paul B Mahol git at videolan.org
Sat Nov 28 23:08:01 EET 2020


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sat Nov 28 21:59:14 2020 +0100| [94ea760c6f46265e7f6bd2403c183432e5b5767f] | committer: Paul B Mahol

avfilter/af_asubboost: make wet option apply to final output

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.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=94ea760c6f46265e7f6bd2403c183432e5b5767f
---

 doc/filters.texi           |  6 +++---
 libavfilter/af_asubboost.c | 11 ++++++-----
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index b927ddbfbb..a658faf8b2 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -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.
diff --git a/libavfilter/af_asubboost.c b/libavfilter/af_asubboost.c
index 7345d3b404..4b30c67461 100644
--- a/libavfilter/af_asubboost.c
+++ b/libavfilter/af_asubboost.c
@@ -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 },



More information about the ffmpeg-cvslog mailing list