--- ray/src/px/normtiff.c 2008/11/10 19:08:19 3.11 +++ ray/src/px/normtiff.c 2021/04/07 21:13:52 3.16 @@ -1,15 +1,14 @@ #ifndef lint -static const char RCSid[] = "$Id: normtiff.c,v 3.11 2008/11/10 19:08:19 greg Exp $"; +static const char RCSid[] = "$Id: normtiff.c,v 3.16 2021/04/07 21:13:52 greg Exp $"; #endif /* * Tone map SGILOG TIFF or Radiance picture and output 24-bit RGB TIFF */ -#include #include -#include -#include +#include "rtio.h" +#include "platform.h" #include "tiffio.h" #include "color.h" #include "tonemap.h" @@ -22,7 +21,7 @@ int flags = TM_F_CAMERA; /* tone-mapping flags */ RGBPRIMP rgbp = stdprims; /* display primaries */ RGBPRIMS myprims; /* overriding display primaries */ double ldmax = 100.; /* maximum display luminance */ -double lddyn = 32.; /* display dynamic range */ +double lddyn = 100.; /* display dynamic range */ double gamv = 2.2; /* display gamma value */ short ortab[8] = { /* orientation conversion table */ @@ -38,7 +37,7 @@ short ortab[8] = { /* orientation conversion table */ typedef struct { FILE *fp; /* file pointer */ - char fmt[32]; /* picture format */ + char fmt[MAXFMTLEN]; /* picture format */ double pa; /* pixel aspect ratio */ RESOLU rs; /* picture resolution */ } PICTURE; @@ -54,7 +53,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 @@ -184,6 +183,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 +213,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 +242,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 +274,7 @@ putimage( /* write out our image */ float xr, float yr, uint16 ru, - BYTE *pd + uby8 *pd ) { register int y;