* 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+.
This commit is contained in:
Bob Friesenhahn 2012-07-06 17:05:16 +00:00
parent 22c4ecd4a8
commit a5681ca6f0
3 changed files with 39 additions and 12 deletions

View File

@ -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> 2012-07-04 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>
* test/raw_decode.c: Add changes so that test can run with build * test/raw_decode.c: Add changes so that test can run with build

View File

@ -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 * Copyright (c) 1994-1997 Sam Leffler
@ -1138,6 +1138,9 @@ JPEGPreDecode(TIFF* tif, uint16 s)
if (downsampled_output) { if (downsampled_output) {
/* Need to use raw-data interface to libjpeg */ /* Need to use raw-data interface to libjpeg */
sp->cinfo.d.raw_data_out = TRUE; 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_decoderow = DecodeRowError;
tif->tif_decodestrip = JPEGDecodeRaw; tif->tif_decodestrip = JPEGDecodeRaw;
tif->tif_decodetile = JPEGDecodeRaw; tif->tif_decodetile = JPEGDecodeRaw;

View File

@ -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> * Copyright (c) 2012, Frank Warmerdam <warmerdam@pobox.com>
@ -42,6 +42,8 @@
#include "tiffio.h" #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_0[] = { 0, 0, 2, 0, 138, 139 };
static unsigned char cluster_64[] = { 0, 0, 9, 6, 134, 119 }; static unsigned char cluster_64[] = { 0, 0, 9, 6, 134, 119 };
static unsigned char cluster_128[] = { 44, 40, 63, 59, 230, 95 }; static unsigned char cluster_128[] = { 44, 40, 63, 59, 230, 95 };
@ -111,6 +113,7 @@ main(int argc, char **argv)
unsigned char *buffer; unsigned char *buffer;
uint32 *rgba_buffer; uint32 *rgba_buffer;
tsize_t sz, szout; tsize_t sz, szout;
unsigned int pixel_status = 0;
(void) argc; (void) argc;
(void) argv; (void) argv;
@ -188,11 +191,15 @@ main(int argc, char **argv)
return 1; return 1;
} }
if (check_rgb_pixel( 0, 15, 0, 18, buffer ) #if JPEG_LIB_VERSION >= 70
|| check_rgb_pixel( 64, 0, 0, 2, buffer ) pixel_status |= check_rgb_pixel( 0, 18, 0, 41, buffer );
|| check_rgb_pixel( 512, 6, 36, 182, buffer ) ) { pixel_status |= check_rgb_pixel( 64, 0, 0, 0, buffer );
exit(1); 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 ); free( buffer );
@ -217,15 +224,23 @@ main(int argc, char **argv)
* accomplish it from the YCbCr subsampled buffer ourselves in which * accomplish it from the YCbCr subsampled buffer ourselves in which
* case the results may be subtly different but similar. * case the results may be subtly different but similar.
*/ */
if (check_rgba_pixel( 0, 15, 0, 18, 255, rgba_buffer ) #if JPEG_LIB_VERSION >= 70
|| check_rgba_pixel( 64, 0, 0, 2, 255, rgba_buffer ) pixel_status |= check_rgba_pixel( 0, 18, 0, 41, 255, rgba_buffer );
|| check_rgba_pixel( 512, 6, 36, 182, 255, rgba_buffer ) ) { pixel_status |= check_rgba_pixel( 64, 0, 0, 0, 255, rgba_buffer );
exit(1); 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 ); free( rgba_buffer );
TIFFClose(tif); TIFFClose(tif);
if (pixel_status) {
exit(1);
}
exit( 0 ); exit( 0 );
} }