Use size_t for the mixers' fade counter and outpos

This commit is contained in:
Chris Robinson 2019-08-20 12:00:24 -07:00
parent 3fa83547e9
commit 80710c146a
6 changed files with 22 additions and 23 deletions

View File

@ -315,14 +315,14 @@ struct ALvoice {
using MixerFunc = void(*)(const al::span<const float> InSamples,
const al::span<FloatBufferLine> OutBuffer, float *CurrentGains, const float *TargetGains,
const ALsizei Counter, const ALsizei OutPos);
const size_t Counter, const size_t OutPos);
using RowMixerFunc = void(*)(const al::span<float> OutBuffer, const al::span<const float> Gains,
const float *InSamples, const size_t InStride);
using HrtfMixerFunc = void(*)(FloatBufferLine &LeftOut, FloatBufferLine &RightOut,
const ALfloat *InSamples, float2 *AccumSamples, const ALsizei OutPos, const ALsizei IrSize,
const ALfloat *InSamples, float2 *AccumSamples, const size_t OutPos, const ALsizei IrSize,
MixHrtfFilter *hrtfparams, const size_t BufferSize);
using HrtfMixerBlendFunc = void(*)(FloatBufferLine &LeftOut, FloatBufferLine &RightOut,
const ALfloat *InSamples, float2 *AccumSamples, const ALsizei OutPos, const ALsizei IrSize,
const ALfloat *InSamples, float2 *AccumSamples, const size_t OutPos, const ALsizei IrSize,
const HrtfFilter *oldparams, MixHrtfFilter *newparams, const size_t BufferSize);
using HrtfDirectMixerFunc = void(*)(FloatBufferLine &LeftOut, FloatBufferLine &RightOut,
const al::span<const FloatBufferLine> InSamples, float2 *AccumSamples, DirectHrtfState *State,

View File

@ -27,19 +27,20 @@ enum ResampleType {
};
template<ResampleType TypeTag, InstSetType InstTag>
const ALfloat *Resample_(const InterpState *state, const ALfloat *RESTRICT src, ALsizei frac, ALint increment, const al::span<float> dst);
const ALfloat *Resample_(const InterpState *state, const ALfloat *RESTRICT src, ALsizei frac,
ALint increment, const al::span<float> dst);
template<InstSetType InstTag>
void Mix_(const al::span<const float> InSamples, const al::span<FloatBufferLine> OutBuffer,
float *CurrentGains, const float *TargetGains, const ALsizei Counter, const ALsizei OutPos);
float *CurrentGains, const float *TargetGains, const size_t Counter, const size_t OutPos);
template<InstSetType InstTag>
void MixRow_(const al::span<float> OutBuffer, const al::span<const float> Gains,
const float *InSamples, const size_t InStride);
template<InstSetType InstTag>
void MixHrtf_(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, const ALfloat *InSamples, float2 *AccumSamples, const ALsizei OutPos, const ALsizei IrSize, MixHrtfFilter *hrtfparams, const size_t BufferSize);
void MixHrtf_(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, const ALfloat *InSamples, float2 *AccumSamples, const size_t OutPos, const ALsizei IrSize, MixHrtfFilter *hrtfparams, const size_t BufferSize);
template<InstSetType InstTag>
void MixHrtfBlend_(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, const ALfloat *InSamples, float2 *AccumSamples, const ALsizei OutPos, const ALsizei IrSize, const HrtfFilter *oldparams, MixHrtfFilter *newparams, const size_t BufferSize);
void MixHrtfBlend_(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, const ALfloat *InSamples, float2 *AccumSamples, const size_t OutPos, const ALsizei IrSize, const HrtfFilter *oldparams, MixHrtfFilter *newparams, const size_t BufferSize);
template<InstSetType InstTag>
void MixDirectHrtf_(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, const al::span<const FloatBufferLine> InSamples, float2 *AccumSamples, DirectHrtfState *State, const size_t BufferSize);

View File

@ -13,10 +13,9 @@ using ApplyCoeffsT = void(size_t Offset, float2 *RESTRICT Values, const ALsizei
template<ApplyCoeffsT &ApplyCoeffs>
inline void MixHrtfBase(FloatBufferLine &LeftOut, FloatBufferLine &RightOut,
const ALfloat *InSamples, float2 *RESTRICT AccumSamples, const ALsizei OutPos,
const ALfloat *InSamples, float2 *RESTRICT AccumSamples, const size_t OutPos,
const ALsizei IrSize, MixHrtfFilter *hrtfparams, const size_t BufferSize)
{
ASSUME(OutPos >= 0);
ASSUME(IrSize >= 4);
ASSUME(BufferSize > 0);
@ -49,7 +48,7 @@ inline void MixHrtfBase(FloatBufferLine &LeftOut, FloatBufferLine &RightOut,
template<ApplyCoeffsT &ApplyCoeffs>
inline void MixHrtfBlendBase(FloatBufferLine &LeftOut, FloatBufferLine &RightOut,
const ALfloat *InSamples, float2 *RESTRICT AccumSamples, const ALsizei OutPos,
const ALfloat *InSamples, float2 *RESTRICT AccumSamples, const size_t OutPos,
const ALsizei IrSize, const HrtfFilter *oldparams, MixHrtfFilter *newparams,
const size_t BufferSize)
{
@ -59,7 +58,6 @@ inline void MixHrtfBlendBase(FloatBufferLine &LeftOut, FloatBufferLine &RightOut
const auto &NewCoeffs = *newparams->Coeffs;
const ALfloat newGainStep{newparams->GainStep};
ASSUME(OutPos >= 0);
ASSUME(IrSize >= 4);
ASSUME(BufferSize > 0);

View File

@ -114,7 +114,7 @@ static inline void ApplyCoeffs(size_t /*Offset*/, float2 *RESTRICT Values, const
template<>
void MixHrtf_<CTag>(FloatBufferLine &LeftOut, FloatBufferLine &RightOut,
const ALfloat *InSamples, float2 *AccumSamples, const ALsizei OutPos, const ALsizei IrSize,
const ALfloat *InSamples, float2 *AccumSamples, const size_t OutPos, const ALsizei IrSize,
MixHrtfFilter *hrtfparams, const size_t BufferSize)
{
MixHrtfBase<ApplyCoeffs>(LeftOut, RightOut, InSamples, AccumSamples, OutPos, IrSize,
@ -123,7 +123,7 @@ void MixHrtf_<CTag>(FloatBufferLine &LeftOut, FloatBufferLine &RightOut,
template<>
void MixHrtfBlend_<CTag>(FloatBufferLine &LeftOut, FloatBufferLine &RightOut,
const ALfloat *InSamples, float2 *AccumSamples, const ALsizei OutPos, const ALsizei IrSize,
const ALfloat *InSamples, float2 *AccumSamples, const size_t OutPos, const ALsizei IrSize,
const HrtfFilter *oldparams, MixHrtfFilter *newparams, const size_t BufferSize)
{
MixHrtfBlendBase<ApplyCoeffs>(LeftOut, RightOut, InSamples, AccumSamples, OutPos, IrSize,
@ -141,10 +141,10 @@ void MixDirectHrtf_<CTag>(FloatBufferLine &LeftOut, FloatBufferLine &RightOut,
template<>
void Mix_<CTag>(const al::span<const float> InSamples, const al::span<FloatBufferLine> OutBuffer,
float *CurrentGains, const float *TargetGains, const ALsizei Counter, const ALsizei OutPos)
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 bool reached_target{InSamples.size() >= static_cast<size_t>(Counter)};
const bool reached_target{InSamples.size() >= Counter};
const auto min_end = reached_target ? InSamples.begin() + Counter : InSamples.end();
for(FloatBufferLine &output : OutBuffer)
{

View File

@ -160,7 +160,7 @@ static inline void ApplyCoeffs(size_t /*Offset*/, float2 *RESTRICT Values, const
template<>
void MixHrtf_<NEONTag>(FloatBufferLine &LeftOut, FloatBufferLine &RightOut,
const ALfloat *InSamples, float2 *AccumSamples, const ALsizei OutPos, const ALsizei IrSize,
const ALfloat *InSamples, float2 *AccumSamples, const size_t OutPos, const ALsizei IrSize,
MixHrtfFilter *hrtfparams, const size_t BufferSize)
{
MixHrtfBase<ApplyCoeffs>(LeftOut, RightOut, InSamples, AccumSamples, OutPos, IrSize,
@ -169,7 +169,7 @@ void MixHrtf_<NEONTag>(FloatBufferLine &LeftOut, FloatBufferLine &RightOut,
template<>
void MixHrtfBlend_<NEONTag>(FloatBufferLine &LeftOut, FloatBufferLine &RightOut,
const ALfloat *InSamples, float2 *AccumSamples, const ALsizei OutPos, const ALsizei IrSize,
const ALfloat *InSamples, float2 *AccumSamples, const size_t OutPos, const ALsizei IrSize,
const HrtfFilter *oldparams, MixHrtfFilter *newparams, const size_t BufferSize)
{
MixHrtfBlendBase<ApplyCoeffs>(LeftOut, RightOut, InSamples, AccumSamples, OutPos, IrSize,
@ -187,10 +187,10 @@ void MixDirectHrtf_<NEONTag>(FloatBufferLine &LeftOut, FloatBufferLine &RightOut
template<>
void Mix_<NEONTag>(const al::span<const float> InSamples, const al::span<FloatBufferLine> OutBuffer,
float *CurrentGains, const float *TargetGains, const ALsizei Counter, const ALsizei OutPos)
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 bool reached_target{InSamples.size() >= static_cast<size_t>(Counter)};
const bool reached_target{InSamples.size() >= Counter};
const auto min_end = reached_target ? InSamples.begin() + Counter : InSamples.end();
const auto aligned_end = minz(InSamples.size(), (min_end-InSamples.begin()+3) & ~3) +
InSamples.begin();

View File

@ -118,7 +118,7 @@ static inline void ApplyCoeffs(size_t Offset, float2 *RESTRICT Values, const ALs
template<>
void MixHrtf_<SSETag>(FloatBufferLine &LeftOut, FloatBufferLine &RightOut,
const ALfloat *InSamples, float2 *AccumSamples, const ALsizei OutPos, const ALsizei IrSize,
const ALfloat *InSamples, float2 *AccumSamples, const size_t OutPos, const ALsizei IrSize,
MixHrtfFilter *hrtfparams, const size_t BufferSize)
{
MixHrtfBase<ApplyCoeffs>(LeftOut, RightOut, InSamples, AccumSamples, OutPos, IrSize,
@ -127,7 +127,7 @@ void MixHrtf_<SSETag>(FloatBufferLine &LeftOut, FloatBufferLine &RightOut,
template<>
void MixHrtfBlend_<SSETag>(FloatBufferLine &LeftOut, FloatBufferLine &RightOut,
const ALfloat *InSamples, float2 *AccumSamples, const ALsizei OutPos, const ALsizei IrSize,
const ALfloat *InSamples, float2 *AccumSamples, const size_t OutPos, const ALsizei IrSize,
const HrtfFilter *oldparams, MixHrtfFilter *newparams, const size_t BufferSize)
{
MixHrtfBlendBase<ApplyCoeffs>(LeftOut, RightOut, InSamples, AccumSamples, OutPos, IrSize,
@ -145,10 +145,10 @@ void MixDirectHrtf_<SSETag>(FloatBufferLine &LeftOut, FloatBufferLine &RightOut,
template<>
void Mix_<SSETag>(const al::span<const float> InSamples, const al::span<FloatBufferLine> OutBuffer,
float *CurrentGains, const float *TargetGains, const ALsizei Counter, const ALsizei OutPos)
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 bool reached_target{InSamples.size() >= static_cast<size_t>(Counter)};
const bool reached_target{InSamples.size() >= Counter};
const auto min_end = reached_target ? InSamples.begin() + Counter : InSamples.end();
const auto aligned_end = minz(InSamples.size(), (min_end-InSamples.begin()+3) & ~3) +
InSamples.begin();