aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/mixer
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-04-18 20:39:52 -0700
committerChris Robinson <[email protected]>2018-04-18 20:39:52 -0700
commitf96a8fe369e317a6203bec5e814761fe8a12531e (patch)
tree240fae4a5a1072e3721e6976058bc50d1a766c9f /Alc/mixer
parent150586d7fef722da17b96697ca0c1f78b2d10eb4 (diff)
Add some ASSUME statements that ensure mixing at least 1 sample
Diffstat (limited to 'Alc/mixer')
-rw-r--r--Alc/mixer/hrtf_inc.c9
-rw-r--r--Alc/mixer/mixer_c.c3
-rw-r--r--Alc/mixer/mixer_neon.c5
-rw-r--r--Alc/mixer/mixer_sse.c4
-rw-r--r--Alc/mixer/mixer_sse2.c2
-rw-r--r--Alc/mixer/mixer_sse41.c2
6 files changed, 25 insertions, 0 deletions
diff --git a/Alc/mixer/hrtf_inc.c b/Alc/mixer/hrtf_inc.c
index ad0daa63..d6bd8042 100644
--- a/Alc/mixer/hrtf_inc.c
+++ b/Alc/mixer/hrtf_inc.c
@@ -27,6 +27,9 @@ void MixHrtf(ALfloat *restrict LeftOut, ALfloat *restrict RightOut,
ALfloat left, right;
ALsizei i;
+ ASSUME(IrSize >= 4);
+ ASSUME(BufferSize > 0);
+
LeftOut += OutPos;
RightOut += OutPos;
for(i = 0;i < BufferSize;i++)
@@ -65,6 +68,9 @@ void MixHrtfBlend(ALfloat *restrict LeftOut, ALfloat *restrict RightOut,
ALfloat left, right;
ALsizei i;
+ ASSUME(IrSize >= 4);
+ ASSUME(BufferSize > 0);
+
LeftOut += OutPos;
RightOut += OutPos;
for(i = 0;i < BufferSize;i++)
@@ -100,6 +106,9 @@ void MixDirectHrtf(ALfloat *restrict LeftOut, ALfloat *restrict RightOut,
ALfloat insample;
ALsizei i;
+ ASSUME(IrSize >= 4);
+ ASSUME(BufferSize > 0);
+
for(i = 0;i < BufferSize;i++)
{
Values[(Offset+IrSize)&HRIR_MASK][0] = 0.0f;
diff --git a/Alc/mixer/mixer_c.c b/Alc/mixer/mixer_c.c
index ee667671..2ec108d7 100644
--- a/Alc/mixer/mixer_c.c
+++ b/Alc/mixer/mixer_c.c
@@ -123,6 +123,7 @@ void Mix_C(const ALfloat *data, ALsizei OutChans, ALfloat (*restrict OutBuffer)[
ALfloat gain, delta, step;
ALsizei c;
+ ASSUME(BufferSize > 0);
delta = (Counter > 0) ? 1.0f/(ALfloat)Counter : 0.0f;
for(c = 0;c < OutChans;c++)
@@ -160,6 +161,8 @@ void MixRow_C(ALfloat *OutBuffer, const ALfloat *Gains, const ALfloat (*restrict
{
ALsizei c, i;
+ ASSUME(BufferSize > 0);
+
for(c = 0;c < InChans;c++)
{
ALfloat gain = Gains[c];
diff --git a/Alc/mixer/mixer_neon.c b/Alc/mixer/mixer_neon.c
index e8a85f71..03468ffe 100644
--- a/Alc/mixer/mixer_neon.c
+++ b/Alc/mixer/mixer_neon.c
@@ -23,6 +23,8 @@ const ALfloat *Resample_lerp_Neon(const InterpState* UNUSED(state),
int32x4_t frac4;
ALsizei i;
+ ASSUME(numsamples > 0);
+
InitiatePositionArrays(frac, increment, frac_, pos_, 4);
frac4 = vld1q_s32(frac_);
@@ -79,6 +81,7 @@ const ALfloat *Resample_bsinc_Neon(const InterpState *state,
ALfloat pf;
ASSUME(m > 0);
+ ASSUME(dstlen > 0);
src += state->bsinc.l;
for(i = 0;i < dstlen;i++)
@@ -167,6 +170,7 @@ void Mix_Neon(const ALfloat *data, ALsizei OutChans, ALfloat (*restrict OutBuffe
float32x4_t gain4;
ALsizei c;
+ ASSUME(BufferSize > 0);
data = ASSUME_ALIGNED(data, 16);
OutBuffer = ASSUME_ALIGNED(OutBuffer, 16);
@@ -239,6 +243,7 @@ void MixRow_Neon(ALfloat *OutBuffer, const ALfloat *Gains, const ALfloat (*restr
float32x4_t gain4;
ALsizei c;
+ ASSUME(BufferSize > 0);
data = ASSUME_ALIGNED(data, 16);
OutBuffer = ASSUME_ALIGNED(OutBuffer, 16);
diff --git a/Alc/mixer/mixer_sse.c b/Alc/mixer/mixer_sse.c
index 5c181c75..c4852ca5 100644
--- a/Alc/mixer/mixer_sse.c
+++ b/Alc/mixer/mixer_sse.c
@@ -25,6 +25,7 @@ const ALfloat *Resample_bsinc_SSE(const InterpState *state, const ALfloat *restr
__m128 r4;
ASSUME(m > 0);
+ ASSUME(dstlen > 0);
src += state->bsinc.l;
for(i = 0;i < dstlen;i++)
@@ -139,6 +140,7 @@ void Mix_SSE(const ALfloat *data, ALsizei OutChans, ALfloat (*restrict OutBuffer
__m128 gain4;
ALsizei c;
+ ASSUME(BufferSize > 0);
delta = (Counter > 0) ? 1.0f/(ALfloat)Counter : 0.0f;
for(c = 0;c < OutChans;c++)
@@ -210,6 +212,8 @@ void MixRow_SSE(ALfloat *OutBuffer, const ALfloat *Gains, const ALfloat (*restri
__m128 gain4;
ALsizei c;
+ ASSUME(BufferSize > 0);
+
for(c = 0;c < InChans;c++)
{
ALsizei pos = 0;
diff --git a/Alc/mixer/mixer_sse2.c b/Alc/mixer/mixer_sse2.c
index 19d07719..4aeb6fc4 100644
--- a/Alc/mixer/mixer_sse2.c
+++ b/Alc/mixer/mixer_sse2.c
@@ -40,6 +40,8 @@ const ALfloat *Resample_lerp_SSE2(const InterpState* UNUSED(state),
ALint pos;
ALsizei i;
+ ASSUME(numsamples > 0);
+
InitiatePositionArrays(frac, increment, frac_.i, pos_.i, 4);
frac4 = _mm_castps_si128(_mm_load_ps(frac_.f));
diff --git a/Alc/mixer/mixer_sse41.c b/Alc/mixer/mixer_sse41.c
index 85fd0f5e..98a3ef74 100644
--- a/Alc/mixer/mixer_sse41.c
+++ b/Alc/mixer/mixer_sse41.c
@@ -41,6 +41,8 @@ const ALfloat *Resample_lerp_SSE41(const InterpState* UNUSED(state),
ALint pos;
ALsizei i;
+ ASSUME(numsamples > 0);
+
InitiatePositionArrays(frac, increment, frac_.i, pos_.i, 4);
frac4 = _mm_castps_si128(_mm_load_ps(frac_.f));