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.28 by gwlarson, Mon Nov 9 17:10:53 1998 UTC vs.
Revision 3.29 by gwlarson, Wed Nov 11 10:56:07 1998 UTC

# Line 24 | Line 24 | static char SCCSid[] = "$SunId$ SGI";
24   #ifndef MAXFRAG
25   #define MAXFRAG         32767   /* maximum fragments/file to track (0==inf) */
26   #endif
27 + #ifndef MINDIRSEL
28 +                                /* minimum directory seek length */
29 + #define MINDIRSEL       (4*BUFSIZ/sizeof(BEAMI))
30 + #endif
31  
32   #ifndef BSD
33   #define write   writebuf        /* safe i/o routines */
# Line 204 | Line 208 | int    i;
208                  }
209                  copystruct(hp->dirseg+j, hp->dirseg+(j-1));
210          }
211 <        mindist = nbeams(hp);                   /* find closest neighbors */
212 <        for (j = hp->dirty; --j; )
213 <                if (hp->dirseg[j].s - (hp->dirseg[j-1].s + hp->dirseg[j-1].n)
214 <                                < mindist) {
215 <                        mindist = hp->dirseg[j].s -
211 >        do {                            /* check neighbors */
212 >                mindist = nbeams(hp);           /* find closest */
213 >                for (j = hp->dirty; --j; )
214 >                        if (hp->dirseg[j].s -
215 >                                        (hp->dirseg[j-1].s + hp->dirseg[j-1].n)
216 >                                        < mindist) {
217 >                                minpos = j;
218 >                                mindist = hp->dirseg[j].s -
219                                          (hp->dirseg[j-1].s + hp->dirseg[j-1].n);
220 <                        minpos = j;
221 <                }
222 <        if (hp->dirty > MAXDIRSE || mindist <= BUFSIZ/sizeof(BEAMI)) {
220 >                        }
221 >                                                /* good enough? */
222 >                if (hp->dirty <= MAXDIRSE && mindist > MINDIRSEL)
223 >                        break;
224                  j = minpos - 1;                 /* coalesce neighbors */
225                  if (hp->dirseg[j].s + hp->dirseg[j].n <
226 <                                hp->dirseg[minpos].s + hp->dirseg[minpos].n) {
226 >                                hp->dirseg[minpos].s + hp->dirseg[minpos].n)
227                          hp->dirseg[j].n = hp->dirseg[minpos].s +
228                                          hp->dirseg[minpos].n - hp->dirseg[j].s;
229 <                }
230 <                hp->dirty--;                    /* close the gap */
223 <                for (j = minpos; j < hp->dirty; j++)
229 >                hp->dirty--;
230 >                while (++j < hp->dirty)         /* close the gap */
231                          copystruct(hp->dirseg+j, hp->dirseg+(j+1));
232 <        }
232 >        } while (mindist <= MINDIRSEL);
233   }
234  
235  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines