aboutsummaryrefslogtreecommitdiffstats
path: root/core/bsinc_tables.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2023-11-02 10:55:28 -0700
committerChris Robinson <[email protected]>2023-11-04 10:11:19 -0700
commit34cde4b55f87d775e79c1f4cbd6b14d129b1a949 (patch)
treee0f9b82a85adf242e394ef2076780439d5640d90 /core/bsinc_tables.cpp
parent6420bc86cd972fd544a74bdbbc0e882d284046be (diff)
Remove an unnecessary struct member
Diffstat (limited to 'core/bsinc_tables.cpp')
-rw-r--r--core/bsinc_tables.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/core/bsinc_tables.cpp b/core/bsinc_tables.cpp
index 1b3f5784..c734b0e9 100644
--- a/core/bsinc_tables.cpp
+++ b/core/bsinc_tables.cpp
@@ -10,6 +10,7 @@
#include <stddef.h>
#include "alnumbers.h"
+#include "alnumeric.h"
#include "bsinc_defs.h"
#include "resampler_limits.h"
@@ -108,7 +109,6 @@ struct BSincHeader {
double width{};
double beta{};
double scaleBase{};
- double scaleRange{};
double besseli_0_beta{};
uint a[BSincScaleCount]{};
@@ -119,13 +119,12 @@ struct BSincHeader {
width = CalcKaiserWidth(Rejection, Order);
beta = CalcKaiserBeta(Rejection);
scaleBase = width / 2.0;
- scaleRange = 1.0 - scaleBase;
besseli_0_beta = BesselI_0(beta);
uint num_points{Order+1};
for(uint si{0};si < BSincScaleCount;++si)
{
- const double scale{scaleBase + (scaleRange * (si+1) / BSincScaleCount)};
+ const double scale{lerpd(scaleBase, 1.0, (si+1) / double{BSincScaleCount})};
const uint a_{std::min(static_cast<uint>(num_points / 2.0 / scale), num_points)};
const uint m{2 * a_};
@@ -162,7 +161,7 @@ struct BSincFilterArray {
{
const uint m{hdr.a[si] * 2};
const size_t o{(BSincPointsMax-m) / 2};
- const double scale{hdr.scaleBase + (hdr.scaleRange * (si+1) / BSincScaleCount)};
+ const double scale{lerpd(hdr.scaleBase, 1.0, (si+1) / double{BSincScaleCount})};
const double cutoff{scale - (hdr.scaleBase * std::max(1.0, scale*2.0))};
const auto a = static_cast<double>(hdr.a[si]);
const double l{a - 1.0/BSincPhaseCount};
@@ -255,7 +254,7 @@ constexpr BSincTable GenerateBSincTable(const T &filter)
BSincTable ret{};
const BSincHeader &hdr = filter.getHeader();
ret.scaleBase = static_cast<float>(hdr.scaleBase);
- ret.scaleRange = static_cast<float>(1.0 / hdr.scaleRange);
+ ret.scaleRange = static_cast<float>(1.0 / (1.0 - hdr.scaleBase));
for(size_t i{0};i < BSincScaleCount;++i)
ret.m[i] = ((hdr.a[i]*2) + 3) & ~3u;
ret.filterOffset[0] = 0;