| AWARE [SYSTEMS] | Imaging expertise for the Delphi developer | |||||||
![]() |
TIFF and LibTiff Mailing List Archive | |||||||
LibTiff Mailing List
TIFF and LibTiff Mailing List Archive Contact
The TIFF Mailing List Homepage |
Thread2011.01.04 02:44 "Re: Regression in libtiff 4.0 CVS when creating a JPEG RGB contig", by Lee HowardEven, Forgive the top-post, but I wanted to keep your reply to me intact for Dwight. I've made the change as suggested to both the 3.9 and HEAD (4.0) CVS branches. Dwight, If this does not work for you please communicate with Even to come up with a solution. Thanks, Lee. Even Rouault wrote: > Hi Lee, > > Happy New Year to begin with. Now, less funny things ;-) I've seen a > regression in GDAL (http://trac.osgeo.org/gdal/ticket/3887) that I tracked > down to be caused by the following change in libtiff : > > 2010-12-14 Lee Howard <faxguy@howardsilvan.com> > > * libtiff/tif_jpeg.c: reduce usage of JCS_UNKNOWN in order > to improve compatibility with various viewers > submitted by e-mail from Dwight Kelly <dkelly@apago.com> > > --- frmts/gtiff/libtiff/tif_jpeg.c.ok 2011-01-01 14:10:57.226381933 +0100 > +++ frmts/gtiff/libtiff/tif_jpeg.c 2011-01-01 14:11:06.736240426 +0100 > @@ -1701,8 +1701,15 @@ > sp->cinfo.c.comp_info[0].h_samp_factor = sp->h_sampling; > sp->cinfo.c.comp_info[0].v_samp_factor = sp->v_sampling; > } else { > - sp->cinfo.c.in_color_space = JCS_UNKNOWN; > - if (!TIFFjpeg_set_colorspace(sp, JCS_UNKNOWN)) > + if (td->td_photometric == PHOTOMETRIC_MINISWHITE || td- > >> td_photometric == PHOTOMETRIC_MINISBLACK) >> > + sp->cinfo.c.in_color_space = JCS_GRAYSCALE; > + else if (td->td_photometric == PHOTOMETRIC_RGB) > + sp->cinfo.c.in_color_space = JCS_RGB; > + else if (td->td_photometric == PHOTOMETRIC_SEPARATED && td- > >> td_samplesperpixel == 4) >> > + sp->cinfo.c.in_color_space = JCS_CMYK; > + else > + sp->cinfo.c.in_color_space = JCS_UNKNOWN; > + if (!TIFFjpeg_set_colorspace(sp, (sp->cinfo.c.in_color_space == > JCS_RGB) ? JCS_YCbCr : sp->cinfo.c.in_color_space)) > return (0); > /* jpeg_set_colorspace set all sampling factors to 1 */ > } > > This can be also reproduced with tifcp : > > $ ./tools/tiffcp in.tif out.tif -c jpeg:r -p contig > > where in.tif is a 3 band image (uncompressed, since for some reason tiffcp > doesn't like compressed images as source) > > and then : > > $ ./tools/tiffinfo out.tif -D > TIFF Directory at offset 0x1274 (4724) > Image Width: 128 Image Length: 128 > Tile Width: 256 Tile Length: 16 > Bits/Sample: 8 > Sample Format: unsigned integer > Compression Scheme: JPEG > Photometric Interpretation: RGB color > Orientation: row 0 top, col 0 lhs > Samples/Pixel: 3 > Planar Configuration: single image plane > JPEG Tables: (289 bytes) > JPEGPreDecode: Warning, Improper JPEG sampling factors 2,2 > Apparently should be 1,1.. > JPEGPreDecode: Cannot honour JPEG sampling factors that exceed those > specified.. > JPEGPreDecode: Warning, Improper JPEG sampling factors 2,2 > Apparently should be 1,1.. > JPEGPreDecode: Cannot honour JPEG sampling factors that exceed those > specified.. > JPEGPreDecode: Warning, Improper JPEG sampling factors 2,2 > Apparently should be 1,1.. > JPEGPreDecode: Cannot honour JPEG sampling factors that exceed those > specified.. > JPEGPreDecode: Warning, Improper JPEG sampling factors 2,2 > Apparently should be 1,1.. > JPEGPreDecode: Cannot honour JPEG sampling factors that exceed those > specified.. > JPEGPreDecode: Warning, Improper JPEG sampling factors 2,2 > Apparently should be 1,1.. > JPEGPreDecode: Cannot honour JPEG sampling factors that exceed those > specified.. > JPEGPreDecode: Warning, Improper JPEG sampling factors 2,2 > Apparently should be 1,1.. > JPEGPreDecode: Cannot honour JPEG sampling factors that exceed those > specified.. > JPEGPreDecode: Warning, Improper JPEG sampling factors 2,2 > Apparently should be 1,1.. > JPEGPreDecode: Cannot honour JPEG sampling factors that exceed those > specified.. > JPEGPreDecode: Warning, Improper JPEG sampling factors 2,2 > Apparently should be 1,1.. > JPEGPreDecode: Cannot honour JPEG sampling factors that exceed those > specified.. > > The line > > if (!TIFFjpeg_set_colorspace(sp, (sp->cinfo.c.in_color_space == JCS_RGB) ? > JCS_YCbCr : sp->cinfo.c.in_color_space)) > > looks suspicious to me. Why shouldn't it be just : > > if (!TIFFjpeg_set_colorspace(sp, sp->cinfo.c.in_color_space)) > > I've tried this and it works fine. > > Best regards, > > Even > > |
|||||||