diff options
-rw-r--r-- | alc/alu.h | 5 | ||||
-rw-r--r-- | alc/bformatdec.cpp | 12 | ||||
-rw-r--r-- | alc/bformatdec.h | 5 | ||||
-rw-r--r-- | alc/effects/reverb.cpp | 15 | ||||
-rw-r--r-- | alc/mixer/defs.h | 2 | ||||
-rw-r--r-- | alc/mixer/mixer_c.cpp | 11 | ||||
-rw-r--r-- | alc/mixer/mixer_neon.cpp | 11 | ||||
-rw-r--r-- | alc/mixer/mixer_sse.cpp | 11 |
8 files changed, 39 insertions, 33 deletions
@@ -317,9 +317,8 @@ struct ALvoice { using MixerFunc = void(*)(const ALfloat *data, const al::span<FloatBufferLine> OutBuffer, ALfloat *CurrentGains, const ALfloat *TargetGains, const ALsizei Counter, const ALsizei OutPos, const ALsizei BufferSize); -using RowMixerFunc = void(*)(ALfloat *OutBuffer, const ALfloat *gains, - const al::span<const FloatBufferLine> InSamples, const ALsizei InPos, - const ALsizei BufferSize); +using RowMixerFunc = void(*)(ALfloat *OutBuffer, const al::span<const ALfloat> Gains, + const ALfloat *InSamples, const ALsizei InStride, const ALsizei BufferSize); using HrtfMixerFunc = void(*)(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, const ALfloat *InSamples, float2 *AccumSamples, const ALsizei OutPos, const ALsizei IrSize, MixHrtfFilter *hrtfparams, const ALsizei BufferSize); diff --git a/alc/bformatdec.cpp b/alc/bformatdec.cpp index a241cc93..ce4c4b3b 100644 --- a/alc/bformatdec.cpp +++ b/alc/bformatdec.cpp @@ -156,16 +156,16 @@ void BFormatDec::process(const al::span<FloatBufferLine> OutBuffer, mXOver[i].process(mSamplesHF[i].data(), mSamplesLF[i].data(), InSamples[i].data(), SamplesToDo); - const al::span<const FloatBufferLine> hfsamples{mSamplesHF, mNumChannels}; - const al::span<const FloatBufferLine> lfsamples{mSamplesLF, mNumChannels}; ALfloat (*mixmtx)[sNumBands][MAX_AMBI_CHANNELS]{mMatrix.Dual}; ALuint enabled{mEnabled}; for(FloatBufferLine &outbuf : OutBuffer) { if LIKELY(enabled&1) { - MixRowSamples(outbuf.data(), (*mixmtx)[sHFBand], hfsamples, 0, SamplesToDo); - MixRowSamples(outbuf.data(), (*mixmtx)[sLFBand], lfsamples, 0, SamplesToDo); + MixRowSamples(outbuf.data(), {(*mixmtx)[sHFBand], mNumChannels}, + mSamplesHF->data(), mSamplesHF->size(), SamplesToDo); + MixRowSamples(outbuf.data(), {(*mixmtx)[sLFBand], mNumChannels}, + mSamplesLF->data(), mSamplesLF->size(), SamplesToDo); } ++mixmtx; enabled >>= 1; @@ -173,13 +173,13 @@ void BFormatDec::process(const al::span<FloatBufferLine> OutBuffer, } else { - const al::span<const FloatBufferLine> insamples{InSamples, mNumChannels}; ALfloat (*mixmtx)[MAX_AMBI_CHANNELS]{mMatrix.Single}; ALuint enabled{mEnabled}; for(FloatBufferLine &outbuf : OutBuffer) { if LIKELY(enabled&1) - MixRowSamples(outbuf.data(), *mixmtx, insamples, 0, SamplesToDo); + MixRowSamples(outbuf.data(), {*mixmtx, mNumChannels}, InSamples->data(), + InSamples->size(), SamplesToDo); ++mixmtx; enabled >>= 1; } diff --git a/alc/bformatdec.h b/alc/bformatdec.h index 6d0bf4e6..dbde90c8 100644 --- a/alc/bformatdec.h +++ b/alc/bformatdec.h @@ -24,8 +24,10 @@ class BFormatDec { static constexpr size_t sLFBand{1}; static constexpr size_t sNumBands{2}; + bool mDualBand{false}; ALuint mEnabled{0u}; /* Bitfield of enabled channels. */ + ALuint mNumChannels{0u}; union MatrixU { ALfloat Dual[MAX_OUTPUT_CHANNELS][sNumBands][MAX_AMBI_CHANNELS]; ALfloat Single[MAX_OUTPUT_CHANNELS][MAX_AMBI_CHANNELS]; @@ -39,9 +41,6 @@ class BFormatDec { FloatBufferLine *mSamplesHF{nullptr}; FloatBufferLine *mSamplesLF{nullptr}; - ALuint mNumChannels{0u}; - bool mDualBand{false}; - public: BFormatDec(const AmbDecConf *conf, const bool allow_2band, const ALuint inchans, const ALuint srate, const ALsizei (&chanmap)[MAX_OUTPUT_CHANNELS]); diff --git a/alc/effects/reverb.cpp b/alc/effects/reverb.cpp index 08d1ea7b..6fafe241 100644 --- a/alc/effects/reverb.cpp +++ b/alc/effects/reverb.cpp @@ -424,14 +424,16 @@ struct ReverbState final : public EffectState { for(ALsizei c{0};c < NUM_LINES;c++) { std::fill_n(mTempLine.begin(), todo, 0.0f); - MixRowSamples(mTempLine.data(), A2B[c], mTempSamples, sEarlyOffset, todo); + MixRowSamples(mTempLine.data(), A2B[c], mTempSamples[0].data()+sEarlyOffset, + mTempSamples[0].size(), todo); MixSamples(mTempLine.data(), samplesOut, mEarly.CurrentGain[c], mEarly.PanGain[c], counter, offset, todo); } for(ALsizei c{0};c < NUM_LINES;c++) { std::fill_n(mTempLine.begin(), todo, 0.0f); - MixRowSamples(mTempLine.data(), A2B[c], mTempSamples, sLateOffset, todo); + MixRowSamples(mTempLine.data(), A2B[c], mTempSamples[0].data()+sLateOffset, + mTempSamples[0].size(), todo); MixSamples(mTempLine.data(), samplesOut, mLate.CurrentGain[c], mLate.PanGain[c], counter, offset, todo); } @@ -445,7 +447,8 @@ struct ReverbState final : public EffectState { for(ALsizei c{0};c < NUM_LINES;c++) { std::fill_n(mTempLine.begin(), todo, 0.0f); - MixRowSamples(mTempLine.data(), A2B[c], mTempSamples, sEarlyOffset, todo); + MixRowSamples(mTempLine.data(), A2B[c], mTempSamples[0].data()+sEarlyOffset, + mTempSamples[0].size(), todo); /* Apply scaling to the B-Format's HF response to "upsample" it to * higher-order output. @@ -459,7 +462,8 @@ struct ReverbState final : public EffectState { for(ALsizei c{0};c < NUM_LINES;c++) { std::fill_n(mTempLine.begin(), todo, 0.0f); - MixRowSamples(mTempLine.data(), A2B[c], mTempSamples, sLateOffset, todo); + MixRowSamples(mTempLine.data(), A2B[c], mTempSamples[0].data()+sLateOffset, + mTempSamples[0].size(), todo); const ALfloat hfscale{(c==0) ? mOrderScales[0] : mOrderScales[1]}; mAmbiSplitter[1][c].applyHfScale(mTempLine.data(), hfscale, todo); @@ -1457,7 +1461,8 @@ void ReverbState::process(const ALsizei samplesToDo, const FloatBufferLine *REST for(ALsizei c{0};c < NUM_LINES;c++) { std::fill_n(mTempLine.begin(), samplesToDo, 0.0f); - MixRowSamples(mTempLine.data(), B2A[c], {samplesIn, samplesIn+numInput}, 0, samplesToDo); + MixRowSamples(mTempLine.data(), {B2A[c], B2A[c]+numInput}, samplesIn->data(), + samplesIn->size(), samplesToDo); /* Band-pass the incoming samples and feed the initial delay line. */ mFilter[c].Lp.process(mTempLine.data(), mTempLine.data(), samplesToDo); diff --git a/alc/mixer/defs.h b/alc/mixer/defs.h index 55de2e67..19fb42d0 100644 --- a/alc/mixer/defs.h +++ b/alc/mixer/defs.h @@ -32,7 +32,7 @@ const ALfloat *Resample_(const InterpState *state, const ALfloat *RESTRICT src, template<InstSetType InstTag> void Mix_(const ALfloat *data, const al::span<FloatBufferLine> OutBuffer, ALfloat *CurrentGains, const ALfloat *TargetGains, const ALsizei Counter, const ALsizei OutPos, const ALsizei BufferSize); template<InstSetType InstTag> -void MixRow_(ALfloat *OutBuffer, const ALfloat *Gains, const al::span<const FloatBufferLine> InSamples, const ALsizei InPos, const ALsizei BufferSize); +void MixRow_(ALfloat *OutBuffer, const al::span<const ALfloat> Gains, const ALfloat *InSamples, const ALsizei InStride, const ALsizei BufferSize); template<InstSetType InstTag> void MixHrtf_(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, const ALfloat *InSamples, float2 *AccumSamples, const ALsizei OutPos, const ALsizei IrSize, MixHrtfFilter *hrtfparams, const ALsizei BufferSize); diff --git a/alc/mixer/mixer_c.cpp b/alc/mixer/mixer_c.cpp index ff20bb2b..4985933c 100644 --- a/alc/mixer/mixer_c.cpp +++ b/alc/mixer/mixer_c.cpp @@ -189,15 +189,16 @@ void Mix_<CTag>(const ALfloat *data, const al::span<FloatBufferLine> OutBuffer, * stepping is necessary. */ template<> -void MixRow_<CTag>(ALfloat *OutBuffer, const ALfloat *Gains, - const al::span<const FloatBufferLine> InSamples, const ALsizei InPos, const ALsizei BufferSize) +void MixRow_<CTag>(ALfloat *OutBuffer, const al::span<const ALfloat> Gains, + const ALfloat *InSamples, const ALsizei InStride, const ALsizei BufferSize) { ASSUME(BufferSize > 0); - for(const FloatBufferLine &input : InSamples) + for(const ALfloat gain : Gains) { - const ALfloat *RESTRICT src{input.data()+InPos}; - const ALfloat gain{*(Gains++)}; + const ALfloat *RESTRICT src{InSamples}; + InSamples += InStride; + if(!(std::fabs(gain) > GAIN_SILENCE_THRESHOLD)) continue; diff --git a/alc/mixer/mixer_neon.cpp b/alc/mixer/mixer_neon.cpp index 40cbdb23..c6ea2c60 100644 --- a/alc/mixer/mixer_neon.cpp +++ b/alc/mixer/mixer_neon.cpp @@ -276,15 +276,16 @@ void Mix_<NEONTag>(const ALfloat *data, const al::span<FloatBufferLine> OutBuffe } template<> -void MixRow_<NEONTag>(ALfloat *OutBuffer, const ALfloat *Gains, - const al::span<const FloatBufferLine> InSamples, const ALsizei InPos, const ALsizei BufferSize) +void MixRow_<NEONTag>(ALfloat *OutBuffer, const al::span<const ALfloat> Gains, + const ALfloat *InSamples, const ALsizei InStride, const ALsizei BufferSize) { ASSUME(BufferSize > 0); - for(const FloatBufferLine &input : InSamples) + for(const ALfloat gain : Gains) { - const ALfloat *RESTRICT src{al::assume_aligned<16>(input.data()+InPos)}; - const ALfloat gain{*(Gains++)}; + const ALfloat *RESTRICT src{InSamples}; + InSamples += InStride; + if(!(std::fabs(gain) > GAIN_SILENCE_THRESHOLD)) continue; diff --git a/alc/mixer/mixer_sse.cpp b/alc/mixer/mixer_sse.cpp index 6c7715fc..b5958c8e 100644 --- a/alc/mixer/mixer_sse.cpp +++ b/alc/mixer/mixer_sse.cpp @@ -229,15 +229,16 @@ void Mix_<SSETag>(const ALfloat *data, const al::span<FloatBufferLine> OutBuffer } template<> -void MixRow_<SSETag>(ALfloat *OutBuffer, const ALfloat *Gains, - const al::span<const FloatBufferLine> InSamples, const ALsizei InPos, const ALsizei BufferSize) +void MixRow_<SSETag>(ALfloat *OutBuffer, const al::span<const ALfloat> Gains, + const ALfloat *InSamples, const ALsizei InStride, const ALsizei BufferSize) { ASSUME(BufferSize > 0); - for(const FloatBufferLine &input : InSamples) + for(const ALfloat gain : Gains) { - const ALfloat *RESTRICT src{al::assume_aligned<16>(input.data()+InPos)}; - const ALfloat gain{*(Gains++)}; + const ALfloat *RESTRICT src{InSamples}; + InSamples += InStride; + if(!(std::fabs(gain) > GAIN_SILENCE_THRESHOLD)) continue; |