20 |
|
#define vfork fork |
21 |
|
#endif |
22 |
|
|
23 |
< |
#define MAXSBUF 524268 /* maximum total size of scanline buffer */ |
23 |
> |
#define MAXSBUF 786432 /* maximum total size of scanline buffer */ |
24 |
|
#define HSIZE 317 /* size of scanline hash table */ |
25 |
|
#define NRETIRE 16 /* number of scanlines to retire at once */ |
26 |
|
|
49 |
|
|
50 |
|
static long ncall = 0L; /* number of calls to getpictscan */ |
51 |
|
static long nread = 0L; /* number of scanlines read */ |
52 |
+ |
static long nrecl = 0L; /* number of scanlines reclaimed */ |
53 |
|
|
54 |
+ |
static int wrongformat = 0; |
55 |
+ |
|
56 |
|
SCAN *scanretire(); |
57 |
|
|
58 |
|
extern long ftell(); |
78 |
|
if (sl->y == y) { /* reclaim */ |
79 |
|
sl->next = hashtab[hi]; |
80 |
|
hashtab[hi] = sl; |
81 |
< |
#ifdef DEBUG |
79 |
< |
if (verbose) |
80 |
< |
fprintf(stderr, |
81 |
< |
"%s: scanline %d reclaimed\n", |
82 |
< |
progname, y); |
83 |
< |
#endif |
81 |
> |
nrecl++; |
82 |
|
} |
83 |
|
return(sl); |
84 |
|
} |
142 |
|
{ |
143 |
|
static long lastcall = 0L; /* ncall at last report */ |
144 |
|
static long lastread = 0L; /* nread at last report */ |
145 |
+ |
static long lastrecl = 0L; /* nrecl at last report */ |
146 |
|
|
147 |
|
if (ncall == lastcall) |
148 |
|
return; |
149 |
< |
fprintf(stderr, "%s: %ld scanlines read in %ld calls\n", |
150 |
< |
progname, nread-lastread, ncall-lastcall); |
149 |
> |
fprintf(stderr, "%s: %ld scanlines read (%ld reclaimed) in %ld calls\n", |
150 |
> |
progname, nread-lastread, nrecl-lastrecl, ncall-lastcall); |
151 |
|
lastcall = ncall; |
152 |
|
lastread = nread; |
153 |
+ |
lastrecl = nrecl; |
154 |
|
} |
155 |
|
#endif |
156 |
|
|
177 |
|
|
178 |
|
|
179 |
|
double |
180 |
< |
getviewpix(vh, vv, se) /* compute single view pixel */ |
180 |
> |
getviewpix(vh, vv) /* compute single view pixel */ |
181 |
|
int vh, vv; |
182 |
– |
SPANERR *se; |
182 |
|
{ |
183 |
|
FVECT dir; |
184 |
|
float rt_buf[6]; |
185 |
|
double res; |
186 |
|
|
187 |
< |
if (compdir(dir, vh, vv, se) < 0) |
187 |
> |
if (compdir(dir, vh, vv) < 0) |
188 |
|
return(-1.0); |
189 |
|
npixinvw++; |
190 |
|
if ((res = pict_val(dir)) >= 0.0) |
211 |
|
float rt_buf[6*MAXPIX]; /* rtrace send/receive buffer */ |
212 |
|
register int n; /* number of pixels in buffer */ |
213 |
|
short buf_vh[MAXPIX]; /* pixel positions */ |
215 |
– |
SPANERR sperr; |
214 |
|
FVECT dir; |
215 |
|
register int vh; |
216 |
|
|
219 |
|
fprintf(stderr, "%s: computing view span at %d...\n", |
220 |
|
progname, vv); |
221 |
|
#endif |
224 |
– |
setspanerr(&sperr, vv); |
222 |
|
n = 0; |
223 |
|
for (vh = -hsize; vh <= hsize; vh++) { |
224 |
< |
if (compdir(dir, vh, vv, &sperr) < 0) { /* not in view */ |
224 |
> |
if (compdir(dir, vh, vv) < 0) { /* not in view */ |
225 |
|
vb[vh+hsize] = -1.0; |
226 |
|
continue; |
227 |
|
} |
287 |
|
getexpos(s) /* get exposure from header line */ |
288 |
|
char *s; |
289 |
|
{ |
290 |
+ |
char fmt[32]; |
291 |
+ |
|
292 |
|
if (isexpos(s)) |
293 |
|
exposure *= exposval(s); |
294 |
+ |
else if (isformat(s)) { |
295 |
+ |
formatval(fmt, s); |
296 |
+ |
wrongformat = strcmp(fmt, COLRFMT); |
297 |
+ |
} |
298 |
|
} |
299 |
|
|
300 |
|
|
306 |
|
exit(1); |
307 |
|
} |
308 |
|
exposure = 1.0; |
309 |
< |
getheader(pictfp, getexpos); |
310 |
< |
if (fgetresolu(&pxsiz, &pysiz, pictfp) != (YMAJOR|YDECR)) { |
311 |
< |
fprintf("%s: bad picture resolution\n", fn); |
309 |
> |
getheader(pictfp, getexpos, NULL); |
310 |
> |
if (wrongformat || |
311 |
> |
fgetresolu(&pxsiz, &pysiz, pictfp) != (YMAJOR|YDECR)) { |
312 |
> |
fprintf("%s: bad picture format\n", fn); |
313 |
|
exit(1); |
314 |
|
} |
315 |
|
initscans(); |