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

Comparing ray/src/util/rad.c (file contents):
Revision 2.96 by greg, Tue May 18 18:57:27 2010 UTC vs.
Revision 2.102 by greg, Sun Oct 10 09:25:45 2010 UTC

# Line 165 | Line 165 | static int touch(char  *fn);
165   static int runcom(char  *cs);
166   static int rmfile(char  *fn);
167   static int mvfile(char  *fold, char     *fnew);
168 < static int next_process(void);
168 > static int next_process(int     reserve);
169   static void wait_process(int    all);
170   static void finish_process(void);
171   static void badvalue(int        vc);
# Line 751 | Line 751 | lowqopts(                      /* low quality rendering options */
751                  op = addarg(op, "-ds .4");
752          else
753                  op = addarg(op, "-ds 0");
754 <        op = addarg(op, "-dt .2 -dc .25 -dr 0 -sj 0 -st .5");
754 >        op = addarg(op, "-dt .2 -dc .25 -dr 0 -ss 0 -st .5");
755          if (vdef(AMBFILE)) {
756                  sprintf(op, " -af %s", vval(AMBFILE));
757                  op += strlen(op);
# Line 826 | Line 826 | medqopts(                      /* medium quality rendering options */
826                  op = addarg(op, "-ds .2 -dj .9");
827          else
828                  op = addarg(op, "-ds .3");
829 <        op = addarg(op, "-dt .1 -dc .5 -dr 1 -sj .7 -st .1");
829 >        op = addarg(op, "-dt .1 -dc .5 -dr 1 -ss 1 -st .1");
830          if ( (overture = vint(INDIRECT)) ) {
831                  sprintf(op, " -ab %d", overture);
832                  op += strlen(op);
# Line 904 | Line 904 | hiqopts(                               /* high quality rendering options */
904                  op = addarg(op, "-ds .1 -dj .9");
905          else
906                  op = addarg(op, "-ds .2");
907 <        op = addarg(op, "-dt .05 -dc .75 -dr 3 -sj 1 -st .01");
907 >        op = addarg(op, "-dt .05 -dc .75 -dr 3 -ss 16 -st .01");
908          sprintf(op, " -ab %d", overture=vint(INDIRECT)+1);
909          op += strlen(op);
910          if (vdef(AMBFILE)) {
# Line 1261 | Line 1261 | rpict(                         /* run rpict and pfilt for each view */
1261   )
1262   {
1263   #define do_rpiece       (sfile[0]!='\0')
1264 <        char    combuf[4*PATH_MAX+512];
1264 >        char    combuf[5*PATH_MAX+512];
1265          char    rawfile[PATH_MAX], picfile[PATH_MAX];
1266          char    zopt[PATH_MAX+4], rep[PATH_MAX+16], res[32];
1267 <        char    rppopt[128], sfile[64], *pfile = NULL;
1267 >        char    rppopt[32], sfile[PATH_MAX], *pfile = NULL;
1268          char    pfopts[128];
1269          char    vs[32], *vw;
1270          int     vn, mult;
# Line 1316 | Line 1316 | rpict(                         /* run rpict and pfilt for each view */
1316                                          getview(0, vs) != NULL) {
1317                  if (!strcmp(c_rpict, DEF_RPICT_PATH) &&
1318                                  getview(1, NULL) == NULL) {
1319 <                        sprintf(sfile, "rpsync_%s.txt", vs);
1319 >                        sprintf(sfile, "%s_%s_rpsync.txt",
1320 >                                vdef(RAWFILE) ? vval(RAWFILE) : vval(PICTURE),
1321 >                                        vs);
1322                          strcpy(rppopt, "-PP pfXXXXXX");
1323                  } else {
1324                          strcpy(rppopt, "-S 1 -PP pfXXXXXX");
# Line 1359 | Line 1361 | rpict(                         /* run rpict and pfilt for each view */
1361                  if (do_rpiece) {
1362                          if (rfdt < oct1date || !fdate(sfile)) {
1363                                  int     xdiv = 8+nprocs/3, ydiv = 8+nprocs/3;
1364 +                                if (rfdt >= oct1date) {
1365 +                                        fprintf(stderr,
1366 +                "%s: partial output not created with rpiece\n", rawfile);
1367 +                                        quit(1);
1368 +                                }
1369                                  rfdt = 0;               /* start fresh */
1370                                  if (!silent)
1371                                          printf("\techo %d %d > %s\n",
# Line 1371 | Line 1378 | rpict(                         /* run rpict and pfilt for each view */
1378                                  fprintf(fp, "%d %d\n", xdiv, ydiv);
1379                                  fclose(fp);
1380                          }
1381 <                } else if (next_process()) {
1381 >                } else if (next_process(0)) {
1382                          if (pfile != NULL)
1383                                  sleep(10);
1384                          continue;
# Line 1384 | Line 1391 | rpict(                         /* run rpict and pfilt for each view */
1391                                  sprintf(combuf, "%s -R %s %s%s %s %s%s%s -o %s %s",
1392                                                  c_rpiece, sfile, rppopt, rep, vw,
1393                                                  res, opts, po, rawfile, oct1name);
1394 <                                while (children_running < nprocs-1 &&
1388 <                                                        next_process()) {
1394 >                                while (next_process(1)) {
1395                                          sleep(10);
1396                                          combuf[strlen(c_rpiece)+2] = 'F';
1397                                  }
# Line 1397 | Line 1403 | rpict(                         /* run rpict and pfilt for each view */
1403                  } else {
1404                          if (overture) {         /* run overture calculation */
1405                                  sprintf(combuf,
1406 <                                "%s%s %s%s -x 64 -y 64 -ps 1 %s > %s",
1406 >                                        "%s%s %s%s -x 64 -y 64 -ps 1 %s > %s",
1407                                                  c_rpict, rep, vw, opts,
1408                                                  oct1name, overfile);
1409 <                                if (runcom(combuf)) {
1410 <                                        fprintf(stderr,
1409 >                                if (!do_rpiece || !next_process(0)) {
1410 >                                        if (runcom(combuf)) {
1411 >                                                fprintf(stderr,
1412                                          "%s: error in overture for view %s\n",
1413 <                                                progname, vs);
1414 <                                        quit(1);
1415 <                                }
1413 >                                                        progname, vs);
1414 >                                                quit(1);
1415 >                                        }
1416   #ifndef NULL_DEVICE
1417 <                                rmfile(overfile);
1417 >                                        rmfile(overfile);
1418   #endif
1419 +                                } else if (do_rpiece)
1420 +                                        sleep(20);
1421                          }
1422                          if (do_rpiece) {
1423                                  sprintf(combuf, "%s -F %s %s%s %s %s%s%s -o %s %s",
1424                                                  c_rpiece, sfile, rppopt, rep, vw,
1425                                                  res, opts, po, rawfile, oct1name);
1426 <                                while (children_running < nprocs-1 &&
1418 <                                                        next_process())
1426 >                                while (next_process(1))
1427                                          sleep(10);
1428                          } else {
1429                                  sprintf(combuf, "%s%s %s %s%s%s%s %s > %s",
# Line 1546 | Line 1554 | mvfile(                /* move a file */
1554  
1555   #ifdef RHAS_FORK_EXEC
1556   static int
1557 < next_process(void)                      /* fork the next process (max. nprocs) */
1557 > next_process(int reserve)               /* fork the next process */
1558   {
1559          RT_PID  child_pid;
1560  
# Line 1557 | Line 1565 | next_process(void)                     /* fork the next process (max. np
1565                                  progname);
1566                  quit(1);
1567          }
1568 +        if (reserve > 0 && children_running >= nprocs-reserve)
1569 +                return(0);              /* caller holding back process(es) */
1570          if (children_running >= nprocs)
1571                  wait_process(0);        /* wait for someone to finish */
1572          fflush(NULL);                   /* flush output */
1573          child_pid = fork();             /* split process */
1574          if (child_pid == 0) {           /* we're the child */
1575                  children_running = -1;
1576 +                nprocs = 1;
1577                  return(0);
1578          }
1579          if (child_pid > 0) {            /* we're the parent */
# Line 1604 | Line 1615 | wait_process(                  /* wait for process(es) to finish */
1615   }
1616   #else   /* ! RHAS_FORK_EXEC */
1617   static int
1618 < next_process(void)
1618 > next_process(int reserve)
1619   {
1620          return(0);                      /* cannot start new process */
1621   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines