Blame SOURCES/libtiff-subsampling.patch

7c98bb
Use the spec-mandated default YCbCrSubSampling values in strip size
7c98bb
calculations, if the YCBCRSUBSAMPLING tag hasn't been provided.
7c98bb
See bug #603703.
7c98bb
7c98bb
Filed upstream at http://bugzilla.maptools.org/show_bug.cgi?id=2215
7c98bb
7c98bb
NB: must be applied after libtiff-scanlinesize.patch to avoid fuzz issues.
7c98bb
7c98bb
7c98bb
diff -Naur tiff-3.9.2.orig/libtiff/tif_strip.c tiff-3.9.2/libtiff/tif_strip.c
7c98bb
--- tiff-3.9.2.orig/libtiff/tif_strip.c	2006-03-25 13:04:35.000000000 -0500
7c98bb
+++ tiff-3.9.2/libtiff/tif_strip.c	2010-06-14 12:00:49.000000000 -0400
7c98bb
@@ -124,9 +124,9 @@
7c98bb
 		uint16 ycbcrsubsampling[2];
7c98bb
 		tsize_t w, scanline, samplingarea;
7c98bb
 
7c98bb
-		TIFFGetField( tif, TIFFTAG_YCBCRSUBSAMPLING,
7c98bb
-			      ycbcrsubsampling + 0,
7c98bb
-			      ycbcrsubsampling + 1 );
7c98bb
+		TIFFGetFieldDefaulted(tif, TIFFTAG_YCBCRSUBSAMPLING,
7c98bb
+				      ycbcrsubsampling + 0,
7c98bb
+				      ycbcrsubsampling + 1);
7c98bb
 
7c98bb
 		samplingarea = ycbcrsubsampling[0]*ycbcrsubsampling[1];
7c98bb
 		if (samplingarea == 0) {
7c98bb
@@ -234,9 +234,9 @@
7c98bb
 		    && !isUpSampled(tif)) {
7c98bb
 			uint16 ycbcrsubsampling[2];
7c98bb
 
7c98bb
-			TIFFGetField(tif, TIFFTAG_YCBCRSUBSAMPLING,
7c98bb
-				     ycbcrsubsampling + 0,
7c98bb
-				     ycbcrsubsampling + 1);
7c98bb
+			TIFFGetFieldDefaulted(tif, TIFFTAG_YCBCRSUBSAMPLING,
7c98bb
+					      ycbcrsubsampling + 0,
7c98bb
+					      ycbcrsubsampling + 1);
7c98bb
 
7c98bb
 			if (ycbcrsubsampling[0]*ycbcrsubsampling[1] == 0) {
7c98bb
 				TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
7c98bb
@@ -308,9 +308,9 @@
7c98bb
 		    && !isUpSampled(tif)) {
7c98bb
 			uint16 ycbcrsubsampling[2];
7c98bb
 
7c98bb
-			TIFFGetField(tif, TIFFTAG_YCBCRSUBSAMPLING,
7c98bb
-				     ycbcrsubsampling + 0,
7c98bb
-				     ycbcrsubsampling + 1);
7c98bb
+			TIFFGetFieldDefaulted(tif, TIFFTAG_YCBCRSUBSAMPLING,
7c98bb
+					      ycbcrsubsampling + 0,
7c98bb
+					      ycbcrsubsampling + 1);
7c98bb
 
7c98bb
 			if (ycbcrsubsampling[0]*ycbcrsubsampling[1] == 0) {
7c98bb
 				TIFFErrorExt(tif->tif_clientdata, tif->tif_name,