aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter
diff options
context:
space:
mode:
authorClément Bœsch <clement@stupeflix.com>2013-11-20 16:35:48 +0100
committerClément Bœsch <clement@stupeflix.com>2013-11-20 16:35:48 +0100
commit9c8b24080638da34e7261b742168855ce85c277f (patch)
treef80b6bf431602ad116b1c3ab9b4c9e94ad6b9767 /libavfilter
parent3e69f7c22106c45485becf3341c4ea3c67d02acc (diff)
downloadffmpeg-9c8b24080638da34e7261b742168855ce85c277f.tar.gz
avfilter/showspectrum: add blackman window.
Diffstat (limited to 'libavfilter')
-rw-r--r--libavfilter/avf_showspectrum.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c
index d3324403e3..e0ea47ac32 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);
}