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

Comparing ray/src/util/ranimate.c (file contents):
Revision 2.27 by gwlarson, Wed Jun 3 16:37:51 1998 UTC vs.
Revision 2.43 by schorsch, Mon Oct 27 10:32:06 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1996 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char RCSid[] = "$Id$";
3   #endif
6
4   /*
5   * Radiance animation control program
6 + *
7 + * The main difference between this program and ranimove is that
8 + * we have many optimizations here for camera motion in static
9 + * environments, calling rpict and pinterp on multiple processors,
10 + * where ranimove puts its emphasis on object motion, and does
11 + * not use any external programs for image generation.
12 + *
13 + * See the ranimate(1) man page for further details.
14   */
15  
16 < #include "standard.h"
16 > #include "copyright.h"
17 >
18 > #include <stdio.h>
19   #include <ctype.h>
13 #include <sys/types.h>
20   #include <sys/stat.h>
21 + #include <time.h>
22 +
23 + /*#include "standard.h"*/
24 + #include "platform.h"
25 + #include "paths.h"
26 + #include "rtio.h"
27 + #include "rterror.h"
28   #include "view.h"
29   #include "vars.h"
30   #include "netproc.h"
31 +                                /* default blur samples */
32 + #ifndef DEF_NBLUR
33 + #define DEF_NBLUR       5
34 + #endif
35                                  /* default remote shell */
19 #ifdef _AUX_SOURCE
20 #define REMSH           "remsh"
21 #else
36   #define REMSH           "rsh"
23 #endif
37                                  /* input variables (alphabetical by name) */
38   #define ANIMATE         0               /* animation command */
39   #define ARCHIVE         1               /* archiving command */
# Line 31 | Line 44 | static char SCCSid[] = "$SunId$ LBL";
44   #define EXPOSURE        6               /* how to compute exposure */
45   #define HOST            7               /* rendering host machine */
46   #define INTERP          8               /* # frames to interpolate */
47 < #define MBLUR           9               /* samples for motion blur */
47 > #define MBLUR           9               /* motion blur parameters */
48   #define NEXTANIM        10              /* next animation file */
49   #define OCTREE          11              /* octree file name */
50   #define OVERSAMP        12              /* # times to oversample image */
# Line 109 | Line 122 | struct pslot {
122   int     npslots;                /* number of process slots */
123  
124   #define phostname(ps)   ((ps)->hostname[0] ? (ps)->hostname : astat.host)
112
113 struct pslot    *findpslot();
114
125   PSERVER *lastpserver;           /* last process server with error */
126  
127 < VIEW    *getview();
128 < char    *getexp(), *dirfile();
127 > static struct pslot * findpslot(int pid);
128 > static void checkdir(void);
129 > static VIEW * getview(int n);
130  
131 < extern time_t   fdate(), time();
131 > static char * dirfile(char *df, register char *path);
132 > static char * getexp(int n);
133 > static int getblur(double *bf);
134 > static int getastat(void);
135 > static void getradfile(char *rfargs);
136 > static void badvalue(int vc);
137 > static int rmfile(char *fn);
138 > static int runcom(char *cs);
139 > static int pruncom(char *com, char *ppins, int maxcopies);
140 > static void bwait(int ncoms);
141 > static int bruncom(char *com, int fout, int (*rf)());
142 > static int serverdown(void);
143 > static int donecom(PSERVER *ps, int pn, int status);
144 > static int countviews(void);
145 > static int dofilt(int frame, int rvr);
146 > static void archive(void);
147 > static int frecover(int frame);
148 > static int recover(int frame);
149 > static void sethosts(void);
150 > static void walkwait(int first, int last, char *vfn);
151 > static void animrend(int frame, VIEW *vp);
152 > static void transferframes(void);
153 > static void filterframes(void);
154 > static void renderframes(int nframes);
155 > static void animate(void);
156 > static void setdefaults(void);
157 > static void putastat(void);
158  
159  
160   main(argc, argv)
# Line 191 | Line 228 | userr:
228   }
229  
230  
231 < getastat()                      /* check/set animation status */
231 > static int
232 > getastat(void)                  /* check/set animation status */
233   {
234          char    sfname[256];
235          FILE    *fp;
# Line 255 | Line 293 | fmterr:
293   }
294  
295  
296 < putastat()                      /* put out current status */
296 > static void
297 > putastat(void)                  /* put out current status */
298   {
299          char    buf[256];
300          FILE    *fp;
# Line 277 | Line 316 | putastat()                     /* put out current status */
316   }
317  
318  
319 < checkdir()                      /* make sure we have our directory */
319 > static void
320 > checkdir(void)                  /* make sure we have our directory */
321   {
322          struct stat     stb;
323  
# Line 299 | Line 339 | checkdir()                     /* make sure we have our directory */
339   }
340  
341  
342 < setdefaults()                   /* set default values */
342 > static void
343 > setdefaults(void)                       /* set default values */
344   {
345          extern char     *atos();
346          int     decades;
# Line 387 | Line 428 | setdefaults()                  /* set default values */
428   }
429  
430  
431 < sethosts()                      /* set up process servers */
431 > static void
432 > sethosts(void)                  /* set up process servers */
433   {
434          extern char     *iskip();
435          char    buf[256], *dir, *uname;
# Line 442 | Line 484 | sethosts()                     /* set up process servers */
484          }
485   }
486  
487 <
488 < getradfile(rfargs)              /* run rad and get needed variables */
447 < char    *rfargs;
487 > static void
488 > getradfile(char *rfargs)                /* run rad and get needed variables */
489   {
490          static short    mvar[] = {OCTREE,PFILT,RESOLUTION,EXPOSURE,-1};
491          char    combuf[256];
# Line 469 | Line 510 | char   *rfargs;
510                          pippt = NULL;
511                  }
512          if (pippt != NULL)
513 <                strcpy(pippt, "> /dev/null");   /* nothing to match */
513 >                strcpy(pippt, "> " NULL_DEVICE);        /* nothing to match */
514          else {
515                  sprintf(cp, ")[ \t]*=' > %s/radset.var", vval(DIRECTORY));
516                  cp += 11;               /* point to file name */
517          }
518 <        if (system(combuf)) {
478 <                fprintf(stderr, "%s: error executing rad command:\n\t%s\n",
479 <                                progname, combuf);
480 <                quit(1);
481 <        }
518 >        system(combuf);                 /* ignore exit code */
519          if (pippt == NULL) {            /* load variables and remove file */
520                  loadvars(cp);
521                  unlink(cp);
# Line 486 | Line 523 | char   *rfargs;
523   }
524  
525  
526 < animate()                       /* run animation */
526 > static void
527 > animate(void)                   /* run animation */
528   {
529          int     xres, yres;
530          float   pa, mult;
# Line 516 | Line 554 | animate()                      /* run animation */
554                                                  progname, vnam(INTERP));
555                          vval(INTERP) = "0";
556                  }
557 <                if (atoi(vval(MBLUR))) {        /* can't handle this yet */
557 >                if (strcmp(vval(MBLUR),"0")) {  /* can't handle this */
558                          if (!nowarn)
559                                  fprintf(stderr,
560                                          "%s: resetting %s=0 for animation\n",
# Line 526 | Line 564 | animate()                      /* run animation */
564          }
565                                          /* figure # frames per batch */
566          d1 = mult*xres*mult*yres*4;             /* space for orig. picture */
567 <        if ((i=vint(INTERP)) || atoi(vval(MBLUR)))
567 >        if ((i=vint(INTERP)) || getblur(NULL) > 1)
568                  d1 += mult*xres*mult*yres*sizeof(float);        /* Z-buffer */
569          d2 = xres*yres*4;                       /* space for final picture */
570          frames_batch = (i+1)*(vflt(DISKSPACE)*1048576.-d1)/(d1+i*d2);
# Line 557 | Line 595 | animate()                      /* run animation */
595   }
596  
597  
598 < renderframes(nframes)           /* render next nframes frames */
599 < int     nframes;
598 > static void
599 > renderframes(int nframes)               /* render next nframes frames */
600   {
601          static char     vendbuf[16];
602          VIEW    *vp;
# Line 614 | Line 652 | int    nframes;
652   }
653  
654  
655 < filterframes()                          /* catch up with filtering */
655 > static void
656 > filterframes(void)                              /* catch up with filtering */
657   {
658          VIEW    *vp;
659          register int    i;
# Line 622 | Line 661 | filterframes()                         /* catch up with filtering */
661          if (astat.tnext < astat.fnext)  /* other work to do first */
662                  return;
663                                          /* filter each view */
664 <        for (i = astat.fnext; i < astat.rnext; i++) {
665 <                if ((vp = getview(i)) == NULL) {        /* get view i */
666 <                        fprintf(stderr,
628 <                        "%s: unexpected error reading view for frame %d\n",
629 <                                        progname, i);
630 <                        quit(1);
631 <                }
632 <                dofilt(i, vp, getexp(i), 0);            /* filter frame */
633 <        }
664 >        for (i = astat.fnext; i < astat.rnext; i++)
665 >                dofilt(i, 0);
666 >
667          bwait(0);                       /* wait for filter processes */
668          archive();                      /* archive originals */
669          astat.fnext = i;                /* update status */
# Line 638 | Line 671 | filterframes()                         /* catch up with filtering */
671   }
672  
673  
674 < transferframes()                        /* catch up with picture transfers */
674 > static void
675 > transferframes(void)                    /* catch up with picture transfers */
676   {
677          char    combuf[10240], *fbase;
678          register char   *cp;
# Line 678 | Line 712 | transferframes()                       /* catch up with picture transfers
712   }
713  
714  
715 < animrend(frame, vp)                     /* start animation frame */
716 < int     frame;
717 < VIEW    *vp;
715 > static void
716 > animrend(                       /* start animation frame */
717 > int     frame,
718 > VIEW    *vp
719 > )
720   {
721          extern int      recover();
722          char    combuf[2048];
# Line 696 | Line 732 | VIEW   *vp;
732   }
733  
734  
735 < walkwait(first, last, vfn)              /* walk-through frames */
736 < int     first, last;
737 < char    *vfn;
735 > static void
736 > walkwait(               /* walk-through frames */
737 > int     first,
738 > int last,
739 > char    *vfn
740 > )
741   {
742 +        double  blurf;
743 +        int     nblur = getblur(&blurf);
744          char    combuf[2048];
745 <        char    *inspoint;
745 >        register char   *inspoint;
746          register int    i;
747  
748          if (!noaction && vint(INTERP))          /* create dummy frames */
# Line 714 | Line 755 | char   *vfn;
755                                          /* create command */
756          sprintf(combuf, "rpict%s%s -w0", rendopt,
757                          viewopt(getview(first>1 ? first-1 : 1)));
758 <        if (vint(INTERP) || atoi(vval(MBLUR)))
759 <                sprintf(combuf+strlen(combuf), " -z %s.zbf", vval(BASENAME));
760 <        sprintf(combuf+strlen(combuf), " -o %s.unf %s -S %d",
758 >        inspoint = combuf;
759 >        while (*inspoint) inspoint++;
760 >        if (nblur) {
761 >                sprintf(inspoint, " -pm %.3f", blurf/nblur);
762 >                while (*inspoint) inspoint++;
763 >        }
764 >        if (nblur > 1 || vint(INTERP)) {
765 >                sprintf(inspoint, " -z %s.zbf", vval(BASENAME));
766 >                while (*inspoint) inspoint++;
767 >        }
768 >        sprintf(inspoint, " -o %s.unf %s -S %d",
769                          vval(BASENAME), rresopt, first);
770 <        inspoint = combuf + strlen(combuf);
770 >        while (*inspoint) inspoint++;
771          sprintf(inspoint, " %s < %s", vval(OCTREE), vfn);
772                                          /* run in parallel */
773          i = (last-first+1)/(vint(INTERP)+1);
# Line 738 | Line 787 | char   *vfn;
787   }
788  
789  
790 < int
791 < recover(frame)                          /* recover the specified frame */
743 < int     frame;
790 > static int
791 > recover(int frame)                              /* recover the specified frame */
792   {
793          static int      *rfrm;          /* list of recovered frames */
794          static int      nrfrms = 0;
795 +        double  blurf;
796 +        int     nblur = getblur(&blurf);
797          char    combuf[2048];
798          char    fname[128];
799          register char   *cp;
# Line 759 | Line 809 | int    frame;
809                                  vval(ANIMATE), frame, rendopt);
810          else
811                  sprintf(combuf, "rpict%s -w0", rendopt);
812 <        cp = combuf + strlen(combuf);
813 <        if (vint(INTERP) || atoi(vval(MBLUR))) {
812 >        cp = combuf;
813 >        while (*cp) cp++;
814 >        if (nblur) {
815 >                sprintf(cp, " -pm %.3f", blurf/nblur);
816 >                while (*cp) cp++;
817 >        }
818 >        if (nblur > 1 || vint(INTERP)) {
819                  sprintf(cp, " -z %s.zbf", fname);
820                  while (*cp) cp++;
821          }
# Line 774 | Line 829 | int    frame;
829                  return(1);
830                                          /* add frame to recovered list */
831          if (nrfrms)
832 <                rfrm = (int *)realloc((char *)rfrm, (nrfrms+1)*sizeof(int));
832 >                rfrm = (int *)realloc((void *)rfrm, (nrfrms+1)*sizeof(int));
833          else
834                  rfrm = (int *)malloc(sizeof(int));
835          if (rfrm == NULL) {
# Line 786 | Line 841 | int    frame;
841   }
842  
843  
844 < int
845 < frecover(frame)                         /* recover filtered frame */
791 < int     frame;
844 > static int
845 > frecover(int frame)                             /* recover filtered frame */
846   {
847 <        VIEW    *vp;
794 <        char    *ex;
795 <
796 <        vp = getview(frame);
797 <        ex = getexp(frame);
798 <        if (dofilt(frame, vp, ex, 2) && dofilt(frame, vp, ex, 1))
847 >        if (dofilt(frame, 2) && dofilt(frame, 1))
848                  return(1);
849          return(0);
850   }
851  
852  
853 < archive()                       /* archive and remove renderings */
853 > static void
854 > archive(void)                   /* archive and remove renderings */
855   {
856   #define RMCOML  (sizeof(rmcom)-1)
857          static char     rmcom[] = "rm -f";
# Line 844 | Line 894 | archive()                      /* archive and remove renderings */
894   }
895  
896  
897 < int
898 < dofilt(frame, vp, ep, rvr)                      /* filter frame */
899 < int     frame;
900 < VIEW    *vp;
901 < char    *ep;
852 < int     rvr;
897 > static int
898 > dofilt(                         /* filter frame */
899 > int     frame,
900 > int     rvr
901 > )
902   {
903          extern int      frecover();
904          static int      iter = 0;
905 +        double  blurf;
906 +        int     nblur = getblur(&blurf);
907 +        VIEW    *vp = getview(frame);
908 +        char    *ep = getexp(frame);
909          char    fnbefore[128], fnafter[128], *fbase;
910          char    combuf[1024], fname0[128], fname1[128];
911          int     usepinterp, usepfilt, nora_rgbe;
912          int     frseq[2];
913                                                  /* check what is needed */
914 <        usepinterp = atoi(vval(MBLUR));
915 <        usepfilt = pfiltalways | ep==NULL;
914 >        if (vp == NULL) {
915 >                 fprintf(stderr,
916 >                        "%s: unexpected error reading view for frame %d\n",
917 >                                          progname, frame);
918 >                quit(1);
919 >        }
920 >        if (ep == NULL) {
921 >                 fprintf(stderr,
922 >                        "%s: unexpected error reading exposure for frame %d\n",
923 >                                          progname, frame);
924 >                quit(1);
925 >        }
926 >        usepinterp = (nblur > 1);
927 >        usepfilt = pfiltalways | (ep==NULL);
928          if (ep != NULL && !strcmp(ep, "1"))
929                  ep = "+0";
930          nora_rgbe = strcmp(vval(OVERSAMP),"1") || ep==NULL ||
# Line 903 | Line 968 | int    rvr;
968          if (usepinterp) {                       /* using pinterp */
969                  if (rvr == 2 && recover(frseq[1]))      /* recover after? */
970                          return(1);
971 <                if (atoi(vval(MBLUR))) {
971 >                if (nblur > 1) {                /* with pmblur */
972                          sprintf(fname0, "%s/vw0%c", vval(DIRECTORY),
973                                          'a'+(iter%26));
974                          sprintf(fname1, "%s/vw1%c", vval(DIRECTORY),
# Line 930 | Line 995 | int    rvr;
995                                  putc('\n', fp); fclose(fp);
996                          }
997                          sprintf(combuf,
998 <                        "(pmblur %s %d %s %s; rm -f %s %s) | pinterp -B",
999 <                        *sskip(vval(MBLUR)) ? sskip2(vval(MBLUR),1) : "1",
935 <                                        atoi(vval(MBLUR)),
998 >                        "(pmblur %.3f %d %s %s; rm -f %s %s) | pinterp -B -a",
999 >                                        blurf, nblur,
1000                                          fname0, fname1, fname0, fname1);
1001                          iter++;
1002                  } else                          /* no blurring */
# Line 946 | Line 1010 | int    rvr;
1010                  if (usepfilt)
1011                          sprintf(combuf+strlen(combuf), " %s", rresopt);
1012                  else
1013 <                        sprintf(combuf+strlen(combuf), " %s -e %s",
1013 >                        sprintf(combuf+strlen(combuf), " -a %s -e %s",
1014                                          fresopt, ep);
1015                  sprintf(combuf+strlen(combuf), " %s.unf %s.zbf",
1016                                  fnbefore, fnbefore);
# Line 993 | Line 1057 | int    rvr;
1057   }
1058  
1059  
1060 < VIEW *
1061 < getview(n)                      /* get view number n */
998 < int     n;
1060 > static VIEW *
1061 > getview(int n)                  /* get view number n */
1062   {
1063          static FILE     *viewfp = NULL;         /* view file pointer */
1064          static int      viewnum = 0;            /* current view number */
# Line 1007 | Line 1070 | int    n;
1070                          fclose(viewfp);
1071                          viewfp = NULL;
1072                          viewnum = 0;
1073 <                        copystruct(&curview, &stdview);
1073 >                        curview = stdview;
1074                  }
1075                  return(NULL);
1076          }
# Line 1023 | Line 1086 | int    n;
1086                          perror(vval(VIEWFILE));
1087                          quit(1);
1088                  }
1089 <                copystruct(&curview, &stdview);
1089 >                curview = stdview;
1090                  viewnum = 0;
1091          }
1092          if (n < 0) {                            /* get next view */
# Line 1043 | Line 1106 | int    n;
1106   }
1107  
1108  
1109 < int
1110 < countviews()                    /* count views in view file */
1109 > static int
1110 > countviews(void)                        /* count views in view file */
1111   {
1112          int     n;
1113  
# Line 1056 | Line 1119 | countviews()                   /* count views in view file */
1119   }
1120  
1121  
1122 < char *
1123 < getexp(n)                       /* get exposure for nth frame */
1061 < int     n;
1122 > static char *
1123 > getexp(int n)                   /* get exposure for nth frame */
1124   {
1125          extern char     *fskip();
1126          static char     expval[32];
# Line 1070 | Line 1132 | int    n;
1132          if (n == 0) {                           /* signal to close file */
1133                  if (expfp != NULL) {
1134                          fclose(expfp);
1135 <                        free((char *)exppos);
1135 >                        free((void *)exppos);
1136                          expfp = NULL;
1137                  }
1138                  return(NULL);
# Line 1127 | Line 1189 | int    n;
1189   }
1190  
1191  
1192 < struct pslot *
1193 < findpslot(pid)                  /* find or allocate a process slot */
1132 < int     pid;
1192 > static struct pslot *
1193 > findpslot(int pid)                      /* find or allocate a process slot */
1194   {
1195          register struct pslot   *psempty = NULL;
1196          register int    i;
# Line 1144 | Line 1205 | int    pid;
1205   }
1206  
1207  
1208 < int
1209 < donecom(ps, pn, status)         /* clean up after finished process */
1210 < PSERVER *ps;
1211 < int     pn;
1212 < int     status;
1208 > static int
1209 > donecom(                /* clean up after finished process */
1210 > PSERVER *ps,
1211 > int     pn,
1212 > int     status
1213 > )
1214   {
1215 <        register PROC   *pp;
1215 >        register NETPROC        *pp;
1216          register struct pslot   *psl;
1217  
1218          pp = ps->proc + pn;
# Line 1185 | Line 1247 | int    status;
1247   }
1248  
1249  
1250 < int
1251 < serverdown()                    /* check status of last process server */
1250 > static int
1251 > serverdown(void)                        /* check status of last process server */
1252   {
1253          if (lastpserver == NULL || !lastpserver->hostname[0])
1254                  return(0);
# Line 1202 | Line 1264 | serverdown()                   /* check status of last process server
1264   }
1265  
1266  
1267 < int
1268 < bruncom(com, fout, rf)          /* run a command in the background */
1269 < char    *com;
1270 < int     fout;
1271 < int     (*rf)();
1267 > static int
1268 > bruncom(                /* run a command in the background */
1269 > char    *com,
1270 > int     fout,
1271 > int     (*rf)()
1272 > )
1273   {
1274          int     pid;
1275          register struct pslot   *psl;
# Line 1235 | Line 1298 | int    (*rf)();
1298   }
1299  
1300  
1301 < bwait(ncoms)                            /* wait for batch job(s) to finish */
1302 < int     ncoms;
1301 > static void
1302 > bwait(int ncoms)                                /* wait for batch job(s) to finish */
1303   {
1304          int     status;
1305  
# Line 1250 | Line 1313 | int    ncoms;
1313   }
1314  
1315  
1316 < int
1317 < pruncom(com, ppins, maxcopies)  /* run a command in parallel over network */
1318 < char    *com, *ppins;
1319 < int     maxcopies;
1316 > static int
1317 > pruncom(        /* run a command in parallel over network */
1318 > char    *com,
1319 > char    *ppins,
1320 > int     maxcopies
1321 > )
1322   {
1323          int     retstatus = 0;
1324          int     hostcopies;
# Line 1275 | Line 1340 | int    maxcopies;
1340                          strcpy(com1=buf, com);  /* build -PP command */
1341                          sprintf(com1+(ppins-com), " -PP %s/%s.persist",
1342                                          vval(DIRECTORY), phostname(ps));
1343 +                        unlink(com1+(ppins-com)+5);
1344                          strcat(com1, ppins);
1345                  } else
1346                          com1 = com;
# Line 1319 | Line 1385 | int    maxcopies;
1385   }
1386  
1387  
1388 < runcom(cs)                      /* run a command locally and wait for it */
1389 < char    *cs;
1388 > static int
1389 > runcom(char *cs)                        /* run a command locally and wait for it */
1390   {
1391          if (!silent)            /* echo it */
1392                  printf("\t%s\n", cs);
# Line 1331 | Line 1397 | char   *cs;
1397   }
1398  
1399  
1400 < rmfile(fn)                      /* remove a file */
1401 < char    *fn;
1400 > static int
1401 > rmfile(char *fn)                        /* remove a file */
1402   {
1403          if (!silent)
1404 < #ifdef MSDOS
1404 > #ifdef _WIN32
1405                  printf("\tdel %s\n", fn);
1406   #else
1407                  printf("\trm -f %s\n", fn);
# Line 1346 | Line 1412 | char   *fn;
1412   }
1413  
1414  
1415 < badvalue(vc)                    /* report bad variable value and exit */
1416 < int     vc;
1415 > static void
1416 > badvalue(int vc)                        /* report bad variable value and exit */
1417   {
1418          fprintf(stderr, "%s: bad value for variable '%s'\n",
1419                          progname, vnam(vc));
# Line 1355 | Line 1421 | int    vc;
1421   }
1422  
1423  
1424 < char *
1425 < dirfile(df, path)               /* separate path into directory and file */
1426 < char    *df;
1427 < register char   *path;
1424 > static char *
1425 > dirfile(                /* separate path into directory and file */
1426 > char    *df,
1427 > register char   *path
1428 > )
1429   {
1430          register int    i;
1431          int     psep;
# Line 1366 | Line 1433 | register char  *path;
1433          for (i = 0, psep = -1; path[i]; i++)
1434                  if (path[i] == '/')
1435                          psep = i;
1436 <        if (df != NULL)
1436 >        if (df != NULL) {
1437                  if (psep == 0) {
1438                          df[0] = '/';
1439                          df[1] = '\0';
# Line 1375 | Line 1442 | register char  *path;
1442                          df[psep] = '\0';
1443                  } else
1444                          df[0] = '\0';
1445 +        }
1446          return(path+psep+1);
1447 + }
1448 +
1449 +
1450 + static int
1451 + getblur(double *bf)             /* get # blur samples (and fraction) */
1452 + {
1453 +        double  blurf;
1454 +        int     nblur;
1455 +        char    *s;
1456 +
1457 +        if (!vdef(MBLUR)) {
1458 +                if (bf != NULL)
1459 +                        *bf = 0.0;
1460 +                return(0);
1461 +        }
1462 +        blurf = atof(vval(MBLUR));
1463 +        if (blurf < 0.0)
1464 +                blurf = 0.0;
1465 +        if (bf != NULL)
1466 +                *bf = blurf;
1467 +        if (blurf <= FTINY)
1468 +                return(0);
1469 +        s = sskip(vval(MBLUR));
1470 +        if (!*s)
1471 +                return(DEF_NBLUR);
1472 +        nblur = atoi(s);
1473 +        if (nblur <= 0)
1474 +                return(1);
1475 +        return(nblur);
1476   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines