pdbox: Applied several changes by Buschel. Reintroduced compilation for iPods.

Changes by Buschel:

* Reduced footprint by making cosine table of size 1^13 instead of 1^15
* Corrected interpolation in the cos~ object
* Optimized multiplication on ARM platforms



git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26534 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Wincent Balin 2010-06-03 22:03:37 +00:00
parent 2438d8b584
commit 2e5b1b1a9c
5 changed files with 1070 additions and 3 deletions

View file

@ -74,7 +74,9 @@ midi
/* beatbox */
#if defined(IRIVER_H300_SERIES) || defined(IRIVER_H100_SERIES) || \
(CONFIG_KEYPAD == SANSA_FUZE_PAD)
(CONFIG_KEYPAD == SANSA_FUZE_PAD) || \
(CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD) || \
(CONFIG_KEYPAD == IPOD_1G2G_PAD)
/* PDBox is confirmed to run on these player models. */
pdbox
#endif

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,8 @@
/* For definition of the cos_table[] look into cos_table.c */
#ifdef ROCKBOX
#define ILOGCOSTABSIZE 13
#else /* ROCKBOX */
#define ILOGCOSTABSIZE 15
#endif /* ROCKBOX */
#define ICOSTABSIZE (1<<ILOGCOSTABSIZE)
extern t_sample cos_table[];

View file

@ -36,10 +36,20 @@ static t_int *cos_perform(t_int *w)
phase = *in++;
phase &= ((1<<fix1)-1);
off = fixtoi((long long)phase<<ILOGCOSTABSIZE);
#ifdef ROCKBOX
#ifdef NO_INTERPOLATION
*out = *(tab+off);
#else /* NO_INTERPOLATION */
frac = phase & ((1<<(fix1-ILOGCOSTABSIZE))-1);
frac <<= ILOGCOSTABSIZE;
*out = mult(*(tab + off ), (itofix(1) - frac)) +
mult(*(tab + off + 1), frac);
#endif /* NO_INTERPOLATION */
#else /* ROCKBOX */
frac = phase&(itofix(1)-1);
*out = mult(*(tab + off),itofix(1) - frac) +
mult(*(tab + off + 1),frac);
#endif /* ROCKBOX */
out++;
}
return (w+4);

View file

@ -12,8 +12,24 @@ typedef int t_sample;
/* fixed point multiplication and division */
#if defined(ROCKBOX) && defined(CPU_ARM)
#define mult(A,B) \
({ \
t_fixed lo; \
t_fixed hi; \
asm volatile ( \
"smull %[lo], %[hi], %[x], %[y] \n\t" /* multiply */ \
"mov %[lo], %[lo], lsr %[shr] \n\t" /* lo >>= fix1 */ \
"orr %[lo], %[lo], %[hi], lsl %[shl]" /* lo |= (hi << (32-fix1)) */ \
: [lo]"=&r"(lo), [hi]"=&r"(hi) \
: [x]"r"(A), [y]"r"(B), [shr]"r"(fix1), [shl]"r"(32-fix1)); \
lo; \
})
#define idiv(a,b) ((((long long) (a) )<<fix1)/(long long) (b) )
#else /* ROCKBOX && CPU_ARM */
#define mult(a,b) (long long)(((long long) (a) * (long long) (b))>>fix1)
#define idiv(a,b) ((((long long) (a) )<<fix1)/(long long) (b) )
#endif /* ROCKBOX && CPU_ARM */
/* conversion macros */