gst_plugins_base/gst-libs/gst/fft/gstfft.c
changeset 0 0e761a78d257
child 8 4a7fac7dd34a
equal deleted inserted replaced
-1:000000000000 0:0e761a78d257
       
     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., 59 Temple Place - Suite 330,
       
    17  * Boston, MA 02111-1307, USA.
       
    18  */
       
    19 
       
    20 /**
       
    21  * SECTION:gstfft
       
    22  * @short_description: General FFT functions and declarations
       
    23  * 
       
    24  * This library includes general definitions and functions, useful for
       
    25  * all typed FFT classes.
       
    26  *
       
    27  */
       
    28 
       
    29 #include <glib.h>
       
    30 
       
    31 #include "gstfft.h"
       
    32 #include "kiss_fft_s16.h"
       
    33 
       
    34 /**
       
    35  * gst_fft_next_fast_length:
       
    36  * @n: Number for which the next fast length should be returned
       
    37  *
       
    38  * Returns the next number to @n that is entirely a product
       
    39  * of 2, 3 and 5. Using this as the @len parameter for
       
    40  * the different GstFFT types will provide the best performance.
       
    41  *
       
    42  * Returns: the next fast FFT length.
       
    43  *
       
    44  */
       
    45 #ifdef __SYMBIAN32__
       
    46 EXPORT_C
       
    47 #endif
       
    48 
       
    49 gint
       
    50 gst_fft_next_fast_length (gint n)
       
    51 {
       
    52   gint half = (n + 1) / 2;
       
    53 
       
    54   /* It's the same for all data types so call the s16
       
    55    * version */
       
    56 
       
    57   /* The real FFT needs an even length so calculate that */
       
    58   return 2 * kiss_fft_s16_next_fast_size (half);
       
    59 }