Use template declarations for the normal mixing functions
This commit is contained in:
+4
-15
@@ -29,6 +29,10 @@ struct BSincTag { };
|
||||
template<typename TypeTag, typename InstTag>
|
||||
const ALfloat *Resample_(const InterpState *state, const ALfloat *RESTRICT src, ALsizei frac, ALint increment, ALfloat *RESTRICT dst, ALsizei dstlen);
|
||||
|
||||
template<typename InstTag>
|
||||
void Mix_(const ALfloat *data, const ALsizei OutChans, ALfloat (*OutBuffer)[BUFFERSIZE], ALfloat *CurrentGains, const ALfloat *TargetGains, const ALsizei Counter, const ALsizei OutPos, const ALsizei BufferSize);
|
||||
template<typename InstTag>
|
||||
void MixRow_(ALfloat *OutBuffer, const ALfloat *Gains, const ALfloat (*data)[BUFFERSIZE], const ALsizei InChans, const ALsizei InPos, const ALsizei BufferSize);
|
||||
|
||||
/* C mixers */
|
||||
void MixHrtf_C(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
|
||||
@@ -43,11 +47,6 @@ void MixHrtfBlend_C(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
|
||||
void MixDirectHrtf_C(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
|
||||
const ALfloat (*data)[BUFFERSIZE], DirectHrtfState *State,
|
||||
const ALsizei NumChans, const ALsizei BufferSize);
|
||||
void Mix_C(const ALfloat *data, const ALsizei OutChans, ALfloat (*OutBuffer)[BUFFERSIZE],
|
||||
ALfloat *CurrentGains, const ALfloat *TargetGains, const ALsizei Counter,
|
||||
const ALsizei OutPos, const ALsizei BufferSize);
|
||||
void MixRow_C(ALfloat *OutBuffer, const ALfloat *Gains, const ALfloat (*data)[BUFFERSIZE],
|
||||
const ALsizei InChans, const ALsizei InPos, const ALsizei BufferSize);
|
||||
|
||||
/* SSE mixers */
|
||||
void MixHrtf_SSE(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
|
||||
@@ -62,11 +61,6 @@ void MixHrtfBlend_SSE(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
|
||||
void MixDirectHrtf_SSE(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
|
||||
const ALfloat (*data)[BUFFERSIZE], DirectHrtfState *State,
|
||||
const ALsizei NumChans, const ALsizei BufferSize);
|
||||
void Mix_SSE(const ALfloat *data, const ALsizei OutChans, ALfloat (*OutBuffer)[BUFFERSIZE],
|
||||
ALfloat *CurrentGains, const ALfloat *TargetGains, const ALsizei Counter,
|
||||
const ALsizei OutPos, const ALsizei BufferSize);
|
||||
void MixRow_SSE(ALfloat *OutBuffer, const ALfloat *Gains, const ALfloat (*data)[BUFFERSIZE],
|
||||
const ALsizei InChans, const ALsizei InPos, const ALsizei BufferSize);
|
||||
|
||||
/* Vectorized resampler helpers */
|
||||
inline void InitiatePositionArrays(ALsizei frac, ALint increment, ALsizei *RESTRICT frac_arr, ALsizei *RESTRICT pos_arr, ALsizei size)
|
||||
@@ -94,10 +88,5 @@ void MixHrtfBlend_Neon(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
|
||||
void MixDirectHrtf_Neon(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
|
||||
const ALfloat (*data)[BUFFERSIZE], DirectHrtfState *State,
|
||||
const ALsizei NumChans, const ALsizei BufferSize);
|
||||
void Mix_Neon(const ALfloat *data, const ALsizei OutChans, ALfloat (*OutBuffer)[BUFFERSIZE],
|
||||
ALfloat *CurrentGains, const ALfloat *TargetGains, const ALsizei Counter,
|
||||
const ALsizei OutPos, const ALsizei BufferSize);
|
||||
void MixRow_Neon(ALfloat *OutBuffer, const ALfloat *Gains, const ALfloat (*data)[BUFFERSIZE],
|
||||
const ALsizei InChans, const ALsizei InPos, const ALsizei BufferSize);
|
||||
|
||||
#endif /* MIXER_DEFS_H */
|
||||
|
||||
@@ -131,9 +131,10 @@ static inline void ApplyCoeffs(ALsizei Offset, ALfloat (&Values)[HRIR_LENGTH][2]
|
||||
#include "hrtf_inc.cpp"
|
||||
|
||||
|
||||
void Mix_C(const ALfloat *data, const ALsizei OutChans, ALfloat (*OutBuffer)[BUFFERSIZE],
|
||||
ALfloat *CurrentGains, const ALfloat *TargetGains, const ALsizei Counter,
|
||||
const ALsizei OutPos, const ALsizei BufferSize)
|
||||
template<>
|
||||
void Mix_<CTag>(const ALfloat *data, const ALsizei OutChans, ALfloat (*OutBuffer)[BUFFERSIZE],
|
||||
ALfloat *CurrentGains, const ALfloat *TargetGains, const ALsizei Counter, const ALsizei OutPos,
|
||||
const ALsizei BufferSize)
|
||||
{
|
||||
ASSUME(OutChans > 0);
|
||||
ASSUME(BufferSize > 0);
|
||||
@@ -176,8 +177,9 @@ void Mix_C(const ALfloat *data, const ALsizei OutChans, ALfloat (*OutBuffer)[BUF
|
||||
* transform. And as the matrices are more or less static once set up, no
|
||||
* stepping is necessary.
|
||||
*/
|
||||
void MixRow_C(ALfloat *OutBuffer, const ALfloat *Gains, const ALfloat (*data)[BUFFERSIZE],
|
||||
const ALsizei InChans, const ALsizei InPos, const ALsizei BufferSize)
|
||||
template<>
|
||||
void MixRow_<CTag>(ALfloat *OutBuffer, const ALfloat *Gains, const ALfloat (*data)[BUFFERSIZE],
|
||||
const ALsizei InChans, const ALsizei InPos, const ALsizei BufferSize)
|
||||
{
|
||||
ASSUME(InChans > 0);
|
||||
ASSUME(BufferSize > 0);
|
||||
|
||||
@@ -170,9 +170,10 @@ static inline void ApplyCoeffs(ALsizei Offset, ALfloat (&Values)[HRIR_LENGTH][2]
|
||||
#include "hrtf_inc.cpp"
|
||||
|
||||
|
||||
void Mix_Neon(const ALfloat *data, const ALsizei OutChans, ALfloat (*OutBuffer)[BUFFERSIZE],
|
||||
ALfloat *CurrentGains, const ALfloat *TargetGains, const ALsizei Counter,
|
||||
const ALsizei OutPos, const ALsizei BufferSize)
|
||||
template<>
|
||||
void Mix_<NEONTag>(const ALfloat *data, const ALsizei OutChans, ALfloat (*OutBuffer)[BUFFERSIZE],
|
||||
ALfloat *CurrentGains, const ALfloat *TargetGains, const ALsizei Counter, const ALsizei OutPos,
|
||||
const ALsizei BufferSize)
|
||||
{
|
||||
ASSUME(OutChans > 0);
|
||||
ASSUME(BufferSize > 0);
|
||||
@@ -255,8 +256,9 @@ void Mix_Neon(const ALfloat *data, const ALsizei OutChans, ALfloat (*OutBuffer)[
|
||||
}
|
||||
}
|
||||
|
||||
void MixRow_Neon(ALfloat *OutBuffer, const ALfloat *Gains, const ALfloat (*data)[BUFFERSIZE],
|
||||
const ALsizei InChans, const ALsizei InPos, const ALsizei BufferSize)
|
||||
template<>
|
||||
void MixRow_<NEONTag>(ALfloat *OutBuffer, const ALfloat *Gains, const ALfloat (*data)[BUFFERSIZE],
|
||||
const ALsizei InChans, const ALsizei InPos, const ALsizei BufferSize)
|
||||
{
|
||||
ASSUME(InChans > 0);
|
||||
ASSUME(BufferSize > 0);
|
||||
|
||||
@@ -149,9 +149,10 @@ static inline void ApplyCoeffs(ALsizei Offset, ALfloat (&Values)[HRIR_LENGTH][2]
|
||||
#include "hrtf_inc.cpp"
|
||||
|
||||
|
||||
void Mix_SSE(const ALfloat *data, const ALsizei OutChans, ALfloat (*OutBuffer)[BUFFERSIZE],
|
||||
ALfloat *CurrentGains, const ALfloat *TargetGains, const ALsizei Counter,
|
||||
const ALsizei OutPos, const ALsizei BufferSize)
|
||||
template<>
|
||||
void Mix_<SSETag>(const ALfloat *data, const ALsizei OutChans, ALfloat (*OutBuffer)[BUFFERSIZE],
|
||||
ALfloat *CurrentGains, const ALfloat *TargetGains, const ALsizei Counter, const ALsizei OutPos,
|
||||
const ALsizei BufferSize)
|
||||
{
|
||||
ASSUME(OutChans > 0);
|
||||
ASSUME(BufferSize > 0);
|
||||
@@ -231,8 +232,9 @@ void Mix_SSE(const ALfloat *data, const ALsizei OutChans, ALfloat (*OutBuffer)[B
|
||||
}
|
||||
}
|
||||
|
||||
void MixRow_SSE(ALfloat *OutBuffer, const ALfloat *Gains, const ALfloat (*data)[BUFFERSIZE],
|
||||
const ALsizei InChans, const ALsizei InPos, const ALsizei BufferSize)
|
||||
template<>
|
||||
void MixRow_<SSETag>(ALfloat *OutBuffer, const ALfloat *Gains, const ALfloat (*data)[BUFFERSIZE],
|
||||
const ALsizei InChans, const ALsizei InPos, const ALsizei BufferSize)
|
||||
{
|
||||
ASSUME(InChans > 0);
|
||||
ASSUME(BufferSize > 0);
|
||||
|
||||
+8
-8
@@ -56,8 +56,8 @@ static_assert(MAX_RESAMPLE_PADDING >= 24, "MAX_RESAMPLE_PADDING must be at least
|
||||
|
||||
Resampler ResamplerDefault = LinearResampler;
|
||||
|
||||
MixerFunc MixSamples = Mix_C;
|
||||
RowMixerFunc MixRowSamples = MixRow_C;
|
||||
MixerFunc MixSamples = Mix_<CTag>;
|
||||
RowMixerFunc MixRowSamples = MixRow_<CTag>;
|
||||
static HrtfMixerFunc MixHrtfSamples = MixHrtf_C;
|
||||
static HrtfMixerBlendFunc MixHrtfBlendSamples = MixHrtfBlend_C;
|
||||
|
||||
@@ -65,26 +65,26 @@ static MixerFunc SelectMixer()
|
||||
{
|
||||
#ifdef HAVE_NEON
|
||||
if((CPUCapFlags&CPU_CAP_NEON))
|
||||
return Mix_Neon;
|
||||
return Mix_<NEONTag>;
|
||||
#endif
|
||||
#ifdef HAVE_SSE
|
||||
if((CPUCapFlags&CPU_CAP_SSE))
|
||||
return Mix_SSE;
|
||||
return Mix_<SSETag>;
|
||||
#endif
|
||||
return Mix_C;
|
||||
return Mix_<CTag>;
|
||||
}
|
||||
|
||||
static RowMixerFunc SelectRowMixer()
|
||||
{
|
||||
#ifdef HAVE_NEON
|
||||
if((CPUCapFlags&CPU_CAP_NEON))
|
||||
return MixRow_Neon;
|
||||
return MixRow_<NEONTag>;
|
||||
#endif
|
||||
#ifdef HAVE_SSE
|
||||
if((CPUCapFlags&CPU_CAP_SSE))
|
||||
return MixRow_SSE;
|
||||
return MixRow_<SSETag>;
|
||||
#endif
|
||||
return MixRow_C;
|
||||
return MixRow_<CTag>;
|
||||
}
|
||||
|
||||
static inline HrtfMixerFunc SelectHrtfMixer()
|
||||
|
||||
Reference in New Issue
Block a user