diff options
author | Chris Robinson <[email protected]> | 2015-09-29 18:27:11 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2015-09-29 20:39:12 -0700 |
commit | dc10e56babf61b62c6cc779414103d7183100c58 (patch) | |
tree | 302dd43223b8c3678cbc726655de628bf5b617fb /OpenAL32 | |
parent | e13d553aefe68f63c1c7d479df80c44f4ab70a0f (diff) |
Implement a 6-point sinc-lanczos filter
Diffstat (limited to 'OpenAL32')
-rw-r--r-- | OpenAL32/Include/alMain.h | 1 | ||||
-rw-r--r-- | OpenAL32/Include/alu.h | 13 | ||||
-rw-r--r-- | OpenAL32/alSource.c | 2 |
3 files changed, 14 insertions, 2 deletions
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 7d508721..9703a9cf 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -529,6 +529,7 @@ enum Resampler { PointResampler, LinearResampler, FIR4Resampler, + FIR6Resampler, ResamplerMax, }; diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h index 16b3e1ab..c37ebb9f 100644 --- a/OpenAL32/Include/alu.h +++ b/OpenAL32/Include/alu.h @@ -202,7 +202,11 @@ inline ALuint64 clampu64(ALuint64 val, ALuint64 min, ALuint64 max) { return minu64(max, maxu64(min, val)); } -extern alignas(16) ALfloat ResampleCoeffs[FRACTIONONE][4]; +union ResamplerCoeffs { + ALfloat FIR4[FRACTIONONE][4]; + ALfloat FIR6[FRACTIONONE][6]; +}; +extern alignas(16) union ResamplerCoeffs ResampleCoeffs; inline ALfloat lerp(ALfloat val1, ALfloat val2, ALfloat mu) @@ -211,9 +215,14 @@ inline ALfloat lerp(ALfloat val1, ALfloat val2, ALfloat mu) } inline ALfloat resample_fir4(ALfloat val0, ALfloat val1, ALfloat val2, ALfloat val3, ALuint frac) { - const ALfloat *k = ResampleCoeffs[frac]; + const ALfloat *k = ResampleCoeffs.FIR4[frac]; return k[0]*val0 + k[1]*val1 + k[2]*val2 + k[3]*val3; } +inline ALfloat resample_fir6(ALfloat val0, ALfloat val1, ALfloat val2, ALfloat val3, ALfloat val4, ALfloat val5, ALuint frac) +{ + const ALfloat *k = ResampleCoeffs.FIR6[frac]; + return k[0]*val0 + k[1]*val1 + k[2]*val2 + k[3]*val3 + k[4]*val4 + k[5]*val5; +} void aluInitMixer(void); diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index aff82b5f..24e5874d 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -43,11 +43,13 @@ const ALsizei ResamplerPadding[ResamplerMax] = { 0, /* Point */ 1, /* Linear */ 2, /* FIR4 */ + 3, /* FIR6 */ }; const ALsizei ResamplerPrePadding[ResamplerMax] = { 0, /* Point */ 0, /* Linear */ 1, /* FIR4 */ + 2, /* FIR6 */ }; |