aboutsummaryrefslogtreecommitdiffstats
path: root/common/bsinc_tables.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2020-04-06 17:11:21 -0700
committerChris Robinson <[email protected]>2020-04-06 17:12:39 -0700
commit2fcc3f38876ec64395841b3ef87c8786fab59c44 (patch)
treeb13ee786d81434af225457ed38fd4514a58edd89 /common/bsinc_tables.cpp
parent7a324231a38cb39e7de84a091114f8d017cb81e0 (diff)
Dynamically allocate the temporary bsinc filter table
Diffstat (limited to 'common/bsinc_tables.cpp')
-rw-r--r--common/bsinc_tables.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/common/bsinc_tables.cpp b/common/bsinc_tables.cpp
index 437f582d..853fe605 100644
--- a/common/bsinc_tables.cpp
+++ b/common/bsinc_tables.cpp
@@ -5,6 +5,7 @@
#include <cassert>
#include <cmath>
#include <limits>
+#include <memory>
#include <stdexcept>
#include "math_defs.h"
@@ -210,10 +211,14 @@ struct Array {
T data[N];
};
+/* FIXME: This should be constexpr, but the temporary filter table is apparently too big
+ * (~200K) for some systems. This requires using heap space, which is not
+ * allowed in a constexpr function.
+ */
template<size_t total_size>
-constexpr auto GenerateBSincCoeffs(const BSincHeader &hdr)
+auto GenerateBSincCoeffs(const BSincHeader &hdr)
{
- double filter[BSincScaleCount][BSincPhaseCount+1][BSincPointsMax]{};
+ auto filter = std::make_unique<double[][BSincPhaseCount+1][BSincPointsMax]>(BSincScaleCount);
/* Calculate the Kaiser-windowed Sinc filter coefficients for each scale
* and phase index.