ref: 9d312b97565ab179ff0291a537b87db3d9865f3a
parent: f93747c44ab8e1c2d31b458ae1ffc0f85952b67c
author: Jean-Marc Valin <[email protected]>
date: Wed Mar 5 12:34:45 EST 2008
Defining RADIX_TWO_ONLY removes all butterflies, except for radix 2 and 4.
--- a/libcelt/kiss_fft.c
+++ b/libcelt/kiss_fft.c
@@ -188,6 +188,7 @@
}
}
+#ifndef RADIX_TWO_ONLY
static void kf_bfly3(
kiss_fft_cpx * Fout,
@@ -477,6 +478,7 @@
}
}
}
+#endif
static
void compute_bitrev_table(
@@ -534,10 +536,14 @@
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 @@
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
}
}
--- a/tests/dft-test.c
+++ b/tests/dft-test.c
@@ -104,6 +104,11 @@
}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 @@
test1d(120,1);
test1d(105,0);
test1d(105,1);
- test1d(128,0);
- test1d(128,1);
- test1d(256,0);
- test1d(256,1);
+#endif
}
return ret;
}
--- a/tests/mdct-test.c
+++ b/tests/mdct-test.c
@@ -123,6 +123,11 @@
}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 @@
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;
}
--- a/tests/real-fft-test.c
+++ b/tests/real-fft-test.c
@@ -64,7 +64,11 @@
}
return snr;
}
+#ifdef RADIX_TWO_ONLY
+#define NFFT 1024
+#else
#define NFFT 8*3*5
+#endif
#ifndef NUMFFTS
#define NUMFFTS 10000