ffmpeg | branch: master | Paul B Mahol <one...@gmail.com> | Thu Nov  3 13:41:58 
2022 +0100| [4dda3b165337af9b421ca76835acd5712ec108b5] | committer: Paul B Mahol

avfilter/vf_pseudocolor: add spectral preset

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

 doc/filters.texi             |  1 +
 libavfilter/vf_pseudocolor.c | 11 ++++++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index bcd19cf931..006173ba47 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -18886,6 +18886,7 @@ Available LUTs:
 @item nominal
 @item preferred
 @item total
+@item spectral
 @end table
 
 @item opacity
diff --git a/libavfilter/vf_pseudocolor.c b/libavfilter/vf_pseudocolor.c
index cb9c9c84cf..89dc2f0901 100644
--- a/libavfilter/vf_pseudocolor.c
+++ b/libavfilter/vf_pseudocolor.c
@@ -67,6 +67,7 @@ enum Curves {
     TURBO,
     CIVIDIS,
     SOLAR,
+    SPECTRAL,
     NB_CURVES,
 };
 
@@ -85,6 +86,7 @@ enum Presets {
     PRESET_NOMINAL,
     PRESET_PREFERRED,
     PRESET_TOTAL,
+    PRESET_SPECTRAL,
     NB_PRESETS,
 };
 
@@ -174,6 +176,11 @@ static const Curve curves[] =
     },
     .offset = { 0., -9., 9. },
     .fun = { solarfun, solarfun, solarfun }, },
+    [SPECTRAL] = {{
+        { -1.6820e-15,   1.4982e-12,  -5.0442e-10,   8.0490e-08,  -6.1903e-06, 
  1.5821e-04, 6.4359e-03,   6.2887e-01 },
+        {  1.2526e-15,  -1.2203e-12,   4.7013e-10,  -8.9360e-08,   8.3839e-06, 
 -3.6642e-04, 1.4784e-02,  -9.8075e-03 },
+        {  1.4755e-15,  -1.6765e-12,   7.3188e-10,  -1.5522e-07,   1.6406e-05, 
 -7.7883e-04, 1.4502e-02,   2.1597e-01 },
+    }, .fun = { limit, limit, limit }, },
 };
 
 static const Preset presets[] =
@@ -191,7 +198,8 @@ static const Preset presets[] =
     [PRESET_RANGE2]  = { 5, spec2_range, NULL,             spec2_fills },
     [PRESET_SHADOWS] = { 2, shadows_range, NULL,           shadows_fills },
     [PRESET_HIGHLIGHTS] = { 3, highlights_range, NULL,     highlights_fills },
-    [PRESET_SOLAR] = { 1, &full_range, &curves[SOLAR], NULL },
+    [PRESET_SOLAR]   = { 1, &full_range, &curves[SOLAR],   NULL },
+    [PRESET_SPECTRAL]= { 1, &full_range, &curves[SPECTRAL],NULL },
 };
 
 typedef struct PseudoColorContext {
@@ -246,6 +254,7 @@ static const AVOption pseudocolor_options[] = {
     { "nominal",    NULL,                  0,                        
AV_OPT_TYPE_CONST,  {.i64=PRESET_NOMINAL}, .flags=FLAGS, "preset" },
     { "preferred",  NULL,                  0,                        
AV_OPT_TYPE_CONST,  {.i64=PRESET_PREFERRED},.flags=FLAGS,"preset" },
     { "total",      NULL,                  0,                        
AV_OPT_TYPE_CONST,  {.i64=PRESET_TOTAL},   .flags=FLAGS, "preset" },
+    { "spectral",   NULL,                  0,                        
AV_OPT_TYPE_CONST,  {.i64=PRESET_SPECTRAL},.flags = FLAGS, "preset" },
     { "opacity", "set pseudocolor opacity",OFFSET(opacity),          
AV_OPT_TYPE_FLOAT,  {.dbl=1}, 0, 1, .flags = FLAGS },
     { NULL }
 };

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to