2010.12.14 17:55 "[Tiff] patch to tif_jpeg.c", by Dwight Kelly

2011.01.26 04:50 "Re: [Tiff] Cannot read YCbCr JPEG-compressed images", by Bob Friesenhahn

On Mon, 24 Jan 2011, Craig Bruce wrote:

JPEGDecodeRaw: application buffer not large enough for all data..

ERROR!

The behaviour is consistent across a couple different versions of Fedora- built and personally-build libtiffs. Is there some special libtiff configuration needed to make YCbCr/JPEG reading work properly? I need to use a custom-built libtiff.

The bug you are reporting has been reported several times before. Please let us know if you find a correct fix.

The reason why our readers are working is because we tell libtiff to use JPEGCOLORMODE_RGB like:

(void) TIFFSetField( tiff, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RGB );

And then libjpeg helps by returning upsampled RGB data to libtiff using reader code designed for PHOTOMETRIC_RGB.

If your software really was capable of dealing with all of the nuances associated with YCbCr (filtering, subsampling, etc.) then you would probably prefer to deal directly with it. Very little software in the TIFF world is currently capable of doing that. Horizontal sampling is not too bad to deal with, but things become more complex when vertical sampling is added. JPEG samples in an 8x8 or 16x16 tile size.

Bob
--
Bob Friesenhahn
bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer, http://www.GraphicsMagick.org/