This is the bug/patch tracker for Rockbox. Click here for more information.
Quick links: Bugs · Patches · Rockbox frontpage
FS#6705 - Small ARM optimizations to MPA codec
Attached to Project:
Rockbox
Opened by Tomasz Malesinski (tmal) - Wednesday, 28 February 2007, 00:38 GMT+2
Last edited by Dave Chapman (linuxstb) - Saturday, 28 July 2007, 17:21 GMT+2
Opened by Tomasz Malesinski (tmal) - Wednesday, 28 February 2007, 00:38 GMT+2
Last edited by Dave Chapman (linuxstb) - Saturday, 28 July 2007, 17:21 GMT+2
|
DetailsHere are some optimizations that let me play mp3 files in realtime on Iriver iFP. The iFP benefits mostly by moving things into IRAM, since its external RAM is very slow (16-bit, 70 ns, no bursts). The patch needs some cleanup, but I won't be working on it in the next weeks, so I put it here in case someone wants to look at it.
One warning: there is a bug somewhere in Makefiles and sometimes make needs to be run twice to recompile and relink the codec. The biggest change is a different dct32 routine. It is worse in terms of number of executed instructions, but it's smaller, so it fits in IRAM and uses less cache. Compared to my last patch ( Rest of the changes involve using ldm and stm instructions. Some give really minor gains. With this patch the mpegplayer plugin does not compile on Ipod because of overfull IRAM. Some ideas for further improvements: - integrate III_overlap into III_imdct_l. - at the cost of accuracy, we could try changing D coefficients (used in synth_full) to use at most 24 bits. ARM multiplies faster when some of the most significant bytes (bytes, not bits) of the last operand are 0. |
This task depends upon
Closed by Dave Chapman (linuxstb)
Saturday, 28 July 2007, 17:21 GMT+2
Reason for closing: Accepted
Additional comments about closing: Finally committed to SVN - thanks.
Saturday, 28 July 2007, 17:21 GMT+2
Reason for closing: Accepted
Additional comments about closing: Finally committed to SVN - thanks.
great work.
I tested your patch on the Sansa with the following result:
~18% performance increase of the codec in 192kBit files
Some WAV output samples differ between the current and your patch.
Do you know, where this rounding error comes from?
Music playback
normal file type: mp3 214 kbps (VBR) 44100Hz stereo boost level: 48%
patched file type: mp3 214 kbps (VBR) 44100Hz stereo boost level: 36%
Audio book playback
normal file type: mp3 81kbps (VBR) 22050Hz mono boost level: 0%
patched file type: mp3 81kbps (VBR) 22050Hz mono boost level: 0%
synth.c: In function ‘synth_full’:
synth.c:1053: warning: unused variable ‘sb’
Current SVN decoded at 164% realtime.
With this patch applied - 175% realtime
With the two .S files and the synth_full function removed from IRAM - 183% realtime
Removing those functions from IRAM also means that mpegplayer compiles fine.
UNPATCHED BUILD:
128kbps MP3: 292.70% realtime
VBR MP3: 150.89% realtime
PATCHED WITH MPA.PATCH:
128kbps MP3: 331.01% realtime
VBR MP3: 169.95% realtime
PATCHED AND REMOVED IRAM:
128kbps MP3: 345.93% realtime
VBR MP3: 180.56% realtime
Both MP3 files were about four minutes in length. These tests were done on an iriver H10. For me, mpegplayer did not compile after I removed the two .S files from IRAM. Attached is the patch file with the stuff removed from IRAM for those interested. I remember someone saying on IRC that we could also get mpegplayer to compile if we added a special conditional for mpegplayer so that it wouldn't use the IRAM changes. However, I have no idea how to do this, so I'll leave it to someone else...
128kbps MP3: 345.93% realtime
VBR MP3: 180.73% realtime
So it seems to be about the same. Attached is the patch with the modifications linuxstb did.
Song: 193,12s, 192kBit/s
Recent SVN: 117,79% (163,94s)
MPA Patch: 154,50% (124,99s)
MPA no IRAM: 130,19% (148,33s)
Forgot to test a VBR mp3. I can do a test with one in a few hours if needed.
Is there something else holding up this patch?
I've also been listening to a my albums for the last couple days and not noticed any issues. Unless anyone else has objections, perhaps we could commit this patch and see if any problems are reported?