aboutsummaryrefslogtreecommitdiffstats
path: root/core/ambdec.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2022-09-12 02:49:21 -0700
committerChris Robinson <[email protected]>2022-09-12 02:49:21 -0700
commit2d49920e7a2069ea6f0b4529f59286f8955d145f (patch)
tree40174f7b01d320b74ef0a75cb58ad5c3a6b64b67 /core/ambdec.cpp
parentc027ef7bf7acb590f20ce8edd51c8db254f3b651 (diff)
Don't pack ambdec coefficients
Tne coefficients are placed as for full 3D ACN handling. The ChanMask just indicates which have potentially useful values. This could be a bit more agressive and clear ChanMask bits for channels that don't contribute to output, so that a decoder the specifies height-related channel bits, but leaves their coefficients all 0, can be handled as 2D. I don't expect many ambdec files to be like that, though.
Diffstat (limited to 'core/ambdec.cpp')
-rw-r--r--core/ambdec.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/core/ambdec.cpp b/core/ambdec.cpp
index fcaf0388..4e4c7e1e 100644
--- a/core/ambdec.cpp
+++ b/core/ambdec.cpp
@@ -153,16 +153,15 @@ al::optional<std::string> AmbDecConf::load(const char *fname) noexcept
AmbDecConf::CoeffArray &mtxrow = matrix[pos++];
mtxrow.fill(0.0f);
- std::size_t curidx{0u};
float value{};
while(mask)
{
- auto idx = al::countr_zero(mask);
+ auto idx = static_cast<unsigned>(al::countr_zero(mask));
mask &= ~(1u << idx);
istr >> value;
- if(curidx < mtxrow.size())
- mtxrow[curidx++] = value;
+ if(idx < mtxrow.size())
+ mtxrow[idx] = value;
}
}
else