diff options
Diffstat (limited to 'alc/mixer')
-rw-r--r-- | alc/mixer/mixer_c.cpp | 12 | ||||
-rw-r--r-- | alc/mixer/mixer_neon.cpp | 14 | ||||
-rw-r--r-- | alc/mixer/mixer_sse.cpp | 14 |
3 files changed, 18 insertions, 22 deletions
diff --git a/alc/mixer/mixer_c.cpp b/alc/mixer/mixer_c.cpp index b665b0a5..af8ff3b1 100644 --- a/alc/mixer/mixer_c.cpp +++ b/alc/mixer/mixer_c.cpp @@ -21,8 +21,8 @@ struct FastBSincTag; namespace { -#define FRAC_PHASE_BITDIFF (FRACTIONBITS - BSINC_PHASE_BITS) -#define FRAC_PHASE_DIFFONE (1<<FRAC_PHASE_BITDIFF) +constexpr ALuint FracPhaseBitDiff{FRACTIONBITS - BSincPhaseBits}; +constexpr ALuint FracPhaseDiffOne{1 << FracPhaseBitDiff}; inline float do_point(const InterpState&, const float *RESTRICT vals, const ALuint) { return vals[0]; } @@ -35,8 +35,8 @@ inline float do_bsinc(const InterpState &istate, const float *RESTRICT vals, con const size_t m{istate.bsinc.m}; // Calculate the phase index and factor. - const ALuint pi{frac >> FRAC_PHASE_BITDIFF}; - const float pf{static_cast<float>(frac & (FRAC_PHASE_DIFFONE-1)) * (1.0f/FRAC_PHASE_DIFFONE)}; + const ALuint 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}; @@ -54,8 +54,8 @@ inline float do_fastbsinc(const InterpState &istate, const float *RESTRICT vals, const size_t m{istate.bsinc.m}; // Calculate the phase index and factor. - const ALuint pi{frac >> FRAC_PHASE_BITDIFF}; - const float pf{static_cast<float>(frac & (FRAC_PHASE_DIFFONE-1)) * (1.0f/FRAC_PHASE_DIFFONE)}; + const ALuint 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}; diff --git a/alc/mixer/mixer_neon.cpp b/alc/mixer/mixer_neon.cpp index 9d21b1c5..2573e791 100644 --- a/alc/mixer/mixer_neon.cpp +++ b/alc/mixer/mixer_neon.cpp @@ -21,8 +21,8 @@ struct FastBSincTag; namespace { -#define FRAC_PHASE_BITDIFF (FRACTIONBITS - BSINC_PHASE_BITS) -#define FRAC_PHASE_DIFFONE (1<<FRAC_PHASE_BITDIFF) +constexpr ALuint FracPhaseBitDiff{FRACTIONBITS - BSincPhaseBits}; +constexpr ALuint FracPhaseDiffOne{1 << FracPhaseBitDiff}; inline void ApplyCoeffs(float2 *RESTRICT Values, const uint_fast32_t IrSize, const HrirArray &Coeffs, const float left, const float right) @@ -114,9 +114,8 @@ const float *Resample_<BSincTag,NEONTag>(const InterpState *state, const float * for(float &out_sample : dst) { // Calculate the phase index and factor. - const ALuint pi{frac >> FRAC_PHASE_BITDIFF}; - const float pf{static_cast<float>(frac & (FRAC_PHASE_DIFFONE-1)) * - (1.0f/FRAC_PHASE_DIFFONE)}; + const ALuint pi{frac >> FracPhaseBitDiff}; + const float pf{static_cast<float>(frac & (FracPhaseDiffOne-1)) * (1.0f/FracPhaseDiffOne)}; // Apply the scale and phase interpolated filter. float32x4_t r4{vdupq_n_f32(0.0f)}; @@ -160,9 +159,8 @@ const float *Resample_<FastBSincTag,NEONTag>(const InterpState *state, for(float &out_sample : dst) { // Calculate the phase index and factor. - const ALuint pi{frac >> FRAC_PHASE_BITDIFF}; - const float pf{static_cast<float>(frac & (FRAC_PHASE_DIFFONE-1)) * - (1.0f/FRAC_PHASE_DIFFONE)}; + const ALuint pi{frac >> FracPhaseBitDiff}; + const float pf{static_cast<float>(frac & (FracPhaseDiffOne-1)) * (1.0f/FracPhaseDiffOne)}; // Apply the phase interpolated filter. float32x4_t r4{vdupq_n_f32(0.0f)}; diff --git a/alc/mixer/mixer_sse.cpp b/alc/mixer/mixer_sse.cpp index d2e021ff..85cddcae 100644 --- a/alc/mixer/mixer_sse.cpp +++ b/alc/mixer/mixer_sse.cpp @@ -20,8 +20,8 @@ struct FastBSincTag; namespace { -#define FRAC_PHASE_BITDIFF (FRACTIONBITS - BSINC_PHASE_BITS) -#define FRAC_PHASE_DIFFONE (1<<FRAC_PHASE_BITDIFF) +constexpr ALuint FracPhaseBitDiff{FRACTIONBITS - BSincPhaseBits}; +constexpr ALuint FracPhaseDiffOne{1 << FracPhaseBitDiff}; #define MLA4(x, y, z) _mm_add_ps(x, _mm_mul_ps(y, z)) @@ -86,9 +86,8 @@ const float *Resample_<BSincTag,SSETag>(const InterpState *state, const float *R for(float &out_sample : dst) { // Calculate the phase index and factor. - const ALuint pi{frac >> FRAC_PHASE_BITDIFF}; - const float pf{static_cast<float>(frac & (FRAC_PHASE_DIFFONE-1)) * - (1.0f/FRAC_PHASE_DIFFONE)}; + const ALuint pi{frac >> FracPhaseBitDiff}; + const float pf{static_cast<float>(frac & (FracPhaseDiffOne-1)) * (1.0f/FracPhaseDiffOne)}; // Apply the scale and phase interpolated filter. __m128 r4{_mm_setzero_ps()}; @@ -133,9 +132,8 @@ const float *Resample_<FastBSincTag,SSETag>(const InterpState *state, const floa for(float &out_sample : dst) { // Calculate the phase index and factor. - const ALuint pi{frac >> FRAC_PHASE_BITDIFF}; - const float pf{static_cast<float>(frac & (FRAC_PHASE_DIFFONE-1)) * - (1.0f/FRAC_PHASE_DIFFONE)}; + const ALuint pi{frac >> FracPhaseBitDiff}; + const float pf{static_cast<float>(frac & (FracPhaseDiffOne-1)) * (1.0f/FracPhaseDiffOne)}; // Apply the phase interpolated filter. __m128 r4{_mm_setzero_ps()}; |