Originally committed as revision 20464 to svn://svn.ffmpeg.org/ffmpeg/trunk
| ... | ... |
@@ -769,6 +769,12 @@ extern COSTABLE(32768); |
| 769 | 769 |
extern COSTABLE(65536); |
| 770 | 770 |
extern COSTABLE_CONST FFTSample* const ff_cos_tabs[17]; |
| 771 | 771 |
|
| 772 |
+/** |
|
| 773 |
+ * Initializes the cosine table in ff_cos_tabs[index] |
|
| 774 |
+ * \param index index in ff_cos_tabs array of the table to initialize |
|
| 775 |
+ */ |
|
| 776 |
+void ff_init_ff_cos_tabs(int index); |
|
| 777 |
+ |
|
| 772 | 778 |
extern SINTABLE(16); |
| 773 | 779 |
extern SINTABLE(32); |
| 774 | 780 |
extern SINTABLE(64); |
| ... | ... |
@@ -61,6 +61,20 @@ static int split_radix_permutation(int i, int n, int inverse) |
| 61 | 61 |
else return split_radix_permutation(i, m, inverse)*4 - 1; |
| 62 | 62 |
} |
| 63 | 63 |
|
| 64 |
+av_cold void ff_init_ff_cos_tabs(int index) |
|
| 65 |
+{
|
|
| 66 |
+#if !CONFIG_HARDCODED_TABLES |
|
| 67 |
+ int i; |
|
| 68 |
+ int m = 1<<index; |
|
| 69 |
+ double freq = 2*M_PI/m; |
|
| 70 |
+ FFTSample *tab = ff_cos_tabs[index]; |
|
| 71 |
+ for(i=0; i<=m/4; i++) |
|
| 72 |
+ tab[i] = cos(i*freq); |
|
| 73 |
+ for(i=1; i<m/4; i++) |
|
| 74 |
+ tab[m/2-i] = tab[i]; |
|
| 75 |
+#endif |
|
| 76 |
+} |
|
| 77 |
+ |
|
| 64 | 78 |
av_cold int ff_fft_init(FFTContext *s, int nbits, int inverse) |
| 65 | 79 |
{
|
| 66 | 80 |
int i, j, m, n; |
| ... | ... |
@@ -96,17 +110,9 @@ av_cold int ff_fft_init(FFTContext *s, int nbits, int inverse) |
| 96 | 96 |
if (HAVE_MMX) ff_fft_init_mmx(s); |
| 97 | 97 |
|
| 98 | 98 |
if (s->split_radix) {
|
| 99 |
-#if !CONFIG_HARDCODED_TABLES |
|
| 100 | 99 |
for(j=4; j<=nbits; j++) {
|
| 101 |
- int m = 1<<j; |
|
| 102 |
- double freq = 2*M_PI/m; |
|
| 103 |
- FFTSample *tab = ff_cos_tabs[j]; |
|
| 104 |
- for(i=0; i<=m/4; i++) |
|
| 105 |
- tab[i] = cos(i*freq); |
|
| 106 |
- for(i=1; i<m/4; i++) |
|
| 107 |
- tab[m/2-i] = tab[i]; |
|
| 100 |
+ ff_init_ff_cos_tabs(j); |
|
| 108 | 101 |
} |
| 109 |
-#endif |
|
| 110 | 102 |
for(i=0; i<n; i++) |
| 111 | 103 |
s->revtab[-split_radix_permutation(i, n, s->inverse) & (n-1)] = i; |
| 112 | 104 |
s->tmp_buf = av_malloc(n * sizeof(FFTComplex)); |
| ... | ... |
@@ -64,6 +64,7 @@ av_cold int ff_rdft_init(RDFTContext *s, int nbits, enum RDFTransformType trans) |
| 64 | 64 |
if (ff_fft_init(&s->fft, nbits-1, trans == IRDFT || trans == RIDFT) < 0) |
| 65 | 65 |
return -1; |
| 66 | 66 |
|
| 67 |
+ ff_init_ff_cos_tabs(nbits); |
|
| 67 | 68 |
s->tcos = ff_cos_tabs[nbits]; |
| 68 | 69 |
s->tsin = ff_sin_tabs[nbits]+(trans == RDFT || trans == IRIDFT)*(n>>2); |
| 69 | 70 |
#if !CONFIG_HARDCODED_TABLES |