News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

GIF Decoder Crashes

Started by localmotion34, May 24, 2007, 09:10:32 PM

Previous topic - Next topic

localmotion34

I have the source from Exagones' GIFLIB, and I compiled it to a static lib.  I linked it with a simple EXE to decode the GIF, and display it on the window.  It works with alot of GIFs, but i noticed it started crashing with a certain few, with no discernable pattern of what application encoded them.  i have included the GIFLIB source as written by Exagone, and the example EXE which crashes. 

Can anyone figure out why this LIB crashes with certain GIFs?  or does anyone have source for an actual GIF decoder, and not just OLE or GDI/Ipicture implementations?

QuoteGIFLIB is no longer available!

Due to the patents on the LZW compression that GIF uses, I can no longer supply GIFLIB or it's source. It might return in 2004 (when the patent expires) but I can't promise anything.

As an alternative, you can use Ernest Murphy's tutorial on pictures objects which shows you how to display GIF and JPG's using functionality built into Windows. For a completely patent-free and higher quality solution, try my PNGlib (see elsewhere on this download page). If you mirror a copy of GIFLIB, please remove it from your site as well.
Sorry for any inconvenience...


<Edit by P1>According to the instructions of the Author, this code is not to be mirrorred.
I have e-mail Thomas for him to post his code, seeing the copyright has expired.
Explicit Permission has been given by Thomas now.  See post below.</Edit>


[attachment deleted by admin]

P1

Is KYKLOS.GIF a gif which will crash the library?

Regards,  P1   :8)

localmotion34

yes, that GIF crashed the LIB. 

BTW, John Found translated this source to FASM for the FreshIDE, which is publically available on many sites.  I actually emailed Thomas a while ago, and he had said that the LIB was still available on a few sites and it was not an issue because all patents had expired. 

P1

Back at the ranch ....

I am hoping Thomas would release current library code with permission.  And maybe fix your problem, without needing to debug this code.

Does this behavior demonstrate itself across different machines with different OSes?

Could you post your test.asm please?

Regards,  P1   :8)

raymond

Havew you tried the GIF decoder from the library in the following thread:

http://www.masm32.com/board/index.php?topic=4266.0

The link to download the library still works. It comes with a Help file.

Raymond
When you assume something, you risk being wrong half the time
http://www.ray.masmcode.com

localmotion34

Quote from: raymond on May 25, 2007, 03:35:37 AM
Havew you tried the GIF decoder from the library in the following thread:

http://www.masm32.com/board/index.php?topic=4266.0

The link to download the library still works. It comes with a Help file.

Raymond


That decoder does not work with hardly any GIFs i have.  The result from the return of LoadGIF is mostly 0.  It really only works with smaller optimized GIFs around 200x100. 

P1

This library was written to handle flat ( non-animated ) gifs.

Here is some assembler code for GIF89a:
http://www.codeproject.com/useritems/anigif.asp

Regards,  P1   :8)

localmotion34

Quote from: raymond on May 25, 2007, 03:35:37 AM
Havew you tried the GIF decoder from the library in the following thread:

http://www.masm32.com/board/index.php?topic=4266.0

The link to download the library still works. It comes with a Help file.

Raymond


@Raymond

Does your GIF decoder use the OLE or IPicture?  or did you code a native GIF decoder yourself?

@P1  Exagone's GIFLIB can decode animated GIFs, but it only renders the FIRST frame.  It is just hit or miss whether it will render a still or animated first frame.  i can't figure out WHY a random GIF crashes it.  It i could, then i could recompile the static lib and move on to working on an encoder. 

raymond

QuoteDoes your GIF decoder use the OLE or IPicture?  or did you code a native GIF decoder yourself?

I encoded myself that GIF decoder. However, it may decode only the first picture of animated GIFs. Could you provide some of those GIF files which are problematic so I may have a look at why they may not be rendered?

Raymond

When you assume something, you risk being wrong half the time
http://www.ray.masmcode.com

localmotion34

Here are the GIFs.  The one of me and my Doberman was saved in Photoshop, and the other was created i think in CorelPaint, which is Animated. 

I have some C sourcecode that successfully loads both the animated and static ones here, but it then crashes due to an unknown memory error. 

I really cant find any code out there that doesnt crash at some point or another.  my own attemtps at a GIF decoder are feeble at best.  Im looking to study a decoder that is always successful, and then learn from that.  i did the same thing with the PCX format, and it worked very well.  Then i was able to write and encoder, with some additional help.  I want to repeat this again, and write a GIF encoder.  I think Zcoder posted here and in the ASM community he wrote a GIF encoder/decoder, but i cant find those sources anywhere. 

i have seen your RFimage linked from another forum, and it works so well with bitmaps and JPEGS.  i think GIF can be really nasty sometimes, like PCX can be with 6 different variaitons. 

but thanks for your help, very much!!

[attachment deleted by admin]

Grincheux

I took your Gifs and loaded them with I-View there is no problem.
http://i-view.idcat39.com/download.html

I use the GFL SDK version 2.54

I-View is a free software. You can download it source code with the GFL DSK for MASM.
Kenavo

Grincheux
_____________________________________________________
http://www.phrio.biz

P1

QuoteMy site has not been updated for some years so there is some old stuff on there. GIFLIB can be used again, although I strongly recommend the much better PNG library on my website. But if you really need GIF I guess that's of no help. I've placed a note on the frontpage of my website with a link to the GIFLIB on Iczelion's site, which never removed it. However that site is down now too. A mirror is available
here: http://win32assembly.online.fr/source1.html

It's no problem to redistribute the library, post it wherever you like.
Also, ignore the GPL license attached with it. Just use it in any way you want. But again, if you can also use PNGs, try my PNG library.

Regards,
Thomas
Download will be restored.

Regards,  P1   :8)

localmotion34

Ok, so now we know we can use the library. 

LMAO, he seems to not like GIF, eh? 

So the original question:

What the heck is causing the LIB to crash?  i have debugged an EXE linked with the LIB, and the GIFdecompress procedure is where it is dying, ALTHOUGH, it is variable WHERE in the procedure it is crashing. 

Depending on the GIF, it will crash in the LZW decompression, or in creating the color table.  Any ideas?

raymond

I've been away for a few days but I had a quick glance at your GIF files before I left home. It would seem that those GIF images may not fully respect the GIF encoding rules. But, some decoders may disregard some of the rules and thus succeed in rendering those images.

I'll have a more detailed look at it when I get back home tomorrow and then report my results.

Raymond
When you assume something, you risk being wrong half the time
http://www.ray.masmcode.com

raymond

I may have jumped to conclusion too fast. Those GIF files you provided do not seem to stray from the encoding rules as far as my library goes. The image viewer which I wrote to use that library displays those two files correctly. And, just in case it may have been using a version of the library more recent than the one you downloaded, I recompiled my viewer with that specific library; and it still renders those images correctly.

I'm attaching that viewer. Let me know if it renders those two GIF files on your system. If it does, there may be some other reason(s) for the problem.

Raymond

P.S. Don't worry about the name of the app. This was (and still is) in the development stage. It is designed to render JPGs, BMPs and GIFs.


[attachment deleted by admin]
When you assume something, you risk being wrong half the time
http://www.ray.masmcode.com