changeset 1:cfec79393811

cleanup
author Peter Meerwald <p.meerwald@bct-electronic.com>
date Fri, 16 Sep 2011 12:57:27 +0200
parents 723f588b82ac
children 3d08140650d8
files peck_fft.c
diffstat 1 files changed, 30 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/peck_fft.c	Fri Sep 16 12:53:08 2011 +0200
+++ b/peck_fft.c	Fri Sep 16 12:57:27 2011 +0200
@@ -15,16 +15,14 @@
 
 #include "_peck_fft_guts.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.
+ * fixed or floating point complex numbers. It also delares the kf_ internal functions.
  */
 
 static void kf_bfly2(
         peck_fft_cpx * Fout,
         const size_t fstride,
         const peck_fft_cfg st,
-        int m
-        )
-{
+        int m) {
 
 //printf("kf_bfly2\n");
 
@@ -32,25 +30,24 @@
     peck_fft_cpx * tw1 = st->twiddles;
     peck_fft_cpx t;
     Fout2 = Fout + m;
-    do{
-        C_FIXDIV(*Fout,2); C_FIXDIV(*Fout2,2);
+    do {
+        C_FIXDIV(*Fout, 2); 
+        C_FIXDIV(*Fout2, 2);
 
-        C_MUL (t,  *Fout2 , *tw1);
+        C_MUL(t, *Fout2, *tw1);
         tw1 += fstride;
-        C_SUB( *Fout2 ,  *Fout , t );
-        C_ADDTO( *Fout ,  t );
+        C_SUB(*Fout2, *Fout, t);
+        C_ADDTO(*Fout, t);
         ++Fout2;
         ++Fout;
-    }while (--m);
+    } while (--m);
 }
 
 static void kf_bfly4(
         peck_fft_cpx * Fout,
         const size_t fstride,
         const peck_fft_cfg st,
-        const size_t m
-        )
-{
+        const size_t m) {
     peck_fft_cpx *tw1,*tw2,*tw3;
     peck_fft_cpx scratch[6];
     size_t k=m;
@@ -59,51 +56,51 @@
 
 //printf("kf_bfly4\n");
 
-
     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_FIXDIV(*Fout, 4); 
+        C_FIXDIV(Fout[m], 4); 
+        C_FIXDIV(Fout[m2], 4); 
+        C_FIXDIV(Fout[m3], 4);
 
-        C_SUB( scratch[5] , *Fout, scratch[1] );
+        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] );
+        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] );
+        C_ADDTO(*Fout, scratch[3]);
 
-        if(st->inverse) {
+        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{
+        } 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);
+    } while (--k);
 }
 
 static void kf_bfly3(
          peck_fft_cpx * Fout,
          const size_t fstride,
          const peck_fft_cfg st,
-         size_t m
-         )
-{
+         size_t m) {
      size_t k=m;
      const size_t m2 = 2*m;
-     peck_fft_cpx *tw1,*tw2;
+     peck_fft_cpx *tw1, *tw2;
      peck_fft_cpx scratch[5];
      peck_fft_cpx epi3;
      epi3 = st->twiddles[fstride*m];
@@ -113,7 +110,7 @@
 
      tw1=tw2=st->twiddles;
 
-     do{
+     do {
          C_FIXDIV(*Fout,3); C_FIXDIV(Fout[m],3); C_FIXDIV(Fout[m2],3);
 
          C_MUL(scratch[1],Fout[m] , *tw1);
@@ -138,7 +135,7 @@
          Fout[m].i += scratch[0].r;
 
          ++Fout;
-     }while(--k);
+     } while (--k);
 }
 
 static void kf_bfly5(

Repositories maintained by Peter Meerwald, pmeerw@pmeerw.net.