Patch for JPEG Loading in SDL_image

Hopefully this one will get more attention than my last patch. :wink:

This fixes the JPEG detection routine in SDL_image such that it should
be able to detect any JPEG file, JFIF or not. It does this by parsing
the headers and tags, rather than expecting specific ones in order with
no gaps.

This also enables it to load raw 32-bit JPEG files, with an alpha
channel. While not defined specifically in the JPEG spec (as far as I
know), this is the format used internally by the .blp files in some of
Blizzard’s recent titles. It detects this from the JPEG itself, and
should not cause any problems with any normal JPEGs that were loadable
previously (in fact, it should make more of them loadable).

I’ve tested it on both little and big endian and on just about every
kind of file I can find. So far, it has worked perfectly in every case.
I’ve also tested it with a number of .blp files and it works great.
Note that .blp is NOT really an image format, so this won’t load them
straight up. You have to process them a bit before you can load them as
JPEGs. Once you do that (and it’s trivial), this patch makes SDL_image
load them fine.

Comments?–
Steaphan Greene
GPG public key: http://www.cs.binghamton.edu/~sgreene/gpg.key.txt
-------------- next part --------------
A non-text attachment was scrubbed…
Name: SDL-image-sgreene-jpeg-detect-1.0.patch.gz
Type: application/octet-stream
Size: 1723 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20060410/937374e1/attachment.obj
-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20060410/937374e1/attachment.pgp

Not to be a pain - I really appreciate all you guys do in the creation
and support of SDL - but is there any word on this at all?

If it will not be incorporated, please let me know so I know I will have
to work around these problems myself in my current project. If there is
a problem with it, let me know, and I will try to fix it.

(If you’re wondering why my last message had a bad PGP sig, mailman
wraps mime-attachment headers, which were part of my signed message,
this one should sign fine).On Mon, Apr 10, 2006 at 08:29:17AM -0400, Stea Greene wrote:

This fixes the JPEG detection routine in SDL_image such that it should
be able to detect any JPEG file, JFIF or not. It does this by parsing
the headers and tags, rather than expecting specific ones in order with
no gaps.

This also enables it to load raw 32-bit JPEG files, with an alpha
channel. While not defined specifically in the JPEG spec (as far as I
know), this is the format used internally by the .blp files in some of
Blizzard’s recent titles. It detects this from the JPEG itself, and
should not cause any problems with any normal JPEGs that were loadable
previously (in fact, it should make more of them loadable).

I’ve tested it on both little and big endian and on just about every
kind of file I can find. So far, it has worked perfectly in every case.
I’ve also tested it with a number of .blp files and it works great.
Note that .blp is NOT really an image format, so this won’t load them
straight up. You have to process them a bit before you can load them as
JPEGs. Once you do that (and it’s trivial), this patch makes SDL_image
load them fine.


Steaphan Greene
GPG public key: http://www.cs.binghamton.edu/~sgreene/gpg.key.txt
-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20060418/5d315cdf/attachment.pgp

This fixes the JPEG detection routine in SDL_image such that it should
be able to detect any JPEG file, JFIF or not. It does this by parsing
the headers and tags, rather than expecting specific ones in order with
no gaps.

Thanks! Your patch is in CVS.

-Sam Lantinga, Senior Software Engineer, Blizzard Entertainment

Great. Thank you (for all you do for all of us leeches on SDL).On Thu, Apr 20, 2006 at 09:53:06AM -0700, Sam Lantinga wrote:

This fixes the JPEG detection routine in SDL_image such that it should
be able to detect any JPEG file, JFIF or not. It does this by parsing
the headers and tags, rather than expecting specific ones in order with
no gaps.

Thanks! Your patch is in CVS.


Steaphan Greene
GPG public key: http://www.cs.binghamton.edu/~sgreene/gpg.key.txt
-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20060420/11943d5d/attachment.pgp

Great. Thank you (for all you do for all of us leeches on SDL).

My pleasure. :slight_smile:

-Sam Lantinga, Senior Software Engineer, Blizzard Entertainment