8 |
|
#include <stdio.h> |
9 |
|
#include <math.h> |
10 |
|
#include <time.h> |
11 |
+ |
#include <string.h> |
12 |
+ |
|
13 |
|
#include "tiffio.h" |
14 |
|
#include "color.h" |
15 |
|
#include "tonemap.h" |
16 |
+ |
#include "tmaptiff.h" |
17 |
|
#include "resolu.h" |
18 |
|
|
19 |
|
|
43 |
|
RESOLU rs; /* picture resolution */ |
44 |
|
} PICTURE; |
45 |
|
|
46 |
< |
extern PICTURE *openpicture(); |
46 |
> |
//extern PICTURE *openpicture(); |
47 |
|
|
48 |
|
#define closepicture(p) (fclose((p)->fp),free((void *)(p))) |
49 |
|
|
50 |
+ |
static gethfunc headline; |
51 |
|
|
52 |
< |
main(argc, argv) |
53 |
< |
int argc; |
54 |
< |
char *argv[]; |
52 |
> |
static int headline(char *s, void *pp); |
53 |
> |
static PICTURE * openpicture(char *fname); |
54 |
> |
static int tmap_picture(char *fname, PICTURE *pp); |
55 |
> |
static int tmap_tiff(char *fname, TIFF *tp); |
56 |
> |
static int putimage(uint16 or, uint32 xs, uint32 ys, float xr, float yr, |
57 |
> |
uint16 ru, BYTE *pd); |
58 |
> |
|
59 |
> |
|
60 |
> |
int |
61 |
> |
main( |
62 |
> |
int argc, |
63 |
> |
char *argv[] |
64 |
> |
) |
65 |
|
{ |
66 |
|
PICTURE *pin = NULL; |
67 |
|
TIFF *tin = NULL; |
140 |
|
} |
141 |
|
|
142 |
|
|
143 |
< |
int |
144 |
< |
headline(s, pp) /* process line from header */ |
145 |
< |
char *s; |
146 |
< |
register PICTURE *pp; |
143 |
> |
static int |
144 |
> |
headline( /* process line from header */ |
145 |
> |
char *s, |
146 |
> |
void *pp |
147 |
> |
) |
148 |
|
{ |
149 |
|
register char *cp; |
150 |
|
|
152 |
|
if (*cp & 0x80) |
153 |
|
return(-1); /* non-ascii in header */ |
154 |
|
if (isaspect(s)) |
155 |
< |
pp->pa *= aspectval(s); |
155 |
> |
((PICTURE *)pp)->pa *= aspectval(s); |
156 |
|
else |
157 |
< |
formatval(pp->fmt, s); |
157 |
> |
formatval(((PICTURE *)pp)->fmt, s); |
158 |
|
return(0); |
159 |
|
} |
160 |
|
|
161 |
|
|
162 |
< |
PICTURE * |
163 |
< |
openpicture(fname) /* open/check Radiance picture file */ |
164 |
< |
char *fname; |
162 |
> |
static PICTURE * |
163 |
> |
openpicture( /* open/check Radiance picture file */ |
164 |
> |
char *fname |
165 |
> |
) |
166 |
|
{ |
167 |
|
FILE *fp; |
168 |
|
register PICTURE *pp; |
186 |
|
return(NULL); /* serious error -- should exit? */ |
187 |
|
pp->fp = fp; pp->fmt[0] = '\0'; pp->pa = 1.; |
188 |
|
/* load header */ |
189 |
< |
if (getheader(fp, headline, (char *)pp) < 0) { |
189 |
> |
if (getheader(fp, headline, pp) < 0) { |
190 |
|
closepicture(pp); |
191 |
|
return(NULL); |
192 |
|
} |
201 |
|
} |
202 |
|
|
203 |
|
|
204 |
< |
int |
205 |
< |
tmap_picture(fname, pp) /* tone map Radiance picture */ |
206 |
< |
char *fname; |
207 |
< |
register PICTURE *pp; |
204 |
> |
static int |
205 |
> |
tmap_picture( /* tone map Radiance picture */ |
206 |
> |
char *fname, |
207 |
> |
register PICTURE *pp |
208 |
> |
) |
209 |
|
{ |
210 |
|
uint16 orient; |
211 |
|
int xsiz, ysiz; |
229 |
|
} |
230 |
|
|
231 |
|
|
232 |
< |
tmap_tiff(fname, tp) /* tone map SGILOG TIFF */ |
233 |
< |
char *fname; |
234 |
< |
TIFF *tp; |
232 |
> |
static int |
233 |
> |
tmap_tiff( /* tone map SGILOG TIFF */ |
234 |
> |
char *fname, |
235 |
> |
TIFF *tp |
236 |
> |
) |
237 |
|
{ |
238 |
|
float xres, yres; |
239 |
|
uint16 orient, resunit, phot; |
262 |
|
} |
263 |
|
|
264 |
|
|
265 |
< |
putimage(or, xs, ys, xr, yr, ru, pd) /* write out our image */ |
266 |
< |
uint16 or; |
267 |
< |
uint32 xs, ys; |
268 |
< |
float xr, yr; |
269 |
< |
uint16 ru; |
270 |
< |
BYTE *pd; |
265 |
> |
static int |
266 |
> |
putimage( /* write out our image */ |
267 |
> |
uint16 or, |
268 |
> |
uint32 xs, |
269 |
> |
uint32 ys, |
270 |
> |
float xr, |
271 |
> |
float yr, |
272 |
> |
uint16 ru, |
273 |
> |
BYTE *pd |
274 |
> |
) |
275 |
|
{ |
276 |
|
register int y; |
277 |
|
uint32 rowsperstrip; |