History

avfilter/af_crossfeed: make slope configurable

Paul B Mahol committed 6 years ago

Commit 35d60011 parent 0ec61fc2 files · +7 −1Browse files

Unified · Split

2 files
  1. doc/filters.texi +4 −0
  2. libavfilter/af_crossfeed.c +3 −1
doc/filters.texi+4−0
@@ -3267,6 +3267,10 @@ Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1. · 3266 unmodified lines
32673267 This sets cut off frequency of low shelf filter. Default is cut off near
32683268 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
32693269
3270+@item slope
3271+Set curve slope of low shelf filter. Default is 0.5.
3272+Allowed range is from 0.01 to 1.
3273+
32703274 @item level_in
32713275 Set input gain. Default is 0.9.
32723276
libavfilter/af_crossfeed.c+3−1
@@ -28,6 +28,7 @@ typedef struct CrossfeedContext { · 27 unmodified lines
2828
2929 double range;
3030 double strength;
31+ double slope;
3132 double level_in;
3233 double level_out;
3334
@@ -62,7 +63,7 @@ static int config_input(AVFilterLink *inlink) · 28 unmodified lines
6263 double w0 = 2 * M_PI * (1. - s->range) * 2100 / inlink->sample_rate;
6364 double alpha;
6465
65− alpha = sin(w0) / 2 * sqrt((A + 1 / A) * (1 / 0.5 - 1) + 2);
66+ alpha = sin(w0) / 2 * sqrt((A + 1 / A) * (1 / s->slope - 1) + 2);
6667
6768 s->a0 = (A + 1) + (A - 1) * cos(w0) + 2 * sqrt(A) * alpha;
6869 s->a1 = -2 * ((A - 1) + (A + 1) * cos(w0));
@@ -139,6 +140,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 70 unmodified lines
139140 static const AVOption crossfeed_options[] = {
140141 { "strength", "set crossfeed strength", OFFSET(strength), AV_OPT_TYPE_DOUBLE, {.dbl=.2}, 0, 1, FLAGS },
141142 { "range", "set soundstage wideness", OFFSET(range), AV_OPT_TYPE_DOUBLE, {.dbl=.5}, 0, 1, FLAGS },
143+ { "slope", "set curve slope", OFFSET(slope), AV_OPT_TYPE_DOUBLE, {.dbl=.5}, .01, 1, FLAGS },
142144 { "level_in", "set level in", OFFSET(level_in), AV_OPT_TYPE_DOUBLE, {.dbl=.9}, 0, 1, FLAGS },
143145 { "level_out", "set level out", OFFSET(level_out), AV_OPT_TYPE_DOUBLE, {.dbl=1.}, 0, 1, FLAGS },
144146 { NULL }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t