20 |
|
|
21 |
|
char *mbcalfile = NULL; /* macbethcal mapping file */ |
22 |
|
|
23 |
< |
static struct mbc mbcond; /* macbethcal conditioning struct */ |
23 |
> |
static struct mbc { |
24 |
> |
float xa[3][6], ya[3][6]; |
25 |
> |
COLORMAT cmat; |
26 |
> |
} mbcond; /* macbethcal conditioning struct */ |
27 |
|
|
28 |
|
static COLOR *scanbuf; /* scanline processing buffer */ |
29 |
|
static int nread; /* number of scanlines processed */ |
63 |
|
#ifdef DEBUG |
64 |
|
fputs("done\n", stderr); |
65 |
|
#endif |
66 |
< |
return(NULL); |
66 |
> |
free((char *)scanbuf); |
67 |
> |
return(scanbuf = NULL); |
68 |
|
} |
69 |
< |
if (freadscan(scanbuf, scanlen(&inpres), infp) < 0) { |
69 |
> |
if (what2do&DO_ACUITY) |
70 |
> |
acuscan(scanbuf, nread); |
71 |
> |
else if (freadscan(scanbuf, scanlen(&inpres), infp) < 0) { |
72 |
|
fprintf(stderr, "%s: %s: scanline read error\n", |
73 |
|
progname, infn); |
74 |
|
exit(1); |
75 |
|
} |
70 |
– |
nread++; |
76 |
|
if (what2do&DO_VEIL) /* add veiling */ |
77 |
< |
addveil(scanbuf, nread-1); |
77 |
> |
addveil(scanbuf, nread); |
78 |
|
if (what2do&DO_COLOR) /* scotopic color loss */ |
79 |
|
scotscan(scanbuf, scanlen(&inpres)); |
80 |
|
if (what2do&DO_LINEAR) /* map luminances */ |
85 |
|
mbscan(scanbuf, scanlen(&inpres), &mbcond); |
86 |
|
else if (lumf == cielum | inprims != outprims) |
87 |
|
matscan(scanbuf, scanlen(&inpres), mbcond.cmat); |
88 |
+ |
nread++; |
89 |
|
return(scanbuf); |
90 |
|
} |
91 |
|
|
100 |
|
comprgb2rgbmat(mbcond.cmat, inprims, outprims); |
101 |
|
else |
102 |
|
compxyz2rgbmat(mbcond.cmat, outprims); |
103 |
+ |
if (what2do&DO_ACUITY) { |
104 |
+ |
#ifdef DEBUG |
105 |
+ |
fprintf(stderr, "%s: initializing acuity sampling...", |
106 |
+ |
progname); |
107 |
+ |
#endif |
108 |
+ |
initacuity(); |
109 |
+ |
#ifdef DEBUG |
110 |
+ |
fprintf(stderr, "done\n"); |
111 |
+ |
#endif |
112 |
+ |
} |
113 |
|
scanbuf = (COLOR *)malloc(scanlen(&inpres)*sizeof(COLOR)); |
114 |
|
if (scanbuf == NULL) |
115 |
|
syserror("malloc"); |