aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alc/ALu.c15
-rw-r--r--Alc/mixer_c.c9
-rw-r--r--Alc/mixer_neon.c9
-rw-r--r--Alc/mixer_sse.c9
-rw-r--r--OpenAL32/Include/alu.h11
5 files changed, 23 insertions, 30 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index d559649a..2b83ea00 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -226,9 +226,9 @@ void aluInit(void)
*/
ALboolean BsincPrepare(const ALuint increment, BsincState *state)
{
- ALfloat sf;
- ALsizei si, pi;
ALboolean uncut = AL_TRUE;
+ ALfloat sf;
+ ALsizei si;
if(increment > FRACTIONONE)
{
@@ -262,16 +262,7 @@ ALboolean BsincPrepare(const ALuint increment, BsincState *state)
state->sf = sf;
state->m = bsinc.m[si];
state->l = -((state->m/2) - 1);
- /* The CPU cost of this table re-mapping could be traded for the memory
- * cost of a complete table map (1024 elements large).
- */
- for(pi = 0;pi < BSINC_PHASE_COUNT;pi++)
- {
- state->coeffs[pi].filter = &bsinc.Tab[bsinc.filterOffset[si] + bsinc.m[si]*(pi*4 + 0)];
- state->coeffs[pi].scDelta = &bsinc.Tab[bsinc.filterOffset[si] + bsinc.m[si]*(pi*4 + 1)];
- state->coeffs[pi].phDelta = &bsinc.Tab[bsinc.filterOffset[si] + bsinc.m[si]*(pi*4 + 2)];
- state->coeffs[pi].spDelta = &bsinc.Tab[bsinc.filterOffset[si] + bsinc.m[si]*(pi*4 + 3)];
- }
+ state->filter = bsinc.Tab + bsinc.filterOffset[si];
return uncut;
}
diff --git a/Alc/mixer_c.c b/Alc/mixer_c.c
index 87f2fe90..6d616cbf 100644
--- a/Alc/mixer_c.c
+++ b/Alc/mixer_c.c
@@ -57,6 +57,7 @@ const ALfloat *Resample_bsinc32_C(const InterpState *state, const ALfloat *restr
ALsizei dstlen)
{
const ALfloat *fil, *scd, *phd, *spd;
+ const ALfloat *filter = state->bsinc.filter;
const ALfloat sf = state->bsinc.sf;
const ALsizei m = state->bsinc.m;
ALsizei j_f, pi, i;
@@ -71,10 +72,10 @@ const ALfloat *Resample_bsinc32_C(const InterpState *state, const ALfloat *restr
pf = (frac & ((1<<FRAC_PHASE_BITDIFF)-1)) * (1.0f/(1<<FRAC_PHASE_BITDIFF));
#undef FRAC_PHASE_BITDIFF
- fil = ASSUME_ALIGNED(state->bsinc.coeffs[pi].filter, 16);
- scd = ASSUME_ALIGNED(state->bsinc.coeffs[pi].scDelta, 16);
- phd = ASSUME_ALIGNED(state->bsinc.coeffs[pi].phDelta, 16);
- spd = ASSUME_ALIGNED(state->bsinc.coeffs[pi].spDelta, 16);
+ fil = ASSUME_ALIGNED(filter + m*pi*4, 16);
+ scd = ASSUME_ALIGNED(fil + m, 16);
+ phd = ASSUME_ALIGNED(scd + m, 16);
+ spd = ASSUME_ALIGNED(phd + m, 16);
// Apply the scale and phase interpolated filter.
r = 0.0f;
diff --git a/Alc/mixer_neon.c b/Alc/mixer_neon.c
index 51191783..dd7e4226 100644
--- a/Alc/mixer_neon.c
+++ b/Alc/mixer_neon.c
@@ -140,6 +140,7 @@ const ALfloat *Resample_bsinc32_Neon(const InterpState *state,
const ALfloat *restrict src, ALsizei frac, ALint increment,
ALfloat *restrict dst, ALsizei dstlen)
{
+ const ALfloat *filter = state->bsinc.filter;
const float32x4_t sf4 = vdupq_n_f32(state->bsinc.sf);
const ALsizei m = state->bsinc.m;
const ALfloat *fil, *scd, *phd, *spd;
@@ -156,10 +157,10 @@ const ALfloat *Resample_bsinc32_Neon(const InterpState *state,
pf = (frac & ((1<<FRAC_PHASE_BITDIFF)-1)) * (1.0f/(1<<FRAC_PHASE_BITDIFF));
#undef FRAC_PHASE_BITDIFF
- fil = ASSUME_ALIGNED(state->bsinc.coeffs[pi].filter, 16);
- scd = ASSUME_ALIGNED(state->bsinc.coeffs[pi].scDelta, 16);
- phd = ASSUME_ALIGNED(state->bsinc.coeffs[pi].phDelta, 16);
- spd = ASSUME_ALIGNED(state->bsinc.coeffs[pi].spDelta, 16);
+ fil = ASSUME_ALIGNED(filter + m*pi*4, 16);
+ scd = ASSUME_ALIGNED(fil + m, 16);
+ phd = ASSUME_ALIGNED(scd + m, 16);
+ spd = ASSUME_ALIGNED(phd + m, 16);
// Apply the scale and phase interpolated filter.
r4 = vdupq_n_f32(0.0f);
diff --git a/Alc/mixer_sse.c b/Alc/mixer_sse.c
index 68786573..bd7928e4 100644
--- a/Alc/mixer_sse.c
+++ b/Alc/mixer_sse.c
@@ -16,6 +16,7 @@ const ALfloat *Resample_bsinc32_SSE(const InterpState *state, const ALfloat *res
ALsizei frac, ALint increment, ALfloat *restrict dst,
ALsizei dstlen)
{
+ const ALfloat *filter = state->bsinc.filter;
const __m128 sf4 = _mm_set1_ps(state->bsinc.sf);
const ALsizei m = state->bsinc.m;
const ALfloat *fil, *scd, *phd, *spd;
@@ -32,10 +33,10 @@ const ALfloat *Resample_bsinc32_SSE(const InterpState *state, const ALfloat *res
pf = (frac & ((1<<FRAC_PHASE_BITDIFF)-1)) * (1.0f/(1<<FRAC_PHASE_BITDIFF));
#undef FRAC_PHASE_BITDIFF
- fil = ASSUME_ALIGNED(state->bsinc.coeffs[pi].filter, 16);
- scd = ASSUME_ALIGNED(state->bsinc.coeffs[pi].scDelta, 16);
- phd = ASSUME_ALIGNED(state->bsinc.coeffs[pi].phDelta, 16);
- spd = ASSUME_ALIGNED(state->bsinc.coeffs[pi].spDelta, 16);
+ fil = ASSUME_ALIGNED(filter + m*pi*4, 16);
+ scd = ASSUME_ALIGNED(fil + m, 16);
+ phd = ASSUME_ALIGNED(scd + m, 16);
+ spd = ASSUME_ALIGNED(phd + m, 16);
// Apply the scale and phase interpolated filter.
r4 = _mm_setzero_ps();
diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h
index 57c85ad0..78f05b63 100644
--- a/OpenAL32/Include/alu.h
+++ b/OpenAL32/Include/alu.h
@@ -73,12 +73,11 @@ typedef struct BsincState {
ALfloat sf; /* Scale interpolation factor. */
ALsizei m; /* Coefficient count. */
ALint l; /* Left coefficient offset. */
- struct {
- const ALfloat *filter; /* Filter coefficients. */
- const ALfloat *scDelta; /* Scale deltas. */
- const ALfloat *phDelta; /* Phase deltas. */
- const ALfloat *spDelta; /* Scale-phase deltas. */
- } coeffs[BSINC_PHASE_COUNT];
+ /* Filter coefficients, followed by the scale, phase, and scale-phase
+ * delta coefficients. Starting at phase index 0, each subsequent phase
+ * index follows contiguously.
+ */
+ const ALfloat *filter;
} BsincState;
typedef union InterpState {