1 |
– |
/* Copyright (c) 1998 Silicon Graphics, Inc. */ |
2 |
– |
|
1 |
|
#ifndef lint |
2 |
< |
static char SCCSid[] = "$SunId$ SGI"; |
2 |
> |
static const char RCSid[] = "$Id$"; |
3 |
|
#endif |
6 |
– |
|
4 |
|
/* |
5 |
|
* Tone map SGILOG TIFF or Radiance picture and output 24-bit RGB TIFF |
6 |
|
*/ |
7 |
|
|
11 |
– |
#undef NOPROTO |
12 |
– |
#define NOPROTO 1 |
13 |
– |
|
8 |
|
#include <stdio.h> |
9 |
|
#include <math.h> |
10 |
+ |
#include <time.h> |
11 |
|
#include "tiffio.h" |
12 |
|
#include "color.h" |
13 |
|
#include "tonemap.h" |
42 |
|
|
43 |
|
extern PICTURE *openpicture(); |
44 |
|
|
45 |
< |
#define closepicture(p) (fclose((p)->fp),free((char *)(p))) |
45 |
> |
#define closepicture(p) (fclose((p)->fp),free((void *)(p))) |
46 |
|
|
47 |
|
|
48 |
|
main(argc, argv) |
170 |
|
return(NULL); /* serious error -- should exit? */ |
171 |
|
pp->fp = fp; pp->fmt[0] = '\0'; pp->pa = 1.; |
172 |
|
/* load header */ |
173 |
< |
if (getheader(fp, headline, pp) < 0) { |
173 |
> |
if (getheader(fp, headline, (char *)pp) < 0) { |
174 |
|
closepicture(pp); |
175 |
|
return(NULL); |
176 |
|
} |
199 |
|
return(-1); |
200 |
|
/* figure out TIFF orientation */ |
201 |
|
for (orient = 8; --orient; ) |
202 |
< |
if (ortab[orient] == pp->rs.or) |
202 |
> |
if (ortab[orient] == pp->rs.rt) |
203 |
|
break; |
204 |
|
orient++; |
205 |
|
/* put out our image */ |
207 |
|
72., 72./pp->pa, 2, pix) != 0) |
208 |
|
return(-1); |
209 |
|
/* free data and we're done */ |
210 |
< |
free((char *)pix); |
210 |
> |
free((void *)pix); |
211 |
|
return(0); |
212 |
|
} |
213 |
|
|
222 |
|
BYTE *pix; |
223 |
|
/* check to make sure it's SGILOG */ |
224 |
|
TIFFGetFieldDefaulted(tp, TIFFTAG_PHOTOMETRIC, &phot); |
225 |
< |
if (phot != PHOTOMETRIC_LOGLUV && phot != PHOTOMETRIC_LOGL) { |
231 |
< |
if (!(flags & TM_F_NOSTDERR)) { |
232 |
< |
fputs(fname, stderr); |
233 |
< |
fputs(": TIFF must be in SGILOG format\n", stderr); |
234 |
< |
} |
235 |
< |
return(-1); |
236 |
< |
} |
237 |
< |
if (phot == PHOTOMETRIC_LOGL) |
225 |
> |
if (phot == PHOTOMETRIC_LOGL | phot == PHOTOMETRIC_MINISBLACK) |
226 |
|
flags |= TM_F_BW; |
227 |
|
/* read and tone map TIFF */ |
228 |
|
if (tmMapTIFF(&pix, &xsiz, &ysiz, flags, |
238 |
|
xres, yres, resunit, pix) != 0) |
239 |
|
return(-1); |
240 |
|
/* free data and we're done */ |
241 |
< |
free((char *)pix); |
241 |
> |
free((void *)pix); |
242 |
|
return(0); |
243 |
|
} |
244 |
|
|