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

Paul B Mahol git at videolan.org
Wed Nov 7 20:02:37 EET 2018


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Wed Nov  7 18:56:21 2018 +0100| [0c6d4e7ba4d73f4cbed3bc494268482ae6e5c586] | committer: Paul B Mahol

avfilter/avf_showspectrum: add plasma color map

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

 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 48c14d8401..cc28e71e32 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -21717,6 +21717,8 @@ each channel is displayed using the magma color scheme
 each channel is displayed using the green color scheme
 @item viridis
 each channel is displayed using the viridis color scheme
+ at item plasma
+each channel is displayed using the plasma color scheme
 @end table
 
 Default value is @samp{channel}.
@@ -21885,6 +21887,8 @@ each channel is displayed using the magma color scheme
 each channel is displayed using the green color scheme
 @item viridis
 each channel is displayed using the viridis color scheme
+ at item plasma
+each channel is displayed using the plasma color scheme
 @end table
 Default value is @samp{intensity}.
 
diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c
index 242577a829..fe71e226bb 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, NB_CLMODES };
+enum ColorMode    { CHANNEL, INTENSITY, RAINBOW, MORELAND, NEBULAE, FIRE, FIERY, FRUIT, COOL, MAGMA, GREEN, VIRIDIS, PLASMA, NB_CLMODES };
 enum SlideMode    { REPLACE, SCROLL, FULLFRAME, RSCROLL, NB_SLIDES };
 enum Orientation  { VERTICAL, HORIZONTAL, NB_ORIENTATIONS };
 
@@ -124,6 +124,7 @@ static const AVOption showspectrum_options[] = {
         { "magma",     "magma based coloring",            0, AV_OPT_TYPE_CONST, {.i64=MAGMA},     0, 0, FLAGS, "color" },
         { "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" },
     { "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" },
@@ -264,6 +265,14 @@ static const struct ColorTable {
     { 0.64,          0x8A/255.,   (0x72 -128)/255.,    (0x4F -128)/255. },
     { 0.80,          0xA3/255.,   (0x50 -128)/255.,    (0x66 -128)/255. },
     {    1,          0xCC/255.,   (0x2F -128)/255.,    (0x87 -128)/255. }},
+    [PLASMA] = {
+    {    0,                  0,                  0,                   0 },
+    { 0.10,          0x27/255.,   (0xC2 -128)/255.,    (0x82 -128)/255. },
+    { 0.58,          0x5B/255.,   (0x9A -128)/255.,    (0xAE -128)/255. },
+    { 0.70,          0x89/255.,   (0x44 -128)/255.,    (0xAB -128)/255. },
+    { 0.80,          0xB4/255.,   (0x2B -128)/255.,    (0x9E -128)/255. },
+    { 0.91,          0xD2/255.,   (0x38 -128)/255.,    (0x92 -128)/255. },
+    {    1,                  1,                  0,                  0. }},
 };
 
 static av_cold void uninit(AVFilterContext *ctx)
@@ -494,6 +503,7 @@ static void color_range(ShowSpectrumContext *s, int ch,
         case COOL:
         case GREEN:
         case VIRIDIS:
+        case PLASMA:
         case MAGMA:
         case INTENSITY:
             *uf = *yf;
@@ -1409,6 +1419,7 @@ static const AVOption showspectrumpic_options[] = {
         { "magma",     "magma based coloring",            0, AV_OPT_TYPE_CONST, {.i64=MAGMA},     0, 0, FLAGS, "color" },
         { "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" },
     { "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