Remove SSE resamplers. They aren't gaining us much this way.
This commit is contained in:
parent
52d403b0d1
commit
12327da4fe
@ -60,16 +60,8 @@ static ResamplerFunc SelectResampler(enum Resampler Resampler, ALuint increment)
|
||||
case PointResampler:
|
||||
return Resample_point32_C;
|
||||
case LinearResampler:
|
||||
#ifdef HAVE_SSE
|
||||
if((CPUCapFlags&CPU_CAP_SSE))
|
||||
return Resample_lerp32_SSE;
|
||||
#endif
|
||||
return Resample_lerp32_C;
|
||||
case CubicResampler:
|
||||
#ifdef HAVE_SSE
|
||||
if((CPUCapFlags&CPU_CAP_SSE))
|
||||
return Resample_cubic32_SSE;
|
||||
#endif
|
||||
return Resample_cubic32_C;
|
||||
case ResamplerMax:
|
||||
/* Shouldn't happen */
|
||||
|
@ -15,10 +15,6 @@ void Resample_point32_C(const ALfloat *src, ALuint frac, ALuint increment, ALuin
|
||||
void Resample_lerp32_C(const ALfloat *src, ALuint frac, ALuint increment, ALuint NumChannels, ALfloat *RESTRICT dst, ALuint dstlen);
|
||||
void Resample_cubic32_C(const ALfloat *src, ALuint frac, ALuint increment, ALuint NumChannels, ALfloat *RESTRICT dst, ALuint dstlen);
|
||||
|
||||
/* SSE resamplers */
|
||||
void Resample_lerp32_SSE(const ALfloat *src, ALuint frac, ALuint increment, ALuint NumChannels, ALfloat *RESTRICT dst, ALuint dstlen);
|
||||
void Resample_cubic32_SSE(const ALfloat *src, ALuint frac, ALuint increment, ALuint NumChannels, ALfloat *RESTRICT dst, ALuint dstlen);
|
||||
|
||||
|
||||
/* C mixers */
|
||||
void MixDirect_Hrtf_C(struct ALsource*,ALCdevice*,struct DirectParams*,const ALfloat*RESTRICT,ALuint,ALuint,ALuint,ALuint);
|
||||
|
@ -13,98 +13,6 @@
|
||||
#include "alAuxEffectSlot.h"
|
||||
#include "mixer_defs.h"
|
||||
|
||||
static __inline ALfloat lerp32(const ALfloat *vals, ALint step, ALuint frac)
|
||||
{ return lerp(vals[0], vals[step], frac * (1.0f/FRACTIONONE)); }
|
||||
|
||||
void Resample_lerp32_SSE(const ALfloat *data, ALuint frac,
|
||||
ALuint increment, ALuint NumChannels, ALfloat *RESTRICT OutBuffer,
|
||||
ALuint BufferSize)
|
||||
{
|
||||
ALIGN(16) float value[3][4];
|
||||
ALuint pos = 0;
|
||||
ALuint i, j;
|
||||
|
||||
for(i = 0;i < BufferSize+1-3;i+=4)
|
||||
{
|
||||
__m128 x, y, a;
|
||||
for(j = 0;j < 4;j++)
|
||||
{
|
||||
value[0][j] = data[(pos )*NumChannels];
|
||||
value[1][j] = data[(pos+1)*NumChannels];
|
||||
value[2][j] = frac * (1.0f/FRACTIONONE);
|
||||
|
||||
frac += increment;
|
||||
pos += frac>>FRACTIONBITS;
|
||||
frac &= FRACTIONMASK;
|
||||
}
|
||||
|
||||
x = _mm_load_ps(value[0]);
|
||||
y = _mm_load_ps(value[1]);
|
||||
y = _mm_sub_ps(y, x);
|
||||
|
||||
a = _mm_load_ps(value[2]);
|
||||
y = _mm_mul_ps(y, a);
|
||||
|
||||
x = _mm_add_ps(x, y);
|
||||
|
||||
_mm_store_ps(&OutBuffer[i], x);
|
||||
}
|
||||
for(;i < BufferSize+1;i++)
|
||||
{
|
||||
OutBuffer[i] = lerp32(data + pos*NumChannels, NumChannels, frac);
|
||||
|
||||
frac += increment;
|
||||
pos += frac>>FRACTIONBITS;
|
||||
frac &= FRACTIONMASK;
|
||||
}
|
||||
}
|
||||
|
||||
void Resample_cubic32_SSE(const ALfloat *data, ALuint frac,
|
||||
ALuint increment, ALuint channels, ALfloat *RESTRICT OutBuffer,
|
||||
ALuint BufferSize)
|
||||
{
|
||||
/* Cubic interpolation mainly consists of a matrix4 * vector4 operation,
|
||||
* followed by scalars being applied to the resulting elements before all
|
||||
* four are added together for the final sample. */
|
||||
static const __m128 matrix[4] = {
|
||||
{ -0.5f, 1.0f, -0.5f, 0.0f },
|
||||
{ 1.5f, -2.5f, 0.0f, 1.0f },
|
||||
{ -1.5f, 2.0f, 0.5f, 0.0f },
|
||||
{ 0.5f, -0.5f, 0.0f, 0.0f },
|
||||
};
|
||||
ALIGN(16) float value[4];
|
||||
ALuint pos = 0;
|
||||
ALuint i;
|
||||
|
||||
for(i = 0;i < BufferSize+1;i++)
|
||||
{
|
||||
__m128 res1, res2;
|
||||
ALfloat mu;
|
||||
|
||||
/* matrix * { samples } */
|
||||
res1 = _mm_add_ps(_mm_mul_ps(_mm_set1_ps(data[(pos-1)*channels]), matrix[0]),
|
||||
_mm_mul_ps(_mm_set1_ps(data[(pos )*channels]), matrix[1]));
|
||||
res2 = _mm_add_ps(_mm_mul_ps(_mm_set1_ps(data[(pos+1)*channels]), matrix[2]),
|
||||
_mm_mul_ps(_mm_set1_ps(data[(pos+2)*channels]), matrix[3]));
|
||||
res1 = _mm_add_ps(res1, res2);
|
||||
|
||||
/* res1 * { mu^3, mu^2, mu^1, mu^0 } */
|
||||
mu = frac * (1.0f/FRACTIONONE);
|
||||
value[0] = mu*mu*mu;
|
||||
value[1] = mu*mu;
|
||||
value[2] = mu;
|
||||
value[3] = 1.0f;
|
||||
res1 = _mm_mul_ps(res1, _mm_load_ps(value));
|
||||
|
||||
_mm_store_ps(value, res1);
|
||||
OutBuffer[i] = value[0] + value[1] + value[2] + value[3];
|
||||
|
||||
frac += increment;
|
||||
pos += frac>>FRACTIONBITS;
|
||||
frac &= FRACTIONMASK;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static __inline void ApplyCoeffsStep(ALuint Offset, ALfloat (*RESTRICT Values)[2],
|
||||
const ALuint IrSize,
|
||||
|
Loading…
Reference in New Issue
Block a user