aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/Include
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-08-16 18:09:53 -0700
committerChris Robinson <[email protected]>2017-08-16 18:09:53 -0700
commit5008024e73e7451c25a4c8729bfb636699615e8e (patch)
treee74f3f6fed16f70db6982d6819d2d347a708c7f2 /OpenAL32/Include
parentf9c09cc845b786705b43b39300d8706db7ab0054 (diff)
Store the sinc4 table in the filter state
Also rename the resampler functions to remove the unnecessary '32' token.
Diffstat (limited to 'OpenAL32/Include')
-rw-r--r--OpenAL32/Include/alu.h18
1 files changed, 11 insertions, 7 deletions
diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h
index 78f05b63..b1c62553 100644
--- a/OpenAL32/Include/alu.h
+++ b/OpenAL32/Include/alu.h
@@ -59,7 +59,9 @@ enum Resampler {
};
extern enum Resampler ResamplerDefault;
-/* The number of distinct scale and phase intervals within the filter table. */
+/* The number of distinct scale and phase intervals within the bsinc filter
+ * table.
+ */
#define BSINC_SCALE_BITS 4
#define BSINC_SCALE_COUNT (1<<BSINC_SCALE_BITS)
#define BSINC_PHASE_BITS 4
@@ -80,8 +82,13 @@ typedef struct BsincState {
const ALfloat *filter;
} BsincState;
+typedef struct Sinc4State {
+ const ALfloat (*filter)[4];
+} Sinc4State;
+
typedef union InterpState {
BsincState bsinc;
+ Sinc4State sinc4;
} InterpState;
ALboolean BsincPrepare(const ALuint increment, BsincState *state);
@@ -381,17 +388,14 @@ inline ALuint64 clampu64(ALuint64 val, ALuint64 min, ALuint64 max)
{ return minu64(max, maxu64(min, val)); }
-extern alignas(16) const ALfloat sinc4Tab[FRACTIONONE][4];
-
-
inline ALfloat lerp(ALfloat val1, ALfloat val2, ALfloat mu)
{
return val1 + (val2-val1)*mu;
}
-inline ALfloat resample_fir4(ALfloat val0, ALfloat val1, ALfloat val2, ALfloat val3, ALsizei frac)
+inline ALfloat resample_fir4(const ALfloat (*restrict filter)[4], ALfloat val0, ALfloat val1, ALfloat val2, ALfloat val3, ALsizei frac)
{
- return sinc4Tab[frac][0]*val0 + sinc4Tab[frac][1]*val1 +
- sinc4Tab[frac][2]*val2 + sinc4Tab[frac][3]*val3;
+ return filter[frac][0]*val0 + filter[frac][1]*val1 +
+ filter[frac][2]*val2 + filter[frac][3]*val3;
}