summaryrefslogtreecommitdiff
path: root/libavfilter/af_asubboost.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2020-11-28 21:59:14 +0100
committerPaul B Mahol <onemda@gmail.com>2020-11-28 22:07:18 +0100
commit94ea760c6f46265e7f6bd2403c183432e5b5767f (patch)
tree3fd671c84c552c8ea553595c7464572d1e9b4565 /libavfilter/af_asubboost.c
parenta01b037c908eae2e4ed03a976fc63a0de6cd443b (diff)
downloadffmpeg-94ea760c6f46265e7f6bd2403c183432e5b5767f.tar.gz
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.
Diffstat (limited to 'libavfilter/af_asubboost.c')
-rw-r--r--libavfilter/af_asubboost.c11
1 files changed, 6 insertions, 5 deletions
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 },