Blame gst-libs/gst/fft/gstfft.c

Packit 0652a1
/* GStreamer
Packit 0652a1
 * Copyright (C) <2007> Sebastian Dröge <slomo@circular-chaos.org>
Packit 0652a1
 *
Packit 0652a1
 * This library is free software; you can redistribute it and/or
Packit 0652a1
 * modify it under the terms of the GNU Library General Public
Packit 0652a1
 * License as published by the Free Software Foundation; either
Packit 0652a1
 * version 2 of the License, or (at your option) any later version.
Packit 0652a1
 *
Packit 0652a1
 * This library is distributed in the hope that it will be useful,
Packit 0652a1
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 0652a1
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 0652a1
 * Library General Public License for more details.
Packit 0652a1
 *
Packit 0652a1
 * You should have received a copy of the GNU Library General Public
Packit 0652a1
 * License along with this library; if not, write to the
Packit 0652a1
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Packit 0652a1
 * Boston, MA 02110-1301, USA.
Packit 0652a1
 */
Packit 0652a1
Packit 0652a1
/**
Packit 0652a1
 * SECTION:gstfft
Packit 0652a1
 * @title: GstFFT
Packit 0652a1
 * @short_description: General FFT functions and declarations
Packit 0652a1
 *
Packit 0652a1
 * This library includes general definitions and functions, useful for
Packit 0652a1
 * all typed FFT classes.
Packit 0652a1
 */
Packit 0652a1
#ifdef HAVE_CONFIG_H
Packit 0652a1
#include "config.h"
Packit 0652a1
#endif
Packit 0652a1
Packit 0652a1
#include <glib.h>
Packit 0652a1
Packit 0652a1
#include "gstfft.h"
Packit 0652a1
#include "kiss_fft_s16.h"
Packit 0652a1
Packit 0652a1
/**
Packit 0652a1
 * gst_fft_next_fast_length:
Packit 0652a1
 * @n: Number for which the next fast length should be returned
Packit 0652a1
 *
Packit 0652a1
 * Returns the next number to @n that is entirely a product
Packit 0652a1
 * of 2, 3 and 5. Using this as the @len parameter for
Packit 0652a1
 * the different GstFFT types will provide the best performance.
Packit 0652a1
 *
Packit 0652a1
 * Returns: the next fast FFT length.
Packit 0652a1
 *
Packit 0652a1
 */
Packit 0652a1
gint
Packit 0652a1
gst_fft_next_fast_length (gint n)
Packit 0652a1
{
Packit 0652a1
  gint half = (n + 1) / 2;
Packit 0652a1
Packit 0652a1
  /* It's the same for all data types so call the s16
Packit 0652a1
   * version */
Packit 0652a1
Packit 0652a1
  /* The real FFT needs an even length so calculate that */
Packit 0652a1
  return 2 * kiss_fft_s16_next_fast_size (half);
Packit 0652a1
}