summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey Goode <jeffg7@gmail.com>2009-09-19 00:12:02 +0000
committerJeffrey Goode <jeffg7@gmail.com>2009-09-19 00:12:02 +0000
commitb2aa2452e798d6fed2c1d5ab3e8b16cfa234a551 (patch)
tree0ca507a61ac4b5b5197ac968995bc568eff19bf5
parent293a4b62d7220f855cb4d13f79b8ff97467f0242 (diff)
downloadrockbox-b2aa2452e798d6fed2c1d5ab3e8b16cfa234a551.zip
rockbox-b2aa2452e798d6fed2c1d5ab3e8b16cfa234a551.tar.gz
rockbox-b2aa2452e798d6fed2c1d5ab3e8b16cfa234a551.tar.bz2
rockbox-b2aa2452e798d6fed2c1d5ab3e8b16cfa234a551.tar.xz
Performance improvement in limiter, about 2%
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22735 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/dsp.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/apps/dsp.c b/apps/dsp.c
index fad5f4d..5aa93cc 100644
--- a/apps/dsp.c
+++ b/apps/dsp.c
@@ -1934,21 +1934,18 @@ static int limiter_process(int count, int32_t *buf[])
}
/* Implement the limiter: adjust gain of the outbound samples by the gain
* amounts in the gain steps array corresponding to the peak values. */
- for (ch = 0; ch < AUDIO_DSP.data.num_channels; ch++)
+ for (i = 0; i < count; i++)
{
- int32_t *d = buf[ch];
- for (i = 0; i < count; i++)
+ if (out_buf_peak[i] > 0)
{
- if (out_buf_peak[i] > 0)
- {
- gain_peak = (out_buf_peak[i] + 1) / 90;
- gain_rem = (out_buf_peak[i] + 1) % 90;
- gain = gain_steps[gain_peak];
- if ((gain_peak < 48) && (gain_rem > 0))
- gain -= gain_rem * ((gain_steps[gain_peak] -
- gain_steps[gain_peak + 1]) / 90);
- d[i] = FRACMUL_SHL(d[i], gain, 3);
- }
+ gain_peak = (out_buf_peak[i] + 1) / 90;
+ gain_rem = (out_buf_peak[i] + 1) % 90;
+ gain = gain_steps[gain_peak];
+ if ((gain_peak < 48) && (gain_rem > 0))
+ gain -= gain_rem * ((gain_steps[gain_peak] -
+ gain_steps[gain_peak + 1]) / 90);
+ for (ch = 0; ch < AUDIO_DSP.data.num_channels; ch++)
+ buf[ch][i] = FRACMUL_SHL(buf[ch][i], gain, 3);
}
}
return count;