FS#5078 - erformance improvements in libmad mp3 decoder

Attached to Project: Rockbox
Opened by Toni (ahellmann) - Sunday, 09 April 2006, 19:44 GMT
Task Type Patches
Category Codecs
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


This patch improves the performance of the libmad mp3 decoder by roughly 10% (measured on "lame --preset extreme" encoded music) with exactly the same pcm output as before. I could only test the improvements with iriver, but these should be effective also for other swcodec based players.
Warning: The patch has been compiled only for iriver.

The changes in detail:
- move huffman tables to IRAM
- move cs- & ca- tables to IRAM
- improved cache hit decision in 'big values' calculation
- bit structures in rq_table removed

The data extraction part in libmad still takes nearly 25% of the decoder time, so the next patch is in work. :) (215.2 KiB)
This task depends upon

Closed by  Thom Johansen (preglow)
Tuesday, 11 April 2006, 23:29 GMT
Reason for closing:  Accepted
Comment by Brandon Low (lostlogic) - Sunday, 09 April 2006, 21:04 GMT
This looks good, I don't know libmad well enough to apply or not apply it. Did you use profiling to conclude where time is being spent, or another method?

Comment by Toni (ahellmann) - Monday, 10 April 2006, 15:29 GMT
I created a plugin from the existing libmad codec and configured iriver TIMER1 for internal plugin usage.
I did manually measure the following functions, which cover 90% of the madlib runtime (assuming that reading
the timer register does not take reasonable time):
(1) III_huffdecode
(2) III_aliasreduce
(3) III_imdct
(4) III_overlap
(5) mad_synthframe
The result on "lame --preset extreme" encoded file:
improved current
(0) 0x24A 0x2EC
(1) 0x00E 0x00E
(2) 0x065 0x0E1
(3) 0x276 0x27A
(4) 0x005 0x005
(5) 0x3AD 0x3AF