Unformat thirdparty/tiff-4.0.3/libtiff/tif_getimage_64.c
to compare with original tif_getimage.c.
This commit is contained in:
parent
46416c1cad
commit
ca9c32c273
1 changed files with 1304 additions and 1316 deletions
452
thirdparty/tiff-4.0.3/libtiff/tif_getimage_64.c
vendored
452
thirdparty/tiff-4.0.3/libtiff/tif_getimage_64.c
vendored
|
@ -2,6 +2,7 @@
|
|||
Modified tif_getimage.c that takes uint64 as output pixel type
|
||||
*/
|
||||
|
||||
|
||||
/* $Id: tif_getimage.c,v 1.82 2012-06-06 00:17:49 fwarmerdam Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -36,13 +37,17 @@
|
|||
#include "tiffiop.h"
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
typedef int (*gtFunc_32)(TIFFRGBAImage*, uint32*, uint32, uint32);
|
||||
typedef int (*gtFunc_64)(TIFFRGBAImage*, uint64*, uint32, uint32);
|
||||
typedef void (*tileContigRoutine_64)(TIFFRGBAImage *, uint64 *, uint32, uint32, uint32, uint32, int32, int32,
|
||||
typedef void (*tileContigRoutine_64)
|
||||
(TIFFRGBAImage*, uint64*, uint32, uint32, uint32, uint32, int32, int32,
|
||||
unsigned char*);
|
||||
typedef void (*tileSeparateRoutine_64)(TIFFRGBAImage *, uint64 *, uint32, uint32, uint32, uint32, int32, int32,
|
||||
typedef void (*tileSeparateRoutine_64)
|
||||
(TIFFRGBAImage*, uint64*, uint32, uint32, uint32, uint32, int32, int32,
|
||||
unsigned char*, unsigned char*, unsigned char*, unsigned char*);
|
||||
|
||||
|
||||
static int gtTileContig(TIFFRGBAImage*, uint64*, uint32, uint32);
|
||||
static int gtTileSeparate(TIFFRGBAImage*, uint64*, uint32, uint32);
|
||||
static int gtStripContig(TIFFRGBAImage*, uint64*, uint32, uint32);
|
||||
|
@ -69,21 +74,15 @@ static const TIFFDisplay display_sRGB = {
|
|||
{ /* XYZ -> luminance matrix */
|
||||
{ 3.2410F, -1.5374F, -0.4986F },
|
||||
{ -0.9692F, 1.8760F, 0.0416F },
|
||||
{0.0556F, -0.2040F, 1.0570F}},
|
||||
100.0F,
|
||||
100.0F,
|
||||
100.0F, /* Light o/p for reference white */
|
||||
255,
|
||||
255,
|
||||
255, /* Pixel values for ref. white */
|
||||
1.0F,
|
||||
1.0F,
|
||||
1.0F, /* Residual light o/p for black pixel */
|
||||
2.4F,
|
||||
2.4F,
|
||||
2.4F, /* Gamma values for the three guns */
|
||||
{ 0.0556F, -0.2040F, 1.0570F }
|
||||
},
|
||||
100.0F, 100.0F, 100.0F, /* Light o/p for reference white */
|
||||
255, 255, 255, /* Pixel values for ref. white */
|
||||
1.0F, 1.0F, 1.0F, /* Residual light o/p for black pixel */
|
||||
2.4F, 2.4F, 2.4F, /* Gamma values for the three guns */
|
||||
};
|
||||
|
||||
|
||||
static int
|
||||
isCCITTCompression(TIFF* tif)
|
||||
{
|
||||
|
@ -95,7 +94,8 @@ isCCITTCompression(TIFF *tif)
|
|||
compress == COMPRESSION_CCITTRLEW);
|
||||
}
|
||||
|
||||
int TIFFRGBAImageBegin_64(TIFFRGBAImage *img, TIFF *tif, int stop, char emsg[1024])
|
||||
int
|
||||
TIFFRGBAImageBegin_64(TIFFRGBAImage* img, TIFF* tif, int stop, char emsg[1024])
|
||||
{
|
||||
uint16* sampleinfo;
|
||||
uint16 extrasamples;
|
||||
|
@ -132,7 +132,8 @@ int TIFFRGBAImageBegin_64(TIFFRGBAImage *img, TIFF *tif, int stop, char emsg[102
|
|||
TIFFGetFieldDefaulted(tif, TIFFTAG_SAMPLESPERPIXEL, &img->samplesperpixel);
|
||||
TIFFGetFieldDefaulted(tif, TIFFTAG_EXTRASAMPLES,
|
||||
&extrasamples, &sampleinfo);
|
||||
if (extrasamples >= 1) {
|
||||
if (extrasamples >= 1)
|
||||
{
|
||||
switch (sampleinfo[0]) {
|
||||
case EXTRASAMPLE_UNSPECIFIED: /* Workaround for some images without */
|
||||
if (img->samplesperpixel > 3) /* correct info about alpha channel */
|
||||
|
@ -149,7 +150,10 @@ int TIFFRGBAImageBegin_64(TIFFRGBAImage *img, TIFF *tif, int stop, char emsg[102
|
|||
if( !TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &img->photometric))
|
||||
img->photometric = PHOTOMETRIC_MINISWHITE;
|
||||
|
||||
if (extrasamples == 0 && img->samplesperpixel == 4 && img->photometric == PHOTOMETRIC_RGB) {
|
||||
if( extrasamples == 0
|
||||
&& img->samplesperpixel == 4
|
||||
&& img->photometric == PHOTOMETRIC_RGB )
|
||||
{
|
||||
img->alpha = EXTRASAMPLE_ASSOCALPHA;
|
||||
extrasamples = 1;
|
||||
}
|
||||
|
@ -199,7 +203,9 @@ int TIFFRGBAImageBegin_64(TIFFRGBAImage *img, TIFF *tif, int stop, char emsg[102
|
|||
/* fall thru... */
|
||||
case PHOTOMETRIC_MINISWHITE:
|
||||
case PHOTOMETRIC_MINISBLACK:
|
||||
if (planarconfig == PLANARCONFIG_CONTIG && img->samplesperpixel != 1 && img->bitspersample < 8) {
|
||||
if (planarconfig == PLANARCONFIG_CONTIG
|
||||
&& img->samplesperpixel != 1
|
||||
&& img->bitspersample < 8 ) {
|
||||
sprintf(emsg,
|
||||
"Sorry, can not handle contiguous data with %s=%d, "
|
||||
"and %s=%d and Bits/Sample=%d",
|
||||
|
@ -242,7 +248,8 @@ int TIFFRGBAImageBegin_64(TIFFRGBAImage *img, TIFF *tif, int stop, char emsg[102
|
|||
goto fail_return;
|
||||
}
|
||||
break;
|
||||
case PHOTOMETRIC_SEPARATED: {
|
||||
case PHOTOMETRIC_SEPARATED:
|
||||
{
|
||||
uint16 inkset;
|
||||
TIFFGetFieldDefaulted(tif, TIFFTAG_INKSET, &inkset);
|
||||
if (inkset != INKSET_CMYK) {
|
||||
|
@ -255,7 +262,8 @@ int TIFFRGBAImageBegin_64(TIFFRGBAImage *img, TIFF *tif, int stop, char emsg[102
|
|||
"Samples/pixel", img->samplesperpixel);
|
||||
goto fail_return;
|
||||
}
|
||||
} break;
|
||||
}
|
||||
break;
|
||||
case PHOTOMETRIC_LOGL:
|
||||
if (compress != COMPRESSION_SGILOG) {
|
||||
sprintf(emsg, "Sorry, LogL data must have %s=%d",
|
||||
|
@ -321,7 +329,9 @@ fail_return:
|
|||
return 0;
|
||||
}
|
||||
|
||||
int TIFFRGBAImageGet_64(TIFFRGBAImage *img, uint64 *raster, uint32 w, uint32 h)
|
||||
|
||||
int
|
||||
TIFFRGBAImageGet_64(TIFFRGBAImage* img, uint64* raster, uint32 w, uint32 h)
|
||||
{
|
||||
gtFunc_64 get = (gtFunc_64) img->get;
|
||||
|
||||
|
@ -435,25 +445,29 @@ gtTileContig(TIFFRGBAImage *img, uint64 *raster, uint32 w, uint32 h)
|
|||
if (flip & FLIP_VERTICALLY) {
|
||||
y = h - 1;
|
||||
toskew = -(int32)(tw + w);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
y = 0;
|
||||
toskew = -(int32)(tw - w);
|
||||
}
|
||||
|
||||
for (row = 0; row < h; row += nrow) {
|
||||
for (row = 0; row < h; row += nrow)
|
||||
{
|
||||
rowstoread = th - (row + img->row_offset) % th;
|
||||
nrow = (row + rowstoread > h ? h - row : rowstoread);
|
||||
for (col = 0; col < w; col += tw) {
|
||||
for (col = 0; col < w; col += tw)
|
||||
{
|
||||
if (TIFFReadTile(tif, buf, col+img->col_offset,
|
||||
row + img->row_offset, 0, 0) == (tmsize_t)(-1) &&
|
||||
img->stoponerr) {
|
||||
row+img->row_offset, 0, 0)==(tmsize_t)(-1) && img->stoponerr)
|
||||
{
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
pos = ((row+img->row_offset) % th) * TIFFTileRowSize(tif);
|
||||
|
||||
if (col + tw > w) {
|
||||
if (col + tw > w)
|
||||
{
|
||||
/*
|
||||
* Tile is clipped horizontally. Calculate
|
||||
* visible portion and skewing factors.
|
||||
|
@ -462,7 +476,9 @@ gtTileContig(TIFFRGBAImage *img, uint64 *raster, uint32 w, uint32 h)
|
|||
fromskew = tw - npix;
|
||||
(*put)(img, raster+y*w+col, col, y,
|
||||
npix, nrow, fromskew, toskew + fromskew, buf + pos);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
(*put)(img, raster+y*w+col, col, y, tw, nrow, 0, toskew, buf + pos);
|
||||
}
|
||||
}
|
||||
|
@ -540,12 +556,14 @@ gtTileSeparate(TIFFRGBAImage *img, uint64 *raster, uint32 w, uint32 h)
|
|||
if (flip & FLIP_VERTICALLY) {
|
||||
y = h - 1;
|
||||
toskew = -(int32)(tw + w);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
y = 0;
|
||||
toskew = -(int32)(tw - w);
|
||||
}
|
||||
|
||||
switch (img->photometric) {
|
||||
switch( img->photometric )
|
||||
{
|
||||
case PHOTOMETRIC_MINISWHITE:
|
||||
case PHOTOMETRIC_MINISBLACK:
|
||||
case PHOTOMETRIC_PALETTE:
|
||||
|
@ -558,32 +576,47 @@ gtTileSeparate(TIFFRGBAImage *img, uint64 *raster, uint32 w, uint32 h)
|
|||
break;
|
||||
}
|
||||
|
||||
for (row = 0; row < h; row += nrow) {
|
||||
for (row = 0; row < h; row += nrow)
|
||||
{
|
||||
rowstoread = th - (row + img->row_offset) % th;
|
||||
nrow = (row + rowstoread > h ? h - row : rowstoread);
|
||||
for (col = 0; col < w; col += tw) {
|
||||
for (col = 0; col < w; col += tw)
|
||||
{
|
||||
if (TIFFReadTile(tif, p0, col+img->col_offset,
|
||||
row + img->row_offset, 0, 0) == (tmsize_t)(-1) &&
|
||||
img->stoponerr) {
|
||||
row+img->row_offset,0,0)==(tmsize_t)(-1) && img->stoponerr)
|
||||
{
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
if (colorchannels > 1 && TIFFReadTile(tif, p1, col + img->col_offset, row + img->row_offset, 0, 1) == (tmsize_t)(-1) && img->stoponerr) {
|
||||
if (colorchannels > 1
|
||||
&& TIFFReadTile(tif, p1, col+img->col_offset,
|
||||
row+img->row_offset,0,1) == (tmsize_t)(-1)
|
||||
&& img->stoponerr)
|
||||
{
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
if (colorchannels > 1 && TIFFReadTile(tif, p2, col + img->col_offset, row + img->row_offset, 0, 2) == (tmsize_t)(-1) && img->stoponerr) {
|
||||
if (colorchannels > 1
|
||||
&& TIFFReadTile(tif, p2, col+img->col_offset,
|
||||
row+img->row_offset,0,2) == (tmsize_t)(-1)
|
||||
&& img->stoponerr)
|
||||
{
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
if (alpha && TIFFReadTile(tif, pa, col + img->col_offset, row + img->row_offset, 0, colorchannels) == (tmsize_t)(-1) && img->stoponerr) {
|
||||
if (alpha
|
||||
&& TIFFReadTile(tif,pa,col+img->col_offset,
|
||||
row+img->row_offset,0,colorchannels) == (tmsize_t)(-1)
|
||||
&& img->stoponerr)
|
||||
{
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
pos = ((row+img->row_offset) % th) * TIFFTileRowSize(tif);
|
||||
|
||||
if (col + tw > w) {
|
||||
if (col + tw > w)
|
||||
{
|
||||
/*
|
||||
* Tile is clipped horizontally. Calculate
|
||||
* visible portion and skewing factors.
|
||||
|
@ -663,7 +696,8 @@ gtStripContig(TIFFRGBAImage *img, uint64 *raster, uint32 w, uint32 h)
|
|||
TIFFGetFieldDefaulted(tif, TIFFTAG_YCBCRSUBSAMPLING, &subsamplinghor, &subsamplingver);
|
||||
scanline = TIFFScanlineSize(tif);
|
||||
fromskew = (w < imagewidth ? imagewidth - w : 0);
|
||||
for (row = 0; row < h; row += nrow) {
|
||||
for (row = 0; row < h; row += nrow)
|
||||
{
|
||||
rowstoread = rowsperstrip - (row + img->row_offset) % rowsperstrip;
|
||||
nrow = (row + rowstoread > h ? h - row : rowstoread);
|
||||
nrowsub = nrow;
|
||||
|
@ -672,8 +706,9 @@ gtStripContig(TIFFRGBAImage *img, uint64 *raster, uint32 w, uint32 h)
|
|||
if (TIFFReadEncodedStrip(tif,
|
||||
TIFFComputeStrip(tif,row+img->row_offset, 0),
|
||||
buf,
|
||||
((row + img->row_offset) % rowsperstrip + nrowsub) * scanline) == (tmsize_t)(-1) &&
|
||||
img->stoponerr) {
|
||||
((row + img->row_offset)%rowsperstrip + nrowsub) * scanline)==(tmsize_t)(-1)
|
||||
&& img->stoponerr)
|
||||
{
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
|
@ -747,12 +782,14 @@ gtStripSeparate(TIFFRGBAImage *img, uint64 *raster, uint32 w, uint32 h)
|
|||
if (flip & FLIP_VERTICALLY) {
|
||||
y = h - 1;
|
||||
toskew = -(int32)(w + w);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
y = 0;
|
||||
toskew = -(int32)(w - w);
|
||||
}
|
||||
|
||||
switch (img->photometric) {
|
||||
switch( img->photometric )
|
||||
{
|
||||
case PHOTOMETRIC_MINISWHITE:
|
||||
case PHOTOMETRIC_MINISBLACK:
|
||||
case PHOTOMETRIC_PALETTE:
|
||||
|
@ -768,28 +805,40 @@ gtStripSeparate(TIFFRGBAImage *img, uint64 *raster, uint32 w, uint32 h)
|
|||
TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
|
||||
scanline = TIFFScanlineSize(tif);
|
||||
fromskew = (w < imagewidth ? imagewidth - w : 0);
|
||||
for (row = 0; row < h; row += nrow) {
|
||||
for (row = 0; row < h; row += nrow)
|
||||
{
|
||||
rowstoread = rowsperstrip - (row + img->row_offset) % rowsperstrip;
|
||||
nrow = (row + rowstoread > h ? h - row : rowstoread);
|
||||
offset_row = row + img->row_offset;
|
||||
if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, offset_row, 0),
|
||||
p0, ((row + img->row_offset) % rowsperstrip + nrow) * scanline) == (tmsize_t)(-1) &&
|
||||
img->stoponerr) {
|
||||
p0, ((row + img->row_offset)%rowsperstrip + nrow) * scanline)==(tmsize_t)(-1)
|
||||
&& img->stoponerr)
|
||||
{
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
if (colorchannels > 1 && TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, offset_row, 1), p1, ((row + img->row_offset) % rowsperstrip + nrow) * scanline) == (tmsize_t)(-1) && img->stoponerr) {
|
||||
if (colorchannels > 1
|
||||
&& TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, offset_row, 1),
|
||||
p1, ((row + img->row_offset)%rowsperstrip + nrow) * scanline) == (tmsize_t)(-1)
|
||||
&& img->stoponerr)
|
||||
{
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
if (colorchannels > 1 && TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, offset_row, 2), p2, ((row + img->row_offset) % rowsperstrip + nrow) * scanline) == (tmsize_t)(-1) && img->stoponerr) {
|
||||
if (colorchannels > 1
|
||||
&& TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, offset_row, 2),
|
||||
p2, ((row + img->row_offset)%rowsperstrip + nrow) * scanline) == (tmsize_t)(-1)
|
||||
&& img->stoponerr)
|
||||
{
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
if (alpha) {
|
||||
if (alpha)
|
||||
{
|
||||
if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, offset_row, colorchannels),
|
||||
pa, ((row + img->row_offset) % rowsperstrip + nrow) * scanline) == (tmsize_t)(-1) &&
|
||||
img->stoponerr) {
|
||||
pa, ((row + img->row_offset)%rowsperstrip + nrow) * scanline)==(tmsize_t)(-1)
|
||||
&& img->stoponerr)
|
||||
{
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
|
@ -831,45 +880,19 @@ gtStripSeparate(TIFFRGBAImage *img, uint64 *raster, uint32 w, uint32 h)
|
|||
* PickSeparateCase analyze the parameters and select
|
||||
* the appropriate "get" and "put" routine to use.
|
||||
*/
|
||||
#define REPEAT8(op) \
|
||||
REPEAT4(op); \
|
||||
REPEAT4(op)
|
||||
#define REPEAT4(op) \
|
||||
REPEAT2(op); \
|
||||
REPEAT2(op)
|
||||
#define REPEAT2(op) \
|
||||
op; \
|
||||
op
|
||||
#define REPEAT8(op) REPEAT4(op); REPEAT4(op)
|
||||
#define REPEAT4(op) REPEAT2(op); REPEAT2(op)
|
||||
#define REPEAT2(op) op; op
|
||||
#define CASE8(x,op) \
|
||||
switch (x) { \
|
||||
case 7: \
|
||||
op; \
|
||||
case 6: \
|
||||
op; \
|
||||
case 5: \
|
||||
op; \
|
||||
case 4: \
|
||||
op; \
|
||||
case 3: \
|
||||
op; \
|
||||
case 2: \
|
||||
op; \
|
||||
case 1: \
|
||||
op; \
|
||||
}
|
||||
#define CASE4(x, op) \
|
||||
switch (x) { \
|
||||
case 3: \
|
||||
op; \
|
||||
case 2: \
|
||||
op; \
|
||||
case 1: \
|
||||
op; \
|
||||
case 7: op; case 6: op; case 5: op; \
|
||||
case 4: op; case 3: op; case 2: op; \
|
||||
case 1: op; \
|
||||
}
|
||||
#define CASE4(x,op) switch (x) { case 3: op; case 2: op; case 1: op; }
|
||||
#define NOP
|
||||
|
||||
#define UNROLL8(w, op1, op2) \
|
||||
{ \
|
||||
#define UNROLL8(w, op1, op2) { \
|
||||
uint32 _x; \
|
||||
for (_x = w; _x >= 8; _x -= 8) { \
|
||||
op1; \
|
||||
|
@ -880,8 +903,7 @@ gtStripSeparate(TIFFRGBAImage *img, uint64 *raster, uint32 w, uint32 h)
|
|||
CASE8(_x,op2); \
|
||||
} \
|
||||
}
|
||||
#define UNROLL4(w, op1, op2) \
|
||||
{ \
|
||||
#define UNROLL4(w, op1, op2) { \
|
||||
uint64 _x; \
|
||||
for (_x = w; _x >= 4; _x -= 4) { \
|
||||
op1; \
|
||||
|
@ -892,8 +914,7 @@ gtStripSeparate(TIFFRGBAImage *img, uint64 *raster, uint32 w, uint32 h)
|
|||
CASE4(_x,op2); \
|
||||
} \
|
||||
}
|
||||
#define UNROLL2(w, op1, op2) \
|
||||
{ \
|
||||
#define UNROLL2(w, op1, op2) { \
|
||||
uint64 _x; \
|
||||
for (_x = w; _x >= 2; _x -= 2) { \
|
||||
op1; \
|
||||
|
@ -905,19 +926,8 @@ gtStripSeparate(TIFFRGBAImage *img, uint64 *raster, uint32 w, uint32 h)
|
|||
} \
|
||||
}
|
||||
|
||||
#define SKEW(r, g, b, skew) \
|
||||
{ \
|
||||
r += skew; \
|
||||
g += skew; \
|
||||
b += skew; \
|
||||
}
|
||||
#define SKEW4(r, g, b, a, skew) \
|
||||
{ \
|
||||
r += skew; \
|
||||
g += skew; \
|
||||
b += skew; \
|
||||
a += skew; \
|
||||
}
|
||||
#define SKEW(r,g,b,skew) { r += skew; g += skew; b += skew; }
|
||||
#define SKEW4(r,g,b,a,skew) { r += skew; g += skew; b += skew; a+= skew; }
|
||||
|
||||
#define A1 (((uint64)0xffffL)<<48)
|
||||
#define PACK_32(r,g,b) \
|
||||
|
@ -940,7 +950,8 @@ gtStripSeparate(TIFFRGBAImage *img, uint64 *raster, uint32 w, uint32 h)
|
|||
uint32 x, uint32 y, \
|
||||
uint32 w, uint32 h, \
|
||||
int32 fromskew, int32 toskew, \
|
||||
unsigned char *pp)
|
||||
unsigned char* pp \
|
||||
)
|
||||
|
||||
/*
|
||||
* 8-bit greyscale => colormap/RGB
|
||||
|
@ -952,7 +963,8 @@ DECLAREContigPutFunc(putgreytile)
|
|||
|
||||
(void) y;
|
||||
while (h-- > 0) {
|
||||
for (x = w; x-- > 0;) {
|
||||
for (x = w; x-- > 0;)
|
||||
{
|
||||
*cp++ = BWmap[*pp][0];
|
||||
pp += samplesperpixel;
|
||||
}
|
||||
|
@ -971,7 +983,8 @@ DECLAREContigPutFunc(putagreytile)
|
|||
|
||||
(void) y;
|
||||
while (h-- > 0) {
|
||||
for (x = w; x-- > 0;) {
|
||||
for (x = w; x-- > 0;)
|
||||
{
|
||||
*cp++ = BWmap[*pp][0] & ((uint64)*(pp+1) << 48 | ~A1);
|
||||
pp += samplesperpixel;
|
||||
}
|
||||
|
@ -992,7 +1005,8 @@ DECLAREContigPutFunc(put16bitbwtile)
|
|||
while (h-- > 0) {
|
||||
uint16 *wp = (uint16 *) pp;
|
||||
|
||||
for (x = w; x-- > 0;) {
|
||||
for (x = w; x-- > 0;)
|
||||
{
|
||||
/* use high order byte of 16bit value */
|
||||
|
||||
*cp++ = BWmap[*wp >> 8][0];
|
||||
|
@ -1011,8 +1025,7 @@ DECLAREContigPutFunc(put1bitbwtile)
|
|||
{
|
||||
uint64** BWmap = (uint64**) img->BWmap;
|
||||
|
||||
(void)x;
|
||||
(void)y;
|
||||
(void) x; (void) y;
|
||||
fromskew /= 8;
|
||||
while (h-- > 0) {
|
||||
uint64* bw;
|
||||
|
@ -1029,8 +1042,7 @@ DECLAREContigPutFunc(put2bitbwtile)
|
|||
{
|
||||
uint64** BWmap = (uint64**) img->BWmap;
|
||||
|
||||
(void)x;
|
||||
(void)y;
|
||||
(void) x; (void) y;
|
||||
fromskew /= 4;
|
||||
while (h-- > 0) {
|
||||
uint64* bw;
|
||||
|
@ -1047,8 +1059,7 @@ DECLAREContigPutFunc(put4bitbwtile)
|
|||
{
|
||||
uint64** BWmap = (uint64**) img->BWmap;
|
||||
|
||||
(void)x;
|
||||
(void)y;
|
||||
(void) x; (void) y;
|
||||
fromskew /= 2;
|
||||
while (h-- > 0) {
|
||||
uint64* bw;
|
||||
|
@ -1065,8 +1076,7 @@ DECLAREContigPutFunc(putRGBcontig8bittile)
|
|||
{
|
||||
int samplesperpixel = img->samplesperpixel;
|
||||
|
||||
(void)x;
|
||||
(void)y;
|
||||
(void) x; (void) y;
|
||||
fromskew *= samplesperpixel;
|
||||
while (h-- > 0) {
|
||||
UNROLL8(w, NOP,
|
||||
|
@ -1085,8 +1095,7 @@ DECLAREContigPutFunc(putRGBAAcontig8bittile)
|
|||
{
|
||||
int samplesperpixel = img->samplesperpixel;
|
||||
|
||||
(void)x;
|
||||
(void)y;
|
||||
(void) x; (void) y;
|
||||
fromskew *= samplesperpixel;
|
||||
while (h-- > 0) {
|
||||
UNROLL8(w, NOP,
|
||||
|
@ -1146,8 +1155,7 @@ DECLAREContigPutFunc(putRGBcontig8bitCMYKtile)
|
|||
int samplesperpixel = img->samplesperpixel;
|
||||
uint16 r, g, b, k;
|
||||
|
||||
(void)x;
|
||||
(void)y;
|
||||
(void) x; (void) y;
|
||||
fromskew *= samplesperpixel;
|
||||
while (h-- > 0) {
|
||||
UNROLL8(w, NOP,
|
||||
|
@ -1196,17 +1204,15 @@ DECLAREContigPutFunc(putRGBcontig8bitCMYKMaptile)
|
|||
uint32 x, uint32 y, \
|
||||
uint32 w, uint32 h,\
|
||||
int32 fromskew, int32 toskew,\
|
||||
unsigned char *r, unsigned char *g, unsigned char *b, unsigned char *a)
|
||||
unsigned char* r, unsigned char* g, unsigned char* b, unsigned char* a\
|
||||
)
|
||||
|
||||
/*
|
||||
* 8-bit unpacked samples => RGB
|
||||
*/
|
||||
DECLARESepPutFunc(putRGBseparate8bittile)
|
||||
{
|
||||
(void)img;
|
||||
(void)x;
|
||||
(void)y;
|
||||
(void)a;
|
||||
(void) img; (void) x; (void) y; (void) a;
|
||||
while (h-- > 0) {
|
||||
UNROLL8(w, NOP, *cp++ = PACK(*r++ << 8, *g++ << 8, *b++ << 8));
|
||||
SKEW(r, g, b, fromskew);
|
||||
|
@ -1219,9 +1225,7 @@ DECLARESepPutFunc(putRGBseparate8bittile)
|
|||
*/
|
||||
DECLARESepPutFunc(putRGBAAseparate8bittile)
|
||||
{
|
||||
(void)img;
|
||||
(void)x;
|
||||
(void)y;
|
||||
(void) img; (void) x; (void) y;
|
||||
while (h-- > 0) {
|
||||
UNROLL8(w, NOP, *cp++ = PACK4(*r++ << 8, *g++ << 8, *b++ << 8, *a++ << 8));
|
||||
SKEW4(r, g, b, a, fromskew);
|
||||
|
@ -1234,8 +1238,7 @@ DECLARESepPutFunc(putRGBAAseparate8bittile)
|
|||
*/
|
||||
DECLARESepPutFunc(putCMYKseparate8bittile)
|
||||
{
|
||||
(void)img;
|
||||
(void)y;
|
||||
(void) img; (void) y;
|
||||
while (h-- > 0) {
|
||||
uint32 rv, gv, bv, kv;
|
||||
for (x = w; x-- > 0;) {
|
||||
|
@ -1258,9 +1261,7 @@ DECLARESepPutFunc(putRGBseparate16bittile)
|
|||
uint16 *wr = (uint16*) r;
|
||||
uint16 *wg = (uint16*) g;
|
||||
uint16 *wb = (uint16*) b;
|
||||
(void)img;
|
||||
(void)y;
|
||||
(void)a;
|
||||
(void) img; (void) y; (void) a;
|
||||
while (h-- > 0) {
|
||||
for (x = 0; x < w; x++)
|
||||
*cp++ = PACK(*wr++, *wg++, *wb++);
|
||||
|
@ -1278,8 +1279,7 @@ DECLARESepPutFunc(putRGBAAseparate16bittile)
|
|||
uint16 *wg = (uint16*) g;
|
||||
uint16 *wb = (uint16*) b;
|
||||
uint16 *wa = (uint16*) a;
|
||||
(void)img;
|
||||
(void)y;
|
||||
(void) img; (void) y;
|
||||
while (h-- > 0) {
|
||||
for (x = 0; x < w; x++)
|
||||
*cp++ = PACK4(*wr++, *wg++, *wb++, *wa++);
|
||||
|
@ -1317,8 +1317,7 @@ DECLAREContigPutFunc(putcontig8bitCIELab)
|
|||
* YCbCr -> RGB conversion and packing routines.
|
||||
*/
|
||||
|
||||
#define YCbCrtoRGB(dst, Y) \
|
||||
{ \
|
||||
#define YCbCrtoRGB(dst, Y) { \
|
||||
uint32 r, g, b; \
|
||||
TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b); \
|
||||
dst = PACK(((uint64)r) << 8, ((uint64)g) << 8, ((uint64)b) << 8); \
|
||||
|
@ -1375,60 +1374,39 @@ DECLAREContigPutFunc(putcontig8bitYCbCr44tile)
|
|||
switch (x) {
|
||||
default:
|
||||
switch (h) {
|
||||
default:
|
||||
YCbCrtoRGB(cp3[3], pp[15]); /* FALLTHROUGH */
|
||||
case 3:
|
||||
YCbCrtoRGB(cp2[3], pp[11]); /* FALLTHROUGH */
|
||||
case 2:
|
||||
YCbCrtoRGB(cp1[3], pp[7]); /* FALLTHROUGH */
|
||||
case 1:
|
||||
YCbCrtoRGB(cp[3], pp[3]); /* FALLTHROUGH */
|
||||
default: YCbCrtoRGB(cp3[3], pp[15]); /* FALLTHROUGH */
|
||||
case 3: YCbCrtoRGB(cp2[3], pp[11]); /* FALLTHROUGH */
|
||||
case 2: YCbCrtoRGB(cp1[3], pp[ 7]); /* FALLTHROUGH */
|
||||
case 1: YCbCrtoRGB(cp [3], pp[ 3]); /* FALLTHROUGH */
|
||||
} /* FALLTHROUGH */
|
||||
case 3:
|
||||
switch (h) {
|
||||
default:
|
||||
YCbCrtoRGB(cp3[2], pp[14]); /* FALLTHROUGH */
|
||||
case 3:
|
||||
YCbCrtoRGB(cp2[2], pp[10]); /* FALLTHROUGH */
|
||||
case 2:
|
||||
YCbCrtoRGB(cp1[2], pp[6]); /* FALLTHROUGH */
|
||||
case 1:
|
||||
YCbCrtoRGB(cp[2], pp[2]); /* FALLTHROUGH */
|
||||
default: YCbCrtoRGB(cp3[2], pp[14]); /* FALLTHROUGH */
|
||||
case 3: YCbCrtoRGB(cp2[2], pp[10]); /* FALLTHROUGH */
|
||||
case 2: YCbCrtoRGB(cp1[2], pp[ 6]); /* FALLTHROUGH */
|
||||
case 1: YCbCrtoRGB(cp [2], pp[ 2]); /* FALLTHROUGH */
|
||||
} /* FALLTHROUGH */
|
||||
case 2:
|
||||
switch (h) {
|
||||
default:
|
||||
YCbCrtoRGB(cp3[1], pp[13]); /* FALLTHROUGH */
|
||||
case 3:
|
||||
YCbCrtoRGB(cp2[1], pp[9]); /* FALLTHROUGH */
|
||||
case 2:
|
||||
YCbCrtoRGB(cp1[1], pp[5]); /* FALLTHROUGH */
|
||||
case 1:
|
||||
YCbCrtoRGB(cp[1], pp[1]); /* FALLTHROUGH */
|
||||
default: YCbCrtoRGB(cp3[1], pp[13]); /* FALLTHROUGH */
|
||||
case 3: YCbCrtoRGB(cp2[1], pp[ 9]); /* FALLTHROUGH */
|
||||
case 2: YCbCrtoRGB(cp1[1], pp[ 5]); /* FALLTHROUGH */
|
||||
case 1: YCbCrtoRGB(cp [1], pp[ 1]); /* FALLTHROUGH */
|
||||
} /* FALLTHROUGH */
|
||||
case 1:
|
||||
switch (h) {
|
||||
default:
|
||||
YCbCrtoRGB(cp3[0], pp[12]); /* FALLTHROUGH */
|
||||
case 3:
|
||||
YCbCrtoRGB(cp2[0], pp[8]); /* FALLTHROUGH */
|
||||
case 2:
|
||||
YCbCrtoRGB(cp1[0], pp[4]); /* FALLTHROUGH */
|
||||
case 1:
|
||||
YCbCrtoRGB(cp[0], pp[0]); /* FALLTHROUGH */
|
||||
default: YCbCrtoRGB(cp3[0], pp[12]); /* FALLTHROUGH */
|
||||
case 3: YCbCrtoRGB(cp2[0], pp[ 8]); /* FALLTHROUGH */
|
||||
case 2: YCbCrtoRGB(cp1[0], pp[ 4]); /* FALLTHROUGH */
|
||||
case 1: YCbCrtoRGB(cp [0], pp[ 0]); /* FALLTHROUGH */
|
||||
} /* FALLTHROUGH */
|
||||
}
|
||||
if (x < 4) {
|
||||
cp += x;
|
||||
cp1 += x;
|
||||
cp2 += x;
|
||||
cp3 += x;
|
||||
cp += x; cp1 += x; cp2 += x; cp3 += x;
|
||||
x = 0;
|
||||
} else {
|
||||
cp += 4;
|
||||
cp1 += 4;
|
||||
cp2 += 4;
|
||||
cp3 += 4;
|
||||
}
|
||||
else {
|
||||
cp += 4; cp1 += 4; cp2 += 4; cp3 += 4;
|
||||
x -= 4;
|
||||
}
|
||||
pp += 18;
|
||||
|
@ -1482,40 +1460,31 @@ DECLAREContigPutFunc(putcontig8bitYCbCr42tile)
|
|||
switch (x) {
|
||||
default:
|
||||
switch (h) {
|
||||
default:
|
||||
YCbCrtoRGB(cp1[3], pp[7]); /* FALLTHROUGH */
|
||||
case 1:
|
||||
YCbCrtoRGB(cp[3], pp[3]); /* FALLTHROUGH */
|
||||
default: YCbCrtoRGB(cp1[3], pp[ 7]); /* FALLTHROUGH */
|
||||
case 1: YCbCrtoRGB(cp [3], pp[ 3]); /* FALLTHROUGH */
|
||||
} /* FALLTHROUGH */
|
||||
case 3:
|
||||
switch (h) {
|
||||
default:
|
||||
YCbCrtoRGB(cp1[2], pp[6]); /* FALLTHROUGH */
|
||||
case 1:
|
||||
YCbCrtoRGB(cp[2], pp[2]); /* FALLTHROUGH */
|
||||
default: YCbCrtoRGB(cp1[2], pp[ 6]); /* FALLTHROUGH */
|
||||
case 1: YCbCrtoRGB(cp [2], pp[ 2]); /* FALLTHROUGH */
|
||||
} /* FALLTHROUGH */
|
||||
case 2:
|
||||
switch (h) {
|
||||
default:
|
||||
YCbCrtoRGB(cp1[1], pp[5]); /* FALLTHROUGH */
|
||||
case 1:
|
||||
YCbCrtoRGB(cp[1], pp[1]); /* FALLTHROUGH */
|
||||
default: YCbCrtoRGB(cp1[1], pp[ 5]); /* FALLTHROUGH */
|
||||
case 1: YCbCrtoRGB(cp [1], pp[ 1]); /* FALLTHROUGH */
|
||||
} /* FALLTHROUGH */
|
||||
case 1:
|
||||
switch (h) {
|
||||
default:
|
||||
YCbCrtoRGB(cp1[0], pp[4]); /* FALLTHROUGH */
|
||||
case 1:
|
||||
YCbCrtoRGB(cp[0], pp[0]); /* FALLTHROUGH */
|
||||
default: YCbCrtoRGB(cp1[0], pp[ 4]); /* FALLTHROUGH */
|
||||
case 1: YCbCrtoRGB(cp [0], pp[ 0]); /* FALLTHROUGH */
|
||||
} /* FALLTHROUGH */
|
||||
}
|
||||
if (x < 4) {
|
||||
cp += x;
|
||||
cp1 += x;
|
||||
cp += x; cp1 += x;
|
||||
x = 0;
|
||||
} else {
|
||||
cp += 4;
|
||||
cp1 += 4;
|
||||
}
|
||||
else {
|
||||
cp += 4; cp1 += 4;
|
||||
x -= 4;
|
||||
}
|
||||
pp += 10;
|
||||
|
@ -1551,19 +1520,16 @@ DECLAREContigPutFunc(putcontig8bitYCbCr41tile)
|
|||
pp += 6;
|
||||
} while (--x);
|
||||
|
||||
if ((w & 3) != 0) {
|
||||
if( (w&3) != 0 )
|
||||
{
|
||||
int32 Cb = pp[4];
|
||||
int32 Cr = pp[5];
|
||||
|
||||
switch( (w&3) ) {
|
||||
case 3:
|
||||
YCbCrtoRGB(cp[2], pp[2]);
|
||||
case 2:
|
||||
YCbCrtoRGB(cp[1], pp[1]);
|
||||
case 1:
|
||||
YCbCrtoRGB(cp[0], pp[0]);
|
||||
case 0:
|
||||
break;
|
||||
case 3: YCbCrtoRGB(cp [2], pp[2]);
|
||||
case 2: YCbCrtoRGB(cp [1], pp[1]);
|
||||
case 1: YCbCrtoRGB(cp [0], pp[0]);
|
||||
case 0: break;
|
||||
}
|
||||
|
||||
cp += (w&3);
|
||||
|
@ -1573,6 +1539,7 @@ DECLAREContigPutFunc(putcontig8bitYCbCr41tile)
|
|||
cp += toskew;
|
||||
pp += fromskew;
|
||||
} while (--h);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1653,7 +1620,8 @@ DECLAREContigPutFunc(putcontig8bitYCbCr21tile)
|
|||
pp += 4;
|
||||
} while (--x);
|
||||
|
||||
if ((w & 1) != 0) {
|
||||
if( (w&1) != 0 )
|
||||
{
|
||||
int32 Cb = pp[2];
|
||||
int32 Cr = pp[3];
|
||||
|
||||
|
@ -1758,7 +1726,11 @@ initYCbCrConversion(TIFFRGBAImage *img)
|
|||
|
||||
if (img->ycbcr == NULL) {
|
||||
img->ycbcr = (TIFFYCbCrToRGB*) _TIFFmalloc(
|
||||
TIFFroundup_32(sizeof(TIFFYCbCrToRGB), sizeof(long)) + 4 * 256 * sizeof(TIFFRGBValue) + 2 * 256 * sizeof(int) + 3 * 256 * sizeof(int32));
|
||||
TIFFroundup_32(sizeof (TIFFYCbCrToRGB), sizeof (long))
|
||||
+ 4*256*sizeof (TIFFRGBValue)
|
||||
+ 2*256*sizeof (int)
|
||||
+ 3*256*sizeof (int32)
|
||||
);
|
||||
if (img->ycbcr == NULL) {
|
||||
TIFFErrorExt(img->tif->tif_clientdata, module,
|
||||
"No space for YCbCr->RGB conversion state");
|
||||
|
@ -1795,7 +1767,8 @@ initCIELabConversion(TIFFRGBAImage *img)
|
|||
TIFFGetFieldDefaulted(img->tif, TIFFTAG_WHITEPOINT, &whitePoint);
|
||||
refWhite[1] = 100.0F;
|
||||
refWhite[0] = whitePoint[0] / whitePoint[1] * refWhite[1];
|
||||
refWhite[2] = (1.0F - whitePoint[0] - whitePoint[1]) / whitePoint[1] * refWhite[1];
|
||||
refWhite[2] = (1.0F - whitePoint[0] - whitePoint[1])
|
||||
/ whitePoint[1] * refWhite[1];
|
||||
if (TIFFCIELabToRGBInit(img->cielab, &display_sRGB, refWhite) < 0) {
|
||||
TIFFErrorExt(img->tif->tif_clientdata, module,
|
||||
"Failed to initialize CIE L*a*b*->RGB conversion state.");
|
||||
|
@ -1836,9 +1809,7 @@ makebwmap(TIFFRGBAImage *img)
|
|||
TIFFRGBValue c;
|
||||
img->BWmap[i] = (uint32*) p;
|
||||
switch (bitspersample) {
|
||||
#define GREY(x) \
|
||||
c = Map[x]; \
|
||||
*p++ = PACK(c << 8, c << 8, c << 8);
|
||||
#define GREY(x) c = Map[x]; *p++ = PACK(c << 8,c << 8,c << 8);
|
||||
case 1:
|
||||
GREY(i>>7);
|
||||
GREY((i>>6)&1);
|
||||
|
@ -1972,9 +1943,7 @@ makecmap(TIFFRGBAImage *img)
|
|||
for (i = 0; i < 256; i++) {
|
||||
TIFFRGBValue c;
|
||||
img->PALmap[i] = p;
|
||||
#define CMAP(x) \
|
||||
c = (TIFFRGBValue)x; \
|
||||
*p++ = PACK_32(r[c] & 0xff, g[c] & 0xff, b[c] & 0xff);
|
||||
#define CMAP(x) c = (TIFFRGBValue) x; *p++ = PACK_32(r[c]&0xff, g[c]&0xff, b[c]&0xff);
|
||||
switch (bitspersample) {
|
||||
case 1:
|
||||
CMAP(i>>7);
|
||||
|
@ -2064,7 +2033,8 @@ PickContigCase(TIFFRGBAImage *img)
|
|||
case 16:
|
||||
if (img->alpha != EXTRASAMPLE_UNSPECIFIED)
|
||||
img->put.contig = (tileContigRoutine) putRGBAAcontig16bittile;
|
||||
else {
|
||||
else
|
||||
{
|
||||
if (BuildMapBitdepth16To8(img))
|
||||
img->put.contig = (tileContigRoutine) putRGBcontig16bittile;
|
||||
}
|
||||
|
@ -2108,8 +2078,10 @@ PickContigCase(TIFFRGBAImage *img)
|
|||
}
|
||||
break;
|
||||
case PHOTOMETRIC_YCBCR:
|
||||
if ((img->bitspersample == 8) && (img->samplesperpixel == 3)) {
|
||||
if (initYCbCrConversion(img) != 0) {
|
||||
if ((img->bitspersample==8) && (img->samplesperpixel==3))
|
||||
{
|
||||
if (initYCbCrConversion(img)!=0)
|
||||
{
|
||||
/*
|
||||
* The 6.0 spec says that subsampling must be
|
||||
* one of 1, 2, or 4, and that vertical subsampling
|
||||
|
@ -2182,10 +2154,13 @@ PickSeparateCase(TIFFRGBAImage *img)
|
|||
img->put.separate = (tileSeparateRoutine) putRGBseparate8bittile;
|
||||
break;
|
||||
case 16:
|
||||
if (img->alpha != EXTRASAMPLE_UNSPECIFIED) {
|
||||
if (img->alpha != EXTRASAMPLE_UNSPECIFIED)
|
||||
{
|
||||
if (BuildMapBitdepth16To8(img))
|
||||
img->put.separate = (tileSeparateRoutine) putRGBAAseparate16bittile;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (BuildMapBitdepth16To8(img))
|
||||
img->put.separate = (tileSeparateRoutine) putRGBseparate16bittile;
|
||||
}
|
||||
|
@ -2193,14 +2168,17 @@ PickSeparateCase(TIFFRGBAImage *img)
|
|||
}
|
||||
break;
|
||||
case PHOTOMETRIC_SEPARATED:
|
||||
if (img->bitspersample == 8 && img->samplesperpixel == 4) {
|
||||
if (img->bitspersample == 8 && img->samplesperpixel == 4)
|
||||
{
|
||||
img->alpha = 1; // Not alpha, but seems like the only way to get 4th band
|
||||
img->put.separate = (tileSeparateRoutine) putCMYKseparate8bittile;
|
||||
}
|
||||
break;
|
||||
case PHOTOMETRIC_YCBCR:
|
||||
if ((img->bitspersample == 8) && (img->samplesperpixel == 3)) {
|
||||
if (initYCbCrConversion(img) != 0) {
|
||||
if ((img->bitspersample==8) && (img->samplesperpixel==3))
|
||||
{
|
||||
if (initYCbCrConversion(img)!=0)
|
||||
{
|
||||
uint16 hs, vs;
|
||||
TIFFGetFieldDefaulted(img->tif, TIFFTAG_YCBCRSUBSAMPLING, &hs, &vs);
|
||||
switch ((hs<<4)|vs) {
|
||||
|
@ -2224,7 +2202,8 @@ BuildMapBitdepth16To8(TIFFRGBAImage *img)
|
|||
uint32 n;
|
||||
assert(img->Bitdepth16To8==NULL);
|
||||
img->Bitdepth16To8=_TIFFmalloc(65536);
|
||||
if (img->Bitdepth16To8 == NULL) {
|
||||
if (img->Bitdepth16To8==NULL)
|
||||
{
|
||||
TIFFErrorExt(img->tif->tif_clientdata,module,"Out of memory");
|
||||
return(0);
|
||||
}
|
||||
|
@ -2234,6 +2213,7 @@ BuildMapBitdepth16To8(TIFFRGBAImage *img)
|
|||
return(1);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Read a whole strip off data from the file, and convert to RGBA form.
|
||||
* If this is the last strip, then it will only contain the portion of
|
||||
|
@ -2241,7 +2221,9 @@ BuildMapBitdepth16To8(TIFFRGBAImage *img)
|
|||
* organized in bottom to top form.
|
||||
*/
|
||||
|
||||
int TIFFReadRGBAStrip_64(TIFF *tif, uint32 row, uint64 *raster)
|
||||
|
||||
int
|
||||
TIFFReadRGBAStrip_64(TIFF* tif, uint32 row, uint64 * raster )
|
||||
|
||||
{
|
||||
char emsg[1024] = "";
|
||||
|
@ -2249,14 +2231,16 @@ int TIFFReadRGBAStrip_64(TIFF *tif, uint32 row, uint64 *raster)
|
|||
int ok;
|
||||
uint32 rowsperstrip, rows_to_read;
|
||||
|
||||
if (TIFFIsTiled(tif)) {
|
||||
if( TIFFIsTiled( tif ) )
|
||||
{
|
||||
TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif),
|
||||
"Can't use TIFFReadRGBAStrip() with tiled file.");
|
||||
return (0);
|
||||
}
|
||||
|
||||
TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
|
||||
if ((row % rowsperstrip) != 0) {
|
||||
if( (row % rowsperstrip) != 0 )
|
||||
{
|
||||
TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif),
|
||||
"Row passed to TIFFReadRGBAStrip() must be first in a strip.");
|
||||
return (0);
|
||||
|
@ -2289,7 +2273,8 @@ int TIFFReadRGBAStrip_64(TIFF *tif, uint32 row, uint64 *raster)
|
|||
* and may include zeroed areas if the tile extends off the image.
|
||||
*/
|
||||
|
||||
int TIFFReadRGBATile_64(TIFF *tif, uint32 col, uint32 row, uint64 *raster)
|
||||
int
|
||||
TIFFReadRGBATile_64(TIFF* tif, uint32 col, uint32 row, uint64 * raster)
|
||||
|
||||
{
|
||||
char emsg[1024] = "";
|
||||
|
@ -2304,7 +2289,8 @@ int TIFFReadRGBATile_64(TIFF *tif, uint32 col, uint32 row, uint64 *raster)
|
|||
* tile boundary.
|
||||
*/
|
||||
|
||||
if (!TIFFIsTiled(tif)) {
|
||||
if( !TIFFIsTiled( tif ) )
|
||||
{
|
||||
TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif),
|
||||
"Can't use TIFFReadRGBATile() with stripped file.");
|
||||
return (0);
|
||||
|
@ -2312,7 +2298,8 @@ int TIFFReadRGBATile_64(TIFF *tif, uint32 col, uint32 row, uint64 *raster)
|
|||
|
||||
TIFFGetFieldDefaulted(tif, TIFFTAG_TILEWIDTH, &tile_xsize);
|
||||
TIFFGetFieldDefaulted(tif, TIFFTAG_TILELENGTH, &tile_ysize);
|
||||
if ((col % tile_xsize) != 0 || (row % tile_ysize) != 0) {
|
||||
if( (col % tile_xsize) != 0 || (row % tile_ysize) != 0 )
|
||||
{
|
||||
TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif),
|
||||
"Row/col passed to TIFFReadRGBATile() must be top"
|
||||
"left corner of a tile.");
|
||||
|
@ -2323,7 +2310,8 @@ int TIFFReadRGBATile_64(TIFF *tif, uint32 col, uint32 row, uint64 *raster)
|
|||
* Setup the RGBA reader.
|
||||
*/
|
||||
|
||||
if (!TIFFRGBAImageOK(tif, emsg) || !TIFFRGBAImageBegin_64(&img, tif, 0, emsg)) {
|
||||
if (!TIFFRGBAImageOK(tif, emsg)
|
||||
|| !TIFFRGBAImageBegin_64(&img, tif, 0, emsg)) {
|
||||
TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "%s", emsg);
|
||||
return( 0 );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue