aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-01-16 08:54:30 -0800
committerChris Robinson <[email protected]>2017-01-16 08:54:30 -0800
commit325a49975a762744638b56b6a7ddd2ccd40fda55 (patch)
tree786d37a90accef04e019abb824cdf13055098112
parentcbb796bf31cd3acfba0ce35e71a51d03e7e26021 (diff)
Use ALsizei and ALint for sizes and offsets with resamplers and filters
-rw-r--r--Alc/mixer.c2
-rw-r--r--Alc/mixer_c.c24
-rw-r--r--Alc/mixer_defs.h47
-rw-r--r--Alc/mixer_sse.c9
-rw-r--r--Alc/mixer_sse2.c10
-rw-r--r--Alc/mixer_sse3.c20
-rw-r--r--Alc/mixer_sse41.c30
-rw-r--r--OpenAL32/Include/alFilter.h4
-rw-r--r--OpenAL32/Include/alu.h3
-rw-r--r--OpenAL32/alFilter.c2
10 files changed, 76 insertions, 75 deletions
diff --git a/Alc/mixer.c b/Alc/mixer.c
index cfb975f4..e759482e 100644
--- a/Alc/mixer.c
+++ b/Alc/mixer.c
@@ -41,7 +41,7 @@
static_assert((INT_MAX>>FRACTIONBITS)/MAX_PITCH > BUFFERSIZE,
"MAX_PITCH and/or BUFFERSIZE are too large for FRACTIONBITS!");
-extern inline void InitiatePositionArrays(ALuint frac, ALuint increment, ALuint *restrict frac_arr, ALuint *restrict pos_arr, ALuint size);
+extern inline void InitiatePositionArrays(ALuint frac, ALint increment, ALuint *restrict frac_arr, ALint *restrict pos_arr, ALsizei size);
alignas(16) union ResamplerCoeffs ResampleCoeffs;
diff --git a/Alc/mixer_c.c b/Alc/mixer_c.c
index 8ddd07f3..15c603ca 100644
--- a/Alc/mixer_c.c
+++ b/Alc/mixer_c.c
@@ -18,8 +18,9 @@ static inline ALfloat fir8_32(const ALfloat *restrict vals, ALuint frac)
{ return resample_fir8(vals[-3], vals[-2], vals[-1], vals[0], vals[1], vals[2], vals[3], vals[4], frac); }
-const ALfloat *Resample_copy32_C(const BsincState* UNUSED(state), const ALfloat *restrict src, ALuint UNUSED(frac),
- ALuint UNUSED(increment), ALfloat *restrict dst, ALuint numsamples)
+const ALfloat *Resample_copy32_C(const BsincState* UNUSED(state),
+ const ALfloat *restrict src, ALuint UNUSED(frac), ALint UNUSED(increment),
+ ALfloat *restrict dst, ALsizei numsamples)
{
#if defined(HAVE_SSE) || defined(HAVE_NEON)
/* Avoid copying the source data if it's aligned like the destination. */
@@ -32,10 +33,10 @@ const ALfloat *Resample_copy32_C(const BsincState* UNUSED(state), const ALfloat
#define DECL_TEMPLATE(Sampler) \
const ALfloat *Resample_##Sampler##_C(const BsincState* UNUSED(state), \
- const ALfloat *restrict src, ALuint frac, ALuint increment, \
- ALfloat *restrict dst, ALuint numsamples) \
+ const ALfloat *restrict src, ALuint frac, ALint increment, \
+ ALfloat *restrict dst, ALsizei numsamples) \
{ \
- ALuint i; \
+ ALsizei i; \
for(i = 0;i < numsamples;i++) \
{ \
dst[i] = Sampler(src, frac); \
@@ -55,16 +56,15 @@ DECL_TEMPLATE(fir8_32)
#undef DECL_TEMPLATE
const ALfloat *Resample_bsinc32_C(const BsincState *state, const ALfloat *restrict src,
- ALuint frac, ALuint increment, ALfloat *restrict dst,
- ALuint dstlen)
+ ALuint frac, ALint increment, ALfloat *restrict dst,
+ ALsizei dstlen)
{
const ALfloat *fil, *scd, *phd, *spd;
const ALfloat sf = state->sf;
- const ALuint m = state->m;
+ const ALsizei m = state->m;
const ALint l = state->l;
- ALuint j_f, pi, i;
+ ALsizei j_s, j_f, pi, i;
ALfloat pf, r;
- ALint j_s;
for(i = 0;i < dstlen;i++)
{
@@ -94,9 +94,9 @@ const ALfloat *Resample_bsinc32_C(const BsincState *state, const ALfloat *restri
}
-void ALfilterState_processC(ALfilterState *filter, ALfloat *restrict dst, const ALfloat *restrict src, ALuint numsamples)
+void ALfilterState_processC(ALfilterState *filter, ALfloat *restrict dst, const ALfloat *restrict src, ALsizei numsamples)
{
- ALuint i;
+ ALsizei i;
if(numsamples > 1)
{
dst[0] = filter->b0 * src[0] +
diff --git a/Alc/mixer_defs.h b/Alc/mixer_defs.h
index 318df626..6d2b3c04 100644
--- a/Alc/mixer_defs.h
+++ b/Alc/mixer_defs.h
@@ -12,12 +12,12 @@ struct MixHrtfParams;
struct HrtfState;
/* C resamplers */
-const ALfloat *Resample_copy32_C(const BsincState *state, const ALfloat *restrict src, ALuint frac, ALuint increment, ALfloat *restrict dst, ALuint dstlen);
-const ALfloat *Resample_point32_C(const BsincState *state, const ALfloat *restrict src, ALuint frac, ALuint increment, ALfloat *restrict dst, ALuint dstlen);
-const ALfloat *Resample_lerp32_C(const BsincState *state, const ALfloat *restrict src, ALuint frac, ALuint increment, ALfloat *restrict dst, ALuint dstlen);
-const ALfloat *Resample_fir4_32_C(const BsincState *state, const ALfloat *restrict src, ALuint frac, ALuint increment, ALfloat *restrict dst, ALuint dstlen);
-const ALfloat *Resample_fir8_32_C(const BsincState *state, const ALfloat *restrict src, ALuint frac, ALuint increment, ALfloat *restrict dst, ALuint dstlen);
-const ALfloat *Resample_bsinc32_C(const BsincState *state, const ALfloat *restrict src, ALuint frac, ALuint increment, ALfloat *restrict dst, ALuint dstlen);
+const ALfloat *Resample_copy32_C(const BsincState *state, const ALfloat *restrict src, ALuint frac, ALint increment, ALfloat *restrict dst, ALsizei dstlen);
+const ALfloat *Resample_point32_C(const BsincState *state, const ALfloat *restrict src, ALuint frac, ALint increment, ALfloat *restrict dst, ALsizei dstlen);
+const ALfloat *Resample_lerp32_C(const BsincState *state, const ALfloat *restrict src, ALuint frac, ALint increment, ALfloat *restrict dst, ALsizei dstlen);
+const ALfloat *Resample_fir4_32_C(const BsincState *state, const ALfloat *restrict src, ALuint frac, ALint increment, ALfloat *restrict dst, ALsizei dstlen);
+const ALfloat *Resample_fir8_32_C(const BsincState *state, const ALfloat *restrict src, ALuint frac, ALint increment, ALfloat *restrict dst, ALsizei dstlen);
+const ALfloat *Resample_bsinc32_C(const BsincState *state, const ALfloat *restrict src, ALuint frac, ALint increment, ALfloat *restrict dst, ALsizei dstlen);
/* C mixers */
@@ -53,43 +53,44 @@ void MixRow_SSE(ALfloat *OutBuffer, const ALfloat *Gains,
ALsizei InPos, ALsizei BufferSize);
/* SSE resamplers */
-inline void InitiatePositionArrays(ALuint frac, ALuint increment, ALuint *restrict frac_arr, ALuint *restrict pos_arr, ALuint size)
+inline void InitiatePositionArrays(ALuint frac, ALint increment, ALuint *restrict frac_arr, ALint *restrict pos_arr, ALsizei size)
{
- ALuint i;
+ ALsizei i;
pos_arr[0] = 0;
frac_arr[0] = frac;
for(i = 1;i < size;i++)
{
- ALuint frac_tmp = frac_arr[i-1] + increment;
+ ALint frac_tmp = frac_arr[i-1] + increment;
pos_arr[i] = pos_arr[i-1] + (frac_tmp>>FRACTIONBITS);
frac_arr[i] = frac_tmp&FRACTIONMASK;
}
}
-const ALfloat *Resample_bsinc32_SSE(const BsincState *state, const ALfloat *restrict src, ALuint frac,
- ALuint increment, ALfloat *restrict dst, ALuint dstlen);
+const ALfloat *Resample_bsinc32_SSE(const BsincState *state, const ALfloat *restrict src,
+ ALuint frac, ALint increment, ALfloat *restrict dst,
+ ALsizei dstlen);
const ALfloat *Resample_lerp32_SSE2(const BsincState *state, const ALfloat *restrict src,
- ALuint frac, ALuint increment, ALfloat *restrict dst,
- ALuint numsamples);
+ ALuint frac, ALint increment, ALfloat *restrict dst,
+ ALsizei numsamples);
const ALfloat *Resample_lerp32_SSE41(const BsincState *state, const ALfloat *restrict src,
- ALuint frac, ALuint increment, ALfloat *restrict dst,
- ALuint numsamples);
+ ALuint frac, ALint increment, ALfloat *restrict dst,
+ ALsizei numsamples);
const ALfloat *Resample_fir4_32_SSE3(const BsincState *state, const ALfloat *restrict src,
- ALuint frac, ALuint increment, ALfloat *restrict dst,
- ALuint numsamples);
+ ALuint frac, ALint increment, ALfloat *restrict dst,
+ ALsizei numsamples);
const ALfloat *Resample_fir4_32_SSE41(const BsincState *state, const ALfloat *restrict src,
- ALuint frac, ALuint increment, ALfloat *restrict dst,
- ALuint numsamples);
+ ALuint frac, ALint increment, ALfloat *restrict dst,
+ ALsizei numsamples);
const ALfloat *Resample_fir8_32_SSE3(const BsincState *state, const ALfloat *restrict src,
- ALuint frac, ALuint increment, ALfloat *restrict dst,
- ALuint numsamples);
+ ALuint frac, ALint increment, ALfloat *restrict dst,
+ ALsizei numsamples);
const ALfloat *Resample_fir8_32_SSE41(const BsincState *state, const ALfloat *restrict src,
- ALuint frac, ALuint increment, ALfloat *restrict dst,
- ALuint numsamples);
+ ALuint frac, ALint increment, ALfloat *restrict dst,
+ ALsizei numsamples);
/* Neon mixers */
void MixHrtf_Neon(ALfloat (*restrict OutBuffer)[BUFFERSIZE], ALsizei lidx, ALsizei ridx,
diff --git a/Alc/mixer_sse.c b/Alc/mixer_sse.c
index bad08e2d..96228b47 100644
--- a/Alc/mixer_sse.c
+++ b/Alc/mixer_sse.c
@@ -13,16 +13,15 @@
const ALfloat *Resample_bsinc32_SSE(const BsincState *state, const ALfloat *restrict src,
- ALuint frac, ALuint increment, ALfloat *restrict dst,
- ALuint dstlen)
+ ALuint frac, ALint increment, ALfloat *restrict dst,
+ ALsizei dstlen)
{
const __m128 sf4 = _mm_set1_ps(state->sf);
- const ALuint m = state->m;
+ const ALsizei m = state->m;
const ALint l = state->l;
const ALfloat *fil, *scd, *phd, *spd;
- ALuint pi, j_f, i;
+ ALsizei j_s, pi, j_f, i;
ALfloat pf;
- ALint j_s;
__m128 r4;
for(i = 0;i < dstlen;i++)
diff --git a/Alc/mixer_sse2.c b/Alc/mixer_sse2.c
index 22a18ef3..5cf4c8a0 100644
--- a/Alc/mixer_sse2.c
+++ b/Alc/mixer_sse2.c
@@ -28,17 +28,17 @@
const ALfloat *Resample_lerp32_SSE2(const BsincState* UNUSED(state), const ALfloat *restrict src,
- ALuint frac, ALuint increment, ALfloat *restrict dst,
- ALuint numsamples)
+ ALuint frac, ALint increment, ALfloat *restrict dst,
+ ALsizei numsamples)
{
const __m128i increment4 = _mm_set1_epi32(increment*4);
const __m128 fracOne4 = _mm_set1_ps(1.0f/FRACTIONONE);
const __m128i fracMask4 = _mm_set1_epi32(FRACTIONMASK);
- union { alignas(16) ALuint i[4]; float f[4]; } pos_;
+ union { alignas(16) ALint i[4]; float f[4]; } pos_;
union { alignas(16) ALuint i[4]; float f[4]; } frac_;
__m128i frac4, pos4;
- ALuint pos;
- ALuint i;
+ ALint pos;
+ ALsizei i;
InitiatePositionArrays(frac, increment, frac_.i, pos_.i, 4);
diff --git a/Alc/mixer_sse3.c b/Alc/mixer_sse3.c
index 66005e53..34121d71 100644
--- a/Alc/mixer_sse3.c
+++ b/Alc/mixer_sse3.c
@@ -32,16 +32,16 @@
const ALfloat *Resample_fir4_32_SSE3(const BsincState* UNUSED(state), const ALfloat *restrict src,
- ALuint frac, ALuint increment, ALfloat *restrict dst,
- ALuint numsamples)
+ ALuint frac, ALint increment, ALfloat *restrict dst,
+ ALsizei numsamples)
{
const __m128i increment4 = _mm_set1_epi32(increment*4);
const __m128i fracMask4 = _mm_set1_epi32(FRACTIONMASK);
- union { alignas(16) ALuint i[4]; float f[4]; } pos_;
+ union { alignas(16) ALint i[4]; float f[4]; } pos_;
union { alignas(16) ALuint i[4]; float f[4]; } frac_;
__m128i frac4, pos4;
- ALuint pos;
- ALuint i;
+ ALint pos;
+ ALsizei i;
InitiatePositionArrays(frac, increment, frac_.i, pos_.i, 4);
@@ -97,16 +97,16 @@ const ALfloat *Resample_fir4_32_SSE3(const BsincState* UNUSED(state), const ALfl
}
const ALfloat *Resample_fir8_32_SSE3(const BsincState* UNUSED(state), const ALfloat *restrict src,
- ALuint frac, ALuint increment, ALfloat *restrict dst,
- ALuint numsamples)
+ ALuint frac, ALint increment, ALfloat *restrict dst,
+ ALsizei numsamples)
{
const __m128i increment4 = _mm_set1_epi32(increment*4);
const __m128i fracMask4 = _mm_set1_epi32(FRACTIONMASK);
- union { alignas(16) ALuint i[4]; float f[4]; } pos_;
+ union { alignas(16) ALint i[4]; float f[4]; } pos_;
union { alignas(16) ALuint i[4]; float f[4]; } frac_;
__m128i frac4, pos4;
- ALuint pos;
- ALuint i, j;
+ ALsizei i, j;
+ ALint pos;
InitiatePositionArrays(frac, increment, frac_.i, pos_.i, 4);
diff --git a/Alc/mixer_sse41.c b/Alc/mixer_sse41.c
index 7a4db6cf..a531ca77 100644
--- a/Alc/mixer_sse41.c
+++ b/Alc/mixer_sse41.c
@@ -29,17 +29,17 @@
const ALfloat *Resample_lerp32_SSE41(const BsincState* UNUSED(state), const ALfloat *restrict src,
- ALuint frac, ALuint increment, ALfloat *restrict dst,
- ALuint numsamples)
+ ALuint frac, ALint increment, ALfloat *restrict dst,
+ ALsizei numsamples)
{
const __m128i increment4 = _mm_set1_epi32(increment*4);
const __m128 fracOne4 = _mm_set1_ps(1.0f/FRACTIONONE);
const __m128i fracMask4 = _mm_set1_epi32(FRACTIONMASK);
- union { alignas(16) ALuint i[4]; float f[4]; } pos_;
+ union { alignas(16) ALint i[4]; float f[4]; } pos_;
union { alignas(16) ALuint i[4]; float f[4]; } frac_;
__m128i frac4, pos4;
- ALuint pos;
- ALuint i;
+ ALint pos;
+ ALsizei i;
InitiatePositionArrays(frac, increment, frac_.i, pos_.i, 4);
@@ -86,16 +86,16 @@ const ALfloat *Resample_lerp32_SSE41(const BsincState* UNUSED(state), const ALfl
}
const ALfloat *Resample_fir4_32_SSE41(const BsincState* UNUSED(state), const ALfloat *restrict src,
- ALuint frac, ALuint increment, ALfloat *restrict dst,
- ALuint numsamples)
+ ALuint frac, ALint increment, ALfloat *restrict dst,
+ ALsizei numsamples)
{
const __m128i increment4 = _mm_set1_epi32(increment*4);
const __m128i fracMask4 = _mm_set1_epi32(FRACTIONMASK);
- union { alignas(16) ALuint i[4]; float f[4]; } pos_;
+ union { alignas(16) ALint i[4]; float f[4]; } pos_;
union { alignas(16) ALuint i[4]; float f[4]; } frac_;
__m128i frac4, pos4;
- ALuint pos;
- ALuint i;
+ ALint pos;
+ ALsizei i;
InitiatePositionArrays(frac, increment, frac_.i, pos_.i, 4);
@@ -154,16 +154,16 @@ const ALfloat *Resample_fir4_32_SSE41(const BsincState* UNUSED(state), const ALf
}
const ALfloat *Resample_fir8_32_SSE41(const BsincState* UNUSED(state), const ALfloat *restrict src,
- ALuint frac, ALuint increment, ALfloat *restrict dst,
- ALuint numsamples)
+ ALuint frac, ALint increment, ALfloat *restrict dst,
+ ALsizei numsamples)
{
const __m128i increment4 = _mm_set1_epi32(increment*4);
const __m128i fracMask4 = _mm_set1_epi32(FRACTIONMASK);
- union { alignas(16) ALuint i[4]; float f[4]; } pos_;
+ union { alignas(16) ALint i[4]; float f[4]; } pos_;
union { alignas(16) ALuint i[4]; float f[4]; } frac_;
__m128i frac4, pos4;
- ALuint pos;
- ALuint i, j;
+ ALsizei i, j;
+ ALint pos;
InitiatePositionArrays(frac, increment, frac_.i, pos_.i, 4);
diff --git a/OpenAL32/Include/alFilter.h b/OpenAL32/Include/alFilter.h
index bec4d46b..019e40d3 100644
--- a/OpenAL32/Include/alFilter.h
+++ b/OpenAL32/Include/alFilter.h
@@ -77,9 +77,9 @@ inline void ALfilterState_clear(ALfilterState *filter)
void ALfilterState_setParams(ALfilterState *filter, ALfilterType type, ALfloat gain, ALfloat freq_mult, ALfloat rcpQ);
-void ALfilterState_processC(ALfilterState *filter, ALfloat *restrict dst, const ALfloat *restrict src, ALuint numsamples);
+void ALfilterState_processC(ALfilterState *filter, ALfloat *restrict dst, const ALfloat *restrict src, ALsizei numsamples);
-inline void ALfilterState_processPassthru(ALfilterState *filter, const ALfloat *restrict src, ALuint numsamples)
+inline void ALfilterState_processPassthru(ALfilterState *filter, const ALfloat *restrict src, ALsizei numsamples)
{
if(numsamples >= 2)
{
diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h
index cd2170cf..4a424246 100644
--- a/OpenAL32/Include/alu.h
+++ b/OpenAL32/Include/alu.h
@@ -149,7 +149,8 @@ typedef struct SendParams {
typedef const ALfloat* (*ResamplerFunc)(const BsincState *state,
- const ALfloat *restrict src, ALuint frac, ALuint increment, ALfloat *restrict dst, ALuint dstlen
+ const ALfloat *restrict src, ALuint frac, ALint increment,
+ ALfloat *restrict dst, ALsizei dstlen
);
typedef void (*MixerFunc)(const ALfloat *data, ALsizei OutChans,
diff --git a/OpenAL32/alFilter.c b/OpenAL32/alFilter.c
index c675d344..150d84b5 100644
--- a/OpenAL32/alFilter.c
+++ b/OpenAL32/alFilter.c
@@ -36,7 +36,7 @@ extern inline void UnlockFiltersWrite(ALCdevice *device);
extern inline struct ALfilter *LookupFilter(ALCdevice *device, ALuint id);
extern inline struct ALfilter *RemoveFilter(ALCdevice *device, ALuint id);
extern inline void ALfilterState_clear(ALfilterState *filter);
-extern inline void ALfilterState_processPassthru(ALfilterState *filter, const ALfloat *restrict src, ALuint numsamples);
+extern inline void ALfilterState_processPassthru(ALfilterState *filter, const ALfloat *restrict src, ALsizei numsamples);
extern inline ALfloat calc_rcpQ_from_slope(ALfloat gain, ALfloat slope);
extern inline ALfloat calc_rcpQ_from_bandwidth(ALfloat freq_mult, ALfloat bandwidth);