1 |
– |
/* Copyright (c) 1999 Regents of the University of California */ |
2 |
– |
|
1 |
|
#ifndef lint |
2 |
< |
static char SCCSid[] = "$SunId$ SGI"; |
2 |
> |
static const char RCSid[] = "$Id$"; |
3 |
|
#endif |
6 |
– |
|
4 |
|
/* |
5 |
|
* Calibrate a scanned MacBeth Color Checker Chart |
6 |
|
* |
12 |
|
|
13 |
|
#include <stdio.h> |
14 |
|
#include <math.h> |
15 |
< |
#ifdef MSDOS |
16 |
< |
#include <fcntl.h> |
17 |
< |
#endif |
15 |
> |
#include <time.h> |
16 |
> |
|
17 |
> |
#include "platform.h" |
18 |
|
#include "color.h" |
19 |
|
#include "resolu.h" |
20 |
|
#include "pmap.h" |
122 |
|
FILE *debugfp = NULL; /* debug output picture */ |
123 |
|
char *progname; |
124 |
|
|
128 |
– |
extern char *malloc(); |
125 |
|
|
130 |
– |
|
126 |
|
main(argc, argv) |
127 |
|
int argc; |
128 |
|
char **argv; |
140 |
|
perror(argv[i]); |
141 |
|
exit(1); |
142 |
|
} |
143 |
< |
#ifdef MSDOS |
149 |
< |
setmode(fileno(debugfp), O_BINARY); |
150 |
< |
#endif |
143 |
> |
SET_FILE_BINARY(debugfp); |
144 |
|
newheader("RADIANCE", debugfp); /* start */ |
145 |
|
printargs(argc, argv, debugfp); /* header */ |
146 |
|
break; |
185 |
|
exit(1); |
186 |
|
} |
187 |
|
if (scanning) { /* load input picture header */ |
188 |
< |
#ifdef MSDOS |
196 |
< |
setmode(fileno(stdin), O_BINARY); |
197 |
< |
#endif |
188 |
> |
SET_FILE_BINARY(stdin); |
189 |
|
if (checkheader(stdin, COLRFMT, NULL) < 0 || |
190 |
|
fgetresolu(&xmax, &ymax, stdin) < 0) { |
191 |
|
fprintf(stderr, "%s: bad input picture\n", progname); |
241 |
|
printf("}\n"); |
242 |
|
putmapping(); /* put out color mapping */ |
243 |
|
} |
244 |
< |
if (debugfp != NULL) /* put out debug picture */ |
244 |
> |
if (debugfp != NULL) { /* put out debug picture */ |
245 |
|
if (scanning) |
246 |
|
picdebug(); |
247 |
|
else |
248 |
|
clrdebug(); |
249 |
+ |
} |
250 |
|
exit(0); |
251 |
|
userr: |
252 |
|
fprintf(stderr, |
354 |
|
scalecolor(inpRGB[i], d); |
355 |
|
inpflags |= 1L<<i; |
356 |
|
} |
357 |
< |
free((char *)scanln); |
357 |
> |
free((void *)scanln); |
358 |
|
} |
359 |
|
|
360 |
|
|
704 |
|
} |
705 |
|
/* clean up */ |
706 |
|
fclose(debugfp); |
707 |
< |
free((char *)scan); |
707 |
> |
free((void *)scan); |
708 |
|
} |
709 |
|
|
710 |
|
|
774 |
|
} |
775 |
|
/* clean up */ |
776 |
|
fclose(debugfp); |
777 |
< |
free((char *)scan); |
777 |
> |
free((void *)scan); |
778 |
|
} |
779 |
|
|
780 |
|
|