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 > load gif image

#171717 - lorenicka - Wed Dec 16, 2009 5:42 pm

Hello
I've a program that gets a jpg image sended as a stream by wifi and displays it in the screen thanks to the library gba-jpeg-decode.
I would like to know if there is a library that allows me to do the same but with a GIF file. I mean, receive a GIF while executing and be able to display like the background of a screen.
thanks

#171718 - azaydius - Thu Dec 17, 2009 7:28 am

The .gif image format is actually copyrighted I believe, so something like that may be illegal. Not 100% sure though.
_________________
fileNinja - https://sourceforge.net/projects/fileninja/

#171719 - Dwedit - Thu Dec 17, 2009 7:32 am

GIF's issue was that it used a compression scheme protected by Patent.
The patent has expired.
But why do you specifically need a GIF file?
_________________
"We are merely sprites that dance at the beck and call of our button pressing overlord."

#171720 - lorenicka - Thu Dec 17, 2009 9:08 am

Because the GIF format is smaller than the JPG and I need to send the less possible data, so it's faster.

#171721 - SteveH - Thu Dec 17, 2009 9:35 am

Roll your own gif file reader, the format is easy to understand and if your really lucky you may be able to use the lz compression / decompression code that's in the NDS's BIOS to decompress the image.

#171722 - sverx - Thu Dec 17, 2009 9:40 am

Consider PNGs too :)

#171723 - Miked0801 - Thu Dec 17, 2009 5:48 pm

GIF is not smaller than JPG. JPG can always beat Gif when going lossy.

#171731 - lorenicka - Thu Dec 17, 2009 8:48 pm

PNGs are bigger and JPG can be smaller buy loosing a lot of quality...

Maybe it is possible to use a normal c++ function to decode the gif? The DS would handle it?

#171733 - vuurrobin - Thu Dec 17, 2009 11:18 pm

there is a png and a jpg library in the devkitPro portlibs directory on sourceforge:

http://sourceforge.net/projects/devkitpro/files/portlibs/

I'm pretty sure there is an gif library somewhere that can be ported to the ds.


you might also check the speedgain of sending less data versus the speedloss of decompressing the images to a format that the ds can use.

you could also convert the images to a ds friendly format and compress them with a compression algorithm that the ds bios routines have. that way, you can send pretty small data, decompress them with the ds bios routines and then directly copy it to vram without converting the image to something ds friendly at runtime.
_________________
my blog:
http://vuurrobin.100webcustomers.com/

#172109 - josath - Fri Jan 15, 2010 10:38 pm

In my experience, a PNG is always smaller than a GIF, when using the same settings. Especially if you optimize the PNG with something like PNGOUT, which reduces size even more, without losing any quality.

People sometimes get confused and compare an 8-bit color GIF to a 24-bit color PNG, and think that GIF is better. But if you compared an 8-bit color GIF to an 8-bit color PNG, you'd see PNG was better.

#172136 - Quirky - Mon Jan 18, 2010 3:53 am

Use giflib. It compiles for the DS without modifications:

http://sourceforge.net/projects/giflib/files/