Skip to content

Commit

Permalink
Merge pull request #4 from mike919192/static_constexpr
Browse files Browse the repository at this point in the history
Make coeff and lookup arrays static constexpr to avoid copying to stack.  Benchmark time went down about -12%
  • Loading branch information
mike919192 authored Oct 7, 2023
2 parents 40e2b7a + 336d36a commit 1785a83
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions include/sdsp/fft.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ namespace sdsp
static_assert(isPowerOf2(N), "FFT size must be a power of 2!");

//compile time calculations
constexpr auto wCoeffs {calc_wCoeffs<N, T>()};
constexpr auto swapLookup {calc_swap_lookup<N, 2>()};
constexpr static auto wCoeffs {calc_wCoeffs<N, T>()};
constexpr static auto swapLookup {calc_swap_lookup<N, 2>()};

//decimation in time
//perform swap on inputs
Expand Down Expand Up @@ -272,9 +272,9 @@ namespace sdsp
static_assert(isPowerOf4(N), "FFT radix 4 size must be a power of 4!");

//compile time calculations
constexpr auto wCoeffs {calc_wCoeffs<N, T>()};
constexpr auto swapLookup {calc_swap_lookup<N, 4>()};
constexpr uint coeff_subscript {log2(N) - 1};
constexpr static auto wCoeffs {calc_wCoeffs<N, T>()};
constexpr static auto swapLookup {calc_swap_lookup<N, 4>()};
constexpr static uint coeff_subscript {log2(N) - 1};

for (uint i {0}; i < log4(N); i++) {
uint i_group_size {static_cast<uint>(N) / (4u << (2u * i))};
Expand Down

0 comments on commit 1785a83

Please sign in to comment.