diff options
author | Jean-Marc Valin <Jean-Marc.Valin@csiro.au> | 2008-03-05 09:34:45 +0300 |
---|---|---|
committer | Jean-Marc Valin <Jean-Marc.Valin@csiro.au> | 2008-03-05 09:34:45 +0300 |
commit | 9d312b97565ab179ff0291a537b87db3d9865f3a (patch) | |
tree | e9bc8def3143a713ca96f2978a3bb26e8350739e | |
parent | f93747c44ab8e1c2d31b458ae1ffc0f85952b67c (diff) |
Defining RADIX_TWO_ONLY removes all butterflies, except for radix 2 and 4.
-rw-r--r-- | libcelt/kiss_fft.c | 14 | ||||
-rw-r--r-- | tests/dft-test.c | 10 | ||||
-rw-r--r-- | tests/mdct-test.c | 10 | ||||
-rw-r--r-- | tests/real-fft-test.c | 4 |
4 files changed, 28 insertions, 10 deletions
diff --git a/libcelt/kiss_fft.c b/libcelt/kiss_fft.c index b072044..275a117 100644 --- a/libcelt/kiss_fft.c +++ b/libcelt/kiss_fft.c @@ -188,6 +188,7 @@ static void ki_bfly4( } } +#ifndef RADIX_TWO_ONLY static void kf_bfly3( kiss_fft_cpx * Fout, @@ -477,6 +478,7 @@ static void ki_bfly_generic( } } } +#endif static void compute_bitrev_table( @@ -534,10 +536,14 @@ void kf_work( switch (p) { case 2: kf_bfly2(Fout,fstride,st,m, N, m2); break; - case 3: for (i=0;i<N;i++){Fout=Fout_beg+i*m2; kf_bfly3(Fout,fstride,st,m);} break; case 4: kf_bfly4(Fout,fstride,st,m, N, m2); break; +#ifndef RADIX_TWO_ONLY + case 3: for (i=0;i<N;i++){Fout=Fout_beg+i*m2; kf_bfly3(Fout,fstride,st,m);} break; case 5: for (i=0;i<N;i++){Fout=Fout_beg+i*m2; kf_bfly5(Fout,fstride,st,m);} break; default: for (i=0;i<N;i++){Fout=Fout_beg+i*m2; kf_bfly_generic(Fout,fstride,st,m,p);} break; +#else + default: celt_fatal("kiss_fft: only powers of two enabled"); +#endif } } @@ -564,10 +570,14 @@ void ki_work( switch (p) { case 2: ki_bfly2(Fout,fstride,st,m, N, m2); break; - case 3: for (i=0;i<N;i++){Fout=Fout_beg+i*m2; ki_bfly3(Fout,fstride,st,m);} break; case 4: ki_bfly4(Fout,fstride,st,m, N, m2); break; +#ifndef RADIX_TWO_ONLY + case 3: for (i=0;i<N;i++){Fout=Fout_beg+i*m2; ki_bfly3(Fout,fstride,st,m);} break; case 5: for (i=0;i<N;i++){Fout=Fout_beg+i*m2; ki_bfly5(Fout,fstride,st,m);} break; default: for (i=0;i<N;i++){Fout=Fout_beg+i*m2; ki_bfly_generic(Fout,fstride,st,m,p);} break; +#else + default: celt_fatal("kiss_fft: only powers of two enabled"); +#endif } } diff --git a/tests/dft-test.c b/tests/dft-test.c index 7f15331..fab680b 100644 --- a/tests/dft-test.c +++ b/tests/dft-test.c @@ -104,6 +104,11 @@ int main(int argc,char ** argv) }else{ test1d(32,0); test1d(32,1); + test1d(128,0); + test1d(128,1); + test1d(256,0); + test1d(256,1); +#ifndef RADIX_TWO_ONLY test1d(36,0); test1d(36,1); test1d(50,0); @@ -112,10 +117,7 @@ int main(int argc,char ** argv) test1d(120,1); test1d(105,0); test1d(105,1); - test1d(128,0); - test1d(128,1); - test1d(256,0); - test1d(256,1); +#endif } return ret; } diff --git a/tests/mdct-test.c b/tests/mdct-test.c index dea054f..8b3a7bb 100644 --- a/tests/mdct-test.c +++ b/tests/mdct-test.c @@ -123,6 +123,11 @@ int main(int argc,char ** argv) }else{ test1d(32,0); test1d(32,1); + test1d(256,0); + test1d(256,1); + test1d(512,0); + test1d(512,1); +#ifndef RADIX_TWO_ONLY test1d(40,0); test1d(40,1); test1d(56,0); @@ -131,12 +136,9 @@ int main(int argc,char ** argv) test1d(120,1); test1d(240,0); test1d(240,1); - test1d(256,0); - test1d(256,1); test1d(480,0); test1d(480,1); - test1d(512,0); - test1d(512,1); +#endif } return ret; } diff --git a/tests/real-fft-test.c b/tests/real-fft-test.c index 25db1a4..fc73f70 100644 --- a/tests/real-fft-test.c +++ b/tests/real-fft-test.c @@ -64,7 +64,11 @@ double snr_compare_scal( kiss_fft_scalar * vec1,kiss_fft_scalar * vec2, int n) } return snr; } +#ifdef RADIX_TWO_ONLY +#define NFFT 1024 +#else #define NFFT 8*3*5 +#endif #ifndef NUMFFTS #define NUMFFTS 10000 |