AWARE [SYSTEMS] Imaging expertise for the Delphi developer
AWare Systems, Imaging expertise for the Delphi developer, Home TIFF and LibTiff Mailing List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
January 2011

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date

Contact

The TIFF Mailing List Homepage
This list is run by Frank Warmerdam
Archive maintained by AWare Systems



Valid HTML 4.01!



Thread

2011.01.01 13:41 "Regression in libtiff 4.0 CVS when creating a JPEG RGB contig", by Even Rouault
2011.01.01 13:53 "Re: Regression in libtiff 4.0 CVS when creating a JPEG RGB contig", by Even Rouault
2011.01.04 02:52 "Re: Regression in libtiff 4.0 CVS when creating a JPEG RGB contig", by Lee Howard
2011.01.04 19:20 "Re: Regression in libtiff 4.0 CVS when creating a JPEG RGB contig", by Even Rouault
2011.01.04 19:47 "Re: Regression in libtiff 4.0 CVS when creating a JPEG RGB contig", by Lee Howard
2011.01.04 20:50 "Re: Regression in libtiff 4.0 CVS when creating a JPEG RGB contig", by Even Rouault
2011.01.04 21:39 "[SPAM WARNING]Re: [Tiff] Regression in libtiff 4.0 CVS when creating a JPEG RGB contig", by <peter.bauer@datamine.ca>
2011.01.04 22:10 "Re: libtiff 4.0 stable? [was: Regression in libtiff 4.0 CVS when creating a JPEG RGB contig]", by Edward Lam
2011.01.05 00:03 "Re: libtiff 4.0 stable? [was: Regression in libtiff 4.0 CVS when creating a JPEG RGB contig]", by Frank Warmerdam
2011.01.05 02:19 "Re: libtiff 4.0 stable? [was: Regression in libtiff 4.0 CVS when creating a JPEG RGB contig]", by Bob Friesenhahn
2011.01.07 14:58 "Re: libtiff 4.0 stable? [was: Regression in libtiff 4.0 CVS when creating a JPEG RGB contig]", by Edward Lam
2011.01.07 17:42 "Re: libtiff 4.0 stable? [was: Regression in libtiff 4.0 CVS when creating a JPEG RGB contig]", by Bob Friesenhahn
2011.01.10 17:52 "Re: libtiff 4.0 stable? [was: Regression in libtiff 4.0 CVS when creating a JPEG RGB contig]", by Joris Van Damme
2011.01.05 02:06 "Re: Regression in libtiff 4.0 CVS when creating a JPEG RGB contig", by Bob Friesenhahn
2011.01.04 19:28 "Re: Regression in libtiff 4.0 CVS when creating a JPEG RGB contig", by Dwight Kelly
2011.01.04 19:32 "Re: Regression in libtiff 4.0 CVS when creating a JPEG RGB contig", by Even Rouault
2011.01.04 02:44 "Re: Regression in libtiff 4.0 CVS when creating a JPEG RGB contig", by Lee Howard

2011.01.04 02:44 "Re: Regression in libtiff 4.0 CVS when creating a JPEG RGB contig", by Lee Howard

Even,

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
>
>