Browse code

avfilter/firequalizer: add tukey window

Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>

Muhammad Faiz authored on 2016/10/16 07:50:47
Showing 1 changed files
... ...
@@ -39,6 +39,7 @@ enum WindowFunc {
39 39
     WFUNC_NUTTALL,
40 40
     WFUNC_BNUTTALL,
41 41
     WFUNC_BHARRIS,
42
+    WFUNC_TUKEY,
42 43
     NB_WFUNC
43 44
 };
44 45
 
... ...
@@ -107,6 +108,7 @@ static const AVOption firequalizer_options[] = {
107 107
         { "nuttall", "nuttall window", 0, AV_OPT_TYPE_CONST, { .i64 = WFUNC_NUTTALL }, 0, 0, FLAGS, "wfunc" },
108 108
         { "bnuttall", "blackman-nuttall window", 0, AV_OPT_TYPE_CONST, { .i64 = WFUNC_BNUTTALL }, 0, 0, FLAGS, "wfunc" },
109 109
         { "bharris", "blackman-harris window", 0, AV_OPT_TYPE_CONST, { .i64 = WFUNC_BHARRIS }, 0, 0, FLAGS, "wfunc" },
110
+        { "tukey", "tukey window", 0, AV_OPT_TYPE_CONST, { .i64 = WFUNC_TUKEY }, 0, 0, FLAGS, "wfunc" },
110 111
     { "fixed", "set fixed frame samples", OFFSET(fixed), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS },
111 112
     { "multi", "set multi channels mode", OFFSET(multi), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS },
112 113
     { "zero_phase", "set zero phase mode", OFFSET(zero_phase), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS },
... ...
@@ -385,6 +387,9 @@ static int generate_kernel(AVFilterContext *ctx, const char *gain, const char *g
385 385
             case WFUNC_BHARRIS:
386 386
                 win = 0.35875 + 0.48829 * cos(u) + 0.14128 * cos(2*u) + 0.01168 * cos(3*u);
387 387
                 break;
388
+            case WFUNC_TUKEY:
389
+                win = (u <= 0.5 * M_PI) ? 1.0 : (0.5 + 0.5 * cos(2*u - M_PI));
390
+                break;
388 391
             default:
389 392
                 av_assert0(0);
390 393
             }