diff options
author | Chris Robinson <[email protected]> | 2016-05-31 07:50:23 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2016-05-31 07:50:23 -0700 |
commit | 72d2febccbc670843669494fe5bc052839f54294 (patch) | |
tree | d1f6c7a42ed98486e5b64f98c1c47ffbcaa45b9e /Alc/bformatdec.c | |
parent | d1c4fb6364ce974bd0a4769604b9bba19481e17f (diff) |
Don't access the band splitter fields in the processing loops
perf shows a 5% drop in relative execution time on the alffplay example with an
audio-only file (20% to 15%). Kinda figured the optimizer would handle it
better, but I guess not.
Diffstat (limited to 'Alc/bformatdec.c')
-rw-r--r-- | Alc/bformatdec.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/Alc/bformatdec.c b/Alc/bformatdec.c index e32053c8..49052cb8 100644 --- a/Alc/bformatdec.c +++ b/Alc/bformatdec.c @@ -34,35 +34,42 @@ static void bandsplit_process(BandSplitter *splitter, ALfloat *restrict hpout, A const ALfloat *input, ALuint count) { ALfloat coeff, d, x; + ALfloat z1, z2; ALuint i; coeff = splitter->coeff*0.5f + 0.5f; + z1 = splitter->lp_z1; + z2 = splitter->lp_z2; for(i = 0;i < count;i++) { x = input[i]; - d = (x - splitter->lp_z1) * coeff; - x = splitter->lp_z1 + d; - splitter->lp_z1 = x + d; + d = (x - z1) * coeff; + x = z1 + d; + z1 = x + d; - d = (x - splitter->lp_z2) * coeff; - x = splitter->lp_z2 + d; - splitter->lp_z2 = x + d; + d = (x - z2) * coeff; + x = z2 + d; + z2 = x + d; lpout[i] = x; } + splitter->lp_z1 = z1; + splitter->lp_z2 = z2; coeff = splitter->coeff; + z1 = splitter->hp_z1; for(i = 0;i < count;i++) { x = input[i]; - d = x - coeff*splitter->hp_z1; - x = splitter->hp_z1 + coeff*d; - splitter->hp_z1 = d; + d = x - coeff*z1; + x = z1 + coeff*d; + z1 = d; hpout[i] = x - lpout[i]; } + splitter->hp_z1 = z1; } |