FS#7256 - Monkey's Audio (.ape file) codec based on libdemac
Opened by Dave Chapman (linuxstb) - Sunday, 03 June 2007, 17:33 GMT
Last edited by Dave Chapman (linuxstb) - Tuesday, 05 June 2007, 18:53 GMT
This patch implements a Monkey's Audio (.ape files) decoder for Rockbox.
The decoder itself (libdemac) was written from scratch by me and is licensed under the GNU GPL. The exception is the majority of rangecoding.h, which is (C) 1997, 1998, 1999, 2000 Michael Schindler and is also licensed under the GPL. See that source file for full details.
The decoder only handles modern variants (v3.97 and later) of Monkey's Audio (the format has gone through lots of incompatible changes during its life).
Monkey's Audio files can be compressed at one of 5 compression levels (1000 - fast, 2000 - normal, 3000 - high, 4000 - extra high and 5000 - insane) and current performance in Rockbox for those 5 compression levels (1000 to 5000) is:
Gigabeat F (300MHz ARM) - 413%, 291%, 203%, 76%, 17%
H140 (124MHz Coldfire) - 175%, 105%, 63%, 21%, ??
iPod Color (75MHz PP5020) - 86%, 55%, 32%, 11%, ??
(-c5000 is extremely slow on Coldfire because the filter history buffer is too big to fit in IRAM. -c1000 doesn't have any filters, and -c2000 to -c4000 make use of IRAM. I didn't bother testing -c5000 on PP).
The percentages are (file duration / decoding time) - i.e. 100% is realtime, and the higher the percentage, the faster the decoding is. Smooth playback in Rockbox requires at least around 120% realtime.
There is still potential for optimisation in all parts of the decoder, but Monkey's Audio (especially at the higher compression levels, where high-order filters are used, meaning large numbers of multiplications per sample) is by design complex to decode. However, -c1000 to -c3000 are very usable on the Gigabeat already.
There are two attachments:
demac-0.1.tgz - the standalone ANSI C libdemac, and an example decoding application.
rockbox-ape-0.1.diff - a patch incorporating libdemac from the above archive, and implementing a Rockbox codec. You only need this file to patch Rockbox.
Apart from the obvious need for optimisation, there is still work to do on both the decoder and the Rockbox codec, including:
1) Testing with a larger variety of test files (especially v3.97 testing) including different bitdepths (8/16/24).
2) Implement seeking in Rockbox
3) Improve the code in parser.c (it's a mess at the moment)
Tuesday, 05 June 2007, 18:53 GMT
Reason for closing: Accepted