• Status Closed
  • Percent Complete
  • Task Type Patches
  • Category Codecs
  • Assigned To
  • Operating System SW-codec
  • Severity Low
  • Priority Very Low
  • Reported Version Daily build (which?)
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by linuxstb - 2007-06-03
Last edited by linuxstb - 2007-06-05

FS#7256 - Monkey's Audio (.ape file) codec based on libdemac

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)

Closed by  linuxstb
2007-06-05 18:53
Reason for closing:  Accepted


Available keyboard shortcuts


Task Details

Task Editing