aboutsummaryrefslogtreecommitdiffstats
path: root/alc
diff options
context:
space:
mode:
Diffstat (limited to 'alc')
-rw-r--r--alc/alu.h4
-rw-r--r--alc/mixer/mixer_c.cpp12
-rw-r--r--alc/mixer/mixer_neon.cpp11
-rw-r--r--alc/mixer/mixer_sse.cpp6
4 files changed, 14 insertions, 19 deletions
diff --git a/alc/alu.h b/alc/alu.h
index cf021285..33c67630 100644
--- a/alc/alu.h
+++ b/alc/alu.h
@@ -67,8 +67,8 @@ extern Resampler ResamplerDefault;
*/
struct BsincState {
ALfloat sf; /* Scale interpolation factor. */
- ALsizei m; /* Coefficient count. */
- ALsizei l; /* Left coefficient offset. */
+ ALuint m; /* Coefficient count. */
+ ALuint l; /* Left coefficient offset. */
/* Filter coefficients, followed by the scale, phase, and scale-phase
* delta coefficients. Starting at phase index 0, each subsequent phase
* index follows contiguously.
diff --git a/alc/mixer/mixer_c.cpp b/alc/mixer/mixer_c.cpp
index 6e96e54e..42d515ae 100644
--- a/alc/mixer/mixer_c.cpp
+++ b/alc/mixer/mixer_c.cpp
@@ -21,7 +21,7 @@ inline ALfloat do_cubic(const InterpState&, const ALfloat *RESTRICT vals, const
{ return cubic(vals[0], vals[1], vals[2], vals[3], static_cast<float>(frac)*(1.0f/FRACTIONONE)); }
inline ALfloat do_bsinc(const InterpState &istate, const ALfloat *RESTRICT vals, const ALuint frac)
{
- ASSUME(istate.bsinc.m > 0);
+ const size_t m{istate.bsinc.m};
// Calculate the phase index and factor.
#define FRAC_PHASE_BITDIFF (FRACTIONBITS-BSINC_PHASE_BITS)
@@ -30,14 +30,14 @@ inline ALfloat do_bsinc(const InterpState &istate, const ALfloat *RESTRICT vals,
(1.0f/(1<<FRAC_PHASE_BITDIFF))};
#undef FRAC_PHASE_BITDIFF
- const ALfloat *fil{istate.bsinc.filter + istate.bsinc.m*static_cast<ptrdiff_t>(pi*4)};
- const ALfloat *scd{fil + istate.bsinc.m};
- const ALfloat *phd{scd + istate.bsinc.m};
- const ALfloat *spd{phd + istate.bsinc.m};
+ const ALfloat *fil{istate.bsinc.filter + m*pi*4};
+ const ALfloat *scd{fil + m};
+ const ALfloat *phd{scd + m};
+ const ALfloat *spd{phd + m};
// Apply the scale and phase interpolated filter.
ALfloat r{0.0f};
- for(ALsizei j_f{0};j_f < istate.bsinc.m;j_f++)
+ for(size_t j_f{0};j_f < m;j_f++)
r += (fil[j_f] + istate.bsinc.sf*scd[j_f] + pf*(phd[j_f] + istate.bsinc.sf*spd[j_f])) * vals[j_f];
return r;
}
diff --git a/alc/mixer/mixer_neon.cpp b/alc/mixer/mixer_neon.cpp
index 8a98f5de..cd2b0ebc 100644
--- a/alc/mixer/mixer_neon.cpp
+++ b/alc/mixer/mixer_neon.cpp
@@ -74,9 +74,7 @@ const ALfloat *Resample_<BSincTag,NEONTag>(const InterpState *state, const ALflo
{
const ALfloat *const filter{state->bsinc.filter};
const float32x4_t sf4{vdupq_n_f32(state->bsinc.sf)};
- const ptrdiff_t m{state->bsinc.m};
-
- ASSUME(m > 0);
+ const size_t m{state->bsinc.m};
src -= state->bsinc.l;
for(float &out_sample : dst)
@@ -92,11 +90,11 @@ const ALfloat *Resample_<BSincTag,NEONTag>(const InterpState *state, const ALflo
float32x4_t r4{vdupq_n_f32(0.0f)};
{
const float32x4_t pf4{vdupq_n_f32(pf)};
- const float *fil{filter + m*static_cast<ptrdiff_t>(pi*4)};
+ const float *fil{filter + m*pi*4};
const float *scd{fil + m};
const float *phd{scd + m};
const float *spd{phd + m};
- ptrdiff_t td{m >> 2};
+ size_t td{m >> 2};
size_t j{0u};
do {
@@ -110,8 +108,7 @@ const ALfloat *Resample_<BSincTag,NEONTag>(const InterpState *state, const ALflo
j += 4;
} while(--td);
}
- r4 = vaddq_f32(r4, vcombine_f32(vrev64_f32(vget_high_f32(r4)),
- vrev64_f32(vget_low_f32(r4))));
+ r4 = vaddq_f32(r4, vrev64q_f32(r4));
out_sample = vget_lane_f32(vadd_f32(vget_low_f32(r4), vget_high_f32(r4)), 0);
frac += increment;
diff --git a/alc/mixer/mixer_sse.cpp b/alc/mixer/mixer_sse.cpp
index d47a0e66..9bb3bb8a 100644
--- a/alc/mixer/mixer_sse.cpp
+++ b/alc/mixer/mixer_sse.cpp
@@ -19,9 +19,7 @@ const ALfloat *Resample_<BSincTag,SSETag>(const InterpState *state, const ALfloa
{
const ALfloat *const filter{state->bsinc.filter};
const __m128 sf4{_mm_set1_ps(state->bsinc.sf)};
- const ptrdiff_t m{state->bsinc.m};
-
- ASSUME(m > 0);
+ const size_t m{state->bsinc.m};
src -= state->bsinc.l;
for(float &out_sample : dst)
@@ -41,7 +39,7 @@ const ALfloat *Resample_<BSincTag,SSETag>(const InterpState *state, const ALfloa
const float *scd{fil + m};
const float *phd{scd + m};
const float *spd{phd + m};
- ptrdiff_t td{m >> 2};
+ size_t td{m >> 2};
size_t j{0u};
#define MLA4(x, y, z) _mm_add_ps(x, _mm_mul_ps(y, z))