1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Thom Johansen 2008-04-08 21:44:07 +00:00
parent 2fee08aff3
commit 18fc7fd654
2 changed files with 6 additions and 53 deletions

View file

@ -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 */

View file

@ -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