• Status Closed
  • Percent Complete
  • Task Type Patches
  • Category Codecs
  • Assigned To No-one
  • 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 saratoga - 2008-07-06
Last edited by saratoga - 2008-07-18

FS#9160 - Use Tremor IMDCT for WMA

The Tremor IMDCT is much, much faster then the WMA (and almost certainly the FAAD) one. This patch copies the Tremor IMDCT over to libwma with minor changes to remove it’s connection to Vorbis.

The resulting decoder sounds correct on the Sim and ARM, while being 4MHz faster on PP5024.

I have not tested it on Coldfire, but expect some speedup and hopefully no reduction in quality.

Closed by  saratoga
2008-07-18 01:24
Reason for closing:  Accepted

Coldfire results from IRC:

<PaulJam> saratoga: without the patch: 249,25% and with the patch: 298,75%
<PaulJam> saratoga: 128kbps (it is one of the windows example music songs)

Also, updated patch to not produce a warning. Output should be identical. If no one finds any glitches, I will try to clean this up and commit it sometime this week or next, then look into adding it to AAC.

Have you actually tested to see if the output is identical?


i just used the “write WAV” functionality of the test_codec plugin and did an ABX test using Foobar2000 to compare the output with and without the patch.
And the volume of the output with the patch applied is noticeably lower in direct comparison to the output without the patch.

Sounds like a wrong fixed point format is used somewhere.

Heres an updated patch.

Gives me more or less identical output (←140dB RMS error) meaning that resolution remains well above 16 bits. We probably lost a bit of accuracy since the fixed point format in Tremor and libwma are mismatched, but I don’t see much sense in rewriting the IMDCT in ARM ASM just to save some accuracy above the 16th bit.

However, this does not rule out the possibility of clipping on loud samples, so any testing is appreciated.

Edit: Sorry, patch had some other junk in it related to Tremor. Should be fixed now.

From what I’ve read, an FFT-based IMDCT would be even faster, and that is what FAAD uses, as far as I can tell (though it might not be well optimized for our targets). Wouldn’t it be better to try to optimize and use that one? Still, a nice speed-up for WMA.

The old IMDCT was also FFT based, but substantially slower then the Tremor one even ignoring ASM optimization. A faster FFT algorithm that was optimized for the minimum number of multiplies at the expense of adds would have been faster, but I don’t know how much so. Unfortunately, few fixed point FFT implementations exist, and designing fast ones is a nontrivial task.

Regarding choice of algorithm, I’ve actually seen claims that both methods are fastest, so I tend to think there is not a huge difference.

Corrected lowered volume on files using noise coding.
Removed some unneeded fixed point functions left over from the ffmpeg imdct.

I would say → go for svn. Because

a) the speed increase is significant
b) it seems you already measured a very low RMS error
c) you won’t get much feedback on possible errors here

Good job!

Go for it!


Available keyboard shortcuts


Task Details

Task Editing