diff options
author | Paul B Mahol <onemda@gmail.com> | 2016-01-05 13:37:11 +0300 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2016-01-05 13:37:11 +0300 |
commit | c13216ac0801ea9af373728aca7c6eda61593a4a (patch) | |
tree | 68f4f90f9025e01e9202fe76ab59c5b6735a52fb /libavfilter/window_func.c | |
parent | c31fa1d7b44c55d8491b7e6ebe8615289aadec69 (diff) |
avfilter/window_func: add tukey window function
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavfilter/window_func.c')
-rw-r--r-- | libavfilter/window_func.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libavfilter/window_func.c b/libavfilter/window_func.c index 15600beebb..9c6202aa18 100644 --- a/libavfilter/window_func.c +++ b/libavfilter/window_func.c @@ -104,6 +104,18 @@ void ff_generate_window_func(float *lut, int N, int win_func, float *overlap) lut[n] = exp(-0.5 * SQR((n-(N-1)/2)/(0.4*(N-1)/2.f))); *overlap = 0.75; break; + case WFUNC_TUKEY: + for (n = 0; n < N; n++) { + float M = (N-1)/2.; + + if (FFABS(n - M) >= 0.3 * M) { + lut[n] = 0.5 * (1 + cos((M_PI*(FFABS(n - M) - 0.3 * M))/((1 - 0.3) * M))); + } else { + lut[n] = 1; + } + } + *overlap = 0.33; + break; default: av_assert0(0); } |