ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/glareval.c
(Generate patch)

Comparing ray/src/util/glareval.c (file contents):
Revision 1.10 by greg, Fri Apr 5 14:41:55 1991 UTC vs.
Revision 1.14 by greg, Fri Apr 19 17:41:06 1991 UTC

# Line 20 | Line 20 | static char SCCSid[] = "$SunId$ LBL";
20   #define vfork           fork
21   #endif
22  
23 < #define MAXSBUF         1023980 /* maximum total size of scanline buffer */
23 > #define MAXSBUF         524268  /* 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  
# Line 50 | Line 50 | static SCAN    *hashtab[HSIZE];        /* scanline hash table */
50   static long     ncall = 0L;     /* number of calls to getpictscan */
51   static long     nread = 0L;     /* number of scanlines read */
52  
53 + static int      wrongformat = 0;
54 +
55   SCAN    *scanretire();
56  
57   extern long     ftell();
# Line 75 | Line 77 | int    y;
77                          if (sl->y == y) {               /* reclaim */
78                                  sl->next = hashtab[hi];
79                                  hashtab[hi] = sl;
80 + #ifdef DEBUG
81 +                                if (verbose)
82 +                                        fprintf(stderr,
83 +                                                "%s: scanline %d reclaimed\n",
84 +                                                        progname, y);
85 + #endif
86                          }
87                          return(sl);
88                  }
# Line 215 | Line 223 | float  *vb;
223   #endif
224          n = 0;
225          for (vh = -hsize; vh <= hsize; vh++) {
226 <                if (compdir(dir, vh, vv) < 0) { /* off viewable region */
226 >                if (compdir(dir, vh, vv) < 0) {         /* not in view */
227                          vb[vh+hsize] = -1.0;
228                          continue;
229                  }
# Line 281 | Line 289 | int    np;
289   getexpos(s)                     /* get exposure from header line */
290   char    *s;
291   {
292 +        char    fmt[32];
293 +
294          if (isexpos(s))
295                  exposure *= exposval(s);
296 +        else if (isformat(s)) {
297 +                formatval(fmt, s);
298 +                wrongformat = strcmp(fmt, COLRFMT);
299 +        }
300   }
301  
302  
303   open_pict(fn)                   /* open picture file */
304   char    *fn;
305   {
292        register int    i;
293
306          if ((pictfp = fopen(fn, "r")) == NULL) {
307                  fprintf("%s: cannot open\n", fn);
308                  exit(1);
309          }
310          exposure = 1.0;
311 <        getheader(pictfp, getexpos);
312 <        if (fgetresolu(&pxsiz, &pysiz, pictfp) != (YMAJOR|YDECR)) {
313 <                fprintf("%s: bad picture resolution\n", fn);
311 >        getheader(pictfp, getexpos, NULL);
312 >        if (wrongformat ||
313 >                        fgetresolu(&pxsiz, &pysiz, pictfp) != (YMAJOR|YDECR)) {
314 >                fprintf("%s: bad picture format\n", fn);
315                  exit(1);
316          }
317          initscans();
# Line 307 | Line 320 | char   *fn;
320  
321   close_pict()                    /* done with picture */
322   {
310        register int    i;
311
323          if (pictfp == NULL)
324                  return;
325          fclose(pictfp);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines