aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/mixer_c.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-08-16 18:09:53 -0700
committerChris Robinson <[email protected]>2017-08-16 18:09:53 -0700
commit5008024e73e7451c25a4c8729bfb636699615e8e (patch)
treee74f3f6fed16f70db6982d6819d2d347a708c7f2 /Alc/mixer_c.c
parentf9c09cc845b786705b43b39300d8706db7ab0054 (diff)
Store the sinc4 table in the filter state
Also rename the resampler functions to remove the unnecessary '32' token.
Diffstat (limited to 'Alc/mixer_c.c')
-rw-r--r--Alc/mixer_c.c42
1 files changed, 29 insertions, 13 deletions
diff --git a/Alc/mixer_c.c b/Alc/mixer_c.c
index 6d616cbf..738789f9 100644
--- a/Alc/mixer_c.c
+++ b/Alc/mixer_c.c
@@ -8,15 +8,13 @@
#include "alAuxEffectSlot.h"
-static inline ALfloat point32(const ALfloat *restrict vals, ALsizei UNUSED(frac))
+static inline ALfloat do_point(const ALfloat *restrict vals, ALsizei UNUSED(frac))
{ return vals[0]; }
-static inline ALfloat lerp32(const ALfloat *restrict vals, ALsizei frac)
+static inline ALfloat do_lerp(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, 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 *Resample_copy_C(const InterpState* UNUSED(state),
const ALfloat *restrict src, ALsizei UNUSED(frac), ALint UNUSED(increment),
ALfloat *restrict dst, ALsizei numsamples)
{
@@ -29,8 +27,8 @@ const ALfloat *Resample_copy32_C(const InterpState* UNUSED(state),
return dst;
}
-#define DECL_TEMPLATE(Sampler) \
-const ALfloat *Resample_##Sampler##_C(const InterpState* UNUSED(state), \
+#define DECL_TEMPLATE(Tag, Sampler) \
+const ALfloat *Resample_##Tag##_C(const InterpState* UNUSED(state), \
const ALfloat *restrict src, ALsizei frac, ALint increment, \
ALfloat *restrict dst, ALsizei numsamples) \
{ \
@@ -46,15 +44,33 @@ const ALfloat *Resample_##Sampler##_C(const InterpState* UNUSED(state), \
return dst; \
}
-DECL_TEMPLATE(point32)
-DECL_TEMPLATE(lerp32)
-DECL_TEMPLATE(fir4_32)
+DECL_TEMPLATE(point, do_point)
+DECL_TEMPLATE(lerp, do_lerp)
#undef DECL_TEMPLATE
-const ALfloat *Resample_bsinc32_C(const InterpState *state, const ALfloat *restrict src,
- ALsizei frac, ALint increment, ALfloat *restrict dst,
- ALsizei dstlen)
+const ALfloat *Resample_fir4_C(const InterpState *state, const ALfloat *restrict src,
+ ALsizei frac, ALint increment, ALfloat *restrict dst,
+ ALsizei numsamples)
+{
+ const ALfloat (*restrict filter)[4] = ASSUME_ALIGNED(state->sinc4.filter, 16);
+ ALsizei i;
+
+ src -= 1;
+ for(i = 0;i < numsamples;i++)
+ {
+ dst[i] = resample_fir4(filter, src[0], src[1], src[2], src[3], frac);
+
+ frac += increment;
+ src += frac>>FRACTIONBITS;
+ frac &= FRACTIONMASK;
+ }
+ return dst;
+}
+
+const ALfloat *Resample_bsinc_C(const InterpState *state, const ALfloat *restrict src,
+ ALsizei frac, ALint increment, ALfloat *restrict dst,
+ ALsizei dstlen)
{
const ALfloat *fil, *scd, *phd, *spd;
const ALfloat *filter = state->bsinc.filter;