aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/mixer/defs.h
blob: 03955b59de5bbfa6e052869176bc5370419d5743 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#ifndef MIXER_DEFS_H
#define MIXER_DEFS_H

#include "AL/alc.h"
#include "AL/al.h"
#include "alMain.h"
#include "alu.h"


struct MixGains;
struct MixHrtfParams;
struct HrtfState;
struct DirectHrtfState;


struct CTag { };
struct SSETag { };
struct SSE2Tag { };
struct SSE3Tag { };
struct SSE4Tag { };
struct NEONTag { };

struct CopyTag { };
struct PointTag { };
struct LerpTag { };
struct CubicTag { };
struct BSincTag { };

template<typename TypeTag, typename InstTag>
const ALfloat *Resample_(const InterpState *state, const ALfloat *RESTRICT src, ALsizei frac, ALint increment, ALfloat *RESTRICT dst, ALsizei dstlen);

template<typename InstTag>
void Mix_(const ALfloat *data, const ALsizei OutChans, ALfloat (*OutBuffer)[BUFFERSIZE], ALfloat *CurrentGains, const ALfloat *TargetGains, const ALsizei Counter, const ALsizei OutPos, const ALsizei BufferSize);
template<typename InstTag>
void MixRow_(ALfloat *OutBuffer, const ALfloat *Gains, const ALfloat (*data)[BUFFERSIZE], const ALsizei InChans, const ALsizei InPos, const ALsizei BufferSize);

/* C mixers */
void MixHrtf_C(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
               const ALfloat *data, ALsizei Offset, const ALsizei OutPos,
               const ALsizei IrSize, MixHrtfParams *hrtfparams,
               HrtfState *hrtfstate, const ALsizei BufferSize);
void MixHrtfBlend_C(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
                    const ALfloat *data, ALsizei Offset, const ALsizei OutPos,
                    const ALsizei IrSize, const HrtfParams *oldparams,
                    MixHrtfParams *newparams, HrtfState *hrtfstate,
                    const ALsizei BufferSize);
void MixDirectHrtf_C(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
                     const ALfloat (*data)[BUFFERSIZE], DirectHrtfState *State,
                     const ALsizei NumChans, const ALsizei BufferSize);

/* SSE mixers */
void MixHrtf_SSE(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
                 const ALfloat *data, ALsizei Offset, const ALsizei OutPos,
                 const ALsizei IrSize, MixHrtfParams *hrtfparams,
                 HrtfState *hrtfstate, const ALsizei BufferSize);
void MixHrtfBlend_SSE(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
                      const ALfloat *data, ALsizei Offset, const ALsizei OutPos,
                      const ALsizei IrSize, const HrtfParams *oldparams,
                      MixHrtfParams *newparams, HrtfState *hrtfstate,
                      const ALsizei BufferSize);
void MixDirectHrtf_SSE(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
                       const ALfloat (*data)[BUFFERSIZE], DirectHrtfState *State,
                       const ALsizei NumChans, const ALsizei BufferSize);

/* Vectorized resampler helpers */
inline void InitiatePositionArrays(ALsizei frac, ALint increment, ALsizei *RESTRICT frac_arr, ALsizei *RESTRICT pos_arr, ALsizei size)
{
    pos_arr[0] = 0;
    frac_arr[0] = frac;
    for(ALsizei i{1};i < size;i++)
    {
        ALint frac_tmp = frac_arr[i-1] + increment;
        pos_arr[i] = pos_arr[i-1] + (frac_tmp>>FRACTIONBITS);
        frac_arr[i] = frac_tmp&FRACTIONMASK;
    }
}

/* Neon mixers */
void MixHrtf_Neon(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
                  const ALfloat *data, ALsizei Offset, const ALsizei OutPos,
                  const ALsizei IrSize, MixHrtfParams *hrtfparams,
                  HrtfState *hrtfstate, const ALsizei BufferSize);
void MixHrtfBlend_Neon(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
                       const ALfloat *data, ALsizei Offset, const ALsizei OutPos,
                       const ALsizei IrSize, const HrtfParams *oldparams,
                       MixHrtfParams *newparams, HrtfState *hrtfstate,
                       const ALsizei BufferSize);
void MixDirectHrtf_Neon(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
                        const ALfloat (*data)[BUFFERSIZE], DirectHrtfState *State,
                        const ALsizei NumChans, const ALsizei BufferSize);

#endif /* MIXER_DEFS_H */