aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2022-08-16 13:00:03 -0700
committerChris Robinson <[email protected]>2022-08-16 13:00:03 -0700
commit90f02176dd46f0754ed0c5f1e95b9ba9917839bb (patch)
treee3a792bbbe31939abae8b01a3bf66344b2aa9380 /core
parent832ccd7f489f7db763a164c663d730f4cadb71bc (diff)
Inline a function and remove an unnecessary parameter
Diffstat (limited to 'core')
-rw-r--r--core/ambidefs.cpp37
-rw-r--r--core/ambidefs.h12
-rw-r--r--core/voice.cpp2
3 files changed, 21 insertions, 30 deletions
diff --git a/core/ambidefs.cpp b/core/ambidefs.cpp
index f5f4289e..22507c8a 100644
--- a/core/ambidefs.cpp
+++ b/core/ambidefs.cpp
@@ -13,25 +13,6 @@ namespace {
using AmbiChannelFloatArray = std::array<float,MaxAmbiChannels>;
-constexpr std::array<float,MaxAmbiOrder+1> Ambi3DDecoderHFScale10{{
- 2.000000000e+00f, 1.154700538e+00f
-}};
-constexpr std::array<float,MaxAmbiOrder+1> Ambi3DDecoderHFScale2O{{
- 1.972026594e+00f, 1.527525232e+00f, 7.888106377e-01f
-}};
-/* TODO: Set properly when making the third-order upsampler decoder. */
-constexpr std::array<float,MaxAmbiOrder+1> Ambi3DDecoderHFScale3O{{
- 1.000000000e+00f, 1.000000000e+00f, 1.000000000e+00f, 1.000000000e+00f
-}};
-
-inline auto& GetDecoderHFScales(uint order) noexcept
-{
- if(order >= 3) return Ambi3DDecoderHFScale3O;
- if(order == 2) return Ambi3DDecoderHFScale2O;
- return Ambi3DDecoderHFScale10;
-}
-
-
/* Copied from mixer.cpp. */
constexpr auto CalcAmbiCoeffs(const float y, const float z, const float x)
{
@@ -195,11 +176,13 @@ const std::array<AmbiChannelFloatArray,4> AmbiScale::FirstOrderUp{CalcFirstOrder
const std::array<AmbiChannelFloatArray,9> AmbiScale::SecondOrderUp{CalcSecondOrderUp()};
const std::array<AmbiChannelFloatArray,16> AmbiScale::ThirdOrderUp{CalcThirdOrderUp()};
-
-auto AmbiScale::GetHFOrderScales(const uint in_order, const uint out_order) noexcept
- -> std::array<float,MaxAmbiOrder+1>
-{
- if(unlikely(in_order >= out_order))
- return {1.0f, 1.0f, 1.0f, 1.0f};
- return GetDecoderHFScales(in_order);
-}
+const std::array<float,MaxAmbiOrder+1> AmbiScale::DecoderHFScale10{{
+ 2.000000000e+00f, 1.154700538e+00f
+}};
+const std::array<float,MaxAmbiOrder+1> AmbiScale::DecoderHFScale2O{{
+ 1.972026594e+00f, 1.527525232e+00f, 7.888106377e-01f
+}};
+/* TODO: Set properly when making the third-order upsampler decoder. */
+const std::array<float,MaxAmbiOrder+1> AmbiScale::DecoderHFScale3O{{
+ 1.000000000e+00f, 1.000000000e+00f, 1.000000000e+00f, 1.000000000e+00f
+}};
diff --git a/core/ambidefs.h b/core/ambidefs.h
index 57b847bf..80383450 100644
--- a/core/ambidefs.h
+++ b/core/ambidefs.h
@@ -111,8 +111,16 @@ struct AmbiScale {
}
/* Retrieves per-order HF scaling factors for "upsampling" ambisonic data. */
- static std::array<float,MaxAmbiOrder+1> GetHFOrderScales(const uint in_order,
- const uint out_order) noexcept;
+ static std::array<float,MaxAmbiOrder+1> GetHFOrderScales(const uint order) noexcept
+ {
+ if(order >= 3) return DecoderHFScale3O;
+ if(order == 2) return DecoderHFScale2O;
+ return DecoderHFScale10;
+ }
+
+ static const std::array<float,MaxAmbiOrder+1> DecoderHFScale10;
+ static const std::array<float,MaxAmbiOrder+1> DecoderHFScale2O;
+ static const std::array<float,MaxAmbiOrder+1> DecoderHFScale3O;
static const std::array<std::array<float,MaxAmbiChannels>,4> FirstOrderUp;
static const std::array<std::array<float,MaxAmbiChannels>,9> SecondOrderUp;
diff --git a/core/voice.cpp b/core/voice.cpp
index 4030fc5b..bda4a113 100644
--- a/core/voice.cpp
+++ b/core/voice.cpp
@@ -899,7 +899,7 @@ void Voice::prepare(DeviceBase *device)
{
const uint8_t *OrderFromChan{Is2DAmbisonic(mFmtChannels) ?
AmbiIndex::OrderFrom2DChannel().data() : AmbiIndex::OrderFromChannel().data()};
- const auto scales = AmbiScale::GetHFOrderScales(mAmbiOrder, device->mAmbiOrder);
+ const auto scales = AmbiScale::GetHFOrderScales(mAmbiOrder);
const BandSplitter splitter{device->mXOverFreq / static_cast<float>(device->Frequency)};
for(auto &chandata : mChans)