summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbfriesen <bfriesen>2012-07-06 17:05:16 +0000
committerbfriesen <bfriesen>2012-07-06 17:05:16 +0000
commit8d153c909c0c3e0e87af50eac3c1f1194974f233 (patch)
treef9e446d7d75c8dbd14efcde249073f3796fbe68f
parent392debac93e27e4aada814181f042cac75a66490 (diff)
downloadlibtiff-8d153c909c0c3e0e87af50eac3c1f1194974f233.tar.gz
* test/raw_decode.c (main): Test fixes to work with IJG JPEG 7+.
IJG JPEG 7+ uses a different upsampling algorithm which produces different numeric results. * libtiff/tif_jpeg.c (JPEGPreDecode): Patch from Even Rouault to work with IJG JPEG 7+.
-rw-r--r--ChangeLog9
-rw-r--r--libtiff/tif_jpeg.c5
-rw-r--r--test/raw_decode.c37
3 files changed, 39 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index ee1afa20..e711fe8e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2012-07-06 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>
+
+ * test/raw_decode.c (main): Test fixes to work with IJG JPEG 7+.
+ IJG JPEG 7+ uses a different upsampling algorithm which produces
+ different numeric results.
+
+ * libtiff/tif_jpeg.c (JPEGPreDecode): Patch from Even Rouault to
+ work with IJG JPEG 7+.
+
2012-07-04 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>
* test/raw_decode.c: Add changes so that test can run with build
diff --git a/libtiff/tif_jpeg.c b/libtiff/tif_jpeg.c
index df53d193..644a580f 100644
--- a/libtiff/tif_jpeg.c
+++ b/libtiff/tif_jpeg.c
@@ -1,4 +1,4 @@
-/* $Id: tif_jpeg.c,v 1.109 2012-07-03 00:57:50 fwarmerdam Exp $ */
+/* $Id: tif_jpeg.c,v 1.110 2012-07-06 17:05:16 bfriesen Exp $ */
/*
* Copyright (c) 1994-1997 Sam Leffler
@@ -1138,6 +1138,9 @@ JPEGPreDecode(TIFF* tif, uint16 s)
if (downsampled_output) {
/* Need to use raw-data interface to libjpeg */
sp->cinfo.d.raw_data_out = TRUE;
+#if JPEG_LIB_VERSION >= 70
+ sp->cinfo.d.do_fancy_upsampling = FALSE;
+#endif /* JPEG_LIB_VERSION >= 70 */
tif->tif_decoderow = DecodeRowError;
tif->tif_decodestrip = JPEGDecodeRaw;
tif->tif_decodetile = JPEGDecodeRaw;
diff --git a/test/raw_decode.c b/test/raw_decode.c
index 0fd52fc3..ec5c1904 100644
--- a/test/raw_decode.c
+++ b/test/raw_decode.c
@@ -1,4 +1,4 @@
-/* $Id: raw_decode.c,v 1.3 2012-07-04 19:45:32 bfriesen Exp $ */
+/* $Id: raw_decode.c,v 1.4 2012-07-06 17:05:16 bfriesen Exp $ */
/*
* Copyright (c) 2012, Frank Warmerdam <warmerdam@pobox.com>
@@ -42,6 +42,8 @@
#include "tiffio.h"
+#include "jpeglib.h" /* Needed for JPEG_LIB_VERSION */
+
static unsigned char cluster_0[] = { 0, 0, 2, 0, 138, 139 };
static unsigned char cluster_64[] = { 0, 0, 9, 6, 134, 119 };
static unsigned char cluster_128[] = { 44, 40, 63, 59, 230, 95 };
@@ -111,6 +113,7 @@ main(int argc, char **argv)
unsigned char *buffer;
uint32 *rgba_buffer;
tsize_t sz, szout;
+ unsigned int pixel_status = 0;
(void) argc;
(void) argv;
@@ -188,11 +191,15 @@ main(int argc, char **argv)
return 1;
}
- if (check_rgb_pixel( 0, 15, 0, 18, buffer )
- || check_rgb_pixel( 64, 0, 0, 2, buffer )
- || check_rgb_pixel( 512, 6, 36, 182, buffer ) ) {
- exit(1);
- }
+#if JPEG_LIB_VERSION >= 70
+ pixel_status |= check_rgb_pixel( 0, 18, 0, 41, buffer );
+ pixel_status |= check_rgb_pixel( 64, 0, 0, 0, buffer );
+ pixel_status |= check_rgb_pixel( 512, 5, 34, 196, buffer );
+#else
+ pixel_status |= check_rgb_pixel( 0, 15, 0, 18, buffer );
+ pixel_status |= check_rgb_pixel( 64, 0, 0, 2, buffer );
+ pixel_status |= check_rgb_pixel( 512, 6, 36, 182, buffer );
+#endif
free( buffer );
@@ -217,14 +224,22 @@ main(int argc, char **argv)
* accomplish it from the YCbCr subsampled buffer ourselves in which
* case the results may be subtly different but similar.
*/
- if (check_rgba_pixel( 0, 15, 0, 18, 255, rgba_buffer )
- || check_rgba_pixel( 64, 0, 0, 2, 255, rgba_buffer )
- || check_rgba_pixel( 512, 6, 36, 182, 255, rgba_buffer ) ) {
- exit(1);
- }
+#if JPEG_LIB_VERSION >= 70
+ pixel_status |= check_rgba_pixel( 0, 18, 0, 41, 255, rgba_buffer );
+ pixel_status |= check_rgba_pixel( 64, 0, 0, 0, 255, rgba_buffer );
+ pixel_status |= check_rgba_pixel( 512, 5, 34, 196, 255, rgba_buffer );
+#else
+ pixel_status |= check_rgba_pixel( 0, 15, 0, 18, 255, rgba_buffer );
+ pixel_status |= check_rgba_pixel( 64, 0, 0, 2, 255, rgba_buffer );
+ pixel_status |= check_rgba_pixel( 512, 6, 36, 182, 255, rgba_buffer );
+#endif
free( rgba_buffer );
TIFFClose(tif);
+
+ if (pixel_status) {
+ exit(1);
+ }
exit( 0 );
}