--- ray/src/px/normtiff.c 2006/09/26 12:26:02 3.10 +++ ray/src/px/normtiff.c 2011/05/20 02:06:39 3.13 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: normtiff.c,v 3.10 2006/09/26 12:26:02 greg Exp $"; +static const char RCSid[] = "$Id: normtiff.c,v 3.13 2011/05/20 02:06:39 greg Exp $"; #endif /* * Tone map SGILOG TIFF or Radiance picture and output 24-bit RGB TIFF @@ -10,6 +10,7 @@ static const char RCSid[] = "$Id: normtiff.c,v 3.10 20 #include #include +#include "platform.h" #include "tiffio.h" #include "color.h" #include "tonemap.h" @@ -54,7 +55,7 @@ static PICTURE *openpicture(char *fname); static int tmap_picture(char *fname, PICTURE *pp); static int tmap_tiff(char *fname, TIFF *tp); static int putimage(uint16 or, uint32 xs, uint32 ys, float xr, float yr, - uint16 ru, BYTE *pd); + uint16 ru, uby8 *pd); int @@ -137,7 +138,7 @@ main( exit(rval==0 ? 0 : 1); userr: fprintf(stderr, -"Usage: %s [-h][-s][-c][-l][-b][-g gv][-d ld][-u lm][-z][-p xr yr xg yg xb yb xw yw] input.{tif|pic} output.tif\n", +"Usage: %s [-h][-s][-c][-l][-b][-g gv][-d ld][-u lm][-z][-p xr yr xg yg xb yb xw yw] input.{tif|hdr} output.tif\n", argv[0]); exit(1); } @@ -184,6 +185,7 @@ openpicture( /* open/check Radiance picture file */ /* else try opening it */ if ((fp = fopen(fname, "r")) == NULL) return(NULL); + SET_FILE_BINARY(fp); /* allocate struct */ if ((pp = (PICTURE *)malloc(sizeof(PICTURE))) == NULL) return(NULL); /* serious error -- should exit? */ @@ -213,7 +215,7 @@ tmap_picture( /* tone map Radiance picture */ uint16 orient; double paspect = (pp->rs.rt & YMAJOR) ? pp->pa : 1./pp->pa; int xsiz, ysiz; - BYTE *pix; + uby8 *pix; /* read and tone map picture */ if (tmMapPicture(&pix, &xsiz, &ysiz, flags, rgbp, gamv, lddyn, ldmax, fname, pp->fp) != TM_E_OK) @@ -242,7 +244,7 @@ tmap_tiff( /* tone map SGILOG TIFF */ float xres, yres; uint16 orient, resunit, phot; int xsiz, ysiz; - BYTE *pix; + uby8 *pix; /* check to make sure it's SGILOG */ TIFFGetFieldDefaulted(tp, TIFFTAG_PHOTOMETRIC, &phot); if ((phot == PHOTOMETRIC_LOGL) | (phot == PHOTOMETRIC_MINISBLACK)) @@ -274,7 +276,7 @@ putimage( /* write out our image */ float xr, float yr, uint16 ru, - BYTE *pd + uby8 *pd ) { register int y;