--- /dev/null	2007-08-16 07:48:53.000000000 +0200
+++ gst-libs/gst/fft/kiss_version	2007-08-20 20:20:58.000000000 +0200
@@ -0,0 +1,4 @@
+Based on Kiss FFT version 1.2.6. http://kissfft.sourceforge.net
+
+Only changes are limitation to one data type for each version in
+kiss_fft.h and _kiss_fft_guts.h.
--- /dev/null	2007-08-16 07:48:53.000000000 +0200
+++ gst-libs/gst/fft/gstfft.c	2007-08-20 20:19:46.000000000 +0200
@@ -0,0 +1,52 @@
+/* GStreamer
+ * Copyright (C) <2007> Sebastian Dröge <slomo@circular-chaos.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * SECTION:gstfft
+ * @short_description: General FFT functions and declarations
+ * 
+ * This library includes general definitions and functions, useful for
+ * all typed FFT classes.
+ *
+ */
+
+#include <glib.h>
+
+#include "gstfft.h"
+#include "kiss_fft_s16.h"
+
+/**
+ * gst_fft_next_fast_size:
+ * @n: Number for which the next fast size should be returned
+ *
+ * Returns the next number to @n that is entirely a product
+ * of 2, 3 and 5. Using this as the @len parameter for
+ * the different GstFFT types will provide the best performance.
+ *
+ * Returns: the next fast FFT size.
+ *
+ */
+gint
+gst_fft_next_fast_size (gint n)
+{
+  /* It's the same for all data types so call the s16
+   * version */
+  return kiss_fft_s16_next_fast_size (n);
+}
+
--- /dev/null	2007-08-16 07:48:53.000000000 +0200
+++ gst-libs/gst/fft/gstfftf32.c	2007-08-20 20:23:39.000000000 +0200
@@ -0,0 +1,267 @@
+/* GStreamer
+ * Copyright (C) <2007> Sebastian Dröge <slomo@circular-chaos.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <glib.h>
+#include <math.h>
+
+#include "kiss_fftr_f32.h"
+#include "gstfft.h"
+#include "gstfftf32.h"
+
+/**
+ * SECTION:gstfftf32
+ * @short_description: FFT functions for 32 bit float samples
+ *
+ * #GstFFTF32 provides a FFT implementation and related functions for
+ * 32 bit float samples. To use this call gst_fft_f32_new() for
+ * allocating a #GstFFTF32 instance with the appropiate parameters and
+ * then call gst_fft_f32_fft() or gst_fft_f32_inverse_fft() to perform the
+ * FFT or inverse FFT on a buffer of samples.
+ *
+ * After use free the #GstFFTF32 instance with gst_fft_f32_free().
+ *
+ * For the best performance use gst_fft_next_fast_size() to get a
+ * number that is entirely a product of 2, 3 and 5 and use this as the
+ * @len parameter for gst_fft_f32_new().
+ *
+ * The @len parameter specifies the number of samples in the time domain that
+ * will be processed or generated. The number of samples in the frequency domain
+ * is @len/2 + 1. To get n samples in the frequency domain use 2*n - 2 as @len.
+ *
+ * Before performing the FFT on time domain data it usually makes sense
+ * to apply a window function to it. For this gst_fft_f32_window() can comfortably
+ * be used.
+ *
+ * For calculating the magnitude or phase of frequency data the functions
+ * gst_fft_f32_magnitude() and gst_fft_f32_phase() exist, if you want to calculate
+ * the magnitude yourself note that the magnitude of the frequency data is
+ * a value between 0 and 1 and is to be scaled by the length of the FFT.
+ *
+ */
+
+/**
+ * gst_fft_f32_new:
+ * @len: Length of the FFT in the time domain
+ * @inverse: %TRUE if the #GstFFTF32 instance should be used for the inverse FFT
+ *
+ * This returns a new #GstFFTF32 instance with the given parameters. It makes
+ * sense to keep one instance for several calls for speed reasons.
+ *
+ * @len must be even and to get the best performance a product of
+ * 2, 3 and 5. To get the next number with this characteristics use
+ * gst_fft_next_fast_size().
+ *
+ * Returns: a new #GstFFTF32 instance.
+ */
+GstFFTF32 *
+gst_fft_f32_new (gint len, gboolean inverse)
+{
+  GstFFTF32 *self;
+  
+  g_return_val_if_fail (len > 0, NULL);
+  g_return_val_if_fail (len % 2 == 0, NULL);
+
+  self = g_new (GstFFTF32, 1);
+
+  self->cfg = kiss_fftr_f32_alloc (len, (inverse) ? 1 : 0, NULL, NULL);
+  g_assert (self->cfg);
+
+  self->inverse = inverse;
+  self->len = len;
+
+  return self;
+}
+
+/**
+ * gst_fft_f32_fft:
+ * @self: #GstFFTF32 instance for this call
+ * @timedata: Buffer of the samples in the time domain
+ * @freqdata: Target buffer for the samples in the frequency domain
+ *
+ * This performs the FFT on @timedata and puts the result in @freqdata.
+ *
+ * @timedata must have as many samples as specified with the @len parameter while
+ * allocating the #GstFFTF32 instance with gst_fft_f32_new().
+ *
+ * @freqdata must be large enough to hold @len/2 + 1 #GstFFTF32Complex frequency
+ * domain samples.
+ *
+ */
+void
+gst_fft_f32_fft (GstFFTF32 *self, const gfloat *timedata, GstFFTF32Complex *freqdata)
+{
+  g_return_if_fail (self);
+  g_return_if_fail (!self->inverse);
+  g_return_if_fail (timedata);
+  g_return_if_fail (freqdata);
+
+  kiss_fftr_f32 (self->cfg, timedata, (kiss_fft_f32_cpx *) freqdata);
+}
+
+/**
+ * gst_fft_f32_inverse_fft:
+ * @self: #GstFFTF32 instance for this call
+ * @freqdata: Buffer of the samples in the frequency domain
+ * @timedata: Target buffer for the samples in the time domain
+ *
+ * This performs the inverse FFT on @freqdata and puts the result in @timedata.
+ *
+ * @freqdata must have @len/2 + 1 samples, where @len is the parameter specified
+ * while allocating the #GstFFTF32 instance with gst_fft_f32_new().
+ *
+ * @timedata must be large enough to hold @len time domain samples.
+ *
+ */
+void
+gst_fft_f32_inverse_fft (GstFFTF32 *self, const GstFFTF32Complex *freqdata, gfloat *timedata)
+{
+  g_return_if_fail (self);
+  g_return_if_fail (self->inverse);
+  g_return_if_fail (timedata);
+  g_return_if_fail (freqdata);
+
+  kiss_fftri_f32 (self->cfg, (kiss_fft_f32_cpx *) freqdata, timedata);
+}
+
+/**
+ * gst_fft_f32_free:
+ * @self: #GstFFTF32 instance for this call
+ *
+ * This frees the memory allocated for @self.
+ *
+ */
+void
+gst_fft_f32_free (GstFFTF32 *self)
+{
+  kiss_fftr_f32_free (self->cfg);
+  g_free (self);
+}
+
+/**
+ * gst_fft_f32_window:
+ * @self: #GstFFTF32 instance for this call
+ * @timedata: Time domain samples
+ * @window: Window function to apply
+ *
+ * This calls the window function @window on the @timedata sample buffer.
+ *
+ */
+void
+gst_fft_f32_window (GstFFTF32 *self, gfloat *timedata, GstFFTWindow window)
+{
+  gint i, len;
+
+  g_return_if_fail (self);
+  g_return_if_fail (timedata);
+
+  len = self->len;
+
+  switch (window) {
+    case GST_FFT_WINDOW_RECTANGULAR:
+      /* do nothing */
+      break;
+    case GST_FFT_WINDOW_HAMMING:
+      for (i = 0; i < len; i++)
+        timedata[i] *= (0.53836 - 0.46164 * cos (2.0 * M_PI * i / len));
+      break;
+    case GST_FFT_WINDOW_HANN:
+      for (i = 0; i < len; i++)
+        timedata[i] *= (0.5 - 0.5 * cos (2.0 * M_PI * i / len));
+      break;
+    case GST_FFT_WINDOW_BARTLETT:
+      for (i = 0; i < len; i++)
+        timedata[i] *= (1.0 - fabs ((2.0 * i - len) / len));
+      break;
+    case GST_FFT_WINDOW_BLACKMAN:
+      for (i = 0; i < len; i++)
+        timedata[i] *= (0.42 - 0.5 * cos ((2.0 * i) / len) +
+	    0.08 * cos ((4.0 * i) / len));
+      break;
+    default:
+      g_assert_not_reached ();
+      break;
+  }
+}
+
+/**
+ * gst_fft_f32_magnitude:
+ * @self: #GstFFTF32 instance for this call
+ * @freqdata: Frequency domain samples
+ * @magnitude: Target buffer for the magnitude
+ * @decibel: %TRUE if the magnitude should be in decibel, %FALSE if it should be an amplitude
+ *
+ * This calculates the magnitude of @freqdata in @magnitude. Depending on the value
+ * of @decibel the magnitude can be calculated in decibel or as amplitude between 0.0
+ * and 1.0.
+ *
+ * @magnitude must be large enough to hold @len/2 + 1 values.
+ *
+ */
+void
+gst_fft_f32_magnitude (GstFFTF32 *self, GstFFTF32Complex *freqdata,
+    gdouble *magnitude, gboolean decibel)
+{
+  gint i, len, nfft;
+  gdouble val;
+
+  g_return_if_fail (self);
+  g_return_if_fail (freqdata);
+  g_return_if_fail (magnitude);
+
+  len = self->len / 2 + 1;
+  nfft = self->len;
+
+  for (i = 0; i < len; i++) {
+    val = (gdouble) freqdata[i].r * (gdouble) freqdata[i].r
+        + (gdouble) freqdata[i].i * (gdouble) freqdata[i].i;
+    val = sqrt (val) / nfft;
+
+    if (decibel)
+      val = 20.0 * log10 (val);
+  }
+}
+
+/**
+ * gst_fft_f32_phase:
+ * @self: #GstFFTF32 instance for this call
+ * @freqdata: Frequency domain samples
+ * @phase: Target buffer for the phase
+ *
+ * This calculates the phases of @freqdata in @phase. The returned
+ * phases will be values between -pi and pi.
+ *
+ * @phase must be large enough to hold @len/2 + 1 values.
+ *
+ */
+void
+gst_fft_f32_phase (GstFFTF32 *self, GstFFTF32Complex *freqdata,
+    gdouble *phase)
+{
+  gint i, len;
+
+  g_return_if_fail (self);
+  g_return_if_fail (freqdata);
+  g_return_if_fail (phase);
+
+  len = self->len / 2 + 1;
+
+  for (i = 0; i < len; i++)
+    phase[i] = atan2 (freqdata[i].i, freqdata[i].r);
+}
+
--- /dev/null	2007-08-16 07:48:53.000000000 +0200
+++ gst-libs/gst/fft/gstfftf64.c	2007-08-20 20:24:14.000000000 +0200
@@ -0,0 +1,267 @@
+/* GStreamer
+ * Copyright (C) <2007> Sebastian Dröge <slomo@circular-chaos.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <glib.h>
+#include <math.h>
+
+#include "kiss_fftr_f64.h"
+#include "gstfft.h"
+#include "gstfftf64.h"
+
+/**
+ * SECTION:gstfftf64
+ * @short_description: FFT functions for 64 bit float samples
+ *
+ * #GstFFTF64 provides a FFT implementation and related functions for
+ * 64 bit float samples. To use this call gst_fft_f64_new() for
+ * allocating a #GstFFTF64 instance with the appropiate parameters and
+ * then call gst_fft_f64_fft() or gst_fft_f64_inverse_fft() to perform the
+ * FFT or inverse FFT on a buffer of samples.
+ *
+ * After use free the #GstFFTF64 instance with gst_fft_f64_free().
+ *
+ * For the best performance use gst_fft_next_fast_size() to get a
+ * number that is entirely a product of 2, 3 and 5 and use this as the
+ * @len parameter for gst_fft_f64_new().
+ *
+ * The @len parameter specifies the number of samples in the time domain that
+ * will be processed or generated. The number of samples in the frequency domain
+ * is @len/2 + 1. To get n samples in the frequency domain use 2*n - 2 as @len.
+ *
+ * Before performing the FFT on time domain data it usually makes sense
+ * to apply a window function to it. For this gst_fft_f64_window() can comfortably
+ * be used.
+ *
+ * For calculating the magnitude or phase of frequency data the functions
+ * gst_fft_f64_magnitude() and gst_fft_f64_phase() exist, if you want to calculate
+ * the magnitude yourself note that the magnitude of the frequency data is
+ * a value between 0 and 1 and is to be scaled by the length of the FFT.
+ *
+ */
+
+/**
+ * gst_fft_f64_new:
+ * @len: Length of the FFT in the time domain
+ * @inverse: %TRUE if the #GstFFTF64 instance should be used for the inverse FFT
+ *
+ * This returns a new #GstFFTF64 instance with the given parameters. It makes
+ * sense to keep one instance for several calls for speed reasons.
+ *
+ * @len must be even and to get the best performance a product of
+ * 2, 3 and 5. To get the next number with this characteristics use
+ * gst_fft_next_fast_size().
+ *
+ * Returns: a new #GstFFTF64 instance.
+ */
+GstFFTF64 *
+gst_fft_f64_new (gint len, gboolean inverse)
+{
+  GstFFTF64 *self;
+  
+  g_return_val_if_fail (len > 0, NULL);
+  g_return_val_if_fail (len % 2 == 0, NULL);
+
+  self = g_new (GstFFTF64, 1);
+
+  self->cfg = kiss_fftr_f64_alloc (len, (inverse) ? 1 : 0, NULL, NULL);
+  g_assert (self->cfg);
+
+  self->inverse = inverse;
+  self->len = len;
+
+  return self;
+}
+
+/**
+ * gst_fft_f64_fft:
+ * @self: #GstFFTF64 instance for this call
+ * @timedata: Buffer of the samples in the time domain
+ * @freqdata: Target buffer for the samples in the frequency domain
+ *
+ * This performs the FFT on @timedata and puts the result in @freqdata.
+ *
+ * @timedata must have as many samples as specified with the @len parameter while
+ * allocating the #GstFFTF64 instance with gst_fft_f64_new().
+ *
+ * @freqdata must be large enough to hold @len/2 + 1 #GstFFTF64Complex frequency
+ * domain samples.
+ *
+ */
+void
+gst_fft_f64_fft (GstFFTF64 *self, const gdouble *timedata, GstFFTF64Complex *freqdata)
+{
+  g_return_if_fail (self);
+  g_return_if_fail (!self->inverse);
+  g_return_if_fail (timedata);
+  g_return_if_fail (freqdata);
+
+  kiss_fftr_f64 (self->cfg, timedata, (kiss_fft_f64_cpx *) freqdata);
+}
+
+/**
+ * gst_fft_f64_inverse_fft:
+ * @self: #GstFFTF64 instance for this call
+ * @freqdata: Buffer of the samples in the frequency domain
+ * @timedata: Target buffer for the samples in the time domain
+ *
+ * This performs the inverse FFT on @freqdata and puts the result in @timedata.
+ *
+ * @freqdata must have @len/2 + 1 samples, where @len is the parameter specified
+ * while allocating the #GstFFTF64 instance with gst_fft_f64_new().
+ *
+ * @timedata must be large enough to hold @len time domain samples.
+ *
+ */
+void
+gst_fft_f64_inverse_fft (GstFFTF64 *self, const GstFFTF64Complex *freqdata, gdouble *timedata)
+{
+  g_return_if_fail (self);
+  g_return_if_fail (self->inverse);
+  g_return_if_fail (timedata);
+  g_return_if_fail (freqdata);
+
+  kiss_fftri_f64 (self->cfg, (kiss_fft_f64_cpx *) freqdata, timedata);
+}
+
+/**
+ * gst_fft_f64_free:
+ * @self: #GstFFTF64 instance for this call
+ *
+ * This frees the memory allocated for @self.
+ *
+ */
+void
+gst_fft_f64_free (GstFFTF64 *self)
+{
+  kiss_fftr_f64_free (self->cfg);
+  g_free (self);
+}
+
+/**
+ * gst_fft_f64_window:
+ * @self: #GstFFTF64 instance for this call
+ * @timedata: Time domain samples
+ * @window: Window function to apply
+ *
+ * This calls the window function @window on the @timedata sample buffer.
+ *
+ */
+void
+gst_fft_f64_window (GstFFTF64 *self, gdouble *timedata, GstFFTWindow window)
+{
+  gint i, len;
+
+  g_return_if_fail (self);
+  g_return_if_fail (timedata);
+
+  len = self->len;
+
+  switch (window) {
+    case GST_FFT_WINDOW_RECTANGULAR:
+      /* do nothing */
+      break;
+    case GST_FFT_WINDOW_HAMMING:
+      for (i = 0; i < len; i++)
+        timedata[i] *= (0.53836 - 0.46164 * cos (2.0 * M_PI * i / len));
+      break;
+    case GST_FFT_WINDOW_HANN:
+      for (i = 0; i < len; i++)
+        timedata[i] *= (0.5 - 0.5 * cos (2.0 * M_PI * i / len));
+      break;
+    case GST_FFT_WINDOW_BARTLETT:
+      for (i = 0; i < len; i++)
+        timedata[i] *= (1.0 - fabs ((2.0 * i - len) / len));
+      break;
+    case GST_FFT_WINDOW_BLACKMAN:
+      for (i = 0; i < len; i++)
+        timedata[i] *= (0.42 - 0.5 * cos ((2.0 * i) / len) +
+	    0.08 * cos ((4.0 * i) / len));
+      break;
+    default:
+      g_assert_not_reached ();
+      break;
+  }
+}
+
+/**
+ * gst_fft_f64_magnitude:
+ * @self: #GstFFTF64 instance for this call
+ * @freqdata: Frequency domain samples
+ * @magnitude: Target buffer for the magnitude
+ * @decibel: %TRUE if the magnitude should be in decibel, %FALSE if it should be an amplitude
+ *
+ * This calculates the magnitude of @freqdata in @magnitude. Depending on the value
+ * of @decibel the magnitude can be calculated in decibel or as amplitude between 0.0
+ * and 1.0.
+ *
+ * @magnitude must be large enough to hold @len/2 + 1 values.
+ *
+ */
+void
+gst_fft_f64_magnitude (GstFFTF64 *self, GstFFTF64Complex *freqdata,
+    gdouble *magnitude, gboolean decibel)
+{
+  gint i, len, nfft;
+  gdouble val;
+
+  g_return_if_fail (self);
+  g_return_if_fail (freqdata);
+  g_return_if_fail (magnitude);
+
+  len = self->len / 2 + 1;
+  nfft = self->len;
+
+  for (i = 0; i < len; i++) {
+    val = (gdouble) freqdata[i].r * (gdouble) freqdata[i].r
+        + (gdouble) freqdata[i].i * (gdouble) freqdata[i].i;
+    val = sqrt (val) / nfft;
+
+    if (decibel)
+      val = 20.0 * log10 (val);
+  }
+}
+
+/**
+ * gst_fft_f64_phase:
+ * @self: #GstFFTF64 instance for this call
+ * @freqdata: Frequency domain samples
+ * @phase: Target buffer for the phase
+ *
+ * This calculates the phases of @freqdata in @phase. The returned
+ * phases will be values between -pi and pi.
+ *
+ * @phase must be large enough to hold @len/2 + 1 values.
+ *
+ */
+void
+gst_fft_f64_phase (GstFFTF64 *self, GstFFTF64Complex *freqdata,
+    gdouble *phase)
+{
+  gint i, len;
+
+  g_return_if_fail (self);
+  g_return_if_fail (freqdata);
+  g_return_if_fail (phase);
+
+  len = self->len / 2 + 1;
+
+  for (i = 0; i < len; i++)
+    phase[i] = atan2 (freqdata[i].i, freqdata[i].r);
+}
+
--- /dev/null	2007-08-16 07:48:53.000000000 +0200
+++ gst-libs/gst/fft/gstffts16.c	2007-08-20 20:23:02.000000000 +0200
@@ -0,0 +1,266 @@
+/* GStreamer
+ * Copyright (C) <2007> Sebastian Dröge <slomo@circular-chaos.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <glib.h>
+#include <math.h>
+
+#include "kiss_fftr_s16.h"
+#include "gstfft.h"
+#include "gstffts16.h"
+
+/**
+ * SECTION:gstffts16
+ * @short_description: FFT functions for signed 16 bit integer samples
+ *
+ * #GstFFTS16 provides a FFT implementation and related functions for
+ * signed 16 bit integer samples. To use this call gst_fft_s16_new() for
+ * allocating a #GstFFTS16 instance with the appropiate parameters and
+ * then call gst_fft_s16_fft() or gst_fft_s16_inverse_fft() to perform the
+ * FFT or inverse FFT on a buffer of samples.
+ *
+ * After use free the #GstFFTS16 instance with gst_fft_s16_free().
+ *
+ * For the best performance use gst_fft_next_fast_size() to get a
+ * number that is entirely a product of 2, 3 and 5 and use this as the
+ * @len parameter for gst_fft_s16_new().
+ *
+ * The @len parameter specifies the number of samples in the time domain that
+ * will be processed or generated. The number of samples in the frequency domain
+ * is @len/2 + 1. To get n samples in the frequency domain use 2*n - 2 as @len.
+ *
+ * Before performing the FFT on time domain data it usually makes sense
+ * to apply a window function to it. For this gst_fft_s16_window() can comfortably
+ * be used.
+ *
+ * For calculating the magnitude or phase of frequency data the functions
+ * gst_fft_s16_magnitude() and gst_fft_s16_phase() exist, if you want to calculate
+ * the magnitude yourself note that the magnitude of the frequency data is
+ * a value between 0 and 32767 and is not to be scaled by the length of the FFT.
+ *
+ */
+
+/**
+ * gst_fft_s16_new:
+ * @len: Length of the FFT in the time domain
+ * @inverse: %TRUE if the #GstFFTS16 instance should be used for the inverse FFT
+ *
+ * This returns a new #GstFFTS16 instance with the given parameters. It makes
+ * sense to keep one instance for several calls for speed reasons.
+ *
+ * @len must be even and to get the best performance a product of
+ * 2, 3 and 5. To get the next number with this characteristics use
+ * gst_fft_next_fast_size().
+ *
+ * Returns: a new #GstFFTS16 instance.
+ */
+GstFFTS16 *
+gst_fft_s16_new (gint len, gboolean inverse)
+{
+  GstFFTS16 *self;
+  
+  g_return_val_if_fail (len > 0, NULL);
+  g_return_val_if_fail (len % 2 == 0, NULL);
+
+  self = g_new (GstFFTS16, 1);
+
+  self->cfg = kiss_fftr_s16_alloc (len, (inverse) ? 1 : 0, NULL, NULL);
+  g_assert (self->cfg);
+
+  self->inverse = inverse;
+  self->len = len;
+
+  return self;
+}
+
+/**
+ * gst_fft_s16_fft:
+ * @self: #GstFFTS16 instance for this call
+ * @timedata: Buffer of the samples in the time domain
+ * @freqdata: Target buffer for the samples in the frequency domain
+ *
+ * This performs the FFT on @timedata and puts the result in @freqdata.
+ *
+ * @timedata must have as many samples as specified with the @len parameter while
+ * allocating the #GstFFTS16 instance with gst_fft_s16_new().
+ *
+ * @freqdata must be large enough to hold @len/2 + 1 #GstFFTS16Complex frequency
+ * domain samples.
+ *
+ */
+void
+gst_fft_s16_fft (GstFFTS16 *self, const gint16 *timedata, GstFFTS16Complex *freqdata)
+{
+  g_return_if_fail (self);
+  g_return_if_fail (!self->inverse);
+  g_return_if_fail (timedata);
+  g_return_if_fail (freqdata);
+
+  kiss_fftr_s16 (self->cfg, timedata, (kiss_fft_s16_cpx *) freqdata);
+}
+
+/**
+ * gst_fft_s16_inverse_fft:
+ * @self: #GstFFTS16 instance for this call
+ * @freqdata: Buffer of the samples in the frequency domain
+ * @timedata: Target buffer for the samples in the time domain
+ *
+ * This performs the inverse FFT on @freqdata and puts the result in @timedata.
+ *
+ * @freqdata must have @len/2 + 1 samples, where @len is the parameter specified
+ * while allocating the #GstFFTS16 instance with gst_fft_s16_new().
+ *
+ * @timedata must be large enough to hold @len time domain samples.
+ *
+ */
+void
+gst_fft_s16_inverse_fft (GstFFTS16 *self, const GstFFTS16Complex *freqdata, gint16 *timedata)
+{
+  g_return_if_fail (self);
+  g_return_if_fail (self->inverse);
+  g_return_if_fail (timedata);
+  g_return_if_fail (freqdata);
+
+  kiss_fftri_s16 (self->cfg, (kiss_fft_s16_cpx *) freqdata, timedata);
+}
+
+/**
+ * gst_fft_s16_free:
+ * @self: #GstFFTS16 instance for this call
+ *
+ * This frees the memory allocated for @self.
+ *
+ */
+void
+gst_fft_s16_free (GstFFTS16 *self)
+{
+  kiss_fftr_s16_free (self->cfg);
+  g_free (self);
+}
+
+/**
+ * gst_fft_s16_window:
+ * @self: #GstFFTS16 instance for this call
+ * @timedata: Time domain samples
+ * @window: Window function to apply
+ *
+ * This calls the window function @window on the @timedata sample buffer.
+ *
+ */
+void
+gst_fft_s16_window (GstFFTS16 *self, gint16 *timedata, GstFFTWindow window)
+{
+  gint i, len;
+
+  g_return_if_fail (self);
+  g_return_if_fail (timedata);
+
+  len = self->len;
+
+  switch (window) {
+    case GST_FFT_WINDOW_RECTANGULAR:
+      /* do nothing */
+      break;
+    case GST_FFT_WINDOW_HAMMING:
+      for (i = 0; i < len; i++)
+        timedata[i] *= (0.53836 - 0.46164 * cos (2.0 * M_PI * i / len));
+      break;
+    case GST_FFT_WINDOW_HANN:
+      for (i = 0; i < len; i++)
+        timedata[i] *= (0.5 - 0.5 * cos (2.0 * M_PI * i / len));
+      break;
+    case GST_FFT_WINDOW_BARTLETT:
+      for (i = 0; i < len; i++)
+        timedata[i] *= (1.0 - fabs ((2.0 * i - len) / len));
+      break;
+    case GST_FFT_WINDOW_BLACKMAN:
+      for (i = 0; i < len; i++)
+        timedata[i] *= (0.42 - 0.5 * cos ((2.0 * i) / len) +
+	    0.08 * cos ((4.0 * i) / len));
+      break;
+    default:
+      g_assert_not_reached ();
+      break;
+  }
+}
+
+/**
+ * gst_fft_s16_magnitude:
+ * @self: #GstFFTS16 instance for this call
+ * @freqdata: Frequency domain samples
+ * @magnitude: Target buffer for the magnitude
+ * @decibel: %TRUE if the magnitude should be in decibel, %FALSE if it should be an amplitude
+ *
+ * This calculates the magnitude of @freqdata in @magnitude. Depending on the value
+ * of @decibel the magnitude can be calculated in decibel or as amplitude between 0.0
+ * and 1.0.
+ *
+ * @magnitude must be large enough to hold @len/2 + 1 values.
+ *
+ */
+void
+gst_fft_s16_magnitude (GstFFTS16 *self, GstFFTS16Complex *freqdata,
+    gdouble *magnitude, gboolean decibel)
+{
+  gint i, len;
+  gdouble val;
+
+  g_return_if_fail (self);
+  g_return_if_fail (freqdata);
+  g_return_if_fail (magnitude);
+
+  len = self->len / 2 + 1;
+
+  for (i = 0; i < len; i++) {
+    val = (gdouble) freqdata[i].r * (gdouble) freqdata[i].r
+        + (gdouble) freqdata[i].i * (gdouble) freqdata[i].i;
+    val = sqrt (val) / 32767.0;
+
+    if (decibel)
+      val = 20.0 * log10 (val);
+  }
+}
+
+/**
+ * gst_fft_s16_phase:
+ * @self: #GstFFTS16 instance for this call
+ * @freqdata: Frequency domain samples
+ * @phase: Target buffer for the phase
+ *
+ * This calculates the phases of @freqdata in @phase. The returned
+ * phases will be values between -pi and pi.
+ *
+ * @phase must be large enough to hold @len/2 + 1 values.
+ *
+ */
+void
+gst_fft_s16_phase (GstFFTS16 *self, GstFFTS16Complex *freqdata,
+    gdouble *phase)
+{
+  gint i, len;
+
+  g_return_if_fail (self);
+  g_return_if_fail (freqdata);
+  g_return_if_fail (phase);
+
+  len = self->len / 2 + 1;
+
+  for (i = 0; i < len; i++)
+    phase[i] = atan2 (freqdata[i].i, freqdata[i].r);
+}
+
--- /dev/null	2007-08-16 07:48:53.000000000 +0200
+++ gst-libs/gst/fft/gstffts32.c	2007-08-20 20:22:42.000000000 +0200
@@ -0,0 +1,266 @@
+/* GStreamer
+ * Copyright (C) <2007> Sebastian Dröge <slomo@circular-chaos.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <glib.h>
+#include <math.h>
+
+#include "kiss_fftr_s32.h"
+#include "gstfft.h"
+#include "gstffts32.h"
+
+/**
+ * SECTION:gstffts32
+ * @short_description: FFT functions for signed 32 bit integer samples
+ *
+ * #GstFFTS32 provides a FFT implementation and related functions for
+ * signed 32 bit integer samples. To use this call gst_fft_s32_new() for
+ * allocating a #GstFFTS32 instance with the appropiate parameters and
+ * then call gst_fft_s32_fft() or gst_fft_s32_inverse_fft() to perform the
+ * FFT or inverse FFT on a buffer of samples.
+ *
+ * After use free the #GstFFTS32 instance with gst_fft_s32_free().
+ *
+ * For the best performance use gst_fft_next_fast_size() to get a
+ * number that is entirely a product of 2, 3 and 5 and use this as the
+ * @len parameter for gst_fft_s32_new().
+ *
+ * The @len parameter specifies the number of samples in the time domain that
+ * will be processed or generated. The number of samples in the frequency domain
+ * is @len/2 + 1. To get n samples in the frequency domain use 2*n - 2 as @len.
+ *
+ * Before performing the FFT on time domain data it usually makes sense
+ * to apply a window function to it. For this gst_fft_s32_window() can comfortably
+ * be used.
+ *
+ * For calculating the magnitude or phase of frequency data the functions
+ * gst_fft_s32_magnitude() and gst_fft_s32_phase() exist, if you want to calculate
+ * the magnitude yourself note that the magnitude of the frequency data is
+ * a value between 0 and 2147483647 and is not to be scaled by the length of the FFT.
+ *
+ */
+
+/**
+ * gst_fft_s32_new:
+ * @len: Length of the FFT in the time domain
+ * @inverse: %TRUE if the #GstFFTS32 instance should be used for the inverse FFT
+ *
+ * This returns a new #GstFFTS32 instance with the given parameters. It makes
+ * sense to keep one instance for several calls for speed reasons.
+ *
+ * @len must be even and to get the best performance a product of
+ * 2, 3 and 5. To get the next number with this characteristics use
+ * gst_fft_next_fast_size().
+ *
+ * Returns: a new #GstFFTS32 instance.
+ */
+GstFFTS32 *
+gst_fft_s32_new (gint len, gboolean inverse)
+{
+  GstFFTS32 *self;
+  
+  g_return_val_if_fail (len > 0, NULL);
+  g_return_val_if_fail (len % 2 == 0, NULL);
+
+  self = g_new (GstFFTS32, 1);
+
+  self->cfg = kiss_fftr_s32_alloc (len, (inverse) ? 1 : 0, NULL, NULL);
+  g_assert (self->cfg);
+
+  self->inverse = inverse;
+  self->len = len;
+
+  return self;
+}
+
+/**
+ * gst_fft_s32_fft:
+ * @self: #GstFFTS32 instance for this call
+ * @timedata: Buffer of the samples in the time domain
+ * @freqdata: Target buffer for the samples in the frequency domain
+ *
+ * This performs the FFT on @timedata and puts the result in @freqdata.
+ *
+ * @timedata must have as many samples as specified with the @len parameter while
+ * allocating the #GstFFTS32 instance with gst_fft_s32_new().
+ *
+ * @freqdata must be large enough to hold @len/2 + 1 #GstFFTS32Complex frequency
+ * domain samples.
+ *
+ */
+void
+gst_fft_s32_fft (GstFFTS32 *self, const gint32 *timedata, GstFFTS32Complex *freqdata)
+{
+  g_return_if_fail (self);
+  g_return_if_fail (!self->inverse);
+  g_return_if_fail (timedata);
+  g_return_if_fail (freqdata);
+
+  kiss_fftr_s32 (self->cfg, timedata, (kiss_fft_s32_cpx *) freqdata);
+}
+
+/**
+ * gst_fft_s32_inverse_fft:
+ * @self: #GstFFTS32 instance for this call
+ * @freqdata: Buffer of the samples in the frequency domain
+ * @timedata: Target buffer for the samples in the time domain
+ *
+ * This performs the inverse FFT on @freqdata and puts the result in @timedata.
+ *
+ * @freqdata must have @len/2 + 1 samples, where @len is the parameter specified
+ * while allocating the #GstFFTS32 instance with gst_fft_s32_new().
+ *
+ * @timedata must be large enough to hold @len time domain samples.
+ *
+ */
+void
+gst_fft_s32_inverse_fft (GstFFTS32 *self, const GstFFTS32Complex *freqdata, gint32 *timedata)
+{
+  g_return_if_fail (self);
+  g_return_if_fail (self->inverse);
+  g_return_if_fail (timedata);
+  g_return_if_fail (freqdata);
+
+  kiss_fftri_s32 (self->cfg, (kiss_fft_s32_cpx *) freqdata, timedata);
+}
+
+/**
+ * gst_fft_s32_free:
+ * @self: #GstFFTS32 instance for this call
+ *
+ * This frees the memory allocated for @self.
+ *
+ */
+void
+gst_fft_s32_free (GstFFTS32 *self)
+{
+  kiss_fftr_s32_free (self->cfg);
+  g_free (self);
+}
+
+/**
+ * gst_fft_s32_window:
+ * @self: #GstFFTS32 instance for this call
+ * @timedata: Time domain samples
+ * @window: Window function to apply
+ *
+ * This calls the window function @window on the @timedata sample buffer.
+ *
+ */
+void
+gst_fft_s32_window (GstFFTS32 *self, gint32 *timedata, GstFFTWindow window)
+{
+  gint i, len;
+
+  g_return_if_fail (self);
+  g_return_if_fail (timedata);
+
+  len = self->len;
+
+  switch (window) {
+    case GST_FFT_WINDOW_RECTANGULAR:
+      /* do nothing */
+      break;
+    case GST_FFT_WINDOW_HAMMING:
+      for (i = 0; i < len; i++)
+        timedata[i] *= (0.53836 - 0.46164 * cos (2.0 * M_PI * i / len));
+      break;
+    case GST_FFT_WINDOW_HANN:
+      for (i = 0; i < len; i++)
+        timedata[i] *= (0.5 - 0.5 * cos (2.0 * M_PI * i / len));
+      break;
+    case GST_FFT_WINDOW_BARTLETT:
+      for (i = 0; i < len; i++)
+        timedata[i] *= (1.0 - fabs ((2.0 * i - len) / len));
+      break;
+    case GST_FFT_WINDOW_BLACKMAN:
+      for (i = 0; i < len; i++)
+        timedata[i] *= (0.42 - 0.5 * cos ((2.0 * i) / len) +
+	    0.08 * cos ((4.0 * i) / len));
+      break;
+    default:
+      g_assert_not_reached ();
+      break;
+  }
+}
+
+/**
+ * gst_fft_s32_magnitude:
+ * @self: #GstFFTS32 instance for this call
+ * @freqdata: Frequency domain samples
+ * @magnitude: Target buffer for the magnitude
+ * @decibel: %TRUE if the magnitude should be in decibel, %FALSE if it should be an amplitude
+ *
+ * This calculates the magnitude of @freqdata in @magnitude. Depending on the value
+ * of @decibel the magnitude can be calculated in decibel or as amplitude between 0.0
+ * and 1.0.
+ *
+ * @magnitude must be large enough to hold @len/2 + 1 values.
+ *
+ */
+void
+gst_fft_s32_magnitude (GstFFTS32 *self, GstFFTS32Complex *freqdata,
+    gdouble *magnitude, gboolean decibel)
+{
+  gint i, len;
+  gdouble val;
+
+  g_return_if_fail (self);
+  g_return_if_fail (freqdata);
+  g_return_if_fail (magnitude);
+
+  len = self->len / 2 + 1;
+
+  for (i = 0; i < len; i++) {
+    val = (gdouble) freqdata[i].r * (gdouble) freqdata[i].r
+        + (gdouble) freqdata[i].i * (gdouble) freqdata[i].i;
+    val = sqrt (val) / 2147483647.0;
+
+    if (decibel)
+      val = 20.0 * log10 (val);
+  }
+}
+
+/**
+ * gst_fft_s32_phase:
+ * @self: #GstFFTS32 instance for this call
+ * @freqdata: Frequency domain samples
+ * @phase: Target buffer for the phase
+ *
+ * This calculates the phases of @freqdata in @phase. The returned
+ * phases will be values between -pi and pi.
+ *
+ * @phase must be large enough to hold @len/2 + 1 values.
+ *
+ */
+void
+gst_fft_s32_phase (GstFFTS32 *self, GstFFTS32Complex *freqdata,
+    gdouble *phase)
+{
+  gint i, len;
+
+  g_return_if_fail (self);
+  g_return_if_fail (freqdata);
+  g_return_if_fail (phase);
+
+  len = self->len / 2 + 1;
+
+  for (i = 0; i < len; i++)
+    phase[i] = atan2 (freqdata[i].i, freqdata[i].r);
+}
+
--- /dev/null	2007-08-16 07:48:53.000000000 +0200
+++ gst-libs/gst/fft/kiss_fft_f32.c	2007-08-20 19:14:55.000000000 +0200
@@ -0,0 +1,399 @@
+/*
+Copyright (c) 2003-2004, Mark Borgerding
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+    * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#include "_kiss_fft_guts_f32.h"
+/* The guts header contains all the multiplication and addition macros that are defined for
+ fixed or floating point complex numbers.  It also delares the kf_ internal functions.
+ */
+
+static kiss_fft_f32_cpx *scratchbuf=NULL;
+static size_t nscratchbuf=0;
+static kiss_fft_f32_cpx *tmpbuf=NULL;
+static size_t ntmpbuf=0;
+
+#define CHECKBUF(buf,nbuf,n) \
+    do { \
+        if ( nbuf < (size_t)(n) ) {\
+            free(buf); \
+            buf = (kiss_fft_f32_cpx*)KISS_FFT_F32_MALLOC(sizeof(kiss_fft_f32_cpx)*(n)); \
+            nbuf = (size_t)(n); \
+        } \
+   }while(0)
+
+
+static void kf_bfly2(
+        kiss_fft_f32_cpx * Fout,
+        const size_t fstride,
+        const kiss_fft_f32_cfg st,
+        int m
+        )
+{
+    kiss_fft_f32_cpx * Fout2;
+    kiss_fft_f32_cpx * tw1 = st->twiddles;
+    kiss_fft_f32_cpx t;
+    Fout2 = Fout + m;
+    do{
+        C_FIXDIV(*Fout,2); C_FIXDIV(*Fout2,2);
+
+        C_MUL (t,  *Fout2 , *tw1);
+        tw1 += fstride;
+        C_SUB( *Fout2 ,  *Fout , t );
+        C_ADDTO( *Fout ,  t );
+        ++Fout2;
+        ++Fout;
+    }while (--m);
+}
+
+static void kf_bfly4(
+        kiss_fft_f32_cpx * Fout,
+        const size_t fstride,
+        const kiss_fft_f32_cfg st,
+        const size_t m
+        )
+{
+    kiss_fft_f32_cpx *tw1,*tw2,*tw3;
+    kiss_fft_f32_cpx scratch[6];
+    size_t k=m;
+    const size_t m2=2*m;
+    const size_t m3=3*m;
+
+    tw3 = tw2 = tw1 = st->twiddles;
+
+    do {
+        C_FIXDIV(*Fout,4); C_FIXDIV(Fout[m],4); C_FIXDIV(Fout[m2],4); C_FIXDIV(Fout[m3],4);
+
+        C_MUL(scratch[0],Fout[m] , *tw1 );
+        C_MUL(scratch[1],Fout[m2] , *tw2 );
+        C_MUL(scratch[2],Fout[m3] , *tw3 );
+
+        C_SUB( scratch[5] , *Fout, scratch[1] );
+        C_ADDTO(*Fout, scratch[1]);
+        C_ADD( scratch[3] , scratch[0] , scratch[2] );
+        C_SUB( scratch[4] , scratch[0] , scratch[2] );
+        C_SUB( Fout[m2], *Fout, scratch[3] );
+        tw1 += fstride;
+        tw2 += fstride*2;
+        tw3 += fstride*3;
+        C_ADDTO( *Fout , scratch[3] );
+
+        if(st->inverse) {
+            Fout[m].r = scratch[5].r - scratch[4].i;
+            Fout[m].i = scratch[5].i + scratch[4].r;
+            Fout[m3].r = scratch[5].r + scratch[4].i;
+            Fout[m3].i = scratch[5].i - scratch[4].r;
+        }else{
+            Fout[m].r = scratch[5].r + scratch[4].i;
+            Fout[m].i = scratch[5].i - scratch[4].r;
+            Fout[m3].r = scratch[5].r - scratch[4].i;
+            Fout[m3].i = scratch[5].i + scratch[4].r;
+        }
+        ++Fout;
+    }while(--k);
+}
+
+static void kf_bfly3(
+         kiss_fft_f32_cpx * Fout,
+         const size_t fstride,
+         const kiss_fft_f32_cfg st,
+         size_t m
+         )
+{
+     size_t k=m;
+     const size_t m2 = 2*m;
+     kiss_fft_f32_cpx *tw1,*tw2;
+     kiss_fft_f32_cpx scratch[5];
+     kiss_fft_f32_cpx epi3;
+     epi3 = st->twiddles[fstride*m];
+
+     tw1=tw2=st->twiddles;
+
+     do{
+         C_FIXDIV(*Fout,3); C_FIXDIV(Fout[m],3); C_FIXDIV(Fout[m2],3);
+
+         C_MUL(scratch[1],Fout[m] , *tw1);
+         C_MUL(scratch[2],Fout[m2] , *tw2);
+
+         C_ADD(scratch[3],scratch[1],scratch[2]);
+         C_SUB(scratch[0],scratch[1],scratch[2]);
+         tw1 += fstride;
+         tw2 += fstride*2;
+
+         Fout[m].r = Fout->r - HALF_OF(scratch[3].r);
+         Fout[m].i = Fout->i - HALF_OF(scratch[3].i);
+
+         C_MULBYSCALAR( scratch[0] , epi3.i );
+
+         C_ADDTO(*Fout,scratch[3]);
+
+         Fout[m2].r = Fout[m].r + scratch[0].i;
+         Fout[m2].i = Fout[m].i - scratch[0].r;
+
+         Fout[m].r -= scratch[0].i;
+         Fout[m].i += scratch[0].r;
+
+         ++Fout;
+     }while(--k);
+}
+
+static void kf_bfly5(
+        kiss_fft_f32_cpx * Fout,
+        const size_t fstride,
+        const kiss_fft_f32_cfg st,
+        int m
+        )
+{
+    kiss_fft_f32_cpx *Fout0,*Fout1,*Fout2,*Fout3,*Fout4;
+    int u;
+    kiss_fft_f32_cpx scratch[13];
+    kiss_fft_f32_cpx * twiddles = st->twiddles;
+    kiss_fft_f32_cpx *tw;
+    kiss_fft_f32_cpx ya,yb;
+    ya = twiddles[fstride*m];
+    yb = twiddles[fstride*2*m];
+
+    Fout0=Fout;
+    Fout1=Fout0+m;
+    Fout2=Fout0+2*m;
+    Fout3=Fout0+3*m;
+    Fout4=Fout0+4*m;
+
+    tw=st->twiddles;
+    for ( u=0; u<m; ++u ) {
+        C_FIXDIV( *Fout0,5); C_FIXDIV( *Fout1,5); C_FIXDIV( *Fout2,5); C_FIXDIV( *Fout3,5); C_FIXDIV( *Fout4,5);
+        scratch[0] = *Fout0;
+
+        C_MUL(scratch[1] ,*Fout1, tw[u*fstride]);
+        C_MUL(scratch[2] ,*Fout2, tw[2*u*fstride]);
+        C_MUL(scratch[3] ,*Fout3, tw[3*u*fstride]);
+        C_MUL(scratch[4] ,*Fout4, tw[4*u*fstride]);
+
+        C_ADD( scratch[7],scratch[1],scratch[4]);
+        C_SUB( scratch[10],scratch[1],scratch[4]);
+        C_ADD( scratch[8],scratch[2],scratch[3]);
+        C_SUB( scratch[9],scratch[2],scratch[3]);
+
+        Fout0->r += scratch[7].r + scratch[8].r;
+        Fout0->i += scratch[7].i + scratch[8].i;
+
+        scratch[5].r = scratch[0].r + S_MUL(scratch[7].r,ya.r) + S_MUL(scratch[8].r,yb.r);
+        scratch[5].i = scratch[0].i + S_MUL(scratch[7].i,ya.r) + S_MUL(scratch[8].i,yb.r);
+
+        scratch[6].r =  S_MUL(scratch[10].i,ya.i) + S_MUL(scratch[9].i,yb.i);
+        scratch[6].i = -S_MUL(scratch[10].r,ya.i) - S_MUL(scratch[9].r,yb.i);
+
+        C_SUB(*Fout1,scratch[5],scratch[6]);
+        C_ADD(*Fout4,scratch[5],scratch[6]);
+
+        scratch[11].r = scratch[0].r + S_MUL(scratch[7].r,yb.r) + S_MUL(scratch[8].r,ya.r);
+        scratch[11].i = scratch[0].i + S_MUL(scratch[7].i,yb.r) + S_MUL(scratch[8].i,ya.r);
+        scratch[12].r = - S_MUL(scratch[10].i,yb.i) + S_MUL(scratch[9].i,ya.i);
+        scratch[12].i = S_MUL(scratch[10].r,yb.i) - S_MUL(scratch[9].r,ya.i);
+
+        C_ADD(*Fout2,scratch[11],scratch[12]);
+        C_SUB(*Fout3,scratch[11],scratch[12]);
+
+        ++Fout0;++Fout1;++Fout2;++Fout3;++Fout4;
+    }
+}
+
+/* perform the butterfly for one stage of a mixed radix FFT */
+static void kf_bfly_generic(
+        kiss_fft_f32_cpx * Fout,
+        const size_t fstride,
+        const kiss_fft_f32_cfg st,
+        int m,
+        int p
+        )
+{
+    int u,k,q1,q;
+    kiss_fft_f32_cpx * twiddles = st->twiddles;
+    kiss_fft_f32_cpx t;
+    int Norig = st->nfft;
+
+    CHECKBUF(scratchbuf,nscratchbuf,p);
+
+    for ( u=0; u<m; ++u ) {
+        k=u;
+        for ( q1=0 ; q1<p ; ++q1 ) {
+            scratchbuf[q1] = Fout[ k  ];
+            C_FIXDIV(scratchbuf[q1],p);
+            k += m;
+        }
+
+        k=u;
+        for ( q1=0 ; q1<p ; ++q1 ) {
+            int twidx=0;
+            Fout[ k ] = scratchbuf[0];
+            for (q=1;q<p;++q ) {
+                twidx += fstride * k;
+                if (twidx>=Norig) twidx-=Norig;
+                C_MUL(t,scratchbuf[q] , twiddles[twidx] );
+                C_ADDTO( Fout[ k ] ,t);
+            }
+            k += m;
+        }
+    }
+}
+
+static
+void kf_work(
+        kiss_fft_f32_cpx * Fout,
+        const kiss_fft_f32_cpx * f,
+        const size_t fstride,
+        int in_stride,
+        int * factors,
+        const kiss_fft_f32_cfg st
+        )
+{
+    kiss_fft_f32_cpx * Fout_beg=Fout;
+    const int p=*factors++; /* the radix  */
+    const int m=*factors++; /* stage's fft length/p */
+    const kiss_fft_f32_cpx * Fout_end = Fout + p*m;
+
+    if (m==1) {
+        do{
+            *Fout = *f;
+            f += fstride*in_stride;
+        }while(++Fout != Fout_end );
+    }else{
+        do{
+            kf_work( Fout , f, fstride*p, in_stride, factors,st);
+            f += fstride*in_stride;
+        }while( (Fout += m) != Fout_end );
+    }
+
+    Fout=Fout_beg;
+
+    switch (p) {
+        case 2: kf_bfly2(Fout,fstride,st,m); break;
+        case 3: kf_bfly3(Fout,fstride,st,m); break; 
+        case 4: kf_bfly4(Fout,fstride,st,m); break;
+        case 5: kf_bfly5(Fout,fstride,st,m); break; 
+        default: kf_bfly_generic(Fout,fstride,st,m,p); break;
+    }
+}
+
+/*  facbuf is populated by p1,m1,p2,m2, ...
+    where 
+    p[i] * m[i] = m[i-1]
+    m0 = n                  */
+static 
+void kf_factor(int n,int * facbuf)
+{
+    int p=4;
+    double floor_sqrt;
+    floor_sqrt = floor( sqrt((double)n) );
+
+    /*factor out powers of 4, powers of 2, then any remaining primes */
+    do {
+        while (n % p) {
+            switch (p) {
+                case 4: p = 2; break;
+                case 2: p = 3; break;
+                default: p += 2; break;
+            }
+            if (p > floor_sqrt)
+                p = n;          /* no more factors, skip to end */
+        }
+        n /= p;
+        *facbuf++ = p;
+        *facbuf++ = n;
+    } while (n > 1);
+}
+
+/*
+ *
+ * User-callable function to allocate all necessary storage space for the fft.
+ *
+ * The return value is a contiguous block of memory, allocated with malloc.  As such,
+ * It can be freed with free(), rather than a kiss_fft-specific function.
+ * */
+kiss_fft_f32_cfg kiss_fft_f32_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem )
+{
+    kiss_fft_f32_cfg st=NULL;
+    size_t memneeded = sizeof(struct kiss_fft_f32_state)
+        + sizeof(kiss_fft_f32_cpx)*(nfft-1); /* twiddle factors*/
+
+    if ( lenmem==NULL ) {
+        st = ( kiss_fft_f32_cfg)KISS_FFT_F32_MALLOC( memneeded );
+    }else{
+        if (mem != NULL && *lenmem >= memneeded)
+            st = (kiss_fft_f32_cfg)mem;
+        *lenmem = memneeded;
+    }
+    if (st) {
+        int i;
+        st->nfft=nfft;
+        st->inverse = inverse_fft;
+
+        for (i=0;i<nfft;++i) {
+            const double pi=3.141592653589793238462643383279502884197169399375105820974944;
+            double phase = -2*pi*i / nfft;
+            if (st->inverse)
+                phase *= -1;
+            kf_cexp(st->twiddles+i, phase );
+        }
+
+        kf_factor(nfft,st->factors);
+    }
+    return st;
+}
+
+
+
+    
+void kiss_fft_f32_stride(kiss_fft_f32_cfg st,const kiss_fft_f32_cpx *fin,kiss_fft_f32_cpx *fout,int in_stride)
+{
+    if (fin == fout) {
+        CHECKBUF(tmpbuf,ntmpbuf,st->nfft);
+        kf_work(tmpbuf,fin,1,in_stride, st->factors,st);
+        memcpy(fout,tmpbuf,sizeof(kiss_fft_f32_cpx)*st->nfft);
+    }else{
+        kf_work( fout, fin, 1,in_stride, st->factors,st );
+    }
+}
+
+void kiss_fft_f32(kiss_fft_f32_cfg cfg,const kiss_fft_f32_cpx *fin,kiss_fft_f32_cpx *fout)
+{
+    kiss_fft_f32_stride(cfg,fin,fout,1);
+}
+
+
+/* not really necessary to call, but if someone is doing in-place ffts, they may want to free the 
+   buffers from CHECKBUF
+ */ 
+void kiss_fft_f32_cleanup(void)
+{
+    free(scratchbuf);
+    scratchbuf = NULL;
+    nscratchbuf=0;
+    free(tmpbuf);
+    tmpbuf=NULL;
+    ntmpbuf=0;
+}
+
+int kiss_fft_f32_next_fast_size(int n)
+{
+    while(1) {
+        int m=n;
+        while ( (m%2) == 0 ) m/=2;
+        while ( (m%3) == 0 ) m/=3;
+        while ( (m%5) == 0 ) m/=5;
+        if (m<=1)
+            break; /* n is completely factorable by twos, threes, and fives */
+        n++;
+    }
+    return n;
+}
--- /dev/null	2007-08-16 07:48:53.000000000 +0200
+++ gst-libs/gst/fft/kiss_fft_f64.c	2007-08-20 19:14:55.000000000 +0200
@@ -0,0 +1,399 @@
+/*
+Copyright (c) 2003-2004, Mark Borgerding
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+    * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#include "_kiss_fft_guts_f64.h"
+/* The guts header contains all the multiplication and addition macros that are defined for
+ fixed or floating point complex numbers.  It also delares the kf_ internal functions.
+ */
+
+static kiss_fft_f64_cpx *scratchbuf=NULL;
+static size_t nscratchbuf=0;
+static kiss_fft_f64_cpx *tmpbuf=NULL;
+static size_t ntmpbuf=0;
+
+#define CHECKBUF(buf,nbuf,n) \
+    do { \
+        if ( nbuf < (size_t)(n) ) {\
+            free(buf); \
+            buf = (kiss_fft_f64_cpx*)KISS_FFT_F64_MALLOC(sizeof(kiss_fft_f64_cpx)*(n)); \
+            nbuf = (size_t)(n); \
+        } \
+   }while(0)
+
+
+static void kf_bfly2(
+        kiss_fft_f64_cpx * Fout,
+        const size_t fstride,
+        const kiss_fft_f64_cfg st,
+        int m
+        )
+{
+    kiss_fft_f64_cpx * Fout2;
+    kiss_fft_f64_cpx * tw1 = st->twiddles;
+    kiss_fft_f64_cpx t;
+    Fout2 = Fout + m;
+    do{
+        C_FIXDIV(*Fout,2); C_FIXDIV(*Fout2,2);
+
+        C_MUL (t,  *Fout2 , *tw1);
+        tw1 += fstride;
+        C_SUB( *Fout2 ,  *Fout , t );
+        C_ADDTO( *Fout ,  t );
+        ++Fout2;
+        ++Fout;
+    }while (--m);
+}
+
+static void kf_bfly4(
+        kiss_fft_f64_cpx * Fout,
+        const size_t fstride,
+        const kiss_fft_f64_cfg st,
+        const size_t m
+        )
+{
+    kiss_fft_f64_cpx *tw1,*tw2,*tw3;
+    kiss_fft_f64_cpx scratch[6];
+    size_t k=m;
+    const size_t m2=2*m;
+    const size_t m3=3*m;
+
+    tw3 = tw2 = tw1 = st->twiddles;
+
+    do {
+        C_FIXDIV(*Fout,4); C_FIXDIV(Fout[m],4); C_FIXDIV(Fout[m2],4); C_FIXDIV(Fout[m3],4);
+
+        C_MUL(scratch[0],Fout[m] , *tw1 );
+        C_MUL(scratch[1],Fout[m2] , *tw2 );
+        C_MUL(scratch[2],Fout[m3] , *tw3 );
+
+        C_SUB( scratch[5] , *Fout, scratch[1] );
+        C_ADDTO(*Fout, scratch[1]);
+        C_ADD( scratch[3] , scratch[0] , scratch[2] );
+        C_SUB( scratch[4] , scratch[0] , scratch[2] );
+        C_SUB( Fout[m2], *Fout, scratch[3] );
+        tw1 += fstride;
+        tw2 += fstride*2;
+        tw3 += fstride*3;
+        C_ADDTO( *Fout , scratch[3] );
+
+        if(st->inverse) {
+            Fout[m].r = scratch[5].r - scratch[4].i;
+            Fout[m].i = scratch[5].i + scratch[4].r;
+            Fout[m3].r = scratch[5].r + scratch[4].i;
+            Fout[m3].i = scratch[5].i - scratch[4].r;
+        }else{
+            Fout[m].r = scratch[5].r + scratch[4].i;
+            Fout[m].i = scratch[5].i - scratch[4].r;
+            Fout[m3].r = scratch[5].r - scratch[4].i;
+            Fout[m3].i = scratch[5].i + scratch[4].r;
+        }
+        ++Fout;
+    }while(--k);
+}
+
+static void kf_bfly3(
+         kiss_fft_f64_cpx * Fout,
+         const size_t fstride,
+         const kiss_fft_f64_cfg st,
+         size_t m
+         )
+{
+     size_t k=m;
+     const size_t m2 = 2*m;
+     kiss_fft_f64_cpx *tw1,*tw2;
+     kiss_fft_f64_cpx scratch[5];
+     kiss_fft_f64_cpx epi3;
+     epi3 = st->twiddles[fstride*m];
+
+     tw1=tw2=st->twiddles;
+
+     do{
+         C_FIXDIV(*Fout,3); C_FIXDIV(Fout[m],3); C_FIXDIV(Fout[m2],3);
+
+         C_MUL(scratch[1],Fout[m] , *tw1);
+         C_MUL(scratch[2],Fout[m2] , *tw2);
+
+         C_ADD(scratch[3],scratch[1],scratch[2]);
+         C_SUB(scratch[0],scratch[1],scratch[2]);
+         tw1 += fstride;
+         tw2 += fstride*2;
+
+         Fout[m].r = Fout->r - HALF_OF(scratch[3].r);
+         Fout[m].i = Fout->i - HALF_OF(scratch[3].i);
+
+         C_MULBYSCALAR( scratch[0] , epi3.i );
+
+         C_ADDTO(*Fout,scratch[3]);
+
+         Fout[m2].r = Fout[m].r + scratch[0].i;
+         Fout[m2].i = Fout[m].i - scratch[0].r;
+
+         Fout[m].r -= scratch[0].i;
+         Fout[m].i += scratch[0].r;
+
+         ++Fout;
+     }while(--k);
+}
+
+static void kf_bfly5(
+        kiss_fft_f64_cpx * Fout,
+        const size_t fstride,
+        const kiss_fft_f64_cfg st,
+        int m
+        )
+{
+    kiss_fft_f64_cpx *Fout0,*Fout1,*Fout2,*Fout3,*Fout4;
+    int u;
+    kiss_fft_f64_cpx scratch[13];
+    kiss_fft_f64_cpx * twiddles = st->twiddles;
+    kiss_fft_f64_cpx *tw;
+    kiss_fft_f64_cpx ya,yb;
+    ya = twiddles[fstride*m];
+    yb = twiddles[fstride*2*m];
+
+    Fout0=Fout;
+    Fout1=Fout0+m;
+    Fout2=Fout0+2*m;
+    Fout3=Fout0+3*m;
+    Fout4=Fout0+4*m;
+
+    tw=st->twiddles;
+    for ( u=0; u<m; ++u ) {
+        C_FIXDIV( *Fout0,5); C_FIXDIV( *Fout1,5); C_FIXDIV( *Fout2,5); C_FIXDIV( *Fout3,5); C_FIXDIV( *Fout4,5);
+        scratch[0] = *Fout0;
+
+        C_MUL(scratch[1] ,*Fout1, tw[u*fstride]);
+        C_MUL(scratch[2] ,*Fout2, tw[2*u*fstride]);
+        C_MUL(scratch[3] ,*Fout3, tw[3*u*fstride]);
+        C_MUL(scratch[4] ,*Fout4, tw[4*u*fstride]);
+
+        C_ADD( scratch[7],scratch[1],scratch[4]);
+        C_SUB( scratch[10],scratch[1],scratch[4]);
+        C_ADD( scratch[8],scratch[2],scratch[3]);
+        C_SUB( scratch[9],scratch[2],scratch[3]);
+
+        Fout0->r += scratch[7].r + scratch[8].r;
+        Fout0->i += scratch[7].i + scratch[8].i;
+
+        scratch[5].r = scratch[0].r + S_MUL(scratch[7].r,ya.r) + S_MUL(scratch[8].r,yb.r);
+        scratch[5].i = scratch[0].i + S_MUL(scratch[7].i,ya.r) + S_MUL(scratch[8].i,yb.r);
+
+        scratch[6].r =  S_MUL(scratch[10].i,ya.i) + S_MUL(scratch[9].i,yb.i);
+        scratch[6].i = -S_MUL(scratch[10].r,ya.i) - S_MUL(scratch[9].r,yb.i);
+
+        C_SUB(*Fout1,scratch[5],scratch[6]);
+        C_ADD(*Fout4,scratch[5],scratch[6]);
+
+        scratch[11].r = scratch[0].r + S_MUL(scratch[7].r,yb.r) + S_MUL(scratch[8].r,ya.r);
+        scratch[11].i = scratch[0].i + S_MUL(scratch[7].i,yb.r) + S_MUL(scratch[8].i,ya.r);
+        scratch[12].r = - S_MUL(scratch[10].i,yb.i) + S_MUL(scratch[9].i,ya.i);
+        scratch[12].i = S_MUL(scratch[10].r,yb.i) - S_MUL(scratch[9].r,ya.i);
+
+        C_ADD(*Fout2,scratch[11],scratch[12]);
+        C_SUB(*Fout3,scratch[11],scratch[12]);
+
+        ++Fout0;++Fout1;++Fout2;++Fout3;++Fout4;
+    }
+}
+
+/* perform the butterfly for one stage of a mixed radix FFT */
+static void kf_bfly_generic(
+        kiss_fft_f64_cpx * Fout,
+        const size_t fstride,
+        const kiss_fft_f64_cfg st,
+        int m,
+        int p
+        )
+{
+    int u,k,q1,q;
+    kiss_fft_f64_cpx * twiddles = st->twiddles;
+    kiss_fft_f64_cpx t;
+    int Norig = st->nfft;
+
+    CHECKBUF(scratchbuf,nscratchbuf,p);
+
+    for ( u=0; u<m; ++u ) {
+        k=u;
+        for ( q1=0 ; q1<p ; ++q1 ) {
+            scratchbuf[q1] = Fout[ k  ];
+            C_FIXDIV(scratchbuf[q1],p);
+            k += m;
+        }
+
+        k=u;
+        for ( q1=0 ; q1<p ; ++q1 ) {
+            int twidx=0;
+            Fout[ k ] = scratchbuf[0];
+            for (q=1;q<p;++q ) {
+                twidx += fstride * k;
+                if (twidx>=Norig) twidx-=Norig;
+                C_MUL(t,scratchbuf[q] , twiddles[twidx] );
+                C_ADDTO( Fout[ k ] ,t);
+            }
+            k += m;
+        }
+    }
+}
+
+static
+void kf_work(
+        kiss_fft_f64_cpx * Fout,
+        const kiss_fft_f64_cpx * f,
+        const size_t fstride,
+        int in_stride,
+        int * factors,
+        const kiss_fft_f64_cfg st
+        )
+{
+    kiss_fft_f64_cpx * Fout_beg=Fout;
+    const int p=*factors++; /* the radix  */
+    const int m=*factors++; /* stage's fft length/p */
+    const kiss_fft_f64_cpx * Fout_end = Fout + p*m;
+
+    if (m==1) {
+        do{
+            *Fout = *f;
+            f += fstride*in_stride;
+        }while(++Fout != Fout_end );
+    }else{
+        do{
+            kf_work( Fout , f, fstride*p, in_stride, factors,st);
+            f += fstride*in_stride;
+        }while( (Fout += m) != Fout_end );
+    }
+
+    Fout=Fout_beg;
+
+    switch (p) {
+        case 2: kf_bfly2(Fout,fstride,st,m); break;
+        case 3: kf_bfly3(Fout,fstride,st,m); break; 
+        case 4: kf_bfly4(Fout,fstride,st,m); break;
+        case 5: kf_bfly5(Fout,fstride,st,m); break; 
+        default: kf_bfly_generic(Fout,fstride,st,m,p); break;
+    }
+}
+
+/*  facbuf is populated by p1,m1,p2,m2, ...
+    where 
+    p[i] * m[i] = m[i-1]
+    m0 = n                  */
+static 
+void kf_factor(int n,int * facbuf)
+{
+    int p=4;
+    double floor_sqrt;
+    floor_sqrt = floor( sqrt((double)n) );
+
+    /*factor out powers of 4, powers of 2, then any remaining primes */
+    do {
+        while (n % p) {
+            switch (p) {
+                case 4: p = 2; break;
+                case 2: p = 3; break;
+                default: p += 2; break;
+            }
+            if (p > floor_sqrt)
+                p = n;          /* no more factors, skip to end */
+        }
+        n /= p;
+        *facbuf++ = p;
+        *facbuf++ = n;
+    } while (n > 1);
+}
+
+/*
+ *
+ * User-callable function to allocate all necessary storage space for the fft.
+ *
+ * The return value is a contiguous block of memory, allocated with malloc.  As such,
+ * It can be freed with free(), rather than a kiss_fft-specific function.
+ * */
+kiss_fft_f64_cfg kiss_fft_f64_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem )
+{
+    kiss_fft_f64_cfg st=NULL;
+    size_t memneeded = sizeof(struct kiss_fft_f64_state)
+        + sizeof(kiss_fft_f64_cpx)*(nfft-1); /* twiddle factors*/
+
+    if ( lenmem==NULL ) {
+        st = ( kiss_fft_f64_cfg)KISS_FFT_F64_MALLOC( memneeded );
+    }else{
+        if (mem != NULL && *lenmem >= memneeded)
+            st = (kiss_fft_f64_cfg)mem;
+        *lenmem = memneeded;
+    }
+    if (st) {
+        int i;
+        st->nfft=nfft;
+        st->inverse = inverse_fft;
+
+        for (i=0;i<nfft;++i) {
+            const double pi=3.141592653589793238462643383279502884197169399375105820974944;
+            double phase = -2*pi*i / nfft;
+            if (st->inverse)
+                phase *= -1;
+            kf_cexp(st->twiddles+i, phase );
+        }
+
+        kf_factor(nfft,st->factors);
+    }
+    return st;
+}
+
+
+
+    
+void kiss_fft_f64_stride(kiss_fft_f64_cfg st,const kiss_fft_f64_cpx *fin,kiss_fft_f64_cpx *fout,int in_stride)
+{
+    if (fin == fout) {
+        CHECKBUF(tmpbuf,ntmpbuf,st->nfft);
+        kf_work(tmpbuf,fin,1,in_stride, st->factors,st);
+        memcpy(fout,tmpbuf,sizeof(kiss_fft_f64_cpx)*st->nfft);
+    }else{
+        kf_work( fout, fin, 1,in_stride, st->factors,st );
+    }
+}
+
+void kiss_fft_f64(kiss_fft_f64_cfg cfg,const kiss_fft_f64_cpx *fin,kiss_fft_f64_cpx *fout)
+{
+    kiss_fft_f64_stride(cfg,fin,fout,1);
+}
+
+
+/* not really necessary to call, but if someone is doing in-place ffts, they may want to free the 
+   buffers from CHECKBUF
+ */ 
+void kiss_fft_f64_cleanup(void)
+{
+    free(scratchbuf);
+    scratchbuf = NULL;
+    nscratchbuf=0;
+    free(tmpbuf);
+    tmpbuf=NULL;
+    ntmpbuf=0;
+}
+
+int kiss_fft_f64_next_fast_size(int n)
+{
+    while(1) {
+        int m=n;
+        while ( (m%2) == 0 ) m/=2;
+        while ( (m%3) == 0 ) m/=3;
+        while ( (m%5) == 0 ) m/=5;
+        if (m<=1)
+            break; /* n is completely factorable by twos, threes, and fives */
+        n++;
+    }
+    return n;
+}
--- /dev/null	2007-08-16 07:48:53.000000000 +0200
+++ gst-libs/gst/fft/kiss_fftr_f32.c	2007-08-20 19:14:55.000000000 +0200
@@ -0,0 +1,159 @@
+/*
+Copyright (c) 2003-2004, Mark Borgerding
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+    * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "kiss_fftr_f32.h"
+#include "_kiss_fft_guts_f32.h"
+
+struct kiss_fftr_f32_state{
+    kiss_fft_f32_cfg substate;
+    kiss_fft_f32_cpx * tmpbuf;
+    kiss_fft_f32_cpx * super_twiddles;
+#ifdef USE_SIMD    
+    long pad;
+#endif    
+};
+
+kiss_fftr_f32_cfg kiss_fftr_f32_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem)
+{
+    int i;
+    kiss_fftr_f32_cfg st = NULL;
+    size_t subsize, memneeded;
+
+    if (nfft & 1) {
+        fprintf(stderr,"Real FFT optimization must be even.\n");
+        return NULL;
+    }
+    nfft >>= 1;
+
+    kiss_fft_f32_alloc (nfft, inverse_fft, NULL, &subsize);
+    memneeded = sizeof(struct kiss_fftr_f32_state) + subsize + sizeof(kiss_fft_f32_cpx) * ( nfft * 2);
+
+    if (lenmem == NULL) {
+        st = (kiss_fftr_f32_cfg) KISS_FFT_F32_MALLOC (memneeded);
+    } else {
+        if (*lenmem >= memneeded)
+            st = (kiss_fftr_f32_cfg) mem;
+        *lenmem = memneeded;
+    }
+    if (!st)
+        return NULL;
+
+    st->substate = (kiss_fft_f32_cfg) (st + 1); /*just beyond kiss_fftr_f32_state struct */
+    st->tmpbuf = (kiss_fft_f32_cpx *) (((char *) st->substate) + subsize);
+    st->super_twiddles = st->tmpbuf + nfft;
+    kiss_fft_f32_alloc(nfft, inverse_fft, st->substate, &subsize);
+
+    for (i = 0; i < nfft; ++i) {
+        double phase =
+            -3.14159265358979323846264338327 * ((double) i / nfft + .5);
+        if (inverse_fft)
+            phase *= -1;
+        kf_cexp (st->super_twiddles+i,phase);
+    }
+    return st;
+}
+
+void kiss_fftr_f32(kiss_fftr_f32_cfg st,const kiss_fft_f32_scalar *timedata,kiss_fft_f32_cpx *freqdata)
+{
+    /* input buffer timedata is stored row-wise */
+    int k,ncfft;
+    kiss_fft_f32_cpx fpnk,fpk,f1k,f2k,tw,tdc;
+
+    if ( st->substate->inverse) {
+        fprintf(stderr,"kiss fft usage error: improper alloc\n");
+        exit(1);
+    }
+
+    ncfft = st->substate->nfft;
+
+    /*perform the parallel fft of two real signals packed in real,imag*/
+    kiss_fft_f32( st->substate , (const kiss_fft_f32_cpx*)timedata, st->tmpbuf );
+    /* The real part of the DC element of the frequency spectrum in st->tmpbuf
+     * contains the sum of the even-numbered elements of the input time sequence
+     * The imag part is the sum of the odd-numbered elements
+     *
+     * The sum of tdc.r and tdc.i is the sum of the input time sequence. 
+     *      yielding DC of input time sequence
+     * The difference of tdc.r - tdc.i is the sum of the input (dot product) [1,-1,1,-1... 
+     *      yielding Nyquist bin of input time sequence
+     */
+ 
+    tdc.r = st->tmpbuf[0].r;
+    tdc.i = st->tmpbuf[0].i;
+    C_FIXDIV(tdc,2);
+    CHECK_OVERFLOW_OP(tdc.r ,+, tdc.i);
+    CHECK_OVERFLOW_OP(tdc.r ,-, tdc.i);
+    freqdata[0].r = tdc.r + tdc.i;
+    freqdata[ncfft].r = tdc.r - tdc.i;
+#ifdef USE_SIMD    
+    freqdata[ncfft].i = freqdata[0].i = _mm_set1_ps(0);
+#else
+    freqdata[ncfft].i = freqdata[0].i = 0;
+#endif
+
+    for ( k=1;k <= ncfft/2 ; ++k ) {
+        fpk    = st->tmpbuf[k]; 
+        fpnk.r =   st->tmpbuf[ncfft-k].r;
+        fpnk.i = - st->tmpbuf[ncfft-k].i;
+        C_FIXDIV(fpk,2);
+        C_FIXDIV(fpnk,2);
+
+        C_ADD( f1k, fpk , fpnk );
+        C_SUB( f2k, fpk , fpnk );
+        C_MUL( tw , f2k , st->super_twiddles[k]);
+
+        freqdata[k].r = HALF_OF(f1k.r + tw.r);
+        freqdata[k].i = HALF_OF(f1k.i + tw.i);
+        freqdata[ncfft-k].r = HALF_OF(f1k.r - tw.r);
+        freqdata[ncfft-k].i = HALF_OF(tw.i - f1k.i);
+    }
+}
+
+void kiss_fftri_f32(kiss_fftr_f32_cfg st,const kiss_fft_f32_cpx *freqdata,kiss_fft_f32_scalar *timedata)
+{
+    /* input buffer timedata is stored row-wise */
+    int k, ncfft;
+
+    if (st->substate->inverse == 0) {
+        fprintf (stderr, "kiss fft usage error: improper alloc\n");
+        exit (1);
+    }
+
+    ncfft = st->substate->nfft;
+
+    st->tmpbuf[0].r = freqdata[0].r + freqdata[ncfft].r;
+    st->tmpbuf[0].i = freqdata[0].r - freqdata[ncfft].r;
+    C_FIXDIV(st->tmpbuf[0],2);
+
+    for (k = 1; k <= ncfft / 2; ++k) {
+        kiss_fft_f32_cpx fk, fnkc, fek, fok, tmp;
+        fk = freqdata[k];
+        fnkc.r = freqdata[ncfft - k].r;
+        fnkc.i = -freqdata[ncfft - k].i;
+        C_FIXDIV( fk , 2 );
+        C_FIXDIV( fnkc , 2 );
+
+        C_ADD (fek, fk, fnkc);
+        C_SUB (tmp, fk, fnkc);
+        C_MUL (fok, tmp, st->super_twiddles[k]);
+        C_ADD (st->tmpbuf[k],     fek, fok);
+        C_SUB (st->tmpbuf[ncfft - k], fek, fok);
+#ifdef USE_SIMD        
+        st->tmpbuf[ncfft - k].i *= _mm_set1_ps(-1.0);
+#else
+        st->tmpbuf[ncfft - k].i *= -1;
+#endif
+    }
+    kiss_fft_f32 (st->substate, st->tmpbuf, (kiss_fft_f32_cpx *) timedata);
+}
--- /dev/null	2007-08-16 07:48:53.000000000 +0200
+++ gst-libs/gst/fft/kiss_fftr_f64.c	2007-08-20 19:14:55.000000000 +0200
@@ -0,0 +1,159 @@
+/*
+Copyright (c) 2003-2004, Mark Borgerding
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+    * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "kiss_fftr_f64.h"
+#include "_kiss_fft_guts_f64.h"
+
+struct kiss_fftr_f64_state{
+    kiss_fft_f64_cfg substate;
+    kiss_fft_f64_cpx * tmpbuf;
+    kiss_fft_f64_cpx * super_twiddles;
+#ifdef USE_SIMD    
+    long pad;
+#endif    
+};
+
+kiss_fftr_f64_cfg kiss_fftr_f64_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem)
+{
+    int i;
+    kiss_fftr_f64_cfg st = NULL;
+    size_t subsize, memneeded;
+
+    if (nfft & 1) {
+        fprintf(stderr,"Real FFT optimization must be even.\n");
+        return NULL;
+    }
+    nfft >>= 1;
+
+    kiss_fft_f64_alloc (nfft, inverse_fft, NULL, &subsize);
+    memneeded = sizeof(struct kiss_fftr_f64_state) + subsize + sizeof(kiss_fft_f64_cpx) * ( nfft * 2);
+
+    if (lenmem == NULL) {
+        st = (kiss_fftr_f64_cfg) KISS_FFT_F64_MALLOC (memneeded);
+    } else {
+        if (*lenmem >= memneeded)
+            st = (kiss_fftr_f64_cfg) mem;
+        *lenmem = memneeded;
+    }
+    if (!st)
+        return NULL;
+
+    st->substate = (kiss_fft_f64_cfg) (st + 1); /*just beyond kiss_fftr_f64_state struct */
+    st->tmpbuf = (kiss_fft_f64_cpx *) (((char *) st->substate) + subsize);
+    st->super_twiddles = st->tmpbuf + nfft;
+    kiss_fft_f64_alloc(nfft, inverse_fft, st->substate, &subsize);
+
+    for (i = 0; i < nfft; ++i) {
+        double phase =
+            -3.14159265358979323846264338327 * ((double) i / nfft + .5);
+        if (inverse_fft)
+            phase *= -1;
+        kf_cexp (st->super_twiddles+i,phase);
+    }
+    return st;
+}
+
+void kiss_fftr_f64(kiss_fftr_f64_cfg st,const kiss_fft_f64_scalar *timedata,kiss_fft_f64_cpx *freqdata)
+{
+    /* input buffer timedata is stored row-wise */
+    int k,ncfft;
+    kiss_fft_f64_cpx fpnk,fpk,f1k,f2k,tw,tdc;
+
+    if ( st->substate->inverse) {
+        fprintf(stderr,"kiss fft usage error: improper alloc\n");
+        exit(1);
+    }
+
+    ncfft = st->substate->nfft;
+
+    /*perform the parallel fft of two real signals packed in real,imag*/
+    kiss_fft_f64( st->substate , (const kiss_fft_f64_cpx*)timedata, st->tmpbuf );
+    /* The real part of the DC element of the frequency spectrum in st->tmpbuf
+     * contains the sum of the even-numbered elements of the input time sequence
+     * The imag part is the sum of the odd-numbered elements
+     *
+     * The sum of tdc.r and tdc.i is the sum of the input time sequence. 
+     *      yielding DC of input time sequence
+     * The difference of tdc.r - tdc.i is the sum of the input (dot product) [1,-1,1,-1... 
+     *      yielding Nyquist bin of input time sequence
+     */
+ 
+    tdc.r = st->tmpbuf[0].r;
+    tdc.i = st->tmpbuf[0].i;
+    C_FIXDIV(tdc,2);
+    CHECK_OVERFLOW_OP(tdc.r ,+, tdc.i);
+    CHECK_OVERFLOW_OP(tdc.r ,-, tdc.i);
+    freqdata[0].r = tdc.r + tdc.i;
+    freqdata[ncfft].r = tdc.r - tdc.i;
+#ifdef USE_SIMD    
+    freqdata[ncfft].i = freqdata[0].i = _mm_set1_ps(0);
+#else
+    freqdata[ncfft].i = freqdata[0].i = 0;
+#endif
+
+    for ( k=1;k <= ncfft/2 ; ++k ) {
+        fpk    = st->tmpbuf[k]; 
+        fpnk.r =   st->tmpbuf[ncfft-k].r;
+        fpnk.i = - st->tmpbuf[ncfft-k].i;
+        C_FIXDIV(fpk,2);
+        C_FIXDIV(fpnk,2);
+
+        C_ADD( f1k, fpk , fpnk );
+        C_SUB( f2k, fpk , fpnk );
+        C_MUL( tw , f2k , st->super_twiddles[k]);
+
+        freqdata[k].r = HALF_OF(f1k.r + tw.r);
+        freqdata[k].i = HALF_OF(f1k.i + tw.i);
+        freqdata[ncfft-k].r = HALF_OF(f1k.r - tw.r);
+        freqdata[ncfft-k].i = HALF_OF(tw.i - f1k.i);
+    }
+}
+
+void kiss_fftri_f64(kiss_fftr_f64_cfg st,const kiss_fft_f64_cpx *freqdata,kiss_fft_f64_scalar *timedata)
+{
+    /* input buffer timedata is stored row-wise */
+    int k, ncfft;
+
+    if (st->substate->inverse == 0) {
+        fprintf (stderr, "kiss fft usage error: improper alloc\n");
+        exit (1);
+    }
+
+    ncfft = st->substate->nfft;
+
+    st->tmpbuf[0].r = freqdata[0].r + freqdata[ncfft].r;
+    st->tmpbuf[0].i = freqdata[0].r - freqdata[ncfft].r;
+    C_FIXDIV(st->tmpbuf[0],2);
+
+    for (k = 1; k <= ncfft / 2; ++k) {
+        kiss_fft_f64_cpx fk, fnkc, fek, fok, tmp;
+        fk = freqdata[k];
+        fnkc.r = freqdata[ncfft - k].r;
+        fnkc.i = -freqdata[ncfft - k].i;
+        C_FIXDIV( fk , 2 );
+        C_FIXDIV( fnkc , 2 );
+
+        C_ADD (fek, fk, fnkc);
+        C_SUB (tmp, fk, fnkc);
+        C_MUL (fok, tmp, st->super_twiddles[k]);
+        C_ADD (st->tmpbuf[k],     fek, fok);
+        C_SUB (st->tmpbuf[ncfft - k], fek, fok);
+#ifdef USE_SIMD        
+        st->tmpbuf[ncfft - k].i *= _mm_set1_ps(-1.0);
+#else
+        st->tmpbuf[ncfft - k].i *= -1;
+#endif
+    }
+    kiss_fft_f64 (st->substate, st->tmpbuf, (kiss_fft_f64_cpx *) timedata);
+}
--- /dev/null	2007-08-16 07:48:53.000000000 +0200
+++ gst-libs/gst/fft/kiss_fftr_s16.c	2007-08-20 19:14:55.000000000 +0200
@@ -0,0 +1,159 @@
+/*
+Copyright (c) 2003-2004, Mark Borgerding
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+    * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "kiss_fftr_s16.h"
+#include "_kiss_fft_guts_s16.h"
+
+struct kiss_fftr_s16_state{
+    kiss_fft_s16_cfg substate;
+    kiss_fft_s16_cpx * tmpbuf;
+    kiss_fft_s16_cpx * super_twiddles;
+#ifdef USE_SIMD    
+    long pad;
+#endif    
+};
+
+kiss_fftr_s16_cfg kiss_fftr_s16_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem)
+{
+    int i;
+    kiss_fftr_s16_cfg st = NULL;
+    size_t subsize, memneeded;
+
+    if (nfft & 1) {
+        fprintf(stderr,"Real FFT optimization must be even.\n");
+        return NULL;
+    }
+    nfft >>= 1;
+
+    kiss_fft_s16_alloc (nfft, inverse_fft, NULL, &subsize);
+    memneeded = sizeof(struct kiss_fftr_s16_state) + subsize + sizeof(kiss_fft_s16_cpx) * ( nfft * 2);
+
+    if (lenmem == NULL) {
+        st = (kiss_fftr_s16_cfg) KISS_FFT_S16_MALLOC (memneeded);
+    } else {
+        if (*lenmem >= memneeded)
+            st = (kiss_fftr_s16_cfg) mem;
+        *lenmem = memneeded;
+    }
+    if (!st)
+        return NULL;
+
+    st->substate = (kiss_fft_s16_cfg) (st + 1); /*just beyond kiss_fftr_s16_state struct */
+    st->tmpbuf = (kiss_fft_s16_cpx *) (((char *) st->substate) + subsize);
+    st->super_twiddles = st->tmpbuf + nfft;
+    kiss_fft_s16_alloc(nfft, inverse_fft, st->substate, &subsize);
+
+    for (i = 0; i < nfft; ++i) {
+        double phase =
+            -3.14159265358979323846264338327 * ((double) i / nfft + .5);
+        if (inverse_fft)
+            phase *= -1;
+        kf_cexp (st->super_twiddles+i,phase);
+    }
+    return st;
+}
+
+void kiss_fftr_s16(kiss_fftr_s16_cfg st,const kiss_fft_s16_scalar *timedata,kiss_fft_s16_cpx *freqdata)
+{
+    /* input buffer timedata is stored row-wise */
+    int k,ncfft;
+    kiss_fft_s16_cpx fpnk,fpk,f1k,f2k,tw,tdc;
+
+    if ( st->substate->inverse) {
+        fprintf(stderr,"kiss fft usage error: improper alloc\n");
+        exit(1);
+    }
+
+    ncfft = st->substate->nfft;
+
+    /*perform the parallel fft of two real signals packed in real,imag*/
+    kiss_fft_s16( st->substate , (const kiss_fft_s16_cpx*)timedata, st->tmpbuf );
+    /* The real part of the DC element of the frequency spectrum in st->tmpbuf
+     * contains the sum of the even-numbered elements of the input time sequence
+     * The imag part is the sum of the odd-numbered elements
+     *
+     * The sum of tdc.r and tdc.i is the sum of the input time sequence. 
+     *      yielding DC of input time sequence
+     * The difference of tdc.r - tdc.i is the sum of the input (dot product) [1,-1,1,-1... 
+     *      yielding Nyquist bin of input time sequence
+     */
+ 
+    tdc.r = st->tmpbuf[0].r;
+    tdc.i = st->tmpbuf[0].i;
+    C_FIXDIV(tdc,2);
+    CHECK_OVERFLOW_OP(tdc.r ,+, tdc.i);
+    CHECK_OVERFLOW_OP(tdc.r ,-, tdc.i);
+    freqdata[0].r = tdc.r + tdc.i;
+    freqdata[ncfft].r = tdc.r - tdc.i;
+#ifdef USE_SIMD    
+    freqdata[ncfft].i = freqdata[0].i = _mm_set1_ps(0);
+#else
+    freqdata[ncfft].i = freqdata[0].i = 0;
+#endif
+
+    for ( k=1;k <= ncfft/2 ; ++k ) {
+        fpk    = st->tmpbuf[k]; 
+        fpnk.r =   st->tmpbuf[ncfft-k].r;
+        fpnk.i = - st->tmpbuf[ncfft-k].i;
+        C_FIXDIV(fpk,2);
+        C_FIXDIV(fpnk,2);
+
+        C_ADD( f1k, fpk , fpnk );
+        C_SUB( f2k, fpk , fpnk );
+        C_MUL( tw , f2k , st->super_twiddles[k]);
+
+        freqdata[k].r = HALF_OF(f1k.r + tw.r);
+        freqdata[k].i = HALF_OF(f1k.i + tw.i);
+        freqdata[ncfft-k].r = HALF_OF(f1k.r - tw.r);
+        freqdata[ncfft-k].i = HALF_OF(tw.i - f1k.i);
+    }
+}
+
+void kiss_fftri_s16(kiss_fftr_s16_cfg st,const kiss_fft_s16_cpx *freqdata,kiss_fft_s16_scalar *timedata)
+{
+    /* input buffer timedata is stored row-wise */
+    int k, ncfft;
+
+    if (st->substate->inverse == 0) {
+        fprintf (stderr, "kiss fft usage error: improper alloc\n");
+        exit (1);
+    }
+
+    ncfft = st->substate->nfft;
+
+    st->tmpbuf[0].r = freqdata[0].r + freqdata[ncfft].r;
+    st->tmpbuf[0].i = freqdata[0].r - freqdata[ncfft].r;
+    C_FIXDIV(st->tmpbuf[0],2);
+
+    for (k = 1; k <= ncfft / 2; ++k) {
+        kiss_fft_s16_cpx fk, fnkc, fek, fok, tmp;
+        fk = freqdata[k];
+        fnkc.r = freqdata[ncfft - k].r;
+        fnkc.i = -freqdata[ncfft - k].i;
+        C_FIXDIV( fk , 2 );
+        C_FIXDIV( fnkc , 2 );
+
+        C_ADD (fek, fk, fnkc);
+        C_SUB (tmp, fk, fnkc);
+        C_MUL (fok, tmp, st->super_twiddles[k]);
+        C_ADD (st->tmpbuf[k],     fek, fok);
+        C_SUB (st->tmpbuf[ncfft - k], fek, fok);
+#ifdef USE_SIMD        
+        st->tmpbuf[ncfft - k].i *= _mm_set1_ps(-1.0);
+#else
+        st->tmpbuf[ncfft - k].i *= -1;
+#endif
+    }
+    kiss_fft_s16 (st->substate, st->tmpbuf, (kiss_fft_s16_cpx *) timedata);
+}
--- /dev/null	2007-08-16 07:48:53.000000000 +0200
+++ gst-libs/gst/fft/kiss_fftr_s32.c	2007-08-20 19:14:55.000000000 +0200
@@ -0,0 +1,159 @@
+/*
+Copyright (c) 2003-2004, Mark Borgerding
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+    * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "kiss_fftr_s32.h"
+#include "_kiss_fft_guts_s32.h"
+
+struct kiss_fftr_s32_state{
+    kiss_fft_s32_cfg substate;
+    kiss_fft_s32_cpx * tmpbuf;
+    kiss_fft_s32_cpx * super_twiddles;
+#ifdef USE_SIMD    
+    long pad;
+#endif    
+};
+
+kiss_fftr_s32_cfg kiss_fftr_s32_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem)
+{
+    int i;
+    kiss_fftr_s32_cfg st = NULL;
+    size_t subsize, memneeded;
+
+    if (nfft & 1) {
+        fprintf(stderr,"Real FFT optimization must be even.\n");
+        return NULL;
+    }
+    nfft >>= 1;
+
+    kiss_fft_s32_alloc (nfft, inverse_fft, NULL, &subsize);
+    memneeded = sizeof(struct kiss_fftr_s32_state) + subsize + sizeof(kiss_fft_s32_cpx) * ( nfft * 2);
+
+    if (lenmem == NULL) {
+        st = (kiss_fftr_s32_cfg) KISS_FFT_S32_MALLOC (memneeded);
+    } else {
+        if (*lenmem >= memneeded)
+            st = (kiss_fftr_s32_cfg) mem;
+        *lenmem = memneeded;
+    }
+    if (!st)
+        return NULL;
+
+    st->substate = (kiss_fft_s32_cfg) (st + 1); /*just beyond kiss_fftr_s32_state struct */
+    st->tmpbuf = (kiss_fft_s32_cpx *) (((char *) st->substate) + subsize);
+    st->super_twiddles = st->tmpbuf + nfft;
+    kiss_fft_s32_alloc(nfft, inverse_fft, st->substate, &subsize);
+
+    for (i = 0; i < nfft; ++i) {
+        double phase =
+            -3.14159265358979323846264338327 * ((double) i / nfft + .5);
+        if (inverse_fft)
+            phase *= -1;
+        kf_cexp (st->super_twiddles+i,phase);
+    }
+    return st;
+}
+
+void kiss_fftr_s32(kiss_fftr_s32_cfg st,const kiss_fft_s32_scalar *timedata,kiss_fft_s32_cpx *freqdata)
+{
+    /* input buffer timedata is stored row-wise */
+    int k,ncfft;
+    kiss_fft_s32_cpx fpnk,fpk,f1k,f2k,tw,tdc;
+
+    if ( st->substate->inverse) {
+        fprintf(stderr,"kiss fft usage error: improper alloc\n");
+        exit(1);
+    }
+
+    ncfft = st->substate->nfft;
+
+    /*perform the parallel fft of two real signals packed in real,imag*/
+    kiss_fft_s32( st->substate , (const kiss_fft_s32_cpx*)timedata, st->tmpbuf );
+    /* The real part of the DC element of the frequency spectrum in st->tmpbuf
+     * contains the sum of the even-numbered elements of the input time sequence
+     * The imag part is the sum of the odd-numbered elements
+     *
+     * The sum of tdc.r and tdc.i is the sum of the input time sequence. 
+     *      yielding DC of input time sequence
+     * The difference of tdc.r - tdc.i is the sum of the input (dot product) [1,-1,1,-1... 
+     *      yielding Nyquist bin of input time sequence
+     */
+ 
+    tdc.r = st->tmpbuf[0].r;
+    tdc.i = st->tmpbuf[0].i;
+    C_FIXDIV(tdc,2);
+    CHECK_OVERFLOW_OP(tdc.r ,+, tdc.i);
+    CHECK_OVERFLOW_OP(tdc.r ,-, tdc.i);
+    freqdata[0].r = tdc.r + tdc.i;
+    freqdata[ncfft].r = tdc.r - tdc.i;
+#ifdef USE_SIMD    
+    freqdata[ncfft].i = freqdata[0].i = _mm_set1_ps(0);
+#else
+    freqdata[ncfft].i = freqdata[0].i = 0;
+#endif
+
+    for ( k=1;k <= ncfft/2 ; ++k ) {
+        fpk    = st->tmpbuf[k]; 
+        fpnk.r =   st->tmpbuf[ncfft-k].r;
+        fpnk.i = - st->tmpbuf[ncfft-k].i;
+        C_FIXDIV(fpk,2);
+        C_FIXDIV(fpnk,2);
+
+        C_ADD( f1k, fpk , fpnk );
+        C_SUB( f2k, fpk , fpnk );
+        C_MUL( tw , f2k , st->super_twiddles[k]);
+
+        freqdata[k].r = HALF_OF(f1k.r + tw.r);
+        freqdata[k].i = HALF_OF(f1k.i + tw.i);
+        freqdata[ncfft-k].r = HALF_OF(f1k.r - tw.r);
+        freqdata[ncfft-k].i = HALF_OF(tw.i - f1k.i);
+    }
+}
+
+void kiss_fftri_s32(kiss_fftr_s32_cfg st,const kiss_fft_s32_cpx *freqdata,kiss_fft_s32_scalar *timedata)
+{
+    /* input buffer timedata is stored row-wise */
+    int k, ncfft;
+
+    if (st->substate->inverse == 0) {
+        fprintf (stderr, "kiss fft usage error: improper alloc\n");
+        exit (1);
+    }
+
+    ncfft = st->substate->nfft;
+
+    st->tmpbuf[0].r = freqdata[0].r + freqdata[ncfft].r;
+    st->tmpbuf[0].i = freqdata[0].r - freqdata[ncfft].r;
+    C_FIXDIV(st->tmpbuf[0],2);
+
+    for (k = 1; k <= ncfft / 2; ++k) {
+        kiss_fft_s32_cpx fk, fnkc, fek, fok, tmp;
+        fk = freqdata[k];
+        fnkc.r = freqdata[ncfft - k].r;
+        fnkc.i = -freqdata[ncfft - k].i;
+        C_FIXDIV( fk , 2 );
+        C_FIXDIV( fnkc , 2 );
+
+        C_ADD (fek, fk, fnkc);
+        C_SUB (tmp, fk, fnkc);
+        C_MUL (fok, tmp, st->super_twiddles[k]);
+        C_ADD (st->tmpbuf[k],     fek, fok);
+        C_SUB (st->tmpbuf[ncfft - k], fek, fok);
+#ifdef USE_SIMD        
+        st->tmpbuf[ncfft - k].i *= _mm_set1_ps(-1.0);
+#else
+        st->tmpbuf[ncfft - k].i *= -1;
+#endif
+    }
+    kiss_fft_s32 (st->substate, st->tmpbuf, (kiss_fft_s32_cpx *) timedata);
+}
--- /dev/null	2007-08-16 07:48:53.000000000 +0200
+++ gst-libs/gst/fft/kiss_fft_s16.c	2007-08-20 19:14:55.000000000 +0200
@@ -0,0 +1,399 @@
+/*
+Copyright (c) 2003-2004, Mark Borgerding
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+    * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#include "_kiss_fft_guts_s16.h"
+/* The guts header contains all the multiplication and addition macros that are defined for
+ fixed or floating point complex numbers.  It also delares the kf_ internal functions.
+ */
+
+static kiss_fft_s16_cpx *scratchbuf=NULL;
+static size_t nscratchbuf=0;
+static kiss_fft_s16_cpx *tmpbuf=NULL;
+static size_t ntmpbuf=0;
+
+#define CHECKBUF(buf,nbuf,n) \
+    do { \
+        if ( nbuf < (size_t)(n) ) {\
+            free(buf); \
+            buf = (kiss_fft_s16_cpx*)KISS_FFT_S16_MALLOC(sizeof(kiss_fft_s16_cpx)*(n)); \
+            nbuf = (size_t)(n); \
+        } \
+   }while(0)
+
+
+static void kf_bfly2(
+        kiss_fft_s16_cpx * Fout,
+        const size_t fstride,
+        const kiss_fft_s16_cfg st,
+        int m
+        )
+{
+    kiss_fft_s16_cpx * Fout2;
+    kiss_fft_s16_cpx * tw1 = st->twiddles;
+    kiss_fft_s16_cpx t;
+    Fout2 = Fout + m;
+    do{
+        C_FIXDIV(*Fout,2); C_FIXDIV(*Fout2,2);
+
+        C_MUL (t,  *Fout2 , *tw1);
+        tw1 += fstride;
+        C_SUB( *Fout2 ,  *Fout , t );
+        C_ADDTO( *Fout ,  t );
+        ++Fout2;
+        ++Fout;
+    }while (--m);
+}
+
+static void kf_bfly4(
+        kiss_fft_s16_cpx * Fout,
+        const size_t fstride,
+        const kiss_fft_s16_cfg st,
+        const size_t m
+        )
+{
+    kiss_fft_s16_cpx *tw1,*tw2,*tw3;
+    kiss_fft_s16_cpx scratch[6];
+    size_t k=m;
+    const size_t m2=2*m;
+    const size_t m3=3*m;
+
+    tw3 = tw2 = tw1 = st->twiddles;
+
+    do {
+        C_FIXDIV(*Fout,4); C_FIXDIV(Fout[m],4); C_FIXDIV(Fout[m2],4); C_FIXDIV(Fout[m3],4);
+
+        C_MUL(scratch[0],Fout[m] , *tw1 );
+        C_MUL(scratch[1],Fout[m2] , *tw2 );
+        C_MUL(scratch[2],Fout[m3] , *tw3 );
+
+        C_SUB( scratch[5] , *Fout, scratch[1] );
+        C_ADDTO(*Fout, scratch[1]);
+        C_ADD( scratch[3] , scratch[0] , scratch[2] );
+        C_SUB( scratch[4] , scratch[0] , scratch[2] );
+        C_SUB( Fout[m2], *Fout, scratch[3] );
+        tw1 += fstride;
+        tw2 += fstride*2;
+        tw3 += fstride*3;
+        C_ADDTO( *Fout , scratch[3] );
+
+        if(st->inverse) {
+            Fout[m].r = scratch[5].r - scratch[4].i;
+            Fout[m].i = scratch[5].i + scratch[4].r;
+            Fout[m3].r = scratch[5].r + scratch[4].i;
+            Fout[m3].i = scratch[5].i - scratch[4].r;
+        }else{
+            Fout[m].r = scratch[5].r + scratch[4].i;
+            Fout[m].i = scratch[5].i - scratch[4].r;
+            Fout[m3].r = scratch[5].r - scratch[4].i;
+            Fout[m3].i = scratch[5].i + scratch[4].r;
+        }
+        ++Fout;
+    }while(--k);
+}
+
+static void kf_bfly3(
+         kiss_fft_s16_cpx * Fout,
+         const size_t fstride,
+         const kiss_fft_s16_cfg st,
+         size_t m
+         )
+{
+     size_t k=m;
+     const size_t m2 = 2*m;
+     kiss_fft_s16_cpx *tw1,*tw2;
+     kiss_fft_s16_cpx scratch[5];
+     kiss_fft_s16_cpx epi3;
+     epi3 = st->twiddles[fstride*m];
+
+     tw1=tw2=st->twiddles;
+
+     do{
+         C_FIXDIV(*Fout,3); C_FIXDIV(Fout[m],3); C_FIXDIV(Fout[m2],3);
+
+         C_MUL(scratch[1],Fout[m] , *tw1);
+         C_MUL(scratch[2],Fout[m2] , *tw2);
+
+         C_ADD(scratch[3],scratch[1],scratch[2]);
+         C_SUB(scratch[0],scratch[1],scratch[2]);
+         tw1 += fstride;
+         tw2 += fstride*2;
+
+         Fout[m].r = Fout->r - HALF_OF(scratch[3].r);
+         Fout[m].i = Fout->i - HALF_OF(scratch[3].i);
+
+         C_MULBYSCALAR( scratch[0] , epi3.i );
+
+         C_ADDTO(*Fout,scratch[3]);
+
+         Fout[m2].r = Fout[m].r + scratch[0].i;
+         Fout[m2].i = Fout[m].i - scratch[0].r;
+
+         Fout[m].r -= scratch[0].i;
+         Fout[m].i += scratch[0].r;
+
+         ++Fout;
+     }while(--k);
+}
+
+static void kf_bfly5(
+        kiss_fft_s16_cpx * Fout,
+        const size_t fstride,
+        const kiss_fft_s16_cfg st,
+        int m
+        )
+{
+    kiss_fft_s16_cpx *Fout0,*Fout1,*Fout2,*Fout3,*Fout4;
+    int u;
+    kiss_fft_s16_cpx scratch[13];
+    kiss_fft_s16_cpx * twiddles = st->twiddles;
+    kiss_fft_s16_cpx *tw;
+    kiss_fft_s16_cpx ya,yb;
+    ya = twiddles[fstride*m];
+    yb = twiddles[fstride*2*m];
+
+    Fout0=Fout;
+    Fout1=Fout0+m;
+    Fout2=Fout0+2*m;
+    Fout3=Fout0+3*m;
+    Fout4=Fout0+4*m;
+
+    tw=st->twiddles;
+    for ( u=0; u<m; ++u ) {
+        C_FIXDIV( *Fout0,5); C_FIXDIV( *Fout1,5); C_FIXDIV( *Fout2,5); C_FIXDIV( *Fout3,5); C_FIXDIV( *Fout4,5);
+        scratch[0] = *Fout0;
+
+        C_MUL(scratch[1] ,*Fout1, tw[u*fstride]);
+        C_MUL(scratch[2] ,*Fout2, tw[2*u*fstride]);
+        C_MUL(scratch[3] ,*Fout3, tw[3*u*fstride]);
+        C_MUL(scratch[4] ,*Fout4, tw[4*u*fstride]);
+
+        C_ADD( scratch[7],scratch[1],scratch[4]);
+        C_SUB( scratch[10],scratch[1],scratch[4]);
+        C_ADD( scratch[8],scratch[2],scratch[3]);
+        C_SUB( scratch[9],scratch[2],scratch[3]);
+
+        Fout0->r += scratch[7].r + scratch[8].r;
+        Fout0->i += scratch[7].i + scratch[8].i;
+
+        scratch[5].r = scratch[0].r + S_MUL(scratch[7].r,ya.r) + S_MUL(scratch[8].r,yb.r);
+        scratch[5].i = scratch[0].i + S_MUL(scratch[7].i,ya.r) + S_MUL(scratch[8].i,yb.r);
+
+        scratch[6].r =  S_MUL(scratch[10].i,ya.i) + S_MUL(scratch[9].i,yb.i);
+        scratch[6].i = -S_MUL(scratch[10].r,ya.i) - S_MUL(scratch[9].r,yb.i);
+
+        C_SUB(*Fout1,scratch[5],scratch[6]);
+        C_ADD(*Fout4,scratch[5],scratch[6]);
+
+        scratch[11].r = scratch[0].r + S_MUL(scratch[7].r,yb.r) + S_MUL(scratch[8].r,ya.r);
+        scratch[11].i = scratch[0].i + S_MUL(scratch[7].i,yb.r) + S_MUL(scratch[8].i,ya.r);
+        scratch[12].r = - S_MUL(scratch[10].i,yb.i) + S_MUL(scratch[9].i,ya.i);
+        scratch[12].i = S_MUL(scratch[10].r,yb.i) - S_MUL(scratch[9].r,ya.i);
+
+        C_ADD(*Fout2,scratch[11],scratch[12]);
+        C_SUB(*Fout3,scratch[11],scratch[12]);
+
+        ++Fout0;++Fout1;++Fout2;++Fout3;++Fout4;
+    }
+}
+
+/* perform the butterfly for one stage of a mixed radix FFT */
+static void kf_bfly_generic(
+        kiss_fft_s16_cpx * Fout,
+        const size_t fstride,
+        const kiss_fft_s16_cfg st,
+        int m,
+        int p
+        )
+{
+    int u,k,q1,q;
+    kiss_fft_s16_cpx * twiddles = st->twiddles;
+    kiss_fft_s16_cpx t;
+    int Norig = st->nfft;
+
+    CHECKBUF(scratchbuf,nscratchbuf,p);
+
+    for ( u=0; u<m; ++u ) {
+        k=u;
+        for ( q1=0 ; q1<p ; ++q1 ) {
+            scratchbuf[q1] = Fout[ k  ];
+            C_FIXDIV(scratchbuf[q1],p);
+            k += m;
+        }
+
+        k=u;
+        for ( q1=0 ; q1<p ; ++q1 ) {
+            int twidx=0;
+            Fout[ k ] = scratchbuf[0];
+            for (q=1;q<p;++q ) {
+                twidx += fstride * k;
+                if (twidx>=Norig) twidx-=Norig;
+                C_MUL(t,scratchbuf[q] , twiddles[twidx] );
+                C_ADDTO( Fout[ k ] ,t);
+            }
+            k += m;
+        }
+    }
+}
+
+static
+void kf_work(
+        kiss_fft_s16_cpx * Fout,
+        const kiss_fft_s16_cpx * f,
+        const size_t fstride,
+        int in_stride,
+        int * factors,
+        const kiss_fft_s16_cfg st
+        )
+{
+    kiss_fft_s16_cpx * Fout_beg=Fout;
+    const int p=*factors++; /* the radix  */
+    const int m=*factors++; /* stage's fft length/p */
+    const kiss_fft_s16_cpx * Fout_end = Fout + p*m;
+
+    if (m==1) {
+        do{
+            *Fout = *f;
+            f += fstride*in_stride;
+        }while(++Fout != Fout_end );
+    }else{
+        do{
+            kf_work( Fout , f, fstride*p, in_stride, factors,st);
+            f += fstride*in_stride;
+        }while( (Fout += m) != Fout_end );
+    }
+
+    Fout=Fout_beg;
+
+    switch (p) {
+        case 2: kf_bfly2(Fout,fstride,st,m); break;
+        case 3: kf_bfly3(Fout,fstride,st,m); break; 
+        case 4: kf_bfly4(Fout,fstride,st,m); break;
+        case 5: kf_bfly5(Fout,fstride,st,m); break; 
+        default: kf_bfly_generic(Fout,fstride,st,m,p); break;
+    }
+}
+
+/*  facbuf is populated by p1,m1,p2,m2, ...
+    where 
+    p[i] * m[i] = m[i-1]
+    m0 = n                  */
+static 
+void kf_factor(int n,int * facbuf)
+{
+    int p=4;
+    double floor_sqrt;
+    floor_sqrt = floor( sqrt((double)n) );
+
+    /*factor out powers of 4, powers of 2, then any remaining primes */
+    do {
+        while (n % p) {
+            switch (p) {
+                case 4: p = 2; break;
+                case 2: p = 3; break;
+                default: p += 2; break;
+            }
+            if (p > floor_sqrt)
+                p = n;          /* no more factors, skip to end */
+        }
+        n /= p;
+        *facbuf++ = p;
+        *facbuf++ = n;
+    } while (n > 1);
+}
+
+/*
+ *
+ * User-callable function to allocate all necessary storage space for the fft.
+ *
+ * The return value is a contiguous block of memory, allocated with malloc.  As such,
+ * It can be freed with free(), rather than a kiss_fft-specific function.
+ * */
+kiss_fft_s16_cfg kiss_fft_s16_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem )
+{
+    kiss_fft_s16_cfg st=NULL;
+    size_t memneeded = sizeof(struct kiss_fft_s16_state)
+        + sizeof(kiss_fft_s16_cpx)*(nfft-1); /* twiddle factors*/
+
+    if ( lenmem==NULL ) {
+        st = ( kiss_fft_s16_cfg)KISS_FFT_S16_MALLOC( memneeded );
+    }else{
+        if (mem != NULL && *lenmem >= memneeded)
+            st = (kiss_fft_s16_cfg)mem;
+        *lenmem = memneeded;
+    }
+    if (st) {
+        int i;
+        st->nfft=nfft;
+        st->inverse = inverse_fft;
+
+        for (i=0;i<nfft;++i) {
+            const double pi=3.141592653589793238462643383279502884197169399375105820974944;
+            double phase = -2*pi*i / nfft;
+            if (st->inverse)
+                phase *= -1;
+            kf_cexp(st->twiddles+i, phase );
+        }
+
+        kf_factor(nfft,st->factors);
+    }
+    return st;
+}
+
+
+
+    
+void kiss_fft_s16_stride(kiss_fft_s16_cfg st,const kiss_fft_s16_cpx *fin,kiss_fft_s16_cpx *fout,int in_stride)
+{
+    if (fin == fout) {
+        CHECKBUF(tmpbuf,ntmpbuf,st->nfft);
+        kf_work(tmpbuf,fin,1,in_stride, st->factors,st);
+        memcpy(fout,tmpbuf,sizeof(kiss_fft_s16_cpx)*st->nfft);
+    }else{
+        kf_work( fout, fin, 1,in_stride, st->factors,st );
+    }
+}
+
+void kiss_fft_s16(kiss_fft_s16_cfg cfg,const kiss_fft_s16_cpx *fin,kiss_fft_s16_cpx *fout)
+{
+    kiss_fft_s16_stride(cfg,fin,fout,1);
+}
+
+
+/* not really necessary to call, but if someone is doing in-place ffts, they may want to free the 
+   buffers from CHECKBUF
+ */ 
+void kiss_fft_s16_cleanup(void)
+{
+    free(scratchbuf);
+    scratchbuf = NULL;
+    nscratchbuf=0;
+    free(tmpbuf);
+    tmpbuf=NULL;
+    ntmpbuf=0;
+}
+
+int kiss_fft_s16_next_fast_size(int n)
+{
+    while(1) {
+        int m=n;
+        while ( (m%2) == 0 ) m/=2;
+        while ( (m%3) == 0 ) m/=3;
+        while ( (m%5) == 0 ) m/=5;
+        if (m<=1)
+            break; /* n is completely factorable by twos, threes, and fives */
+        n++;
+    }
+    return n;
+}
--- /dev/null	2007-08-16 07:48:53.000000000 +0200
+++ gst-libs/gst/fft/kiss_fft_s32.c	2007-08-20 19:14:55.000000000 +0200
@@ -0,0 +1,399 @@
+/*
+Copyright (c) 2003-2004, Mark Borgerding
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+    * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#include "_kiss_fft_guts_s32.h"
+/* The guts header contains all the multiplication and addition macros that are defined for
+ fixed or floating point complex numbers.  It also delares the kf_ internal functions.
+ */
+
+static kiss_fft_s32_cpx *scratchbuf=NULL;
+static size_t nscratchbuf=0;
+static kiss_fft_s32_cpx *tmpbuf=NULL;
+static size_t ntmpbuf=0;
+
+#define CHECKBUF(buf,nbuf,n) \
+    do { \
+        if ( nbuf < (size_t)(n) ) {\
+            free(buf); \
+            buf = (kiss_fft_s32_cpx*)KISS_FFT_S32_MALLOC(sizeof(kiss_fft_s32_cpx)*(n)); \
+            nbuf = (size_t)(n); \
+        } \
+   }while(0)
+
+
+static void kf_bfly2(
+        kiss_fft_s32_cpx * Fout,
+        const size_t fstride,
+        const kiss_fft_s32_cfg st,
+        int m
+        )
+{
+    kiss_fft_s32_cpx * Fout2;
+    kiss_fft_s32_cpx * tw1 = st->twiddles;
+    kiss_fft_s32_cpx t;
+    Fout2 = Fout + m;
+    do{
+        C_FIXDIV(*Fout,2); C_FIXDIV(*Fout2,2);
+
+        C_MUL (t,  *Fout2 , *tw1);
+        tw1 += fstride;
+        C_SUB( *Fout2 ,  *Fout , t );
+        C_ADDTO( *Fout ,  t );
+        ++Fout2;
+        ++Fout;
+    }while (--m);
+}
+
+static void kf_bfly4(
+        kiss_fft_s32_cpx * Fout,
+        const size_t fstride,
+        const kiss_fft_s32_cfg st,
+        const size_t m
+        )
+{
+    kiss_fft_s32_cpx *tw1,*tw2,*tw3;
+    kiss_fft_s32_cpx scratch[6];
+    size_t k=m;
+    const size_t m2=2*m;
+    const size_t m3=3*m;
+
+    tw3 = tw2 = tw1 = st->twiddles;
+
+    do {
+        C_FIXDIV(*Fout,4); C_FIXDIV(Fout[m],4); C_FIXDIV(Fout[m2],4); C_FIXDIV(Fout[m3],4);
+
+        C_MUL(scratch[0],Fout[m] , *tw1 );
+        C_MUL(scratch[1],Fout[m2] , *tw2 );
+        C_MUL(scratch[2],Fout[m3] , *tw3 );
+
+        C_SUB( scratch[5] , *Fout, scratch[1] );
+        C_ADDTO(*Fout, scratch[1]);
+        C_ADD( scratch[3] , scratch[0] , scratch[2] );
+        C_SUB( scratch[4] , scratch[0] , scratch[2] );
+        C_SUB( Fout[m2], *Fout, scratch[3] );
+        tw1 += fstride;
+        tw2 += fstride*2;
+        tw3 += fstride*3;
+        C_ADDTO( *Fout , scratch[3] );
+
+        if(st->inverse) {
+            Fout[m].r = scratch[5].r - scratch[4].i;
+            Fout[m].i = scratch[5].i + scratch[4].r;
+            Fout[m3].r = scratch[5].r + scratch[4].i;
+            Fout[m3].i = scratch[5].i - scratch[4].r;
+        }else{
+            Fout[m].r = scratch[5].r + scratch[4].i;
+            Fout[m].i = scratch[5].i - scratch[4].r;
+            Fout[m3].r = scratch[5].r - scratch[4].i;
+            Fout[m3].i = scratch[5].i + scratch[4].r;
+        }
+        ++Fout;
+    }while(--k);
+}
+
+static void kf_bfly3(
+         kiss_fft_s32_cpx * Fout,
+         const size_t fstride,
+         const kiss_fft_s32_cfg st,
+         size_t m
+         )
+{
+     size_t k=m;
+     const size_t m2 = 2*m;
+     kiss_fft_s32_cpx *tw1,*tw2;
+     kiss_fft_s32_cpx scratch[5];
+     kiss_fft_s32_cpx epi3;
+     epi3 = st->twiddles[fstride*m];
+
+     tw1=tw2=st->twiddles;
+
+     do{
+         C_FIXDIV(*Fout,3); C_FIXDIV(Fout[m],3); C_FIXDIV(Fout[m2],3);
+
+         C_MUL(scratch[1],Fout[m] , *tw1);
+         C_MUL(scratch[2],Fout[m2] , *tw2);
+
+         C_ADD(scratch[3],scratch[1],scratch[2]);
+         C_SUB(scratch[0],scratch[1],scratch[2]);
+         tw1 += fstride;
+         tw2 += fstride*2;
+
+         Fout[m].r = Fout->r - HALF_OF(scratch[3].r);
+         Fout[m].i = Fout->i - HALF_OF(scratch[3].i);
+
+         C_MULBYSCALAR( scratch[0] , epi3.i );
+
+         C_ADDTO(*Fout,scratch[3]);
+
+         Fout[m2].r = Fout[m].r + scratch[0].i;
+         Fout[m2].i = Fout[m].i - scratch[0].r;
+
+         Fout[m].r -= scratch[0].i;
+         Fout[m].i += scratch[0].r;
+
+         ++Fout;
+     }while(--k);
+}
+
+static void kf_bfly5(
+        kiss_fft_s32_cpx * Fout,
+        const size_t fstride,
+        const kiss_fft_s32_cfg st,
+        int m
+        )
+{
+    kiss_fft_s32_cpx *Fout0,*Fout1,*Fout2,*Fout3,*Fout4;
+    int u;
+    kiss_fft_s32_cpx scratch[13];
+    kiss_fft_s32_cpx * twiddles = st->twiddles;
+    kiss_fft_s32_cpx *tw;
+    kiss_fft_s32_cpx ya,yb;
+    ya = twiddles[fstride*m];
+    yb = twiddles[fstride*2*m];
+
+    Fout0=Fout;
+    Fout1=Fout0+m;
+    Fout2=Fout0+2*m;
+    Fout3=Fout0+3*m;
+    Fout4=Fout0+4*m;
+
+    tw=st->twiddles;
+    for ( u=0; u<m; ++u ) {
+        C_FIXDIV( *Fout0,5); C_FIXDIV( *Fout1,5); C_FIXDIV( *Fout2,5); C_FIXDIV( *Fout3,5); C_FIXDIV( *Fout4,5);
+        scratch[0] = *Fout0;
+
+        C_MUL(scratch[1] ,*Fout1, tw[u*fstride]);
+        C_MUL(scratch[2] ,*Fout2, tw[2*u*fstride]);
+        C_MUL(scratch[3] ,*Fout3, tw[3*u*fstride]);
+        C_MUL(scratch[4] ,*Fout4, tw[4*u*fstride]);
+
+        C_ADD( scratch[7],scratch[1],scratch[4]);
+        C_SUB( scratch[10],scratch[1],scratch[4]);
+        C_ADD( scratch[8],scratch[2],scratch[3]);
+        C_SUB( scratch[9],scratch[2],scratch[3]);
+
+        Fout0->r += scratch[7].r + scratch[8].r;
+        Fout0->i += scratch[7].i + scratch[8].i;
+
+        scratch[5].r = scratch[0].r + S_MUL(scratch[7].r,ya.r) + S_MUL(scratch[8].r,yb.r);
+        scratch[5].i = scratch[0].i + S_MUL(scratch[7].i,ya.r) + S_MUL(scratch[8].i,yb.r);
+
+        scratch[6].r =  S_MUL(scratch[10].i,ya.i) + S_MUL(scratch[9].i,yb.i);
+        scratch[6].i = -S_MUL(scratch[10].r,ya.i) - S_MUL(scratch[9].r,yb.i);
+
+        C_SUB(*Fout1,scratch[5],scratch[6]);
+        C_ADD(*Fout4,scratch[5],scratch[6]);
+
+        scratch[11].r = scratch[0].r + S_MUL(scratch[7].r,yb.r) + S_MUL(scratch[8].r,ya.r);
+        scratch[11].i = scratch[0].i + S_MUL(scratch[7].i,yb.r) + S_MUL(scratch[8].i,ya.r);
+        scratch[12].r = - S_MUL(scratch[10].i,yb.i) + S_MUL(scratch[9].i,ya.i);
+        scratch[12].i = S_MUL(scratch[10].r,yb.i) - S_MUL(scratch[9].r,ya.i);
+
+        C_ADD(*Fout2,scratch[11],scratch[12]);
+        C_SUB(*Fout3,scratch[11],scratch[12]);
+
+        ++Fout0;++Fout1;++Fout2;++Fout3;++Fout4;
+    }
+}
+
+/* perform the butterfly for one stage of a mixed radix FFT */
+static void kf_bfly_generic(
+        kiss_fft_s32_cpx * Fout,
+        const size_t fstride,
+        const kiss_fft_s32_cfg st,
+        int m,
+        int p
+        )
+{
+    int u,k,q1,q;
+    kiss_fft_s32_cpx * twiddles = st->twiddles;
+    kiss_fft_s32_cpx t;
+    int Norig = st->nfft;
+
+    CHECKBUF(scratchbuf,nscratchbuf,p);
+
+    for ( u=0; u<m; ++u ) {
+        k=u;
+        for ( q1=0 ; q1<p ; ++q1 ) {
+            scratchbuf[q1] = Fout[ k  ];
+            C_FIXDIV(scratchbuf[q1],p);
+            k += m;
+        }
+
+        k=u;
+        for ( q1=0 ; q1<p ; ++q1 ) {
+            int twidx=0;
+            Fout[ k ] = scratchbuf[0];
+            for (q=1;q<p;++q ) {
+                twidx += fstride * k;
+                if (twidx>=Norig) twidx-=Norig;
+                C_MUL(t,scratchbuf[q] , twiddles[twidx] );
+                C_ADDTO( Fout[ k ] ,t);
+            }
+            k += m;
+        }
+    }
+}
+
+static
+void kf_work(
+        kiss_fft_s32_cpx * Fout,
+        const kiss_fft_s32_cpx * f,
+        const size_t fstride,
+        int in_stride,
+        int * factors,
+        const kiss_fft_s32_cfg st
+        )
+{
+    kiss_fft_s32_cpx * Fout_beg=Fout;
+    const int p=*factors++; /* the radix  */
+    const int m=*factors++; /* stage's fft length/p */
+    const kiss_fft_s32_cpx * Fout_end = Fout + p*m;
+
+    if (m==1) {
+        do{
+            *Fout = *f;
+            f += fstride*in_stride;
+        }while(++Fout != Fout_end );
+    }else{
+        do{
+            kf_work( Fout , f, fstride*p, in_stride, factors,st);
+            f += fstride*in_stride;
+        }while( (Fout += m) != Fout_end );
+    }
+
+    Fout=Fout_beg;
+
+    switch (p) {
+        case 2: kf_bfly2(Fout,fstride,st,m); break;
+        case 3: kf_bfly3(Fout,fstride,st,m); break; 
+        case 4: kf_bfly4(Fout,fstride,st,m); break;
+        case 5: kf_bfly5(Fout,fstride,st,m); break; 
+        default: kf_bfly_generic(Fout,fstride,st,m,p); break;
+    }
+}
+
+/*  facbuf is populated by p1,m1,p2,m2, ...
+    where 
+    p[i] * m[i] = m[i-1]
+    m0 = n                  */
+static 
+void kf_factor(int n,int * facbuf)
+{
+    int p=4;
+    double floor_sqrt;
+    floor_sqrt = floor( sqrt((double)n) );
+
+    /*factor out powers of 4, powers of 2, then any remaining primes */
+    do {
+        while (n % p) {
+            switch (p) {
+                case 4: p = 2; break;
+                case 2: p = 3; break;
+                default: p += 2; break;
+            }
+            if (p > floor_sqrt)
+                p = n;          /* no more factors, skip to end */
+        }
+        n /= p;
+        *facbuf++ = p;
+        *facbuf++ = n;
+    } while (n > 1);
+}
+
+/*
+ *
+ * User-callable function to allocate all necessary storage space for the fft.
+ *
+ * The return value is a contiguous block of memory, allocated with malloc.  As such,
+ * It can be freed with free(), rather than a kiss_fft-specific function.
+ * */
+kiss_fft_s32_cfg kiss_fft_s32_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem )
+{
+    kiss_fft_s32_cfg st=NULL;
+    size_t memneeded = sizeof(struct kiss_fft_s32_state)
+        + sizeof(kiss_fft_s32_cpx)*(nfft-1); /* twiddle factors*/
+
+    if ( lenmem==NULL ) {
+        st = ( kiss_fft_s32_cfg)KISS_FFT_S32_MALLOC( memneeded );
+    }else{
+        if (mem != NULL && *lenmem >= memneeded)
+            st = (kiss_fft_s32_cfg)mem;
+        *lenmem = memneeded;
+    }
+    if (st) {
+        int i;
+        st->nfft=nfft;
+        st->inverse = inverse_fft;
+
+        for (i=0;i<nfft;++i) {
+            const double pi=3.141592653589793238462643383279502884197169399375105820974944;
+            double phase = -2*pi*i / nfft;
+            if (st->inverse)
+                phase *= -1;
+            kf_cexp(st->twiddles+i, phase );
+        }
+
+        kf_factor(nfft,st->factors);
+    }
+    return st;
+}
+
+
+
+    
+void kiss_fft_s32_stride(kiss_fft_s32_cfg st,const kiss_fft_s32_cpx *fin,kiss_fft_s32_cpx *fout,int in_stride)
+{
+    if (fin == fout) {
+        CHECKBUF(tmpbuf,ntmpbuf,st->nfft);
+        kf_work(tmpbuf,fin,1,in_stride, st->factors,st);
+        memcpy(fout,tmpbuf,sizeof(kiss_fft_s32_cpx)*st->nfft);
+    }else{
+        kf_work( fout, fin, 1,in_stride, st->factors,st );
+    }
+}
+
+void kiss_fft_s32(kiss_fft_s32_cfg cfg,const kiss_fft_s32_cpx *fin,kiss_fft_s32_cpx *fout)
+{
+    kiss_fft_s32_stride(cfg,fin,fout,1);
+}
+
+
+/* not really necessary to call, but if someone is doing in-place ffts, they may want to free the 
+   buffers from CHECKBUF
+ */ 
+void kiss_fft_s32_cleanup(void)
+{
+    free(scratchbuf);
+    scratchbuf = NULL;
+    nscratchbuf=0;
+    free(tmpbuf);
+    tmpbuf=NULL;
+    ntmpbuf=0;
+}
+
+int kiss_fft_s32_next_fast_size(int n)
+{
+    while(1) {
+        int m=n;
+        while ( (m%2) == 0 ) m/=2;
+        while ( (m%3) == 0 ) m/=3;
+        while ( (m%5) == 0 ) m/=5;
+        if (m<=1)
+            break; /* n is completely factorable by twos, threes, and fives */
+        n++;
+    }
+    return n;
+}
--- /dev/null	2007-08-16 07:48:53.000000000 +0200
+++ gst-libs/gst/fft/gstfftf32.h	2007-08-20 19:20:15.000000000 +0200
@@ -0,0 +1,77 @@
+/* GStreamer
+ * Copyright (C) <2007> Sebastian Dröge <slomo@circular-chaos.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_FFT_F32_H__
+#define __GST_FFT_F32_H__
+
+#include <glib.h>
+#include <gst/gst.h>
+
+#include "gstfft.h"
+
+typedef struct _GstFFTF32 GstFFTF32;
+typedef struct _GstFFTF32Complex GstFFTF32Complex;
+
+/**
+ * GstFFTF32:
+ *
+ * Instance structure for #GstFFTF32.
+ *
+ */
+struct _GstFFTF32 {
+  /* <private> */
+  void * cfg;
+  gboolean inverse;
+  gint len;
+  gpointer _padding[GST_PADDING];
+};
+
+/* Copy of kiss_fft_f32_cpx for documentation reasons,
+ * do NOT change! */
+
+/**
+ * GstFFTF32Complex:
+ * @r: Real part
+ * @i: Imaginary part
+ *
+ * Data type for complex numbers composed of
+ * 32 bit float.
+ *
+ */
+struct _GstFFTF32Complex
+{
+  gfloat r;
+  gfloat i;
+};
+
+/* Functions */
+
+GstFFTF32 * gst_fft_f32_new (gint len, gboolean inverse);
+void gst_fft_f32_fft (GstFFTF32 *self, const gfloat *timedata, GstFFTF32Complex *freqdata);
+void gst_fft_f32_inverse_fft (GstFFTF32 *self, const GstFFTF32Complex *freqdata, gfloat *timedata);
+void gst_fft_f32_free (GstFFTF32 *self);
+
+void gst_fft_f32_window (GstFFTF32 *self, gfloat *timedata, GstFFTWindow window);
+
+void gst_fft_f32_magnitude (GstFFTF32 *self, GstFFTF32Complex *freqdata,
+    gdouble *magnitude, gboolean decibel);
+void gst_fft_f32_phase (GstFFTF32 *self, GstFFTF32Complex *freqdata,
+    gdouble *phase);
+
+#endif /* __GST_FFT_F32_H__ */
--- /dev/null	2007-08-16 07:48:53.000000000 +0200
+++ gst-libs/gst/fft/gstfftf64.h	2007-08-20 19:20:15.000000000 +0200
@@ -0,0 +1,77 @@
+/* GStreamer
+ * Copyright (C) <2007> Sebastian Dröge <slomo@circular-chaos.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_FFT_F64_H__
+#define __GST_FFT_F64_H__
+
+#include <glib.h>
+#include <gst/gst.h>
+
+#include "gstfft.h"
+
+typedef struct _GstFFTF64 GstFFTF64;
+typedef struct _GstFFTF64Complex GstFFTF64Complex;
+
+/**
+ * GstFFTF64:
+ *
+ * Instance structure for #GstFFTF64.
+ *
+ */
+struct _GstFFTF64 {
+  /* <private> */
+  void * cfg;
+  gboolean inverse;
+  gint len;
+  gpointer _padding[GST_PADDING];
+};
+
+/* Copy of kiss_fft_f64_cpx for documentation reasons,
+ * do NOT change! */
+
+/**
+ * GstFFTF64Complex:
+ * @r: Real part
+ * @i: Imaginary part
+ *
+ * Data type for complex numbers composed of
+ * 64 bit float.
+ *
+ */
+struct _GstFFTF64Complex
+{
+  gdouble r;
+  gdouble i;
+};
+
+/* Functions */
+
+GstFFTF64 * gst_fft_f64_new (gint len, gboolean inverse);
+void gst_fft_f64_fft (GstFFTF64 *self, const gdouble *timedata, GstFFTF64Complex *freqdata);
+void gst_fft_f64_inverse_fft (GstFFTF64 *self, const GstFFTF64Complex *freqdata, gdouble *timedata);
+void gst_fft_f64_free (GstFFTF64 *self);
+
+void gst_fft_f64_window (GstFFTF64 *self, gdouble *timedata, GstFFTWindow window);
+
+void gst_fft_f64_magnitude (GstFFTF64 *self, GstFFTF64Complex *freqdata,
+    gdouble *magnitude, gboolean decibel);
+void gst_fft_f64_phase (GstFFTF64 *self, GstFFTF64Complex *freqdata,
+    gdouble *phase);
+
+#endif /* __GST_FFT_F64_H__ */
--- /dev/null	2007-08-16 07:48:53.000000000 +0200
+++ gst-libs/gst/fft/gstfft.h	2007-08-20 20:26:16.000000000 +0200
@@ -0,0 +1,49 @@
+/* GStreamer
+ * Copyright (C) <2007> Sebastian Dröge <slomo@circular-chaos.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <glib.h>
+#include <math.h>
+
+#ifndef __GST_FFT_H__
+#define __GST_FFT_H__
+
+/**
+ * GstFFTWindow:
+ * @GST_FFT_WINDOW_RECTANGULAR: Rectangular window
+ * @GST_FFT_WINDOW_HAMMING: Hamming window
+ * @GST_FFT_WINDOW_HANN: Hann (sometimes also called Hanning) window
+ * @GST_FFT_WINDOW_BARTLETT: Bartlett window
+ * @GST_FFT_WINDOW_BLACKMAN: Blackman window
+ *
+ * The various window functions available.
+ */
+typedef enum
+{
+  GST_FFT_WINDOW_RECTANGULAR,
+  GST_FFT_WINDOW_HAMMING,
+  GST_FFT_WINDOW_HANN,
+  GST_FFT_WINDOW_BARTLETT,
+  GST_FFT_WINDOW_BLACKMAN
+} GstFFTWindow;
+
+/* Functions */
+
+gint gst_fft_next_fast_size (gint n);
+
+#endif /* __GST_FFT_H__ */
--- /dev/null	2007-08-16 07:48:53.000000000 +0200
+++ gst-libs/gst/fft/gstffts16.h	2007-08-20 19:20:15.000000000 +0200
@@ -0,0 +1,77 @@
+/* GStreamer
+ * Copyright (C) <2007> Sebastian Dröge <slomo@circular-chaos.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_FFT_S16_H__
+#define __GST_FFT_S16_H__
+
+#include <glib.h>
+#include <gst/gst.h>
+
+#include "gstfft.h"
+
+typedef struct _GstFFTS16 GstFFTS16;
+typedef struct _GstFFTS16Complex GstFFTS16Complex;
+
+/**
+ * GstFFTS16:
+ *
+ * Instance structure for #GstFFTS16.
+ *
+ */
+struct _GstFFTS16 {
+  /* <private> */
+  void *cfg;
+  gboolean inverse;
+  gint len;
+  gpointer _padding[GST_PADDING];
+};
+
+/* Copy of kiss_fft_s16_cpx for documentation reasons,
+ * do NOT change! */
+
+/**
+ * GstFFTS16Complex:
+ * @r: Real part
+ * @i: Imaginary part
+ *
+ * Data type for complex numbers composed of
+ * signed 16 bit integers.
+ *
+ */
+struct _GstFFTS16Complex
+{
+  gint16 r;
+  gint16 i;
+};
+
+/* Functions */
+
+GstFFTS16 * gst_fft_s16_new (gint len, gboolean inverse);
+void gst_fft_s16_fft (GstFFTS16 *self, const gint16 *timedata, GstFFTS16Complex *freqdata);
+void gst_fft_s16_inverse_fft (GstFFTS16 *self, const GstFFTS16Complex *freqdata, gint16 *timedata);
+void gst_fft_s16_free (GstFFTS16 *self);
+
+void gst_fft_s16_window (GstFFTS16 *self, gint16 *timedata, GstFFTWindow window);
+
+void gst_fft_s16_magnitude (GstFFTS16 *self, GstFFTS16Complex *freqdata,
+    gdouble *magnitude, gboolean decibel);
+void gst_fft_s16_phase (GstFFTS16 *self, GstFFTS16Complex *freqdata,
+    gdouble *phase);
+
+#endif /* __GST_FFT_S16_H__ */
--- /dev/null	2007-08-16 07:48:53.000000000 +0200
+++ gst-libs/gst/fft/gstffts32.h	2007-08-20 19:20:15.000000000 +0200
@@ -0,0 +1,77 @@
+/* GStreamer
+ * Copyright (C) <2007> Sebastian Dröge <slomo@circular-chaos.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_FFT_S32_H__
+#define __GST_FFT_S32_H__
+
+#include <glib.h>
+#include <gst/gst.h>
+
+#include "gstfft.h"
+
+typedef struct _GstFFTS32 GstFFTS32;
+typedef struct _GstFFTS32Complex GstFFTS32Complex;
+
+/**
+ * GstFFTS32:
+ *
+ * Instance structure for #GstFFTS32.
+ *
+ */
+struct _GstFFTS32 {
+  /* <private> */
+  void * cfg;
+  gboolean inverse;
+  gint len;
+  gpointer _padding[GST_PADDING];
+};
+
+/* Copy of kiss_fft_s32_cpx for documentation reasons,
+ * do NOT change! */
+
+/**
+ * GstFFTS32Complex:
+ * @r: Real part
+ * @i: Imaginary part
+ *
+ * Data type for complex numbers composed of
+ * signed 32 bit integers.
+ *
+ */
+struct _GstFFTS32Complex
+{
+  gint32 r;
+  gint32 i;
+};
+
+/* Functions */
+
+GstFFTS32 * gst_fft_s32_new (gint len, gboolean inverse);
+void gst_fft_s32_fft (GstFFTS32 *self, const gint32 *timedata, GstFFTS32Complex *freqdata);
+void gst_fft_s32_inverse_fft (GstFFTS32 *self, const GstFFTS32Complex *freqdata, gint32 *timedata);
+void gst_fft_s32_free (GstFFTS32 *self);
+
+void gst_fft_s32_window (GstFFTS32 *self, gint32 *timedata, GstFFTWindow window);
+
+void gst_fft_s32_magnitude (GstFFTS32 *self, GstFFTS32Complex *freqdata,
+    gdouble *magnitude, gboolean decibel);
+void gst_fft_s32_phase (GstFFTS32 *self, GstFFTS32Complex *freqdata,
+    gdouble *phase);
+
+#endif /* __GST_FFT_S32_H__ */
--- /dev/null	2007-08-16 07:48:53.000000000 +0200
+++ gst-libs/gst/fft/kiss_fft_f32.h	2007-08-20 19:14:55.000000000 +0200
@@ -0,0 +1,99 @@
+#ifndef KISS_FFT_F32_H
+#define KISS_FFT_F32_H
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+#include <memory.h>
+#include <malloc.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ ATTENTION!
+ If you would like a :
+ -- a utility that will handle the caching of fft objects
+ -- real-only (no imaginary time component ) FFT
+ -- a multi-dimensional FFT
+ -- a command-line utility to perform ffts
+ -- a command-line utility to perform fast-convolution filtering
+
+ Then see kfc.h kiss_fftr.h kiss_fftnd.h fftutil.c kiss_fastfir.c
+  in the tools/ directory.
+*/
+
+#define KISS_FFT_F32_MALLOC malloc
+#define kiss_fft_f32_scalar float
+
+typedef struct {
+    kiss_fft_f32_scalar r;
+    kiss_fft_f32_scalar i;
+}kiss_fft_f32_cpx;
+
+typedef struct kiss_fft_f32_state* kiss_fft_f32_cfg;
+
+/* 
+ *  kiss_fft_f32_alloc
+ *  
+ *  Initialize a FFT (or IFFT) algorithm's cfg/state buffer.
+ *
+ *  typical usage:      kiss_fft_f32_cfg mycfg=kiss_fft_f32_alloc(1024,0,NULL,NULL);
+ *
+ *  The return value from fft_alloc is a cfg buffer used internally
+ *  by the fft routine or NULL.
+ *
+ *  If lenmem is NULL, then kiss_fft_f32_alloc will allocate a cfg buffer using malloc.
+ *  The returned value should be free()d when done to avoid memory leaks.
+ *  
+ *  The state can be placed in a user supplied buffer 'mem':
+ *  If lenmem is not NULL and mem is not NULL and *lenmem is large enough,
+ *      then the function places the cfg in mem and the size used in *lenmem
+ *      and returns mem.
+ *  
+ *  If lenmem is not NULL and ( mem is NULL or *lenmem is not large enough),
+ *      then the function returns NULL and places the minimum cfg 
+ *      buffer size in *lenmem.
+ * */
+
+kiss_fft_f32_cfg kiss_fft_f32_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem); 
+
+/*
+ * kiss_fft(cfg,in_out_buf)
+ *
+ * Perform an FFT on a complex input buffer.
+ * for a forward FFT,
+ * fin should be  f[0] , f[1] , ... ,f[nfft-1]
+ * fout will be   F[0] , F[1] , ... ,F[nfft-1]
+ * Note that each element is complex and can be accessed like
+    f[k].r and f[k].i
+ * */
+void kiss_fft_f32(kiss_fft_f32_cfg cfg,const kiss_fft_f32_cpx *fin,kiss_fft_f32_cpx *fout);
+
+/*
+ A more generic version of the above function. It reads its input from every Nth sample.
+ * */
+void kiss_fft_f32_stride(kiss_fft_f32_cfg cfg,const kiss_fft_f32_cpx *fin,kiss_fft_f32_cpx *fout,int fin_stride);
+
+/* If kiss_fft_f32_alloc allocated a buffer, it is one contiguous 
+   buffer and can be simply free()d when no longer needed*/
+#define kiss_fft_f32_free free
+
+/*
+ Cleans up some memory that gets managed internally. Not necessary to call, but it might clean up 
+ your compiler output to call this before you exit.
+*/
+void kiss_fft_f32_cleanup(void);
+	
+
+/*
+ * Returns the smallest integer k, such that k>=n and k has only "fast" factors (2,3,5)
+ */
+int kiss_fft_f32_next_fast_size(int n);
+
+#ifdef __cplusplus
+} 
+#endif
+
+#endif
--- /dev/null	2007-08-16 07:48:53.000000000 +0200
+++ gst-libs/gst/fft/kiss_fft_f64.h	2007-08-20 19:14:55.000000000 +0200
@@ -0,0 +1,99 @@
+#ifndef KISS_FFT_F64_H
+#define KISS_FFT_F64_H
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+#include <memory.h>
+#include <malloc.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ ATTENTION!
+ If you would like a :
+ -- a utility that will handle the caching of fft objects
+ -- real-only (no imaginary time component ) FFT
+ -- a multi-dimensional FFT
+ -- a command-line utility to perform ffts
+ -- a command-line utility to perform fast-convolution filtering
+
+ Then see kfc.h kiss_fftr.h kiss_fftnd.h fftutil.c kiss_fastfir.c
+  in the tools/ directory.
+*/
+
+#define KISS_FFT_F64_MALLOC malloc
+#define kiss_fft_f64_scalar double
+
+typedef struct {
+    kiss_fft_f64_scalar r;
+    kiss_fft_f64_scalar i;
+}kiss_fft_f64_cpx;
+
+typedef struct kiss_fft_f64_state* kiss_fft_f64_cfg;
+
+/* 
+ *  kiss_fft_f64_alloc
+ *  
+ *  Initialize a FFT (or IFFT) algorithm's cfg/state buffer.
+ *
+ *  typical usage:      kiss_fft_f64_cfg mycfg=kiss_fft_f64_alloc(1024,0,NULL,NULL);
+ *
+ *  The return value from fft_alloc is a cfg buffer used internally
+ *  by the fft routine or NULL.
+ *
+ *  If lenmem is NULL, then kiss_fft_f64_alloc will allocate a cfg buffer using malloc.
+ *  The returned value should be free()d when done to avoid memory leaks.
+ *  
+ *  The state can be placed in a user supplied buffer 'mem':
+ *  If lenmem is not NULL and mem is not NULL and *lenmem is large enough,
+ *      then the function places the cfg in mem and the size used in *lenmem
+ *      and returns mem.
+ *  
+ *  If lenmem is not NULL and ( mem is NULL or *lenmem is not large enough),
+ *      then the function returns NULL and places the minimum cfg 
+ *      buffer size in *lenmem.
+ * */
+
+kiss_fft_f64_cfg kiss_fft_f64_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem); 
+
+/*
+ * kiss_fft(cfg,in_out_buf)
+ *
+ * Perform an FFT on a complex input buffer.
+ * for a forward FFT,
+ * fin should be  f[0] , f[1] , ... ,f[nfft-1]
+ * fout will be   F[0] , F[1] , ... ,F[nfft-1]
+ * Note that each element is complex and can be accessed like
+    f[k].r and f[k].i
+ * */
+void kiss_fft_f64(kiss_fft_f64_cfg cfg,const kiss_fft_f64_cpx *fin,kiss_fft_f64_cpx *fout);
+
+/*
+ A more generic version of the above function. It reads its input from every Nth sample.
+ * */
+void kiss_fft_f64_stride(kiss_fft_f64_cfg cfg,const kiss_fft_f64_cpx *fin,kiss_fft_f64_cpx *fout,int fin_stride);
+
+/* If kiss_fft_f64_alloc allocated a buffer, it is one contiguous 
+   buffer and can be simply free()d when no longer needed*/
+#define kiss_fft_f64_free free
+
+/*
+ Cleans up some memory that gets managed internally. Not necessary to call, but it might clean up 
+ your compiler output to call this before you exit.
+*/
+void kiss_fft_f64_cleanup(void);
+	
+
+/*
+ * Returns the smallest integer k, such that k>=n and k has only "fast" factors (2,3,5)
+ */
+int kiss_fft_f64_next_fast_size(int n);
+
+#ifdef __cplusplus
+} 
+#endif
+
+#endif
--- /dev/null	2007-08-16 07:48:53.000000000 +0200
+++ gst-libs/gst/fft/_kiss_fft_guts_f32.h	2007-08-20 19:14:55.000000000 +0200
@@ -0,0 +1,98 @@
+/*
+Copyright (c) 2003-2004, Mark Borgerding
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+    * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/* kiss_fft.h
+   defines kiss_fft_f32_scalar as either short or a float type
+   and defines
+   typedef struct { kiss_fft_f32_scalar r; kiss_fft_f32_scalar i; }kiss_fft_f32_cpx; */
+#include "kiss_fft_f32.h"
+#include <limits.h>
+
+#define MAXFACTORS 32
+/* e.g. an fft of length 128 has 4 factors 
+ as far as kissfft is concerned
+ 4*4*4*2
+ */
+
+struct kiss_fft_f32_state{
+    int nfft;
+    int inverse;
+    int factors[2*MAXFACTORS];
+    kiss_fft_f32_cpx twiddles[1];
+};
+
+/*
+  Explanation of macros dealing with complex math:
+
+   C_MUL(m,a,b)         : m = a*b
+   C_FIXDIV( c , div )  : if a fixed point impl., c /= div. noop otherwise
+   C_SUB( res, a,b)     : res = a - b
+   C_SUBFROM( res , a)  : res -= a
+   C_ADDTO( res , a)    : res += a
+ * */
+
+#define S_MUL(a,b) ( (a)*(b) )
+#define C_MUL(m,a,b) \
+    do{ (m).r = (a).r*(b).r - (a).i*(b).i;\
+        (m).i = (a).r*(b).i + (a).i*(b).r; }while(0)
+#define C_FIXDIV(c,div) /* NOOP */
+#define C_MULBYSCALAR( c, s ) \
+    do{ (c).r *= (s);\
+        (c).i *= (s); }while(0)
+
+#ifndef CHECK_OVERFLOW_OP
+#  define CHECK_OVERFLOW_OP(a,op,b) /* noop */
+#endif
+
+#define  C_ADD( res, a,b)\
+    do { \
+	    CHECK_OVERFLOW_OP((a).r,+,(b).r)\
+	    CHECK_OVERFLOW_OP((a).i,+,(b).i)\
+	    (res).r=(a).r+(b).r;  (res).i=(a).i+(b).i; \
+    }while(0)
+#define  C_SUB( res, a,b)\
+    do { \
+	    CHECK_OVERFLOW_OP((a).r,-,(b).r)\
+	    CHECK_OVERFLOW_OP((a).i,-,(b).i)\
+	    (res).r=(a).r-(b).r;  (res).i=(a).i-(b).i; \
+    }while(0)
+#define C_ADDTO( res , a)\
+    do { \
+	    CHECK_OVERFLOW_OP((res).r,+,(a).r)\
+	    CHECK_OVERFLOW_OP((res).i,+,(a).i)\
+	    (res).r += (a).r;  (res).i += (a).i;\
+    }while(0)
+
+#define C_SUBFROM( res , a)\
+    do {\
+	    CHECK_OVERFLOW_OP((res).r,-,(a).r)\
+	    CHECK_OVERFLOW_OP((res).i,-,(a).i)\
+	    (res).r -= (a).r;  (res).i -= (a).i; \
+    }while(0)
+
+
+#define KISS_FFT_F32_COS(phase) (kiss_fft_f32_scalar) cos(phase)
+#define KISS_FFT_F32_SIN(phase) (kiss_fft_f32_scalar) sin(phase)
+#define HALF_OF(x) ((x)*.5)
+
+#define  kf_cexp(x,phase) \
+	do{ \
+		(x)->r = KISS_FFT_F32_COS(phase);\
+		(x)->i = KISS_FFT_F32_SIN(phase);\
+	}while(0)
+
+
+/* a debugging function */
+#define pcpx(c)\
+    fprintf(stderr,"%g + %gi\n",(double)((c)->r),(double)((c)->i) )
--- /dev/null	2007-08-16 07:48:53.000000000 +0200
+++ gst-libs/gst/fft/_kiss_fft_guts_f64.h	2007-08-20 19:14:55.000000000 +0200
@@ -0,0 +1,98 @@
+/*
+Copyright (c) 2003-2004, Mark Borgerding
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+    * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/* kiss_fft.h
+   defines kiss_fft_f64_scalar as either short or a float type
+   and defines
+   typedef struct { kiss_fft_f64_scalar r; kiss_fft_f64_scalar i; }kiss_fft_f64_cpx; */
+#include "kiss_fft_f64.h"
+#include <limits.h>
+
+#define MAXFACTORS 32
+/* e.g. an fft of length 128 has 4 factors 
+ as far as kissfft is concerned
+ 4*4*4*2
+ */
+
+struct kiss_fft_f64_state{
+    int nfft;
+    int inverse;
+    int factors[2*MAXFACTORS];
+    kiss_fft_f64_cpx twiddles[1];
+};
+
+/*
+  Explanation of macros dealing with complex math:
+
+   C_MUL(m,a,b)         : m = a*b
+   C_FIXDIV( c , div )  : if a fixed point impl., c /= div. noop otherwise
+   C_SUB( res, a,b)     : res = a - b
+   C_SUBFROM( res , a)  : res -= a
+   C_ADDTO( res , a)    : res += a
+ * */
+
+#define S_MUL(a,b) ( (a)*(b) )
+#define C_MUL(m,a,b) \
+    do{ (m).r = (a).r*(b).r - (a).i*(b).i;\
+        (m).i = (a).r*(b).i + (a).i*(b).r; }while(0)
+#define C_FIXDIV(c,div) /* NOOP */
+#define C_MULBYSCALAR( c, s ) \
+    do{ (c).r *= (s);\
+        (c).i *= (s); }while(0)
+
+#ifndef CHECK_OVERFLOW_OP
+#  define CHECK_OVERFLOW_OP(a,op,b) /* noop */
+#endif
+
+#define  C_ADD( res, a,b)\
+    do { \
+	    CHECK_OVERFLOW_OP((a).r,+,(b).r)\
+	    CHECK_OVERFLOW_OP((a).i,+,(b).i)\
+	    (res).r=(a).r+(b).r;  (res).i=(a).i+(b).i; \
+    }while(0)
+#define  C_SUB( res, a,b)\
+    do { \
+	    CHECK_OVERFLOW_OP((a).r,-,(b).r)\
+	    CHECK_OVERFLOW_OP((a).i,-,(b).i)\
+	    (res).r=(a).r-(b).r;  (res).i=(a).i-(b).i; \
+    }while(0)
+#define C_ADDTO( res , a)\
+    do { \
+	    CHECK_OVERFLOW_OP((res).r,+,(a).r)\
+	    CHECK_OVERFLOW_OP((res).i,+,(a).i)\
+	    (res).r += (a).r;  (res).i += (a).i;\
+    }while(0)
+
+#define C_SUBFROM( res , a)\
+    do {\
+	    CHECK_OVERFLOW_OP((res).r,-,(a).r)\
+	    CHECK_OVERFLOW_OP((res).i,-,(a).i)\
+	    (res).r -= (a).r;  (res).i -= (a).i; \
+    }while(0)
+
+
+#define KISS_FFT_F64_COS(phase) (kiss_fft_f64_scalar) cos(phase)
+#define KISS_FFT_F64_SIN(phase) (kiss_fft_f64_scalar) sin(phase)
+#define HALF_OF(x) ((x)*.5)
+
+#define  kf_cexp(x,phase) \
+	do{ \
+		(x)->r = KISS_FFT_F64_COS(phase);\
+		(x)->i = KISS_FFT_F64_SIN(phase);\
+	}while(0)
+
+
+/* a debugging function */
+#define pcpx(c)\
+    fprintf(stderr,"%g + %gi\n",(double)((c)->r),(double)((c)->i) )
--- /dev/null	2007-08-16 07:48:53.000000000 +0200
+++ gst-libs/gst/fft/_kiss_fft_guts_s16.h	2007-08-20 19:14:55.000000000 +0200
@@ -0,0 +1,121 @@
+/*
+Copyright (c) 2003-2004, Mark Borgerding
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+    * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/* kiss_fft.h
+   defines kiss_fft_s16_scalar as either short or a float type
+   and defines
+   typedef struct { kiss_fft_s16_scalar r; kiss_fft_s16_scalar i; }kiss_fft_s16_cpx; */
+#include "kiss_fft_s16.h"
+#include <limits.h>
+
+#define MAXFACTORS 32
+/* e.g. an fft of length 128 has 4 factors 
+ as far as kissfft is concerned
+ 4*4*4*2
+ */
+
+struct kiss_fft_s16_state{
+    int nfft;
+    int inverse;
+    int factors[2*MAXFACTORS];
+    kiss_fft_s16_cpx twiddles[1];
+};
+
+/*
+  Explanation of macros dealing with complex math:
+
+   C_MUL(m,a,b)         : m = a*b
+   C_FIXDIV( c , div )  : if a fixed point impl., c /= div. noop otherwise
+   C_SUB( res, a,b)     : res = a - b
+   C_SUBFROM( res , a)  : res -= a
+   C_ADDTO( res , a)    : res += a
+ * */
+#define FRACBITS 15
+#define SAMPPROD int32_t 
+#define SAMP_MAX 32767
+
+#define SAMP_MIN -SAMP_MAX
+
+#if defined(CHECK_OVERFLOW)
+#  define CHECK_OVERFLOW_OP(a,op,b)  \
+	if ( (SAMPPROD)(a) op (SAMPPROD)(b) > SAMP_MAX || (SAMPPROD)(a) op (SAMPPROD)(b) < SAMP_MIN ) { \
+		fprintf(stderr,"WARNING:overflow @ " __FILE__ "(%d): (%d " #op" %d) = %ld\n",__LINE__,(a),(b),(SAMPPROD)(a) op (SAMPPROD)(b) );  }
+#endif
+
+
+#   define smul(a,b) ( (SAMPPROD)(a)*(b) )
+#   define sround( x )  (kiss_fft_s16_scalar)( ( (x) + (1<<(FRACBITS-1)) ) >> FRACBITS )
+
+#   define S_MUL(a,b) sround( smul(a,b) )
+
+#   define C_MUL(m,a,b) \
+      do{ (m).r = sround( smul((a).r,(b).r) - smul((a).i,(b).i) ); \
+          (m).i = sround( smul((a).r,(b).i) + smul((a).i,(b).r) ); }while(0)
+
+#   define DIVSCALAR(x,k) \
+	(x) = sround( smul(  x, SAMP_MAX/k ) )
+
+#   define C_FIXDIV(c,div) \
+	do {    DIVSCALAR( (c).r , div);  \
+		DIVSCALAR( (c).i  , div); }while (0)
+
+#   define C_MULBYSCALAR( c, s ) \
+    do{ (c).r =  sround( smul( (c).r , s ) ) ;\
+        (c).i =  sround( smul( (c).i , s ) ) ; }while(0)
+
+#ifndef CHECK_OVERFLOW_OP
+#  define CHECK_OVERFLOW_OP(a,op,b) /* noop */
+#endif
+
+#define  C_ADD( res, a,b)\
+    do { \
+	    CHECK_OVERFLOW_OP((a).r,+,(b).r)\
+	    CHECK_OVERFLOW_OP((a).i,+,(b).i)\
+	    (res).r=(a).r+(b).r;  (res).i=(a).i+(b).i; \
+    }while(0)
+#define  C_SUB( res, a,b)\
+    do { \
+	    CHECK_OVERFLOW_OP((a).r,-,(b).r)\
+	    CHECK_OVERFLOW_OP((a).i,-,(b).i)\
+	    (res).r=(a).r-(b).r;  (res).i=(a).i-(b).i; \
+    }while(0)
+#define C_ADDTO( res , a)\
+    do { \
+	    CHECK_OVERFLOW_OP((res).r,+,(a).r)\
+	    CHECK_OVERFLOW_OP((res).i,+,(a).i)\
+	    (res).r += (a).r;  (res).i += (a).i;\
+    }while(0)
+
+#define C_SUBFROM( res , a)\
+    do {\
+	    CHECK_OVERFLOW_OP((res).r,-,(a).r)\
+	    CHECK_OVERFLOW_OP((res).i,-,(a).i)\
+	    (res).r -= (a).r;  (res).i -= (a).i; \
+    }while(0)
+
+
+#  define KISS_FFT_S16_COS(phase)  floor(.5+SAMP_MAX * cos (phase))
+#  define KISS_FFT_S16_SIN(phase)  floor(.5+SAMP_MAX * sin (phase))
+#  define HALF_OF(x) ((x)>>1)
+
+#define  kf_cexp(x,phase) \
+	do{ \
+		(x)->r = KISS_FFT_S16_COS(phase);\
+		(x)->i = KISS_FFT_S16_SIN(phase);\
+	}while(0)
+
+
+/* a debugging function */
+#define pcpx(c)\
+    fprintf(stderr,"%g + %gi\n",(double)((c)->r),(double)((c)->i) )
--- /dev/null	2007-08-16 07:48:53.000000000 +0200
+++ gst-libs/gst/fft/_kiss_fft_guts_s32.h	2007-08-20 19:14:55.000000000 +0200
@@ -0,0 +1,122 @@
+/*
+Copyright (c) 2003-2004, Mark Borgerding
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+    * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/* kiss_fft.h
+   defines kiss_fft_s32_scalar as either short or a float type
+   and defines
+   typedef struct { kiss_fft_s32_scalar r; kiss_fft_s32_scalar i; }kiss_fft_s32_cpx; */
+#include "kiss_fft_s32.h"
+#include <limits.h>
+
+#define MAXFACTORS 32
+/* e.g. an fft of length 128 has 4 factors 
+ as far as kissfft is concerned
+ 4*4*4*2
+ */
+
+struct kiss_fft_s32_state{
+    int nfft;
+    int inverse;
+    int factors[2*MAXFACTORS];
+    kiss_fft_s32_cpx twiddles[1];
+};
+
+/*
+  Explanation of macros dealing with complex math:
+
+   C_MUL(m,a,b)         : m = a*b
+   C_FIXDIV( c , div )  : if a fixed point impl., c /= div. noop otherwise
+   C_SUB( res, a,b)     : res = a - b
+   C_SUBFROM( res , a)  : res -= a
+   C_ADDTO( res , a)    : res += a
+ * */
+
+#define FRACBITS 31
+#define SAMPPROD int64_t
+#define SAMP_MAX 2147483647
+
+#define SAMP_MIN -SAMP_MAX
+
+#if defined(CHECK_OVERFLOW)
+#  define CHECK_OVERFLOW_OP(a,op,b)  \
+	if ( (SAMPPROD)(a) op (SAMPPROD)(b) > SAMP_MAX || (SAMPPROD)(a) op (SAMPPROD)(b) < SAMP_MIN ) { \
+		fprintf(stderr,"WARNING:overflow @ " __FILE__ "(%d): (%d " #op" %d) = %ld\n",__LINE__,(a),(b),(SAMPPROD)(a) op (SAMPPROD)(b) );  }
+#endif
+
+
+#   define smul(a,b) ( (SAMPPROD)(a)*(b) )
+#   define sround( x )  (kiss_fft_s32_scalar)( ( (x) + (1<<(FRACBITS-1)) ) >> FRACBITS )
+
+#   define S_MUL(a,b) sround( smul(a,b) )
+
+#   define C_MUL(m,a,b) \
+      do{ (m).r = sround( smul((a).r,(b).r) - smul((a).i,(b).i) ); \
+          (m).i = sround( smul((a).r,(b).i) + smul((a).i,(b).r) ); }while(0)
+
+#   define DIVSCALAR(x,k) \
+	(x) = sround( smul(  x, SAMP_MAX/k ) )
+
+#   define C_FIXDIV(c,div) \
+	do {    DIVSCALAR( (c).r , div);  \
+		DIVSCALAR( (c).i  , div); }while (0)
+
+#   define C_MULBYSCALAR( c, s ) \
+    do{ (c).r =  sround( smul( (c).r , s ) ) ;\
+        (c).i =  sround( smul( (c).i , s ) ) ; }while(0)
+
+#ifndef CHECK_OVERFLOW_OP
+#  define CHECK_OVERFLOW_OP(a,op,b) /* noop */
+#endif
+
+#define  C_ADD( res, a,b)\
+    do { \
+	    CHECK_OVERFLOW_OP((a).r,+,(b).r)\
+	    CHECK_OVERFLOW_OP((a).i,+,(b).i)\
+	    (res).r=(a).r+(b).r;  (res).i=(a).i+(b).i; \
+    }while(0)
+#define  C_SUB( res, a,b)\
+    do { \
+	    CHECK_OVERFLOW_OP((a).r,-,(b).r)\
+	    CHECK_OVERFLOW_OP((a).i,-,(b).i)\
+	    (res).r=(a).r-(b).r;  (res).i=(a).i-(b).i; \
+    }while(0)
+#define C_ADDTO( res , a)\
+    do { \
+	    CHECK_OVERFLOW_OP((res).r,+,(a).r)\
+	    CHECK_OVERFLOW_OP((res).i,+,(a).i)\
+	    (res).r += (a).r;  (res).i += (a).i;\
+    }while(0)
+
+#define C_SUBFROM( res , a)\
+    do {\
+	    CHECK_OVERFLOW_OP((res).r,-,(a).r)\
+	    CHECK_OVERFLOW_OP((res).i,-,(a).i)\
+	    (res).r -= (a).r;  (res).i -= (a).i; \
+    }while(0)
+
+
+#  define KISS_FFT_S32_COS(phase)  floor(.5+SAMP_MAX * cos (phase))
+#  define KISS_FFT_S32_SIN(phase)  floor(.5+SAMP_MAX * sin (phase))
+#  define HALF_OF(x) ((x)>>1)
+
+#define  kf_cexp(x,phase) \
+	do{ \
+		(x)->r = KISS_FFT_S32_COS(phase);\
+		(x)->i = KISS_FFT_S32_SIN(phase);\
+	}while(0)
+
+
+/* a debugging function */
+#define pcpx(c)\
+    fprintf(stderr,"%g + %gi\n",(double)((c)->r),(double)((c)->i) )
--- /dev/null	2007-08-16 07:48:53.000000000 +0200
+++ gst-libs/gst/fft/kiss_fftr_f32.h	2007-08-20 19:14:55.000000000 +0200
@@ -0,0 +1,46 @@
+#ifndef KISS_FTR_F32_H
+#define KISS_FTR_F32_H
+
+#include "kiss_fft_f32.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+    
+/* 
+ 
+ Real optimized version can save about 45% cpu time vs. complex fft of a real seq.
+
+ 
+ 
+ */
+
+typedef struct kiss_fftr_f32_state *kiss_fftr_f32_cfg;
+
+
+kiss_fftr_f32_cfg kiss_fftr_f32_alloc(int nfft,int inverse_fft,void * mem, size_t * lenmem);
+/*
+ nfft must be even
+
+ If you don't care to allocate space, use mem = lenmem = NULL 
+*/
+
+
+void kiss_fftr_f32(kiss_fftr_f32_cfg cfg,const kiss_fft_f32_scalar *timedata,kiss_fft_f32_cpx *freqdata);
+/*
+ input timedata has nfft scalar points
+ output freqdata has nfft/2+1 complex points
+*/
+
+void kiss_fftri_f32(kiss_fftr_f32_cfg cfg,const kiss_fft_f32_cpx *freqdata,kiss_fft_f32_scalar *timedata);
+/*
+ input freqdata has  nfft/2+1 complex points
+ output timedata has nfft scalar points
+*/
+
+#define kiss_fftr_f32_free free
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null	2007-08-16 07:48:53.000000000 +0200
+++ gst-libs/gst/fft/kiss_fftr_f64.h	2007-08-20 19:14:55.000000000 +0200
@@ -0,0 +1,46 @@
+#ifndef KISS_FTR_F64_H
+#define KISS_FTR_F64_H
+
+#include "kiss_fft_f64.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+    
+/* 
+ 
+ Real optimized version can save about 45% cpu time vs. complex fft of a real seq.
+
+ 
+ 
+ */
+
+typedef struct kiss_fftr_f64_state *kiss_fftr_f64_cfg;
+
+
+kiss_fftr_f64_cfg kiss_fftr_f64_alloc(int nfft,int inverse_fft,void * mem, size_t * lenmem);
+/*
+ nfft must be even
+
+ If you don't care to allocate space, use mem = lenmem = NULL 
+*/
+
+
+void kiss_fftr_f64(kiss_fftr_f64_cfg cfg,const kiss_fft_f64_scalar *timedata,kiss_fft_f64_cpx *freqdata);
+/*
+ input timedata has nfft scalar points
+ output freqdata has nfft/2+1 complex points
+*/
+
+void kiss_fftri_f64(kiss_fftr_f64_cfg cfg,const kiss_fft_f64_cpx *freqdata,kiss_fft_f64_scalar *timedata);
+/*
+ input freqdata has  nfft/2+1 complex points
+ output timedata has nfft scalar points
+*/
+
+#define kiss_fftr_f64_free free
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null	2007-08-16 07:48:53.000000000 +0200
+++ gst-libs/gst/fft/kiss_fftr_s16.h	2007-08-20 19:14:55.000000000 +0200
@@ -0,0 +1,46 @@
+#ifndef KISS_FTR_S16_H
+#define KISS_FTR_S16_H
+
+#include "kiss_fft_s16.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+    
+/* 
+ 
+ Real optimized version can save about 45% cpu time vs. complex fft of a real seq.
+
+ 
+ 
+ */
+
+typedef struct kiss_fftr_s16_state *kiss_fftr_s16_cfg;
+
+
+kiss_fftr_s16_cfg kiss_fftr_s16_alloc(int nfft,int inverse_fft,void * mem, size_t * lenmem);
+/*
+ nfft must be even
+
+ If you don't care to allocate space, use mem = lenmem = NULL 
+*/
+
+
+void kiss_fftr_s16(kiss_fftr_s16_cfg cfg,const kiss_fft_s16_scalar *timedata,kiss_fft_s16_cpx *freqdata);
+/*
+ input timedata has nfft scalar points
+ output freqdata has nfft/2+1 complex points
+*/
+
+void kiss_fftri_s16(kiss_fftr_s16_cfg cfg,const kiss_fft_s16_cpx *freqdata,kiss_fft_s16_scalar *timedata);
+/*
+ input freqdata has  nfft/2+1 complex points
+ output timedata has nfft scalar points
+*/
+
+#define kiss_fftr_s16_free free
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null	2007-08-16 07:48:53.000000000 +0200
+++ gst-libs/gst/fft/kiss_fftr_s32.h	2007-08-20 19:14:55.000000000 +0200
@@ -0,0 +1,46 @@
+#ifndef KISS_FTR_S32_H
+#define KISS_FTR_S32_H
+
+#include "kiss_fft_s32.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+    
+/* 
+ 
+ Real optimized version can save about 45% cpu time vs. complex fft of a real seq.
+
+ 
+ 
+ */
+
+typedef struct kiss_fftr_s32_state *kiss_fftr_s32_cfg;
+
+
+kiss_fftr_s32_cfg kiss_fftr_s32_alloc(int nfft,int inverse_fft,void * mem, size_t * lenmem);
+/*
+ nfft must be even
+
+ If you don't care to allocate space, use mem = lenmem = NULL 
+*/
+
+
+void kiss_fftr_s32(kiss_fftr_s32_cfg cfg,const kiss_fft_s32_scalar *timedata,kiss_fft_s32_cpx *freqdata);
+/*
+ input timedata has nfft scalar points
+ output freqdata has nfft/2+1 complex points
+*/
+
+void kiss_fftri_s32(kiss_fftr_s32_cfg cfg,const kiss_fft_s32_cpx *freqdata,kiss_fft_s32_scalar *timedata);
+/*
+ input freqdata has  nfft/2+1 complex points
+ output timedata has nfft scalar points
+*/
+
+#define kiss_fftr_s32_free free
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null	2007-08-16 07:48:53.000000000 +0200
+++ gst-libs/gst/fft/kiss_fft_s16.h	2007-08-20 19:14:55.000000000 +0200
@@ -0,0 +1,101 @@
+#ifndef KISS_FFT_S16_H
+#define KISS_FFT_S16_H
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+#include <memory.h>
+#include <malloc.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ ATTENTION!
+ If you would like a :
+ -- a utility that will handle the caching of fft objects
+ -- real-only (no imaginary time component ) FFT
+ -- a multi-dimensional FFT
+ -- a command-line utility to perform ffts
+ -- a command-line utility to perform fast-convolution filtering
+
+ Then see kfc.h kiss_fftr.h kiss_fftnd.h fftutil.c kiss_fastfir.c
+  in the tools/ directory.
+*/
+
+#define KISS_FFT_S16_MALLOC malloc
+
+#include <sys/types.h>	
+#define kiss_fft_s16_scalar int16_t
+
+typedef struct {
+    kiss_fft_s16_scalar r;
+    kiss_fft_s16_scalar i;
+}kiss_fft_s16_cpx;
+
+typedef struct kiss_fft_s16_state* kiss_fft_s16_cfg;
+
+/* 
+ *  kiss_fft_s16_alloc
+ *  
+ *  Initialize a FFT (or IFFT) algorithm's cfg/state buffer.
+ *
+ *  typical usage:      kiss_fft_s16_cfg mycfg=kiss_fft_s16_alloc(1024,0,NULL,NULL);
+ *
+ *  The return value from fft_alloc is a cfg buffer used internally
+ *  by the fft routine or NULL.
+ *
+ *  If lenmem is NULL, then kiss_fft_s16_alloc will allocate a cfg buffer using malloc.
+ *  The returned value should be free()d when done to avoid memory leaks.
+ *  
+ *  The state can be placed in a user supplied buffer 'mem':
+ *  If lenmem is not NULL and mem is not NULL and *lenmem is large enough,
+ *      then the function places the cfg in mem and the size used in *lenmem
+ *      and returns mem.
+ *  
+ *  If lenmem is not NULL and ( mem is NULL or *lenmem is not large enough),
+ *      then the function returns NULL and places the minimum cfg 
+ *      buffer size in *lenmem.
+ * */
+
+kiss_fft_s16_cfg kiss_fft_s16_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem); 
+
+/*
+ * kiss_fft(cfg,in_out_buf)
+ *
+ * Perform an FFT on a complex input buffer.
+ * for a forward FFT,
+ * fin should be  f[0] , f[1] , ... ,f[nfft-1]
+ * fout will be   F[0] , F[1] , ... ,F[nfft-1]
+ * Note that each element is complex and can be accessed like
+    f[k].r and f[k].i
+ * */
+void kiss_fft_s16(kiss_fft_s16_cfg cfg,const kiss_fft_s16_cpx *fin,kiss_fft_s16_cpx *fout);
+
+/*
+ A more generic version of the above function. It reads its input from every Nth sample.
+ * */
+void kiss_fft_s16_stride(kiss_fft_s16_cfg cfg,const kiss_fft_s16_cpx *fin,kiss_fft_s16_cpx *fout,int fin_stride);
+
+/* If kiss_fft_s16_alloc allocated a buffer, it is one contiguous 
+   buffer and can be simply free()d when no longer needed*/
+#define kiss_fft_s16_free free
+
+/*
+ Cleans up some memory that gets managed internally. Not necessary to call, but it might clean up 
+ your compiler output to call this before you exit.
+*/
+void kiss_fft_s16_cleanup(void);
+	
+
+/*
+ * Returns the smallest integer k, such that k>=n and k has only "fast" factors (2,3,5)
+ */
+int kiss_fft_s16_next_fast_size(int n);
+
+#ifdef __cplusplus
+} 
+#endif
+
+#endif
--- /dev/null	2007-08-16 07:48:53.000000000 +0200
+++ gst-libs/gst/fft/kiss_fft_s32.h	2007-08-20 19:14:55.000000000 +0200
@@ -0,0 +1,102 @@
+#ifndef KISS_FFT_S32_H
+#define KISS_FFT_S32_H
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+#include <memory.h>
+#include <malloc.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ ATTENTION!
+ If you would like a :
+ -- a utility that will handle the caching of fft objects
+ -- real-only (no imaginary time component ) FFT
+ -- a multi-dimensional FFT
+ -- a command-line utility to perform ffts
+ -- a command-line utility to perform fast-convolution filtering
+
+ Then see kfc.h kiss_fftr.h kiss_fftnd.h fftutil.c kiss_fastfir.c
+  in the tools/ directory.
+*/
+
+#define KISS_FFT_S32_MALLOC malloc
+
+
+#include <sys/types.h>	
+#define kiss_fft_s32_scalar int32_t
+
+typedef struct {
+    kiss_fft_s32_scalar r;
+    kiss_fft_s32_scalar i;
+}kiss_fft_s32_cpx;
+
+typedef struct kiss_fft_s32_state* kiss_fft_s32_cfg;
+
+/* 
+ *  kiss_fft_s32_alloc
+ *  
+ *  Initialize a FFT (or IFFT) algorithm's cfg/state buffer.
+ *
+ *  typical usage:      kiss_fft_s32_cfg mycfg=kiss_fft_s32_alloc(1024,0,NULL,NULL);
+ *
+ *  The return value from fft_alloc is a cfg buffer used internally
+ *  by the fft routine or NULL.
+ *
+ *  If lenmem is NULL, then kiss_fft_s32_alloc will allocate a cfg buffer using malloc.
+ *  The returned value should be free()d when done to avoid memory leaks.
+ *  
+ *  The state can be placed in a user supplied buffer 'mem':
+ *  If lenmem is not NULL and mem is not NULL and *lenmem is large enough,
+ *      then the function places the cfg in mem and the size used in *lenmem
+ *      and returns mem.
+ *  
+ *  If lenmem is not NULL and ( mem is NULL or *lenmem is not large enough),
+ *      then the function returns NULL and places the minimum cfg 
+ *      buffer size in *lenmem.
+ * */
+
+kiss_fft_s32_cfg kiss_fft_s32_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem); 
+
+/*
+ * kiss_fft(cfg,in_out_buf)
+ *
+ * Perform an FFT on a complex input buffer.
+ * for a forward FFT,
+ * fin should be  f[0] , f[1] , ... ,f[nfft-1]
+ * fout will be   F[0] , F[1] , ... ,F[nfft-1]
+ * Note that each element is complex and can be accessed like
+    f[k].r and f[k].i
+ * */
+void kiss_fft_s32(kiss_fft_s32_cfg cfg,const kiss_fft_s32_cpx *fin,kiss_fft_s32_cpx *fout);
+
+/*
+ A more generic version of the above function. It reads its input from every Nth sample.
+ * */
+void kiss_fft_s32_stride(kiss_fft_s32_cfg cfg,const kiss_fft_s32_cpx *fin,kiss_fft_s32_cpx *fout,int fin_stride);
+
+/* If kiss_fft_s32_alloc allocated a buffer, it is one contiguous 
+   buffer and can be simply free()d when no longer needed*/
+#define kiss_fft_s32_free free
+
+/*
+ Cleans up some memory that gets managed internally. Not necessary to call, but it might clean up 
+ your compiler output to call this before you exit.
+*/
+void kiss_fft_s32_cleanup(void);
+	
+
+/*
+ * Returns the smallest integer k, such that k>=n and k has only "fast" factors (2,3,5)
+ */
+int kiss_fft_s32_next_fast_size(int n);
+
+#ifdef __cplusplus
+} 
+#endif
+
+#endif
--- /dev/null	2007-08-16 07:48:53.000000000 +0200
+++ gst-libs/gst/fft/Makefile.am	2007-08-20 19:33:59.000000000 +0200
@@ -0,0 +1,46 @@
+lib_LTLIBRARIES = libgstfft-@GST_MAJORMINOR@.la
+
+libgstfft_@GST_MAJORMINOR@_includedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/fft
+
+libgstfft_@GST_MAJORMINOR@_include_HEADERS = \
+	gstfft.h \
+	gstffts16.h \
+	gstffts32.h \
+	gstfftf32.h \
+	gstfftf64.h
+
+noinst_HEADERS = \
+	kiss_fft_s16.h \
+	kiss_fft_s32.h \
+	kiss_fft_f32.h \
+	kiss_fft_f64.h \
+	kiss_fftr_s16.h \
+	kiss_fftr_s32.h \
+	kiss_fftr_f32.h \
+	kiss_fftr_f64.h \
+	_kiss_fft_guts_s16.h \
+	_kiss_fft_guts_s32.h \
+	_kiss_fft_guts_f32.h \
+	_kiss_fft_guts_f64.h
+
+libgstfft_@GST_MAJORMINOR@_la_SOURCES = \
+	gstfft.c \
+	gstffts16.c \
+	gstffts32.c \
+	gstfftf32.c \
+	gstfftf64.c \
+	kiss_fft_s16.c \
+	kiss_fft_s32.c \
+	kiss_fft_f32.c \
+	kiss_fft_f64.c \
+	kiss_fftr_s16.c \
+	kiss_fftr_s32.c \
+	kiss_fftr_f32.c \
+	kiss_fftr_f64.c
+
+libgstfft_@GST_MAJORMINOR@_la_LIBADD = $(GST_LIBS) $(LIBM)
+libgstfft_@GST_MAJORMINOR@_la_CFLAGS = $(GST_CFLAGS)
+libgstfft_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)
+
+EXTRA_DIST = kiss_version
+
Index: configure.ac
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-base/configure.ac,v
retrieving revision 1.693
diff -u -p -a -u -r1.693 configure.ac
--- configure.ac	7 Aug 2007 15:13:46 -0000	1.693
+++ configure.ac	20 Aug 2007 18:31:10 -0000
@@ -648,6 +648,7 @@ gst-libs/Makefile
 gst-libs/gst/Makefile
 gst-libs/gst/audio/Makefile
 gst-libs/gst/cdda/Makefile
+gst-libs/gst/fft/Makefile
 gst-libs/gst/floatcast/Makefile
 gst-libs/gst/interfaces/Makefile
 gst-libs/gst/netbuffer/Makefile
Index: gst-libs/gst/Makefile.am
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-base/gst-libs/gst/Makefile.am,v
retrieving revision 1.39
diff -u -p -a -u -r1.39 Makefile.am
--- gst-libs/gst/Makefile.am	24 Jul 2007 11:52:55 -0000	1.39
+++ gst-libs/gst/Makefile.am	20 Aug 2007 18:31:10 -0000
@@ -7,6 +7,7 @@ SUBDIRS = \
 	tag \
 	audio \
 	cdda \
+	fft \
 	floatcast \
 	netbuffer \
 	pbutils \
Index: pkgconfig/gstreamer-plugins-base-uninstalled.pc.in
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-base/pkgconfig/gstreamer-plugins-base-uninstalled.pc.in,v
retrieving revision 1.9
diff -u -p -a -u -r1.9 gstreamer-plugins-base-uninstalled.pc.in
--- pkgconfig/gstreamer-plugins-base-uninstalled.pc.in	24 Jul 2007 11:52:56 -0000	1.9
+++ pkgconfig/gstreamer-plugins-base-uninstalled.pc.in	20 Aug 2007 18:31:10 -0000
@@ -9,7 +9,7 @@ Description: Streaming media framework, 
 Version: @VERSION@
 Requires: gstreamer-@GST_MAJORMINOR@
 
-Libs: -L${libdir}/audio -L${libdir}/cdda -L${libdir}/floatcast -L${libdir}/interfaces -L${libdir}/netbuffer -L${libdir}/riff -L${libdir}/rtp -L${libdir}/rtsp -L${libdir}/sdp -L${libdir}/tag -L${libdir}/pbutils -L${libdir}/video
+Libs: -L${libdir}/audio -L${libdir}/cdda -L${libdir}/fft -L${libdir}/floatcast -L${libdir}/interfaces -L${libdir}/netbuffer -L${libdir}/riff -L${libdir}/rtp -L${libdir}/rtsp -L${libdir}/sdp -L${libdir}/tag -L${libdir}/pbutils -L${libdir}/video
 Cflags: -I${includedir}
 
-libraries=audio cdda floatcast interfaces netbuffer riff tag pbutils video
+libraries=audio cdda fft floatcast interfaces netbuffer riff tag pbutils video
Index: pkgconfig/gstreamer-plugins-base.pc.in
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-base/pkgconfig/gstreamer-plugins-base.pc.in,v
retrieving revision 1.8
diff -u -p -a -u -r1.8 gstreamer-plugins-base.pc.in
--- pkgconfig/gstreamer-plugins-base.pc.in	9 Mar 2007 11:23:32 -0000	1.8
+++ pkgconfig/gstreamer-plugins-base.pc.in	20 Aug 2007 18:31:10 -0000
@@ -11,4 +11,4 @@ Version: @VERSION@
 Libs: -L${libdir}
 Cflags: -I${includedir}
 
-libraries=audio cdda floatcast interfaces netbuffer riff rtp tag pbutils video
+libraries=audio cdda fft floatcast interfaces netbuffer riff rtp tag pbutils video
