diff options
author | Chris Robinson <[email protected]> | 2022-08-18 18:43:15 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2022-08-18 18:44:37 -0700 |
commit | 4f75f9258ca316fdb52db4d61158a8e22b442e46 (patch) | |
tree | 406e22a756f7f4c3bbcc9a90023635a3ba753058 /core/ambidefs.cpp | |
parent | 2f3acdff4a568537cf9016404f26b3cf1d0122f2 (diff) |
Avoid duplicate code
Diffstat (limited to 'core/ambidefs.cpp')
-rw-r--r-- | core/ambidefs.cpp | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/core/ambidefs.cpp b/core/ambidefs.cpp index 22507c8a..12438689 100644 --- a/core/ambidefs.cpp +++ b/core/ambidefs.cpp @@ -3,55 +3,11 @@ #include "ambidefs.h" -#include <cassert> - -#include "alnumbers.h" -#include "opthelpers.h" - namespace { using AmbiChannelFloatArray = std::array<float,MaxAmbiChannels>; -/* Copied from mixer.cpp. */ -constexpr auto CalcAmbiCoeffs(const float y, const float z, const float x) -{ - const float xx{x*x}, yy{y*y}, zz{z*z}, xy{x*y}, yz{y*z}, xz{x*z}; - - return AmbiChannelFloatArray{{ - /* Zeroth-order */ - 1.0f, /* ACN 0 = 1 */ - /* First-order */ - al::numbers::sqrt3_v<float> * y, /* ACN 1 = sqrt(3) * Y */ - al::numbers::sqrt3_v<float> * z, /* ACN 2 = sqrt(3) * Z */ - al::numbers::sqrt3_v<float> * x, /* ACN 3 = sqrt(3) * X */ - /* Second-order */ - 3.872983346e+00f * xy, /* ACN 4 = sqrt(15) * X * Y */ - 3.872983346e+00f * yz, /* ACN 5 = sqrt(15) * Y * Z */ - 1.118033989e+00f * (3.0f*zz - 1.0f), /* ACN 6 = sqrt(5)/2 * (3*Z*Z - 1) */ - 3.872983346e+00f * xz, /* ACN 7 = sqrt(15) * X * Z */ - 1.936491673e+00f * (xx - yy), /* ACN 8 = sqrt(15)/2 * (X*X - Y*Y) */ - /* Third-order */ - 2.091650066e+00f * (y*(3.0f*xx - yy)), /* ACN 9 = sqrt(35/8) * Y * (3*X*X - Y*Y) */ - 1.024695076e+01f * (z*xy), /* ACN 10 = sqrt(105) * Z * X * Y */ - 1.620185175e+00f * (y*(5.0f*zz - 1.0f)), /* ACN 11 = sqrt(21/8) * Y * (5*Z*Z - 1) */ - 1.322875656e+00f * (z*(5.0f*zz - 3.0f)), /* ACN 12 = sqrt(7)/2 * Z * (5*Z*Z - 3) */ - 1.620185175e+00f * (x*(5.0f*zz - 1.0f)), /* ACN 13 = sqrt(21/8) * X * (5*Z*Z - 1) */ - 5.123475383e+00f * (z*(xx - yy)), /* ACN 14 = sqrt(105)/2 * Z * (X*X - Y*Y) */ - 2.091650066e+00f * (x*(xx - 3.0f*yy)), /* ACN 15 = sqrt(35/8) * X * (X*X - 3*Y*Y) */ - /* Fourth-order */ - /* ACN 16 = sqrt(35)*3/2 * X * Y * (X*X - Y*Y) */ - /* ACN 17 = sqrt(35/2)*3/2 * (3*X*X - Y*Y) * Y * Z */ - /* ACN 18 = sqrt(5)*3/2 * X * Y * (7*Z*Z - 1) */ - /* ACN 19 = sqrt(5/2)*3/2 * Y * Z * (7*Z*Z - 3) */ - /* ACN 20 = 3/8 * (35*Z*Z*Z*Z - 30*Z*Z + 3) */ - /* ACN 21 = sqrt(5/2)*3/2 * X * Z * (7*Z*Z - 3) */ - /* ACN 22 = sqrt(5)*3/4 * (X*X - Y*Y) * (7*Z*Z - 1) */ - /* ACN 23 = sqrt(35/2)*3/2 * (X*X - 3*Y*Y) * X * Z */ - /* ACN 24 = sqrt(35)*3/8 * (X*X*X*X - 6*X*X*Y*Y + Y*Y*Y*Y) */ - }}; -} - constexpr std::array<std::array<float,4>,8> FirstOrderDecoder{{ {{ 1.250000000e-01f, 1.250000000e-01f, 1.250000000e-01f, 1.250000000e-01f, }}, |