41#define JPL_DBG_DUMP_SPEAKER_FAILED_SELECTION 0
43#if JPL_DBG_DUMP_SPEAKER_FAILED_SELECTION
53 concept CLUT =
requires {
typename T::GainType; }&&
requires {
typename T::SpeakerIndexType; };
57 template<auto GetSpeakerVectorFunction,
class LUTCodec, CVec3 Vec3Type, CLUT LUTType>
60 template<CLUT LUTType,
class LUTCodec, CVec3 Vec3TypeImplicit>
66 template<auto GetSpeakerVectorFunction,
class LUTCodec, CLUT LUTType>
111 template<CLUTType auto T,
size_t N, CVec3 Vec3Type =
void*>
141 template<CVec3 Vec3Type>
144 static_assert(!std::same_as<Vec3Type, void*> &&
"Vec3Type is not specified for the LUT that requires it.");
151 template<
class DynamicDataType_>
163 template<
size_t N,
class GainType_,
class SpeakerIndexType_,
class DynamicDataType_ = DynamicDataTypeNone>
169 std::array<GainPack<GainType>, N>
Gains;
174 template<
size_t N,
class SpeakerIndexType_,
class DynamicDataType_>
186 template<
size_t N, CVec3 Vec3Type>
188 :
LUTBase<N, float, SpeakerTripletIdx> {};
190 template<
size_t N, CVec3 Vec3Type>
192 :
LUTBase<N, float, TripletIdx, DynamicDataTri> {};
194 template<
size_t N, CVec3 Vec3Type>
196 :
LUTBase<N, Gain24Bit, SpeakerTripletIdx> {};
198 template<
size_t N, CVec3 Vec3Type>
200 :
LUTBase<N, Gain24Bit, TripletIdx, DynamicDataTri> {};
202 template<
size_t N, CVec3 Vec3Type>
204 :
LUTBase<N, GainTypeNone, TripletIdx, DynamicDataWithMat<Vec3Type>> {};
207 template<
size_t N, CVec3 Vec3Type>
struct LUT<
ELUTSize::KB_589, N, Vec3Type> :
LUTBase<N, Gain16Bit, SpeakerTripletIdx> {};
208 template<
size_t N, CVec3 Vec3Type>
struct LUT<
ELUTSize::KB_458, N, Vec3Type> : LUTBase<N, Gain16Bit, TripletIdx, DynamicDataTri> {};
226 template<
size_t N, CVec3 Vec3Type>
231 template<CLUT LUTType,
class LUTCodec, CVec3 Vec3TypeImplicit>
238 static constexpr bool bLUTHasGains = !std::same_as<typename LUTType::GainType, GainTypeNone>;
248 JPL_INLINE
explicit LUTQuery(
const LUTType& lut) noexcept :
LUT(lut) {}
253 template<CVec3 Vec3Type>
254 void GainsFor(
const Vec3Type& direction, VBAPCell& outSpeakerGains)
const;
258 std::array<
float, 3 *
simd::size()>& outGains)
const;
263 template<CVec3 Vec3Type>
264 JPL_INLINE
void GainsFor(
const Vec3Type& direction, std::span<float> outGains)
const;
267 JPL_INLINE
void ExtractGains(
int index, std::span<float, 3> outGains)
const requires (
bLUTHasGains);
270 template<CVec3 Vec3Type>
271 JPL_INLINE
void ExtractGains(
int index,
const Vec3Type& direction, std::span<float, 3> outGains)
const requires (!
bLUTHasGains);
279 template<auto GetSpeakerVectorFunction,
class LUTCodec, CVec3 Vec3Type, CLUT LUTType>
289 [[nodiscard]] JPL_INLINE
const std::pmr::vector<SpeakerTripletIdx>&
GetTris() const noexcept {
return mTris; }
301 [[nodiscard]]
bool ComputeCellFor(
const Vec3Type& direction,
int lutIndex);
306#if JPL_VALIDATE_VBAP_LUT
307 void ValidateLUT()
const;
312 JPL_INLINE
void Compute2DMats();
314 JPL_INLINE
bool Triangulate();
315 JPL_INLINE
void ComputeTriMatrices();
318 JPL_INLINE
uint32 FindReaplacementForDummy(const SpeakerTriangulation::Vec3i& tri) const;
322 std::pmr::vector<Vec3Type> mVectors;
326 uint32 mNumRealSpeakers = 0;
327 uint32 mNumGroundSpeakers = 0;
328 uint32 mNumTopSpeakers = 0;
332 std::pmr::vector<Math::Mat3<Vec3Type>> mTrisInvMats;
348#define JPL_NORMALIZE_GAINS_WITH_DUMMY 0
353 template<auto GetSpeakerVectorFunction,
class LUTCodec , CVec3 Vec3Type, CLUT LUTType>
357 , mDummySpeakers(channelMap, mVectors)
369 mVectors.push_back(GetSpeakerVectorFunction(channel));
389 mDummySpeakers.AddDummy(Vec3Type(0.0f, -1.0f, 0.0f));
396 if (mNumTopSpeakers == 6 || mNumTopSpeakers == 4)
416 ExtractDynamicData();
421 JPL_ASSERT(
false,
"Failed to triangulate speaker setup.");
427 template<auto GetSpeakerVectorFunction,
class LUTCodec, CVec3 Vec3Type, CLUT LUTType>
430 const ChannelMap channelMap = mDummySpeakers.GetChannelMap();
434 using ChannelAngleArray =
typename Traits::template Array<ChannelAngle<Traits>>;
435 ChannelAngleArray sourceChannelsSorted;
438 JPL_ASSERT(sourceChannelsSorted.size() >= mNumGroundSpeakers);
442 const Vec2 A{ mVectors[a].X, mVectors[aGetZ(]) };
443 const Vec2 B{ mVectors[b].X, mVectors[bGetZ(]) };
444 Math::Mat2<Vec2> L{ A, B };
446 auto& Linv = m2DMats.emplace_back();
453 uint32 firstChannelIdx = sourceChannelsSorted[mNumGroundSpeakers - 1].ChannelId;
456 for (
uint32 i = 0; i < sourceChannelsSorted.size() && i < mNumGroundSpeakers; ++i)
458 const uint32 secondChannelIdx = sourceChannelsSorted[i].ChannelId;
459 createEdgeMat(firstChannelIdx, secondChannelIdx);
460 firstChannelIdx = secondChannelIdx;
465 template<auto GetSpeakerVectorFunction,
class LUTCodec, CVec3 Vec3Type, CLUT LUTType>
466 JPL_INLINE
bool LUTBuilder<GetSpeakerVectorFunction, LUTCodec, Vec3Type, LUTType>::Triangulate()
470 ComputeTriMatrices();
476 template<auto GetSpeakerVectorFunction,
class LUTCodec, CVec3 Vec3Type, CLUT LUTType>
477 JPL_INLINE
void LUTBuilder<GetSpeakerVectorFunction, LUTCodec, Vec3Type, LUTType>::ComputeTriMatrices()
479 mTrisInvMats.clear();
480 mTrisInvMats.reserve(mTris.size());
483 Math::Mat3<Vec3Type> L{ mVectors[tri[0]], mVectors[tri[1]], mVectors[tri[2]] };
484 Math::Mat3<Vec3Type>& Linv = mTrisInvMats.emplace_back();
489 template<auto GetSpeakerVectorFunction,
class LUTCodec, CVec3 Vec3Type, CLUT LUTType>
492 float maxDot = -std::numeric_limits<float>::max();
495 const Vec3Type& A = mVectors[tri[0]];
496 const Vec3Type& B = mVectors[tri[1]];
497 const Vec3Type& C = mVectors[tri[2]];
499 maxDot = std::max({ maxDot, DotProduct(A, B), DotProduct(B, C), DotProduct(C, A) });
501 JPL_ASSERT(maxDot > -std::numeric_limits<float>::max());
505 template<auto GetSpeakerVectorFunction,
class LUTCodec, CVec3 Vec3Type, CLUT LUTType>
509 SanitizeSpeakerIndex(triplet[0]),
510 SanitizeSpeakerIndex(triplet[1]),
511 SanitizeSpeakerIndex(triplet[2])
515 template<auto GetSpeakerVectorFunction,
class LUTCodec, CVec3 Vec3Type, CLUT LUTType>
518 return speakerIndex +
uint8(speakerIndex >= mLFEIndex);
521 template<auto GetSpeakerVectorFunction,
class LUTCodec, CVec3 Vec3Type, CLUT LUTType>
524 using LUTGainType =
typename LUTType::GainType;
525 using LUTSpeakerIdxType =
typename LUTType::SpeakerIndexType;
526 static constexpr bool bLUTHasGains = !std::same_as<LUTGainType, GainTypeNone>;
527 static constexpr bool bLUTStoresTripletIdx = std::same_as<LUTSpeakerIdxType, TripletIdx>;
529 Vec3Type directionSafe = direction;
546 for (
int triI = 0; triI < mTrisInvMats.size(); ++triI)
548 Vec3Type gains = mTrisInvMats[triI].Transform(directionSafe);
550 static constexpr float eps = -JPL_FLOAT_EPS;
551 if (
GetX(gains) < eps ||
GetY(gains) < eps ||
GetZ(gains) < eps)
560#if JPL_NORMALIZE_GAINS_WITH_DUMMY
567#if defined(JPL_ENABLE_ASSERTS)
570 [[maybe_unused]]
int numDummies = 0;
571 for (
const uint32 idx : tri)
572 numDummies += mDummySpeakers.Contains(idx);
579 if constexpr (bLUTHasGains)
583 if (mDummySpeakers.Contains(tri[0]))
588 else if (mDummySpeakers.Contains(tri[1]))
593 else if (mDummySpeakers.Contains(tri[2]))
602 tri[dummy] = FindReaplacementForDummy(tri);
605#if !JPL_NORMALIZE_GAINS_WITH_DUMMY
613 if constexpr (bLUTHasGains)
615 mLUT.Gains[lutIndex] = { LUTGainType(
GetX(gains)), LUTGainType(
GetY(gains)), LUTGainType(
GetZ(gains)) };
618 if constexpr (bLUTStoresTripletIdx)
620 mLUT.Speakers[lutIndex] = SanitizeSpeakerIndex(triI);
624 mLUT.Speakers[lutIndex] = {
625 SanitizeSpeakerIndex(
static_cast<SpeakerIdx>(tri[0])),
626 SanitizeSpeakerIndex(
static_cast<SpeakerIdx>(tri[1])),
627 SanitizeSpeakerIndex(
static_cast<SpeakerIdx>(tri[2]))
634#if JPL_DBG_DUMP_SPEAKER_FAILED_SELECTION
635 std::stringstream ss;
636 for (
int triI = 0; triI < mTrisInvMats.size(); ++triI)
638 ss <<
"triI " << triI <<
'\n';
640 const auto& tri = mTris[triI];
642 const auto& A = mVectors[tri[0]];
643 ss <<
"A: " <<
GetX(A) <<
" " <<
GetY(A) <<
" " <<
GetZ(A) <<
'\n';
645 const auto& B = mVectors[tri[1]];
646 ss <<
"B: " <<
GetX(B) <<
" " <<
GetY(B) <<
" " <<
GetZ(B) <<
'\n';
648 const auto& C = mVectors[tri[2]];
649 ss <<
"C: " <<
GetX(C) <<
" " <<
GetY(C) <<
" " <<
GetZ(C) <<
'\n';
651 Vec3Type gains = mTrisInvMats[triI].Transform(directionSafe);
653 ss <<
"gains: " <<
GetX(gains) <<
" " <<
GetY(gains) <<
" " <<
GetZ(gains) <<
'\n';
657 std::string dump = ss.str();
659 const auto formatString = std::format(
"Computing VBAP LUT failed. Direction {{{}, {}, {}}}, LUT index {}, InvMatsSize {}"
660 "\n Triplets Dump:\n {}",
668 JPL_ASSERT(
false,
"Computing VBAP LUT failed.");
671 if constexpr (bLUTHasGains)
673 mLUT.Gains[lutIndex] = { LUTGainType(0.0f), LUTGainType(0.0f), LUTGainType(0.0f) };
676 if constexpr (bLUTStoresTripletIdx)
678 mLUT.Speakers[lutIndex] = std::numeric_limits<SpeakerIdx>::max();
682 mLUT.Speakers[lutIndex] = {
683 std::numeric_limits<SpeakerIdx>::max(),
684 std::numeric_limits<SpeakerIdx>::max(),
685 std::numeric_limits<SpeakerIdx>::max()
692 template<auto GetSpeakerVectorFunction,
class LUTCodec, CVec3 Vec3Type, CLUT LUTType>
695 bool bAnyFailed =
false;
700 for (uint16_t dy = 0; dy < LUTCodec::cAxisRange; ++dy)
702 for (uint16_t dx = 0; dx < LUTCodec::cAxisRange; ++dx)
704 if (!LUTCodec::AreValidComponents(dx, dy))
707 const uint32_t code = LUTCodec::CombineComponents(dx, dy);
708 const Vec3Type dir = LUTCodec::template Decode<Vec3Type>(code);
711 bAnyFailed |= ComputeCellFor(dir, code);
718#if JPL_VALIDATE_VBAP_LUT
719 template<auto GetSpeakerVectorFunction,
class LUTCodec, CVec3 Vec3Type, CLUT LUTType>
722 for (
uint32 i = 0; i < mLUT.Speakers.size(); ++i)
724 if (!LUTCodec::IsValidCode(i))
727 if constexpr (std::same_as<typename LUTType::SpeakerIndexType, SpeakerTripletIdx>)
729 const auto& speakers = mLUT.Speakers[i];
739 const TripletIdx tripletIdx = mLUT.Speakers[i];
748 if constexpr (
requires{ mLUT.Gains; })
750 for (
uint32 i = 0; i < mLUT.Gains.size(); ++i)
752 if (!LUTCodec::IsValidCode(i))
755 const auto& gains = mLUT.Gains[i];
757 const std::array<float, 3> gainsDecoded
769 template<auto GetSpeakerVectorFunction,
class LUTCodec, CVec3 Vec3Type, CLUT LUTType>
770 inline void LUTBuilder<GetSpeakerVectorFunction, LUTCodec, Vec3Type, LUTType>::ExtractDynamicData() const requires(cLUTHasDynamicData)
772 mLUT.Data.resize(mTris.size());
774 for (
uint32 i = 0; i < mLUT.Data.size(); ++i)
776 auto& data = mLUT.Data[i];
778 if constexpr (
requires{ data.Tri; })
780 static_assert(
requires{ data.DummyIndex; });
786 for (; data.DummyIndex < 3; ++data.DummyIndex)
788 if (mDummySpeakers.Contains(data.Tri[data.DummyIndex]))
790 data.Tri[data.DummyIndex] = FindReaplacementForDummy(data.Tri);
798 if constexpr (
requires{ data.TrisInvMat; })
799 data.TrisInvMat = mTrisInvMats[i];
803 template<auto GetSpeakerVectorFunction,
class LUTCodec, CVec3 Vec3Type, CLUT LUTType>
809 while (std::ranges::find(tri, newI) != std::ranges::end(tri))
819 template<CLUT LUTType,
class LUTCodec, CVec3 Vec3TypeImplicit>
820 template<CVec3 Vec3Type>
828 const auto index = LUTCodec::Encode(direction);
830 if constexpr (std::same_as<typename LUTType::SpeakerIndexType, SpeakerTripletIdx>)
832 outSpeakers =
LUT.Speakers[index];
833 ExtractGains(index, outGains);
839 outSpeakers =
LUT.Data[tripletIdx].Tri;
842 std::array<float, 4> gains{ 0.0f, 0.0f, 0.0f, 0.0f };
844 if constexpr (bLUTHasGains)
845 ExtractGains(index, std::span<float, 3>(gains.data(), 3));
847 ExtractGains(index, direction, std::span<float, 3>(gains.data(), 3));
850 const uint8 dummyIndex =
LUT.Data[tripletIdx].DummyIndex;
852 if constexpr (bLUTHasGains)
854 gains[dummyIndex] = 0.0f;
858#if !JPL_NORMALIZE_GAINS_WITH_DUMMY
869 gains[dummyIndex] = 0.0f;
877 gains[dummyIndex] = 0.0f;
882 std::memcpy(outGains.data(), gains.data(),
sizeof(
float) * 3);
888 template<CLUT LUTType,
class LUTCodec, CVec3 Vec3TypeImplicit>
891 std::array<
float, 3 *
simd::size()>& outSpeakerGains)
const
894 const simd_mask indexPack = LUTCodec::Encode(dirX, dirY, dirZ);
895 std::array<uint32, 4> indices;
896 indexPack.
store(indices.data());
902 if constexpr (std::same_as<typename LUTType::SpeakerIndexType, SpeakerTripletIdx>)
904 for (
uint32 i = 0, iout = 0; i < indices.size(); ++i, iout += 3)
906 const uint32 index = indices[i];
907 std::memcpy(&outSpeakersIndices[iout], &
LUT.Speakers[index],
sizeof(
SpeakerIdx) * 3);
908 ExtractGains(index, std::span<float, 3>(&outSpeakerGains[iout], 3));
913 if constexpr (bLUTHasGains)
918 for (
uint32 i = 0, iout = 0; i < indices.size(); ++i, iout += 3)
921 const uint32 index = indices[i];
923 std::memcpy(&outSpeakersIndices[iout], &
LUT.Data[tripletIdx].Tri,
sizeof(
SpeakerIdx) * 3);
926 std::array<float, 4> gains{ 0.0f, 0.0f, 0.0f, 0.0f };
927 ExtractGains(index, std::span<float, 3>(gains.data(), 3));
930 const uint8 dummyIndex =
LUT.Data[tripletIdx].DummyIndex;
931 gains[dummyIndex] = 0.0f;
934 std::memcpy(&outSpeakerGains[iout], gains.data(),
sizeof(
float) * 3);
942 std::array<Vec3TypeImplicit, 4> directions;
948 Vec3TypeImplicit& direction = directions[i];
949 SetX(direction, xs[i]);
SetY(direction, ys[i]);
SetZ(direction, zs[i]);
953 for (
uint32 i = 0, iout = 0; i < indices.size(); ++i, iout += 3)
955 const uint32 index = indices[i];
956 Vec3TypeImplicit& direction = directions[i];
960 std::memcpy(&outSpeakersIndices[iout], &
LUT.Data[tripletIdx].Tri,
sizeof(
SpeakerIdx) * 3);
963 std::array<float, 4> gains{ 0.0f, 0.0f, 0.0f, 0.0f };
964 ExtractGains(index, direction, std::span<float, 3>(gains.data(), 3));
967 const uint8 dummyIndex =
LUT.Data[tripletIdx].DummyIndex;
969#if !JPL_NORMALIZE_GAINS_WITH_DUMMY
980 gains[dummyIndex] = 0.0f;
988 gains[dummyIndex] = 0.0f;
991 std::memcpy(&outSpeakerGains[iout], gains.data(),
sizeof(
float) * 3);
999 template<CLUT LUTType,
class LUTCodec, CVec3 Vec3TypeImplicit>
1000 template<CVec3 Vec3Type>
1004 GainsFor(direction, cell);
1011 template<CLUT LUTType,
class LUTCodec, CVec3 Vec3TypeImplicit>
1014 if constexpr (std::same_as<typename LUTType::GainType, float>)
1016 std::memcpy(outGains.data(),
LUT.Gains[index].data(),
sizeof(
float) * 3);
1020 static_assert(std::same_as<typename LUTType::GainType, Gain24Bit>);
1024 outGains[0] = pack[0]; outGains[1] = pack[1]; outGains[2] = pack[2];
1028 template<CLUT LUTType,
class LUTCodec, CVec3 Vec3TypeImplicit>
1029 template<CVec3 Vec3Type>
1030 JPL_INLINE
void LUTQuery<LUTType, LUTCodec, Vec3TypeImplicit>::ExtractGains(
int index,
const Vec3Type& direction, std::span<float, 3> outGains)
const requires (!bLUTHasGains)
1033 const TripletIdx triplet = LUT.Speakers[index];
1036 const Vec3Type gainsV = LUT.Data[triplet].TrisInvMat.Transform(direction);
1037 outGains[0] =
GetX(gainsV); outGains[1] =
GetY(gainsV); outGains[2] =
GetZ(gainsV);
#define JPL_ASSERT(inExpression,...)
Main assert macro, usage: JPL_ASSERT(condition, message) or JPL_ASSERT(condition)
Definition ErrorReporting.h:80
#define JPL_ENSURE(inExpression,...)
Define ENSURE.
Definition ErrorReporting.h:94
Definition ChannelMap.h:154
constexpr void ForEachChannel(Predicate predicate) const
Definition ChannelMap.h:222
Utility class to encapsulate dummy speaker handling while building a LUT.
Definition DummySpeakers.h:36
JPL_INLINE constexpr uint32 GetNumDummies() const noexcept
Definition DummySpeakers.h:75
Forward declarations.
Definition VBAPLUT3D.h:281
JPL_INLINE uint32 GetNumDummies() const noexcept
Definition VBAPLUT3D.h:287
JPL_INLINE bool BuildForAllDirections()
Build the entire LUT for all directions.
Definition VBAPLUT3D.h:693
JPL_INLINE uint32 GetNumRealChannels() const noexcept
Definition VBAPLUT3D.h:288
bool ComputeCellFor(const Vec3Type &direction, int lutIndex)
Definition VBAPLUT3D.h:522
LUTBuilder(ChannelMap channelMap, LUTType &outLUT)
Definition VBAPLUT3D.h:354
static constexpr bool cLUTHasDynamicData
Definition VBAPLUT3D.h:283
SpeakerTripletIdx SanitizeSpeakerIndex(const SpeakerTripletIdx &triplet) const
Definition VBAPLUT3D.h:506
float FindShortestAperture() const
Definition VBAPLUT3D.h:490
JPL_INLINE const std::pmr::vector< SpeakerTripletIdx > & GetTris() const noexcept
Definition VBAPLUT3D.h:289
Definition VBAPLUT3D.h:68
LUTQuery< LUTType, LUTCodec, Vec3Type > QueryType
Definition VBAPLUT3D.h:73
LUTBuilder< GetSpeakerVectorFunction, LUTCodec, Vec3Type, LUTType > BuilderType
Definition VBAPLUT3D.h:72
std::remove_cvref_t< decltype(GetSpeakerVectorFunction(EChannel{}))> Vec3Type
Definition VBAPLUT3D.h:70
static JPL_INLINE BuilderType MakeBuilder(ChannelMap channelMap, LUTType &lut)
Make LUTBuilder object to build LUT for given 'channelMap' and 'LUTType'.
Definition VBAPLUT3D.h:77
static JPL_INLINE QueryType Query(const LUTType &LUT)
Make LUTQuery object to query 'LUT' for speaker gains.
Definition VBAPLUT3D.h:83
Interface to query LUT gains for a direction.
Definition VBAPLUT3D.h:233
static constexpr bool bLUTHasGains
Definition VBAPLUT3D.h:238
void GainsFor(const Vec3Type &direction, VBAPCell &outSpeakerGains) const
Definition VBAPLUT3D.h:821
JPL_INLINE LUTQuery(const LUTType &lut) noexcept
Definition VBAPLUT3D.h:248
const LUTType & LUT
Definition VBAPLUT3D.h:274
Definition VBAPLUT3D.h:106
VBAP LUT interfaces only accept LUT types defined below.
Definition VBAPLUT3D.h:53
JPL_INLINE constexpr void NormalizeL2(ContainerType &&data)
Apply unit vector scaling, so that the magnitude of the vector = 1.
Definition Algorithm.h:98
JPL_INLINE constexpr bool IsNormalizedL2(const ContainerType &data, float tolerance=JPL_FLOAT_EPS)
Definition Algorithm.h:115
JPL_INLINE constexpr bool IsNearlyZero(T value, T errorTolerance=JPL_FLOAT_EPS_V< T >) noexcept
Definition Math.h:146
JPL_INLINE constexpr bool IsNearlyEqual(T a, T b, T tolerance=JPL_FLOAT_EPS_V< T >) noexcept
Definition Math.h:152
std::array< uint8, 3 > Vec3i
Definition VBAPEx.h:92
bool TriangulateSpeakerLayout(std::span< const Vec3Type > speakerVectors, Vec3iContainerType &outIndices)
Definition VBAPEx.h:141
Forward declaration.
Definition DummySpeakers.h:31
uint8 TripletIdx
Definition VBAPLUT3D.h:130
void * DynamicDataTypeNone
Definition VBAPLUT3D.h:149
std::array< SpeakerIdx, 3 > SpeakerTripletIdx
Direct indices of the speakers, corersponding to channels in the output buffer.
Definition VBAPLUT3D.h:126
std::array< T, 3 > GainPack
Alias for speaker triplet gains.
Definition VBAPLUT3D.h:117
void * GainTypeNone
LUT can be made out of just the selected speaker triplets, without precomputed gains.
Definition VBAPLUT3D.h:120
ELUTSize
Definition VBAPLUT3D.h:94
uint8 SpeakerIdx
Index of a speaker/channel.
Definition VBAPLUT3D.h:123
JPL_INLINE void SetZ(Vec3Type &v, Vec3FloatType< Vec3Type > value) noexcept
Definition Vec3Traits.h:41
std::uint32_t uint32
Definition Core.h:311
JPL_INLINE auto GetX(const Vec3Type &v) noexcept
Definition Vec3Traits.h:35
JPL_INLINE void SetY(Vec3Type &v, Vec3FloatType< Vec3Type > value) noexcept
Definition Vec3Traits.h:40
std::uint8_t uint8
Definition Core.h:309
JPL_INLINE auto GetZ(const Vec3Type &v) noexcept
Definition Vec3Traits.h:37
std::pmr::memory_resource * GetDefaultMemoryResource() noexcept
Definition Memory.h:42
EChannel
Definition ChannelMap.h:39
@ TOP_Channels
Definition ChannelMap.h:75
@ TopCenter
Definition ChannelMap.h:58
@ LFE
Definition ChannelMap.h:43
JPL_INLINE auto GetY(const Vec3Type &v) noexcept
Definition Vec3Traits.h:36
JPL_INLINE void SetX(Vec3Type &v, Vec3FloatType< Vec3Type > value) noexcept
Definition Vec3Traits.h:39
Definition ChannelMap.h:272
Minimal 3x3 matrix interface.
Definition MinimalMat.h:83
static void GetSortedChannelAngles(ChannelMap channelMap, ArrayType< ChannelAngle, Args... > &sortedChannelAngles, std::function< float(EChannel)> getChannelAngle, bool skipLFE=true)
Get channel angles from ChannelMap, normalize to [0, Pi] and sort in assending order.
Definition VBAPEx.h:258
Definition VBAPLUT3D.h:153
std::pmr::vector< DynamicDataType > Data
Definition VBAPLUT3D.h:155
DynamicDataType_ DynamicDataType
Definition VBAPLUT3D.h:154
Definition VBAPLUT3D.h:136
SpeakerTripletIdx Tri
Definition VBAPLUT3D.h:137
uint8 DummyIndex
Definition VBAPLUT3D.h:138
Definition VBAPLUT3D.h:143
Math::Mat3< Vec3Type > TrisInvMat
Definition VBAPLUT3D.h:146
SpeakerIndexType_ SpeakerIndexType
Definition VBAPLUT3D.h:178
std::array< SpeakerIndexType, N > Speakers
Definition VBAPLUT3D.h:180
GainTypeNone GainType
Definition VBAPLUT3D.h:177
Base to compose LUT specializations.
Definition VBAPLUT3D.h:165
std::array< SpeakerIndexType, N > Speakers
Definition VBAPLUT3D.h:170
std::array< GainPack< GainType >, N > Gains
Definition VBAPLUT3D.h:169
GainType_ GainType
Definition VBAPLUT3D.h:166
SpeakerIndexType_ SpeakerIndexType
Definition VBAPLUT3D.h:167
Data extracted from LUT for specific source direction.
Definition VBAPLUT3D.h:243
GainPack< float > Gains
Definition VBAPLUT3D.h:244
SpeakerTripletIdx Speakers
Represents gains of speaker/out-channel triplet.
Definition VBAPLUT3D.h:245
Definition VBAPLUT3D.h:112
Definition MinimalVec2.h:29
JPL_INLINE void store(uint32 *mem) const
Store values from simd to provided memory location.
Definition SIMD.h:1143
Minimal 4-wide 32-bit float vector implementation for SIMD.
Definition SIMD.h:60
JPL_INLINE void store(float *mem) const
Store values from simd to provided memory location.
Definition SIMD.h:573
static constexpr std::size_t size() noexcept
Get number of element of the vector.
Definition SIMD.h:97