aboutsummaryrefslogtreecommitdiffstats
path: root/core/bsinc_tables.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2021-03-01 01:03:44 -0800
committerChris Robinson <[email protected]>2021-03-01 01:03:44 -0800
commit9f349c21e702cb60dc6d75fdef2cc1b6e53780e9 (patch)
tree4f85441118fb04f650e010565c51580e4069e6b0 /core/bsinc_tables.cpp
parent6102cdae024d6d3903f611db129854658a1e1acd (diff)
Avoid cutting off the last bsinc filter coefficient
Diffstat (limited to 'core/bsinc_tables.cpp')
-rw-r--r--core/bsinc_tables.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/core/bsinc_tables.cpp b/core/bsinc_tables.cpp
index 8f375ac2..4ffb8fcb 100644
--- a/core/bsinc_tables.cpp
+++ b/core/bsinc_tables.cpp
@@ -171,19 +171,19 @@ struct BSincFilterArray {
const double scale{hdr.scaleBase + (hdr.scaleRange * (si+1) / BSincScaleCount)};
const double cutoff{scale - (hdr.scaleBase * std::max(0.5, scale) * 2.0)};
const auto a = static_cast<double>(hdr.a[si]);
- const double l{a - 1.0};
+ const double l{a - 1.0/BSincPhaseCount};
/* Do one extra phase index so that the phase delta has a proper
* target for its last index.
*/
for(uint pi{0};pi <= BSincPhaseCount;++pi)
{
- const double phase{l + (pi/double{BSincPhaseCount})};
+ const double phase{std::floor(l) + (pi/double{BSincPhaseCount})};
for(uint i{0};i < m;++i)
{
const double x{i - phase};
- filter[si][pi][o+i] = Kaiser(hdr.beta, x/a, hdr.besseli_0_beta) * cutoff *
+ filter[si][pi][o+i] = Kaiser(hdr.beta, x/l, hdr.besseli_0_beta) * cutoff *
Sinc(cutoff*x);
}
}