summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2013-05-26 17:04:45 -0700
committerChris Robinson <[email protected]>2013-05-26 17:04:45 -0700
commit0a4be3470e5cd48c95bef5a30a169ea671646132 (patch)
tree6815708cdbbc65652ba9506fc3dd2441181557a5
parent4bf5466f6494f0f20a5930bb1864b8322bc3e20a (diff)
Pre-apply the a[0] EQ filter coefficient
Saves 20 fp divisions per sample
-rw-r--r--Alc/effects/equalizer.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/Alc/effects/equalizer.c b/Alc/effects/equalizer.c
index 441c785f..f9744fb9 100644
--- a/Alc/effects/equalizer.c
+++ b/Alc/effects/equalizer.c
@@ -216,6 +216,12 @@ static ALvoid ALequalizerState_Update(ALequalizerState *state, ALCdevice *device
state->bandfilter[it].a[2] = 1.0f - alpha / gain;
break;
}
+ state->bandfilter[it].b[0] /= state->bandfilter[it].a[0];
+ state->bandfilter[it].b[1] /= state->bandfilter[it].a[0];
+ state->bandfilter[it].b[2] /= state->bandfilter[it].a[0];
+ state->bandfilter[it].a[0] /= state->bandfilter[it].a[0];
+ state->bandfilter[it].a[1] /= state->bandfilter[it].a[0];
+ state->bandfilter[it].a[2] /= state->bandfilter[it].a[0];
}
}
@@ -240,11 +246,11 @@ static ALvoid ALequalizerState_Process(ALequalizerState *state, ALuint SamplesTo
{
ALEQFilter *filter = &state->bandfilter[ft];
- tempsmp = filter->b[0] / filter->a[0] * smp +
- filter->b[1] / filter->a[0] * filter->x[0] +
- filter->b[2] / filter->a[0] * filter->x[1] -
- filter->a[1] / filter->a[0] * filter->y[0] -
- filter->a[2] / filter->a[0] * filter->y[1];
+ tempsmp = filter->b[0] * smp +
+ filter->b[1] * filter->x[0] +
+ filter->b[2] * filter->x[1] -
+ filter->a[1] * filter->y[0] -
+ filter->a[2] * filter->y[1];
filter->x[1] = filter->x[0];
filter->x[0] = smp;