--- ray/src/px/pcond2.c 1996/10/03 16:52:49 3.1 +++ ray/src/px/pcond2.c 1997/01/28 16:31:16 3.5 @@ -20,7 +20,10 @@ double inpexp = 1.0; /* input exposure value */ char *mbcalfile = NULL; /* macbethcal mapping file */ -static struct mbc mbcond; /* macbethcal conditioning struct */ +static struct mbc { + float xa[3][6], ya[3][6]; + COLORMAT cmat; +} mbcond; /* macbethcal conditioning struct */ static COLOR *scanbuf; /* scanline processing buffer */ static int nread; /* number of scanlines processed */ @@ -57,19 +60,18 @@ COLOR * nextscan() /* read and condition next scanline */ { if (nread >= numscans(&inpres)) { -#ifdef DEBUG - fputs("done\n", stderr); -#endif - return(NULL); + free((char *)scanbuf); + return(scanbuf = NULL); } - if (freadscan(scanbuf, scanlen(&inpres), infp) < 0) { + if (what2do&DO_ACUITY) + acuscan(scanbuf, nread); + else if (freadscan(scanbuf, scanlen(&inpres), infp) < 0) { fprintf(stderr, "%s: %s: scanline read error\n", progname, infn); exit(1); } - nread++; if (what2do&DO_VEIL) /* add veiling */ - addveil(scanbuf, nread-1); + addveil(scanbuf, nread); if (what2do&DO_COLOR) /* scotopic color loss */ scotscan(scanbuf, scanlen(&inpres)); if (what2do&DO_LINEAR) /* map luminances */ @@ -80,6 +82,7 @@ nextscan() /* read and condition next scanline */ mbscan(scanbuf, scanlen(&inpres), &mbcond); else if (lumf == cielum | inprims != outprims) matscan(scanbuf, scanlen(&inpres), mbcond.cmat); + nread++; return(scanbuf); } @@ -94,13 +97,12 @@ firstscan() /* return first processed scanline */ comprgb2rgbmat(mbcond.cmat, inprims, outprims); else compxyz2rgbmat(mbcond.cmat, outprims); + if (what2do&DO_ACUITY) + initacuity(); scanbuf = (COLOR *)malloc(scanlen(&inpres)*sizeof(COLOR)); if (scanbuf == NULL) syserror("malloc"); nread = 0; -#ifdef DEBUG - fprintf(stderr, "%s: processing image...", progname); -#endif return(nextscan()); }