GP32 Loading A Gif


pea

developer
Joined
Oct 3, 2004
Messages
1,089
Age
46
Location
New Zealand
Website
www.projectitis.com
Hi all,

What's the method/package that you guys use to load and uncompress a gif (standard palette) into memory as a simple array of indices?

How do they reate in terms of speed/size?

Cheers,
Pea
 
to load a gif, use the gpgif lib
palette suxx for some img but it's work

i fix the lib to not crash on loading an animated gif, now it's load the first frame
i also made change to load the img into an 8 bit array (original load into a 16bit)

to see speed, load a gif with yAnl (it run at 33mhz, more faster at 66 or +)

source and binary of yAnl can be found here :
http://procvor.free.fr/yAnl_16days.rar
 
to load a gif, use the gpgif lib
palette suxx for some img but it's work

i fix the lib to not crash on loading an animated gif, now it's load the first frame
i also made change to load the img into an 8 bit array (original load into a 16bit)

to see speed, load a gif with yAnl (it run at 33mhz, more faster at 66 or +)

source and binary of yAnl can be found here :
http://procvor.free.fr/yAnl_16days.rar

if you have a 16bits version i would be happy ^^
 
Last edited by a moderator:
you can found the 16 bit version onto the aquafish page :)
http://egloo.fr.st/

but it will crash on loading an animated gif

it was crash due to the lib read an short at an unaligned address

the fix :

(*gif).width = (*fpt) + 256*(*(fpt+1)); fpt+=2 ;
(*gif).height = (*fpt) + 256*(*(fpt+1)); fpt+=2 ;

it's in the gifGetInfo routine.
 
Hi rov,

I dl and extracted your project and started converting libgif over to use MrMirkos SDK. I get a problem while compiling:

tGif structure has no member named 'pal'

This occurs in the function gifGetPalette. The line is:

Code:
gif->pal = (uint*)malloc(256*sizeof(uint));

In the .h file, the tGif struct indeed doesn't have a member named pal

Code:
typedef struct tGif{
	int width;	
	int height;
	short *imag;
	tGifWork *work;
}tGif;

Am I using the correct .h file (the one you said you modded) or the wrong one?

Cheers,
Pea
 
I think I got it. The definition of tGif was different within the .h file and within the .c file itself.

I'm just getting back in to c (I use mostly Delphi) but I thought that the .c file should reference the .h file and not redeclare the structs??
 
yet in fact in yAnl i not use the .h, only include the .c
i think the .h was got the original struc and i copy and change it in the .c
so, you can del the .h :)
 
Woohoo! Gif loading is working now with MrMirkos SDK. I also updated the gif function to be less prone to memory leaks (i.e. All malloc/free happens in same function) and added a function to destroy the gif after use.

Will upload the functions to my site within a few days....
 
Woohoo! Gif loading is working now with MrMirkos SDK. I also updated the gif function to be less prone to memory leaks (i.e. All malloc/free happens in same function) and added a function to destroy the gif after use.

Will upload the functions to my site within a few days....

I use PNG with all of my PC stuff, but GIF seems better since it's 8-bit paletted and still retains alpha (although not 255 levels of alpha like PNG).
 
Last edited by a moderator:
True, PNG is very cool. I looked at using PNG instead since I am using 16bit colour anyway. It doesn't seem that difficult, as there are a few libs out there that can be used, but in terms of easy code and small file size, I decided to use gif.

Having said that however, if someone does have a good PNG lib, I would be happy to have a look at it and maybe use it as well :)
 
Hia all,

I have discovered that there is a bug in the GIF code whereby the resulting colours are completely screwed up unless the palette has all 256 colours! For example, a GIF with only 12 colours will have random colours. I am trying to work on this, but does anyone have any idea as to why?

My code is based on that of aquafish (rov has a different version which uses 8bpp, mine uses 16bpp).

The code can be found here:
http://www.pea.co.nz/gp32/gpd_downloads.php
 
pea posted on Dec 18 2004 at 11:34 PM said:
Hia all,

I have discovered that there is a bug in the GIF code whereby the resulting colours are completely screwed up unless the palette has all 256 colours! For example, a GIF with only 12 colours will have random colours. I am trying to work on this, but does anyone have any idea as to why?

My code is based on that of aquafish (rov has a different version which uses 8bpp, mine uses 16bpp).

The code can be found here:
http://www.pea.co.nz/gp32/gpd_downloads.php

finally I had a look at your routines... I don't understand how do you check for transparency/alpha in the drawCanvas() thingy... Do you have an optimized memcpy() now?
 
Last edited by a moderator:
Sorry Synchro, my routine doesn't handle transparency (yet), nor have I got an optimised memcpy yet either.. the colour bug is the pain in the *ss that I am working on at the moment. Have been away over christmas, but will get stuck in again in a day or two
 
easy, pal! no need to hurry :) I was walking through your code and was wondering :) I like your GIF routine, I am now considering using it for V2 ... plamic provided a new memcpy in another thread... juts keep us updated :)
 
yeah, I saw that (re: asm memcpy). That's great. I can't wait to get stuck in. I have my computer with me on holiday, but I forgot the power leads :( So I'm off to buy some today.
 
Back
Top