[FFmpeg-cvslog] avfilter/showspectrum: add blackman window.

Clément Bœsch git at videolan.org
Wed Nov 20 16:38:45 CET 2013


ffmpeg | branch: master | Clément Bœsch <clement at stupeflix.com> | Wed Nov 20 16:35:48 2013 +0100| [9c8b24080638da34e7261b742168855ce85c277f] | committer: Clément Bœsch

avfilter/showspectrum: add blackman window.

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

 doc/filters.texi               |    2 ++
 libavfilter/avf_showspectrum.c |    8 +++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 59d5dd5..a3a7636 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -9782,6 +9782,8 @@ No samples pre-processing (do not expect this to be faster)
 Hann window
 @item hamming
 Hamming window
+ at item blackman
+Blackman window
 @end table
 
 Default value is @code{hann}.
diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c
index d332440..e0ea47a 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, NB_CLMODES };
-enum WindowFunc   { WFUNC_NONE, WFUNC_HANN, WFUNC_HAMMING, NB_WFUNC };
+enum WindowFunc   { WFUNC_NONE, WFUNC_HANN, WFUNC_HAMMING, WFUNC_BLACKMAN, NB_WFUNC };
 
 typedef struct {
     const AVClass *class;
@@ -84,6 +84,7 @@ static const AVOption showspectrum_options[] = {
     { "win_func", "set window function", OFFSET(win_func), AV_OPT_TYPE_INT, {.i64 = WFUNC_HANN}, 0, NB_WFUNC-1, FLAGS, "win_func" },
         { "hann",    "Hann window",    0, AV_OPT_TYPE_CONST, {.i64 = WFUNC_HANN},    INT_MIN, INT_MAX, FLAGS, "win_func" },
         { "hamming", "Hamming window", 0, AV_OPT_TYPE_CONST, {.i64 = WFUNC_HAMMING}, INT_MIN, INT_MAX, FLAGS, "win_func" },
+        { "blackman", "Blackman window", 0, AV_OPT_TYPE_CONST, {.i64 = WFUNC_BLACKMAN}, INT_MIN, INT_MAX, FLAGS, "win_func" },
     { NULL }
 };
 
@@ -219,6 +220,11 @@ static int config_output(AVFilterLink *outlink)
             for (i = 0; i < win_size; i++)
                 s->window_func_lut[i] = .54f - .46f * cos(2*M_PI*i / (win_size-1));
             break;
+        case WFUNC_BLACKMAN: {
+            for (i = 0; i < win_size; i++)
+                s->window_func_lut[i] = .42f - .5f*cos(2*M_PI*i / (win_size-1)) + .08f*cos(4*M_PI*i / (win_size-1));
+            break;
+        }
         default:
             av_assert0(0);
         }



More information about the ffmpeg-cvslog mailing list