[FFmpeg-cvslog] avfilter/af_stereotools: add 2 more modes

Paul B Mahol git at videolan.org
Mon Jun 19 20:02:24 EEST 2017


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Mon Jun 19 18:59:33 2017 +0200| [ef178f630f79b6867f1a378aea948c1719994d4d] | committer: Paul B Mahol

avfilter/af_stereotools: add 2 more modes

Signed-off-by: Paul B Mahol <onemda at gmail.com>

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

 doc/filters.texi             |  6 ++++++
 libavfilter/af_stereotools.c | 13 ++++++++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 2ef375a3da..1d003aebf7 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -3743,6 +3743,12 @@ Left/Right to Left + Right.
 
 @item lr>rl
 Left/Right to Right/Left.
+
+ at item ms>ll
+Mid/Side to Left/Left.
+
+ at item ms>rr
+Mid/Side to Right/Right.
 @end table
 
 @item slev
diff --git a/libavfilter/af_stereotools.c b/libavfilter/af_stereotools.c
index 2d2a9bd625..cd2de869b9 100644
--- a/libavfilter/af_stereotools.c
+++ b/libavfilter/af_stereotools.c
@@ -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,          6, A, "mode" },
+    { "mode",        "set stereo mode",  OFFSET(mode),        AV_OPT_TYPE_INT,    {.i64=0},   0,          8, 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" },
@@ -77,6 +77,8 @@ static const AVOption stereotools_options[] = {
     {     "lr>rr",   0,                  0,                   AV_OPT_TYPE_CONST,  {.i64=4},   0,          0, A, "mode" },
     {     "lr>l+r",  0,                  0,                   AV_OPT_TYPE_CONST,  {.i64=5},   0,          0, A, "mode" },
     {     "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" },
     { "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 },
@@ -246,6 +248,15 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
             r = m * mlev * FFMIN(1., mpan)      - S * slev * FFMIN(1., sbal);
             L = l;
             R = r;
+        case 7:
+            l = L * mlev * FFMIN(1., 2. - mpan) + R * slev * FFMIN(1., 2. - sbal);
+            L = l;
+            R = l;
+            break;
+        case 8:
+            r = L * mlev * FFMIN(1., mpan)      - R * slev * FFMIN(1., sbal);
+            L = r;
+            R = r;
             break;
         }
 



More information about the ffmpeg-cvslog mailing list