diff options
author | Jukka Ojanen <jukka.ojanen@linkotec.net> | 2015-03-16 17:42:28 +0200 |
---|---|---|
committer | Jukka Ojanen <jukka.ojanen@linkotec.net> | 2015-03-16 17:42:28 +0200 |
commit | bc5aa8c1a2006a579b306234848d00a9ae34d362 (patch) | |
tree | 3f74119038f9747faf77f20dfc467744b32daa29 | |
parent | f869be2f8644d43d965a088850c28041b43a6eca (diff) | |
download | ffts-bc5aa8c1a2006a579b306234848d00a9ae34d362.zip ffts-bc5aa8c1a2006a579b306234848d00a9ae34d362.tar.gz |
Determinate lookup table size using closed-form expression
-rw-r--r-- | src/ffts.c | 26 |
1 files changed, 4 insertions, 22 deletions
@@ -203,7 +203,6 @@ static int ffts_generate_luts(ffts_plan_t *p, size_t N, size_t leaf_N, int sign) { V4SF MULI_SIGN; - size_t lut_size; size_t n_luts; ffts_cpx_32f *w; size_t i, n; @@ -220,32 +219,15 @@ ffts_generate_luts(ffts_plan_t *p, size_t N, size_t leaf_N, int sign) n_luts = 0; } - /* fprintf(stderr, "n_luts = %zu\n", n_luts); */ - - n = leaf_N * 2; + if (n_luts) { + size_t lut_size; - lut_size = 0; - for (i = 0; i < n_luts; i++) { - if (!i) { -#if defined(__arm__) && !defined(DYNAMIC_DISABLED) - lut_size += n/4 * sizeof(ffts_cpx_32f); -#else - lut_size += n/4 * 2 * sizeof(ffts_cpx_32f); -#endif - n *= 2; - } else { #if defined(__arm__) && !defined(DYNAMIC_DISABLED) - lut_size += n/8 * 3 * sizeof(ffts_cpx_32f); + lut_size = leaf_N * (((1 << n_luts) - 2) * 3 + 1) * sizeof(ffts_cpx_32f) / 2; #else - lut_size += n/8 * 3 * 2 * sizeof(ffts_cpx_32f); + lut_size = leaf_N * (((1 << n_luts) - 2) * 3 + 1) * sizeof(ffts_cpx_32f); #endif - } - n *= 2; - } - - /* fprintf(stderr, "lut size = %zu\n", lut_size); */ - if (n_luts) { p->ws = FFTS_MALLOC(lut_size, 32); if (!p->ws) { goto cleanup; |