Workaround for wrong sampling factors used in the Intergarph JPEG
compressed TIFF images as per bug: http://bugzilla.remotesensing.org/show_bug.cgi?id=532
This commit is contained in:
parent
1cba436f59
commit
1f663d3a9b
@ -1,4 +1,4 @@
|
||||
/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_jpeg.c,v 1.18 2004-01-29 08:51:56 dron Exp $ */
|
||||
/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_jpeg.c,v 1.19 2004-04-06 08:42:30 dron Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994-1997 Sam Leffler
|
||||
@ -66,7 +66,7 @@ int TIFFFillTile(TIFF*, ttile_t);
|
||||
*/
|
||||
|
||||
/* Define "boolean" as unsigned char, not int, per Windows custom. */
|
||||
#if defined(__WIN32__)
|
||||
#if defined(WIN32)
|
||||
# ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */
|
||||
typedef unsigned char boolean;
|
||||
# endif
|
||||
@ -707,13 +707,22 @@ JPEGPreDecode(TIFF* tif, tsample_t s)
|
||||
sp->cinfo.d.comp_info[0].v_samp_factor != sp->v_sampling) {
|
||||
TIFFWarning(module,
|
||||
"Improper JPEG sampling factors %d,%d\n"
|
||||
"Apparently should be %d,%d, "
|
||||
"decompressor will try reading with "
|
||||
"sampling %d,%d",
|
||||
"Apparently should be %d,%d.",
|
||||
sp->cinfo.d.comp_info[0].h_samp_factor,
|
||||
sp->cinfo.d.comp_info[0].v_samp_factor,
|
||||
sp->h_sampling,
|
||||
sp->v_sampling,
|
||||
sp->h_sampling, sp->v_sampling);
|
||||
|
||||
/*
|
||||
* XXX: Files written by the Intergraph software
|
||||
* has different sampling factors stored in the
|
||||
* TIFF tags and in the JPEG structures. We will
|
||||
* try to deduce Intergraph files by the presense
|
||||
* of the tag 33918.
|
||||
*/
|
||||
if (!_TIFFFindFieldInfo(tif, 33918, TIFF_ANY)) {
|
||||
TIFFWarning(module,
|
||||
"Decompressor will try reading with "
|
||||
"sampling %d,%d.",
|
||||
sp->cinfo.d.comp_info[0].h_samp_factor,
|
||||
sp->cinfo.d.comp_info[0].v_samp_factor);
|
||||
|
||||
@ -722,6 +731,7 @@ JPEGPreDecode(TIFF* tif, tsample_t s)
|
||||
sp->v_sampling = (uint16)
|
||||
sp->cinfo.d.comp_info[0].v_samp_factor;
|
||||
}
|
||||
}
|
||||
/* Rest should have sampling factors 1,1 */
|
||||
for (ci = 1; ci < sp->cinfo.d.num_components; ci++) {
|
||||
if (sp->cinfo.d.comp_info[ci].h_samp_factor != 1 ||
|
||||
|
Loading…
Reference in New Issue
Block a user