| 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) |
| 95 |
|
mbscan(scanbuf, scanlen(&inpres), &mbcond); |
| 96 |
|
else if (cwarpfile != NULL) /* device color space warp */ |
| 97 |
|
cwscan(scanbuf, scanlen(&inpres), cwarp); |
| 98 |
< |
else if (lumf == cielum | inprims != outprims) |
| 98 |
> |
else if ((lumf == cielum) | (inprims != outprims)) |
| 99 |
|
matscan(scanbuf, scanlen(&inpres), mbcond.cmat); |
| 100 |
|
nread++; |
| 101 |
|
return(scanbuf); |
| 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); |
| 125 |
|
} |
| 126 |
|
|
| 127 |
|
|
| 128 |
< |
sfscan(sl, len, sf) /* apply scalefactor to scanline */ |
| 129 |
< |
register COLOR *sl; |
| 130 |
< |
int len; |
| 131 |
< |
double sf; |
| 128 |
> |
static void |
| 129 |
> |
sfscan( /* apply scalefactor to scanline */ |
| 130 |
> |
register COLOR *sl, |
| 131 |
> |
int len, |
| 132 |
> |
double sf |
| 133 |
> |
) |
| 134 |
|
{ |
| 135 |
|
while (len--) { |
| 136 |
|
scalecolor(sl[0], sf); |
| 139 |
|
} |
| 140 |
|
|
| 141 |
|
|
| 142 |
< |
matscan(sl, len, mat) /* apply color matrix to scaline */ |
| 143 |
< |
register COLOR *sl; |
| 144 |
< |
int len; |
| 145 |
< |
COLORMAT mat; |
| 142 |
> |
static void |
| 143 |
> |
matscan( /* apply color matrix to scaline */ |
| 144 |
> |
register COLOR *sl, |
| 145 |
> |
int len, |
| 146 |
> |
COLORMAT mat |
| 147 |
> |
) |
| 148 |
|
{ |
| 149 |
|
while (len--) { |
| 150 |
|
colortrans(sl[0], mat, sl[0]); |
| 154 |
|
} |
| 155 |
|
|
| 156 |
|
|
| 157 |
< |
mbscan(sl, len, mb) /* apply macbethcal adj. to scaline */ |
| 158 |
< |
COLOR *sl; |
| 159 |
< |
int len; |
| 160 |
< |
register struct mbc *mb; |
| 157 |
> |
static void |
| 158 |
> |
mbscan( /* apply macbethcal adj. to scaline */ |
| 159 |
> |
COLOR *sl, |
| 160 |
> |
int len, |
| 161 |
> |
register struct mbc *mb |
| 162 |
> |
) |
| 163 |
|
{ |
| 164 |
|
double d; |
| 165 |
|
register int i, j; |
| 180 |
|
} |
| 181 |
|
|
| 182 |
|
|
| 183 |
< |
cwscan(sl, len, wp) /* apply color space warp to scaline */ |
| 184 |
< |
COLOR *sl; |
| 185 |
< |
int len; |
| 186 |
< |
WARP3D *wp; |
| 183 |
> |
static void |
| 184 |
> |
cwscan( /* apply color space warp to scaline */ |
| 185 |
> |
COLOR *sl, |
| 186 |
> |
int len, |
| 187 |
> |
WARP3D *wp |
| 188 |
> |
) |
| 189 |
|
{ |
| 190 |
|
int rval; |
| 191 |
|
|
| 204 |
|
} |
| 205 |
|
|
| 206 |
|
|
| 207 |
< |
getmbcalfile(fn, mb) /* load macbethcal file */ |
| 208 |
< |
char *fn; |
| 209 |
< |
register struct mbc *mb; |
| 207 |
> |
static void |
| 208 |
> |
getmbcalfile( /* load macbethcal file */ |
| 209 |
> |
char *fn, |
| 210 |
> |
register struct mbc *mb |
| 211 |
> |
) |
| 212 |
|
{ |
| 195 |
– |
extern char *fgets(); |
| 213 |
|
char buf[128]; |
| 214 |
|
FILE *fp; |
| 215 |
|
int inpflags = 0; |