| @@ -16519,6 +16519,9 @@ It accepts the following values: | |||||
| @item gauss | @item gauss | ||||
| @item tukey | @item tukey | ||||
| @item dolph | @item dolph | ||||
| @item cauchy | |||||
| @item parzen | |||||
| @item poisson | |||||
| @end table | @end table | ||||
| Default is @code{hanning}. | Default is @code{hanning}. | ||||
| @@ -16667,6 +16670,9 @@ It accepts the following values: | |||||
| @item gauss | @item gauss | ||||
| @item tukey | @item tukey | ||||
| @item dolph | @item dolph | ||||
| @item cauchy | |||||
| @item parzen | |||||
| @item poisson | |||||
| @end table | @end table | ||||
| Default value is @code{hann}. | Default value is @code{hann}. | ||||
| @@ -16811,6 +16817,9 @@ It accepts the following values: | |||||
| @item gauss | @item gauss | ||||
| @item tukey | @item tukey | ||||
| @item dolph | @item dolph | ||||
| @item cauchy | |||||
| @item parzen | |||||
| @item poisson | |||||
| @end table | @end table | ||||
| Default value is @code{hann}. | Default value is @code{hann}. | ||||
| @@ -113,6 +113,9 @@ static const AVOption showfreqs_options[] = { | |||||
| { "gauss", "Gauss", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_GAUSS}, 0, 0, FLAGS, "win_func" }, | { "gauss", "Gauss", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_GAUSS}, 0, 0, FLAGS, "win_func" }, | ||||
| { "tukey", "Tukey", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_TUKEY}, 0, 0, FLAGS, "win_func" }, | { "tukey", "Tukey", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_TUKEY}, 0, 0, FLAGS, "win_func" }, | ||||
| { "dolph", "Dolph-Chebyshev", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_DOLPH}, 0, 0, FLAGS, "win_func" }, | { "dolph", "Dolph-Chebyshev", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_DOLPH}, 0, 0, FLAGS, "win_func" }, | ||||
| { "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" }, | |||||
| { "overlap", "set window overlap", OFFSET(overlap), AV_OPT_TYPE_FLOAT, {.dbl=1.}, 0., 1., FLAGS }, | { "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 }, | { "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 }, | { "colors", "set channels colors", OFFSET(colors), AV_OPT_TYPE_STRING, {.str = "red|green|blue|yellow|orange|lime|pink|magenta|brown" }, 0, 0, FLAGS }, | ||||
| @@ -135,6 +135,9 @@ static const AVOption showspectrum_options[] = { | |||||
| { "gauss", "Gauss", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_GAUSS}, 0, 0, FLAGS, "win_func" }, | { "gauss", "Gauss", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_GAUSS}, 0, 0, FLAGS, "win_func" }, | ||||
| { "tukey", "Tukey", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_TUKEY}, 0, 0, FLAGS, "win_func" }, | { "tukey", "Tukey", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_TUKEY}, 0, 0, FLAGS, "win_func" }, | ||||
| { "dolph", "Dolph-Chebyshev", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_DOLPH}, 0, 0, FLAGS, "win_func" }, | { "dolph", "Dolph-Chebyshev", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_DOLPH}, 0, 0, FLAGS, "win_func" }, | ||||
| { "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" }, | |||||
| { "orientation", "set orientation", OFFSET(orientation), AV_OPT_TYPE_INT, {.i64=VERTICAL}, 0, NB_ORIENTATIONS-1, FLAGS, "orientation" }, | { "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" }, | { "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" }, | { "horizontal", NULL, 0, AV_OPT_TYPE_CONST, {.i64=HORIZONTAL}, 0, 0, FLAGS, "orientation" }, | ||||
| @@ -967,6 +970,9 @@ static const AVOption showspectrumpic_options[] = { | |||||
| { "gauss", "Gauss", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_GAUSS}, 0, 0, FLAGS, "win_func" }, | { "gauss", "Gauss", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_GAUSS}, 0, 0, FLAGS, "win_func" }, | ||||
| { "tukey", "Tukey", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_TUKEY}, 0, 0, FLAGS, "win_func" }, | { "tukey", "Tukey", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_TUKEY}, 0, 0, FLAGS, "win_func" }, | ||||
| { "dolph", "Dolph-Chebyshev", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_DOLPH}, 0, 0, FLAGS, "win_func" }, | { "dolph", "Dolph-Chebyshev", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_DOLPH}, 0, 0, FLAGS, "win_func" }, | ||||
| { "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" }, | |||||
| { "orientation", "set orientation", OFFSET(orientation), AV_OPT_TYPE_INT, {.i64=VERTICAL}, 0, NB_ORIENTATIONS-1, FLAGS, "orientation" }, | { "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" }, | { "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" }, | { "horizontal", NULL, 0, AV_OPT_TYPE_CONST, {.i64=HORIZONTAL}, 0, 0, FLAGS, "orientation" }, | ||||
| @@ -128,6 +128,50 @@ void ff_generate_window_func(float *lut, int N, int win_func, float *overlap) | |||||
| } | } | ||||
| *overlap = 0.5;} | *overlap = 0.5;} | ||||
| break; | break; | ||||
| case WFUNC_CAUCHY: | |||||
| for (n = 0; n < N; n++) { | |||||
| double x = 2 * ((n / (double)(N - 1)) - .5); | |||||
| if (x <= -.5 || x >= .5) { | |||||
| lut[n] = 0; | |||||
| } else { | |||||
| lut[n] = FFMIN(1, fabs(1/(1+4*16*x*x))); | |||||
| } | |||||
| } | |||||
| *overlap = 0.75; | |||||
| break; | |||||
| case WFUNC_PARZEN: | |||||
| for (n = 0; n < N; n++) { | |||||
| double x = 2 * ((n / (double)(N - 1)) - .5); | |||||
| if (x > 0.25 && x <= 0.5) { | |||||
| lut[n] = -2 * powf(-1 + 2 * x, 3); | |||||
| } else if (x >= -.5 && x < -.25) { | |||||
| lut[n] = 2 * powf(1 + 2 * x, 3); | |||||
| } else if (x >= -.25 && x < 0) { | |||||
| lut[n] = 1 - 24 * x * x - 48 * x * x * x; | |||||
| } else if (x >= 0 && x <= .25) { | |||||
| lut[n] = 1 - 24 * x * x + 48 * x * x * x; | |||||
| } else { | |||||
| lut[n] = 0; | |||||
| } | |||||
| } | |||||
| *overlap = 0.75; | |||||
| break; | |||||
| case WFUNC_POISSON: | |||||
| for (n = 0; n < N; n++) { | |||||
| double x = 2 * ((n / (double)(N - 1)) - .5); | |||||
| if (x >= 0 && x <= .5) { | |||||
| lut[n] = exp(-6*x); | |||||
| } else if (x < 0 && x >= -.5) { | |||||
| lut[n] = exp(6*x); | |||||
| } else { | |||||
| lut[n] = 0; | |||||
| } | |||||
| } | |||||
| *overlap = 0.75; | |||||
| break; | |||||
| default: | default: | ||||
| av_assert0(0); | av_assert0(0); | ||||
| } | } | ||||
| @@ -26,7 +26,8 @@ enum WindowFunc { WFUNC_RECT, WFUNC_HANNING, WFUNC_HAMMING, WFUNC_BLACKMAN, | |||||
| WFUNC_BARTLETT, WFUNC_WELCH, WFUNC_FLATTOP, | WFUNC_BARTLETT, WFUNC_WELCH, WFUNC_FLATTOP, | ||||
| WFUNC_BHARRIS, WFUNC_BNUTTALL, WFUNC_SINE, WFUNC_NUTTALL, | WFUNC_BHARRIS, WFUNC_BNUTTALL, WFUNC_SINE, WFUNC_NUTTALL, | ||||
| WFUNC_BHANN, WFUNC_LANCZOS, WFUNC_GAUSS, WFUNC_TUKEY, | WFUNC_BHANN, WFUNC_LANCZOS, WFUNC_GAUSS, WFUNC_TUKEY, | ||||
| WFUNC_DOLPH, NB_WFUNC }; | |||||
| WFUNC_DOLPH, WFUNC_CAUCHY, WFUNC_PARZEN, WFUNC_POISSON, | |||||
| NB_WFUNC }; | |||||
| void ff_generate_window_func(float *lut, int N, int win_func, float *overlap); | void ff_generate_window_func(float *lut, int N, int win_func, float *overlap); | ||||