1 |
– |
/* Copyright (c) 1997 Regents of the University of California */ |
2 |
– |
|
1 |
|
#ifndef lint |
2 |
< |
static char SCCSid[] = "$SunId$ LBL"; |
2 |
> |
static const char RCSid[] = "$Id$"; |
3 |
|
#endif |
6 |
– |
|
4 |
|
/* |
5 |
|
* Warp colors in Radiance picture to correct for input/output changes. |
6 |
|
*/ |
7 |
|
|
8 |
|
#include <stdio.h> |
9 |
+ |
|
10 |
+ |
#include "resolu.h" |
11 |
|
#include "color.h" |
12 |
|
#include "warp3d.h" |
13 |
|
|
14 |
|
char *progname; /* global argv[0] */ |
15 |
|
|
16 |
< |
FILE *infp = stdin; /* input stream */ |
16 |
> |
FILE *infp = NULL; /* input stream */ |
17 |
|
int xres, yres; /* input picture resolution */ |
18 |
|
|
19 |
|
WARP3D *cwarp; /* our warp map */ |
20 |
|
int iclip = CGAMUT_UPPER; /* input value gamut clipping */ |
21 |
|
int oclip = CGAMUT_LOWER; /* output value gamut clipping */ |
22 |
|
|
23 |
+ |
static void syserror(char *s); |
24 |
+ |
static void picwarp(void); |
25 |
|
|
26 |
< |
main(argc, argv) |
27 |
< |
int argc; |
28 |
< |
char *argv[]; |
26 |
> |
|
27 |
> |
int |
28 |
> |
main( |
29 |
> |
int argc, |
30 |
> |
char *argv[] |
31 |
> |
) |
32 |
|
{ |
33 |
< |
static char picfmt[LPICFMT+1] = PICFMT; |
33 |
> |
static char picfmt[MAXFMTLEN] = PICFMT; |
34 |
|
int cwflags = 0; |
35 |
|
int rval; |
36 |
|
int i; |
37 |
|
|
38 |
|
progname = argv[0]; |
39 |
+ |
infp = stdin; |
40 |
|
/* get options */ |
41 |
|
for (i = 1; i < argc && argv[i][0] == '-'; i++) |
42 |
|
switch (argv[i][1]) { |
89 |
|
exit(0); |
90 |
|
userr: |
91 |
|
fprintf(stderr, |
92 |
< |
"Usage: %s [-i][-o][-e|-f] map.cwp [input.pic [output.pic]]\n", |
92 |
> |
"Usage: %s [-i][-o][-e|-f] map.cwp [input.hdr [output.hdr]]\n", |
93 |
|
progname); |
94 |
|
exit(1); |
95 |
|
} |
96 |
|
|
97 |
|
|
98 |
< |
syserror(s) /* print system error and exit */ |
99 |
< |
char *s; |
98 |
> |
static void |
99 |
> |
syserror( /* print system error and exit */ |
100 |
> |
char *s |
101 |
> |
) |
102 |
|
{ |
103 |
|
fprintf(stderr, "%s: ", progname); |
104 |
|
perror(s); |
106 |
|
} |
107 |
|
|
108 |
|
|
109 |
< |
picwarp() /* warp our picture scanlines */ |
109 |
> |
static void |
110 |
> |
picwarp(void) /* warp our picture scanlines */ |
111 |
|
{ |
112 |
|
register COLOR *scan; |
113 |
|
long ngamut = 0; |
149 |
|
} |
150 |
|
} |
151 |
|
if (ngamut >= (long)xres*yres/100) |
152 |
< |
fprintf(stderr, "%s: warning - %d%% of pixels out of gamut\n", |
152 |
> |
fprintf(stderr, "%s: warning - %ld%% of pixels out of gamut\n", |
153 |
|
progname, 100*ngamut/((long)xres*yres)); |
154 |
< |
free((char *)scan); |
154 |
> |
free((void *)scan); |
155 |
|
} |