diff options
author | Paul B Mahol <onemda@gmail.com> | 2015-12-30 18:35:17 +0100 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2015-12-30 18:53:24 +0100 |
commit | 2893dbfe2c316904de8a445c43f0e3089224e584 (patch) | |
tree | 0c545fefecad577cc16296dc9a6d619c92e1c2c6 /libavfilter/avf_showspectrum.c | |
parent | 05434b0eea3f959b8b44be97c56bad6ab6a0dc22 (diff) | |
download | ffmpeg-2893dbfe2c316904de8a445c43f0e3089224e584.tar.gz |
avfilter/avf_showspectrum: add moreland color map
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavfilter/avf_showspectrum.c')
-rw-r--r-- | libavfilter/avf_showspectrum.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c index 1eec55c9d6..fbb0f78dec 100644 --- a/libavfilter/avf_showspectrum.c +++ b/libavfilter/avf_showspectrum.c @@ -37,7 +37,7 @@ enum DisplayMode { COMBINED, SEPARATE, NB_MODES }; enum DisplayScale { LINEAR, SQRT, CBRT, LOG, NB_SCALES }; -enum ColorMode { CHANNEL, INTENSITY, RAINBOW, NB_CLMODES }; +enum ColorMode { CHANNEL, INTENSITY, RAINBOW, MORELAND, NB_CLMODES }; enum SlideMode { REPLACE, SCROLL, FULLFRAME, RSCROLL, NB_SLIDES }; enum Orientation { VERTICAL, HORIZONTAL, NB_ORIENTATIONS }; @@ -82,7 +82,8 @@ static const AVOption showspectrum_options[] = { { "color", "set channel coloring", OFFSET(color_mode), AV_OPT_TYPE_INT, {.i64=CHANNEL}, CHANNEL, NB_CLMODES-1, FLAGS, "color" }, { "channel", "separate color for each channel", 0, AV_OPT_TYPE_CONST, {.i64=CHANNEL}, 0, 0, FLAGS, "color" }, { "intensity", "intensity based coloring", 0, AV_OPT_TYPE_CONST, {.i64=INTENSITY}, 0, 0, FLAGS, "color" }, - { "rainbow", "rainbow based coloring", 0, AV_OPT_TYPE_CONST, {.i64=RAINBOW}, 0, 0, FLAGS, "color" }, + { "rainbow", "rainbow based coloring", 0, AV_OPT_TYPE_CONST, {.i64=RAINBOW}, 0, 0, FLAGS, "color" }, + { "moreland", "moreland based coloring", 0, AV_OPT_TYPE_CONST, {.i64=MORELAND}, 0, 0, FLAGS, "color" }, { "scale", "set display scale", OFFSET(scale), AV_OPT_TYPE_INT, {.i64=SQRT}, LINEAR, NB_SCALES-1, FLAGS, "scale" }, { "sqrt", "square root", 0, AV_OPT_TYPE_CONST, {.i64=SQRT}, 0, 0, FLAGS, "scale" }, { "cbrt", "cubic root", 0, AV_OPT_TYPE_CONST, {.i64=CBRT}, 0, 0, FLAGS, "scale" }, @@ -134,6 +135,15 @@ static const struct ColorTable { { 0.73, 205/256., (19-128)/256., (149-128)/256. }, { 0.86, 135/256., (83-128)/256., (200-128)/256. }, { 1, 73/256., (95-128)/256., (225-128)/256. }}, + [MORELAND] = { + { 0, 44/256., (181-128)/256., (112-128)/256. }, + { 0.13, 126/256., (177-128)/256., (106-128)/256. }, + { 0.25, 164/256., (163-128)/256., (109-128)/256. }, + { 0.38, 200/256., (140-128)/256., (120-128)/256. }, + { 0.60, 201/256., (117-128)/256., (141-128)/256. }, + { 0.73, 177/256., (103-128)/256., (165-128)/256. }, + { 0.86, 136/256., (100-128)/256., (183-128)/256. }, + { 1, 68/256., (117-128)/256., (203-128)/256. }}, }; static av_cold void uninit(AVFilterContext *ctx) @@ -381,6 +391,7 @@ static int plot_spectrum_column(AVFilterLink *inlink, AVFrame *insamples) yf = 256.0f / s->nb_display_channels; switch (s->color_mode) { case RAINBOW: + case MORELAND: case INTENSITY: uf = yf; vf = yf; @@ -442,8 +453,7 @@ static int plot_spectrum_column(AVFilterLink *inlink, AVFrame *insamples) av_assert0(0); } - if (s->color_mode == INTENSITY || - s->color_mode == RAINBOW) { + if (s->color_mode > CHANNEL) { const int cm = s->color_mode; float y, u, v; int i; |