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 > Compression on DS

#45960 - headspin - Fri Jun 17, 2005 7:03 am

Just have a few questions about using compression on DS..

1. DS has built in ADPCM playback, right? So how can one do this.

2. Is DS ADPCM format generic, eg. same as Tepples 8ad (www.pineight.com/gba/) or sox (sox.sourceforge.net) ADPCM output? In other words can I use these conversion programs to create compatible ADPCM format audio for DS or does someone have to build specific convertor for DS.

3. How about GSM playback? Has anyone got Tepples code working for DS yet?

4. Anyone have a JPEG decompressor jpg ->VRAM (BGR15) available?

5. What other image decompression routines BIOS or otherwise are there (same as GBA? Diff/Huff/RL/lz77).

Is it as easy as GBA BIOS unpack routines? Can ARM9 use them? Can I use GBACrusher to compress? Anyone have some examples I can borrow, or know a demo with source that uses compression for gfx/audio?

Thanks for any help on this.
_________________
Warhawk DS | Manic Miner: The Lost Levels | The Detective Game

#45963 - newbiecoders - Fri Jun 17, 2005 9:10 am

I second that question. With the 4meg EWRAM limit this is exactly what I need to keep the catridge size down. I look forward to your replies!

#45967 - Mollusk - Fri Jun 17, 2005 10:49 am

Check out this link http://members.iinet.net.au/~freeaxs/gbacomp/ for image compression... it's for gba, but should work on DS I guess.

#45969 - headspin - Fri Jun 17, 2005 11:21 am

Yeah thanks, I wrote that ;) I just want to see if anyone is already using compression with DS that can give some advice before I go ahead with my own research. It would be nice to hear what experience coders have with using it on the DS.
_________________
Warhawk DS | Manic Miner: The Lost Levels | The Detective Game

#45974 - headspin - Fri Jun 17, 2005 1:02 pm

Ok, just got JPEG decompressor from my GBA compression site to work on DS with a few slight modifications.
_________________
Warhawk DS | Manic Miner: The Lost Levels | The Detective Game

#45975 - Mollusk - Fri Jun 17, 2005 1:04 pm

Oh, very interesting ! What modifications ?

#45977 - headspin - Fri Jun 17, 2005 1:31 pm

Download the modified library from http://headkaze.webpal.info/ . The readme.txt explains the modifications.
_________________
Warhawk DS | Manic Miner: The Lost Levels | The Detective Game

#45979 - Mollusk - Fri Jun 17, 2005 1:34 pm

Thanks, I'll try that out now :p

#45982 - headspin - Fri Jun 17, 2005 2:13 pm

I've added an NDSLib JPEG example based on Dovoto's code.
_________________
Warhawk DS | Manic Miner: The Lost Levels | The Detective Game

#45986 - Mollusk - Fri Jun 17, 2005 3:50 pm

Headspin, stupid me ! I just saw YOU had posted this topic... Next time I'll check out who asks before giving links :p

#45987 - tepples - Fri Jun 17, 2005 3:52 pm

There's IMA ADPCM, there's 8ad, and then there's Nintendo's proprietary format. IMA ADPCM is the standard format. 8ad is a minor variation on IMA ADPCM with a different quantization table and different step-size-change tables, both modified to help alleviate the slope overload problem that I found when testing IMA ADPCM with music. They're not bitstream compatible, but the 8ad decoder can be recompiled to decode IMA ADPCM.

The big differences between basic ADPCM (IMA, 8ad, etc) and LPC (GSM Full Rate, Speex, etc) are as follows:
  • ADPCM uses a static predictor, pred[n] = output[n + 1]. LPC uses a more accurate short-term predictor of the next sample based on a weighted sum of the previous 8-16 samples; most implementations also use "long term prediction" that adds an additional term several dozen samples backward, useful for speech or for consonant harmony.
  • ADPCM most often uses a simple uniform or Lloyd-Max quantization of the samples. The better predictor allows LPC to use "trickier" methods; for example, GSM Full Rate stores only every third sample ("regular pulse excitation"), and Speex keeps a "code book" of various patterns, each several samples in length.

With the extra CPU power of the Nintendo DS, you could probably run two GSM Full Rate decoders at 32 kHz each, for nearly CD quality stereo, but that won't be very useful until the GBA Movie Player (or some other storage medium larger than 32 MB) is fully cracked.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#46050 - dovoto - Sat Jun 18, 2005 10:42 pm

Quote:
There's IMA ADPCM, there's 8ad, and then there's Nintendo's proprietary format.


Have the ADPCM capabilities on DS been verified to be proprietary? This is the first I have heard of it but have not looked too deep.


As to compression I believe the bios (arm9 and arm7) still supports the GBA compression rutiens. THere is also a built in texture compression type for which i have some display code (but no compression code).
_________________
www.drunkencoders.com

#46265 - LunarCrisis - Wed Jun 22, 2005 4:06 pm

Is there info on the compressed texture format so that others could write compression code, or does that still have to be reverse-engineered?
_________________
If a tree falls in the forest and no one is there to hear it, why the heck do you care?

#46266 - dovoto - Wed Jun 22, 2005 4:27 pm

Someone allready did some work on the format using the metroid demo...they were able to decompress the textures but compression is a bit harder. I will find out if he minds me sharing his code (I assume he will not) then I will post it.
_________________
www.drunkencoders.com