aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorChris Robinson <chris.kcat@gmail.com>2023-09-04 19:47:24 -0700
committerChris Robinson <chris.kcat@gmail.com>2023-09-04 19:47:24 -0700
commit1351a2a7d98cf288e44773c3cb4ff67929b3e6fc (patch)
tree06d70f71b6eb2cf41bdab45593016bcc95bea61a /core
parent9d695bd3b603e8427b3a40f0c27708bf56a9ecac (diff)
Precalculate some square factors
Diffstat (limited to 'core')
-rw-r--r--core/uhjfilter.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/core/uhjfilter.cpp b/core/uhjfilter.cpp
index d56d9b9d..4e4e99a5 100644
--- a/core/uhjfilter.cpp
+++ b/core/uhjfilter.cpp
@@ -29,23 +29,18 @@ template<>
struct GetPhaseShifter<UhjLength512> { static auto& Get() noexcept { return PShiftHq; } };
-constexpr float square(double x) noexcept
-{ return static_cast<float>(x*x); }
-
/* Filter coefficients for the 'base' all-pass IIR, which applies a frequency-
* dependent phase-shift of N degrees. The output of the filter requires a 1-
* sample delay.
*/
constexpr std::array<float,4> Filter1Coeff{{
- square(0.6923878), square(0.9360654322959), square(0.9882295226860),
- square(0.9987488452737)
+ 0.479400865589f, 0.876218493539f, 0.976597589508f, 0.997499255936f
}};
/* Filter coefficients for the offset all-pass IIR, which applies a frequency-
* dependent phase-shift of N+90 degrees.
*/
constexpr std::array<float,4> Filter2Coeff{{
- square(0.4021921162426), square(0.8561710882420), square(0.9722909545651),
- square(0.9952884791278)
+ 0.161758498368f, 0.733028932341f, 0.945349700329f, 0.990599156684f
}};
} // namespace