Remove the sinc8 resampler option
Perf shows less than 1 percent CPU difference from the higher quality bsinc resampler, but uses almost twice as much memory (a 128KB lookup table).
This commit is contained in:
+14
-45
@@ -43,22 +43,21 @@ static_assert((INT_MAX>>FRACTIONBITS)/MAX_PITCH > BUFFERSIZE,
|
||||
|
||||
extern inline void InitiatePositionArrays(ALuint frac, ALint increment, ALuint *restrict frac_arr, ALint *restrict pos_arr, ALsizei size);
|
||||
|
||||
alignas(16) union ResamplerCoeffs ResampleCoeffs;
|
||||
alignas(16) ALfloat ResampleCoeffs_FIR4[FRACTIONONE][4];
|
||||
|
||||
|
||||
enum Resampler {
|
||||
PointResampler,
|
||||
LinearResampler,
|
||||
FIR4Resampler,
|
||||
FIR8Resampler,
|
||||
BSincResampler,
|
||||
|
||||
ResamplerDefault = LinearResampler
|
||||
};
|
||||
|
||||
/* FIR8 requires 3 extra samples before the current position, and 4 after. */
|
||||
static_assert(MAX_PRE_SAMPLES >= 3, "MAX_PRE_SAMPLES must be at least 3!");
|
||||
static_assert(MAX_POST_SAMPLES >= 4, "MAX_POST_SAMPLES must be at least 4!");
|
||||
/* BSinc requires up to 11 extra samples before the current position, and 12 after. */
|
||||
static_assert(MAX_PRE_SAMPLES >= 11, "MAX_PRE_SAMPLES must be at least 11!");
|
||||
static_assert(MAX_POST_SAMPLES >= 12, "MAX_POST_SAMPLES must be at least 12!");
|
||||
|
||||
|
||||
static MixerFunc MixSamples = Mix_C;
|
||||
@@ -140,20 +139,6 @@ static inline ResamplerFunc SelectResampler(enum Resampler resampler)
|
||||
return Resample_fir4_32_SSE3;
|
||||
#endif
|
||||
return Resample_fir4_32_C;
|
||||
case FIR8Resampler:
|
||||
#ifdef HAVE_NEON
|
||||
if((CPUCapFlags&CPU_CAP_NEON))
|
||||
return Resample_fir8_32_Neon;
|
||||
#endif
|
||||
#ifdef HAVE_SSE4_1
|
||||
if((CPUCapFlags&CPU_CAP_SSE4_1))
|
||||
return Resample_fir8_32_SSE41;
|
||||
#endif
|
||||
#ifdef HAVE_SSE3
|
||||
if((CPUCapFlags&CPU_CAP_SSE3))
|
||||
return Resample_fir8_32_SSE3;
|
||||
#endif
|
||||
return Resample_fir8_32_C;
|
||||
case BSincResampler:
|
||||
#ifdef HAVE_NEON
|
||||
if((CPUCapFlags&CPU_CAP_NEON))
|
||||
@@ -264,13 +249,11 @@ void aluInitMixer(void)
|
||||
resampler = LinearResampler;
|
||||
else if(strcasecmp(str, "sinc4") == 0)
|
||||
resampler = FIR4Resampler;
|
||||
else if(strcasecmp(str, "sinc8") == 0)
|
||||
resampler = FIR8Resampler;
|
||||
else if(strcasecmp(str, "bsinc") == 0)
|
||||
resampler = BSincResampler;
|
||||
else if(strcasecmp(str, "cubic") == 0)
|
||||
else if(strcasecmp(str, "cubic") == 0 || strcasecmp(str, "sinc8") == 0)
|
||||
{
|
||||
WARN("Resampler option \"cubic\" is deprecated, using sinc4\n");
|
||||
WARN("Resampler option \"%s\" is deprecated, using sinc4\n", str);
|
||||
resampler = FIR4Resampler;
|
||||
}
|
||||
else
|
||||
@@ -284,28 +267,14 @@ void aluInitMixer(void)
|
||||
}
|
||||
}
|
||||
|
||||
if(resampler == FIR8Resampler)
|
||||
for(i = 0;i < FRACTIONONE;i++)
|
||||
{
|
||||
ALdouble mu = (ALdouble)i / FRACTIONONE;
|
||||
ResampleCoeffs.FIR8[i][0] = SincKaiser(4.0, mu - -3.0);
|
||||
ResampleCoeffs.FIR8[i][1] = SincKaiser(4.0, mu - -2.0);
|
||||
ResampleCoeffs.FIR8[i][2] = SincKaiser(4.0, mu - -1.0);
|
||||
ResampleCoeffs.FIR8[i][3] = SincKaiser(4.0, mu - 0.0);
|
||||
ResampleCoeffs.FIR8[i][4] = SincKaiser(4.0, mu - 1.0);
|
||||
ResampleCoeffs.FIR8[i][5] = SincKaiser(4.0, mu - 2.0);
|
||||
ResampleCoeffs.FIR8[i][6] = SincKaiser(4.0, mu - 3.0);
|
||||
ResampleCoeffs.FIR8[i][7] = SincKaiser(4.0, mu - 4.0);
|
||||
}
|
||||
else if(resampler == FIR4Resampler)
|
||||
for(i = 0;i < FRACTIONONE;i++)
|
||||
{
|
||||
ALdouble mu = (ALdouble)i / FRACTIONONE;
|
||||
ResampleCoeffs.FIR4[i][0] = SincKaiser(2.0, mu - -1.0);
|
||||
ResampleCoeffs.FIR4[i][1] = SincKaiser(2.0, mu - 0.0);
|
||||
ResampleCoeffs.FIR4[i][2] = SincKaiser(2.0, mu - 1.0);
|
||||
ResampleCoeffs.FIR4[i][3] = SincKaiser(2.0, mu - 2.0);
|
||||
}
|
||||
for(i = 0;i < FRACTIONONE;i++)
|
||||
{
|
||||
ALdouble mu = (ALdouble)i / FRACTIONONE;
|
||||
ResampleCoeffs_FIR4[i][0] = SincKaiser(2.0, mu - -1.0);
|
||||
ResampleCoeffs_FIR4[i][1] = SincKaiser(2.0, mu - 0.0);
|
||||
ResampleCoeffs_FIR4[i][2] = SincKaiser(2.0, mu - 1.0);
|
||||
ResampleCoeffs_FIR4[i][3] = SincKaiser(2.0, mu - 2.0);
|
||||
}
|
||||
|
||||
MixHrtfSamples = SelectHrtfMixer();
|
||||
MixSamples = SelectMixer();
|
||||
|
||||
@@ -14,8 +14,6 @@ static inline ALfloat lerp32(const ALfloat *restrict vals, ALuint frac)
|
||||
{ return lerp(vals[0], vals[1], frac * (1.0f/FRACTIONONE)); }
|
||||
static inline ALfloat fir4_32(const ALfloat *restrict vals, ALuint frac)
|
||||
{ return resample_fir4(vals[-1], vals[0], vals[1], vals[2], frac); }
|
||||
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 InterpState* UNUSED(state),
|
||||
@@ -51,7 +49,6 @@ const ALfloat *Resample_##Sampler##_C(const InterpState* UNUSED(state), \
|
||||
DECL_TEMPLATE(point32)
|
||||
DECL_TEMPLATE(lerp32)
|
||||
DECL_TEMPLATE(fir4_32)
|
||||
DECL_TEMPLATE(fir8_32)
|
||||
|
||||
#undef DECL_TEMPLATE
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ const ALfloat *Resample_copy32_C(const InterpState *state, const ALfloat *restri
|
||||
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);
|
||||
|
||||
|
||||
@@ -81,13 +80,6 @@ const ALfloat *Resample_fir4_32_SSE41(const InterpState *state, const ALfloat *r
|
||||
ALuint frac, ALint increment, ALfloat *restrict dst,
|
||||
ALsizei numsamples);
|
||||
|
||||
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 InterpState *state, const ALfloat *restrict src,
|
||||
ALuint frac, ALint increment, ALfloat *restrict dst,
|
||||
ALsizei numsamples);
|
||||
|
||||
const ALfloat *Resample_bsinc32_SSE(const InterpState *state, const ALfloat *restrict src,
|
||||
ALuint frac, ALint increment, ALfloat *restrict dst,
|
||||
ALsizei dstlen);
|
||||
@@ -115,9 +107,6 @@ const ALfloat *Resample_lerp32_Neon(const InterpState *state, const ALfloat *res
|
||||
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 InterpState *state, const ALfloat *restrict src,
|
||||
ALuint frac, ALint increment, ALfloat *restrict dst,
|
||||
ALsizei numsamples);
|
||||
const ALfloat *Resample_bsinc32_Neon(const InterpState *state, const ALfloat *restrict src,
|
||||
ALuint frac, ALint increment, ALfloat *restrict dst,
|
||||
ALsizei dstlen);
|
||||
|
||||
+4
-79
@@ -90,10 +90,10 @@ const ALfloat *Resample_fir4_32_Neon(const InterpState* UNUSED(state),
|
||||
const float32x4_t val1 = vld1q_f32(&src[pos_[1]]);
|
||||
const float32x4_t val2 = vld1q_f32(&src[pos_[2]]);
|
||||
const float32x4_t val3 = vld1q_f32(&src[pos_[3]]);
|
||||
float32x4_t k0 = vld1q_f32(ResampleCoeffs.FIR4[frac_[0]]);
|
||||
float32x4_t k1 = vld1q_f32(ResampleCoeffs.FIR4[frac_[1]]);
|
||||
float32x4_t k2 = vld1q_f32(ResampleCoeffs.FIR4[frac_[2]]);
|
||||
float32x4_t k3 = vld1q_f32(ResampleCoeffs.FIR4[frac_[3]]);
|
||||
float32x4_t k0 = vld1q_f32(ResampleCoeffs_FIR4[frac_[0]]);
|
||||
float32x4_t k1 = vld1q_f32(ResampleCoeffs_FIR4[frac_[1]]);
|
||||
float32x4_t k2 = vld1q_f32(ResampleCoeffs_FIR4[frac_[2]]);
|
||||
float32x4_t k3 = vld1q_f32(ResampleCoeffs_FIR4[frac_[3]]);
|
||||
float32x4_t out;
|
||||
|
||||
k0 = vmulq_f32(k0, val0);
|
||||
@@ -136,81 +136,6 @@ const ALfloat *Resample_fir4_32_Neon(const InterpState* UNUSED(state),
|
||||
return dst;
|
||||
}
|
||||
|
||||
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);
|
||||
alignas(16) ALint pos_[4];
|
||||
alignas(16) ALuint frac_[4];
|
||||
int32x4_t pos4;
|
||||
uint32x4_t frac4;
|
||||
ALsizei i, j;
|
||||
|
||||
InitiatePositionArrays(frac, increment, frac_, pos_, 4);
|
||||
|
||||
frac4 = vld1q_u32(frac_);
|
||||
pos4 = vld1q_s32(pos_);
|
||||
|
||||
src -= 3;
|
||||
for(i = 0;numsamples-i > 3;i += 4)
|
||||
{
|
||||
float32x4_t out[2];
|
||||
for(j = 0;j < 8;j+=4)
|
||||
{
|
||||
const float32x4_t val0 = vld1q_f32(&src[pos_[0]+j]);
|
||||
const float32x4_t val1 = vld1q_f32(&src[pos_[1]+j]);
|
||||
const float32x4_t val2 = vld1q_f32(&src[pos_[2]+j]);
|
||||
const float32x4_t val3 = vld1q_f32(&src[pos_[3]+j]);
|
||||
float32x4_t k0 = vld1q_f32(&ResampleCoeffs.FIR4[frac_[0]][j]);
|
||||
float32x4_t k1 = vld1q_f32(&ResampleCoeffs.FIR4[frac_[1]][j]);
|
||||
float32x4_t k2 = vld1q_f32(&ResampleCoeffs.FIR4[frac_[2]][j]);
|
||||
float32x4_t k3 = vld1q_f32(&ResampleCoeffs.FIR4[frac_[3]][j]);
|
||||
|
||||
k0 = vmulq_f32(k0, val0);
|
||||
k1 = vmulq_f32(k1, val1);
|
||||
k2 = vmulq_f32(k2, val2);
|
||||
k3 = vmulq_f32(k3, val3);
|
||||
k0 = vcombine_f32(vpadd_f32(vget_low_f32(k0), vget_high_f32(k0)),
|
||||
vpadd_f32(vget_low_f32(k1), vget_high_f32(k1)));
|
||||
k2 = vcombine_f32(vpadd_f32(vget_low_f32(k2), vget_high_f32(k2)),
|
||||
vpadd_f32(vget_low_f32(k3), vget_high_f32(k3)));
|
||||
out[j>>2] = vcombine_f32(vpadd_f32(vget_low_f32(k0), vget_high_f32(k0)),
|
||||
vpadd_f32(vget_low_f32(k2), vget_high_f32(k2)));
|
||||
}
|
||||
|
||||
out[0] = vaddq_f32(out[0], out[1]);
|
||||
vst1q_f32(&dst[i], out[0]);
|
||||
|
||||
frac4 = vaddq_u32(frac4, (uint32x4_t)increment4);
|
||||
pos4 = vaddq_s32(pos4, (int32x4_t)vshrq_n_u32(frac4, FRACTIONBITS));
|
||||
frac4 = vandq_u32(frac4, fracMask4);
|
||||
|
||||
vst1q_s32(pos_, pos4);
|
||||
vst1q_u32(frac_, frac4);
|
||||
}
|
||||
|
||||
if(i < numsamples)
|
||||
{
|
||||
/* NOTE: These four elements represent the position *after* the last
|
||||
* four samples, so the lowest element is the next position to
|
||||
* resample.
|
||||
*/
|
||||
ALint pos = pos_[0];
|
||||
frac = frac_[0];
|
||||
do {
|
||||
dst[i] = resample_fir8(src[pos ], src[pos+1], src[pos+2], src[pos+3],
|
||||
src[pos+4], src[pos+5], src[pos+6], src[pos+7], frac);
|
||||
|
||||
frac += increment;
|
||||
pos += frac>>FRACTIONBITS;
|
||||
frac &= FRACTIONMASK;
|
||||
} while(++i < numsamples);
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
|
||||
const ALfloat *Resample_bsinc32_Neon(const InterpState *state,
|
||||
const ALfloat *restrict src, ALuint frac, ALint increment,
|
||||
ALfloat *restrict dst, ALsizei dstlen)
|
||||
|
||||
+4
-71
@@ -55,10 +55,10 @@ const ALfloat *Resample_fir4_32_SSE3(const InterpState* UNUSED(state),
|
||||
const __m128 val1 = _mm_loadu_ps(&src[pos_.i[1]]);
|
||||
const __m128 val2 = _mm_loadu_ps(&src[pos_.i[2]]);
|
||||
const __m128 val3 = _mm_loadu_ps(&src[pos_.i[3]]);
|
||||
__m128 k0 = _mm_load_ps(ResampleCoeffs.FIR4[frac_.i[0]]);
|
||||
__m128 k1 = _mm_load_ps(ResampleCoeffs.FIR4[frac_.i[1]]);
|
||||
__m128 k2 = _mm_load_ps(ResampleCoeffs.FIR4[frac_.i[2]]);
|
||||
__m128 k3 = _mm_load_ps(ResampleCoeffs.FIR4[frac_.i[3]]);
|
||||
__m128 k0 = _mm_load_ps(ResampleCoeffs_FIR4[frac_.i[0]]);
|
||||
__m128 k1 = _mm_load_ps(ResampleCoeffs_FIR4[frac_.i[1]]);
|
||||
__m128 k2 = _mm_load_ps(ResampleCoeffs_FIR4[frac_.i[2]]);
|
||||
__m128 k3 = _mm_load_ps(ResampleCoeffs_FIR4[frac_.i[3]]);
|
||||
__m128 out;
|
||||
|
||||
k0 = _mm_mul_ps(k0, val0);
|
||||
@@ -95,70 +95,3 @@ const ALfloat *Resample_fir4_32_SSE3(const InterpState* UNUSED(state),
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
|
||||
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);
|
||||
union { alignas(16) ALint i[4]; float f[4]; } pos_;
|
||||
union { alignas(16) ALuint i[4]; float f[4]; } frac_;
|
||||
__m128i frac4, pos4;
|
||||
ALsizei i, j;
|
||||
ALint pos;
|
||||
|
||||
InitiatePositionArrays(frac, increment, frac_.i, pos_.i, 4);
|
||||
|
||||
frac4 = _mm_castps_si128(_mm_load_ps(frac_.f));
|
||||
pos4 = _mm_castps_si128(_mm_load_ps(pos_.f));
|
||||
|
||||
src -= 3;
|
||||
for(i = 0;numsamples-i > 3;i += 4)
|
||||
{
|
||||
__m128 out[2];
|
||||
for(j = 0;j < 8;j+=4)
|
||||
{
|
||||
const __m128 val0 = _mm_loadu_ps(&src[pos_.i[0]+j]);
|
||||
const __m128 val1 = _mm_loadu_ps(&src[pos_.i[1]+j]);
|
||||
const __m128 val2 = _mm_loadu_ps(&src[pos_.i[2]+j]);
|
||||
const __m128 val3 = _mm_loadu_ps(&src[pos_.i[3]+j]);
|
||||
__m128 k0 = _mm_load_ps(&ResampleCoeffs.FIR8[frac_.i[0]][j]);
|
||||
__m128 k1 = _mm_load_ps(&ResampleCoeffs.FIR8[frac_.i[1]][j]);
|
||||
__m128 k2 = _mm_load_ps(&ResampleCoeffs.FIR8[frac_.i[2]][j]);
|
||||
__m128 k3 = _mm_load_ps(&ResampleCoeffs.FIR8[frac_.i[3]][j]);
|
||||
|
||||
k0 = _mm_mul_ps(k0, val0);
|
||||
k1 = _mm_mul_ps(k1, val1);
|
||||
k2 = _mm_mul_ps(k2, val2);
|
||||
k3 = _mm_mul_ps(k3, val3);
|
||||
k0 = _mm_hadd_ps(k0, k1);
|
||||
k2 = _mm_hadd_ps(k2, k3);
|
||||
out[j>>2] = _mm_hadd_ps(k0, k2);
|
||||
}
|
||||
|
||||
out[0] = _mm_add_ps(out[0], out[1]);
|
||||
_mm_store_ps(&dst[i], out[0]);
|
||||
|
||||
frac4 = _mm_add_epi32(frac4, increment4);
|
||||
pos4 = _mm_add_epi32(pos4, _mm_srli_epi32(frac4, FRACTIONBITS));
|
||||
frac4 = _mm_and_si128(frac4, fracMask4);
|
||||
|
||||
_mm_store_ps(pos_.f, _mm_castsi128_ps(pos4));
|
||||
_mm_store_ps(frac_.f, _mm_castsi128_ps(frac4));
|
||||
}
|
||||
|
||||
pos = pos_.i[0];
|
||||
frac = frac_.i[0];
|
||||
|
||||
for(;i < numsamples;i++)
|
||||
{
|
||||
dst[i] = resample_fir8(src[pos ], src[pos+1], src[pos+2], src[pos+3],
|
||||
src[pos+4], src[pos+5], src[pos+6], src[pos+7], frac);
|
||||
|
||||
frac += increment;
|
||||
pos += frac>>FRACTIONBITS;
|
||||
frac &= FRACTIONMASK;
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
|
||||
+4
-77
@@ -109,10 +109,10 @@ const ALfloat *Resample_fir4_32_SSE41(const InterpState* UNUSED(state),
|
||||
const __m128 val1 = _mm_loadu_ps(&src[pos_.i[1]]);
|
||||
const __m128 val2 = _mm_loadu_ps(&src[pos_.i[2]]);
|
||||
const __m128 val3 = _mm_loadu_ps(&src[pos_.i[3]]);
|
||||
__m128 k0 = _mm_load_ps(ResampleCoeffs.FIR4[frac_.i[0]]);
|
||||
__m128 k1 = _mm_load_ps(ResampleCoeffs.FIR4[frac_.i[1]]);
|
||||
__m128 k2 = _mm_load_ps(ResampleCoeffs.FIR4[frac_.i[2]]);
|
||||
__m128 k3 = _mm_load_ps(ResampleCoeffs.FIR4[frac_.i[3]]);
|
||||
__m128 k0 = _mm_load_ps(ResampleCoeffs_FIR4[frac_.i[0]]);
|
||||
__m128 k1 = _mm_load_ps(ResampleCoeffs_FIR4[frac_.i[1]]);
|
||||
__m128 k2 = _mm_load_ps(ResampleCoeffs_FIR4[frac_.i[2]]);
|
||||
__m128 k3 = _mm_load_ps(ResampleCoeffs_FIR4[frac_.i[3]]);
|
||||
__m128 out;
|
||||
|
||||
k0 = _mm_mul_ps(k0, val0);
|
||||
@@ -152,76 +152,3 @@ const ALfloat *Resample_fir4_32_SSE41(const InterpState* UNUSED(state),
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
|
||||
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);
|
||||
union { alignas(16) ALint i[4]; float f[4]; } pos_;
|
||||
union { alignas(16) ALuint i[4]; float f[4]; } frac_;
|
||||
__m128i frac4, pos4;
|
||||
ALsizei i, j;
|
||||
ALint pos;
|
||||
|
||||
InitiatePositionArrays(frac, increment, frac_.i, pos_.i, 4);
|
||||
|
||||
frac4 = _mm_castps_si128(_mm_load_ps(frac_.f));
|
||||
pos4 = _mm_castps_si128(_mm_load_ps(pos_.f));
|
||||
|
||||
src -= 3;
|
||||
for(i = 0;numsamples-i > 3;i += 4)
|
||||
{
|
||||
__m128 out[2];
|
||||
for(j = 0;j < 8;j+=4)
|
||||
{
|
||||
const __m128 val0 = _mm_loadu_ps(&src[pos_.i[0]+j]);
|
||||
const __m128 val1 = _mm_loadu_ps(&src[pos_.i[1]+j]);
|
||||
const __m128 val2 = _mm_loadu_ps(&src[pos_.i[2]+j]);
|
||||
const __m128 val3 = _mm_loadu_ps(&src[pos_.i[3]+j]);
|
||||
__m128 k0 = _mm_load_ps(&ResampleCoeffs.FIR8[frac_.i[0]][j]);
|
||||
__m128 k1 = _mm_load_ps(&ResampleCoeffs.FIR8[frac_.i[1]][j]);
|
||||
__m128 k2 = _mm_load_ps(&ResampleCoeffs.FIR8[frac_.i[2]][j]);
|
||||
__m128 k3 = _mm_load_ps(&ResampleCoeffs.FIR8[frac_.i[3]][j]);
|
||||
|
||||
k0 = _mm_mul_ps(k0, val0);
|
||||
k1 = _mm_mul_ps(k1, val1);
|
||||
k2 = _mm_mul_ps(k2, val2);
|
||||
k3 = _mm_mul_ps(k3, val3);
|
||||
k0 = _mm_hadd_ps(k0, k1);
|
||||
k2 = _mm_hadd_ps(k2, k3);
|
||||
out[j>>2] = _mm_hadd_ps(k0, k2);
|
||||
}
|
||||
|
||||
out[0] = _mm_add_ps(out[0], out[1]);
|
||||
_mm_store_ps(&dst[i], out[0]);
|
||||
|
||||
frac4 = _mm_add_epi32(frac4, increment4);
|
||||
pos4 = _mm_add_epi32(pos4, _mm_srli_epi32(frac4, FRACTIONBITS));
|
||||
frac4 = _mm_and_si128(frac4, fracMask4);
|
||||
|
||||
pos_.i[0] = _mm_extract_epi32(pos4, 0);
|
||||
pos_.i[1] = _mm_extract_epi32(pos4, 1);
|
||||
pos_.i[2] = _mm_extract_epi32(pos4, 2);
|
||||
pos_.i[3] = _mm_extract_epi32(pos4, 3);
|
||||
frac_.i[0] = _mm_extract_epi32(frac4, 0);
|
||||
frac_.i[1] = _mm_extract_epi32(frac4, 1);
|
||||
frac_.i[2] = _mm_extract_epi32(frac4, 2);
|
||||
frac_.i[3] = _mm_extract_epi32(frac4, 3);
|
||||
}
|
||||
|
||||
pos = pos_.i[0];
|
||||
frac = frac_.i[0];
|
||||
|
||||
for(;i < numsamples;i++)
|
||||
{
|
||||
dst[i] = resample_fir8(src[pos ], src[pos+1], src[pos+2], src[pos+3],
|
||||
src[pos+4], src[pos+5], src[pos+6], src[pos+7], frac);
|
||||
|
||||
frac += increment;
|
||||
pos += frac>>FRACTIONBITS;
|
||||
frac &= FRACTIONMASK;
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
|
||||
+2
-12
@@ -229,11 +229,7 @@ inline ALuint64 clampu64(ALuint64 val, ALuint64 min, ALuint64 max)
|
||||
{ return minu64(max, maxu64(min, val)); }
|
||||
|
||||
|
||||
union ResamplerCoeffs {
|
||||
ALfloat FIR4[FRACTIONONE][4];
|
||||
ALfloat FIR8[FRACTIONONE][8];
|
||||
};
|
||||
extern alignas(16) union ResamplerCoeffs ResampleCoeffs;
|
||||
extern alignas(16) ALfloat ResampleCoeffs_FIR4[FRACTIONONE][4];
|
||||
|
||||
extern alignas(16) const ALfloat bsincTab[18840];
|
||||
|
||||
@@ -244,15 +240,9 @@ inline ALfloat lerp(ALfloat val1, ALfloat val2, ALfloat mu)
|
||||
}
|
||||
inline ALfloat resample_fir4(ALfloat val0, ALfloat val1, ALfloat val2, ALfloat val3, ALuint frac)
|
||||
{
|
||||
const ALfloat *k = ResampleCoeffs.FIR4[frac];
|
||||
const ALfloat *k = ResampleCoeffs_FIR4[frac];
|
||||
return k[0]*val0 + k[1]*val1 + k[2]*val2 + k[3]*val3;
|
||||
}
|
||||
inline ALfloat resample_fir8(ALfloat val0, ALfloat val1, ALfloat val2, ALfloat val3, ALfloat val4, ALfloat val5, ALfloat val6, ALfloat val7, ALuint frac)
|
||||
{
|
||||
const ALfloat *k = ResampleCoeffs.FIR8[frac];
|
||||
return k[0]*val0 + k[1]*val1 + k[2]*val2 + k[3]*val3 +
|
||||
k[4]*val4 + k[5]*val5 + k[6]*val6 + k[7]*val7;
|
||||
}
|
||||
|
||||
|
||||
enum HrtfRequestMode {
|
||||
|
||||
@@ -101,7 +101,6 @@ static const struct NameValuePair {
|
||||
{ "Linear", "linear" },
|
||||
{ "Default (Linear)", "" },
|
||||
{ "4-Point Sinc", "sinc4" },
|
||||
{ "8-Point Sinc", "sinc8" },
|
||||
{ "Band-limited Sinc", "bsinc" },
|
||||
|
||||
{ "", "" }
|
||||
@@ -598,9 +597,10 @@ void MainWindow::loadConfig(const QString &fname)
|
||||
|
||||
QString resampler = settings.value("resampler").toString().trimmed();
|
||||
ui->resamplerSlider->setValue(0);
|
||||
/* The "cubic" resampler is no longer supported. It's been replaced by
|
||||
* "sinc4". */
|
||||
if(resampler == "cubic")
|
||||
/* The "cubic" and "sinc8" resamplers are no longer supported. Use "sinc4"
|
||||
* as a fallback.
|
||||
*/
|
||||
if(resampler == "cubic" || resampler == "sinc8")
|
||||
resampler = "sinc4";
|
||||
for(int i = 0;resamplerList[i].name[0];i++)
|
||||
{
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>564</width>
|
||||
<height>454</height>
|
||||
<height>460</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>564</width>
|
||||
<height>454</height>
|
||||
<height>460</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -131,8 +131,8 @@ to stereo output.</string>
|
||||
<rect>
|
||||
<x>380</x>
|
||||
<y>20</y>
|
||||
<width>96</width>
|
||||
<height>22</height>
|
||||
<width>91</width>
|
||||
<height>29</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
@@ -2075,8 +2075,8 @@ added by the ALC_EXT_DEDICATED extension.</string>
|
||||
<rect>
|
||||
<x>160</x>
|
||||
<y>20</y>
|
||||
<width>131</width>
|
||||
<height>22</height>
|
||||
<width>123</width>
|
||||
<height>29</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizeAdjustPolicy">
|
||||
@@ -2245,7 +2245,7 @@ added by the ALC_EXT_DEDICATED extension.</string>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>564</width>
|
||||
<height>19</height>
|
||||
<height>27</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
|
||||
Reference in New Issue
Block a user