aboutsummaryrefslogtreecommitdiffstats
path: root/alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-08-25 15:36:40 -0700
committerChris Robinson <[email protected]>2019-08-25 15:36:40 -0700
commit88a8bf903b08cd93ea7028a4c726f39e4cde7c79 (patch)
treeb24161d1c89d9335262787a8b0c7c930f2976c0e /alc
parente165cae3cddec51332660bdb1e69d7fa5f687e68 (diff)
Use size_t for the post-process sample length
Diffstat (limited to 'alc')
-rw-r--r--alc/alcmain.h12
-rw-r--r--alc/alu.cpp9
-rw-r--r--alc/bformatdec.cpp6
-rw-r--r--alc/bformatdec.h2
-rw-r--r--alc/bs2b.cpp14
-rw-r--r--alc/bs2b.h2
-rw-r--r--alc/uhjfilter.cpp17
-rw-r--r--alc/uhjfilter.h2
8 files changed, 32 insertions, 32 deletions
diff --git a/alc/alcmain.h b/alc/alcmain.h
index 910e3279..6b6a8de3 100644
--- a/alc/alcmain.h
+++ b/alc/alcmain.h
@@ -303,7 +303,7 @@ struct ALCdevice : public al::intrusive_ref<ALCdevice> {
/* Stereo-to-binaural filter */
std::unique_ptr<bs2b> Bs2b;
- using PostProc = void(ALCdevice::*)(const ALsizei SamplesToDo);
+ using PostProc = void(ALCdevice::*)(const size_t SamplesToDo);
PostProc PostProcess{nullptr};
std::unique_ptr<FrontStablizer> Stablizer;
@@ -344,12 +344,12 @@ struct ALCdevice : public al::intrusive_ref<ALCdevice> {
ALsizei channelsFromFmt() const noexcept { return ChannelsFromDevFmt(FmtChans, mAmbiOrder); }
ALsizei frameSizeFromFmt() const noexcept { return bytesFromFmt() * channelsFromFmt(); }
- void ProcessHrtf(const ALsizei SamplesToDo);
- void ProcessAmbiDec(const ALsizei SamplesToDo);
- void ProcessUhj(const ALsizei SamplesToDo);
- void ProcessBs2b(const ALsizei SamplesToDo);
+ void ProcessHrtf(const size_t SamplesToDo);
+ void ProcessAmbiDec(const size_t SamplesToDo);
+ void ProcessUhj(const size_t SamplesToDo);
+ void ProcessBs2b(const size_t SamplesToDo);
- inline void postProcess(const ALsizei SamplesToDo)
+ inline void postProcess(const size_t SamplesToDo)
{ if LIKELY(PostProcess) (this->*PostProcess)(SamplesToDo); }
DEF_NEWDEL(ALCdevice)
diff --git a/alc/alu.cpp b/alc/alu.cpp
index a7d7cd70..c961f5d5 100644
--- a/alc/alu.cpp
+++ b/alc/alu.cpp
@@ -152,24 +152,23 @@ void aluInit(void)
}
-void ALCdevice::ProcessHrtf(const ALsizei SamplesToDo)
+void ALCdevice::ProcessHrtf(const size_t SamplesToDo)
{
/* HRTF is stereo output only. */
const int lidx{RealOut.ChannelIndex[FrontLeft]};
const int ridx{RealOut.ChannelIndex[FrontRight]};
ASSUME(lidx >= 0 && ridx >= 0);
- ASSUME(SamplesToDo >= 0);
MixDirectHrtf(RealOut.Buffer[lidx], RealOut.Buffer[ridx], Dry.Buffer, HrtfAccumData,
mHrtfState.get(), SamplesToDo);
}
-void ALCdevice::ProcessAmbiDec(const ALsizei SamplesToDo)
+void ALCdevice::ProcessAmbiDec(const size_t SamplesToDo)
{
AmbiDecoder->process(RealOut.Buffer, Dry.Buffer.data(), SamplesToDo);
}
-void ALCdevice::ProcessUhj(const ALsizei SamplesToDo)
+void ALCdevice::ProcessUhj(const size_t SamplesToDo)
{
/* UHJ is stereo output only. */
const int lidx{RealOut.ChannelIndex[FrontLeft]};
@@ -181,7 +180,7 @@ void ALCdevice::ProcessUhj(const ALsizei SamplesToDo)
SamplesToDo);
}
-void ALCdevice::ProcessBs2b(const ALsizei SamplesToDo)
+void ALCdevice::ProcessBs2b(const size_t SamplesToDo)
{
/* First, decode the ambisonic mix to the "real" output. */
AmbiDecoder->process(RealOut.Buffer, Dry.Buffer.data(), SamplesToDo);
diff --git a/alc/bformatdec.cpp b/alc/bformatdec.cpp
index 7d681bc6..c2137b33 100644
--- a/alc/bformatdec.cpp
+++ b/alc/bformatdec.cpp
@@ -146,7 +146,7 @@ BFormatDec::BFormatDec(const ALuint inchans, const ALsizei chancount,
void BFormatDec::process(const al::span<FloatBufferLine> OutBuffer,
- const FloatBufferLine *InSamples, const ALsizei SamplesToDo)
+ const FloatBufferLine *InSamples, const size_t SamplesToDo)
{
ASSUME(SamplesToDo > 0);
@@ -162,7 +162,7 @@ void BFormatDec::process(const al::span<FloatBufferLine> OutBuffer,
{
if LIKELY(enabled&1)
{
- const al::span<float> outspan{outbuf.data(), outbuf.data()+SamplesToDo};
+ const al::span<float> outspan{outbuf.data(), SamplesToDo};
MixRowSamples(outspan, {(*mixmtx)[sHFBand], mNumChannels}, mSamplesHF->data(),
mSamplesHF->size());
MixRowSamples(outspan, {(*mixmtx)[sLFBand], mNumChannels}, mSamplesLF->data(),
@@ -179,7 +179,7 @@ void BFormatDec::process(const al::span<FloatBufferLine> OutBuffer,
for(FloatBufferLine &outbuf : OutBuffer)
{
if LIKELY(enabled&1)
- MixRowSamples({outbuf.data(), outbuf.data()+SamplesToDo}, {*mixmtx, mNumChannels},
+ MixRowSamples({outbuf.data(), SamplesToDo}, {*mixmtx, mNumChannels},
InSamples->data(), InSamples->size());
++mixmtx;
enabled >>= 1;
diff --git a/alc/bformatdec.h b/alc/bformatdec.h
index dbde90c8..98cbb022 100644
--- a/alc/bformatdec.h
+++ b/alc/bformatdec.h
@@ -50,7 +50,7 @@ public:
/* Decodes the ambisonic input to the given output channels. */
void process(const al::span<FloatBufferLine> OutBuffer, const FloatBufferLine *InSamples,
- const ALsizei SamplesToDo);
+ const size_t SamplesToDo);
/* Retrieves per-order HF scaling factors for "upsampling" ambisonic data. */
static std::array<ALfloat,MAX_AMBI_ORDER+1> GetHFOrderScales(const ALsizei in_order,
diff --git a/alc/bs2b.cpp b/alc/bs2b.cpp
index 71249d4a..fb75188c 100644
--- a/alc/bs2b.cpp
+++ b/alc/bs2b.cpp
@@ -130,7 +130,7 @@ void bs2b_clear(struct bs2b *bs2b)
std::fill(std::begin(bs2b->history), std::end(bs2b->history), bs2b::t_last_sample{});
} /* bs2b_clear */
-void bs2b_cross_feed(struct bs2b *bs2b, float *Left, float *Right, int SamplesToDo)
+void bs2b_cross_feed(struct bs2b *bs2b, float *Left, float *Right, size_t SamplesToDo)
{
const float a0_lo{bs2b->a0_lo};
const float b1_lo{bs2b->b1_lo};
@@ -140,14 +140,14 @@ void bs2b_cross_feed(struct bs2b *bs2b, float *Left, float *Right, int SamplesTo
float lsamples[128][2];
float rsamples[128][2];
- for(int base{0};base < SamplesToDo;)
+ for(size_t base{0};base < SamplesToDo;)
{
- const int todo{std::min(128, SamplesToDo-base)};
+ const size_t todo{std::min<size_t>(128, SamplesToDo-base)};
/* Process left input */
float z_lo{bs2b->history[0].lo};
float z_hi{bs2b->history[0].hi};
- for(int i{0};i < todo;i++)
+ for(size_t i{0};i < todo;i++)
{
lsamples[i][0] = a0_lo*Left[i] + z_lo;
z_lo = b1_lo*lsamples[i][0];
@@ -161,7 +161,7 @@ void bs2b_cross_feed(struct bs2b *bs2b, float *Left, float *Right, int SamplesTo
/* Process right input */
z_lo = bs2b->history[1].lo;
z_hi = bs2b->history[1].hi;
- for(int i{0};i < todo;i++)
+ for(size_t i{0};i < todo;i++)
{
rsamples[i][0] = a0_lo*Right[i] + z_lo;
z_lo = b1_lo*rsamples[i][0];
@@ -173,9 +173,9 @@ void bs2b_cross_feed(struct bs2b *bs2b, float *Left, float *Right, int SamplesTo
bs2b->history[1].hi = z_hi;
/* Crossfeed */
- for(int i{0};i < todo;i++)
+ for(size_t i{0};i < todo;i++)
*(Left++) = lsamples[i][1] + rsamples[i][0];
- for(int i{0};i < todo;i++)
+ for(size_t i{0};i < todo;i++)
*(Right++) = rsamples[i][1] + lsamples[i][0];
base += todo;
diff --git a/alc/bs2b.h b/alc/bs2b.h
index d9bcc172..df717cd4 100644
--- a/alc/bs2b.h
+++ b/alc/bs2b.h
@@ -84,6 +84,6 @@ int bs2b_get_srate(bs2b *bs2b);
/* Clear buffer */
void bs2b_clear(bs2b *bs2b);
-void bs2b_cross_feed(bs2b *bs2b, float *Left, float *Right, int SamplesToDo);
+void bs2b_cross_feed(bs2b *bs2b, float *Left, float *Right, size_t SamplesToDo);
#endif /* BS2B_H */
diff --git a/alc/uhjfilter.cpp b/alc/uhjfilter.cpp
index 7f3cd069..222f519a 100644
--- a/alc/uhjfilter.cpp
+++ b/alc/uhjfilter.cpp
@@ -64,7 +64,8 @@ void allpass_process(AllPassState *state, ALfloat *dst, const ALfloat *src, cons
* know which is the intended result.
*/
-void Uhj2Encoder::encode(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, FloatBufferLine *InSamples, const ALsizei SamplesToDo)
+void Uhj2Encoder::encode(FloatBufferLine &LeftOut, FloatBufferLine &RightOut,
+ FloatBufferLine *InSamples, const size_t SamplesToDo)
{
alignas(16) ALfloat D[MAX_UPDATE_SAMPLES], S[MAX_UPDATE_SAMPLES];
alignas(16) ALfloat temp[MAX_UPDATE_SAMPLES];
@@ -74,9 +75,9 @@ void Uhj2Encoder::encode(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, Fl
auto winput = InSamples[0].cbegin();
auto xinput = InSamples[1].cbegin();
auto yinput = InSamples[2].cbegin();
- for(ALsizei base{0};base < SamplesToDo;)
+ for(size_t base{0};base < SamplesToDo;)
{
- const ALsizei todo{mini(SamplesToDo - base, MAX_UPDATE_SAMPLES)};
+ const size_t todo{minz(SamplesToDo - base, MAX_UPDATE_SAMPLES)};
ASSUME(todo > 0);
/* D = 0.6554516*Y */
@@ -91,7 +92,7 @@ void Uhj2Encoder::encode(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, Fl
* output sample.
*/
D[0] = mLastY;
- for(ALsizei i{1};i < todo;i++)
+ for(size_t i{1};i < todo;i++)
D[i] = temp[i-1];
mLastY = temp[todo-1];
@@ -103,7 +104,7 @@ void Uhj2Encoder::encode(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, Fl
allpass_process(&mFilter2_WX[1], temp, temp, Filter2CoeffSqr[1], todo);
allpass_process(&mFilter2_WX[2], temp, temp, Filter2CoeffSqr[2], todo);
allpass_process(&mFilter2_WX[3], temp, temp, Filter2CoeffSqr[3], todo);
- for(ALsizei i{0};i < todo;i++)
+ for(size_t i{0};i < todo;i++)
D[i] += temp[i];
/* S = 0.9396926*W + 0.1855740*X */
@@ -115,17 +116,17 @@ void Uhj2Encoder::encode(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, Fl
allpass_process(&mFilter1_WX[2], temp, temp, Filter1CoeffSqr[2], todo);
allpass_process(&mFilter1_WX[3], temp, temp, Filter1CoeffSqr[3], todo);
S[0] = mLastWX;
- for(ALsizei i{1};i < todo;i++)
+ for(size_t i{1};i < todo;i++)
S[i] = temp[i-1];
mLastWX = temp[todo-1];
/* Left = (S + D)/2.0 */
ALfloat *RESTRICT left = al::assume_aligned<16>(LeftOut.data()+base);
- for(ALsizei i{0};i < todo;i++)
+ for(size_t i{0};i < todo;i++)
left[i] += (S[i] + D[i]) * 0.5f;
/* Right = (S - D)/2.0 */
ALfloat *RESTRICT right = al::assume_aligned<16>(RightOut.data()+base);
- for(ALsizei i{0};i < todo;i++)
+ for(size_t i{0};i < todo;i++)
right[i] += (S[i] - D[i]) * 0.5f;
winput += todo;
diff --git a/alc/uhjfilter.h b/alc/uhjfilter.h
index 53e4f89e..88d30351 100644
--- a/alc/uhjfilter.h
+++ b/alc/uhjfilter.h
@@ -46,7 +46,7 @@ struct Uhj2Encoder {
* signal. The input must use FuMa channel ordering and scaling.
*/
void encode(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, FloatBufferLine *InSamples,
- const ALsizei SamplesToDo);
+ const size_t SamplesToDo);
DEF_NEWDEL(Uhj2Encoder)
};