From 2d49920e7a2069ea6f0b4529f59286f8955d145f Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 12 Sep 2022 02:49:21 -0700 Subject: 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. --- core/ambdec.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'core/ambdec.cpp') 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 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(al::countr_zero(mask)); mask &= ~(1u << idx); istr >> value; - if(curidx < mtxrow.size()) - mtxrow[curidx++] = value; + if(idx < mtxrow.size()) + mtxrow[idx] = value; } } else -- cgit v1.2.3