diff options
author | Chris Robinson <[email protected]> | 2020-04-06 17:11:21 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2020-04-06 17:12:39 -0700 |
commit | 2fcc3f38876ec64395841b3ef87c8786fab59c44 (patch) | |
tree | b13ee786d81434af225457ed38fd4514a58edd89 /common/bsinc_tables.cpp | |
parent | 7a324231a38cb39e7de84a091114f8d017cb81e0 (diff) |
Dynamically allocate the temporary bsinc filter table
Diffstat (limited to 'common/bsinc_tables.cpp')
-rw-r--r-- | common/bsinc_tables.cpp | 9 |
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. |