Shop OBEX P1 Docs P2 Docs Learn Events
MP3 decode is hard! — Parallax Forums

MP3 decode is hard!

RaymanRayman Posts: 14,162
edited 2008-01-03 02:43 in Propeller 1
I started looking at MP3 decoding and found it to be about 100X more complicated than I thought.· Still, I found a paper saying something to the effect that real-time playback is possible with 48 MIPS, 18kB program space, 9kB coefficient space and 22kB stack space...· So, I guess it's plausible to have a Prop based MP3 player, but it will probably use all the cogs and all the memory.

I'm looking at the inner workings of Libmad right now...

Comments

  • deSilvadeSilva Posts: 2,967
    edited 2007-12-28 21:08
    Well it is as compliccated as *I* thought smile.gif I think it will be very educative
    to look into the inner working, however the algorithm(s) used are very advanced. I should doubt that the Propeller can work it. You need about 50kB memory and 50 MIPS. The Propeller I has half of both
  • AleAle Posts: 2,363
    edited 2007-12-28 21:11
    Rayman: Some time ago I thought that vorbis playing was useful, I am really bothered about the patent issue with mp3. Sadly vorbis requires a bit more processing than mp3 :-(
    There are all-integer implementations, for instance in mplayer and in xine. Maybe one of those could be useful. OTOH a mp3 player IC does not cost that much, but has its limitations. That is what I'd call ... a challenge. Good luck !

    Edit: The propeller has more MIPS, but less memory. A multithreded decoding would be really neat stuff, some real piece of engineering.
  • deSilvadeSilva Posts: 2,967
    edited 2007-12-28 21:36
    Upto now I have seen no useful synthetic benchmarks for the Propeller. Natural benchmarks depend on the kind of application. A 16 bit unsigned multiplication takes around 2.5 µs, which will be 0.4 MIPS; do it in 6 COGS you get 2.4 MIPS - if you hace 10% of multiplications in your core algorithm you come to 24 MIPS - that was the basis of MY calculation smile.gif
  • AleAle Posts: 2,363
    edited 2007-12-29 07:52
    you are right deSilva, A thorough analysis of some <format> source code would yield what is needed. I think a 486 DX4 100 was able to play mp3... and that machine had hardly 50 MIPS...
  • RaymanRayman Posts: 14,162
    edited 2007-12-29 08:43
    But it also had a math coprocessor...
  • Paul BakerPaul Baker Posts: 6,351
    edited 2007-12-29 09:33
    mp3 playback is possible, it just depends on how many cogs you are willing to throw at it, each cog can operate on a frame and place the decoded information into a corresponding playback buffer that a playback cog will cycle through.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
  • AleAle Posts: 2,363
    edited 2007-12-29 09:51
    I forgot smile.gif
  • deSilvadeSilva Posts: 2,967
    edited 2007-12-29 11:15
    I not smile.gif I took 6 COGs for my estimation.
    I see the main issue in the missing multiplication instruction. This is normally the bottleneck for all signal processing. The LIBMAD may use many tables but access to them needs indexing and interpolation as well. I am really excited what Rayman will find out!

    The math coprocesor of the 486 was not the fastest, but using floating point can simplify algorithms considerably.... And it worked "in parallel"

    It all depends on the structure of the core algorithm.. There is a thing called Amdahl's law which tricked me many times when I worked with speeding up programs for vector processors, many many years ago smile.gif
  • Ym2413aYm2413a Posts: 630
    edited 2007-12-29 21:52
    Interesting! [noparse]:)[/noparse]
    MP3 isn't a walk in the park for most microcontrollers.
    There are other compression formats that are easier to decode, but then again I guess that would be missing the point.
  • kittmasterkittmaster Posts: 77
    edited 2007-12-29 23:59
    Figures......MP3 is really much more compact.....would be cool if it could be made to work.

    What about a slave prop and a master.......? dedicated MP3 decoding?.....
  • Ym2413aYm2413a Posts: 630
    edited 2007-12-30 18:45
    kittmaster said...

    What about a slave prop and a master.......? dedicated MP3 decoding?.....

    I think that would miss the point also, other then proof of concept maybe...
    Since there are cheap MP3 decoder ICs out there.

    What would be nice is if MP3 could be done with some resources left over. Then that would be an useful object. [noparse];)[/noparse]
    Single chip MP3 player/jukebox anyone?

    Really the Prop would do a better job decodering some other forms of audio compression, but the thing with MP3 is that it is so widely supported and the fact that it is used on other platforms. [noparse]:)[/noparse]
  • VIRANDVIRAND Posts: 656
    edited 2008-01-03 02:43
    It's possible, but just out of my reach. I tried to build a portable mp3 player before they existed in stores.
    It barely worked but I got stuck on the Fourier Modified Discrete Cosine Transforms. Need more brains!!!
    The prop has a SINE table which is useful in this app, and somehow can be used for fast multiplication too.
    The Propeller is also a little bit faster than the first windows PC's that could play MP3's!
    Behold, the prop can synthesize up to 8 wideband broadcast frequency TV channels! (and singing monks too!)
    What can't it do with snail-paced audio frequencies?
Sign In or Register to comment.