--- ray/src/px/ra_tiff.c 2005/03/22 04:51:56 2.29 +++ ray/src/px/ra_tiff.c 2005/08/19 02:31:32 2.32 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: ra_tiff.c,v 2.29 2005/03/22 04:51:56 greg Exp $"; +static const char RCSid[] = "$Id: ra_tiff.c,v 2.32 2005/08/19 02:31:32 greg Exp $"; #endif /* * Program to convert between RADIANCE and TIFF files. @@ -362,7 +362,7 @@ initfromtif(void) /* initialize conversion from TIFF quiterr("unknown input image resolution"); if (!TIFFGetField(cvts.tif, TIFFTAG_STONITS, &cvts.stonits)) - cvts.stonits = 1.; + cvts.stonits = -1.; if (!TIFFGetField(cvts.tif, TIFFTAG_DATETIME, &cp)) cvts.capdate[0] = '\0'; @@ -380,13 +380,15 @@ initfromtif(void) /* initialize conversion from TIFF if (cvts.pixrat < .99 || cvts.pixrat > 1.01) fputaspect(cvts.pixrat, cvts.rfp); if (CHK(C_XYZE)) { - fputexpos(pow(2.,(double)cvts.bradj)/cvts.stonits, cvts.rfp); + if (cvts.stonits > .0) + fputexpos(pow(2.,(double)cvts.bradj)/cvts.stonits, cvts.rfp); fputformat(CIEFMT, cvts.rfp); } else { if (CHK(C_PRIM)) fputprims(cvts.prims, cvts.rfp); - fputexpos(WHTEFFICACY*pow(2.,(double)cvts.bradj)/cvts.stonits, - cvts.rfp); + if (cvts.stonits > .0) + fputexpos(WHTEFFICACY*pow(2.,(double)cvts.bradj)/cvts.stonits, + cvts.rfp); fputformat(COLRFMT, cvts.rfp); } if (cvts.capdate[0]) @@ -656,6 +658,9 @@ Luv2Color( /* read/convert/write Luv->COLOR scanline if (CHK(C_RFLT|C_TWRD|C_TFLT|C_GRY) != (C_RFLT|C_TFLT)) quiterr("internal error 1 in Luv2Color"); + if (cvts.pconf != PLANARCONFIG_CONTIG) + quiterr("cannot handle separate 32-bit color planes"); + if (TIFFReadScanline(cvts.tif, cvts.t.p, y, 0) < 0) quiterr("error reading TIFF input"); /* also works for float RGB */ @@ -694,6 +699,9 @@ RRGGBB2Color( /* read/convert/write RGB16->COLOR sca if (CHK(C_RFLT|C_TWRD|C_TFLT|C_GRY) != (C_TWRD|C_RFLT)) quiterr("internal error 1 in RRGGBB2Color"); + if (cvts.pconf != PLANARCONFIG_CONTIG) + quiterr("cannot handle separate 16-bit color planes"); + if (TIFFReadScanline(cvts.tif, cvts.t.p, y, 0) < 0) quiterr("error reading TIFF input"); @@ -973,7 +981,7 @@ Color2RRGGBB( /* read/convert/write COLOR->RGB16 sca colortrans(cvts.r.colors[x], cvts.cmat, cvts.r.colors[x]); if (CHK(C_GAMUT)) - clipgamut(cvts.r.colors[x], cvts.t.fp[3*x + 1], + clipgamut(cvts.r.colors[x], bright(cvts.r.colors[x]), CGAMUT_LOWER, cblack, cwhite); } for (i = 3; i--; ) {