From 9b64e5e0db2a778313bb873bb38f481ce40efe31 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 26 Sep 2019 19:24:29 -0700 Subject: Implement a "fast" bsinc path This takes advantage of the fact than when increment <= 1 (when not down- sampling), the scale factor is always 0. As a result, the scale and scale-phase deltas never contribute to the filtered output. Removing those multiply+add operations cuts half of the work done by the inner loop. Sounds that do need to down-sample (when played with a high pitch, or is 48khz on 44.1khz output, for example), still go through the normal bsinc process. --- alc/mixvoice.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'alc/mixvoice.cpp') diff --git a/alc/mixvoice.cpp b/alc/mixvoice.cpp index bfb3b663..58a08ce3 100644 --- a/alc/mixvoice.cpp +++ b/alc/mixvoice.cpp @@ -135,7 +135,7 @@ inline HrtfMixerBlendFunc SelectHrtfBlendMixer() } // namespace -ResamplerFunc SelectResampler(Resampler resampler) +ResamplerFunc SelectResampler(Resampler resampler, ALuint increment) { switch(resampler) { @@ -159,6 +159,18 @@ ResamplerFunc SelectResampler(Resampler resampler) return Resample_; case Resampler::BSinc12: case Resampler::BSinc24: + if(increment <= FRACTIONONE) + { +#ifdef HAVE_NEON + if((CPUCapFlags&CPU_CAP_NEON)) + return Resample_; +#endif +#ifdef HAVE_SSE + if((CPUCapFlags&CPU_CAP_SSE)) + return Resample_; +#endif + return Resample_; + } #ifdef HAVE_NEON if((CPUCapFlags&CPU_CAP_NEON)) return Resample_; -- cgit v1.2.3