Allow handling of images with extra samples that are to be ignored for
contiguous 8bit greyscale and paletted images. See bug http://bugzilla.remotesensing.org/show_bug.cgi?id=75
This commit is contained in:
parent
abf486d1fa
commit
d15abe6676
@ -1,3 +1,11 @@
|
|||||||
|
2001-08-31 Frank Warmerdam <warmerdam@pobox.com>
|
||||||
|
|
||||||
|
* libtiff/tif_getimage.c: relax handling of contig case where
|
||||||
|
there are extra samples that are supposed to be ignored. This
|
||||||
|
should now work for 8bit greyscale or palletted images.
|
||||||
|
|
||||||
|
http://bugzilla.remotesensing.org/show_bug.cgi?id=75
|
||||||
|
|
||||||
2001-08-28 Frank Warmerdam <warmerdam@pobox.com>
|
2001-08-28 Frank Warmerdam <warmerdam@pobox.com>
|
||||||
|
|
||||||
* libtiff/tif_getimage.c: Don't complain for CMYK (separated)
|
* libtiff/tif_getimage.c: Don't complain for CMYK (separated)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_getimage.c,v 1.12 2001-08-28 13:11:38 warmerda Exp $ */
|
/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_getimage.c,v 1.13 2001-08-31 13:53:08 warmerda Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1991-1997 Sam Leffler
|
* Copyright (c) 1991-1997 Sam Leffler
|
||||||
@ -82,13 +82,22 @@ TIFFRGBAImageOK(TIFF* tif, char emsg[1024])
|
|||||||
case PHOTOMETRIC_MINISWHITE:
|
case PHOTOMETRIC_MINISWHITE:
|
||||||
case PHOTOMETRIC_MINISBLACK:
|
case PHOTOMETRIC_MINISBLACK:
|
||||||
case PHOTOMETRIC_PALETTE:
|
case PHOTOMETRIC_PALETTE:
|
||||||
if (td->td_planarconfig == PLANARCONFIG_CONTIG && td->td_samplesperpixel != 1) {
|
if (td->td_planarconfig == PLANARCONFIG_CONTIG
|
||||||
|
&& td->td_samplesperpixel != 1
|
||||||
|
&& td->td_bitspersample < 8 ) {
|
||||||
sprintf(emsg,
|
sprintf(emsg,
|
||||||
"Sorry, can not handle contiguous data with %s=%d, and %s=%d",
|
"Sorry, can not handle contiguous data with %s=%d, "
|
||||||
|
"and %s=%d and Bits/Sample=%d",
|
||||||
photoTag, photometric,
|
photoTag, photometric,
|
||||||
"Samples/pixel", td->td_samplesperpixel);
|
"Samples/pixel", td->td_samplesperpixel,
|
||||||
|
td->td_bitspersample);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
** We should likely validate that any extra samples are either
|
||||||
|
** to be ignored, or are alpha, and if alpha we should try to use
|
||||||
|
** them. But for now we won't bother with this.
|
||||||
|
*/
|
||||||
break;
|
break;
|
||||||
case PHOTOMETRIC_YCBCR:
|
case PHOTOMETRIC_YCBCR:
|
||||||
if (td->td_planarconfig != PLANARCONFIG_CONTIG) {
|
if (td->td_planarconfig != PLANARCONFIG_CONTIG) {
|
||||||
@ -261,11 +270,15 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int stop, char emsg[1024])
|
|||||||
/* fall thru... */
|
/* fall thru... */
|
||||||
case PHOTOMETRIC_MINISWHITE:
|
case PHOTOMETRIC_MINISWHITE:
|
||||||
case PHOTOMETRIC_MINISBLACK:
|
case PHOTOMETRIC_MINISBLACK:
|
||||||
if (planarconfig == PLANARCONFIG_CONTIG && img->samplesperpixel != 1) {
|
if (planarconfig == PLANARCONFIG_CONTIG
|
||||||
|
&& img->samplesperpixel != 1
|
||||||
|
&& img->bitspersample < 8 ) {
|
||||||
sprintf(emsg,
|
sprintf(emsg,
|
||||||
"Sorry, can not handle contiguous data with %s=%d, and %s=%d",
|
"Sorry, can not handle contiguous data with %s=%d, "
|
||||||
|
"and %s=%d and Bits/Sample=%d",
|
||||||
photoTag, img->photometric,
|
photoTag, img->photometric,
|
||||||
"Samples/pixel", img->samplesperpixel);
|
"Samples/pixel", img->samplesperpixel,
|
||||||
|
img->bitspersample);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -789,10 +802,15 @@ static void name(\
|
|||||||
DECLAREContigPutFunc(put8bitcmaptile)
|
DECLAREContigPutFunc(put8bitcmaptile)
|
||||||
{
|
{
|
||||||
uint32** PALmap = img->PALmap;
|
uint32** PALmap = img->PALmap;
|
||||||
|
int samplesperpixel = img->samplesperpixel;
|
||||||
|
|
||||||
(void) x; (void) y;
|
(void) y;
|
||||||
while (h-- > 0) {
|
while (h-- > 0) {
|
||||||
UNROLL8(w, NOP, *cp++ = PALmap[*pp++][0]);
|
for (x = w; x-- > 0;)
|
||||||
|
{
|
||||||
|
*cp++ = PALmap[*pp][0];
|
||||||
|
pp += samplesperpixel;
|
||||||
|
}
|
||||||
cp += toskew;
|
cp += toskew;
|
||||||
pp += fromskew;
|
pp += fromskew;
|
||||||
}
|
}
|
||||||
@ -854,12 +872,16 @@ DECLAREContigPutFunc(put1bitcmaptile)
|
|||||||
*/
|
*/
|
||||||
DECLAREContigPutFunc(putgreytile)
|
DECLAREContigPutFunc(putgreytile)
|
||||||
{
|
{
|
||||||
|
int samplesperpixel = img->samplesperpixel;
|
||||||
uint32** BWmap = img->BWmap;
|
uint32** BWmap = img->BWmap;
|
||||||
|
|
||||||
(void) y;
|
(void) y;
|
||||||
while (h-- > 0) {
|
while (h-- > 0) {
|
||||||
for (x = w; x-- > 0;)
|
for (x = w; x-- > 0;)
|
||||||
*cp++ = BWmap[*pp++][0];
|
{
|
||||||
|
*cp++ = BWmap[*pp][0];
|
||||||
|
pp += samplesperpixel;
|
||||||
|
}
|
||||||
cp += toskew;
|
cp += toskew;
|
||||||
pp += fromskew;
|
pp += fromskew;
|
||||||
}
|
}
|
||||||
@ -870,6 +892,7 @@ DECLAREContigPutFunc(putgreytile)
|
|||||||
*/
|
*/
|
||||||
DECLAREContigPutFunc(put16bitbwtile)
|
DECLAREContigPutFunc(put16bitbwtile)
|
||||||
{
|
{
|
||||||
|
int samplesperpixel = img->samplesperpixel;
|
||||||
uint32** BWmap = img->BWmap;
|
uint32** BWmap = img->BWmap;
|
||||||
|
|
||||||
(void) y;
|
(void) y;
|
||||||
@ -880,8 +903,9 @@ DECLAREContigPutFunc(put16bitbwtile)
|
|||||||
{
|
{
|
||||||
/* use high order byte of 16bit value */
|
/* use high order byte of 16bit value */
|
||||||
|
|
||||||
*cp++ = BWmap[*(wp++) >> 8][0];
|
*cp++ = BWmap[*wp >> 8][0];
|
||||||
pp += 2;
|
pp += 2 * samplesperpixel;
|
||||||
|
wp += samplesperpixel;
|
||||||
}
|
}
|
||||||
cp += toskew;
|
cp += toskew;
|
||||||
pp += fromskew;
|
pp += fromskew;
|
||||||
|
Loading…
Reference in New Issue
Block a user