31 |
|
static COLOR *scanbuf; /* scanline processing buffer */ |
32 |
|
static int nread; /* number of scanlines processed */ |
33 |
|
|
34 |
+ |
static void sfscan(COLOR *sl, int len, double sf); |
35 |
+ |
static void matscan(COLOR *sl, int len, COLORMAT mat); |
36 |
+ |
static void mbscan(COLOR *sl, int len, struct mbc *mb); |
37 |
+ |
static void cwscan(COLOR *sl, int len, WARP3D *wp); |
38 |
+ |
static void getmbcalfile(char *fn, struct mbc *mb); |
39 |
|
|
40 |
< |
double |
41 |
< |
rgblum(clr, scotopic) /* compute (scotopic) luminance of RGB color */ |
42 |
< |
COLOR clr; |
43 |
< |
int scotopic; |
40 |
> |
|
41 |
> |
extern double |
42 |
> |
rgblum( /* compute (scotopic) luminance of RGB color */ |
43 |
> |
COLOR clr, |
44 |
> |
int scotopic |
45 |
> |
) |
46 |
|
{ |
47 |
|
if (scotopic) /* approximate */ |
48 |
|
return( WHTSEFFICACY * (colval(clr,RED)*.062 + |
53 |
|
} |
54 |
|
|
55 |
|
|
56 |
< |
double |
57 |
< |
cielum(xyz, scotopic) /* compute (scotopic) luminance of CIE color */ |
58 |
< |
COLOR xyz; |
59 |
< |
int scotopic; |
56 |
> |
extern double |
57 |
> |
cielum( /* compute (scotopic) luminance of CIE color */ |
58 |
> |
COLOR xyz, |
59 |
> |
int scotopic |
60 |
> |
) |
61 |
|
{ |
62 |
|
if (scotopic) /* approximate */ |
63 |
|
return(colval(xyz,CIEY) * |
67 |
|
} |
68 |
|
|
69 |
|
|
70 |
< |
COLOR * |
71 |
< |
nextscan() /* read and condition next scanline */ |
70 |
> |
extern COLOR * |
71 |
> |
nextscan(void) /* read and condition next scanline */ |
72 |
|
{ |
73 |
|
if (nread >= numscans(&inpres)) { |
74 |
|
if (cwarpfile != NULL) |
102 |
|
} |
103 |
|
|
104 |
|
|
105 |
< |
COLOR * |
106 |
< |
firstscan() /* return first processed scanline */ |
105 |
> |
extern COLOR * |
106 |
> |
firstscan(void) /* return first processed scanline */ |
107 |
|
{ |
108 |
|
if (mbcalfile != NULL) /* load macbethcal file */ |
109 |
|
getmbcalfile(mbcalfile, &mbcond); |
115 |
|
comprgb2rgbWBmat(mbcond.cmat, inprims, outprims); |
116 |
|
else |
117 |
|
compxyz2rgbWBmat(mbcond.cmat, outprims); |
118 |
< |
if (what2do&DO_ACUITY) |
119 |
< |
initacuity(); |
118 |
> |
if (what2do&DO_ACUITY && !initacuity()) { |
119 |
> |
fprintf(stderr, "%s: warning - cannot initialize acuity pass\n", |
120 |
> |
progname); |
121 |
> |
what2do &= ~DO_ACUITY; |
122 |
> |
} |
123 |
|
scanbuf = (COLOR *)malloc(scanlen(&inpres)*sizeof(COLOR)); |
124 |
|
if (scanbuf == NULL) |
125 |
|
syserror("malloc"); |
128 |
|
} |
129 |
|
|
130 |
|
|
131 |
< |
sfscan(sl, len, sf) /* apply scalefactor to scanline */ |
132 |
< |
register COLOR *sl; |
133 |
< |
int len; |
134 |
< |
double sf; |
131 |
> |
static void |
132 |
> |
sfscan( /* apply scalefactor to scanline */ |
133 |
> |
register COLOR *sl, |
134 |
> |
int len, |
135 |
> |
double sf |
136 |
> |
) |
137 |
|
{ |
138 |
|
while (len--) { |
139 |
|
scalecolor(sl[0], sf); |
142 |
|
} |
143 |
|
|
144 |
|
|
145 |
< |
matscan(sl, len, mat) /* apply color matrix to scaline */ |
146 |
< |
register COLOR *sl; |
147 |
< |
int len; |
148 |
< |
COLORMAT mat; |
145 |
> |
static void |
146 |
> |
matscan( /* apply color matrix to scaline */ |
147 |
> |
register COLOR *sl, |
148 |
> |
int len, |
149 |
> |
COLORMAT mat |
150 |
> |
) |
151 |
|
{ |
152 |
|
while (len--) { |
153 |
|
colortrans(sl[0], mat, sl[0]); |
157 |
|
} |
158 |
|
|
159 |
|
|
160 |
< |
mbscan(sl, len, mb) /* apply macbethcal adj. to scaline */ |
161 |
< |
COLOR *sl; |
162 |
< |
int len; |
163 |
< |
register struct mbc *mb; |
160 |
> |
static void |
161 |
> |
mbscan( /* apply macbethcal adj. to scaline */ |
162 |
> |
COLOR *sl, |
163 |
> |
int len, |
164 |
> |
register struct mbc *mb |
165 |
> |
) |
166 |
|
{ |
167 |
|
double d; |
168 |
|
register int i, j; |
183 |
|
} |
184 |
|
|
185 |
|
|
186 |
< |
cwscan(sl, len, wp) /* apply color space warp to scaline */ |
187 |
< |
COLOR *sl; |
188 |
< |
int len; |
189 |
< |
WARP3D *wp; |
186 |
> |
static void |
187 |
> |
cwscan( /* apply color space warp to scaline */ |
188 |
> |
COLOR *sl, |
189 |
> |
int len, |
190 |
> |
WARP3D *wp |
191 |
> |
) |
192 |
|
{ |
193 |
|
int rval; |
194 |
|
|
207 |
|
} |
208 |
|
|
209 |
|
|
210 |
< |
getmbcalfile(fn, mb) /* load macbethcal file */ |
211 |
< |
char *fn; |
212 |
< |
register struct mbc *mb; |
210 |
> |
static void |
211 |
> |
getmbcalfile( /* load macbethcal file */ |
212 |
> |
char *fn, |
213 |
> |
register struct mbc *mb |
214 |
> |
) |
215 |
|
{ |
195 |
– |
extern char *fgets(); |
216 |
|
char buf[128]; |
217 |
|
FILE *fp; |
218 |
|
int inpflags = 0; |