summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJukka Ojanen <jukka.ojanen@linkotec.net>2015-03-16 17:42:28 +0200
committerJukka Ojanen <jukka.ojanen@linkotec.net>2015-03-16 17:42:28 +0200
commitbc5aa8c1a2006a579b306234848d00a9ae34d362 (patch)
tree3f74119038f9747faf77f20dfc467744b32daa29 /src
parentf869be2f8644d43d965a088850c28041b43a6eca (diff)
downloadffts-bc5aa8c1a2006a579b306234848d00a9ae34d362.zip
ffts-bc5aa8c1a2006a579b306234848d00a9ae34d362.tar.gz
Determinate lookup table size using closed-form expression
Diffstat (limited to 'src')
-rw-r--r--src/ffts.c26
1 files changed, 4 insertions, 22 deletions
diff --git a/src/ffts.c b/src/ffts.c
index 8ffb0c3..2b6b647 100644
--- a/src/ffts.c
+++ b/src/ffts.c
@@ -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;
OpenPOWER on IntegriCloud