[FFmpeg-cvslog] avfilter/vf_vectorscope: make intensity user configurable

Paul B Mahol git at videolan.org
Mon Aug 24 16:30:01 CEST 2015


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sun Aug 23 11:54:16 2015 +0000| [c34c050303b11e3f88fa1be7b43fe9439765e0af] | committer: Paul B Mahol

avfilter/vf_vectorscope: make intensity user configurable

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

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

 doc/filters.texi             |    4 ++++
 libavfilter/vf_vectorscope.c |   13 ++++++++-----
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 0a63890..2f7b0fa 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -10533,6 +10533,10 @@ Set which color component will be represented on X-axis. Default is @code{1}.
 
 @item y
 Set which color component will be represented on Y-axis. Default is @code{2}.
+
+ at item intensity
+Set intensity, used by modes: gray, color and color3 for increasing brightness
+of color component which represents frequency of (X, Y) location in graph.
 @end table
 
 @anchor{vidstabdetect}
diff --git a/libavfilter/vf_vectorscope.c b/libavfilter/vf_vectorscope.c
index dd26aa6..7f875a4 100644
--- a/libavfilter/vf_vectorscope.c
+++ b/libavfilter/vf_vectorscope.c
@@ -38,6 +38,7 @@ enum VectorscopeMode {
 typedef struct VectorscopeContext {
     const AVClass *class;
     int mode;
+    int intensity;
     const uint8_t *bg_color;
     int planewidth[4];
     int planeheight[4];
@@ -56,6 +57,7 @@ static const AVOption vectorscope_options[] = {
     { "color3", 0, 0, AV_OPT_TYPE_CONST, {.i64=COLOR3}, 0, 0, FLAGS, "mode" },
     { "x", "set color component on X axis", OFFSET(x), AV_OPT_TYPE_INT, {.i64=1}, 0, 2, FLAGS},
     { "y", "set color component on Y axis", OFFSET(y), AV_OPT_TYPE_INT, {.i64=2}, 0, 2, FLAGS},
+    { "intensity", "set intensity", OFFSET(intensity), AV_OPT_TYPE_INT, {.i64=1}, 1, 255, FLAGS},
     { NULL }
 };
 
@@ -182,6 +184,7 @@ static void vectorscope(VectorscopeContext *s, AVFrame *in, AVFrame *out, int pd
     const int slinesizex = in->linesize[s->x];
     const int slinesizey = in->linesize[s->y];
     const int dlinesize = out->linesize[0];
+    const int intensity = s->intensity;
     int i, j, px = s->x, py = s->y;
     const int h = s->planeheight[py];
     const int w = s->planewidth[px];
@@ -204,7 +207,7 @@ static void vectorscope(VectorscopeContext *s, AVFrame *in, AVFrame *out, int pd
                     const int y = spy[iwy + j];
                     const int pos = y * dlinesize + x;
 
-                    dpd[pos] = FFMIN(dpd[pos] + 1, 255);
+                    dpd[pos] = FFMIN(dpd[pos] + intensity, 255);
                     if (dst[3])
                         dst[3][pos] = 255;
                 }
@@ -218,9 +221,9 @@ static void vectorscope(VectorscopeContext *s, AVFrame *in, AVFrame *out, int pd
                     const int y = spy[iwy + j];
                     const int pos = y * dlinesize + x;
 
-                    dst[0][pos] = FFMIN(dst[0][pos] + 1, 255);
-                    dst[1][pos] = FFMIN(dst[1][pos] + 1, 255);
-                    dst[2][pos] = FFMIN(dst[2][pos] + 1, 255);
+                    dst[0][pos] = FFMIN(dst[0][pos] + intensity, 255);
+                    dst[1][pos] = FFMIN(dst[1][pos] + intensity, 255);
+                    dst[2][pos] = FFMIN(dst[2][pos] + intensity, 255);
                     if (dst[3])
                         dst[3][pos] = 255;
                 }
@@ -283,7 +286,7 @@ static void vectorscope(VectorscopeContext *s, AVFrame *in, AVFrame *out, int pd
                 const int y = spy[iw2 + j];
                 const int pos = y * dlinesize + x;
 
-                dpd[pos] = FFMIN(255, dpd[pos] + 1);
+                dpd[pos] = FFMIN(255, dpd[pos] + intensity);
                 dpx[pos] = x;
                 dpy[pos] = y;
                 if (dst[3])



More information about the ffmpeg-cvslog mailing list