avfilter/showspectrum: add blackman window.

pull/47/merge
Clément Bœsch 11 years ago
parent 3e69f7c221
commit 9c8b240806
  1. 2
      doc/filters.texi
  2. 8
      libavfilter/avf_showspectrum.c

@ -9782,6 +9782,8 @@ No samples pre-processing (do not expect this to be faster)
Hann window
@item hamming
Hamming window
@item blackman
Blackman window
@end table
Default value is @code{hann}.

@ -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);
}

Loading…
Cancel
Save