diff options
author | Chris Robinson <[email protected]> | 2017-02-13 11:29:32 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2017-02-13 11:29:32 -0800 |
commit | 0324712540f88d18f1fa8f18f7a72da06af00d75 (patch) | |
tree | df0e7b260f1833f3e5b42503225d2b6978ccf181 /Alc | |
parent | 841d0bb893e19dbe6f95bd80a3ac50997f9e8f0d (diff) |
Put BsincState in a generic union
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/ALu.c | 4 | ||||
-rw-r--r-- | Alc/mixer.c | 2 | ||||
-rw-r--r-- | Alc/mixer_c.c | 20 | ||||
-rw-r--r-- | Alc/mixer_defs.h | 34 | ||||
-rw-r--r-- | Alc/mixer_neon.c | 38 | ||||
-rw-r--r-- | Alc/mixer_sse.c | 16 | ||||
-rw-r--r-- | Alc/mixer_sse2.c | 6 | ||||
-rw-r--r-- | Alc/mixer_sse3.c | 12 | ||||
-rw-r--r-- | Alc/mixer_sse41.c | 18 |
9 files changed, 75 insertions, 75 deletions
@@ -433,7 +433,7 @@ static void CalcNonAttnSourceParams(ALvoice *voice, const struct ALsourceProps * voice->Step = MAX_PITCH<<FRACTIONBITS; else voice->Step = maxi(fastf2i(Pitch*FRACTIONONE + 0.5f), 1); - BsincPrepare(voice->Step, &voice->SincState); + BsincPrepare(voice->Step, &voice->ResampleState.bsinc); /* Calculate gains */ DryGain = clampf(SourceVolume, MinVolume, MaxVolume); @@ -1115,7 +1115,7 @@ static void CalcAttnSourceParams(ALvoice *voice, const struct ALsourceProps *pro voice->Step = MAX_PITCH<<FRACTIONBITS; else voice->Step = maxi(fastf2i(Pitch*FRACTIONONE + 0.5f), 1); - BsincPrepare(voice->Step, &voice->SincState); + BsincPrepare(voice->Step, &voice->ResampleState.bsinc); if(Device->Render_Mode == HrtfRender) { diff --git a/Alc/mixer.c b/Alc/mixer.c index 5442954e..592d51d4 100644 --- a/Alc/mixer.c +++ b/Alc/mixer.c @@ -564,7 +564,7 @@ void MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALsizei Samp ); /* Now resample, then filter and mix to the appropriate outputs. */ - ResampledData = Resample(&voice->SincState, + ResampledData = Resample(&voice->ResampleState, &SrcData[MAX_PRE_SAMPLES], DataPosFrac, increment, Device->ResampledData, DstBufferSize ); diff --git a/Alc/mixer_c.c b/Alc/mixer_c.c index 1284371b..323f1363 100644 --- a/Alc/mixer_c.c +++ b/Alc/mixer_c.c @@ -18,7 +18,7 @@ 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 *Resample_copy32_C(const InterpState* UNUSED(state), const ALfloat *restrict src, ALuint UNUSED(frac), ALint UNUSED(increment), ALfloat *restrict dst, ALsizei numsamples) { @@ -32,7 +32,7 @@ const ALfloat *Resample_copy32_C(const BsincState* UNUSED(state), } #define DECL_TEMPLATE(Sampler) \ -const ALfloat *Resample_##Sampler##_C(const BsincState* UNUSED(state), \ +const ALfloat *Resample_##Sampler##_C(const InterpState* UNUSED(state), \ const ALfloat *restrict src, ALuint frac, ALint increment, \ ALfloat *restrict dst, ALsizei numsamples) \ { \ @@ -55,17 +55,17 @@ DECL_TEMPLATE(fir8_32) #undef DECL_TEMPLATE -const ALfloat *Resample_bsinc32_C(const BsincState *state, const ALfloat *restrict src, +const ALfloat *Resample_bsinc32_C(const InterpState *state, const ALfloat *restrict src, ALuint frac, ALint increment, ALfloat *restrict dst, ALsizei dstlen) { const ALfloat *fil, *scd, *phd, *spd; - const ALfloat sf = state->sf; - const ALsizei m = state->m; + const ALfloat sf = state->bsinc.sf; + const ALsizei m = state->bsinc.m; ALsizei j_f, pi, i; ALfloat pf, r; - src += state->l; + src += state->bsinc.l; for(i = 0;i < dstlen;i++) { // Calculate the phase index and factor. @@ -74,10 +74,10 @@ const ALfloat *Resample_bsinc32_C(const BsincState *state, const ALfloat *restri pf = (frac & ((1<<FRAC_PHASE_BITDIFF)-1)) * (1.0f/(1<<FRAC_PHASE_BITDIFF)); #undef FRAC_PHASE_BITDIFF - fil = state->coeffs[pi].filter; - scd = state->coeffs[pi].scDelta; - phd = state->coeffs[pi].phDelta; - spd = state->coeffs[pi].spDelta; + 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); // Apply the scale and phase interpolated filter. r = 0.0f; diff --git a/Alc/mixer_defs.h b/Alc/mixer_defs.h index 4bafc839..60735c9f 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, 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); +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_fir8_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); /* C mixers */ @@ -67,28 +67,28 @@ inline void InitiatePositionArrays(ALuint frac, ALint increment, ALuint *restric } } -const ALfloat *Resample_lerp32_SSE2(const BsincState *state, const ALfloat *restrict src, +const ALfloat *Resample_lerp32_SSE2(const InterpState *state, const ALfloat *restrict src, ALuint frac, ALint increment, ALfloat *restrict dst, ALsizei numsamples); -const ALfloat *Resample_lerp32_SSE41(const BsincState *state, const ALfloat *restrict src, +const ALfloat *Resample_lerp32_SSE41(const InterpState *state, const ALfloat *restrict src, ALuint frac, ALint increment, ALfloat *restrict dst, ALsizei numsamples); -const ALfloat *Resample_fir4_32_SSE3(const BsincState *state, const ALfloat *restrict src, +const ALfloat *Resample_fir4_32_SSE3(const InterpState *state, const ALfloat *restrict src, ALuint frac, ALint increment, ALfloat *restrict dst, ALsizei numsamples); -const ALfloat *Resample_fir4_32_SSE41(const BsincState *state, const ALfloat *restrict src, +const ALfloat *Resample_fir4_32_SSE41(const InterpState *state, const ALfloat *restrict src, ALuint frac, ALint increment, ALfloat *restrict dst, ALsizei numsamples); -const ALfloat *Resample_fir8_32_SSE3(const BsincState *state, const ALfloat *restrict src, +const ALfloat *Resample_fir8_32_SSE3(const InterpState *state, const ALfloat *restrict src, ALuint frac, ALint increment, ALfloat *restrict dst, ALsizei numsamples); -const ALfloat *Resample_fir8_32_SSE41(const BsincState *state, const ALfloat *restrict src, +const ALfloat *Resample_fir8_32_SSE41(const InterpState *state, const ALfloat *restrict src, ALuint frac, ALint increment, ALfloat *restrict dst, ALsizei numsamples); -const ALfloat *Resample_bsinc32_SSE(const BsincState *state, const ALfloat *restrict src, +const ALfloat *Resample_bsinc32_SSE(const InterpState *state, const ALfloat *restrict src, ALuint frac, ALint increment, ALfloat *restrict dst, ALsizei dstlen); @@ -109,16 +109,16 @@ void MixRow_Neon(ALfloat *OutBuffer, const ALfloat *Gains, ALsizei InPos, ALsizei BufferSize); /* Neon resamplers */ -const ALfloat *Resample_lerp32_Neon(const BsincState *state, const ALfloat *restrict src, +const ALfloat *Resample_lerp32_Neon(const InterpState *state, const ALfloat *restrict src, ALuint frac, ALint increment, ALfloat *restrict dst, ALsizei numsamples); -const ALfloat *Resample_fir4_32_Neon(const BsincState *state, const ALfloat *restrict src, +const ALfloat *Resample_fir4_32_Neon(const InterpState *state, const ALfloat *restrict src, ALuint frac, ALint increment, ALfloat *restrict dst, ALsizei numsamples); -const ALfloat *Resample_fir8_32_Neon(const BsincState *state, const ALfloat *restrict src, +const ALfloat *Resample_fir8_32_Neon(const InterpState *state, const ALfloat *restrict src, ALuint frac, ALint increment, ALfloat *restrict dst, ALsizei numsamples); -const ALfloat *Resample_bsinc32_Neon(const BsincState *state, const ALfloat *restrict src, +const ALfloat *Resample_bsinc32_Neon(const InterpState *state, const ALfloat *restrict src, ALuint frac, ALint increment, ALfloat *restrict dst, ALsizei dstlen); diff --git a/Alc/mixer_neon.c b/Alc/mixer_neon.c index 533817ff..543ff0f3 100644 --- a/Alc/mixer_neon.c +++ b/Alc/mixer_neon.c @@ -10,9 +10,9 @@ #include "mixer_defs.h" -const ALfloat *Resample_lerp32_Neon(const BsincState* UNUSED(state), const ALfloat *restrict src, - ALuint frac, ALint increment, ALfloat *restrict dst, - ALsizei numsamples) +const ALfloat *Resample_lerp32_Neon(const InterpState* UNUSED(state), + const ALfloat *restrict src, ALuint 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); @@ -66,9 +66,9 @@ const ALfloat *Resample_lerp32_Neon(const BsincState* UNUSED(state), const ALflo return dst; } -const ALfloat *Resample_fir4_32_Neon(const BsincState* UNUSED(state), const ALfloat *restrict src, - ALuint frac, ALint increment, ALfloat *restrict dst, - ALsizei numsamples) +const ALfloat *Resample_fir4_32_Neon(const InterpState* UNUSED(state), + const ALfloat *restrict src, ALuint 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); @@ -136,9 +136,9 @@ const ALfloat *Resample_fir4_32_Neon(const BsincState* UNUSED(state), const ALfl return dst; } -const ALfloat *Resample_fir8_32_Neon(const BsincState* UNUSED(state), const ALfloat *restrict src, - ALuint frac, ALint increment, ALfloat *restrict dst, - ALsizei numsamples) +const ALfloat *Resample_fir8_32_Neon(const InterpState* UNUSED(state), + const ALfloat *restrict src, ALuint 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); @@ -211,18 +211,18 @@ const ALfloat *Resample_fir8_32_Neon(const BsincState* UNUSED(state), const ALfl return dst; } -const ALfloat *Resample_bsinc32_Neon(const BsincState *state, const ALfloat *restrict src, - ALuint frac, ALint increment, ALfloat *restrict dst, - ALsizei dstlen) +const ALfloat *Resample_bsinc32_Neon(const InterpState *state, + const ALfloat *restrict src, ALuint frac, ALint increment, + ALfloat *restrict dst, ALsizei dstlen) { - const float32x4_t sf4 = vdupq_n_f32(state->sf); - const ALsizei m = state->m; + const float32x4_t sf4 = vdupq_n_f32(state->bsinc.sf); + const ALsizei m = state->bsinc.m; const ALfloat *fil, *scd, *phd, *spd; ALsizei pi, i, j; float32x4_t r4; ALfloat pf; - src += state->l; + src += state->bsinc.l; for(i = 0;i < dstlen;i++) { // Calculate the phase index and factor. @@ -231,10 +231,10 @@ const ALfloat *Resample_bsinc32_Neon(const BsincState *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->coeffs[pi].filter, 16); - scd = ASSUME_ALIGNED(state->coeffs[pi].scDelta, 16); - phd = ASSUME_ALIGNED(state->coeffs[pi].phDelta, 16); - spd = ASSUME_ALIGNED(state->coeffs[pi].spDelta, 16); + 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); // 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 8aeb8211..7870a6d8 100644 --- a/Alc/mixer_sse.c +++ b/Alc/mixer_sse.c @@ -12,18 +12,18 @@ #include "mixer_defs.h" -const ALfloat *Resample_bsinc32_SSE(const BsincState *state, const ALfloat *restrict src, +const ALfloat *Resample_bsinc32_SSE(const InterpState *state, const ALfloat *restrict src, ALuint frac, ALint increment, ALfloat *restrict dst, ALsizei dstlen) { - const __m128 sf4 = _mm_set1_ps(state->sf); - const ALsizei m = state->m; + const __m128 sf4 = _mm_set1_ps(state->bsinc.sf); + const ALsizei m = state->bsinc.m; const ALfloat *fil, *scd, *phd, *spd; ALsizei pi, i, j; ALfloat pf; __m128 r4; - src += state->l; + src += state->bsinc.l; for(i = 0;i < dstlen;i++) { // Calculate the phase index and factor. @@ -32,10 +32,10 @@ const ALfloat *Resample_bsinc32_SSE(const BsincState *state, const ALfloat *rest pf = (frac & ((1<<FRAC_PHASE_BITDIFF)-1)) * (1.0f/(1<<FRAC_PHASE_BITDIFF)); #undef FRAC_PHASE_BITDIFF - fil = ASSUME_ALIGNED(state->coeffs[pi].filter, 16); - scd = ASSUME_ALIGNED(state->coeffs[pi].scDelta, 16); - phd = ASSUME_ALIGNED(state->coeffs[pi].phDelta, 16); - spd = ASSUME_ALIGNED(state->coeffs[pi].spDelta, 16); + 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); // Apply the scale and phase interpolated filter. r4 = _mm_setzero_ps(); diff --git a/Alc/mixer_sse2.c b/Alc/mixer_sse2.c index 5cf4c8a0..a1e8507e 100644 --- a/Alc/mixer_sse2.c +++ b/Alc/mixer_sse2.c @@ -27,9 +27,9 @@ #include "mixer_defs.h" -const ALfloat *Resample_lerp32_SSE2(const BsincState* UNUSED(state), const ALfloat *restrict src, - ALuint frac, ALint increment, ALfloat *restrict dst, - ALsizei numsamples) +const ALfloat *Resample_lerp32_SSE2(const InterpState* UNUSED(state), + const ALfloat *restrict src, 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); diff --git a/Alc/mixer_sse3.c b/Alc/mixer_sse3.c index 34121d71..3b444158 100644 --- a/Alc/mixer_sse3.c +++ b/Alc/mixer_sse3.c @@ -31,9 +31,9 @@ #include "mixer_defs.h" -const ALfloat *Resample_fir4_32_SSE3(const BsincState* UNUSED(state), const ALfloat *restrict src, - ALuint frac, ALint increment, ALfloat *restrict dst, - ALsizei numsamples) +const ALfloat *Resample_fir4_32_SSE3(const InterpState* UNUSED(state), + const ALfloat *restrict src, ALuint frac, ALint increment, + ALfloat *restrict dst, ALsizei numsamples) { const __m128i increment4 = _mm_set1_epi32(increment*4); const __m128i fracMask4 = _mm_set1_epi32(FRACTIONMASK); @@ -96,9 +96,9 @@ const ALfloat *Resample_fir4_32_SSE3(const BsincState* UNUSED(state), const ALfl return dst; } -const ALfloat *Resample_fir8_32_SSE3(const BsincState* UNUSED(state), const ALfloat *restrict src, - ALuint frac, ALint increment, ALfloat *restrict dst, - ALsizei numsamples) +const ALfloat *Resample_fir8_32_SSE3(const InterpState* UNUSED(state), + const ALfloat *restrict src, ALuint frac, ALint increment, + ALfloat *restrict dst, ALsizei numsamples) { const __m128i increment4 = _mm_set1_epi32(increment*4); const __m128i fracMask4 = _mm_set1_epi32(FRACTIONMASK); diff --git a/Alc/mixer_sse41.c b/Alc/mixer_sse41.c index a531ca77..7ae5bec7 100644 --- a/Alc/mixer_sse41.c +++ b/Alc/mixer_sse41.c @@ -28,9 +28,9 @@ #include "mixer_defs.h" -const ALfloat *Resample_lerp32_SSE41(const BsincState* UNUSED(state), const ALfloat *restrict src, - ALuint frac, ALint increment, ALfloat *restrict dst, - ALsizei numsamples) +const ALfloat *Resample_lerp32_SSE41(const InterpState* UNUSED(state), + const ALfloat *restrict src, 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); @@ -85,9 +85,9 @@ const ALfloat *Resample_lerp32_SSE41(const BsincState* UNUSED(state), const ALfl return dst; } -const ALfloat *Resample_fir4_32_SSE41(const BsincState* UNUSED(state), const ALfloat *restrict src, - ALuint frac, ALint increment, ALfloat *restrict dst, - ALsizei numsamples) +const ALfloat *Resample_fir4_32_SSE41(const InterpState* UNUSED(state), + const ALfloat *restrict src, ALuint frac, ALint increment, + ALfloat *restrict dst, ALsizei numsamples) { const __m128i increment4 = _mm_set1_epi32(increment*4); const __m128i fracMask4 = _mm_set1_epi32(FRACTIONMASK); @@ -153,9 +153,9 @@ const ALfloat *Resample_fir4_32_SSE41(const BsincState* UNUSED(state), const ALf return dst; } -const ALfloat *Resample_fir8_32_SSE41(const BsincState* UNUSED(state), const ALfloat *restrict src, - ALuint frac, ALint increment, ALfloat *restrict dst, - ALsizei numsamples) +const ALfloat *Resample_fir8_32_SSE41(const InterpState* UNUSED(state), + const ALfloat *restrict src, ALuint frac, ALint increment, + ALfloat *restrict dst, ALsizei numsamples) { const __m128i increment4 = _mm_set1_epi32(increment*4); const __m128i fracMask4 = _mm_set1_epi32(FRACTIONMASK); |