Implement a "fast" bsinc path
[openal-soft.git] / alc / mixer / defs.h
blobce5729733365113bd4fc267f6e6aeb279fcb9c05
1 #ifndef MIXER_DEFS_H
2 #define MIXER_DEFS_H
4 #include "AL/al.h"
6 #include "alcmain.h"
7 #include "alspan.h"
8 #include "alu.h"
9 #include "hrtf.h"
12 enum InstSetType {
13 CTag,
14 SSETag,
15 SSE2Tag,
16 SSE3Tag,
17 SSE4Tag,
18 NEONTag
21 enum ResampleType {
22 CopyTag,
23 PointTag,
24 LerpTag,
25 CubicTag,
26 BSincTag,
27 FastBSincTag
30 template<ResampleType TypeTag, InstSetType InstTag>
31 const ALfloat *Resample_(const InterpState *state, const ALfloat *RESTRICT src, ALuint frac,
32 ALuint increment, const al::span<float> dst);
34 template<InstSetType InstTag>
35 void Mix_(const al::span<const float> InSamples, const al::span<FloatBufferLine> OutBuffer,
36 float *CurrentGains, const float *TargetGains, const size_t Counter, const size_t OutPos);
37 template<InstSetType InstTag>
38 void MixRow_(const al::span<float> OutBuffer, const al::span<const float> Gains,
39 const float *InSamples, const size_t InStride);
41 template<InstSetType InstTag>
42 void MixHrtf_(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, const ALfloat *InSamples, float2 *AccumSamples, const size_t OutPos, const ALuint IrSize, MixHrtfFilter *hrtfparams, const size_t BufferSize);
43 template<InstSetType InstTag>
44 void MixHrtfBlend_(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, const ALfloat *InSamples, float2 *AccumSamples, const size_t OutPos, const ALuint IrSize, const HrtfFilter *oldparams, MixHrtfFilter *newparams, const size_t BufferSize);
45 template<InstSetType InstTag>
46 void MixDirectHrtf_(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, const al::span<const FloatBufferLine> InSamples, float2 *AccumSamples, DirectHrtfState *State, const size_t BufferSize);
48 /* Vectorized resampler helpers */
49 inline void InitPosArrays(ALuint frac, ALuint increment, ALuint *frac_arr, ALuint *pos_arr,
50 size_t size)
52 pos_arr[0] = 0;
53 frac_arr[0] = frac;
54 for(size_t i{1};i < size;i++)
56 const ALuint frac_tmp{frac_arr[i-1] + increment};
57 pos_arr[i] = pos_arr[i-1] + (frac_tmp>>FRACTIONBITS);
58 frac_arr[i] = frac_tmp&FRACTIONMASK;
62 #endif /* MIXER_DEFS_H */