Avoid an extraneous index map
This commit is contained in:
+5
-8
@@ -98,17 +98,14 @@ BFormatDec::BFormatDec(const AmbDecConf *conf, const bool allow_2band, const ALu
|
||||
}
|
||||
}
|
||||
|
||||
BFormatDec::BFormatDec(const ALuint inchans, const ChannelDec (&chancoeffs)[MAX_OUTPUT_CHANNELS],
|
||||
const al::span<const ALuint> chanmap) : mChannelDec{inchans}
|
||||
BFormatDec::BFormatDec(const ALuint inchans, const al::span<const ChannelDec> chancoeffs)
|
||||
: mChannelDec{inchans}
|
||||
{
|
||||
for(size_t j{0};j < mChannelDec.size();++j)
|
||||
{
|
||||
const ChannelDec *incoeffs{chancoeffs};
|
||||
for(const ALuint chanidx : chanmap)
|
||||
{
|
||||
mChannelDec[j].mGains.Single[chanidx] = (*incoeffs)[j];
|
||||
++incoeffs;
|
||||
}
|
||||
float *outcoeffs{mChannelDec[j].mGains.Single};
|
||||
for(const ChannelDec &incoeffs : chancoeffs)
|
||||
*(outcoeffs++) = incoeffs[j];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-5
@@ -43,8 +43,7 @@ class BFormatDec {
|
||||
public:
|
||||
BFormatDec(const AmbDecConf *conf, const bool allow_2band, const ALuint inchans,
|
||||
const ALuint srate, const ALuint (&chanmap)[MAX_OUTPUT_CHANNELS]);
|
||||
BFormatDec(const ALuint inchans, const ChannelDec (&chancoeffs)[MAX_OUTPUT_CHANNELS],
|
||||
const al::span<const ALuint> chanmap);
|
||||
BFormatDec(const ALuint inchans, const al::span<const ChannelDec> chancoeffs);
|
||||
|
||||
/* Decodes the ambisonic input to the given output channels. */
|
||||
void process(const al::span<FloatBufferLine> OutBuffer, const FloatBufferLine *InSamples,
|
||||
@@ -61,10 +60,9 @@ public:
|
||||
BFormatDec{conf, allow_2band, inchans, srate, chanmap}};
|
||||
}
|
||||
static std::unique_ptr<BFormatDec> Create(const ALuint inchans,
|
||||
const ChannelDec (&chancoeffs)[MAX_OUTPUT_CHANNELS], const al::span<const ALuint> chanmap)
|
||||
const al::span<const ChannelDec> chancoeffs)
|
||||
{
|
||||
return std::unique_ptr<BFormatDec>{new(FamCount{inchans})
|
||||
BFormatDec{inchans, chancoeffs, chanmap}};
|
||||
return std::unique_ptr<BFormatDec>{new(FamCount{inchans}) BFormatDec{inchans, chancoeffs}};
|
||||
}
|
||||
|
||||
DEF_FAM_NEWDEL(BFormatDec, mChannelDec)
|
||||
|
||||
+5
-5
@@ -434,7 +434,7 @@ void InitPanning(ALCdevice *device)
|
||||
else
|
||||
{
|
||||
ChannelDec chancoeffs[MAX_OUTPUT_CHANNELS]{};
|
||||
ALuint idxmap[MAX_OUTPUT_CHANNELS]{};
|
||||
ALuint maxchan{0};
|
||||
for(size_t i{0u};i < chanmap.size();++i)
|
||||
{
|
||||
const ALuint idx{GetChannelIdxByName(device->RealOut, chanmap[i].ChanName)};
|
||||
@@ -444,8 +444,8 @@ void InitPanning(ALCdevice *device)
|
||||
GetLabelFromChannel(chanmap[i].ChanName));
|
||||
continue;
|
||||
}
|
||||
idxmap[i] = idx;
|
||||
std::copy_n(chanmap[i].Config, coeffcount, chancoeffs[i]);
|
||||
maxchan = maxu(maxchan, idx);
|
||||
std::copy_n(chanmap[i].Config, coeffcount, chancoeffs[idx]);
|
||||
}
|
||||
|
||||
/* For non-DevFmtAmbi3D, set the ambisonic order given the mixing
|
||||
@@ -464,8 +464,8 @@ void InitPanning(ALCdevice *device)
|
||||
(coeffcount > 5) ? "third" :
|
||||
(coeffcount > 3) ? "second" : "first",
|
||||
"");
|
||||
device->AmbiDecoder = BFormatDec::Create(coeffcount, chancoeffs,
|
||||
al::span<const ALuint>{idxmap, chanmap.size()});
|
||||
device->AmbiDecoder = BFormatDec::Create(coeffcount,
|
||||
al::span<const ChannelDec>{chancoeffs, maxchan});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user