summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThom Johansen <thomj@rockbox.org>2008-04-08 21:44:07 +0000
committerThom Johansen <thomj@rockbox.org>2008-04-08 21:44:07 +0000
commit18fc7fd6548981e5e033b07470c0b65d907a0684 (patch)
tree87060036143aa6a57c7401c9f77360800b69108d
parent2fee08aff39e1e095006448427fc8ebc529e2d62 (diff)
downloadrockbox-18fc7fd6548981e5e033b07470c0b65d907a0684.zip
rockbox-18fc7fd6548981e5e033b07470c0b65d907a0684.tar.gz
rockbox-18fc7fd6548981e5e033b07470c0b65d907a0684.tar.bz2
rockbox-18fc7fd6548981e5e033b07470c0b65d907a0684.tar.xz
Remove FRACMUL_8_LOOP macro. This only benefited Coldfire, and we have assembler routines for the gain function there now.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17040 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/dsp.c16
-rw-r--r--apps/dsp.h43
2 files changed, 6 insertions, 53 deletions
diff --git a/apps/dsp.c b/apps/dsp.c
index faa08ed..5b90b7c 100644
--- a/apps/dsp.c
+++ b/apps/dsp.c
@@ -794,22 +794,16 @@ void dsp_set_crossfeed_cross_params(long lf_gain, long hf_gain, long cutoff)
static void dsp_apply_gain(int count, struct dsp_data *data, int32_t *buf[])
{
const int32_t gain = data->gain;
- int ch = data->num_channels - 1;
+ int ch;
- do
+ for (ch = 0; ch < data->num_channels; ch++)
{
- int32_t *s = buf[ch];
int32_t *d = buf[ch];
- int32_t samp = *s++;
- int i = 0;
+ int i;
- do
- {
- FRACMUL_8_LOOP(samp, gain, s, d);
- }
- while (++i < count);
+ for (i = 0; i < count; i++)
+ d[i] = FRACMUL_SHL(d[i], gain, 8);
}
- while (--ch >= 0);
}
#endif /* DSP_HAVE_ASM_APPLY_GAIN */
diff --git a/apps/dsp.h b/apps/dsp.h
index 21807b9..37658c9 100644
--- a/apps/dsp.h
+++ b/apps/dsp.h
@@ -83,7 +83,7 @@ enum {
/* Multiply two S.31 fractional integers, and return the 32 most significant
* bits after a shift left by the constant z. NOTE: Only works for shifts of
- * up to 8 on Coldfire!
+ * 1 to 8 on Coldfire!
*/
#define FRACMUL_SHL(x, y, z) \
({ \
@@ -102,25 +102,6 @@ enum {
t; \
})
-/* Multiply one S.31-bit and one S8.23 fractional integer and return the
- * sign bit and the 31 most significant bits of the result. Load next value
- * to multiply with into x from s (and increase s); x must contain the
- * initial value.
- */
-#define FRACMUL_8_LOOP(x, y, s, d) \
-{ \
- long t, t2; \
- asm volatile ("mac.l %[a], %[b], (%[src])+, %[a], %%acc0\n\t" \
- "move.l %%accext01, %[t2]\n\t" \
- "movclr.l %%acc0, %[t]\n\t" \
- "asl.l #8, %[t]\n\t" \
- "move.b %[t2], %[t]\n\t" \
- "move.l %[t], (%[dst])+\n\t" \
- : [a] "+r" (x), [src] "+a" (s), [dst] "+a" (d), \
- [t] "=r" (t), [t2] "=r" (t2) \
- : [b] "r" (y)); \
-}
-
#elif defined(CPU_ARM)
/* Multiply two S.31 fractional integers and return the sign bit and the
@@ -152,33 +133,11 @@ enum {
t; \
})
-/* Multiply one S.31-bit and one S8.23 fractional integer and store the
- * sign bit and the 31 most significant bits of the result to d (and
- * increase d). Load next value to multiply with into x from s (and
- * increase s); x must contain the initial value.
- */
-#define FRACMUL_8_LOOP(x, y, s, d) \
-({ \
- long t, t2; \
- asm volatile ("smull %[t], %[t2], %[a], %[b]\n\t" \
- "mov %[t2], %[t2], asl #9\n\t" \
- "orr %[d], %[t2], %[t], lsr #23\n\t" \
- : [d] "=&r" (*(d)++), [t] "=&r" (t), [t2] "=&r" (t2) \
- : [a] "r" (x), [b] "r" (y)); \
- x = *(s)++; \
-})
-
#else
#define FRACMUL(x, y) (long) (((((long long) (x)) * ((long long) (y))) >> 31))
#define FRACMUL_SHL(x, y, z) \
((long)(((((long long) (x)) * ((long long) (y))) >> (31 - (z)))))
-#define FRACMUL_8_LOOP(x, y, s, d) \
-({ \
- long t = x; \
- x = *(s)++; \
- *(d)++ = (long) (((((long long) (t)) * ((long long) (y))) >> 23)); \
-})
#endif