From 1351a2a7d98cf288e44773c3cb4ff67929b3e6fc Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 4 Sep 2023 19:47:24 -0700 Subject: Precalculate some square factors --- core/uhjfilter.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'core') 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 { static auto& Get() noexcept { return PShiftHq; } }; -constexpr float square(double x) noexcept -{ return static_cast(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 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 Filter2Coeff{{ - square(0.4021921162426), square(0.8561710882420), square(0.9722909545651), - square(0.9952884791278) + 0.161758498368f, 0.733028932341f, 0.945349700329f, 0.990599156684f }}; } // namespace -- cgit v1.2.3