summaryrefslogtreecommitdiff
path: root/apps/codecs/libmad/fixed.h
diff options
context:
space:
mode:
authorThom Johansen <thomj@rockbox.org>2005-06-09 14:13:09 +0000
committerThom Johansen <thomj@rockbox.org>2005-06-09 14:13:09 +0000
commitcc518c5f32daa7b40bc84fd1e98addefbb4f9d76 (patch)
treefd2010d6c552378bb4b794cdf413bb43b8a72e6c /apps/codecs/libmad/fixed.h
parent7c54b3ad4b10cd58573a180a8bff5166c36e5580 (diff)
downloadrockbox-cc518c5f32daa7b40bc84fd1e98addefbb4f9d76.zip
rockbox-cc518c5f32daa7b40bc84fd1e98addefbb4f9d76.tar.gz
rockbox-cc518c5f32daa7b40bc84fd1e98addefbb4f9d76.tar.bz2
rockbox-cc518c5f32daa7b40bc84fd1e98addefbb4f9d76.tar.xz
Full precision synth_full and dct32. Replaced all multiplications with proper 64 bit EMAC multiplications, which yields improved sound.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6638 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/libmad/fixed.h')
-rw-r--r--apps/codecs/libmad/fixed.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/apps/codecs/libmad/fixed.h b/apps/codecs/libmad/fixed.h
index baa7dc5..7ccf1cb 100644
--- a/apps/codecs/libmad/fixed.h
+++ b/apps/codecs/libmad/fixed.h
@@ -420,6 +420,29 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y)
# define MAD_F_SCALEBITS MAD_F_FRACBITS
+# elif defined(FPM_COLDFIRE_EMAC)
+
+/* mad_f_mul using the Coldfire MCF5249 EMAC unit. Loses 3 bits of accuracy.
+ Note that we don't define any of the libmad accumulator macros, as
+ any functions that use these should have the relevant sections rewritten
+ in assembler to utilise the EMAC accumulators properly.
+ Assumes the default +/- 3.28 fixed point format
+ */
+#define mad_f_mul(x, y) \
+({ \
+ mad_fixed64hi_t hi; \
+ asm volatile("mac.l %[a], %[b], %%acc0\n\t" \
+ "movclr.l %%acc0, %[hi]\n\t" \
+ "asl.l #3, %[hi]" \
+ : [hi] "=d" (hi) \
+ : [a] "r" ((x)), [b] "r" ((y))); \
+ hi; \
+})
+/* Define dummy mad_f_scale64 to prevent libmad from defining MAD_F_SCALEBITS
+ below. Having MAD_F_SCALEBITS defined screws up the PRESHIFT macro in synth.h
+ */
+#define mad_f_scale64(hi, lo) (lo)
+
/* --- Default ------------------------------------------------------------- */
# elif defined(FPM_DEFAULT)