1
Description: fix TIFFReadScanline with ycbcr JPEG images
2
Patch from upstream CVS from Relase-v3-9-2 to 2010-01-10
4
Bug: http://bugzilla.maptools.org/show_bug.cgi?id=1936
5
Bug-Debian: http://bugs.debian.org/510792
8
Index: tiff-3.9.2/ChangeLog
9
===================================================================
10
--- tiff-3.9.2.orig/ChangeLog 2009-11-04 12:12:17.000000000 -0500
11
+++ tiff-3.9.2/ChangeLog 2010-01-10 09:40:52.752917618 -0500
13
+2010-01-06 Frank Warmerdam <warmerdam@pobox.com>
15
+ * libtiff/tif_dir.c: Ensure tile and scanline sizes are reset
16
+ when moving to new directories.
17
+ http://bugzilla.maptools.org/show_bug.cgi?id=1936
19
+2009-12-03 Frank Warmerdam <warmerdam@pobox.com>
21
+ * libtiff/tif_jpeg.c: Fix a couple of issues that trigger failures in
22
+ some cases when using TIFFReadScanline() with JPEG compressed
23
+ subsampled ycbcr images.
24
+ http://bugzilla.maptools.org/show_bug.cgi?id=1936
26
2009-11-04 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>
28
* libtiff 3.9.2 released.
29
Index: tiff-3.9.2/libtiff/tif_dir.c
30
===================================================================
31
--- tiff-3.9.2.orig/libtiff/tif_dir.c 2008-12-31 19:10:43.000000000 -0500
32
+++ tiff-3.9.2/libtiff/tif_dir.c 2010-01-10 09:40:52.752917618 -0500
34
-/* $Id: tif_dir.c,v 1.75.2.2 2009-01-01 00:10:43 bfriesen Exp $ */
35
+/* $Id: tif_dir.c,v 1.75.2.3 2010-01-07 04:05:39 fwarmerdam Exp $ */
38
* Copyright (c) 1988-1997 Sam Leffler
39
@@ -1099,6 +1099,11 @@
40
* Should we also be clearing stuff like INSUBIFD?
42
tif->tif_flags &= ~TIFF_ISTILED;
44
+ * Clear other directory-specific fields.
46
+ tif->tif_tilesize = -1;
47
+ tif->tif_scanlinesize = -1;
51
Index: tiff-3.9.2/libtiff/tif_jpeg.c
52
===================================================================
53
--- tiff-3.9.2.orig/libtiff/tif_jpeg.c 2009-08-30 12:21:46.000000000 -0400
54
+++ tiff-3.9.2/libtiff/tif_jpeg.c 2010-01-10 09:40:52.980917084 -0500
56
-/* $Id: tif_jpeg.c,v 1.50.2.4 2009-08-30 16:21:46 bfriesen Exp $ */
57
+/* $Id: tif_jpeg.c,v 1.50.2.5 2009-12-04 01:04:00 fwarmerdam Exp $ */
60
* Copyright (c) 1994-1997 Sam Leffler
61
@@ -1613,7 +1613,11 @@
62
* Must recalculate cached tile size in case sampling state changed.
63
* Should we really be doing this now if image size isn't set?
65
- tif->tif_tilesize = isTiled(tif) ? TIFFTileSize(tif) : (tsize_t) -1;
66
+ if( tif->tif_tilesize > 0 )
67
+ tif->tif_tilesize = isTiled(tif) ? TIFFTileSize(tif) : (tsize_t) -1;
69
+ if(tif->tif_scanlinesize > 0 )
70
+ tif->tif_scanlinesize = TIFFScanlineSize(tif);
74
@@ -1741,13 +1745,21 @@
80
if( !TIFFFillStrip( tif, 0 ) )
84
TIFFSetField( tif, TIFFTAG_YCBCRSUBSAMPLING,
85
(uint16) sp->h_sampling, (uint16) sp->v_sampling );
88
+ ** We want to clear the loaded strip so the application has time
89
+ ** to set JPEGCOLORMODE or other behavior modifiers. This essentially
90
+ ** undoes the JPEGPreDecode triggers by TIFFFileStrip(). (#1936)
92
+ tif->tif_curstrip = -1;
94
#endif /* CHECK_JPEG_YCBCR_SUBSAMPLING */