aboutsummaryrefslogtreecommitdiffstats
path: root/core/bsinc_tables.cpp
diff options
context:
space:
mode:
authorSven Göthel <[email protected]>2024-01-05 13:52:12 +0100
committerSven Göthel <[email protected]>2024-01-05 13:52:12 +0100
commitec98cdacc85ff0202852472c7756586437912f22 (patch)
tree42414746a27ab35cb8cdbc95af521d74821e57f4 /core/bsinc_tables.cpp
parentfd5269bec9a5fe4815974b1786a037e6a247bfd2 (diff)
parentb82cd2e60edb8fbe5fdd3567105ae76a016a554c (diff)
Merge remote-tracking branch 'upstream/master'HEADmaster
Diffstat (limited to 'core/bsinc_tables.cpp')
-rw-r--r--core/bsinc_tables.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/core/bsinc_tables.cpp b/core/bsinc_tables.cpp
index 41102e9a..6e3ee338 100644
--- a/core/bsinc_tables.cpp
+++ b/core/bsinc_tables.cpp
@@ -5,9 +5,9 @@
#include <array>
#include <cassert>
#include <cmath>
+#include <cstddef>
#include <limits>
#include <memory>
-#include <stddef.h>
#include <stdexcept>
#include "alnumbers.h"
@@ -123,15 +123,13 @@ struct BSincHeader {
double beta{};
double scaleBase{};
- uint a[BSincScaleCount]{};
+ std::array<uint,BSincScaleCount> a{};
uint total_size{};
constexpr BSincHeader(uint Rejection, uint Order) noexcept
+ : width{CalcKaiserWidth(Rejection, Order)}, beta{CalcKaiserBeta(Rejection)}
+ , scaleBase{width / 2.0}
{
- width = CalcKaiserWidth(Rejection, Order);
- beta = CalcKaiserBeta(Rejection);
- scaleBase = width / 2.0;
-
uint num_points{Order+1};
for(uint si{0};si < BSincScaleCount;++si)
{
@@ -162,8 +160,9 @@ struct BSincFilterArray {
constexpr uint BSincPointsMax{(hdr.a[0]*2 + 3) & ~3u};
static_assert(BSincPointsMax <= MaxResamplerPadding, "MaxResamplerPadding is too small");
- using filter_type = double[BSincPhaseCount+1][BSincPointsMax];
- auto filter = std::make_unique<filter_type[]>(BSincScaleCount);
+ using filter_type = std::array<std::array<double,BSincPointsMax>,BSincPhaseCount+1>;
+ auto filterptr = std::make_unique<std::array<filter_type,BSincScaleCount>>();
+ const auto filter = filterptr->begin();
const double besseli_0_beta{cyl_bessel_i(0, hdr.beta)};
@@ -254,8 +253,8 @@ struct BSincFilterArray {
assert(idx == hdr.total_size);
}
- constexpr const BSincHeader &getHeader() const noexcept { return hdr; }
- constexpr const float *getTable() const noexcept { return &mTable.front(); }
+ [[nodiscard]] constexpr auto getHeader() const noexcept -> const BSincHeader& { return hdr; }
+ [[nodiscard]] constexpr auto getTable() const noexcept -> const float* { return mTable.data(); }
};
const BSincFilterArray<bsinc12_hdr> bsinc12_filter{};