[FFmpeg-cvslog] avfilter/avf_showspectrum: add cividis colormap

Paul B Mahol git at videolan.org
Thu Nov 8 16:21:48 EET 2018


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Thu Nov  8 15:08:43 2018 +0100| [09fdfc11b79694cac97ceded9adeda485f701569] | committer: Paul B Mahol

avfilter/avf_showspectrum: add cividis colormap

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

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

diff --git a/doc/filters.texi b/doc/filters.texi
index d055342866..b307c15ead 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -21722,6 +21722,8 @@ each channel is displayed using the green color scheme
 each channel is displayed using the viridis color scheme
 @item plasma
 each channel is displayed using the plasma color scheme
+ at item cividis
+each channel is displayed using the cividis color scheme
 @end table
 
 Default value is @samp{channel}.
@@ -21892,6 +21894,8 @@ each channel is displayed using the green color scheme
 each channel is displayed using the viridis color scheme
 @item plasma
 each channel is displayed using the plasma color scheme
+ at item cividis
+each channel is displayed using the cividis color scheme
 @end table
 Default value is @samp{intensity}.
 
diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c
index fe71e226bb..d6221343bc 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, NB_CLMODES };
+enum ColorMode    { CHANNEL, INTENSITY, RAINBOW, MORELAND, NEBULAE, FIRE, FIERY, FRUIT, COOL, MAGMA, GREEN, VIRIDIS, PLASMA, CIVIDIS, NB_CLMODES };
 enum SlideMode    { REPLACE, SCROLL, FULLFRAME, RSCROLL, NB_SLIDES };
 enum Orientation  { VERTICAL, HORIZONTAL, NB_ORIENTATIONS };
 
@@ -125,6 +125,7 @@ static const AVOption showspectrum_options[] = {
         { "green",     "green based coloring",            0, AV_OPT_TYPE_CONST, {.i64=GREEN},     0, 0, FLAGS, "color" },
         { "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" },
     { "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" },
@@ -273,6 +274,14 @@ static const struct ColorTable {
     { 0.80,          0xB4/255.,   (0x2B -128)/255.,    (0x9E -128)/255. },
     { 0.91,          0xD2/255.,   (0x38 -128)/255.,    (0x92 -128)/255. },
     {    1,                  1,                  0,                  0. }},
+    [CIVIDIS] = {
+    {    0,                  0,                  0,                   0 },
+    { 0.20,          0x28/255.,   (0x98 -128)/255.,    (0x6F -128)/255. },
+    { 0.50,          0x48/255.,   (0x95 -128)/255.,    (0x74 -128)/255. },
+    { 0.63,          0x69/255.,   (0x84 -128)/255.,    (0x7F -128)/255. },
+    { 0.76,          0x89/255.,   (0x75 -128)/255.,    (0x84 -128)/255. },
+    { 0.90,          0xCE/255.,   (0x35 -128)/255.,    (0x95 -128)/255. },
+    {    1,                  1,                  0,                  0. }},
 };
 
 static av_cold void uninit(AVFilterContext *ctx)
@@ -504,6 +513,7 @@ static void color_range(ShowSpectrumContext *s, int ch,
         case GREEN:
         case VIRIDIS:
         case PLASMA:
+        case CIVIDIS:
         case MAGMA:
         case INTENSITY:
             *uf = *yf;
@@ -1420,6 +1430,7 @@ static const AVOption showspectrumpic_options[] = {
         { "green",     "green based coloring",            0, AV_OPT_TYPE_CONST, {.i64=GREEN},     0, 0, FLAGS, "color" },
         { "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" },
     { "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