43static const char photoTag[] =
"PhotometricInterpretation";
48#define FLIP_VERTICALLY 0x01
49#define FLIP_HORIZONTALLY 0x02
57 { 3.2410F, -1.5374F, -0.4986F },
58 { -0.9692F, 1.8760F, 0.0416F },
59 { 0.0556F, -0.2040F, 1.0570F }
61 100.0F, 100.0F, 100.0F,
81 sprintf(emsg,
"Sorry, requested compression method is not configured");
92 sprintf(emsg,
"Sorry, can not handle images with %d-bit samples",
97 sprintf(emsg,
"Sorry, can not handle images with IEEE floating-point samples");
102 switch (colorchannels) {
114 switch (photometric) {
122 "Sorry, can not handle contiguous data with %s=%d, "
123 "and %s=%d and Bits/Sample=%d",
144 if (colorchannels < 3) {
145 sprintf(emsg,
"Sorry, can not handle RGB image with %s=%d",
146 "Color channels", colorchannels);
156 "Sorry, can not handle separated image with %s=%d",
162 "Sorry, can not handle separated image with %s=%d",
170 sprintf(emsg,
"Sorry, LogL data must have %s=%d",
178 sprintf(emsg,
"Sorry, LogLuv data must have %s=%d or %d",
183 sprintf(emsg,
"Sorry, can not handle LogLuv images with %s=%d",
189 "Sorry, can not handle image with %s=%d, %s=%d",
191 "colorchannels", colorchannels);
198 "Sorry, can not handle image with %s=%d, %s=%d and %s=%d",
200 "colorchannels", colorchannels,
206 sprintf(emsg,
"Sorry, can not handle image with %s=%d",
240 if (
img->Bitdepth16To8) {
272 uint16 *red_orig, *green_orig, *blue_orig;
294 img->stoponerr = stop;
296 switch (
img->bitspersample) {
304 sprintf(emsg,
"Sorry, can not handle images with %d-bit samples",
311 &extrasamples, &sampleinfo);
312 if (extrasamples >= 1)
314 switch (sampleinfo[0]) {
316 if (
img->samplesperpixel > 3)
321 img->alpha = sampleinfo[0];
326#ifdef DEFAULT_EXTRASAMPLE_AS_ALPHA
330 if( extrasamples == 0
331 &&
img->samplesperpixel == 4
339 colorchannels =
img->samplesperpixel - extrasamples;
343 switch (colorchannels) {
358 switch (
img->photometric) {
361 &red_orig, &green_orig, &blue_orig)) {
362 sprintf(emsg,
"Missing required \"Colormap\" tag");
367 n_color = (1U <<
img->bitspersample);
371 if( !
img->redcmap || !
img->greencmap || !
img->bluecmap ) {
372 sprintf(emsg,
"Out of memory for colormap copy");
384 &&
img->samplesperpixel != 1
385 &&
img->bitspersample < 8 ) {
387 "Sorry, can not handle contiguous data with %s=%d, "
388 "and %s=%d and Bits/Sample=%d",
390 "Samples/pixel",
img->samplesperpixel,
422 if (colorchannels < 3) {
423 sprintf(emsg,
"Sorry, can not handle RGB image with %s=%d",
424 "Color channels", colorchannels);
433 sprintf(emsg,
"Sorry, can not handle separated image with %s=%d",
437 if (
img->samplesperpixel < 4) {
438 sprintf(emsg,
"Sorry, can not handle separated image with %s=%d",
439 "Samples/pixel",
img->samplesperpixel);
446 sprintf(emsg,
"Sorry, LogL data must have %s=%d",
452 img->bitspersample = 8;
456 sprintf(emsg,
"Sorry, LogLuv data must have %s=%d or %d",
461 sprintf(emsg,
"Sorry, can not handle LogLuv images with %s=%d",
462 "Planarconfiguration", planarconfig);
467 img->bitspersample = 8;
472 sprintf(emsg,
"Sorry, can not handle image with %s=%d",
483 sprintf(emsg,
"Sorry, can not handle image");
488 sprintf(emsg,
"Sorry, can not handle image");
508 "No \"put\" routine setupl; probably can not handle image format");
511 return (*
img->get)(
img, raster,
w,
h);
521 int orientation,
int stop)
523 char emsg[1024] =
"";
528 img.req_orientation = (
uint16)orientation;
555 switch (
img->orientation) {
628 int32 fromskew, toskew;
632 int32 this_toskew, leftmost_toskew;
633 int32 leftmost_fromskew;
649 toskew = -(
int32)(tw +
w);
653 toskew = -(
int32)(tw -
w);
659 leftmost_fromskew =
img->col_offset % tw;
660 leftmost_tw = tw - leftmost_fromskew;
661 leftmost_toskew = toskew + leftmost_fromskew;
664 rowstoread = th - (
row +
img->row_offset) % th;
665 nrow = (
row + rowstoread >
h ?
h -
row : rowstoread);
666 fromskew = leftmost_fromskew;
667 this_tw = leftmost_tw;
668 this_toskew = leftmost_toskew;
670 col =
img->col_offset;
682 if (tocol + this_tw >
w)
687 fromskew = tw - (
w - tocol);
688 this_tw = tw - fromskew;
689 this_toskew = toskew + fromskew;
691 (*put)(
img, raster+
y*
w+tocol, tocol,
y, this_tw, nrow, fromskew, this_toskew,
buf +
pos);
699 this_toskew = toskew;
741 unsigned char* p0 =
NULL;
742 unsigned char* p1 =
NULL;
743 unsigned char* p2 =
NULL;
747 int32 fromskew, toskew;
753 int32 this_toskew, leftmost_toskew;
754 int32 leftmost_fromskew;
769 toskew = -(
int32)(tw +
w);
773 toskew = -(
int32)(tw -
w);
776 switch(
img->photometric )
792 leftmost_fromskew =
img->col_offset % tw;
793 leftmost_tw = tw - leftmost_fromskew;
794 leftmost_toskew = toskew + leftmost_fromskew;
797 rowstoread = th - (
row +
img->row_offset) % th;
798 nrow = (
row + rowstoread >
h ?
h -
row : rowstoread);
799 fromskew = leftmost_fromskew;
800 this_tw = leftmost_tw;
801 this_toskew = leftmost_toskew;
803 col =
img->col_offset;
817 if( colorchannels == 1 )
835 if (colorchannels > 1
843 if (colorchannels > 1
862 if (tocol + this_tw >
w)
867 fromskew = tw - (
w - tocol);
868 this_tw = tw - fromskew;
869 this_toskew = toskew + fromskew;
871 (*put)(
img, raster+
y*
w+tocol, tocol,
y, this_tw, nrow, fromskew, this_toskew, \
880 this_toskew = toskew;
922 uint16 subsamplinghor,subsamplingver;
925 int32 fromskew, toskew;
930 if( subsamplingver == 0 ) {
949 fromskew = (
w < imagewidth ? imagewidth -
w : 0);
953 rowstoread = rowsperstrip - (
row +
img->row_offset) % rowsperstrip;
954 nrow = (
row + rowstoread >
h ?
h -
row : rowstoread);
956 if ((nrowsub%subsamplingver)!=0)
957 nrowsub+=subsamplingver-nrowsub%subsamplingver;
958 temp = (
row +
img->row_offset)%rowsperstrip + nrowsub;
975 pos = ((
row +
img->row_offset) % rowsperstrip) * scanline + \
977 (*put)(
img, raster+
y*
w, 0,
y,
w, nrow, fromskew, toskew,
buf +
pos);
1018 uint32 rowsperstrip, offset_row;
1022 int32 fromskew, toskew;
1043 switch(
img->photometric )
1058 fromskew = (
w < imagewidth ? imagewidth -
w : 0);
1062 rowstoread = rowsperstrip - (
row +
img->row_offset) % rowsperstrip;
1063 nrow = (
row + rowstoread >
h ?
h -
row : rowstoread);
1064 offset_row =
row +
img->row_offset;
1065 temp = (
row +
img->row_offset)%rowsperstrip + nrow;
1083 if( colorchannels == 1 )
1090 p1 = p0 + stripsize;
1091 p2 = p1 + stripsize;
1102 if (colorchannels > 1
1110 if (colorchannels > 1
1129 pos = ((
row +
img->row_offset) % rowsperstrip) * scanline + \
1131 (*put)(
img, raster+
y*
w, 0,
y,
w, nrow, fromskew, toskew, p0 +
pos, p1 +
pos,
1167#define REPEAT8(op) REPEAT4(op); REPEAT4(op)
1168#define REPEAT4(op) REPEAT2(op); REPEAT2(op)
1169#define REPEAT2(op) op; op
1170#define CASE8(x,op) \
1180#define CASE4(x,op) switch (x) { case 3: op; case 2: op; case 1: op; }
1183#define UNROLL8(w, op1, op2) { \
1185 for (_x = w; _x >= 8; _x -= 8) { \
1194#define UNROLL4(w, op1, op2) { \
1196 for (_x = w; _x >= 4; _x -= 4) { \
1205#define UNROLL2(w, op1, op2) { \
1207 for (_x = w; _x >= 2; _x -= 2) { \
1217#define SKEW(r,g,b,skew) { r += skew; g += skew; b += skew; }
1218#define SKEW4(r,g,b,a,skew) { r += skew; g += skew; b += skew; a+= skew; }
1220#define A1 (((uint32)0xffL)<<24)
1221#define PACK(r,g,b) \
1222 ((uint32)(r)|((uint32)(g)<<8)|((uint32)(b)<<16)|A1)
1223#define PACK4(r,g,b,a) \
1224 ((uint32)(r)|((uint32)(g)<<8)|((uint32)(b)<<16)|((uint32)(a)<<24))
1225#define W2B(v) (((v)>>8)&0xff)
1227#define PACKW(r,g,b) \
1228 ((uint32)W2B(r)|((uint32)W2B(g)<<8)|((uint32)W2B(b)<<16)|A1)
1229#define PACKW4(r,g,b,a) \
1230 ((uint32)W2B(r)|((uint32)W2B(g)<<8)|((uint32)W2B(b)<<16)|((uint32)W2B(a)<<24))
1232#define DECLAREContigPutFunc(name) \
1234 TIFFRGBAImage* img, \
1236 uint32 x, uint32 y, \
1237 uint32 w, uint32 h, \
1238 int32 fromskew, int32 toskew, \
1248 int samplesperpixel =
img->samplesperpixel;
1251 for( ;
h > 0; --
h) {
1252 for (
x =
w;
x > 0; --
x)
1254 *
cp++ = PALmap[*pp][0];
1255 pp += samplesperpixel;
1271 for( ;
h > 0; --
h) {
1288 for( ;
h > 0; --
h) {
1305 for( ;
h > 0; --
h) {
1318 int samplesperpixel =
img->samplesperpixel;
1322 for( ;
h > 0; --
h) {
1323 for (
x =
w;
x > 0; --
x)
1325 *
cp++ = BWmap[*pp][0];
1326 pp += samplesperpixel;
1338 int samplesperpixel =
img->samplesperpixel;
1342 for( ;
h > 0; --
h) {
1343 for (
x =
w;
x > 0; --
x)
1345 *
cp++ = BWmap[*pp][0] & ((
uint32)*(pp+1) << 24 | ~A1);
1346 pp += samplesperpixel;
1358 int samplesperpixel =
img->samplesperpixel;
1362 for( ;
h > 0; --
h) {
1365 for (
x =
w;
x > 0; --
x)
1369 *
cp++ = BWmap[*wp >> 8][0];
1370 pp += 2 * samplesperpixel;
1371 wp += samplesperpixel;
1387 for( ;
h > 0; --
h) {
1404 for( ;
h > 0; --
h) {
1421 for( ;
h > 0; --
h) {
1434 int samplesperpixel =
img->samplesperpixel;
1437 fromskew *= samplesperpixel;
1438 for( ;
h > 0; --
h) {
1440 *
cp++ =
PACK(pp[0], pp[1], pp[2]);
1441 pp += samplesperpixel);
1453 int samplesperpixel =
img->samplesperpixel;
1456 fromskew *= samplesperpixel;
1457 for( ;
h > 0; --
h) {
1459 *
cp++ =
PACK4(pp[0], pp[1], pp[2], pp[3]);
1460 pp += samplesperpixel);
1472 int samplesperpixel =
img->samplesperpixel;
1474 fromskew *= samplesperpixel;
1475 for( ;
h > 0; --
h) {
1478 for (
x =
w;
x > 0; --
x) {
1485 pp += samplesperpixel;
1497 int samplesperpixel =
img->samplesperpixel;
1500 fromskew *= samplesperpixel;
1501 for( ;
h > 0; --
h) {
1502 for (
x =
w;
x > 0; --
x) {
1504 img->Bitdepth16To8[wp[1]],
1505 img->Bitdepth16To8[wp[2]]);
1506 wp += samplesperpixel;
1519 int samplesperpixel =
img->samplesperpixel;
1522 fromskew *= samplesperpixel;
1523 for( ;
h > 0; --
h) {
1524 for (
x =
w;
x > 0; --
x) {
1526 img->Bitdepth16To8[wp[1]],
1527 img->Bitdepth16To8[wp[2]],
1528 img->Bitdepth16To8[wp[3]]);
1529 wp += samplesperpixel;
1542 int samplesperpixel =
img->samplesperpixel;
1545 fromskew *= samplesperpixel;
1546 for( ;
h > 0; --
h) {
1549 for (
x =
w;
x > 0; --
x) {
1550 a =
img->Bitdepth16To8[wp[3]];
1552 r =
m[
img->Bitdepth16To8[wp[0]]];
1553 g =
m[
img->Bitdepth16To8[wp[1]]];
1554 b =
m[
img->Bitdepth16To8[wp[2]]];
1556 wp += samplesperpixel;
1570 int samplesperpixel =
img->samplesperpixel;
1574 fromskew *= samplesperpixel;
1575 for( ;
h > 0; --
h) {
1578 r = (
k*(255-pp[0]))/255;
1579 g = (
k*(255-pp[1]))/255;
1580 b = (
k*(255-pp[2]))/255;
1582 pp += samplesperpixel);
1595 int samplesperpixel =
img->samplesperpixel;
1600 fromskew *= samplesperpixel;
1601 for( ;
h > 0; --
h) {
1602 for (
x =
w;
x > 0; --
x) {
1604 r = (
k*(255-pp[0]))/255;
1605 g = (
k*(255-pp[1]))/255;
1606 b = (
k*(255-pp[2]))/255;
1608 pp += samplesperpixel;
1615#define DECLARESepPutFunc(name) \
1617 TIFFRGBAImage* img,\
1619 uint32 x, uint32 y, \
1620 uint32 w, uint32 h,\
1621 int32 fromskew, int32 toskew,\
1622 unsigned char* r, unsigned char* g, unsigned char* b, unsigned char* a\
1631 for( ;
h > 0; --
h) {
1644 for( ;
h > 0; --
h) {
1657 for( ;
h > 0; --
h) {
1659 for (
x =
w;
x > 0; --
x) {
1661 rv = (kv*(255-*
r++))/255;
1662 gv = (kv*(255-*
g++))/255;
1663 bv = (kv*(255-*
b++))/255;
1677 for( ;
h > 0; --
h) {
1680 for (
x =
w;
x > 0; --
x) {
1702 for( ;
h > 0; --
h) {
1703 for (
x = 0;
x <
w;
x++)
1705 img->Bitdepth16To8[*wg++],
1706 img->Bitdepth16To8[*wb++]);
1707 SKEW(wr, wg, wb, fromskew);
1722 for( ;
h > 0; --
h) {
1723 for (
x = 0;
x <
w;
x++)
1725 img->Bitdepth16To8[*wg++],
1726 img->Bitdepth16To8[*wb++],
1727 img->Bitdepth16To8[*wa++]);
1728 SKEW4(wr, wg, wb, wa, fromskew);
1743 for( ;
h > 0; --
h) {
1746 for (
x =
w;
x > 0; --
x) {
1747 a2 =
img->Bitdepth16To8[*wa++];
1749 r2 =
m[
img->Bitdepth16To8[*wr++]];
1750 g2 =
m[
img->Bitdepth16To8[*wg++]];
1751 b2 =
m[
img->Bitdepth16To8[*wb++]];
1754 SKEW4(wr, wg, wb, wa, fromskew);
1768 for( ;
h > 0; --
h) {
1769 for (
x =
w;
x > 0; --
x) {
1771 (
unsigned char)pp[0],
1788#define YCbCrtoRGB(dst, Y) { \
1790 TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b); \
1791 dst = PACK(r, g, b); \
1803static void putcontig8bitYCbCrGenericTile(
1817 int32 incr = 3*
w+4*toskew;
1819 int group_size = v_group * h_group + 2;
1822 fromskew = (fromskew * group_size) / h_group;
1824 for( yy = 0; yy <
h; yy++ )
1826 unsigned char *pp_line;
1827 int y_line_group = yy / v_group;
1828 int y_remainder = yy - y_line_group * v_group;
1830 pp_line = pp + v_line_group *
1838 for (;
h >= 4;
h -= 4) {
1861 cp += 4, cp1 += 4, cp2 += 4, cp3 += 4;
1864 cp += incr, cp1 += incr, cp2 += incr, cp3 += incr;
1878 int32 incr = 3*
w+4*toskew;
1882 fromskew = (fromskew / 4) * (4*2+2);
1883 if ((
h & 3) == 0 && (
w & 3) == 0) {
1884 for (;
h >= 4;
h -= 4) {
1921 for (
x =
w;
x > 0;) {
1955 cp +=
x; cp1 +=
x; cp2 +=
x; cp3 +=
x;
1959 cp += 4; cp1 += 4; cp2 += 4; cp3 += 4;
1985 fromskew = (fromskew / 4) * (4*2+2);
1986 if ((
w & 3) == 0 && (
h & 1) == 0) {
1987 for (;
h >= 2;
h -= 2) {
2012 for (
x =
w;
x > 0;) {
2063 fromskew = (fromskew / 4) * (4*1+2);
2110 fromskew = (fromskew / 2) * (2*2+2);
2166 fromskew = (fromskew / 2) * (2*1+2);
2205 fromskew = (fromskew / 1) * (1 * 2 + 2);
2241 fromskew = (fromskew / 1) * (1 * 1 + 2);
2265 for( ;
h > 0; --
h) {
2280 return f > (
float)(-0x7FFFFFFF + 128) &&
f < (
float)0x7FFFFFFF;
2286 static const char module[] =
"initYCbCrConversion";
2288 float *luma, *refBlackWhite;
2294 + 2*256*
sizeof (
int)
2295 + 3*256*
sizeof (
int32)
2299 "No space for YCbCr->RGB conversion state");
2310 if( luma[0] != luma[0] ||
2311 luma[1] != luma[1] ||
2313 luma[2] != luma[2] )
2316 "Invalid values for YCbCrCoefficients tag");
2328 "Invalid values for ReferenceBlackWhite tag");
2340 static const char module[] =
"initCIELabConversion";
2346 if (whitePoint[1] == 0.0f ) {
2348 "Invalid value for WhitePoint tag.");
2357 "No space for CIE L*a*b*->RGB conversion state.");
2362 refWhite[1] = 100.0F;
2363 refWhite[0] = whitePoint[0] / whitePoint[1] * refWhite[1];
2364 refWhite[2] = (1.0F - whitePoint[0] - whitePoint[1])
2365 / whitePoint[1] * refWhite[1];
2368 "Failed to initialize CIE L*a*b*->RGB conversion state.");
2373 return putcontig8bitCIELab;
2387 int bitspersample =
img->bitspersample;
2388 int nsamples = 8 / bitspersample;
2402 for (
i = 0;
i < 256;
i++) {
2405 switch (bitspersample) {
2406#define GREY(x) c = Map[x]; *p++ = PACK(c,c,c);
2450 if(
img->bitspersample == 16 )
2456 "No space for photometric conversion table");
2466 if (
img->bitspersample <= 16 &&
2488 long n = 1L<<
img->bitspersample;
2491 if (*
r++ >= 256 || *
g++ >= 256 || *
b++ >= 256)
2504 for (
i = (1L<<
img->bitspersample)-1;
i >= 0;
i--) {
2505#define CVT(x) ((uint16)((x)>>8))
2523 int bitspersample =
img->bitspersample;
2524 int nsamples = 8 / bitspersample;
2538 for (
i = 0;
i < 256;
i++) {
2541#define CMAP(x) c = (TIFFRGBValue) x; *p++ = PACK(r[c]&0xff, g[c]&0xff, b[c]&0xff);
2542 switch (bitspersample) {
2579 switch (
img->photometric) {
2583 if (
img->bitspersample == 8)
2619 switch (
img->photometric) {
2621 switch (
img->bitspersample) {
2624 img->samplesperpixel >= 4)
2625 img->put.contig = putRGBAAcontig8bittile;
2627 img->samplesperpixel >= 4)
2630 img->put.contig = putRGBUAcontig8bittile;
2632 else if(
img->samplesperpixel >= 3 )
2633 img->put.contig = putRGBcontig8bittile;
2637 img->samplesperpixel >=4 )
2640 img->put.contig = putRGBAAcontig16bittile;
2643 img->samplesperpixel >=4 )
2647 img->put.contig = putRGBUAcontig16bittile;
2649 else if(
img->samplesperpixel >=3 )
2652 img->put.contig = putRGBcontig16bittile;
2659 if (
img->bitspersample == 8) {
2661 img->put.contig = putRGBcontig8bitCMYKtile;
2663 img->put.contig = putRGBcontig8bitCMYKMaptile;
2669 switch (
img->bitspersample) {
2671 img->put.contig = put8bitcmaptile;
2674 img->put.contig = put4bitcmaptile;
2677 img->put.contig = put2bitcmaptile;
2680 img->put.contig = put1bitcmaptile;
2688 switch (
img->bitspersample) {
2690 img->put.contig = put16bitbwtile;
2693 if (
img->alpha &&
img->samplesperpixel == 2)
2694 img->put.contig = putagreytile;
2696 img->put.contig = putgreytile;
2699 img->put.contig = put4bitbwtile;
2702 img->put.contig = put2bitbwtile;
2705 img->put.contig = put1bitbwtile;
2711 if ((
img->bitspersample==8) && (
img->samplesperpixel==3))
2727 switch ((SubsamplingHor<<4)|SubsamplingVer) {
2729 img->put.contig = putcontig8bitYCbCr44tile;
2732 img->put.contig = putcontig8bitYCbCr42tile;
2735 img->put.contig = putcontig8bitYCbCr41tile;
2738 img->put.contig = putcontig8bitYCbCr22tile;
2741 img->put.contig = putcontig8bitYCbCr21tile;
2744 img->put.contig = putcontig8bitYCbCr12tile;
2747 img->put.contig = putcontig8bitYCbCr11tile;
2755 if (
img->bitspersample == 8)
2774 switch (
img->photometric) {
2779 switch (
img->bitspersample) {
2782 img->put.separate = putRGBAAseparate8bittile;
2786 img->put.separate = putRGBUAseparate8bittile;
2789 img->put.separate = putRGBseparate8bittile;
2795 img->put.separate = putRGBAAseparate16bittile;
2801 img->put.separate = putRGBUAseparate16bittile;
2806 img->put.separate = putRGBseparate16bittile;
2812 if (
img->bitspersample == 8 &&
img->samplesperpixel == 4)
2815 img->put.separate = putCMYKseparate8bittile;
2819 if ((
img->bitspersample==8) && (
img->samplesperpixel==3))
2825 switch ((hs<<4)|
vs) {
2827 img->put.separate = putseparate8bitYCbCr11tile;
2841 static const char module[]=
"BuildMapUaToAa";
2852 for (na=0; na<256; na++)
2854 for (nv=0; nv<256; nv++)
2855 *
m++=(
uint8)((nv*na+127)/255);
2863 static const char module[]=
"BuildMapBitdepth16To8";
2873 m=
img->Bitdepth16To8;
2874 for (
n=0;
n<65536;
n++)
2899 char emsg[1024] =
"";
2902 uint32 rowsperstrip, rows_to_read;
2907 "Can't use TIFFReadRGBAStrip() with tiled file.");
2912 if( (
row % rowsperstrip) != 0 )
2915 "Row passed to TIFFReadRGBAStrip() must be first in a strip.");
2924 if(
row + rowsperstrip >
img.height )
2925 rows_to_read =
img.height -
row;
2927 rows_to_read = rowsperstrip;
2957 char emsg[1024] =
"";
2960 uint32 tile_xsize, tile_ysize;
2961 uint32 read_xsize, read_ysize;
2972 "Can't use TIFFReadRGBATile() with striped file.");
2978 if( (col % tile_xsize) != 0 || (
row % tile_ysize) != 0 )
2981 "Row/col passed to TIFFReadRGBATile() must be top"
2982 "left corner of a tile.");
3003 if(
row + tile_ysize >
img.height )
3004 read_ysize =
img.height -
row;
3006 read_ysize = tile_ysize;
3008 if( col + tile_xsize >
img.width )
3009 read_xsize =
img.width - col;
3011 read_xsize = tile_xsize;
3018 img.col_offset = col;
3032 if( read_xsize == tile_xsize && read_ysize == tile_ysize )
3035 for( i_row = 0; i_row < read_ysize; i_row++ ) {
3036 memmove( raster + (tile_ysize - i_row - 1) * tile_xsize,
3037 raster + (read_ysize - i_row - 1) * read_xsize,
3038 read_xsize *
sizeof(
uint32) );
3039 _TIFFmemset( raster + (tile_ysize - i_row - 1) * tile_xsize+read_xsize,
3040 0,
sizeof(
uint32) * (tile_xsize - read_xsize) );
3043 for( i_row = read_ysize; i_row < tile_ysize; i_row++ ) {
3044 _TIFFmemset( raster + (tile_ysize - i_row - 1) * tile_xsize,
3045 0,
sizeof(
uint32) * tile_xsize );
struct png_info_def *typedef unsigned char **typedef struct png_info_def *typedef struct png_info_def *typedef struct png_info_def *typedef unsigned char ** row
GLint GLint GLint GLint GLint x
GLclampf GLclampf GLclampf alpha
GLint GLint GLint GLint GLint GLint y
GLdouble GLdouble GLdouble r
GLboolean GLboolean GLboolean b
GLenum GLuint GLenum GLsizei const GLchar * buf
GLenum GLuint GLsizei bufsize
GLboolean GLboolean GLboolean GLboolean a
GLubyte GLubyte GLubyte GLubyte w
GLfloat GLfloat GLfloat GLfloat h
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define memmove(s1, s2, n)
#define sprintf(buf, format,...)
static const struct update_accum a2
static CRYPT_DATA_BLOB b2[]
static float(__cdecl *square_half_float)(float x
int ZEXPORT compress(Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)
uint16 td_samplesperpixel
int TIFFGetFieldDefaulted(TIFF *tif, uint32 tag,...)
tmsize_t _TIFFMultiplySSize(TIFF *tif, tmsize_t first, tmsize_t second, const char *where)
void TIFFYCbCrtoRGB(TIFFYCbCrToRGB *ycbcr, uint32 Y, int32 Cb, int32 Cr, uint32 *r, uint32 *g, uint32 *b)
int TIFFYCbCrToRGBInit(TIFFYCbCrToRGB *ycbcr, float *luma, float *refBlackWhite)
void TIFFXYZToRGB(TIFFCIELabToRGB *cielab, float X, float Y, float Z, uint32 *r, uint32 *g, uint32 *b)
int TIFFCIELabToRGBInit(TIFFCIELabToRGB *cielab, const TIFFDisplay *display, float *refWhite)
void TIFFCIELabToXYZ(TIFFCIELabToRGB *cielab, uint32 l, int32 a, int32 b, float *X, float *Y, float *Z)
int TIFFSetField(TIFF *tif, uint32 tag,...)
int TIFFGetField(TIFF *tif, uint32 tag,...)
void TIFFErrorExt(thandle_t fd, const char *module, const char *fmt,...)
int TIFFReadRGBATile(TIFF *tif, uint32 col, uint32 row, uint32 *raster)
static int gtTileContig(TIFFRGBAImage *, uint32 *, uint32, uint32)
static int isInRefBlackWhiteRange(float f)
#define SKEW4(r, g, b, a, skew)
static const TIFFDisplay display_sRGB
int TIFFRGBAImageGet(TIFFRGBAImage *img, uint32 *raster, uint32 w, uint32 h)
#define UNROLL8(w, op1, op2)
static int setupMap(TIFFRGBAImage *img)
int TIFFReadRGBAStrip(TIFF *tif, uint32 row, uint32 *raster)
static int setorientation(TIFFRGBAImage *img)
#define YCbCrtoRGB(dst, Y)
static int buildMap(TIFFRGBAImage *img)
static int gtStripContig(TIFFRGBAImage *, uint32 *, uint32, uint32)
static int gtTileSeparate(TIFFRGBAImage *, uint32 *, uint32, uint32)
int TIFFReadRGBAImage(TIFF *tif, uint32 rwidth, uint32 rheight, uint32 *raster, int stop)
int TIFFReadRGBAImageOriented(TIFF *tif, uint32 rwidth, uint32 rheight, uint32 *raster, int orientation, int stop)
static int gtStripSeparate(TIFFRGBAImage *, uint32 *, uint32, uint32)
int TIFFRGBAImageBegin(TIFFRGBAImage *img, TIFF *tif, int stop, char emsg[1024])
#define PACK4(r, g, b, a)
int TIFFReadRGBAStripExt(TIFF *tif, uint32 row, uint32 *raster, int stop_on_error)
#define UNROLL4(w, op1, op2)
static int PickContigCase(TIFFRGBAImage *)
static tileContigRoutine initCIELabConversion(TIFFRGBAImage *img)
#define DECLAREContigPutFunc(name)
int TIFFReadRGBATileExt(TIFF *tif, uint32 col, uint32 row, uint32 *raster, int stop_on_error)
static int isCCITTCompression(TIFF *tif)
void TIFFRGBAImageEnd(TIFFRGBAImage *img)
#define SKEW(r, g, b, skew)
static int makebwmap(TIFFRGBAImage *img)
static int initYCbCrConversion(TIFFRGBAImage *img)
static int BuildMapUaToAa(TIFFRGBAImage *img)
int TIFFRGBAImageOK(TIFF *tif, char emsg[1024])
static void cvtcmap(TIFFRGBAImage *img)
#define UNROLL2(w, op1, op2)
static int checkcmap(TIFFRGBAImage *img)
#define FLIP_HORIZONTALLY
static int makecmap(TIFFRGBAImage *img)
#define DECLARESepPutFunc(name)
static int BuildMapBitdepth16To8(TIFFRGBAImage *img)
static int PickSeparateCase(TIFFRGBAImage *)
static const char photoTag[]
const char * TIFFFileName(TIFF *tif)
int TIFFIsTiled(TIFF *tif)
tmsize_t _TIFFReadEncodedStripAndAllocBuffer(TIFF *tif, uint32 strip, void **buf, tmsize_t bufsizetoalloc, tmsize_t size_to_read)
tmsize_t TIFFReadTile(TIFF *tif, void *buf, uint32 x, uint32 y, uint32 z, uint16 s)
tmsize_t TIFFReadEncodedStrip(TIFF *tif, uint32 strip, void *buf, tmsize_t size)
tmsize_t _TIFFReadTileAndAllocBuffer(TIFF *tif, void **buf, tmsize_t bufsizetoalloc, uint32 x, uint32 y, uint32 z, uint16 s)
uint32 TIFFComputeStrip(TIFF *tif, uint32 row, uint16 sample)
tmsize_t TIFFStripSize(TIFF *tif)
tmsize_t TIFFScanlineSize(TIFF *tif)
tmsize_t TIFFTileSize(TIFF *tif)
tmsize_t TIFFTileRowSize(TIFF *tif)
void _TIFFmemset(void *p, int v, tmsize_t c)
void * _TIFFmalloc(tmsize_t s)
void _TIFFmemcpy(void *d, const void *s, tmsize_t c)
void TIFFWarningExt(thandle_t fd, const char *module, const char *fmt,...)
#define TIFFTAG_BITSPERSAMPLE
#define ORIENTATION_BOTRIGHT
#define PLANARCONFIG_SEPARATE
#define ORIENTATION_LEFTTOP
#define ORIENTATION_BOTLEFT
#define TIFFTAG_WHITEPOINT
#define EXTRASAMPLE_UNASSALPHA
#define COMPRESSION_CCITTFAX3
#define COMPRESSION_CCITTRLE
#define EXTRASAMPLE_ASSOCALPHA
#define ORIENTATION_TOPLEFT
#define ORIENTATION_RIGHTBOT
#define ORIENTATION_RIGHTTOP
#define TIFFTAG_SAMPLESPERPIXEL
#define COMPRESSION_SGILOG
#define COMPRESSION_CCITTRLEW
#define PHOTOMETRIC_CIELAB
#define EXTRASAMPLE_UNSPECIFIED
#define TIFFTAG_PHOTOMETRIC
#define TIFFTAG_TILELENGTH
#define PHOTOMETRIC_PALETTE
#define TIFFTAG_EXTRASAMPLES
#define TIFFTAG_IMAGEWIDTH
#define PHOTOMETRIC_SEPARATED
#define TIFFTAG_YCBCRCOEFFICIENTS
#define TIFFTAG_ORIENTATION
#define PHOTOMETRIC_LOGLUV
#define SAMPLEFORMAT_IEEEFP
#define PHOTOMETRIC_YCBCR
#define SGILOGDATAFMT_8BIT
#define ORIENTATION_TOPRIGHT
#define PHOTOMETRIC_MINISWHITE
#define TIFFTAG_YCBCRSUBSAMPLING
#define TIFFTAG_SGILOGDATAFMT
#define TIFFTAG_ROWSPERSTRIP
#define ORIENTATION_LEFTBOT
#define COMPRESSION_SGILOG24
#define TIFFTAG_REFERENCEBLACKWHITE
#define TIFFTAG_TILEWIDTH
#define TIFFTAG_IMAGELENGTH
#define TIFFTAG_COMPRESSION
#define PHOTOMETRIC_MINISBLACK
#define TIFFTAG_PLANARCONFIG
#define COMPRESSION_CCITTFAX4
#define TIFFTAG_JPEGCOLORMODE
#define JPEGCOLORMODE_RGB
#define PLANARCONFIG_CONTIG
void(* tileSeparateRoutine)(TIFFRGBAImage *, uint32 *, uint32, uint32, uint32, uint32, int32, int32, unsigned char *, unsigned char *, unsigned char *, unsigned char *)
unsigned char TIFFRGBValue
void(* tileContigRoutine)(TIFFRGBAImage *, uint32 *, uint32, uint32, uint32, uint32, int32, int32, unsigned char *)
#define TIFF_TMSIZE_T_MAX
#define TIFFroundup_32(x, y)