1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

avfilter/af_stereotools: add two more modes

This commit is contained in:
Paul B Mahol 2020-12-04 11:53:34 +01:00
parent 87c1b74233
commit 456146356a
2 changed files with 20 additions and 2 deletions

View File

@ -5499,6 +5499,12 @@ Mid/Side to Left/Left.
@item ms>rr
Mid/Side to Right/Right.
@item ms>rl
Mid/Side to Right/Left.
@item lr>l-r
Left/Right to Left - Right.
@end table
@item slev

View File

@ -69,7 +69,7 @@ static const AVOption stereotools_options[] = {
{ "muter", "mute R", OFFSET(mute_r), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, A },
{ "phasel", "phase L", OFFSET(phase_l), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, A },
{ "phaser", "phase R", OFFSET(phase_r), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, A },
{ "mode", "set stereo mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=0}, 0, 8, A, "mode" },
{ "mode", "set stereo mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=0}, 0, 10, A, "mode" },
{ "lr>lr", 0, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, A, "mode" },
{ "lr>ms", 0, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, A, "mode" },
{ "ms>lr", 0, 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, A, "mode" },
@ -79,6 +79,8 @@ static const AVOption stereotools_options[] = {
{ "lr>rl", 0, 0, AV_OPT_TYPE_CONST, {.i64=6}, 0, 0, A, "mode" },
{ "ms>ll", 0, 0, AV_OPT_TYPE_CONST, {.i64=7}, 0, 0, A, "mode" },
{ "ms>rr", 0, 0, AV_OPT_TYPE_CONST, {.i64=8}, 0, 0, A, "mode" },
{ "ms>rl", 0, 0, AV_OPT_TYPE_CONST, {.i64=9}, 0, 0, A, "mode" },
{ "lr>l-r", 0, 0, AV_OPT_TYPE_CONST, {.i64=10}, 0, 0, A, "mode" },
{ "slev", "set side level", OFFSET(slev), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0.015625, 64, A },
{ "sbal", "set side balance", OFFSET(sbal), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -1, 1, A },
{ "mlev", "set middle level", OFFSET(mlev), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0.015625, 64, A },
@ -235,7 +237,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
L = R;
break;
case 5:
L = (L + R) / 2;
L = (L + R) * 0.5;
R = L;
break;
case 6:
@ -259,6 +261,16 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
L = r;
R = r;
break;
case 9:
l = L * mlev * FFMIN(1., 2. - mpan) + R * slev * FFMIN(1., 2. - sbal);
r = L * mlev * FFMIN(1., mpan) - R * slev * FFMIN(1., sbal);
L = r;
R = l;
break;
case 10:
L = (L - R) * 0.5;
R = L;
break;
}
L *= 1. - mute_l;