[FFmpeg-cvslog] avfilter/avf_showcwt: add qdrt frequency scale

Paul B Mahol git at videolan.org
Sun Jul 9 21:47:46 EEST 2023


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sun Jul  9 20:50:04 2023 +0200| [fcbee7efdfb55a25d573669114b5a968a72deb9f] | committer: Paul B Mahol

avfilter/avf_showcwt: add qdrt frequency scale

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

 doc/filters.texi          |  1 +
 libavfilter/avf_showcwt.c | 10 ++++++++++
 2 files changed, 11 insertions(+)

diff --git a/doc/filters.texi b/doc/filters.texi
index 1a07e03bad..a8e0dbde15 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -30711,6 +30711,7 @@ Set the frequency scale used. Allowed values are:
 @item erbs
 @item sqrt
 @item cbrt
+ at item qdrt
 @end table
 Default value is @code{linear}.
 
diff --git a/libavfilter/avf_showcwt.c b/libavfilter/avf_showcwt.c
index b989beab11..ff2c06fb7a 100644
--- a/libavfilter/avf_showcwt.c
+++ b/libavfilter/avf_showcwt.c
@@ -42,6 +42,7 @@ enum FrequencyScale {
     FSCALE_ERBS,
     FSCALE_SQRT,
     FSCALE_CBRT,
+    FSCALE_QDRT,
     NB_FSCALE
 };
 
@@ -131,6 +132,7 @@ static const AVOption showcwt_options[] = {
     {  "erbs",    "erbs",             0,                       AV_OPT_TYPE_CONST,{.i64=FSCALE_ERBS},   0, 0, FLAGS, "scale" },
     {  "sqrt",    "sqrt",             0,                       AV_OPT_TYPE_CONST,{.i64=FSCALE_SQRT},   0, 0, FLAGS, "scale" },
     {  "cbrt",    "cbrt",             0,                       AV_OPT_TYPE_CONST,{.i64=FSCALE_CBRT},   0, 0, FLAGS, "scale" },
+    {  "qdrt",    "qdrt",             0,                       AV_OPT_TYPE_CONST,{.i64=FSCALE_QDRT},   0, 0, FLAGS, "scale" },
     { "min",  "set minimum frequency", OFFSET(minimum_frequency), AV_OPT_TYPE_FLOAT, {.dbl = 20.}, 1, 2000, FLAGS },
     { "max",  "set maximum frequency", OFFSET(maximum_frequency), AV_OPT_TYPE_FLOAT, {.dbl = 20000.}, 0, 192000, FLAGS },
     { "logb", "set logarithmic basis", OFFSET(logarithmic_basis), AV_OPT_TYPE_FLOAT, {.dbl = 0.0001}, 0, 1, FLAGS },
@@ -253,6 +255,10 @@ static void frequency_band(float *frequency_band,
             frequency = frequency * frequency * frequency;
             frequency_derivative *= 3.f * powf(frequency, 2.f / 3.f);
             break;
+        case FSCALE_QDRT:
+            frequency = frequency * frequency * frequency * frequency;
+            frequency_derivative *= 4.f * powf(frequency, 3.f / 4.f);
+            break;
         }
 
         frequency_band[y*2  ] = frequency;
@@ -700,6 +706,10 @@ static int config_output(AVFilterLink *outlink)
         minimum_frequency = cbrtf(minimum_frequency);
         maximum_frequency = cbrtf(maximum_frequency);
         break;
+    case FSCALE_QDRT:
+        minimum_frequency = powf(minimum_frequency, 0.25f);
+        maximum_frequency = powf(maximum_frequency, 0.25f);
+        break;
     }
 
     frequency_band(s->frequency_band,



More information about the ffmpeg-cvslog mailing list