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

Comparing ray/src/hd/rholo3.c (file contents):
Revision 3.31 by gwlarson, Thu Mar 4 10:29:23 1999 UTC vs.
Revision 3.33 by gwlarson, Mon Mar 8 17:31:49 1999 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1998 Silicon Graphics, Inc. */
1 > /* Copyright (c) 1999 Silicon Graphics, Inc. */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ SGI";
# Line 10 | Line 10 | static char SCCSid[] = "$SunId$ SGI";
10  
11   #include "rholo.h"
12   #include "view.h"
13 #include <sys/types.h>
13  
14   #ifndef NFRAG2CHUNK
15   #define NFRAG2CHUNK     4096    /* number of fragments to start chunking */
# Line 264 | Line 263 | int    bi;
263  
264   ambient_list()                  /* compute ambient beam list */
265   {
266 <        long    wtotal = 0;
266 >        int4    wtotal, minrt;
267          double  frac;
268          int     i;
269          register int    j, k;
# Line 275 | Line 274 | ambient_list()                 /* compute ambient beam list */
274          complist = (PACKHEAD *)malloc(complen*sizeof(PACKHEAD));
275          CHECK(complist==NULL, SYSTEM, "out of memory in ambient_list");
276                                          /* compute beam weights */
277 <        k = 0;
277 >        k = 0; wtotal = 0;
278          for (j = 0; hdlist[j] != NULL; j++) {
279                  frac = 512. * VLEN(hdlist[j]->wg[0]) *
280                                  VLEN(hdlist[j]->wg[1]) *
# Line 290 | Line 289 | ambient_list()                 /* compute ambient beam list */
289          }
290                                          /* adjust sample weights */
291          if (vdef(DISKSPACE))
292 <                frac = 1024.*1024.*vflt(DISKSPACE) /
294 <                                (wtotal*sizeof(RAYVAL));
292 >                frac = 1024.*1024.*vflt(DISKSPACE) / (wtotal*sizeof(RAYVAL));
293          else
294 <                frac = 1024.*1024.*16384. / (wtotal*sizeof(RAYVAL));
295 <        if (frac > 1.11 || frac < 0.9)
296 <                for (k = complen; k--; )
297 <                        complist[k].nr = frac*complist[k].nr + 0.5;
294 >                frac = 1024.*1024.*2048. / (wtotal*sizeof(RAYVAL));
295 >        minrt = .02*frac*wtotal/complen + .5;   /* heuristic mimimum */
296 >        if (minrt > RPACKSIZ)
297 >                minrt = RPACKSIZ;
298 >        for (k = complen; k--; )
299 >                if ((complist[k].nr = frac*complist[k].nr + 0.5) < minrt)
300 >                        complist[k].nr = minrt;
301          listpos = 0; lastin = -1;       /* flag initial sort */
302   }
303  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines