[FFmpeg-cvslog] avfilter/avf_showspectrum: add terrain color map

Paul B Mahol git at videolan.org
Thu Nov 8 19:00:32 EET 2018


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Thu Nov  8 17:57:35 2018 +0100| [70463b702697ef8be4ec4d88969b4fce5b4e7a7e] | committer: Paul B Mahol

avfilter/avf_showspectrum: add terrain color map

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

 doc/filters.texi               |  4 ++++
 libavfilter/avf_showspectrum.c | 11 ++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index b307c15ead..c99a384c29 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -21724,6 +21724,8 @@ each channel is displayed using the viridis color scheme
 each channel is displayed using the plasma color scheme
 @item cividis
 each channel is displayed using the cividis color scheme
+ at item terrain
+each channel is displayed using the terrain color scheme
 @end table
 
 Default value is @samp{channel}.
@@ -21896,6 +21898,8 @@ each channel is displayed using the viridis color scheme
 each channel is displayed using the plasma color scheme
 @item cividis
 each channel is displayed using the cividis color scheme
+ at item terrain
+each channel is displayed using the terrain color scheme
 @end table
 Default value is @samp{intensity}.
 
diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c
index d6221343bc..e8d3f1ec8d 100644
--- a/libavfilter/avf_showspectrum.c
+++ b/libavfilter/avf_showspectrum.c
@@ -46,7 +46,7 @@
 enum DisplayMode  { COMBINED, SEPARATE, NB_MODES };
 enum DataMode     { D_MAGNITUDE, D_PHASE, NB_DMODES };
 enum DisplayScale { LINEAR, SQRT, CBRT, LOG, FOURTHRT, FIFTHRT, NB_SCALES };
-enum ColorMode    { CHANNEL, INTENSITY, RAINBOW, MORELAND, NEBULAE, FIRE, FIERY, FRUIT, COOL, MAGMA, GREEN, VIRIDIS, PLASMA, CIVIDIS, NB_CLMODES };
+enum ColorMode    { CHANNEL, INTENSITY, RAINBOW, MORELAND, NEBULAE, FIRE, FIERY, FRUIT, COOL, MAGMA, GREEN, VIRIDIS, PLASMA, CIVIDIS, TERRAIN, NB_CLMODES };
 enum SlideMode    { REPLACE, SCROLL, FULLFRAME, RSCROLL, NB_SLIDES };
 enum Orientation  { VERTICAL, HORIZONTAL, NB_ORIENTATIONS };
 
@@ -126,6 +126,7 @@ static const AVOption showspectrum_options[] = {
         { "viridis",   "viridis based coloring",          0, AV_OPT_TYPE_CONST, {.i64=VIRIDIS},   0, 0, FLAGS, "color" },
         { "plasma",    "plasma based coloring",           0, AV_OPT_TYPE_CONST, {.i64=PLASMA},    0, 0, FLAGS, "color" },
         { "cividis",   "cividis based coloring",          0, AV_OPT_TYPE_CONST, {.i64=CIVIDIS},   0, 0, FLAGS, "color" },
+        { "terrain",   "terrain based coloring",          0, AV_OPT_TYPE_CONST, {.i64=TERRAIN},   0, 0, FLAGS, "color" },
     { "scale", "set display scale", OFFSET(scale), AV_OPT_TYPE_INT, {.i64=SQRT}, LINEAR, NB_SCALES-1, FLAGS, "scale" },
         { "lin",  "linear",      0, AV_OPT_TYPE_CONST, {.i64=LINEAR}, 0, 0, FLAGS, "scale" },
         { "sqrt", "square root", 0, AV_OPT_TYPE_CONST, {.i64=SQRT},   0, 0, FLAGS, "scale" },
@@ -282,6 +283,12 @@ static const struct ColorTable {
     { 0.76,          0x89/255.,   (0x75 -128)/255.,    (0x84 -128)/255. },
     { 0.90,          0xCE/255.,   (0x35 -128)/255.,    (0x95 -128)/255. },
     {    1,                  1,                  0,                  0. }},
+    [TERRAIN] = {
+    {    0,                  0,                  0,                   0 },
+    { 0.15,                  0,                 .5,                   0 },
+    { 0.60,                  1,                -.5,                 -.5 },
+    { 0.85,                  1,                -.5,                  .5 },
+    {    1,                  1,                  0,                   0 }},
 };
 
 static av_cold void uninit(AVFilterContext *ctx)
@@ -514,6 +521,7 @@ static void color_range(ShowSpectrumContext *s, int ch,
         case VIRIDIS:
         case PLASMA:
         case CIVIDIS:
+        case TERRAIN:
         case MAGMA:
         case INTENSITY:
             *uf = *yf;
@@ -1431,6 +1439,7 @@ static const AVOption showspectrumpic_options[] = {
         { "viridis",   "viridis based coloring",          0, AV_OPT_TYPE_CONST, {.i64=VIRIDIS},   0, 0, FLAGS, "color" },
         { "plasma",    "plasma based coloring",           0, AV_OPT_TYPE_CONST, {.i64=PLASMA},    0, 0, FLAGS, "color" },
         { "cividis",   "cividis based coloring",          0, AV_OPT_TYPE_CONST, {.i64=CIVIDIS},   0, 0, FLAGS, "color" },
+        { "terrain",   "terrain based coloring",          0, AV_OPT_TYPE_CONST, {.i64=TERRAIN},   0, 0, FLAGS, "color" },
     { "scale", "set display scale", OFFSET(scale), AV_OPT_TYPE_INT, {.i64=LOG}, 0, NB_SCALES-1, FLAGS, "scale" },
         { "lin",  "linear",      0, AV_OPT_TYPE_CONST, {.i64=LINEAR}, 0, 0, FLAGS, "scale" },
         { "sqrt", "square root", 0, AV_OPT_TYPE_CONST, {.i64=SQRT},   0, 0, FLAGS, "scale" },



More information about the ffmpeg-cvslog mailing list