Small JPEG Decoder Library
Copyright © 1994-2000 Rich Geldreich (


The Small JPEG Decoder Library is a C++ library that can decode the most common types of JPEG images. It's not the most full-featured JPEG library available, but it's relatively fast, completely free with full source code (LGPL license), uses little memory, and should be easy to understand and further optimize. The very common Huffman DCT-based sequential and progressive modes of operation are supported.

This library only handles JPEG decompression, upsampling, and colorspace conversion. It does not handle pixel format conversion, quantization, dithering, etc.

If your application's input set is limited in some way (say, you're making a game or some other app that has prepared resources), this library may suite your needs. This library may also prove useful to those that want to read JPEG images on very small 32-bit platforms or embedded devices.

v0.93b (Dec. 28, 2001) may be downloaded below. The file "readme.txt" contains more information about the library, its history, etc.



Known Problems

The MMX specific code in h2v2.cpp does not round and, in general, is not as precise as it should be. The output G component suffers the worst. I might rewrite this code again-- there's way too much unpacking/packing/shifting going on anyway.

Download (79k) Tweaked YCbCr to RGB lookup tables to improve grayscale pixel conversion quality.

readme.txt (8k) Readme file from archive.

Previous Versions (79k) Fixed a dumb bug in the decode_next_row functions that could allow non-zero coefficients from leaking through in rare cases. (298k) MMX state saved/restored around calls to the decoder stream's read() method, added some defines to ease porting to non-x86 platforms. (323k) Much faster. Still needs a lot of testing because there's a lot more assembler and MMX specific code. (290k) Added warning about the MMX IDCT bug, added free(Pbuf); to jpg2tga.cpp, fixed workspace so the lib header files can be found, changed comments a bit.