aboutsummaryrefslogtreecommitdiffstats
path: root/alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2020-04-03 03:11:32 -0700
committerChris Robinson <[email protected]>2020-04-03 03:11:32 -0700
commitd9225083b4c7fe84d7a4bbde31801be4e51f6f61 (patch)
tree25e3e4546dd091add68ef2eb5e5d81adb536af08 /alc
parent236564b54ace15b940ca5e97f44e2e7e0a8f4846 (diff)
Avoid using ALfloat in the mixer functions
Diffstat (limited to 'alc')
-rw-r--r--alc/mixer/defs.h2
-rw-r--r--alc/mixer/mixer_c.cpp28
-rw-r--r--alc/mixer/mixer_neon.cpp32
-rw-r--r--alc/mixer/mixer_sse.cpp22
-rw-r--r--alc/mixer/mixer_sse2.cpp6
-rw-r--r--alc/mixer/mixer_sse41.cpp6
6 files changed, 48 insertions, 48 deletions
diff --git a/alc/mixer/defs.h b/alc/mixer/defs.h
index a3b49ad3..a624509a 100644
--- a/alc/mixer/defs.h
+++ b/alc/mixer/defs.h
@@ -30,7 +30,7 @@ enum ResampleType {
};
template<ResampleType TypeTag, InstSetType InstTag>
-const ALfloat *Resample_(const InterpState *state, const ALfloat *RESTRICT src, ALuint frac,
+const float *Resample_(const InterpState *state, const float *RESTRICT src, ALuint frac,
ALuint increment, const al::span<float> dst);
template<InstSetType InstTag>
diff --git a/alc/mixer/mixer_c.cpp b/alc/mixer/mixer_c.cpp
index d169ce79..d27186fd 100644
--- a/alc/mixer/mixer_c.cpp
+++ b/alc/mixer/mixer_c.cpp
@@ -90,8 +90,8 @@ inline void ApplyCoeffs(float2 *RESTRICT Values, const ALuint IrSize, const Hrir
} // namespace
template<>
-const ALfloat *Resample_<CopyTag,CTag>(const InterpState*, const ALfloat *RESTRICT src, ALuint,
- ALuint, const al::span<float> dst)
+const float *Resample_<CopyTag,CTag>(const InterpState*, const float *RESTRICT src, ALuint, ALuint,
+ const al::span<float> dst)
{
#if defined(HAVE_SSE) || defined(HAVE_NEON)
/* Avoid copying the source data if it's aligned like the destination. */
@@ -99,31 +99,31 @@ const ALfloat *Resample_<CopyTag,CTag>(const InterpState*, const ALfloat *RESTRI
return src;
#endif
std::copy_n(src, dst.size(), dst.begin());
- return dst.begin();
+ return dst.data();
}
template<>
-const ALfloat *Resample_<PointTag,CTag>(const InterpState *state, const ALfloat *RESTRICT src,
+const float *Resample_<PointTag,CTag>(const InterpState *state, const float *RESTRICT src,
ALuint frac, ALuint increment, const al::span<float> dst)
{ return DoResample<do_point>(state, src, frac, increment, dst); }
template<>
-const ALfloat *Resample_<LerpTag,CTag>(const InterpState *state, const ALfloat *RESTRICT src,
+const float *Resample_<LerpTag,CTag>(const InterpState *state, const float *RESTRICT src,
ALuint frac, ALuint increment, const al::span<float> dst)
{ return DoResample<do_lerp>(state, src, frac, increment, dst); }
template<>
-const ALfloat *Resample_<CubicTag,CTag>(const InterpState *state, const ALfloat *RESTRICT src,
+const float *Resample_<CubicTag,CTag>(const InterpState *state, const float *RESTRICT src,
ALuint frac, ALuint increment, const al::span<float> dst)
{ return DoResample<do_cubic>(state, src-1, frac, increment, dst); }
template<>
-const ALfloat *Resample_<BSincTag,CTag>(const InterpState *state, const ALfloat *RESTRICT src,
+const float *Resample_<BSincTag,CTag>(const InterpState *state, const float *RESTRICT src,
ALuint frac, ALuint increment, const al::span<float> dst)
{ return DoResample<do_bsinc>(state, src-state->bsinc.l, frac, increment, dst); }
template<>
-const ALfloat *Resample_<FastBSincTag,CTag>(const InterpState *state, const ALfloat *RESTRICT src,
+const float *Resample_<FastBSincTag,CTag>(const InterpState *state, const float *RESTRICT src,
ALuint frac, ALuint increment, const al::span<float> dst)
{ return DoResample<do_fastbsinc>(state, src-state->bsinc.l, frac, increment, dst); }
@@ -152,22 +152,22 @@ template<>
void Mix_<CTag>(const al::span<const float> InSamples, const al::span<FloatBufferLine> OutBuffer,
float *CurrentGains, const float *TargetGains, const size_t Counter, const size_t OutPos)
{
- const ALfloat delta{(Counter > 0) ? 1.0f / static_cast<ALfloat>(Counter) : 0.0f};
+ const float delta{(Counter > 0) ? 1.0f / static_cast<float>(Counter) : 0.0f};
const bool reached_target{InSamples.size() >= Counter};
const auto min_end = reached_target ? InSamples.begin() + Counter : InSamples.end();
for(FloatBufferLine &output : OutBuffer)
{
- ALfloat *RESTRICT dst{al::assume_aligned<16>(output.data()+OutPos)};
- ALfloat gain{*CurrentGains};
- const ALfloat diff{*TargetGains - gain};
+ float *RESTRICT dst{al::assume_aligned<16>(output.data()+OutPos)};
+ float gain{*CurrentGains};
+ const float diff{*TargetGains - gain};
auto in_iter = InSamples.begin();
if(!(std::fabs(diff) > std::numeric_limits<float>::epsilon()))
gain = *TargetGains;
else
{
- const ALfloat step{diff * delta};
- ALfloat step_count{0.0f};
+ const float step{diff * delta};
+ float step_count{0.0f};
while(in_iter != min_end)
{
*(dst++) += *(in_iter++) * (gain + step*step_count);
diff --git a/alc/mixer/mixer_neon.cpp b/alc/mixer/mixer_neon.cpp
index e44a3dbe..055715f3 100644
--- a/alc/mixer/mixer_neon.cpp
+++ b/alc/mixer/mixer_neon.cpp
@@ -45,8 +45,8 @@ inline void ApplyCoeffs(float2 *RESTRICT Values, const ALuint IrSize, const Hrir
} // namespace
template<>
-const ALfloat *Resample_<LerpTag,NEONTag>(const InterpState*, const ALfloat *RESTRICT src,
- ALuint frac, ALuint increment, const al::span<float> dst)
+const float *Resample_<LerpTag,NEONTag>(const InterpState*, const float *RESTRICT src, ALuint frac,
+ ALuint increment, const al::span<float> dst)
{
const int32x4_t increment4 = vdupq_n_s32(static_cast<int>(increment*4));
const float32x4_t fracOne4 = vdupq_n_f32(1.0f/FRACTIONONE);
@@ -95,11 +95,11 @@ const ALfloat *Resample_<LerpTag,NEONTag>(const InterpState*, const ALfloat *RES
frac &= FRACTIONMASK;
} while(dst_iter != dst.end());
}
- return dst.begin();
+ return dst.data();
}
template<>
-const ALfloat *Resample_<BSincTag,NEONTag>(const InterpState *state, const ALfloat *RESTRICT src,
+const float *Resample_<BSincTag,NEONTag>(const InterpState *state, const float *RESTRICT src,
ALuint frac, ALuint increment, const al::span<float> dst)
{
const float *const filter{state->bsinc.filter};
@@ -142,12 +142,12 @@ const ALfloat *Resample_<BSincTag,NEONTag>(const InterpState *state, const ALflo
src += frac>>FRACTIONBITS;
frac &= FRACTIONMASK;
}
- return dst.begin();
+ return dst.data();
}
template<>
-const ALfloat *Resample_<FastBSincTag,NEONTag>(const InterpState *state,
- const ALfloat *RESTRICT src, ALuint frac, ALuint increment, const al::span<float> dst)
+const float *Resample_<FastBSincTag,NEONTag>(const InterpState *state,
+ const float *RESTRICT src, ALuint frac, ALuint increment, const al::span<float> dst)
{
const float *const filter{state->bsinc.filter};
const size_t m{state->bsinc.m};
@@ -184,7 +184,7 @@ const ALfloat *Resample_<FastBSincTag,NEONTag>(const InterpState *state,
src += frac>>FRACTIONBITS;
frac &= FRACTIONMASK;
}
- return dst.begin();
+ return dst.data();
}
@@ -212,24 +212,24 @@ template<>
void Mix_<NEONTag>(const al::span<const float> InSamples, const al::span<FloatBufferLine> OutBuffer,
float *CurrentGains, const float *TargetGains, const size_t Counter, const size_t OutPos)
{
- const ALfloat delta{(Counter > 0) ? 1.0f / static_cast<ALfloat>(Counter) : 0.0f};
+ const float delta{(Counter > 0) ? 1.0f / static_cast<float>(Counter) : 0.0f};
const bool reached_target{InSamples.size() >= Counter};
const auto min_end = reached_target ? InSamples.begin() + Counter : InSamples.end();
const auto aligned_end = minz(static_cast<uintptr_t>(min_end-InSamples.begin()+3) & ~3u,
InSamples.size()) + InSamples.begin();
for(FloatBufferLine &output : OutBuffer)
{
- ALfloat *RESTRICT dst{al::assume_aligned<16>(output.data()+OutPos)};
- ALfloat gain{*CurrentGains};
- const ALfloat diff{*TargetGains - gain};
+ float *RESTRICT dst{al::assume_aligned<16>(output.data()+OutPos)};
+ float gain{*CurrentGains};
+ const float diff{*TargetGains - gain};
auto in_iter = InSamples.begin();
if(!(std::fabs(diff) > std::numeric_limits<float>::epsilon()))
gain = *TargetGains;
else
{
- const ALfloat step{diff * delta};
- ALfloat step_count{0.0f};
+ const float step{diff * delta};
+ float step_count{0.0f};
/* Mix with applying gain steps in aligned multiples of 4. */
if(ptrdiff_t todo{(min_end-in_iter) >> 2})
{
@@ -296,9 +296,9 @@ template<>
void MixRow_<NEONTag>(const al::span<float> OutBuffer, const al::span<const float> Gains,
const float *InSamples, const size_t InStride)
{
- for(const ALfloat gain : Gains)
+ for(const float gain : Gains)
{
- const ALfloat *RESTRICT input{InSamples};
+ const float *RESTRICT input{InSamples};
InSamples += InStride;
if(!(std::fabs(gain) > GAIN_SILENCE_THRESHOLD))
diff --git a/alc/mixer/mixer_sse.cpp b/alc/mixer/mixer_sse.cpp
index f9ed8f73..8c52d85f 100644
--- a/alc/mixer/mixer_sse.cpp
+++ b/alc/mixer/mixer_sse.cpp
@@ -71,7 +71,7 @@ inline void ApplyCoeffs(float2 *RESTRICT Values, const ALuint IrSize, const Hrir
} // namespace
template<>
-const ALfloat *Resample_<BSincTag,SSETag>(const InterpState *state, const ALfloat *RESTRICT src,
+const float *Resample_<BSincTag,SSETag>(const InterpState *state, const float *RESTRICT src,
ALuint frac, ALuint increment, const al::span<float> dst)
{
const float *const filter{state->bsinc.filter};
@@ -115,12 +115,12 @@ const ALfloat *Resample_<BSincTag,SSETag>(const InterpState *state, const ALfloa
src += frac>>FRACTIONBITS;
frac &= FRACTIONMASK;
}
- return dst.begin();
+ return dst.data();
}
template<>
-const ALfloat *Resample_<FastBSincTag,SSETag>(const InterpState *state,
- const ALfloat *RESTRICT src, ALuint frac, ALuint increment, const al::span<float> dst)
+const float *Resample_<FastBSincTag,SSETag>(const InterpState *state, const float *RESTRICT src,
+ ALuint frac, ALuint increment, const al::span<float> dst)
{
const float *const filter{state->bsinc.filter};
const size_t m{state->bsinc.m};
@@ -158,7 +158,7 @@ const ALfloat *Resample_<FastBSincTag,SSETag>(const InterpState *state,
src += frac>>FRACTIONBITS;
frac &= FRACTIONMASK;
}
- return dst.begin();
+ return dst.data();
}
@@ -186,24 +186,24 @@ template<>
void Mix_<SSETag>(const al::span<const float> InSamples, const al::span<FloatBufferLine> OutBuffer,
float *CurrentGains, const float *TargetGains, const size_t Counter, const size_t OutPos)
{
- const ALfloat delta{(Counter > 0) ? 1.0f / static_cast<ALfloat>(Counter) : 0.0f};
+ const float delta{(Counter > 0) ? 1.0f / static_cast<float>(Counter) : 0.0f};
const bool reached_target{InSamples.size() >= Counter};
const auto min_end = reached_target ? InSamples.begin() + Counter : InSamples.end();
const auto aligned_end = minz(static_cast<uintptr_t>(min_end-InSamples.begin()+3) & ~3u,
InSamples.size()) + InSamples.begin();
for(FloatBufferLine &output : OutBuffer)
{
- ALfloat *RESTRICT dst{al::assume_aligned<16>(output.data()+OutPos)};
- ALfloat gain{*CurrentGains};
- const ALfloat diff{*TargetGains - gain};
+ float *RESTRICT dst{al::assume_aligned<16>(output.data()+OutPos)};
+ float gain{*CurrentGains};
+ const float diff{*TargetGains - gain};
auto in_iter = InSamples.begin();
if(!(std::fabs(diff) > std::numeric_limits<float>::epsilon()))
gain = *TargetGains;
else
{
- const ALfloat step{diff * delta};
- ALfloat step_count{0.0f};
+ const float step{diff * delta};
+ float step_count{0.0f};
/* Mix with applying gain steps in aligned multiples of 4. */
if(ptrdiff_t todo{(min_end-in_iter) >> 2})
{
diff --git a/alc/mixer/mixer_sse2.cpp b/alc/mixer/mixer_sse2.cpp
index 897cd1f7..bb9b65f2 100644
--- a/alc/mixer/mixer_sse2.cpp
+++ b/alc/mixer/mixer_sse2.cpp
@@ -28,8 +28,8 @@
template<>
-const ALfloat *Resample_<LerpTag,SSE2Tag>(const InterpState*, const ALfloat *RESTRICT src,
- ALuint frac, ALuint increment, const al::span<float> dst)
+const float *Resample_<LerpTag,SSE2Tag>(const InterpState*, const float *RESTRICT src, ALuint frac,
+ ALuint increment, const al::span<float> dst)
{
const __m128i increment4{_mm_set1_epi32(static_cast<int>(increment*4))};
const __m128 fracOne4{_mm_set1_ps(1.0f/FRACTIONONE)};
@@ -79,5 +79,5 @@ const ALfloat *Resample_<LerpTag,SSE2Tag>(const InterpState*, const ALfloat *RES
frac &= FRACTIONMASK;
} while(dst_iter != dst.end());
}
- return dst.begin();
+ return dst.data();
}
diff --git a/alc/mixer/mixer_sse41.cpp b/alc/mixer/mixer_sse41.cpp
index cfa21e99..1f483887 100644
--- a/alc/mixer/mixer_sse41.cpp
+++ b/alc/mixer/mixer_sse41.cpp
@@ -29,8 +29,8 @@
template<>
-const ALfloat *Resample_<LerpTag,SSE4Tag>(const InterpState*, const ALfloat *RESTRICT src,
- ALuint frac, ALuint increment, const al::span<float> dst)
+const float *Resample_<LerpTag,SSE4Tag>(const InterpState*, const float *RESTRICT src, ALuint frac,
+ ALuint increment, const al::span<float> dst)
{
const __m128i increment4{_mm_set1_epi32(static_cast<int>(increment*4))};
const __m128 fracOne4{_mm_set1_ps(1.0f/FRACTIONONE)};
@@ -84,5 +84,5 @@ const ALfloat *Resample_<LerpTag,SSE4Tag>(const InterpState*, const ALfloat *RES
frac &= FRACTIONMASK;
} while(dst_iter != dst.end());
}
- return dst.begin();
+ return dst.data();
}