Commit ed58db42 authored by Paul B Mahol's avatar Paul B Mahol

avfilter/avf_showspectrum: add viridis color map

parent 97551075
...@@ -21715,6 +21715,8 @@ each channel is displayed using the cool color scheme ...@@ -21715,6 +21715,8 @@ each channel is displayed using the cool color scheme
each channel is displayed using the magma color scheme each channel is displayed using the magma color scheme
@item green @item green
each channel is displayed using the green color scheme each channel is displayed using the green color scheme
@item viridis
each channel is displayed using the viridis color scheme
@end table @end table
Default value is @samp{channel}. Default value is @samp{channel}.
...@@ -21881,6 +21883,8 @@ each channel is displayed using the cool color scheme ...@@ -21881,6 +21883,8 @@ each channel is displayed using the cool color scheme
each channel is displayed using the magma color scheme each channel is displayed using the magma color scheme
@item green @item green
each channel is displayed using the green color scheme each channel is displayed using the green color scheme
@item viridis
each channel is displayed using the viridis color scheme
@end table @end table
Default value is @samp{intensity}. Default value is @samp{intensity}.
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
enum DisplayMode { COMBINED, SEPARATE, NB_MODES }; enum DisplayMode { COMBINED, SEPARATE, NB_MODES };
enum DataMode { D_MAGNITUDE, D_PHASE, NB_DMODES }; enum DataMode { D_MAGNITUDE, D_PHASE, NB_DMODES };
enum DisplayScale { LINEAR, SQRT, CBRT, LOG, FOURTHRT, FIFTHRT, NB_SCALES }; enum DisplayScale { LINEAR, SQRT, CBRT, LOG, FOURTHRT, FIFTHRT, NB_SCALES };
enum ColorMode { CHANNEL, INTENSITY, RAINBOW, MORELAND, NEBULAE, FIRE, FIERY, FRUIT, COOL, MAGMA, GREEN, NB_CLMODES }; enum ColorMode { CHANNEL, INTENSITY, RAINBOW, MORELAND, NEBULAE, FIRE, FIERY, FRUIT, COOL, MAGMA, GREEN, VIRIDIS, NB_CLMODES };
enum SlideMode { REPLACE, SCROLL, FULLFRAME, RSCROLL, NB_SLIDES }; enum SlideMode { REPLACE, SCROLL, FULLFRAME, RSCROLL, NB_SLIDES };
enum Orientation { VERTICAL, HORIZONTAL, NB_ORIENTATIONS }; enum Orientation { VERTICAL, HORIZONTAL, NB_ORIENTATIONS };
...@@ -123,6 +123,7 @@ static const AVOption showspectrum_options[] = { ...@@ -123,6 +123,7 @@ static const AVOption showspectrum_options[] = {
{ "cool", "cool based coloring", 0, AV_OPT_TYPE_CONST, {.i64=COOL}, 0, 0, FLAGS, "color" }, { "cool", "cool based coloring", 0, AV_OPT_TYPE_CONST, {.i64=COOL}, 0, 0, FLAGS, "color" },
{ "magma", "magma based coloring", 0, AV_OPT_TYPE_CONST, {.i64=MAGMA}, 0, 0, FLAGS, "color" }, { "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" }, { "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" },
{ "scale", "set display scale", OFFSET(scale), AV_OPT_TYPE_INT, {.i64=SQRT}, LINEAR, NB_SCALES-1, FLAGS, "scale" }, { "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" }, { "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" }, { "sqrt", "square root", 0, AV_OPT_TYPE_CONST, {.i64=SQRT}, 0, 0, FLAGS, "scale" },
...@@ -254,6 +255,15 @@ static const struct ColorTable { ...@@ -254,6 +255,15 @@ static const struct ColorTable {
{ 0, 0, 0, 0 }, { 0, 0, 0, 0 },
{ .75, .5, 0, -.5 }, { .75, .5, 0, -.5 },
{ 1, 1, 0, 0 }}, { 1, 1, 0, 0 }},
[VIRIDIS] = {
{ 0, 0, 0, 0 },
{ 0.10, 0x39/255., (0x9D -128)/255., (0x8F -128)/255. },
{ 0.23, 0x5C/255., (0x9A -128)/255., (0x68 -128)/255. },
{ 0.35, 0x69/255., (0x93 -128)/255., (0x57 -128)/255. },
{ 0.48, 0x76/255., (0x88 -128)/255., (0x4B -128)/255. },
{ 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. }},
}; };
static av_cold void uninit(AVFilterContext *ctx) static av_cold void uninit(AVFilterContext *ctx)
...@@ -483,6 +493,7 @@ static void color_range(ShowSpectrumContext *s, int ch, ...@@ -483,6 +493,7 @@ static void color_range(ShowSpectrumContext *s, int ch,
case FRUIT: case FRUIT:
case COOL: case COOL:
case GREEN: case GREEN:
case VIRIDIS:
case MAGMA: case MAGMA:
case INTENSITY: case INTENSITY:
*uf = *yf; *uf = *yf;
...@@ -1397,6 +1408,7 @@ static const AVOption showspectrumpic_options[] = { ...@@ -1397,6 +1408,7 @@ static const AVOption showspectrumpic_options[] = {
{ "cool", "cool based coloring", 0, AV_OPT_TYPE_CONST, {.i64=COOL}, 0, 0, FLAGS, "color" }, { "cool", "cool based coloring", 0, AV_OPT_TYPE_CONST, {.i64=COOL}, 0, 0, FLAGS, "color" },
{ "magma", "magma based coloring", 0, AV_OPT_TYPE_CONST, {.i64=MAGMA}, 0, 0, FLAGS, "color" }, { "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" }, { "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" },
{ "scale", "set display scale", OFFSET(scale), AV_OPT_TYPE_INT, {.i64=LOG}, 0, NB_SCALES-1, FLAGS, "scale" }, { "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" }, { "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" }, { "sqrt", "square root", 0, AV_OPT_TYPE_CONST, {.i64=SQRT}, 0, 0, FLAGS, "scale" },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment