AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2010.12.14 17:55 "[Tiff] patch to tif_jpeg.c", by Dwight Kelly
2010.12.15 00:00 "Re: [Tiff] patch to tif_jpeg.c", by Lee Howard
2011.01.01 13:41 "[Tiff] Regression in libtiff 4.0 CVS when creating a JPEG RGB contig", by Even Rouault
2011.01.01 13:53 "Re: [Tiff] Regression in libtiff 4.0 CVS when creating a JPEG RGB contig", by Even Rouault
2011.01.04 02:52 "Re: [Tiff] Regression in libtiff 4.0 CVS when creating a JPEG RGB contig", by Lee Howard
2011.01.04 19:20 "Re: [Tiff] Regression in libtiff 4.0 CVS when creating a JPEG RGB contig", by Even Rouault
2011.01.04 19:47 "Re: [Tiff] Regression in libtiff 4.0 CVS when creating a JPEG RGB contig", by Lee Howard
2011.01.04 20:50 "Re: [Tiff] 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
2011.01.04 22:10 "Re: [Tiff] 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: [Tiff] 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: [Tiff] 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: [Tiff] 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: [Tiff] 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: [Tiff] libtiff 4.0 stable? [was: Regression in libtiff 4.0 CVS when creating a JPEG RGB contig]", by
2011.01.05 02:06 "Re: [Tiff] Regression in libtiff 4.0 CVS when creating a JPEG RGB contig", by Bob Friesenhahn
2011.01.04 19:28 "Re: [Tiff] Regression in libtiff 4.0 CVS when creating a JPEG RGB contig", by Dwight Kelly
2011.01.04 19:32 "Re: [Tiff] Regression in libtiff 4.0 CVS when creating a JPEG RGB contig", by Even Rouault
2011.01.04 02:44 "Re: [Tiff] Regression in libtiff 4.0 CVS when creating a JPEG RGB contig", by Lee Howard
2011.01.21 00:51 "[Tiff] Cannot read YCbCr JPEG-compressed images", by Craig Bruce
2011.01.21 12:11 "Re: [Tiff] Cannot read YCbCr JPEG-compressed images", by John
2011.01.23 03:30 "Re: [Tiff] Cannot read YCbCr JPEG-compressed images", by Charles Auer
2011.01.23 16:01 "Re: [Tiff] Cannot read YCbCr JPEG-compressed images", by Bob Friesenhahn
2011.01.25 01:02 "Re: [Tiff] Cannot read YCbCr JPEG-compressed images", by Craig Bruce
2011.01.25 02:00 "Re: [Tiff] Cannot read YCbCr JPEG-compressed images", by Olivier Paquet
2011.01.26 02:40 "Re: [Tiff] Cannot read YCbCr JPEG-compressed images", by Craig Bruce
2011.01.26 04:50 "Re: [Tiff] Cannot read YCbCr JPEG-compressed images", by Bob Friesenhahn

2011.01.04 02:44 "Re: [Tiff] 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.

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-
== PHOTOMETRIC_MINISBLACK) > td_photometric

>>

> +                             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-
== 4) > td_samplesperpixel

>>

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