History

avfilter/af_crossfeed: make slope configurable

Paul B Mahol committed 6 years ago

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

Showing the changes to libavfilter (1 of 2 files). Show all

Unified · Split

libavfilter/af_crossfeed.c+3−1
@@ -28,6 +28,7 @@ typedef struct CrossfeedContext { · 27 unmodified lines
28 28
29 double range;29 double range;
30 double strength;30 double strength;
31 double slope;
31 double level_in;32 double level_in;
32 double level_out;33 double level_out;
33 34
@@ -62,7 +63,7 @@ static int config_input(AVFilterLink *inlink) · 28 unmodified lines
62 double w0 = 2 * M_PI * (1. - s->range) * 2100 / inlink->sample_rate;63 double w0 = 2 * M_PI * (1. - s->range) * 2100 / inlink->sample_rate;
63 double alpha;64 double alpha;
64 65
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);
66 67
67 s->a0 = (A + 1) + (A - 1) * cos(w0) + 2 * sqrt(A) * alpha;68 s->a0 = (A + 1) + (A - 1) * cos(w0) + 2 * sqrt(A) * alpha;
68 s->a1 = -2 * ((A - 1) + (A + 1) * cos(w0));69 s->a1 = -2 * ((A - 1) + (A + 1) * cos(w0));
@@ -139,6 +140,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 70 unmodified lines
139static const AVOption crossfeed_options[] = {140static const AVOption crossfeed_options[] = {
140 { "strength", "set crossfeed strength", OFFSET(strength), AV_OPT_TYPE_DOUBLE, {.dbl=.2}, 0, 1, FLAGS },141 { "strength", "set crossfeed strength", OFFSET(strength), AV_OPT_TYPE_DOUBLE, {.dbl=.2}, 0, 1, FLAGS },
141 { "range", "set soundstage wideness", OFFSET(range), AV_OPT_TYPE_DOUBLE, {.dbl=.5}, 0, 1, FLAGS },142 { "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 },
142 { "level_in", "set level in", OFFSET(level_in), AV_OPT_TYPE_DOUBLE, {.dbl=.9}, 0, 1, FLAGS },144 { "level_in", "set level in", OFFSET(level_in), AV_OPT_TYPE_DOUBLE, {.dbl=.9}, 0, 1, FLAGS },
143 { "level_out", "set level out", OFFSET(level_out), AV_OPT_TYPE_DOUBLE, {.dbl=1.}, 0, 1, FLAGS },145 { "level_out", "set level out", OFFSET(level_out), AV_OPT_TYPE_DOUBLE, {.dbl=1.}, 0, 1, FLAGS },
144 { NULL }146 { 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