aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2022-09-23 17:16:37 -0700
committerChris Robinson <[email protected]>2022-09-23 17:16:37 -0700
commita326bf4e6452b1260a36e2b719d47aa0f0361f95 (patch)
tree62c7d6a6d69dc8530213890887bf90236e226860
parent839f960b4d303c92bcfefeb8fbb37e40136db2c3 (diff)
Move some comments to a more appropriate place
-rw-r--r--core/ambidefs.cpp64
1 files changed, 32 insertions, 32 deletions
diff --git a/core/ambidefs.cpp b/core/ambidefs.cpp
index 819ba9a6..4d78bf84 100644
--- a/core/ambidefs.cpp
+++ b/core/ambidefs.cpp
@@ -42,6 +42,13 @@ constexpr std::array<std::array<float,MaxAmbiOrder+1>,MaxAmbiOrder+1> HFScales2D
}};
+/* This calculates a first-order "upsampler" matrix. It combines a first-order
+ * decoder matrix with a max-order encoder matrix, creating a matrix that
+ * behaves as if the B-Format input signal is first decoded to a speaker array
+ * at first-order, then those speaker feeds are encoded to a higher-order
+ * signal. While not perfect, this should accurately encode a lower-order
+ * signal into a higher-order signal.
+ */
constexpr std::array<std::array<float,4>,8> FirstOrderDecoder{{
{{ 1.250000000e-01f, 1.250000000e-01f, 1.250000000e-01f, 1.250000000e-01f, }},
{{ 1.250000000e-01f, 1.250000000e-01f, 1.250000000e-01f, -1.250000000e-01f, }},
@@ -64,13 +71,6 @@ constexpr std::array<AmbiChannelFloatArray,8> FirstOrderEncoder{{
}};
static_assert(FirstOrderDecoder.size() == FirstOrderEncoder.size(), "First-order mismatch");
-/* This calculates a first-order "upsampler" matrix. It combines a first-order
- * decoder matrix with a max-order encoder matrix, creating a matrix that
- * behaves as if the B-Format input signal is first decoded to a speaker array
- * at first-order, then those speaker feeds are encoded to a higher-order
- * signal. While not perfect, this should accurately encode a lower-order
- * signal into a higher-order signal.
- */
auto CalcFirstOrderUp()
{
std::array<AmbiChannelFloatArray,4> res{};
@@ -90,6 +90,10 @@ auto CalcFirstOrderUp()
}
+/* This calculates a 2D first-order "upsampler" matrix. Same as the first-order
+ * matrix, just using a more optimized speaker array for horizontal-only
+ * content.
+ */
constexpr std::array<std::array<float,4>,4> FirstOrder2DDecoder{{
{{ 2.500000000e-01f, 2.041241452e-01f, 0.0f, 2.041241452e-01f, }},
{{ 2.500000000e-01f, 2.041241452e-01f, 0.0f, -2.041241452e-01f, }},
@@ -104,10 +108,6 @@ constexpr std::array<AmbiChannelFloatArray,4> FirstOrder2DEncoder{{
}};
static_assert(FirstOrder2DDecoder.size() == FirstOrder2DEncoder.size(), "First-order 2D mismatch");
-/* This calculates a 2D first-order "upsampler" matrix. Same as the first-order
- * matrix, just using a more optimized speaker array for horizontal-only
- * content.
- */
auto CalcFirstOrder2DUp()
{
std::array<AmbiChannelFloatArray,4> res{};
@@ -127,6 +127,10 @@ auto CalcFirstOrder2DUp()
}
+/* This calculates a second-order "upsampler" matrix. Same as the first-order
+ * matrix, just using a slightly more dense speaker array suitable for second-
+ * order content.
+ */
constexpr std::array<std::array<float,9>,12> SecondOrderDecoder{{
{{ 8.333333333e-02f, 0.000000000e+00f, -7.588274978e-02f, 1.227808683e-01f, 0.000000000e+00f, 0.000000000e+00f, -1.591525047e-02f, -1.443375673e-01f, 1.167715449e-01f, }},
{{ 8.333333333e-02f, -1.227808683e-01f, 0.000000000e+00f, 7.588274978e-02f, -1.443375673e-01f, 0.000000000e+00f, -9.316949906e-02f, 0.000000000e+00f, -7.216878365e-02f, }},
@@ -157,10 +161,6 @@ constexpr std::array<AmbiChannelFloatArray,12> SecondOrderEncoder{{
}};
static_assert(SecondOrderDecoder.size() == SecondOrderEncoder.size(), "Second-order mismatch");
-/* This calculates a second-order "upsampler" matrix. Same as the first-order
- * matrix, just using a slightly more dense speaker array suitable for second-
- * order content.
- */
auto CalcSecondOrderUp()
{
std::array<AmbiChannelFloatArray,9> res{};
@@ -180,6 +180,10 @@ auto CalcSecondOrderUp()
}
+/* This calculates a 2D second-order "upsampler" matrix. Same as the second-
+ * order matrix, just using a more optimized speaker array for horizontal-only
+ * content.
+ */
constexpr std::array<std::array<float,9>,6> SecondOrder2DDecoder{{
{{ 1.666666667e-01f, -9.622504486e-02f, 0.0f, 1.666666667e-01f, -1.490711985e-01f, 0.0f, 0.0f, 0.0f, 8.606629658e-02f, }},
{{ 1.666666667e-01f, -1.924500897e-01f, 0.0f, 0.000000000e+00f, 0.000000000e+00f, 0.0f, 0.0f, 0.0f, -1.721325932e-01f, }},
@@ -199,10 +203,6 @@ constexpr std::array<AmbiChannelFloatArray,6> SecondOrder2DEncoder{{
static_assert(SecondOrder2DDecoder.size() == SecondOrder2DEncoder.size(),
"Second-order 2D mismatch");
-/* This calculates a 2D second-order "upsampler" matrix. Same as the second-
- * order matrix, just using a more optimized speaker array for horizontal-only
- * content.
- */
auto CalcSecondOrder2DUp()
{
std::array<AmbiChannelFloatArray,9> res{};
@@ -222,6 +222,10 @@ auto CalcSecondOrder2DUp()
}
+/* This calculates a third-order "upsampler" matrix. Same as the first-order
+ * matrix, just using a more dense speaker array suitable for third-order
+ * content.
+ */
constexpr std::array<std::array<float,16>,20> ThirdOrderDecoder{{
{{ 5.000000000e-02f, 3.090169944e-02f, 8.090169944e-02f, 0.000000000e+00f, 0.000000000e+00f, 6.454972244e-02f, 9.045084972e-02f, 0.000000000e+00f, -1.232790000e-02f, -1.256118221e-01f, 0.000000000e+00f, 1.126112056e-01f, 7.944389175e-02f, 0.000000000e+00f, 2.421151497e-02f, 0.000000000e+00f, }},
{{ 5.000000000e-02f, -3.090169944e-02f, 8.090169944e-02f, 0.000000000e+00f, 0.000000000e+00f, -6.454972244e-02f, 9.045084972e-02f, 0.000000000e+00f, -1.232790000e-02f, 1.256118221e-01f, 0.000000000e+00f, -1.126112056e-01f, 7.944389175e-02f, 0.000000000e+00f, 2.421151497e-02f, 0.000000000e+00f, }},
@@ -268,10 +272,6 @@ constexpr std::array<AmbiChannelFloatArray,20> ThirdOrderEncoder{{
}};
static_assert(ThirdOrderDecoder.size() == ThirdOrderEncoder.size(), "Third-order mismatch");
-/* This calculates a third-order "upsampler" matrix. Same as the first-order
- * matrix, just using a more dense speaker array suitable for third-order
- * content.
- */
auto CalcThirdOrderUp()
{
std::array<AmbiChannelFloatArray,16> res{};
@@ -291,6 +291,10 @@ auto CalcThirdOrderUp()
}
+/* This calculates a 2D third-order "upsampler" matrix. Same as the third-order
+ * matrix, just using a more optimized speaker array for horizontal-only
+ * content.
+ */
constexpr std::array<std::array<float,16>,8> ThirdOrder2DDecoder{{
{{ 1.250000000e-01f, -5.523559567e-02f, 0.0f, 1.333505242e-01f, -9.128709292e-02f, 0.0f, 0.0f, 0.0f, 9.128709292e-02f, -1.104247249e-01f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 4.573941867e-02f, }},
{{ 1.250000000e-01f, -1.333505242e-01f, 0.0f, 5.523559567e-02f, -9.128709292e-02f, 0.0f, 0.0f, 0.0f, -9.128709292e-02f, 4.573941867e-02f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -1.104247249e-01f, }},
@@ -313,10 +317,6 @@ constexpr std::array<AmbiChannelFloatArray,8> ThirdOrder2DEncoder{{
}};
static_assert(ThirdOrder2DDecoder.size() == ThirdOrder2DEncoder.size(), "Third-order 2D mismatch");
-/* This calculates a 2D third-order "upsampler" matrix. Same as the third-order
- * matrix, just using a more optimized speaker array for horizontal-only
- * content.
- */
auto CalcThirdOrder2DUp()
{
std::array<AmbiChannelFloatArray,16> res{};
@@ -336,6 +336,11 @@ auto CalcThirdOrder2DUp()
}
+/* This calculates a 2D fourth-order "upsampler" matrix. There is no 3D fourth-
+ * order upsampler since fourth-order is the max order we'll be supporting for
+ * the foreseeable future. This is only necessary for mixing horizontal-only
+ * fourth-order content to 3D.
+ */
constexpr std::array<std::array<float,25>,10> FourthOrder2DDecoder{{
{{ 1.000000000e-01f, 3.568220898e-02f, 0.0f, 1.098185471e-01f, 6.070619982e-02f, 0.0f, 0.0f, 0.0f, 8.355491589e-02f, 7.735682057e-02f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 5.620301997e-02f, 8.573754253e-02f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.785781628e-02f, }},
{{ 1.000000000e-01f, 9.341723590e-02f, 0.0f, 6.787159473e-02f, 9.822469464e-02f, 0.0f, 0.0f, 0.0f, -3.191513794e-02f, 2.954767620e-02f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -9.093839659e-02f, -5.298871540e-02f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -7.293270986e-02f, }},
@@ -362,11 +367,6 @@ constexpr std::array<AmbiChannelFloatArray,10> FourthOrder2DEncoder{{
}};
static_assert(FourthOrder2DDecoder.size() == FourthOrder2DEncoder.size(), "Fourth-order 2D mismatch");
-/* This calculates a 2D fourth-order "upsampler" matrix. There is no 3D fourth-
- * order upsampler since fourth-order is the max order we'll be supporting for
- * the foreseeable future. This is only necessary for mixing horizontal-only
- * fourth-order content to 3D.
- */
auto CalcFourthOrder2DUp()
{
std::array<AmbiChannelFloatArray,25> res{};