gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > 2 MP3 Streams

#121115 - DVSoftware - Fri Mar 09, 2007 2:56 am

Hello,
Is it possible to decode 2 64kbps mono mp3 streams on ARM7 with helix, or should i seek another codec for my needs?

#121120 - Firon - Fri Mar 09, 2007 4:24 am

The ARM7 only has enough CPU power to decode one MP3 stream.

#121122 - tepples - Fri Mar 09, 2007 4:34 am

But if it can decode a 2-channel MP3 stream in real time, why can't it decode two 1-channel MP3 streams in real time?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#121127 - Firon - Fri Mar 09, 2007 7:41 am

Can it? I don't remember it being able to... I could've sworn simon only got it decoding a 2-channel stream on the ARM9.

#121132 - simonjhall - Fri Mar 09, 2007 10:26 am

I don't reckon you'd be able to play two mono 64kbps streams on the ARM7 - I couldn't even get it to do stereo!

Either that decoder isn't good enough or the processor ain't up to the task.
However Helix is tiny hence why I'm using it. I couldn't fit anything else in the 96k!

The ARM9 has more than enough grunt to do what you want though.
_________________
Big thanks to everyone who donated for Quake2

#121137 - DVSoftware - Fri Mar 09, 2007 11:55 am

i know that arm9 can do it, but game needs to run, too
i'm creating some music game, and i need to play 2 streams :/

according to helix community, ARM7 should be able to decode 320kbps 48khz stream using 30 mhz...
have you compiled it with fixed point define?

Edit:
can you suggest some less cpu intensive codec, that can be used on nintendo ds, and that can compress one song to less than 5 mb?

Edit #2:
Real audio might be an answer
https://datatype.helixcommunity.org/ra8fixpt

#121138 - simonjhall - Fri Mar 09, 2007 12:15 pm

320kbps? No chance! The figures quoted on that site are misleading. For instance, it assumes certain things about memory access times.

I'm using the fixed-point ARM-asm optimised build but I still get low performance. I reckon that the performance is funky due to the lack of data cache. I'll try again this weekend if you like, in case I'm doing something wrong...

On the other hand, the ARM9 which does have a data cache doesn't do that much better - it's only about twice as fast (which is in line with the increase in clock speed).
_________________
Big thanks to everyone who donated for Quake2

#121142 - OOPMan - Fri Mar 09, 2007 1:40 pm

Yeah, what Simon said...

I'm pretty sure the Helix site is a little more specific than just saying "ARM7, 320kbps, 48khz, 30mhz"

ARM are not like PC CPUs. They don't tend to come package as separate things that can be dropped into a motherboard.

They usually come in the form of highly embedded SOCs with wildly varying features when it comes to things cache, etc...

So blanket statements about Helix on ARMs are silly, because the ARM line is a very very very diverse thing...
_________________
"My boot, your face..." - Attributed to OOPMan, Emperor of Eroticon VI

You can find my NDS homebrew projects here...

#121145 - tepples - Fri Mar 09, 2007 2:43 pm

DVSoftware wrote:
can you suggest some less cpu intensive codec, that can be used on nintendo ds, and that can compress one song to less than 5 mb?

One song of how long? And do you need higher fidelity than players of a handheld game expect? I've used GSM Full Rate on the Game Boy Advance, which is half as fast as the DS's ARM7. Others have had success with MP2.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#121150 - DVSoftware - Fri Mar 09, 2007 3:22 pm

Approx. 3 minute song.
I need it at least 22khz and quality that's equal or better to 64kbits mp3.

#121178 - silent_code - Fri Mar 09, 2007 10:19 pm

OOPMan wrote:
ARM are not like PC CPUs. They don't tend to come package as separate things that can be dropped into a motherboard. They usually come in the form of highly embedded SOCs with wildly varying features when it comes to things cache, etc...


that's right!
(@ DVSoftware) and it's even worse: arm don't even sell cpus, they sell cpu architectures! (that's like blueprints.)
in the case of the nds' processors, nintendo bought the license, added some optional components they needed and then sent the whole thing to production by themselves (that's sort of a rush through the process, but you get the idea).
you can be certain, that two arm7 based cpus of two different devices will perform differntly and will have different features. take the gp32 as an example (that may be able to do the mp3 stuff you want, i guess).

it's kind of like with ibm's power pc cpus. you can't compare a gekko (gamecube) cpu to a xbox 360 cpu (core), though they are both based on the ppc architecture. even the cell cpu is a ppc "on the outside". afaik the same code will run on all these cpus (with none or minor changes), but perform very differently.

#121217 - Firon - Sat Mar 10, 2007 10:24 am

DVSoftware wrote:
Approx. 3 minute song.
I need it at least 22khz and quality that's equal or better to 64kbits mp3.

You could try looking into WavPack lossy using fast mode (-fx3). Assuming you resample the input before encoding to 32768Hz (or lower) and mono, you should have no problem decoding two streams on the ARM7.
You won't get 64kbit/s, but you can do pretty decent. I was doing 180kbps in 32768Hz stereo, so you could maybe get away with 100-120 per stream in mono. Less if you don't mind some additional hiss/roughness.

http://www.wavpack.com/downloads.html

#121232 - DVSoftware - Sat Mar 10, 2007 5:44 pm

interesting, can you direct me how can i use the decoder on ds?

#121279 - bsder - Sun Mar 11, 2007 1:24 am

If you can, you'd probably be better off going with the Tremor codec from Ogg Vorbis.

Ogg seems to require a little less CPU horsepower than MP3 as it trades some lookup tables for computation.

I don't know if you can fit the whole codec in 96K, though. I think you can fit the decoder, but there are some lookup tables you might need to stash in main memory.

#121431 - OOPMan - Mon Mar 12, 2007 11:49 am

simonjhall has treaded the path of Tremor on the ARM7 before bsder. Unfortunately, it's a little too bloated by his accounts to run nicely on the DS' ARM7...
_________________
"My boot, your face..." - Attributed to OOPMan, Emperor of Eroticon VI

You can find my NDS homebrew projects here...

#121522 - HyperHacker - Mon Mar 12, 2007 10:13 pm

Hm, OGG uses less CPU power than MP3? I always thought it was the opposite.
_________________
I'm a PSP hacker now, but I still <3 DS.

#121529 - simonjhall - Mon Mar 12, 2007 10:32 pm

Yeah, I couldn't fit tremor into the 64+32k of fast memory available to the ARM7. Yeah, I could have relocated it elsewhere in memory but 100k of memory is really hard to come by :-)
As a result I have no idea of what the performance is like. I'd imagine it being poor...

The reason I've decided on using MP3 over OGG (so far...) is because I can fit the Helix decoder, the DS wifi lib and a gallon of sound code into that same 96k. I can't fit printf/sprintf in there though :-(
_________________
Big thanks to everyone who donated for Quake2

#121534 - Lick - Mon Mar 12, 2007 10:47 pm

On the ARM9 OGG was much faster. Perhaps due to the fact that Tremor is an optimized library, where libmad is not.
_________________
http://licklick.wordpress.com

#121567 - HyperHacker - Tue Mar 13, 2007 5:10 am

What about for R4300? Is there a nice optimized OGG decoder for that, and/or does OGG need less CPU power than MP3 in general (not just one specific decoder)?
_________________
I'm a PSP hacker now, but I still <3 DS.

#121597 - OOPMan - Tue Mar 13, 2007 10:26 am

I always thought OGG generally had higher decoding requirements, being a more complex codec...

Maybe I'm wrong, though...
_________________
"My boot, your face..." - Attributed to OOPMan, Emperor of Eroticon VI

You can find my NDS homebrew projects here...