libtiff: Removed SubsamplingHor/Ver from TIFFRGBAImage structure to avoid ABI changes (#1980)

https://github.com/libsdl-org/libtiff/commit/35d21f7970c6a9e53385efcbda9772a448d45a7d

From 35d21f7970c6a9e53385efcbda9772a448d45a7d Mon Sep 17 00:00:00 2001
From: Frank Warmerdam <[EMAIL REDACTED]>
Date: Sun, 21 Dec 2008 16:35:19 +0000
Subject: [PATCH] Removed SubsamplingHor/Ver from TIFFRGBAImage structure to
 avoid ABI changes (#1980)

---
 ChangeLog              |  6 ++++++
 libtiff/tif_getimage.c | 16 +++++++++-------
 libtiff/tiffio.h       |  4 +---
 3 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ce9c0a72..83e18802 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-12-21  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_getimage.c, tiffio.h: More ABI corrections. 
+	Removed SubsamplingHor/Ver from TIFFRGBAImage structure.
+	  http://bugzilla.maptools.org/show_bug.cgi?id=1980
+
 2008-12-18  Frank Warmerdam  <warmerdam@pobox.com>
 
 	* libtiff/tif_getimage.c,tiffio.h: removed all use of UaToAa and
diff --git a/libtiff/tif_getimage.c b/libtiff/tif_getimage.c
index 0e92a0de..84f744e4 100644
--- a/libtiff/tif_getimage.c
+++ b/libtiff/tif_getimage.c
@@ -1,4 +1,4 @@
-/* $Id: tif_getimage.c,v 1.63.2.1 2008-12-18 21:51:43 fwarmerdam Exp $ */
+/* $Id: tif_getimage.c,v 1.63.2.2 2008-12-21 16:35:19 fwarmerdam Exp $ */
 
 /*
  * Copyright (c) 1991-1997 Sam Leffler
@@ -422,8 +422,6 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int stop, char emsg[1024])
 			    photoTag, img->photometric);
 			return (0);
 	}
-	img->SubsamplingHor = 1;
-	img->SubsamplingVer = 1;
 	img->Map = NULL;
 	img->BWmap = NULL;
 	img->PALmap = NULL;
@@ -795,6 +793,7 @@ gtStripContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
 	uint32 pos;
 	unsigned char* buf;
 	uint32 rowsperstrip;
+	uint16 subsamplinghor,subsamplingver;
 	uint32 imagewidth = img->width;
 	tsize_t scanline;
 	int32 fromskew, toskew;
@@ -817,6 +816,7 @@ gtStripContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
 	}
 
 	TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
+	TIFFGetFieldDefaulted(tif, TIFFTAG_YCBCRSUBSAMPLING, &subsamplinghor, &subsamplingver);
 	scanline = TIFFNewScanlineSize(tif);
 	fromskew = (w < imagewidth ? imagewidth - w : 0);
 	for (row = 0; row < h; row += nrow)
@@ -824,8 +824,8 @@ gtStripContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
 		rowstoread = rowsperstrip - (row + img->row_offset) % rowsperstrip;
 		nrow = (row + rowstoread > h ? h - row : rowstoread);
 		nrowsub = nrow;
-		if ((nrowsub%(img->SubsamplingVer))!=0)
-			nrowsub+=img->SubsamplingVer-nrowsub%(img->SubsamplingVer);
+		if ((nrowsub%subsamplingver)!=0)
+			nrowsub+=subsamplingver-nrowsub%subsamplingver;
 		if (TIFFReadEncodedStrip(tif,
 		    TIFFComputeStrip(tif,row+img->row_offset, 0),
 		    buf,
@@ -2410,8 +2410,10 @@ PickContigCase(TIFFRGBAImage* img)
 					 * Joris: added support for the [1,2] case, nonetheless, to accomodate
 					 * some OJPEG files
 					 */
-					TIFFGetFieldDefaulted(img->tif, TIFFTAG_YCBCRSUBSAMPLING, &img->SubsamplingHor, &img->SubsamplingVer);
-					switch ((img->SubsamplingHor<<4)|img->SubsamplingVer) {
+					uint16 SubsamplingHor;
+					uint16 SubsamplingVer;
+					TIFFGetFieldDefaulted(img->tif, TIFFTAG_YCBCRSUBSAMPLING, &SubsamplingHor, &SubsamplingVer);
+					switch ((SubsamplingHor<<4)|SubsamplingVer) {
 						case 0x44:
 							img->put.contig = putcontig8bitYCbCr44tile;
 							break;
diff --git a/libtiff/tiffio.h b/libtiff/tiffio.h
index 29c99f1d..9f23baa7 100644
--- a/libtiff/tiffio.h
+++ b/libtiff/tiffio.h
@@ -1,4 +1,4 @@
-/* $Id: tiffio.h,v 1.56.2.1 2008-12-18 21:51:43 fwarmerdam Exp $ */
+/* $Id: tiffio.h,v 1.56.2.2 2008-12-21 16:35:19 fwarmerdam Exp $ */
 
 /*
  * Copyright (c) 1988-1997 Sam Leffler
@@ -194,8 +194,6 @@ struct _TIFFRGBAImage {
 	int alpha;                              /* type of alpha data present */
 	uint32 width;                           /* image width */
 	uint32 height;                          /* image height */
-	uint16 SubsamplingHor;                  /* subsampling factors */
-	uint16 SubsamplingVer;
 	uint16 bitspersample;                   /* image bits/sample */
 	uint16 samplesperpixel;                 /* image samples/pixel */
 	uint16 orientation;                     /* image orientation */