1 |
– |
/* Copyright (c) 1991 Regents of the University of California */ |
2 |
– |
|
1 |
|
#ifndef lint |
2 |
< |
static char SCCSid[] = "$SunId$ LBL"; |
2 |
> |
static const char RCSid[] = "$Id$"; |
3 |
|
#endif |
6 |
– |
|
4 |
|
/* |
5 |
|
* Compute pixels for glare calculation |
6 |
|
*/ |
7 |
|
|
8 |
|
#include "glare.h" |
12 |
– |
#include "resolu.h" |
9 |
|
/* maximum rtrace buffer size */ |
10 |
|
#define MAXPIX (4096/(6*sizeof(float))) |
11 |
|
|
37 |
|
static SCAN *freelist; /* scanline free list */ |
38 |
|
static SCAN *hashtab[HSIZE]; /* scanline hash table */ |
39 |
|
|
40 |
+ |
static long scanbufsiz; /* size of allocated scanline buffer */ |
41 |
+ |
|
42 |
|
static long ncall = 0L; /* number of calls to getpictscan */ |
43 |
|
static long nread = 0L; /* number of scanlines read */ |
44 |
|
static long nrecl = 0L; /* number of scanlines reclaimed */ |
261 |
|
progname, np); |
262 |
|
#endif |
263 |
|
bzero(pb+6*np, 6*sizeof(float)); |
264 |
< |
if (process(rt_pd, pb, pb, 3*sizeof(float)*np, |
265 |
< |
6*sizeof(float)*(np+1)) < 3*sizeof(float)*np) { |
264 |
> |
if (process(rt_pd, (char *)pb, (char *)pb, 3*sizeof(float)*(np+1), |
265 |
> |
6*sizeof(float)*(np+1)) < 3*sizeof(float)*(np+1)) { |
266 |
|
fprintf(stderr, "%s: rtrace communication error\n", |
267 |
|
progname); |
268 |
|
exit(1); |
270 |
|
} |
271 |
|
|
272 |
|
|
273 |
+ |
int |
274 |
|
getexpos(s) /* get exposure from header line */ |
275 |
|
char *s; |
276 |
|
{ |
282 |
|
formatval(fmt, s); |
283 |
|
wrongformat = strcmp(fmt, COLRFMT); |
284 |
|
} |
285 |
+ |
return(0); |
286 |
|
} |
287 |
|
|
288 |
|
|
290 |
|
char *fn; |
291 |
|
{ |
292 |
|
if ((pictfp = fopen(fn, "r")) == NULL) { |
293 |
< |
fprintf("%s: cannot open\n", fn); |
293 |
> |
fprintf(stderr, "%s: cannot open\n", fn); |
294 |
|
exit(1); |
295 |
|
} |
296 |
|
exposure = 1.0; |
398 |
|
register SCAN *ptr; |
399 |
|
register int i; |
400 |
|
/* initialize positions */ |
401 |
< |
scanpos = (long *)malloc(pysiz*sizeof(long)); |
401 |
> |
scanpos = (long *)bmalloc(pysiz*sizeof(long)); |
402 |
|
if (scanpos == NULL) |
403 |
|
memerr("scanline positions"); |
404 |
|
for (i = pysiz-1; i >= 0; i--) |
415 |
|
i = MAXSBUF / scansize; /* compute number to allocate */ |
416 |
|
if (i > HSIZE) |
417 |
|
i = HSIZE; |
418 |
< |
scan_buf = malloc(i*scansize); /* get in one big chunk */ |
418 |
> |
scanbufsiz = i*scansize; |
419 |
> |
scan_buf = bmalloc(scanbufsiz); /* get in one big chunk */ |
420 |
|
if (scan_buf == NULL) |
421 |
|
memerr("scanline buffers"); |
422 |
|
ptr = (SCAN *)scan_buf; |
433 |
|
|
434 |
|
donescans() /* free up scanlines */ |
435 |
|
{ |
436 |
< |
free(scan_buf); |
437 |
< |
free((char *)scanpos); |
436 |
> |
bfree(scan_buf, scanbufsiz); |
437 |
> |
bfree((char *)scanpos, pysiz*sizeof(long)); |
438 |
|
} |