| 1 |
< |
/* Copyright (c) 1998 Silicon Graphics, Inc. */ |
| 1 |
> |
/* Copyright (c) 1999 Silicon Graphics, Inc. */ |
| 2 |
|
|
| 3 |
|
#ifndef lint |
| 4 |
|
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 */ |
| 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; |
| 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]) * |
| 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 |
|
|