From 9b06e7befaa761b7f42108c2d720f78757458c2a Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Fri, 1 Jan 2016 23:22:00 +0100 Subject: [PATCH] avfilter/avf_showspectrum: add fiery color map Signed-off-by: Paul B Mahol --- doc/filters.texi | 4 ++++ libavfilter/avf_showspectrum.c | 14 +++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/doc/filters.texi b/doc/filters.texi index a6fd2a280c..2f80f6e5a9 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -14623,6 +14623,8 @@ each channel is displayed using the moreland color scheme each channel is displayed using the nebulae color scheme @item fire each channel is displayed using the fire color scheme +@item fiery +each channel is displayed using the fiery color scheme @end table Default value is @samp{channel}. @@ -14746,6 +14748,8 @@ each channel is displayed using the moreland color scheme each channel is displayed using the nebulae color scheme @item fire each channel is displayed using the fire color scheme +@item fiery +each channel is displayed using the fiery color scheme @end table Default value is @samp{intensity}. diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c index 961b1406f6..b7ee266220 100644 --- a/libavfilter/avf_showspectrum.c +++ b/libavfilter/avf_showspectrum.c @@ -41,7 +41,7 @@ enum DisplayMode { COMBINED, SEPARATE, NB_MODES }; enum DisplayScale { LINEAR, SQRT, CBRT, LOG, NB_SCALES }; -enum ColorMode { CHANNEL, INTENSITY, RAINBOW, MORELAND, NEBULAE, FIRE, NB_CLMODES }; +enum ColorMode { CHANNEL, INTENSITY, RAINBOW, MORELAND, NEBULAE, FIRE, FIERY, NB_CLMODES }; enum SlideMode { REPLACE, SCROLL, FULLFRAME, RSCROLL, NB_SLIDES }; enum Orientation { VERTICAL, HORIZONTAL, NB_ORIENTATIONS }; @@ -96,6 +96,7 @@ static const AVOption showspectrum_options[] = { { "moreland", "moreland based coloring", 0, AV_OPT_TYPE_CONST, {.i64=MORELAND}, 0, 0, FLAGS, "color" }, { "nebulae", "nebulae based coloring", 0, AV_OPT_TYPE_CONST, {.i64=NEBULAE}, 0, 0, FLAGS, "color" }, { "fire", "fire based coloring", 0, AV_OPT_TYPE_CONST, {.i64=FIRE}, 0, 0, FLAGS, "color" }, + { "fiery", "fiery based coloring", 0, AV_OPT_TYPE_CONST, {.i64=FIERY}, 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" }, @@ -175,6 +176,15 @@ static const struct ColorTable { { 0.77, 126/256., (74-128)/256., (172-128)/256. }, { 0.87, 164/256., (73-128)/256., (162-128)/256. }, { 1, 1, 0, 0 }}, + [FIERY] = { + { 0, 0, 0, 0 }, + { 0.23, 36/256., (116-128)/256., (163-128)/256. }, + { 0.45, 52/256., (102-128)/256., (200-128)/256. }, + { 0.57, 116/256., (84-128)/256., (196-128)/256. }, + { 0.67, 157/256., (67-128)/256., (181-128)/256. }, + { 0.77, 193/256., (40-128)/256., (155-128)/256. }, + { 0.87, 221/256., (101-128)/256., (134-128)/256. }, + { 1, 1, 0, 0 }}, }; static av_cold void uninit(AVFilterContext *ctx) @@ -456,6 +466,7 @@ static int plot_spectrum_column(AVFilterLink *inlink, AVFrame *insamples) case MORELAND: case NEBULAE: case FIRE: + case FIERY: case INTENSITY: uf = yf; vf = yf; @@ -753,6 +764,7 @@ static const AVOption showspectrumpic_options[] = { { "moreland", "moreland based coloring", 0, AV_OPT_TYPE_CONST, {.i64=MORELAND}, 0, 0, FLAGS, "color" }, { "nebulae", "nebulae based coloring", 0, AV_OPT_TYPE_CONST, {.i64=NEBULAE}, 0, 0, FLAGS, "color" }, { "fire", "fire based coloring", 0, AV_OPT_TYPE_CONST, {.i64=FIRE}, 0, 0, FLAGS, "color" }, + { "fiery", "fiery based coloring", 0, AV_OPT_TYPE_CONST, {.i64=FIERY}, 0, 0, FLAGS, "color" }, { "scale", "set display scale", OFFSET(scale), AV_OPT_TYPE_INT, {.i64=LOG}, 0, 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" },