diff options
author | Chris Robinson <[email protected]> | 2019-01-23 11:21:03 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-01-23 11:21:03 -0800 |
commit | d3842a632da8542ac0c8fbdff39dc3d4a25c1a16 (patch) | |
tree | 0ea1ff2d63f72c3fd70b90e177f77d77b86897b4 | |
parent | 23179d0bcdd27d2b5ab5ddf0e38b180e2d6969e6 (diff) |
Use template declarations for the normal mixing functions
-rw-r--r-- | Alc/mixer/defs.h | 19 | ||||
-rw-r--r-- | Alc/mixer/mixer_c.cpp | 12 | ||||
-rw-r--r-- | Alc/mixer/mixer_neon.cpp | 12 | ||||
-rw-r--r-- | Alc/mixer/mixer_sse.cpp | 12 | ||||
-rw-r--r-- | Alc/mixvoice.cpp | 16 |
5 files changed, 33 insertions, 38 deletions
diff --git a/Alc/mixer/defs.h b/Alc/mixer/defs.h index 4b1e0303..03955b59 100644 --- a/Alc/mixer/defs.h +++ b/Alc/mixer/defs.h @@ -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 */ diff --git a/Alc/mixer/mixer_c.cpp b/Alc/mixer/mixer_c.cpp index 5f9f45a2..6b1cc495 100644 --- a/Alc/mixer/mixer_c.cpp +++ b/Alc/mixer/mixer_c.cpp @@ -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); diff --git a/Alc/mixer/mixer_neon.cpp b/Alc/mixer/mixer_neon.cpp index d9eac59c..978ea8d3 100644 --- a/Alc/mixer/mixer_neon.cpp +++ b/Alc/mixer/mixer_neon.cpp @@ -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); diff --git a/Alc/mixer/mixer_sse.cpp b/Alc/mixer/mixer_sse.cpp index ec0fbfc5..adb0287d 100644 --- a/Alc/mixer/mixer_sse.cpp +++ b/Alc/mixer/mixer_sse.cpp @@ -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); diff --git a/Alc/mixvoice.cpp b/Alc/mixvoice.cpp index fd379cd0..35828ea3 100644 --- a/Alc/mixvoice.cpp +++ b/Alc/mixvoice.cpp @@ -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() |