Originally committed as revision 20243 to svn://svn.ffmpeg.org/ffmpeg/trunk
| ... | ... |
@@ -37,7 +37,7 @@ int main(void) |
| 37 | 37 |
for (i = 4; i <= BITS; i++) {
|
| 38 | 38 |
int m = 1 << i; |
| 39 | 39 |
double freq = 2*M_PI/m; |
| 40 |
- printf("const DECLARE_ALIGNED_16(FFTSample, ff_cos_%i[]) = {\n ", m);
|
|
| 40 |
+ printf("COSTABLE(%i) = {\n ", m);
|
|
| 41 | 41 |
for (j = 0; j < m/2 - 1; j++) {
|
| 42 | 42 |
int idx = j > m/4 ? m/2 - j : j; |
| 43 | 43 |
printf(" "FLOATFMT",", cos(idx*freq));
|
| ... | ... |
@@ -743,11 +743,44 @@ typedef struct FFTContext {
|
| 743 | 743 |
} FFTContext; |
| 744 | 744 |
|
| 745 | 745 |
#if CONFIG_HARDCODED_TABLES |
| 746 |
-extern const FFTSample* const ff_cos_tabs[13]; |
|
| 746 |
+#define COSTABLE_CONST const |
|
| 747 | 747 |
#else |
| 748 |
-extern FFTSample* const ff_cos_tabs[13]; |
|
| 748 |
+#define COSTABLE_CONST |
|
| 749 | 749 |
#endif |
| 750 | 750 |
|
| 751 |
+#define COSTABLE(size) \ |
|
| 752 |
+ COSTABLE_CONST DECLARE_ALIGNED_16(FFTSample, ff_cos_##size[size/2]) |
|
| 753 |
+#define SINTABLE(size) \ |
|
| 754 |
+ DECLARE_ALIGNED_16(FFTSample, ff_sin_##size[size/2]) |
|
| 755 |
+extern COSTABLE(16); |
|
| 756 |
+extern COSTABLE(32); |
|
| 757 |
+extern COSTABLE(64); |
|
| 758 |
+extern COSTABLE(128); |
|
| 759 |
+extern COSTABLE(256); |
|
| 760 |
+extern COSTABLE(512); |
|
| 761 |
+extern COSTABLE(1024); |
|
| 762 |
+extern COSTABLE(2048); |
|
| 763 |
+extern COSTABLE(4096); |
|
| 764 |
+extern COSTABLE(8192); |
|
| 765 |
+extern COSTABLE(16384); |
|
| 766 |
+extern COSTABLE(32768); |
|
| 767 |
+extern COSTABLE(65536); |
|
| 768 |
+extern COSTABLE_CONST FFTSample* const ff_cos_tabs[13]; |
|
| 769 |
+ |
|
| 770 |
+extern SINTABLE(16); |
|
| 771 |
+extern SINTABLE(32); |
|
| 772 |
+extern SINTABLE(64); |
|
| 773 |
+extern SINTABLE(128); |
|
| 774 |
+extern SINTABLE(256); |
|
| 775 |
+extern SINTABLE(512); |
|
| 776 |
+extern SINTABLE(1024); |
|
| 777 |
+extern SINTABLE(2048); |
|
| 778 |
+extern SINTABLE(4096); |
|
| 779 |
+extern SINTABLE(8192); |
|
| 780 |
+extern SINTABLE(16384); |
|
| 781 |
+extern SINTABLE(32768); |
|
| 782 |
+extern SINTABLE(65536); |
|
| 783 |
+ |
|
| 751 | 784 |
/** |
| 752 | 785 |
* Sets up a complex FFT. |
| 753 | 786 |
* @param nbits log2 of the length of the input array |
| ... | ... |
@@ -28,32 +28,23 @@ |
| 28 | 28 |
|
| 29 | 29 |
#include "dsputil.h" |
| 30 | 30 |
|
| 31 |
-#if CONFIG_HARDCODED_TABLES |
|
| 32 |
-#define COSTABLE(size) \ |
|
| 33 |
- extern const DECLARE_ALIGNED_16(FFTSample, ff_cos_##size[size/2]); |
|
| 34 |
-#else |
|
| 35 |
-#define COSTABLE(size) \ |
|
| 36 |
- DECLARE_ALIGNED_16(FFTSample, ff_cos_##size[size/2]); |
|
| 37 |
-#endif |
|
| 38 |
- |
|
| 39 | 31 |
/* cos(2*pi*x/n) for 0<=x<=n/4, followed by its reverse */ |
| 40 |
-COSTABLE(16) |
|
| 41 |
-COSTABLE(32) |
|
| 42 |
-COSTABLE(64) |
|
| 43 |
-COSTABLE(128) |
|
| 44 |
-COSTABLE(256) |
|
| 45 |
-COSTABLE(512) |
|
| 46 |
-COSTABLE(1024) |
|
| 47 |
-COSTABLE(2048) |
|
| 48 |
-COSTABLE(4096) |
|
| 49 |
-COSTABLE(8192) |
|
| 50 |
-COSTABLE(16384) |
|
| 51 |
-COSTABLE(32768) |
|
| 52 |
-COSTABLE(65536) |
|
| 53 |
-#if CONFIG_HARDCODED_TABLES |
|
| 54 |
-const |
|
| 32 |
+#if !CONFIG_HARDCODED_TABLES |
|
| 33 |
+COSTABLE(16); |
|
| 34 |
+COSTABLE(32); |
|
| 35 |
+COSTABLE(64); |
|
| 36 |
+COSTABLE(128); |
|
| 37 |
+COSTABLE(256); |
|
| 38 |
+COSTABLE(512); |
|
| 39 |
+COSTABLE(1024); |
|
| 40 |
+COSTABLE(2048); |
|
| 41 |
+COSTABLE(4096); |
|
| 42 |
+COSTABLE(8192); |
|
| 43 |
+COSTABLE(16384); |
|
| 44 |
+COSTABLE(32768); |
|
| 45 |
+COSTABLE(65536); |
|
| 55 | 46 |
#endif |
| 56 |
-FFTSample * const ff_cos_tabs[] = {
|
|
| 47 |
+COSTABLE_CONST FFTSample * const ff_cos_tabs[] = {
|
|
| 57 | 48 |
ff_cos_16, ff_cos_32, ff_cos_64, ff_cos_128, ff_cos_256, ff_cos_512, ff_cos_1024, |
| 58 | 49 |
ff_cos_2048, ff_cos_4096, ff_cos_8192, ff_cos_16384, ff_cos_32768, ff_cos_65536, |
| 59 | 50 |
}; |
| ... | ... |
@@ -27,19 +27,19 @@ |
| 27 | 27 |
*/ |
| 28 | 28 |
|
| 29 | 29 |
/* sin(2*pi*x/n) for 0<=x<n/4, followed by n/2<=x<3n/4 */ |
| 30 |
-DECLARE_ALIGNED_16(FFTSample, ff_sin_16[8]); |
|
| 31 |
-DECLARE_ALIGNED_16(FFTSample, ff_sin_32[16]); |
|
| 32 |
-DECLARE_ALIGNED_16(FFTSample, ff_sin_64[32]); |
|
| 33 |
-DECLARE_ALIGNED_16(FFTSample, ff_sin_128[64]); |
|
| 34 |
-DECLARE_ALIGNED_16(FFTSample, ff_sin_256[128]); |
|
| 35 |
-DECLARE_ALIGNED_16(FFTSample, ff_sin_512[256]); |
|
| 36 |
-DECLARE_ALIGNED_16(FFTSample, ff_sin_1024[512]); |
|
| 37 |
-DECLARE_ALIGNED_16(FFTSample, ff_sin_2048[1024]); |
|
| 38 |
-DECLARE_ALIGNED_16(FFTSample, ff_sin_4096[2048]); |
|
| 39 |
-DECLARE_ALIGNED_16(FFTSample, ff_sin_8192[4096]); |
|
| 40 |
-DECLARE_ALIGNED_16(FFTSample, ff_sin_16384[8192]); |
|
| 41 |
-DECLARE_ALIGNED_16(FFTSample, ff_sin_32768[16384]); |
|
| 42 |
-DECLARE_ALIGNED_16(FFTSample, ff_sin_65536[32768]); |
|
| 30 |
+SINTABLE(16); |
|
| 31 |
+SINTABLE(32); |
|
| 32 |
+SINTABLE(64); |
|
| 33 |
+SINTABLE(128); |
|
| 34 |
+SINTABLE(256); |
|
| 35 |
+SINTABLE(512); |
|
| 36 |
+SINTABLE(1024); |
|
| 37 |
+SINTABLE(2048); |
|
| 38 |
+SINTABLE(4096); |
|
| 39 |
+SINTABLE(8192); |
|
| 40 |
+SINTABLE(16384); |
|
| 41 |
+SINTABLE(32768); |
|
| 42 |
+SINTABLE(65536); |
|
| 43 | 43 |
FFTSample * const ff_sin_tabs[] = {
|
| 44 | 44 |
ff_sin_16, ff_sin_32, ff_sin_64, ff_sin_128, ff_sin_256, ff_sin_512, ff_sin_1024, |
| 45 | 45 |
ff_sin_2048, ff_sin_4096, ff_sin_8192, ff_sin_16384, ff_sin_32768, ff_sin_65536, |