--- ray/src/util/glareval.c 1991/04/12 10:28:34 1.12 +++ ray/src/util/glareval.c 1991/04/22 15:43:21 1.16 @@ -20,7 +20,7 @@ static char SCCSid[] = "$SunId$ LBL"; #define vfork fork #endif -#define MAXSBUF 524268 /* maximum total size of scanline buffer */ +#define MAXSBUF 786432 /* maximum total size of scanline buffer */ #define HSIZE 317 /* size of scanline hash table */ #define NRETIRE 16 /* number of scanlines to retire at once */ @@ -49,7 +49,10 @@ static SCAN *hashtab[HSIZE]; /* scanline hash table */ static long ncall = 0L; /* number of calls to getpictscan */ static long nread = 0L; /* number of scanlines read */ +static long nrecl = 0L; /* number of scanlines reclaimed */ +static int wrongformat = 0; + SCAN *scanretire(); extern long ftell(); @@ -75,12 +78,7 @@ int y; if (sl->y == y) { /* reclaim */ sl->next = hashtab[hi]; hashtab[hi] = sl; -#ifdef DEBUG - if (verbose) - fprintf(stderr, - "%s: scanline %d reclaimed\n", - progname, y); -#endif + nrecl++; } return(sl); } @@ -144,13 +142,15 @@ pict_stats() /* print out picture read statistics */ { static long lastcall = 0L; /* ncall at last report */ static long lastread = 0L; /* nread at last report */ + static long lastrecl = 0L; /* nrecl at last report */ if (ncall == lastcall) return; - fprintf(stderr, "%s: %ld scanlines read in %ld calls\n", - progname, nread-lastread, ncall-lastcall); + fprintf(stderr, "%s: %ld scanlines read (%ld reclaimed) in %ld calls\n", + progname, nread-lastread, nrecl-lastrecl, ncall-lastcall); lastcall = ncall; lastread = nread; + lastrecl = nrecl; } #endif @@ -177,15 +177,14 @@ FVECT vd; double -getviewpix(vh, vv, se) /* compute single view pixel */ +getviewpix(vh, vv) /* compute single view pixel */ int vh, vv; -SPANERR *se; { FVECT dir; float rt_buf[6]; double res; - if (compdir(dir, vh, vv, se) < 0) + if (compdir(dir, vh, vv) < 0) return(-1.0); npixinvw++; if ((res = pict_val(dir)) >= 0.0) @@ -212,7 +211,6 @@ float *vb; float rt_buf[6*MAXPIX]; /* rtrace send/receive buffer */ register int n; /* number of pixels in buffer */ short buf_vh[MAXPIX]; /* pixel positions */ - SPANERR sperr; FVECT dir; register int vh; @@ -221,10 +219,9 @@ float *vb; fprintf(stderr, "%s: computing view span at %d...\n", progname, vv); #endif - setspanerr(&sperr, vv); n = 0; for (vh = -hsize; vh <= hsize; vh++) { - if (compdir(dir, vh, vv, &sperr) < 0) { /* not in view */ + if (compdir(dir, vh, vv) < 0) { /* not in view */ vb[vh+hsize] = -1.0; continue; } @@ -290,8 +287,14 @@ int np; getexpos(s) /* get exposure from header line */ char *s; { + char fmt[32]; + if (isexpos(s)) exposure *= exposval(s); + else if (isformat(s)) { + formatval(fmt, s); + wrongformat = strcmp(fmt, COLRFMT); + } } @@ -303,9 +306,10 @@ char *fn; exit(1); } exposure = 1.0; - getheader(pictfp, getexpos); - if (fgetresolu(&pxsiz, &pysiz, pictfp) != (YMAJOR|YDECR)) { - fprintf("%s: bad picture resolution\n", fn); + getheader(pictfp, getexpos, NULL); + if (wrongformat || + fgetresolu(&pxsiz, &pysiz, pictfp) != (YMAJOR|YDECR)) { + fprintf("%s: bad picture format\n", fn); exit(1); } initscans();