mirror of https://git.ffmpeg.org/ffmpeg.git
avfilter/window_func: add bohman window
This commit is contained in:
parent
59a35fe1f6
commit
40ac622460
|
@ -20851,6 +20851,7 @@ It accepts the following values:
|
|||
@item cauchy
|
||||
@item parzen
|
||||
@item poisson
|
||||
@item bohman
|
||||
@end table
|
||||
Default is @code{hanning}.
|
||||
|
||||
|
@ -21009,6 +21010,7 @@ It accepts the following values:
|
|||
@item cauchy
|
||||
@item parzen
|
||||
@item poisson
|
||||
@item bohman
|
||||
@end table
|
||||
|
||||
Default value is @code{hann}.
|
||||
|
@ -21172,6 +21174,7 @@ It accepts the following values:
|
|||
@item cauchy
|
||||
@item parzen
|
||||
@item poisson
|
||||
@item bohman
|
||||
@end table
|
||||
Default value is @code{hann}.
|
||||
|
||||
|
|
|
@ -67,6 +67,7 @@ static const AVOption hilbert_options[] = {
|
|||
{ "cauchy", "Cauchy", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_CAUCHY}, 0, 0, FLAGS, "win_func" },
|
||||
{ "parzen", "Parzen", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_PARZEN}, 0, 0, FLAGS, "win_func" },
|
||||
{ "poisson", "Poisson", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_POISSON}, 0, 0, FLAGS, "win_func" },
|
||||
{ "bohman" , "Bohman", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_BOHMAN}, 0, 0, FLAGS, "win_func" },
|
||||
{NULL}
|
||||
};
|
||||
|
||||
|
|
|
@ -118,6 +118,7 @@ static const AVOption showfreqs_options[] = {
|
|||
{ "cauchy", "Cauchy", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_CAUCHY}, 0, 0, FLAGS, "win_func" },
|
||||
{ "parzen", "Parzen", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_PARZEN}, 0, 0, FLAGS, "win_func" },
|
||||
{ "poisson", "Poisson", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_POISSON}, 0, 0, FLAGS, "win_func" },
|
||||
{ "bohman", "Bohman", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_BOHMAN} , 0, 0, FLAGS, "win_func" },
|
||||
{ "overlap", "set window overlap", OFFSET(overlap), AV_OPT_TYPE_FLOAT, {.dbl=1.}, 0., 1., FLAGS },
|
||||
{ "averaging", "set time averaging", OFFSET(avg), AV_OPT_TYPE_INT, {.i64=1}, 0, INT32_MAX, FLAGS },
|
||||
{ "colors", "set channels colors", OFFSET(colors), AV_OPT_TYPE_STRING, {.str = "red|green|blue|yellow|orange|lime|pink|magenta|brown" }, 0, 0, FLAGS },
|
||||
|
|
|
@ -152,6 +152,7 @@ static const AVOption showspectrum_options[] = {
|
|||
{ "cauchy", "Cauchy", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_CAUCHY}, 0, 0, FLAGS, "win_func" },
|
||||
{ "parzen", "Parzen", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_PARZEN}, 0, 0, FLAGS, "win_func" },
|
||||
{ "poisson", "Poisson", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_POISSON}, 0, 0, FLAGS, "win_func" },
|
||||
{ "bohman", "Bohman", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_BOHMAN}, 0, 0, FLAGS, "win_func" },
|
||||
{ "orientation", "set orientation", OFFSET(orientation), AV_OPT_TYPE_INT, {.i64=VERTICAL}, 0, NB_ORIENTATIONS-1, FLAGS, "orientation" },
|
||||
{ "vertical", NULL, 0, AV_OPT_TYPE_CONST, {.i64=VERTICAL}, 0, 0, FLAGS, "orientation" },
|
||||
{ "horizontal", NULL, 0, AV_OPT_TYPE_CONST, {.i64=HORIZONTAL}, 0, 0, FLAGS, "orientation" },
|
||||
|
@ -1425,6 +1426,7 @@ static const AVOption showspectrumpic_options[] = {
|
|||
{ "cauchy", "Cauchy", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_CAUCHY}, 0, 0, FLAGS, "win_func" },
|
||||
{ "parzen", "Parzen", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_PARZEN}, 0, 0, FLAGS, "win_func" },
|
||||
{ "poisson", "Poisson", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_POISSON}, 0, 0, FLAGS, "win_func" },
|
||||
{ "bohman", "Bohman", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_BOHMAN}, 0, 0, FLAGS, "win_func" },
|
||||
{ "orientation", "set orientation", OFFSET(orientation), AV_OPT_TYPE_INT, {.i64=VERTICAL}, 0, NB_ORIENTATIONS-1, FLAGS, "orientation" },
|
||||
{ "vertical", NULL, 0, AV_OPT_TYPE_CONST, {.i64=VERTICAL}, 0, 0, FLAGS, "orientation" },
|
||||
{ "horizontal", NULL, 0, AV_OPT_TYPE_CONST, {.i64=HORIZONTAL}, 0, 0, FLAGS, "orientation" },
|
||||
|
|
|
@ -30,6 +30,7 @@ enum WindowFunc { WFUNC_RECT, WFUNC_HANNING, WFUNC_HAMMING, WFUNC_BLACKMAN,
|
|||
WFUNC_BHARRIS, WFUNC_BNUTTALL, WFUNC_SINE, WFUNC_NUTTALL,
|
||||
WFUNC_BHANN, WFUNC_LANCZOS, WFUNC_GAUSS, WFUNC_TUKEY,
|
||||
WFUNC_DOLPH, WFUNC_CAUCHY, WFUNC_PARZEN, WFUNC_POISSON,
|
||||
WFUNC_BOHMAN,
|
||||
NB_WFUNC };
|
||||
|
||||
static inline void generate_window_func(float *lut, int N, int win_func,
|
||||
|
@ -182,6 +183,14 @@ static inline void generate_window_func(float *lut, int N, int win_func,
|
|||
}
|
||||
*overlap = 0.75;
|
||||
break;
|
||||
case WFUNC_BOHMAN:
|
||||
for (n = 0; n < N; n++) {
|
||||
double x = 2 * ((n / (double)(N - 1))) - 1.;
|
||||
|
||||
lut[n] = (1 - fabs(x)) * cos(M_PI*fabs(x)) + 1./M_PI*sin(M_PI*fabs(x));
|
||||
}
|
||||
*overlap = 0.75;
|
||||
break;
|
||||
default:
|
||||
av_assert0(0);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue