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

Comparing ray/src/hd/holofile.c (file contents):
Revision 3.4 by gregl, Tue Nov 4 10:42:03 1997 UTC vs.
Revision 3.5 by gregl, Wed Nov 5 17:28:49 1997 UTC

# Line 16 | Line 16 | static char SCCSid[] = "$SunId$ SGI";
16   #define CACHESIZE       16      /* default cache size (Mbytes, 0==inf) */
17   #endif
18   #ifndef FREEBEAMS
19 < #define FREEBEAMS       1024    /* maximum beams to free at a time */
19 > #define FREEBEAMS       512     /* maximum beams to free at a time */
20   #endif
21   #ifndef PCTFREE
22 < #define PCTFREE         12      /* maximum fraction to free (%) */
22 > #define PCTFREE         20      /* maximum fraction to free (%) */
23   #endif
24  
25 < #define MAXFRAG         8192    /* maximum fragments tracked per open file */
25 > #define MAXFRAG         (128*FRAGBLK)   /* maximum fragments per file */
26  
27   #define FRAGBLK         64      /* number of fragments to allocate at a time */
28  
# Line 314 | Line 314 | register int   i;
314                  register int    j, k;
315                                          /* relinquish old fragment */
316                  if (hp->bi[i].nrd) {
317 <                        j = ++f->nfrags;
317 >                        j = f->nfrags++;
318   #ifdef MAXFRAG
319 <                        if (j >= MAXFRAG)
319 >                        if (j >= MAXFRAG-1)
320                                  f->nfrags--;
321                        else
321   #endif
322 <                        if (j % FRAGBLK == 1) {         /* more frag. space */
322 >                        if (j % FRAGBLK == 0) {         /* more frag. space */
323                                  if (f->fi == NULL)
324                                          f->fi = (BEAMI *)malloc(
325                                                          FRAGBLK*sizeof(BEAMI));
326                                  else
327                                          f->fi = (BEAMI *)realloc((char *)f->fi,
328 <                                                (FRAGBLK-1+j)*sizeof(BEAMI));
328 >                                                (j+FRAGBLK)*sizeof(BEAMI));
329                                  if (f->fi == NULL)
330                                          error(SYSTEM,
331                                                  "out of memory in hdgetbi");
332                          }
333 <                        for ( ; ; ) {   /* stick it in our descending list */
334 <                                if (!--j || hp->bi[i].fo < f->fi[j-1].fo) {
333 >                        for ( ; ; j--) {        /* insert in descending list */
334 >                                if (!j || hp->bi[i].fo < f->fi[j-1].fo) {
335                                          f->fi[j].fo = hp->bi[i].fo;
336                                          f->fi[j].nrd = hp->bi[i].nrd;
337                                          break;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines