summaryrefslogtreecommitdiff
path: root/apps/codecs/demac/libdemac/rangecoding.h
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2008-11-05 00:10:05 +0000
committerJens Arnold <amiconn@rockbox.org>2008-11-05 00:10:05 +0000
commitfe04e40be7a26c758a82e410e58be63c1f3d571c (patch)
tree955b1557f3da7cd8362bc05d96302cac08a72ff2 /apps/codecs/demac/libdemac/rangecoding.h
parent7a835ee0c64bb941f205a2eb915cf0aaf460f1bc (diff)
downloadrockbox-fe04e40be7a26c758a82e410e58be63c1f3d571c.zip
rockbox-fe04e40be7a26c758a82e410e58be63c1f3d571c.tar.gz
rockbox-fe04e40be7a26c758a82e410e58be63c1f3d571c.tar.bz2
rockbox-fe04e40be7a26c758a82e410e58be63c1f3d571c.tar.xz
Further optimised (vs. libgcc) unsigned 32 bit division for ARMv4 (based on the ARMv5(+) version from libgcc), in IRAM on PP for better performance on PP5002, and put into the codeclib for possible reuse. APE -c1000 is now usable on both PP502x and PP5002 (~138% realtime, they're on par now). Gigabeat F/X should also see an APE speedup.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19009 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/demac/libdemac/rangecoding.h')
-rw-r--r--apps/codecs/demac/libdemac/rangecoding.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/apps/codecs/demac/libdemac/rangecoding.h b/apps/codecs/demac/libdemac/rangecoding.h
index c96886e..645fd1a 100644
--- a/apps/codecs/demac/libdemac/rangecoding.h
+++ b/apps/codecs/demac/libdemac/rangecoding.h
@@ -49,6 +49,14 @@ removing the rc parameter from each function (and the RNGC macro)).
*/
+#ifdef ROCKBOX
+#include "../lib/codeclib.h"
+/* for UDIV32() */
+#endif
+
+#ifndef UDIV32
+#define UDIV32(a, b) (a / b)
+#endif
/* BITSTREAM READING FUNCTIONS */
@@ -121,15 +129,15 @@ static inline void range_dec_normalize(void)
static inline int range_decode_culfreq(int tot_f)
{
range_dec_normalize();
- rc.help = rc.range / tot_f;
- return rc.low / rc.help;
+ rc.help = UDIV32(rc.range, tot_f);
+ return UDIV32(rc.low, rc.help);
}
static inline int range_decode_culshift(int shift)
{
range_dec_normalize();
rc.help = rc.range >> shift;
- return rc.low / rc.help;
+ return UDIV32(rc.low, rc.help);
}