1 /* GStreamer
2 * Copyright (C) <2007> Sebastian Dröge <slomo@circular-chaos.org>
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20 /**
21 * SECTION:gstfft
22 * @title: GstFFT
23 * @short_description: General FFT functions and declarations
24 *
25 * This library includes general definitions and functions, useful for
26 * all typed FFT classes.
27 */
28 #ifdef HAVE_CONFIG_H
29 #include "config.h"
30 #endif
31
32 #include <glib.h>
33
34 #include "gstfft.h"
35 #include "kiss_fft_s16.h"
36
37 /**
38 * gst_fft_next_fast_length:
39 * @n: Number for which the next fast length should be returned
40 *
41 * Returns the next number to @n that is entirely a product
42 * of 2, 3 and 5. Using this as the @len parameter for
43 * the different GstFFT types will provide the best performance.
44 *
45 * Returns: the next fast FFT length.
46 *
47 */
48 gint
gst_fft_next_fast_length(gint n)49 gst_fft_next_fast_length (gint n)
50 {
51 gint half = (n + 1) / 2;
52
53 /* It's the same for all data types so call the s16
54 * version */
55
56 /* The real FFT needs an even length so calculate that */
57 return 2 * kiss_fft_s16_next_fast_size (half);
58 }
59