diff options
author | Chris Robinson <[email protected]> | 2021-02-16 05:49:09 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2021-02-16 05:49:09 -0800 |
commit | 8fd83778b8e5108f2bfd3157d7d1dccfc13bd272 (patch) | |
tree | 8c0beff7e27c124ac3672a78ccb8e1736cb832f0 /core/mixer | |
parent | 9665171ea3e8d4dbfe0270894ccad92cca6e18f8 (diff) |
Add some optimization hints
Diffstat (limited to 'core/mixer')
-rw-r--r-- | core/mixer/mixer_c.cpp | 14 | ||||
-rw-r--r-- | core/mixer/mixer_neon.cpp | 14 | ||||
-rw-r--r-- | core/mixer/mixer_sse.cpp | 14 |
3 files changed, 24 insertions, 18 deletions
diff --git a/core/mixer/mixer_c.cpp b/core/mixer/mixer_c.cpp index 6b9c4344..8c2c60c5 100644 --- a/core/mixer/mixer_c.cpp +++ b/core/mixer/mixer_c.cpp @@ -32,15 +32,16 @@ inline float do_cubic(const InterpState&, const float *RESTRICT vals, const uint inline float do_bsinc(const InterpState &istate, const float *RESTRICT vals, const uint frac) { const size_t m{istate.bsinc.m}; + ASSUME(m > 0); // Calculate the phase index and factor. const uint pi{frac >> FracPhaseBitDiff}; const float pf{static_cast<float>(frac & (FracPhaseDiffOne-1)) * (1.0f/FracPhaseDiffOne)}; - const float *fil{istate.bsinc.filter + m*pi*4}; - const float *phd{fil + m}; - const float *scd{phd + m}; - const float *spd{scd + m}; + const float *RESTRICT fil{istate.bsinc.filter + m*pi*4}; + const float *RESTRICT phd{fil + m}; + const float *RESTRICT scd{phd + m}; + const float *RESTRICT spd{scd + m}; // Apply the scale and phase interpolated filter. float r{0.0f}; @@ -51,13 +52,14 @@ inline float do_bsinc(const InterpState &istate, const float *RESTRICT vals, con inline float do_fastbsinc(const InterpState &istate, const float *RESTRICT vals, const uint frac) { const size_t m{istate.bsinc.m}; + ASSUME(m > 0); // Calculate the phase index and factor. const uint pi{frac >> FracPhaseBitDiff}; const float pf{static_cast<float>(frac & (FracPhaseDiffOne-1)) * (1.0f/FracPhaseDiffOne)}; - const float *fil{istate.bsinc.filter + m*pi*4}; - const float *phd{fil + m}; + const float *RESTRICT fil{istate.bsinc.filter + m*pi*4}; + const float *RESTRICT phd{fil + m}; // Apply the phase interpolated filter. float r{0.0f}; diff --git a/core/mixer/mixer_neon.cpp b/core/mixer/mixer_neon.cpp index 220d412e..8cd7e610 100644 --- a/core/mixer/mixer_neon.cpp +++ b/core/mixer/mixer_neon.cpp @@ -118,6 +118,7 @@ float *Resample_<BSincTag,NEONTag>(const InterpState *state, float *RESTRICT src const float *const filter{state->bsinc.filter}; const float32x4_t sf4{vdupq_n_f32(state->bsinc.sf)}; const size_t m{state->bsinc.m}; + ASSUME(m > 0); src -= state->bsinc.l; for(float &out_sample : dst) @@ -130,10 +131,10 @@ float *Resample_<BSincTag,NEONTag>(const InterpState *state, float *RESTRICT src float32x4_t r4{vdupq_n_f32(0.0f)}; { const float32x4_t pf4{vdupq_n_f32(pf)}; - const float *fil{filter + m*pi*4}; - const float *phd{fil + m}; - const float *scd{phd + m}; - const float *spd{scd + m}; + const float *RESTRICT fil{filter + m*pi*4}; + const float *RESTRICT phd{fil + m}; + const float *RESTRICT scd{phd + m}; + const float *RESTRICT spd{scd + m}; size_t td{m >> 2}; size_t j{0u}; @@ -163,6 +164,7 @@ float *Resample_<FastBSincTag,NEONTag>(const InterpState *state, float *RESTRICT { const float *const filter{state->bsinc.filter}; const size_t m{state->bsinc.m}; + ASSUME(m > 0); src -= state->bsinc.l; for(float &out_sample : dst) @@ -175,8 +177,8 @@ float *Resample_<FastBSincTag,NEONTag>(const InterpState *state, float *RESTRICT float32x4_t r4{vdupq_n_f32(0.0f)}; { const float32x4_t pf4{vdupq_n_f32(pf)}; - const float *fil{filter + m*pi*4}; - const float *phd{fil + m}; + const float *RESTRICT fil{filter + m*pi*4}; + const float *RESTRICT phd{fil + m}; size_t td{m >> 2}; size_t j{0u}; diff --git a/core/mixer/mixer_sse.cpp b/core/mixer/mixer_sse.cpp index 8c748a57..ba53d0a5 100644 --- a/core/mixer/mixer_sse.cpp +++ b/core/mixer/mixer_sse.cpp @@ -83,6 +83,7 @@ float *Resample_<BSincTag,SSETag>(const InterpState *state, float *RESTRICT src, const float *const filter{state->bsinc.filter}; const __m128 sf4{_mm_set1_ps(state->bsinc.sf)}; const size_t m{state->bsinc.m}; + ASSUME(m > 0); src -= state->bsinc.l; for(float &out_sample : dst) @@ -95,10 +96,10 @@ float *Resample_<BSincTag,SSETag>(const InterpState *state, float *RESTRICT src, __m128 r4{_mm_setzero_ps()}; { const __m128 pf4{_mm_set1_ps(pf)}; - const float *fil{filter + m*pi*4}; - const float *phd{fil + m}; - const float *scd{phd + m}; - const float *spd{scd + m}; + const float *RESTRICT fil{filter + m*pi*4}; + const float *RESTRICT phd{fil + m}; + const float *RESTRICT scd{phd + m}; + const float *RESTRICT spd{scd + m}; size_t td{m >> 2}; size_t j{0u}; @@ -129,6 +130,7 @@ float *Resample_<FastBSincTag,SSETag>(const InterpState *state, float *RESTRICT { const float *const filter{state->bsinc.filter}; const size_t m{state->bsinc.m}; + ASSUME(m > 0); src -= state->bsinc.l; for(float &out_sample : dst) @@ -141,8 +143,8 @@ float *Resample_<FastBSincTag,SSETag>(const InterpState *state, float *RESTRICT __m128 r4{_mm_setzero_ps()}; { const __m128 pf4{_mm_set1_ps(pf)}; - const float *fil{filter + m*pi*4}; - const float *phd{fil + m}; + const float *RESTRICT fil{filter + m*pi*4}; + const float *RESTRICT phd{fil + m}; size_t td{m >> 2}; size_t j{0u}; |