? gst-libs/gst/fft/.kiss_fftr_s16.c.swp
Index: gst-libs/gst/fft/_kiss_fft_guts_f32.h
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-base/gst-libs/gst/fft/_kiss_fft_guts_f32.h,v
retrieving revision 1.1
diff -u -p -a -u -p -r1.1 _kiss_fft_guts_f32.h
--- gst-libs/gst/fft/_kiss_fft_guts_f32.h	6 Sep 2007 07:00:27 -0000	1.1
+++ gst-libs/gst/fft/_kiss_fft_guts_f32.h	13 Jan 2009 19:46:21 -0000
@@ -19,6 +19,20 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIG
 #include "kiss_fft_f32.h"
 #include <limits.h>
 
+/* The 2*sizeof(size_t) alignment here is borrowed from
+ * GNU libc, so it should be good most everywhere.
+ * It is more conservative than is needed on some 64-bit
+ * platforms, but ia64 does require a 16-byte alignment.
+ * The SIMD extensions for x86 and ppc32 would want a
+ * larger alignment than this, but we don't need to
+ * do better than malloc.
+ *
+ * Borrowed from GLib's gobject/gtype.c
+ */
+#define STRUCT_ALIGNMENT (2 * sizeof (size_t))
+#define ALIGN_STRUCT(offset) \
+      ((offset + (STRUCT_ALIGNMENT - 1)) & -STRUCT_ALIGNMENT)
+
 #define MAXFACTORS 32
 /* e.g. an fft of length 128 has 4 factors 
  as far as kissfft is concerned
Index: gst-libs/gst/fft/_kiss_fft_guts_f64.h
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-base/gst-libs/gst/fft/_kiss_fft_guts_f64.h,v
retrieving revision 1.1
diff -u -p -a -u -p -r1.1 _kiss_fft_guts_f64.h
--- gst-libs/gst/fft/_kiss_fft_guts_f64.h	6 Sep 2007 07:00:27 -0000	1.1
+++ gst-libs/gst/fft/_kiss_fft_guts_f64.h	13 Jan 2009 19:46:21 -0000
@@ -19,6 +19,20 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIG
 #include "kiss_fft_f64.h"
 #include <limits.h>
 
+/* The 2*sizeof(size_t) alignment here is borrowed from
+ * GNU libc, so it should be good most everywhere.
+ * It is more conservative than is needed on some 64-bit
+ * platforms, but ia64 does require a 16-byte alignment.
+ * The SIMD extensions for x86 and ppc32 would want a
+ * larger alignment than this, but we don't need to
+ * do better than malloc.
+ *
+ * Borrowed from GLib's gobject/gtype.c
+ */
+#define STRUCT_ALIGNMENT (2 * sizeof (size_t))
+#define ALIGN_STRUCT(offset) \
+      ((offset + (STRUCT_ALIGNMENT - 1)) & -STRUCT_ALIGNMENT)
+
 #define MAXFACTORS 32
 /* e.g. an fft of length 128 has 4 factors 
  as far as kissfft is concerned
Index: gst-libs/gst/fft/_kiss_fft_guts_s16.h
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-base/gst-libs/gst/fft/_kiss_fft_guts_s16.h,v
retrieving revision 1.1
diff -u -p -a -u -p -r1.1 _kiss_fft_guts_s16.h
--- gst-libs/gst/fft/_kiss_fft_guts_s16.h	6 Sep 2007 07:00:27 -0000	1.1
+++ gst-libs/gst/fft/_kiss_fft_guts_s16.h	13 Jan 2009 19:46:21 -0000
@@ -19,6 +19,20 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIG
 #include "kiss_fft_s16.h"
 #include <limits.h>
 
+/* The 2*sizeof(size_t) alignment here is borrowed from
+ * GNU libc, so it should be good most everywhere.
+ * It is more conservative than is needed on some 64-bit
+ * platforms, but ia64 does require a 16-byte alignment.
+ * The SIMD extensions for x86 and ppc32 would want a
+ * larger alignment than this, but we don't need to
+ * do better than malloc.
+ *
+ * Borrowed from GLib's gobject/gtype.c
+ */
+#define STRUCT_ALIGNMENT (2 * sizeof (size_t))
+#define ALIGN_STRUCT(offset) \
+      ((offset + (STRUCT_ALIGNMENT - 1)) & -STRUCT_ALIGNMENT)
+
 #define MAXFACTORS 32
 /* e.g. an fft of length 128 has 4 factors 
  as far as kissfft is concerned
Index: gst-libs/gst/fft/_kiss_fft_guts_s32.h
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-base/gst-libs/gst/fft/_kiss_fft_guts_s32.h,v
retrieving revision 1.1
diff -u -p -a -u -p -r1.1 _kiss_fft_guts_s32.h
--- gst-libs/gst/fft/_kiss_fft_guts_s32.h	6 Sep 2007 07:00:28 -0000	1.1
+++ gst-libs/gst/fft/_kiss_fft_guts_s32.h	13 Jan 2009 19:46:21 -0000
@@ -19,6 +19,20 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIG
 #include "kiss_fft_s32.h"
 #include <limits.h>
 
+/* The 2*sizeof(size_t) alignment here is borrowed from
+ * GNU libc, so it should be good most everywhere.
+ * It is more conservative than is needed on some 64-bit
+ * platforms, but ia64 does require a 16-byte alignment.
+ * The SIMD extensions for x86 and ppc32 would want a
+ * larger alignment than this, but we don't need to
+ * do better than malloc.
+ *
+ * Borrowed from GLib's gobject/gtype.c
+ */
+#define STRUCT_ALIGNMENT (2 * sizeof (size_t))
+#define ALIGN_STRUCT(offset) \
+      ((offset + (STRUCT_ALIGNMENT - 1)) & -STRUCT_ALIGNMENT)
+
 #define MAXFACTORS 32
 /* e.g. an fft of length 128 has 4 factors 
  as far as kissfft is concerned
Index: gst-libs/gst/fft/kiss_fftr_f32.c
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-base/gst-libs/gst/fft/kiss_fftr_f32.c,v
retrieving revision 1.1
diff -u -p -a -u -p -r1.1 kiss_fftr_f32.c
--- gst-libs/gst/fft/kiss_fftr_f32.c	6 Sep 2007 07:00:32 -0000	1.1
+++ gst-libs/gst/fft/kiss_fftr_f32.c	13 Jan 2009 19:46:21 -0000
@@ -39,8 +39,8 @@ kiss_fftr_f32_alloc (int nfft, int inver
   nfft >>= 1;
 
   kiss_fft_f32_alloc (nfft, inverse_fft, NULL, &subsize);
-  memneeded =
-      sizeof (struct kiss_fftr_f32_state) + subsize +
+  memneeded = ALIGN_STRUCT (sizeof (struct kiss_fftr_f32_state))
+      + ALIGN_STRUCT (subsize) +
       sizeof (kiss_fft_f32_cpx) * (nfft * 2);
 
   if (lenmem == NULL) {
@@ -53,8 +53,8 @@ kiss_fftr_f32_alloc (int nfft, int inver
   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->substate = (kiss_fft_f32_cfg) (((char *) st) + ALIGN_STRUCT (sizeof (struct kiss_fftr_f32_state)));   /*just beyond kiss_fftr_f32_state struct */
+  st->tmpbuf = (kiss_fft_f32_cpx *) (((char *) st->substate) + ALIGN_STRUCT (subsize));
   st->super_twiddles = st->tmpbuf + nfft;
   kiss_fft_f32_alloc (nfft, inverse_fft, st->substate, &subsize);
 
Index: gst-libs/gst/fft/kiss_fftr_f64.c
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-base/gst-libs/gst/fft/kiss_fftr_f64.c,v
retrieving revision 1.1
diff -u -p -a -u -p -r1.1 kiss_fftr_f64.c
--- gst-libs/gst/fft/kiss_fftr_f64.c	6 Sep 2007 07:00:33 -0000	1.1
+++ gst-libs/gst/fft/kiss_fftr_f64.c	13 Jan 2009 19:46:21 -0000
@@ -39,9 +39,9 @@ kiss_fftr_f64_alloc (int nfft, int inver
   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);
+  memneeded = ALIGN_STRUCT (sizeof (struct kiss_fftr_f64_state))
+      + ALIGN_STRUCT (subsize)
+      + sizeof (kiss_fft_f64_cpx) * (nfft * 2);
 
   if (lenmem == NULL) {
     st = (kiss_fftr_f64_cfg) KISS_FFT_F64_MALLOC (memneeded);
@@ -53,8 +53,8 @@ kiss_fftr_f64_alloc (int nfft, int inver
   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->substate = (kiss_fft_f64_cfg) (((char *) st) + ALIGN_STRUCT (sizeof (struct kiss_fftr_f64_state)));   /*just beyond kiss_fftr_f64_state struct */
+  st->tmpbuf = (kiss_fft_f64_cpx *) (((char *) st->substate) + ALIGN_STRUCT (subsize));
   st->super_twiddles = st->tmpbuf + nfft;
   kiss_fft_f64_alloc (nfft, inverse_fft, st->substate, &subsize);
 
Index: gst-libs/gst/fft/kiss_fftr_s16.c
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-base/gst-libs/gst/fft/kiss_fftr_s16.c,v
retrieving revision 1.1
diff -u -p -a -u -p -r1.1 kiss_fftr_s16.c
--- gst-libs/gst/fft/kiss_fftr_s16.c	6 Sep 2007 07:00:33 -0000	1.1
+++ gst-libs/gst/fft/kiss_fftr_s16.c	13 Jan 2009 19:46:21 -0000
@@ -39,9 +39,9 @@ kiss_fftr_s16_alloc (int nfft, int inver
   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);
+  memneeded = ALIGN_STRUCT (sizeof (struct kiss_fftr_s16_state))
+      + ALIGN_STRUCT (subsize)
+      + sizeof (kiss_fft_s16_cpx) * (nfft * 2);
 
   if (lenmem == NULL) {
     st = (kiss_fftr_s16_cfg) KISS_FFT_S16_MALLOC (memneeded);
@@ -53,8 +53,8 @@ kiss_fftr_s16_alloc (int nfft, int inver
   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->substate = (kiss_fft_s16_cfg) (((char *) st) + ALIGN_STRUCT (sizeof (struct kiss_fftr_s16_state)));   /*just beyond kiss_fftr_s16_state struct */
+  st->tmpbuf = (kiss_fft_s16_cpx *) (((char *) st->substate) + ALIGN_STRUCT (subsize));
   st->super_twiddles = st->tmpbuf + nfft;
   kiss_fft_s16_alloc (nfft, inverse_fft, st->substate, &subsize);
 
Index: gst-libs/gst/fft/kiss_fftr_s32.c
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-base/gst-libs/gst/fft/kiss_fftr_s32.c,v
retrieving revision 1.1
diff -u -p -a -u -p -r1.1 kiss_fftr_s32.c
--- gst-libs/gst/fft/kiss_fftr_s32.c	6 Sep 2007 07:00:34 -0000	1.1
+++ gst-libs/gst/fft/kiss_fftr_s32.c	13 Jan 2009 19:46:21 -0000
@@ -39,9 +39,9 @@ kiss_fftr_s32_alloc (int nfft, int inver
   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);
+  memneeded = ALIGN_STRUCT (sizeof (struct kiss_fftr_s32_state))
+      + ALIGN_STRUCT (subsize)
+      + sizeof (kiss_fft_s32_cpx) * (nfft * 2);
 
   if (lenmem == NULL) {
     st = (kiss_fftr_s32_cfg) KISS_FFT_S32_MALLOC (memneeded);
@@ -53,8 +53,8 @@ kiss_fftr_s32_alloc (int nfft, int inver
   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->substate = (kiss_fft_s32_cfg) (((char *) st) + ALIGN_STRUCT (sizeof (struct kiss_fftr_s32_state)));   /*just beyond kiss_fftr_s32_state struct */
+  st->tmpbuf = (kiss_fft_s32_cpx *) (((char *) st->substate) + ALIGN_STRUCT (subsize));
   st->super_twiddles = st->tmpbuf + nfft;
   kiss_fft_s32_alloc (nfft, inverse_fft, st->substate, &subsize);
 
