[FFmpeg-cvslog] avfilter/avf_avectorscope: add swap and mirror options
Paul B Mahol
git at videolan.org
Tue Nov 21 13:27:11 EET 2017
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Tue Nov 21 12:07:13 2017 +0100| [afd2bf54c31b501244941e93bff364c6aa60e02c] | committer: Paul B Mahol
avfilter/avf_avectorscope: add swap and mirror options
Signed-off-by: Paul B Mahol <onemda at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=afd2bf54c31b501244941e93bff364c6aa60e02c
---
doc/filters.texi | 20 ++++++++++++++++++++
libavfilter/avf_avectorscope.c | 17 +++++++++++++++++
2 files changed, 37 insertions(+)
diff --git a/doc/filters.texi b/doc/filters.texi
index 63ce899784..62f633c6f8 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -17232,6 +17232,26 @@ Cubic root.
Logarithmic.
@end table
+ at item swap
+Swap left channel axis with right channel axis.
+
+ at item mirror
+Mirror axis.
+
+ at table @samp
+ at item none
+No mirror.
+
+ at item x
+Mirror only x axis.
+
+ at item y
+Mirror only y axis.
+
+ at item xy
+Mirror both axis.
+ at end table
+
@end table
@subsection Examples
diff --git a/libavfilter/avf_avectorscope.c b/libavfilter/avf_avectorscope.c
index c8ff0698e3..725ac8bbda 100644
--- a/libavfilter/avf_avectorscope.c
+++ b/libavfilter/avf_avectorscope.c
@@ -65,6 +65,8 @@ typedef struct AudioVectorScopeContext {
int contrast[4];
int fade[4];
double zoom;
+ int swap;
+ int mirror;
unsigned prev_x, prev_y;
AVRational frame_rate;
} AudioVectorScopeContext;
@@ -99,6 +101,12 @@ static const AVOption avectorscope_options[] = {
{ "sqrt", "square root", 0, AV_OPT_TYPE_CONST, {.i64=SQRT}, 0, 0, FLAGS, "scale" },
{ "cbrt", "cube root", 0, AV_OPT_TYPE_CONST, {.i64=CBRT}, 0, 0, FLAGS, "scale" },
{ "log", "logarithmic", 0, AV_OPT_TYPE_CONST, {.i64=LOG}, 0, 0, FLAGS, "scale" },
+ { "swap", "swap x axis with y axis", OFFSET(swap), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1, FLAGS },
+ { "mirror", "mirror axis", OFFSET(mirror), AV_OPT_TYPE_INT, {.i64=2}, 0, 3, FLAGS, "mirror" },
+ { "none", "no mirror", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, "mirror" },
+ { "x", "mirror x", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, "mirror" },
+ { "y", "mirror y", 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, FLAGS, "mirror" },
+ { "xy", "mirror both", 0, AV_OPT_TYPE_CONST, {.i64=3}, 0, 0, FLAGS, "mirror" },
{ NULL }
};
@@ -316,6 +324,15 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
break;
}
+ if (s->mirror & 1)
+ src[0] = -src[0];
+
+ if (s->mirror & 2)
+ src[1] = -src[1];
+
+ if (s->swap)
+ FFSWAP(float, src[0], src[1]);;
+
if (s->mode == LISSAJOUS) {
x = ((src[1] - src[0]) * zoom / 2 + 1) * hw;
y = (1.0 - (src[0] + src[1]) * zoom / 2) * hh;
More information about the ffmpeg-cvslog
mailing list