diff options
author | Chris Robinson <[email protected]> | 2017-04-08 14:29:08 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2017-04-08 14:29:08 -0700 |
commit | aef774a7a03485a645edc79ea292abe8c634b8e9 (patch) | |
tree | 4bc9a436fa578c3801cb6e5bbd42eb829a98da7f /Alc | |
parent | 319d0971986309d7882a9be42a5aef7dc612945d (diff) |
Handle the source offset fraction as an ALsizei
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/mixer.c | 4 | ||||
-rw-r--r-- | Alc/mixer_c.c | 15 | ||||
-rw-r--r-- | Alc/mixer_defs.h | 28 | ||||
-rw-r--r-- | Alc/mixer_neon.c | 40 | ||||
-rw-r--r-- | Alc/mixer_sse.c | 2 | ||||
-rw-r--r-- | Alc/mixer_sse2.c | 4 | ||||
-rw-r--r-- | Alc/mixer_sse3.c | 4 | ||||
-rw-r--r-- | Alc/mixer_sse41.c | 8 |
8 files changed, 52 insertions, 53 deletions
diff --git a/Alc/mixer.c b/Alc/mixer.c index f4374882..2a30e323 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, ALint increment, ALuint *restrict frac_arr, ALint *restrict pos_arr, ALsizei size); +extern inline void InitiatePositionArrays(ALsizei frac, ALint increment, ALsizei *restrict frac_arr, ALint *restrict pos_arr, ALsizei size); enum Resampler { @@ -280,7 +280,7 @@ ALboolean MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALsizei ALsizei NumChannels, SampleSize; ResamplerFunc Resample; ALsizei DataPosInt; - ALuint DataPosFrac; + ALsizei DataPosFrac; ALint64 DataSize64; ALint increment; ALsizei Counter; diff --git a/Alc/mixer_c.c b/Alc/mixer_c.c index bb945e88..f0db2ebc 100644 --- a/Alc/mixer_c.c +++ b/Alc/mixer_c.c @@ -8,16 +8,16 @@ #include "alAuxEffectSlot.h" -static inline ALfloat point32(const ALfloat *restrict vals, ALuint UNUSED(frac)) +static inline ALfloat point32(const ALfloat *restrict vals, ALsizei UNUSED(frac)) { return vals[0]; } -static inline ALfloat lerp32(const ALfloat *restrict vals, ALuint frac) +static inline ALfloat lerp32(const ALfloat *restrict vals, ALsizei frac) { return lerp(vals[0], vals[1], frac * (1.0f/FRACTIONONE)); } -static inline ALfloat fir4_32(const ALfloat *restrict vals, ALuint frac) +static inline ALfloat fir4_32(const ALfloat *restrict vals, ALsizei frac) { return resample_fir4(vals[-1], vals[0], vals[1], vals[2], frac); } const ALfloat *Resample_copy32_C(const InterpState* UNUSED(state), - const ALfloat *restrict src, ALuint UNUSED(frac), ALint UNUSED(increment), + const ALfloat *restrict src, ALsizei UNUSED(frac), ALint UNUSED(increment), ALfloat *restrict dst, ALsizei numsamples) { #if defined(HAVE_SSE) || defined(HAVE_NEON) @@ -31,7 +31,7 @@ const ALfloat *Resample_copy32_C(const InterpState* UNUSED(state), #define DECL_TEMPLATE(Sampler) \ const ALfloat *Resample_##Sampler##_C(const InterpState* UNUSED(state), \ - const ALfloat *restrict src, ALuint frac, ALint increment, \ + const ALfloat *restrict src, ALsizei frac, ALint increment, \ ALfloat *restrict dst, ALsizei numsamples) \ { \ ALsizei i; \ @@ -53,7 +53,7 @@ DECL_TEMPLATE(fir4_32) #undef DECL_TEMPLATE const ALfloat *Resample_bsinc32_C(const InterpState *state, const ALfloat *restrict src, - ALuint frac, ALint increment, ALfloat *restrict dst, + ALsizei frac, ALint increment, ALfloat *restrict dst, ALsizei dstlen) { const ALfloat *fil, *scd, *phd, *spd; @@ -79,8 +79,7 @@ const ALfloat *Resample_bsinc32_C(const InterpState *state, const ALfloat *restr // Apply the scale and phase interpolated filter. r = 0.0f; for(j_f = 0;j_f < m;j_f++) - r += (fil[j_f] + sf*scd[j_f] + pf*(phd[j_f] + sf*spd[j_f])) * - src[j_f]; + r += (fil[j_f] + sf*scd[j_f] + pf*(phd[j_f] + sf*spd[j_f])) * src[j_f]; dst[i] = r; frac += increment; diff --git a/Alc/mixer_defs.h b/Alc/mixer_defs.h index d4a49b53..dce748c5 100644 --- a/Alc/mixer_defs.h +++ b/Alc/mixer_defs.h @@ -12,11 +12,11 @@ struct MixHrtfParams; struct HrtfState; /* C resamplers */ -const ALfloat *Resample_copy32_C(const InterpState *state, const ALfloat *restrict src, ALuint frac, ALint increment, ALfloat *restrict dst, ALsizei dstlen); -const ALfloat *Resample_point32_C(const InterpState *state, const ALfloat *restrict src, ALuint frac, ALint increment, ALfloat *restrict dst, ALsizei dstlen); -const ALfloat *Resample_lerp32_C(const InterpState *state, const ALfloat *restrict src, ALuint frac, ALint increment, ALfloat *restrict dst, ALsizei dstlen); -const ALfloat *Resample_fir4_32_C(const InterpState *state, const ALfloat *restrict src, ALuint frac, ALint increment, ALfloat *restrict dst, ALsizei dstlen); -const ALfloat *Resample_bsinc32_C(const InterpState *state, const ALfloat *restrict src, ALuint frac, ALint increment, ALfloat *restrict dst, ALsizei dstlen); +const ALfloat *Resample_copy32_C(const InterpState *state, const ALfloat *restrict src, ALsizei frac, ALint increment, ALfloat *restrict dst, ALsizei dstlen); +const ALfloat *Resample_point32_C(const InterpState *state, const ALfloat *restrict src, ALsizei frac, ALint increment, ALfloat *restrict dst, ALsizei dstlen); +const ALfloat *Resample_lerp32_C(const InterpState *state, const ALfloat *restrict src, ALsizei frac, ALint increment, ALfloat *restrict dst, ALsizei dstlen); +const ALfloat *Resample_fir4_32_C(const InterpState *state, const ALfloat *restrict src, ALsizei frac, ALint increment, ALfloat *restrict dst, ALsizei dstlen); +const ALfloat *Resample_bsinc32_C(const InterpState *state, const ALfloat *restrict src, ALsizei frac, ALint increment, ALfloat *restrict dst, ALsizei dstlen); /* C mixers */ @@ -52,7 +52,7 @@ void MixRow_SSE(ALfloat *OutBuffer, const ALfloat *Gains, ALsizei InPos, ALsizei BufferSize); /* SSE resamplers */ -inline void InitiatePositionArrays(ALuint frac, ALint increment, ALuint *restrict frac_arr, ALint *restrict pos_arr, ALsizei size) +inline void InitiatePositionArrays(ALsizei frac, ALint increment, ALsizei *restrict frac_arr, ALint *restrict pos_arr, ALsizei size) { ALsizei i; @@ -67,21 +67,21 @@ inline void InitiatePositionArrays(ALuint frac, ALint increment, ALuint *restric } const ALfloat *Resample_lerp32_SSE2(const InterpState *state, const ALfloat *restrict src, - ALuint frac, ALint increment, ALfloat *restrict dst, + ALsizei frac, ALint increment, ALfloat *restrict dst, ALsizei numsamples); const ALfloat *Resample_lerp32_SSE41(const InterpState *state, const ALfloat *restrict src, - ALuint frac, ALint increment, ALfloat *restrict dst, + ALsizei frac, ALint increment, ALfloat *restrict dst, ALsizei numsamples); const ALfloat *Resample_fir4_32_SSE3(const InterpState *state, const ALfloat *restrict src, - ALuint frac, ALint increment, ALfloat *restrict dst, + ALsizei frac, ALint increment, ALfloat *restrict dst, ALsizei numsamples); const ALfloat *Resample_fir4_32_SSE41(const InterpState *state, const ALfloat *restrict src, - ALuint frac, ALint increment, ALfloat *restrict dst, + ALsizei frac, ALint increment, ALfloat *restrict dst, ALsizei numsamples); const ALfloat *Resample_bsinc32_SSE(const InterpState *state, const ALfloat *restrict src, - ALuint frac, ALint increment, ALfloat *restrict dst, + ALsizei frac, ALint increment, ALfloat *restrict dst, ALsizei dstlen); /* Neon mixers */ @@ -102,13 +102,13 @@ void MixRow_Neon(ALfloat *OutBuffer, const ALfloat *Gains, /* Neon resamplers */ const ALfloat *Resample_lerp32_Neon(const InterpState *state, const ALfloat *restrict src, - ALuint frac, ALint increment, ALfloat *restrict dst, + ALsizei frac, ALint increment, ALfloat *restrict dst, ALsizei numsamples); const ALfloat *Resample_fir4_32_Neon(const InterpState *state, const ALfloat *restrict src, - ALuint frac, ALint increment, ALfloat *restrict dst, + ALsizei frac, ALint increment, ALfloat *restrict dst, ALsizei numsamples); const ALfloat *Resample_bsinc32_Neon(const InterpState *state, const ALfloat *restrict src, - ALuint frac, ALint increment, ALfloat *restrict dst, + ALsizei frac, ALint increment, ALfloat *restrict dst, ALsizei dstlen); #endif /* MIXER_DEFS_H */ diff --git a/Alc/mixer_neon.c b/Alc/mixer_neon.c index 0ceb9328..65dd608c 100644 --- a/Alc/mixer_neon.c +++ b/Alc/mixer_neon.c @@ -11,21 +11,21 @@ const ALfloat *Resample_lerp32_Neon(const InterpState* UNUSED(state), - const ALfloat *restrict src, ALuint frac, ALint increment, + const ALfloat *restrict src, ALsizei frac, ALint increment, ALfloat *restrict dst, ALsizei numsamples) { const int32x4_t increment4 = vdupq_n_s32(increment*4); const float32x4_t fracOne4 = vdupq_n_f32(1.0f/FRACTIONONE); - const uint32x4_t fracMask4 = vdupq_n_u32(FRACTIONMASK); + const int32x4_t fracMask4 = vdupq_n_s32(FRACTIONMASK); alignas(16) ALint pos_[4]; - alignas(16) ALuint frac_[4]; + alignas(16) ALsizei frac_[4]; int32x4_t pos4; - uint32x4_t frac4; + int32x4_t frac4; ALsizei i; InitiatePositionArrays(frac, increment, frac_, pos_, 4); - frac4 = vld1q_u32(frac_); + frac4 = vld1q_s32(frac_); pos4 = vld1q_s32(pos_); for(i = 0;numsamples-i > 3;i += 4) @@ -35,14 +35,14 @@ const ALfloat *Resample_lerp32_Neon(const InterpState* UNUSED(state), /* val1 + (val2-val1)*mu */ const float32x4_t r0 = vsubq_f32(val2, val1); - const float32x4_t mu = vmulq_f32(vcvtq_f32_u32(frac4), fracOne4); + const float32x4_t mu = vmulq_f32(vcvtq_f32_s32(frac4), fracOne4); const float32x4_t out = vmlaq_f32(val1, mu, r0); vst1q_f32(&dst[i], out); - frac4 = vaddq_u32(frac4, (uint32x4_t)increment4); - pos4 = vaddq_s32(pos4, (int32x4_t)vshrq_n_u32(frac4, FRACTIONBITS)); - frac4 = vandq_u32(frac4, fracMask4); + frac4 = vaddq_s32(frac4, increment4); + pos4 = vaddq_s32(pos4, vshrq_n_s32(frac4, FRACTIONBITS)); + frac4 = vandq_s32(frac4, fracMask4); vst1q_s32(pos_, pos4); } @@ -54,7 +54,7 @@ const ALfloat *Resample_lerp32_Neon(const InterpState* UNUSED(state), * resample. */ ALint pos = pos_[0]; - frac = vgetq_lane_u32(frac4, 0); + frac = vgetq_lane_s32(frac4, 0); do { dst[i] = lerp(src[pos], src[pos+1], frac * (1.0f/FRACTIONONE)); @@ -67,20 +67,20 @@ const ALfloat *Resample_lerp32_Neon(const InterpState* UNUSED(state), } const ALfloat *Resample_fir4_32_Neon(const InterpState* UNUSED(state), - const ALfloat *restrict src, ALuint frac, ALint increment, + const ALfloat *restrict src, ALsizei frac, ALint increment, ALfloat *restrict dst, ALsizei numsamples) { const int32x4_t increment4 = vdupq_n_s32(increment*4); - const uint32x4_t fracMask4 = vdupq_n_u32(FRACTIONMASK); + const int32x4_t fracMask4 = vdupq_n_s32(FRACTIONMASK); alignas(16) ALint pos_[4]; - alignas(16) ALuint frac_[4]; + alignas(16) ALsizei frac_[4]; int32x4_t pos4; - uint32x4_t frac4; + int32x4_t frac4; ALsizei i; InitiatePositionArrays(frac, increment, frac_, pos_, 4); - frac4 = vld1q_u32(frac_); + frac4 = vld1q_s32(frac_); pos4 = vld1q_s32(pos_); --src; @@ -109,12 +109,12 @@ const ALfloat *Resample_fir4_32_Neon(const InterpState* UNUSED(state), vst1q_f32(&dst[i], out); - frac4 = vaddq_u32(frac4, (uint32x4_t)increment4); - pos4 = vaddq_s32(pos4, (int32x4_t)vshrq_n_u32(frac4, FRACTIONBITS)); - frac4 = vandq_u32(frac4, fracMask4); + frac4 = vaddq_s32(frac4, increment4); + pos4 = vaddq_s32(pos4, vshrq_n_s32(frac4, FRACTIONBITS)); + frac4 = vandq_s32(frac4, fracMask4); vst1q_s32(pos_, pos4); - vst1q_u32(frac_, frac4); + vst1q_s32(frac_, frac4); } if(i < numsamples) @@ -137,7 +137,7 @@ const ALfloat *Resample_fir4_32_Neon(const InterpState* UNUSED(state), } const ALfloat *Resample_bsinc32_Neon(const InterpState *state, - const ALfloat *restrict src, ALuint frac, ALint increment, + const ALfloat *restrict src, ALsizei frac, ALint increment, ALfloat *restrict dst, ALsizei dstlen) { const float32x4_t sf4 = vdupq_n_f32(state->bsinc.sf); diff --git a/Alc/mixer_sse.c b/Alc/mixer_sse.c index 37ce953f..d30ec982 100644 --- a/Alc/mixer_sse.c +++ b/Alc/mixer_sse.c @@ -13,7 +13,7 @@ const ALfloat *Resample_bsinc32_SSE(const InterpState *state, const ALfloat *restrict src, - ALuint frac, ALint increment, ALfloat *restrict dst, + ALsizei frac, ALint increment, ALfloat *restrict dst, ALsizei dstlen) { const __m128 sf4 = _mm_set1_ps(state->bsinc.sf); diff --git a/Alc/mixer_sse2.c b/Alc/mixer_sse2.c index a1e8507e..84cc35dd 100644 --- a/Alc/mixer_sse2.c +++ b/Alc/mixer_sse2.c @@ -28,14 +28,14 @@ const ALfloat *Resample_lerp32_SSE2(const InterpState* UNUSED(state), - const ALfloat *restrict src, ALuint frac, ALint increment, + const ALfloat *restrict src, ALsizei 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) ALint i[4]; float f[4]; } pos_; - union { alignas(16) ALuint i[4]; float f[4]; } frac_; + union { alignas(16) ALsizei i[4]; float f[4]; } frac_; __m128i frac4, pos4; ALint pos; ALsizei i; diff --git a/Alc/mixer_sse3.c b/Alc/mixer_sse3.c index 142cd363..78603c87 100644 --- a/Alc/mixer_sse3.c +++ b/Alc/mixer_sse3.c @@ -32,13 +32,13 @@ const ALfloat *Resample_fir4_32_SSE3(const InterpState* UNUSED(state), - const ALfloat *restrict src, ALuint frac, ALint increment, + const ALfloat *restrict src, ALsizei 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) ALint i[4]; float f[4]; } pos_; - union { alignas(16) ALuint i[4]; float f[4]; } frac_; + union { alignas(16) ALsizei i[4]; float f[4]; } frac_; __m128i frac4, pos4; ALint pos; ALsizei i; diff --git a/Alc/mixer_sse41.c b/Alc/mixer_sse41.c index d5f06d90..613a89ff 100644 --- a/Alc/mixer_sse41.c +++ b/Alc/mixer_sse41.c @@ -29,14 +29,14 @@ const ALfloat *Resample_lerp32_SSE41(const InterpState* UNUSED(state), - const ALfloat *restrict src, ALuint frac, ALint increment, + const ALfloat *restrict src, ALsizei 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) ALint i[4]; float f[4]; } pos_; - union { alignas(16) ALuint i[4]; float f[4]; } frac_; + union { alignas(16) ALsizei i[4]; float f[4]; } frac_; __m128i frac4, pos4; ALint pos; ALsizei i; @@ -86,13 +86,13 @@ const ALfloat *Resample_lerp32_SSE41(const InterpState* UNUSED(state), } const ALfloat *Resample_fir4_32_SSE41(const InterpState* UNUSED(state), - const ALfloat *restrict src, ALuint frac, ALint increment, + const ALfloat *restrict src, ALsizei 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) ALint i[4]; float f[4]; } pos_; - union { alignas(16) ALuint i[4]; float f[4]; } frac_; + union { alignas(16) ALsizei i[4]; float f[4]; } frac_; __m128i frac4, pos4; ALint pos; ALsizei i; |