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.5 by greg, Tue Jan 23 16:14:28 1996 UTC vs.
Revision 2.30 by greg, Mon Feb 24 16:44:40 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1995 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 + /* ====================================================================
17 + * The Radiance Software License, Version 1.0
18 + *
19 + * Copyright (c) 1990 - 2002 The Regents of the University of California,
20 + * through Lawrence Berkeley National Laboratory.   All rights reserved.
21 + *
22 + * Redistribution and use in source and binary forms, with or without
23 + * modification, are permitted provided that the following conditions
24 + * are met:
25 + *
26 + * 1. Redistributions of source code must retain the above copyright
27 + *         notice, this list of conditions and the following disclaimer.
28 + *
29 + * 2. Redistributions in binary form must reproduce the above copyright
30 + *       notice, this list of conditions and the following disclaimer in
31 + *       the documentation and/or other materials provided with the
32 + *       distribution.
33 + *
34 + * 3. The end-user documentation included with the redistribution,
35 + *           if any, must include the following acknowledgment:
36 + *             "This product includes Radiance software
37 + *                 (http://radsite.lbl.gov/)
38 + *                 developed by the Lawrence Berkeley National Laboratory
39 + *               (http://www.lbl.gov/)."
40 + *       Alternately, this acknowledgment may appear in the software itself,
41 + *       if and wherever such third-party acknowledgments normally appear.
42 + *
43 + * 4. The names "Radiance," "Lawrence Berkeley National Laboratory"
44 + *       and "The Regents of the University of California" must
45 + *       not be used to endorse or promote products derived from this
46 + *       software without prior written permission. For written
47 + *       permission, please contact [email protected].
48 + *
49 + * 5. Products derived from this software may not be called "Radiance",
50 + *       nor may "Radiance" appear in their name, without prior written
51 + *       permission of Lawrence Berkeley National Laboratory.
52 + *
53 + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
54 + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
55 + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
56 + * DISCLAIMED.   IN NO EVENT SHALL Lawrence Berkeley National Laboratory OR
57 + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
58 + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
59 + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
60 + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
61 + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
62 + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
63 + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
64 + * SUCH DAMAGE.
65 + * ====================================================================
66 + *
67 + * This software consists of voluntary contributions made by many
68 + * individuals on behalf of Lawrence Berkeley National Laboratory.   For more
69 + * information on Lawrence Berkeley National Laboratory, please see
70 + * <http://www.lbl.gov/>.
71 + */
72 +
73   #include "standard.h"
74   #include <ctype.h>
13 #include <sys/types.h>
75   #include <sys/stat.h>
76   #include "view.h"
77   #include "vars.h"
78   #include "netproc.h"
79 <                                /* input variables */
80 < #define HOST            0               /* rendering host machine */
81 < #define RENDER          1               /* rendering options */
82 < #define PFILT           2               /* pfilt options */
83 < #define PINTERP         3               /* pinterp options */
84 < #define OCTREE          4               /* octree file name */
85 < #define DIRECTORY       5               /* working (sub)directory */
86 < #define BASENAME        6               /* output image base name */
87 < #define VIEWFILE        7               /* animation frame views */
88 < #define START           8               /* starting frame number */
89 < #define END             9               /* ending frame number */
90 < #define RIF             10              /* rad input file */
91 < #define NEXTANIM        11              /* next animation file */
92 < #define ANIMATE         12              /* animation command */
93 < #define TRANSFER        13              /* frame transfer command */
94 < #define ARCHIVE         14              /* archiving command */
95 < #define INTERP          15              /* # frames to interpolate */
96 < #define OVERSAMP        16              /* # times to oversample image */
97 < #define MBLUR           17              /* samples for motion blur */
98 < #define RTRACE          18              /* use rtrace with pinterp? */
99 < #define DISKSPACE       19              /* how much disk space to use */
100 < #define RESOLUTION      20              /* desired final resolution */
101 < #define EXPOSURE        21              /* how to compute exposure */
79 >                                /* default blur samples */
80 > #ifndef DEF_NBLUR
81 > #define DEF_NBLUR       5
82 > #endif
83 >                                /* default remote shell */
84 > #ifdef _AUX_SOURCE
85 > #define REMSH           "remsh"
86 > #else
87 > #define REMSH           "rsh"
88 > #endif
89 >                                /* input variables (alphabetical by name) */
90 > #define ANIMATE         0               /* animation command */
91 > #define ARCHIVE         1               /* archiving command */
92 > #define BASENAME        2               /* output image base name */
93 > #define DIRECTORY       3               /* working (sub)directory */
94 > #define DISKSPACE       4               /* how much disk space to use */
95 > #define END             5               /* ending frame number */
96 > #define EXPOSURE        6               /* how to compute exposure */
97 > #define HOST            7               /* rendering host machine */
98 > #define INTERP          8               /* # frames to interpolate */
99 > #define MBLUR           9               /* motion blur parameters */
100 > #define NEXTANIM        10              /* next animation file */
101 > #define OCTREE          11              /* octree file name */
102 > #define OVERSAMP        12              /* # times to oversample image */
103 > #define PFILT           13              /* pfilt options */
104 > #define PINTERP         14              /* pinterp options */
105 > #define RENDER          15              /* rendering options */
106 > #define RESOLUTION      16              /* desired final resolution */
107 > #define RIF             17              /* rad input file */
108 > #define RSH             18              /* remote shell script or program */
109 > #define RTRACE          19              /* use rtrace with pinterp? */
110 > #define START           20              /* starting frame number */
111 > #define TRANSFER        21              /* frame transfer command */
112 > #define VIEWFILE        22              /* animation frame views */
113  
114 < int     NVARS = 22;             /* total number of variables */
114 > int     NVARS = 23;             /* total number of variables */
115  
116   VARIABLE        vv[] = {                /* variable-value pairs */
45        {"host",        4,      0,      NULL,   NULL},
46        {"render",      3,      0,      NULL,   catvalues},
47        {"pfilt",       2,      0,      NULL,   catvalues},
48        {"pinterp",     2,      0,      NULL,   catvalues},
49        {"OCTREE",      3,      0,      NULL,   onevalue},
50        {"DIRECTORY",   3,      0,      NULL,   onevalue},
51        {"BASENAME",    3,      0,      NULL,   onevalue},
52        {"VIEWFILE",    2,      0,      NULL,   onevalue},
53        {"START",       2,      0,      NULL,   intvalue},
54        {"END",         2,      0,      NULL,   intvalue},
55        {"RIF",         3,      0,      NULL,   onevalue},
56        {"NEXTANIM",    3,      0,      NULL,   onevalue},
117          {"ANIMATE",     2,      0,      NULL,   onevalue},
58        {"TRANSFER",    2,      0,      NULL,   onevalue},
118          {"ARCHIVE",     2,      0,      NULL,   onevalue},
119 +        {"BASENAME",    3,      0,      NULL,   onevalue},
120 +        {"DIRECTORY",   3,      0,      NULL,   onevalue},
121 +        {"DISKSPACE",   3,      0,      NULL,   fltvalue},
122 +        {"END",         2,      0,      NULL,   intvalue},
123 +        {"EXPOSURE",    3,      0,      NULL,   onevalue},
124 +        {"host",        4,      0,      NULL,   NULL},
125          {"INTERPOLATE", 3,      0,      NULL,   intvalue},
61        {"OVERSAMPLE",  2,      0,      NULL,   fltvalue},
126          {"MBLUR",       2,      0,      NULL,   onevalue},
127 <        {"RTRACE",      2,      0,      NULL,   boolvalue},
128 <        {"DISKSPACE",   3,      0,      NULL,   fltvalue},
127 >        {"NEXTANIM",    3,      0,      NULL,   onevalue},
128 >        {"OCTREE",      3,      0,      NULL,   onevalue},
129 >        {"OVERSAMPLE",  2,      0,      NULL,   fltvalue},
130 >        {"pfilt",       2,      0,      NULL,   catvalues},
131 >        {"pinterp",     2,      0,      NULL,   catvalues},
132 >        {"render",      3,      0,      NULL,   catvalues},
133          {"RESOLUTION",  3,      0,      NULL,   onevalue},
134 <        {"EXPOSURE",    3,      0,      NULL,   onevalue},
134 >        {"RIF",         3,      0,      NULL,   onevalue},
135 >        {"RSH",         3,      0,      NULL,   onevalue},
136 >        {"RTRACE",      2,      0,      NULL,   boolvalue},
137 >        {"START",       2,      0,      NULL,   intvalue},
138 >        {"TRANSFER",    2,      0,      NULL,   onevalue},
139 >        {"VIEWFILE",    2,      0,      NULL,   onevalue},
140   };
141  
142   #define SFNAME  "STATUS"                /* status file name */
# Line 84 | Line 157 | int    nowarn = 0;             /* turn warnings off? */
157   int     silent = 0;             /* silent mode? */
158   int     noaction = 0;           /* take no action? */
159  
160 < char    rendopt[2048] = "";     /* rendering options */
160 > char    *remsh;                 /* remote shell program/script */
161 > char    rendopt[2048];          /* rendering options */
162   char    rresopt[32];            /* rendering resolution options */
163   char    fresopt[32];            /* filter resolution options */
164   int     pfiltalways;            /* always use pfilt? */
165  
166 + char    arcargs[10240];         /* files to archive */
167 + char    *arcfirst, *arcnext;    /* pointers to first and next argument */
168 +
169   struct pslot {
170          int     pid;                    /* process ID (0 if empty) */
171          int     fout;                   /* output frame number */
# Line 96 | Line 173 | struct pslot {
173   }       *pslot;                 /* process slots */
174   int     npslots;                /* number of process slots */
175  
99 int     lastpid;                /* ID of last completed background process */
100 PSERVER *lastpserver;           /* last process server used */
101
176   #define phostname(ps)   ((ps)->hostname[0] ? (ps)->hostname : astat.host)
177  
178   struct pslot    *findpslot();
179  
180 + PSERVER *lastpserver;           /* last process server with error */
181 +
182   VIEW    *getview();
183 < char    *getexp();
183 > char    *getexp(), *dirfile();
184 > int     getblur();
185  
186 + extern time_t   time();
187  
188 +
189   main(argc, argv)
190   int     argc;
191   char    *argv[];
# Line 137 | Line 216 | char   *argv[];
216          cfname = argv[i];
217                                                  /* load variables */
218          loadvars(cfname);
219 +                                                /* check variables */
220 +        checkvalues();
221                                                  /* did we get DIRECTORY? */
222          checkdir();
223                                                  /* check status */
# Line 163 | Line 244 | char   *argv[];
244                  argv[i] = vval(NEXTANIM);       /* just change input file */
245                  if (!silent)
246                          printargs(argc, argv, stdout);
247 <                execvp(progname, argv);         /* pass to next */
248 <                quit(1);                        /* shouldn't return */
247 >                if ((argv[0] = getpath(progname,getenv("PATH"),X_OK)) == NULL)
248 >                        fprintf(stderr, "%s: command not found\n", progname);
249 >                else
250 >                        execv(progname, argv);
251 >                quit(1);
252          }
253          quit(0);
254   userr:
# Line 175 | Line 259 | userr:
259  
260   getastat()                      /* check/set animation status */
261   {
262 <        char    buf[256];
262 >        char    sfname[256];
263          FILE    *fp;
264  
265 <        sprintf(buf, "%s/%s", vval(DIRECTORY), SFNAME);
266 <        if ((fp = fopen(buf, "r")) == NULL) {
265 >        sprintf(sfname, "%s/%s", vval(DIRECTORY), SFNAME);
266 >        if ((fp = fopen(sfname, "r")) == NULL) {
267                  if (errno != ENOENT) {
268 <                        perror(buf);
268 >                        perror(sfname);
269                          return(-1);
270                  }
271                  astat.rnext = astat.fnext = astat.tnext = 0;
# Line 201 | Line 285 | getastat()                     /* check/set animation status */
285                  goto fmterr;
286          fclose(fp);
287          if (astat.pid != 0) {                   /* thinks it's still running */
288 <                gethostname(buf, sizeof(buf));
205 <                if (strcmp(buf, astat.host)) {
288 >                if (strcmp(myhostname(), astat.host)) {
289                          fprintf(stderr,
290                          "%s: process %d may still be running on host %s\n",
291                                          progname, astat.pid, astat.host);
# Line 215 | Line 298 | getastat()                     /* check/set animation status */
298                  }
299                  /* assume it is dead */
300          }
301 <        if (strcmp(cfname, astat.cfname) && astat.tnext != 0) { /* other's */
301 >        if (strcmp(cfname, astat.cfname) && astat.pid != 0) {   /* other's */
302                  fprintf(stderr, "%s: unfinished job \"%s\"\n",
303                                  progname, astat.cfname);
304                  return(-1);
305          }
306 +                                                /* check control file mods. */
307 +        if (!nowarn && fdate(cfname) > fdate(sfname))
308 +                fprintf(stderr,
309 +                        "%s: warning - control file modified since last run\n",
310 +                                progname);
311   setours:                                        /* set our values */
312 <        gethostname(astat.host, sizeof(astat.host));
312 >        strcpy(astat.host, myhostname());
313          astat.pid = getpid();
314          strcpy(astat.cfname, cfname);
315          return(0);
316   fmterr:
317          fprintf(stderr, "%s: format error in status file \"%s\"\n",
318 <                        progname, buf);
318 >                        progname, sfname);
319          fclose(fp);
320          return(-1);
321   }
# Line 279 | Line 367 | checkdir()                     /* make sure we have our directory */
367  
368   setdefaults()                   /* set default values */
369   {
370 +        extern char     *atos();
371 +        int     decades;
372          char    buf[256];
373  
374          if (vdef(ANIMATE)) {
# Line 312 | Line 402 | setdefaults()                  /* set default values */
402                  quit(1);
403          }
404          if (!vdef(BASENAME)) {
405 <                sprintf(buf, "%s/frame%%03d", vval(DIRECTORY));
405 >                decades = (int)log10((double)vint(END)) + 1;
406 >                if (decades < 3) decades = 3;
407 >                sprintf(buf, "%s/frame%%0%dd", vval(DIRECTORY), decades);
408                  vval(BASENAME) = savqstr(buf);
409                  vdef(BASENAME)++;
410          }
# Line 344 | Line 436 | setdefaults()                  /* set default values */
436                  vval(DISKSPACE) = "100";
437                  vdef(DISKSPACE)++;
438          }
439 +        if (!vdef(RSH)) {
440 +                vval(RSH) = REMSH;
441 +                vdef(RSH)++;
442 +        }
443 +                                /* locate remote shell program */
444 +        atos(buf, sizeof(buf), vval(RSH));
445 +        if ((remsh = getpath(buf, getenv("PATH"), X_OK)) != NULL)
446 +                remsh = savqstr(remsh);
447 +        else
448 +                remsh = vval(RSH);      /* will generate error if used */
449 +
450                                  /* append rendering options */
451          if (vdef(RENDER))
452                  sprintf(rendopt+strlen(rendopt), " %s", vval(RENDER));
# Line 406 | Line 509 | sethosts()                     /* set up process servers */
509   }
510  
511  
512 < getradfile(rfname)              /* run rad and get needed variables */
513 < char    *rfname;
512 > getradfile(rfargs)              /* run rad and get needed variables */
513 > char    *rfargs;
514   {
515          static short    mvar[] = {OCTREE,PFILT,RESOLUTION,EXPOSURE,-1};
516          char    combuf[256];
517          register int    i;
518          register char   *cp;
519 +        char    *pippt;
520                                          /* create rad command */
521          sprintf(rendopt, " @%s/render.opt", vval(DIRECTORY));
522          sprintf(combuf,
523          "rad -v 0 -s -e -w %s OPTFILE=%s | egrep '^[ \t]*(NOMATCH",
524 <                        rfname, rendopt+2);
524 >                        rfargs, rendopt+2);
525          cp = combuf;
526 <        while (*cp) cp++;               /* match unset variables */
526 >        while (*cp) {
527 >                if (*cp == '|') pippt = cp;
528 >                cp++;
529 >        }                               /* match unset variables */
530          for (i = 0; mvar[i] >= 0; i++)
531                  if (!vdef(mvar[i])) {
532                          *cp++ = '|';
533                          strcpy(cp, vnam(mvar[i]));
534                          while (*cp) cp++;
535 +                        pippt = NULL;
536                  }
537 <        sprintf(cp, ")[ \t]*=' > %s/radset.var", vval(DIRECTORY));
538 <        cp += 11;                       /* point to file name */
539 <        if (system(combuf)) {
540 <                fprintf(stderr, "%s: bad rad input file \"%s\"\n",
541 <                                progname, rfname);
434 <                quit(1);
537 >        if (pippt != NULL)
538 >                strcpy(pippt, "> /dev/null");   /* nothing to match */
539 >        else {
540 >                sprintf(cp, ")[ \t]*=' > %s/radset.var", vval(DIRECTORY));
541 >                cp += 11;               /* point to file name */
542          }
543 <        loadvars(cp);                   /* load variables and remove file */
544 <        unlink(cp);
543 >        system(combuf);                 /* ignore exit code */
544 >        if (pippt == NULL) {            /* load variables and remove file */
545 >                loadvars(cp);
546 >                unlink(cp);
547 >        }
548   }
549  
550  
# Line 449 | Line 559 | animate()                      /* run animation */
559          i = sscanf(vval(RESOLUTION), "%d %d %f", &xres, &yres, &pa);
560          mult = vflt(OVERSAMP);
561          if (i == 3) {
562 <                sprintf(rresopt, "-x %d -y %d -pa %f", (int)(mult*xres),
562 >                sprintf(rresopt, "-x %d -y %d -pa %.3f", (int)(mult*xres),
563                                  (int)(mult*yres), pa);
564 <                sprintf(fresopt, "-x %d -y %d -pa %f", xres, yres, pa);
564 >                sprintf(fresopt, "-x %d -y %d -pa %.3f", xres, yres, pa);
565          } else if (i) {
566                  if (i == 1) yres = xres;
567                  sprintf(rresopt, "-x %d -y %d", (int)(mult*xres),
# Line 468 | Line 578 | animate()                      /* run animation */
578                                                  progname, vnam(INTERP));
579                          vval(INTERP) = "0";
580                  }
581 <                if (atoi(vval(MBLUR))) {        /* can't handle this yet */
581 >                if (strcmp(vval(MBLUR),"0")) {  /* can't handle this */
582                          if (!nowarn)
583                                  fprintf(stderr,
584                                          "%s: resetting %s=0 for animation\n",
# Line 478 | Line 588 | animate()                      /* run animation */
588          }
589                                          /* figure # frames per batch */
590          d1 = mult*xres*mult*yres*4;             /* space for orig. picture */
591 <        if ((i=vint(INTERP)) || atoi(vval(MBLUR)))
592 <                d1 += mult*xres*mult*yres*4;    /* space for z-buffer */
591 >        if ((i=vint(INTERP)) || getblur(NULL) > 1)
592 >                d1 += mult*xres*mult*yres*sizeof(float);        /* Z-buffer */
593          d2 = xres*yres*4;                       /* space for final picture */
594          frames_batch = (i+1)*(vflt(DISKSPACE)*1048576.-d1)/(d1+i*d2);
595          if (frames_batch < i+2) {
# Line 487 | Line 597 | animate()                      /* run animation */
597                                  progname);
598                  quit(1);
599          }
600 +                                        /* initialize archive argument list */
601 +        i = vdef(ARCHIVE) ? strlen(vval(ARCHIVE))+132 : 132;
602 +        arcnext = arcfirst = arcargs + i;
603                                          /* initialize status file */
604          if (astat.rnext == 0)
605                  astat.rnext = astat.fnext = astat.tnext = vint(START);
# Line 581 | Line 694 | filterframes()                         /* catch up with filtering */
694                  dofilt(i, vp, getexp(i), 0);            /* filter frame */
695          }
696          bwait(0);                       /* wait for filter processes */
697 <        archive(astat.fnext, i-1);      /* archive originals */
697 >        archive();                      /* archive originals */
698          astat.fnext = i;                /* update status */
699          putastat();
700   }
# Line 589 | Line 702 | filterframes()                         /* catch up with filtering */
702  
703   transferframes()                        /* catch up with picture transfers */
704   {
705 <        char    combuf[10240];
705 >        char    combuf[10240], *fbase;
706          register char   *cp;
707          register int    i;
708  
# Line 600 | Line 713 | transferframes()                       /* catch up with picture transfers
713                  putastat();             /* update status */
714                  return;
715          }
716 <        strcpy(combuf, vval(TRANSFER)); /* start transfer command */
717 <        cp = combuf + strlen(combuf);
716 >        strcpy(combuf, "cd ");          /* start transfer command */
717 >        fbase = dirfile(cp = combuf+3, vval(BASENAME));
718 >        if (*cp) {
719 >                while (*++cp) ;
720 >                *cp++ = ';'; *cp++ = ' ';
721 >        } else
722 >                cp = combuf;
723 >        strcpy(cp, vval(TRANSFER));
724 >        while (*cp) cp++;
725                                          /* make argument list */
726          for (i = astat.tnext; i < astat.fnext; i++) {
727                  *cp++ = ' ';
728 <                sprintf(cp, vval(BASENAME), i);
728 >                sprintf(cp, fbase, i);
729                  while (*cp) cp++;
730                  strcpy(cp, ".pic");
731                  cp += 4;
# Line 642 | Line 762 | walkwait(first, last, vfn)             /* walk-through frames */
762   int     first, last;
763   char    *vfn;
764   {
765 +        double  blurf;
766 +        int     nblur = getblur(&blurf);
767          char    combuf[2048];
768 <        char    *inspoint;
768 >        register char   *inspoint;
769          register int    i;
770  
771          if (!noaction && vint(INTERP))          /* create dummy frames */
# Line 654 | Line 776 | char   *vfn;
776                                  close(open(combuf, O_RDONLY|O_CREAT, 0666));
777                          }
778                                          /* create command */
779 <        sprintf(combuf, "rpict%s -w0", rendopt);
780 <        if (vint(INTERP) || atoi(vval(MBLUR)))
781 <                sprintf(combuf+strlen(combuf), " -z %s.zbf", vval(BASENAME));
782 <        sprintf(combuf+strlen(combuf), " -o %s.unf %s -S %d",
779 >        sprintf(combuf, "rpict%s%s -w0", rendopt,
780 >                        viewopt(getview(first>1 ? first-1 : 1)));
781 >        inspoint = combuf;
782 >        while (*inspoint) inspoint++;
783 >        if (nblur) {
784 >                sprintf(inspoint, " -pm %.3f", blurf/nblur);
785 >                while (*inspoint) inspoint++;
786 >        }
787 >        if (nblur > 1 || vint(INTERP)) {
788 >                sprintf(inspoint, " -z %s.zbf", vval(BASENAME));
789 >                while (*inspoint) inspoint++;
790 >        }
791 >        sprintf(inspoint, " -o %s.unf %s -S %d",
792                          vval(BASENAME), rresopt, first);
793 <        inspoint = combuf + strlen(combuf);
793 >        while (*inspoint) inspoint++;
794          sprintf(inspoint, " %s < %s", vval(OCTREE), vfn);
795                                          /* run in parallel */
796 <        if (pruncom(combuf, inspoint, (last-first+1)/(vint(INTERP)+1))) {
796 >        i = (last-first+1)/(vint(INTERP)+1);
797 >        if (i < 1) i = 1;
798 >        if (pruncom(combuf, inspoint, i)) {
799                  fprintf(stderr, "%s: error rendering frames %d through %d\n",
800                                  progname, first, last);
801                  quit(1);
# Line 683 | Line 816 | int    frame;
816   {
817          static int      *rfrm;          /* list of recovered frames */
818          static int      nrfrms = 0;
819 +        double  blurf;
820 +        int     nblur = getblur(&blurf);
821          char    combuf[2048];
822          char    fname[128];
823          register char   *cp;
# Line 698 | Line 833 | int    frame;
833                                  vval(ANIMATE), frame, rendopt);
834          else
835                  sprintf(combuf, "rpict%s -w0", rendopt);
836 <        cp = combuf + strlen(combuf);
837 <        if (vint(INTERP) || atoi(vval(MBLUR))) {
836 >        cp = combuf;
837 >        while (*cp) cp++;
838 >        if (nblur) {
839 >                sprintf(cp, " -pm %.3f", blurf/nblur);
840 >                while (*cp) cp++;
841 >        }
842 >        if (nblur > 1 || vint(INTERP)) {
843                  sprintf(cp, " -z %s.zbf", fname);
844                  while (*cp) cp++;
845          }
# Line 740 | Line 880 | int    frame;
880   }
881  
882  
883 < archive(first, last)                    /* archive and remove renderings */
744 < int     first, last;
883 > archive()                       /* archive and remove renderings */
884   {
885   #define RMCOML  (sizeof(rmcom)-1)
886          static char     rmcom[] = "rm -f";
887 <        int     offset = RMCOML;
888 <        char    combuf[10240];
889 <        struct stat     stb;
751 <        register char   *cp;
752 <        register int    i;
887 >        char    basedir[128];
888 >        int     dlen, alen;
889 >        register int    j;
890  
891 <        if (noaction)
892 <                return;
893 <        if (vdef(ARCHIVE) && strlen(vval(ARCHIVE)) > offset)
894 <                offset = strlen(vval(ARCHIVE));
758 <        cp = combuf + offset;
759 <        *cp++ = ' ';                            /* make argument list */
760 <        for (i = first; i <= last; i++) {
761 <                sprintf(cp, vval(BASENAME), i);
762 <                strcat(cp, ".unf");
763 <                if (stat(cp, &stb) == 0 && stb.st_size > 0) {   /* non-zero? */
764 <                        while (*cp) cp++;
765 <                        *cp++ = ' ';
766 <                        sprintf(cp, vval(BASENAME), i);
767 <                        strcat(cp, ".zbf");
768 <                        if (access(cp, F_OK) == 0) {            /* exists? */
769 <                                while (*cp) cp++;
770 <                                *cp++ = ' ';
771 <                        }
772 <                }
773 <        }
774 <        *--cp = '\0';
775 <        if (cp <= combuf + offset)              /* no files? */
776 <                return;
891 >        if (arcnext == arcfirst)
892 >                return;                         /* nothing to do */
893 >        dirfile(basedir, vval(BASENAME));
894 >        dlen = strlen(basedir);
895          if (vdef(ARCHIVE)) {                    /* run archive command */
896 <                i = strlen(vval(ARCHIVE));
897 <                strncpy(combuf+offset-i, vval(ARCHIVE), i);
898 <                if (runcom(combuf+offset-i)) {
899 <                        fprintf(stderr,
900 <                "%s: error running archive command on frames %d through %d\n",
901 <                                        progname, first, last);
896 >                alen = strlen(vval(ARCHIVE));
897 >                if (dlen) {
898 >                        j = alen + dlen + 5;
899 >                        strncpy(arcfirst-j, "cd ", 3);
900 >                        strncpy(arcfirst-j+3, basedir, dlen);
901 >                        (arcfirst-j)[dlen+3] = ';'; (arcfirst-j)[dlen+4] = ' ';
902 >                } else
903 >                        j = alen;
904 >                strncpy(arcfirst-alen, vval(ARCHIVE), alen);
905 >                if (runcom(arcfirst-j)) {
906 >                        fprintf(stderr, "%s: error running archive command\n",
907 >                                        progname);
908                          quit(1);
909                  }
910          }
911 +        if (dlen) {
912 +                j = RMCOML + dlen + 5;
913 +                strncpy(arcfirst-j, "cd ", 3);
914 +                strncpy(arcfirst-j+3, basedir, dlen);
915 +                (arcfirst-j)[dlen+3] = ';'; (arcfirst-j)[dlen+4] = ' ';
916 +        } else
917 +                j = RMCOML;
918                                                  /* run remove command */
919 <        strncpy(combuf+offset-RMCOML, rmcom, RMCOML);
920 <        runcom(combuf+offset-RMCOML);
919 >        strncpy(arcfirst-RMCOML, rmcom, RMCOML);
920 >        runcom(arcfirst-j);
921 >        arcnext = arcfirst;                     /* reset argument list */
922   #undef RMCOML
923   }
924  
# Line 799 | Line 931 | char   *ep;
931   int     rvr;
932   {
933          extern int      frecover();
934 <        char    fnbefore[128], fnafter[128];
935 <        char    combuf[1024], fname[128];
936 <        int     usepinterp, usepfilt;
934 >        static int      iter = 0;
935 >        double  blurf;
936 >        int     nblur = getblur(&blurf);
937 >        char    fnbefore[128], fnafter[128], *fbase;
938 >        char    combuf[1024], fname0[128], fname1[128];
939 >        int     usepinterp, usepfilt, nora_rgbe;
940          int     frseq[2];
941                                                  /* check what is needed */
942 <        usepinterp = atoi(vval(MBLUR));
942 >        usepinterp = (nblur > 1);
943          usepfilt = pfiltalways | ep==NULL;
944 +        if (ep != NULL && !strcmp(ep, "1"))
945 +                ep = "+0";
946 +        nora_rgbe = strcmp(vval(OVERSAMP),"1") || ep==NULL ||
947 +                        *ep != '+' || *ep != '-' || !isint(ep);
948                                                  /* compute rendered views */
949          frseq[0] = frame - ((frame-1) % (vint(INTERP)+1));
950          frseq[1] = frseq[0] + vint(INTERP) + 1;
951 +        fbase = dirfile(NULL, vval(BASENAME));
952          if (frseq[1] > vint(END))
953                  frseq[1] = vint(END);
954          if (frseq[1] == frame) {                        /* pfilt only */
955                  frseq[0] = frseq[1];
956                  usepinterp = 0;                 /* update what's needed */
957 <                usepfilt |= vflt(OVERSAMP)>1.01 || strcmp(ep,"1");
958 <        } else if (frseq[0] == frame) {         /* no interpolation */
959 <                                                /* update what's needed */
960 <                if (!usepinterp)
961 <                        usepfilt |= vflt(OVERSAMP)>1.01 || strcmp(ep,"1");
957 >                usepfilt |= nora_rgbe;
958 >        } else if (frseq[0] == frame) {         /* no interpolation needed */
959 >                if (!rvr && frame > 1+vint(INTERP)) {   /* archive previous */
960 >                        *arcnext++ = ' ';
961 >                        sprintf(arcnext, fbase, frame-vint(INTERP)-1);
962 >                        while (*arcnext) arcnext++;
963 >                        strcpy(arcnext, ".unf");
964 >                        arcnext += 4;
965 >                        if (usepinterp || vint(INTERP)) {       /* and Z-buf */
966 >                                *arcnext++ = ' ';
967 >                                sprintf(arcnext, fbase, frame-vint(INTERP)-1);
968 >                                while (*arcnext) arcnext++;
969 >                                strcpy(arcnext, ".zbf");
970 >                                arcnext += 4;
971 >                        }
972 >                }
973 >                if (!usepinterp)                /* update what's needed */
974 >                        usepfilt |= nora_rgbe;
975          } else                                  /* interpolation needed */
976                  usepinterp++;
977          if (frseq[1] >= astat.rnext)            /* next batch unavailable */
# Line 831 | Line 984 | int    rvr;
984          if (usepinterp) {                       /* using pinterp */
985                  if (rvr == 2 && recover(frseq[1]))      /* recover after? */
986                          return(1);
987 <                if (atoi(vval(MBLUR))) {
988 <                        FILE    *fp;            /* motion blurring */
989 <                        sprintf(fname, "%s/vw0", vval(DIRECTORY));
990 <                        if (access(fname, F_OK) == 0)
991 <                                sleep(10);
992 <                        if ((fp = fopen(fname, "w")) == NULL) {
993 <                                perror(fname); quit(1);
994 <                        }
995 <                        fputs(VIEWSTR, fp);
996 <                        fprintview(vp, fp);
997 <                        putc('\n', fp); fclose(fp);
998 <                        if ((vp = getview(frame+1)) == NULL) {
999 <                                fprintf(stderr,
987 >                if (nblur > 1) {                /* with pmblur */
988 >                        sprintf(fname0, "%s/vw0%c", vval(DIRECTORY),
989 >                                        'a'+(iter%26));
990 >                        sprintf(fname1, "%s/vw1%c", vval(DIRECTORY),
991 >                                        'a'+(iter%26));
992 >                        if (!noaction) {
993 >                                FILE    *fp;            /* motion blurring */
994 >                                if ((fp = fopen(fname0, "w")) == NULL) {
995 >                                        perror(fname0); quit(1);
996 >                                }
997 >                                fputs(VIEWSTR, fp);
998 >                                fprintview(vp, fp);
999 >                                putc('\n', fp); fclose(fp);
1000 >                                if ((vp = getview(frame+1)) == NULL) {
1001 >                                        fprintf(stderr,
1002                          "%s: unexpected error reading view for frame %d\n",
1003 <                                                progname, frame+1);
1004 <                                quit(1);
1003 >                                                        progname, frame+1);
1004 >                                        quit(1);
1005 >                                }
1006 >                                if ((fp = fopen(fname1, "w")) == NULL) {
1007 >                                        perror(fname1); quit(1);
1008 >                                }
1009 >                                fputs(VIEWSTR, fp);
1010 >                                fprintview(vp, fp);
1011 >                                putc('\n', fp); fclose(fp);
1012                          }
851                        sprintf(fname, "%s/vw1", vval(DIRECTORY));
852                        if ((fp = fopen(fname, "w")) == NULL) {
853                                perror(fname); quit(1);
854                        }
855                        fputs(VIEWSTR, fp);
856                        fprintview(vp, fp);
857                        putc('\n', fp); fclose(fp);
1013                          sprintf(combuf,
1014 <        "(pmblur %s %d %s/vw0 %s/vw1; rm -f %s/vw0 %s/vw1) | pinterp -B",
1015 <                        *sskip(vval(MBLUR)) ? sskip2(vval(MBLUR),1) : "1",
1016 <                                        atoi(vval(MBLUR)), vval(DIRECTORY),
1017 <                                        vval(DIRECTORY), vval(DIRECTORY),
863 <                                        vval(DIRECTORY), vval(DIRECTORY));
1014 >                        "(pmblur %.3f %d %s %s; rm -f %s %s) | pinterp -B -a",
1015 >                                        blurf, nblur,
1016 >                                        fname0, fname1, fname0, fname1);
1017 >                        iter++;
1018                  } else                          /* no blurring */
1019                          strcpy(combuf, "pinterp");
1020                  strcat(combuf, viewopt(vp));
1021                  if (vbool(RTRACE))
1022                          sprintf(combuf+strlen(combuf), " -ff -fr '%s -w0 %s'",
1023 <                                        rendopt, vval(OCTREE));
1023 >                                        rendopt+1, vval(OCTREE));
1024                  if (vdef(PINTERP))
1025                          sprintf(combuf+strlen(combuf), " %s", vval(PINTERP));
1026                  if (usepfilt)
1027                          sprintf(combuf+strlen(combuf), " %s", rresopt);
1028                  else
1029 <                        sprintf(combuf+strlen(combuf), " %s -e %s",
1029 >                        sprintf(combuf+strlen(combuf), "-a %s -e %s",
1030                                          fresopt, ep);
1031                  sprintf(combuf+strlen(combuf), " %s.unf %s.zbf",
1032                                  fnbefore, fnbefore);
# Line 907 | Line 1061 | int    rvr;
1061          } else {                                /* else just check it */
1062                  if (rvr == 2)
1063                          return(1);
1064 <                sprintf(combuf, "ra_rgbe -r %s.unf", fnbefore);
1064 >                sprintf(combuf, "ra_rgbe -e %s -r %s.unf", ep, fnbefore);
1065          }
1066                                                  /* output file name */
1067 <        sprintf(fname, vval(BASENAME), frame);
1068 <        sprintf(combuf+strlen(combuf), " > %s.pic", fname);
1067 >        sprintf(fname0, vval(BASENAME), frame);
1068 >        sprintf(combuf+strlen(combuf), " > %s.pic", fname0);
1069          if (rvr)                                /* in recovery */
1070                  return(runcom(combuf));
1071          bruncom(combuf, frame, frecover);       /* else run in background */
# Line 937 | Line 1091 | int    n;
1091                  }
1092                  return(NULL);
1093          }
1094 <        if (viewfp == NULL) {           /* open file */
1094 >        if (viewfp == NULL) {                   /* open file */
1095                  if ((viewfp = fopen(vval(VIEWFILE), "r")) == NULL) {
1096                          perror(vval(VIEWFILE));
1097                          quit(1);
1098                  }
1099 <        } else if (n < viewnum) {       /* rewind file */
1099 >        } else if (n > 0 && n < viewnum) {      /* rewind file */
1100 >                if (viewnum == 1 && feof(viewfp))
1101 >                        return(&curview);               /* just one view */
1102                  if (fseek(viewfp, 0L, 0) == EOF) {
1103                          perror(vval(VIEWFILE));
1104                          quit(1);
# Line 950 | Line 1106 | int    n;
1106                  copystruct(&curview, &stdview);
1107                  viewnum = 0;
1108          }
1109 +        if (n < 0) {                            /* get next view */
1110 +                register int    c = getc(viewfp);
1111 +                if (c == EOF)
1112 +                        return((VIEW *)NULL);           /* that's it */
1113 +                ungetc(c, viewfp);
1114 +                n = viewnum + 1;
1115 +        }
1116          while (n > viewnum) {           /* scan to desired view */
1117                  if (fgets(linebuf, sizeof(linebuf), viewfp) == NULL)
1118 <                        return(NULL);
1118 >                        return(viewnum==1 ? &curview : (VIEW *)NULL);
1119                  if (isview(linebuf) && sscanview(&curview, linebuf) > 0)
1120                          viewnum++;
1121          }
# Line 963 | Line 1126 | int    n;
1126   int
1127   countviews()                    /* count views in view file */
1128   {
1129 <        register int    n = 0;
1129 >        int     n;
1130  
1131 <        while (getview(n+1) != NULL)
1131 >        if (getview(n=1) == NULL)
1132 >                return(0);
1133 >        while (getview(-1) != NULL)
1134                  n++;
1135          return(n);
1136   }
# Line 985 | Line 1150 | int    n;
1150          if (n == 0) {                           /* signal to close file */
1151                  if (expfp != NULL) {
1152                          fclose(expfp);
1153 +                        free((void *)exppos);
1154                          expfp = NULL;
1155                  }
1156                  return(NULL);
1157 <        }
1157 >        } else if (n > vint(END))               /* request past end (error?) */
1158 >                return(NULL);
1159          if (!vdef(EXPOSURE))                    /* no setting (auto) */
1160                  return(NULL);
1161          if (isflt(vval(EXPOSURE)))              /* always the same */
# Line 1026 | Line 1193 | int    n;
1193                  }
1194                  curfrm++;
1195                  cp = fskip(expval);                     /* check format */
1196 <                if (cp == NULL || *cp != '\n') {
1196 >                if (cp != NULL)
1197 >                        while (isspace(*cp))
1198 >                                *cp++ = '\0';
1199 >                if (cp == NULL || *cp) {
1200                          fprintf(stderr,
1201                                  "%s: exposure format error on line %d\n",
1202                                          vval(EXPOSURE), curfrm);
1203                          quit(1);
1204                  }
1035                *cp = '\0';
1205          }
1206          return(expval);                         /* return value */
1207   }
# Line 1062 | Line 1231 | int    pn;
1231   int     status;
1232   {
1233          register PROC   *pp;
1234 +        register struct pslot   *psl;
1235  
1236          pp = ps->proc + pn;
1237          if (pp->elen) {                 /* pass errors */
# Line 1073 | Line 1243 | int    status;
1243                  if (ps->hostname[0])
1244                          status = 1;     /* because rsh doesn't return status */
1245          }
1246 +        lastpserver = NULL;
1247 +        psl = findpslot(pp->pid);       /* check for bruncom() slot */
1248 +        if (psl->pid) {
1249 +                if (status) {
1250 +                        if (psl->rcvf != NULL)  /* attempt recovery */
1251 +                                status = (*psl->rcvf)(psl->fout);
1252 +                        if (status) {
1253 +                                fprintf(stderr,
1254 +                                        "%s: error rendering frame %d\n",
1255 +                                                progname, psl->fout);
1256 +                                quit(1);
1257 +                        }
1258 +                        lastpserver = ps;
1259 +                }
1260 +                psl->pid = 0;                   /* free process slot */
1261 +        } else if (status)
1262 +                lastpserver = ps;
1263          freestr(pp->com);               /* free command string */
1077        lastpid = pp->pid;              /* record PID for bwait() */
1078        lastpserver = ps;               /* record server for serverdown() */
1264          return(status);
1265   }
1266  
# Line 1083 | Line 1268 | int    status;
1268   int
1269   serverdown()                    /* check status of last process server */
1270   {
1271 +        if (lastpserver == NULL || !lastpserver->hostname[0])
1272 +                return(0);
1273          if (pserverOK(lastpserver))     /* server still up? */
1274                  return(0);
1275          delpserver(lastpserver);        /* else delete it */
# Line 1109 | Line 1296 | int    (*rf)();
1296                          printf("\t%s\n", com);  /* echo command */
1297                  return(0);
1298          }
1299 <                                        /* else start it when we can */
1300 <        while ((pid = startjob(NULL, savestr(com), donecom)) == -1)
1299 >        com = savestr(com);             /* else start it when we can */
1300 >        while ((pid = startjob(NULL, com, donecom)) == -1)
1301                  bwait(1);
1302          if (!silent) {                          /* echo command */
1303                  PSERVER *ps;
# Line 1132 | Line 1319 | bwait(ncoms)                           /* wait for batch job(s) to finish */
1319   int     ncoms;
1320   {
1321          int     status;
1135        register struct pslot   *psl;
1322  
1323          if (noaction)
1324                  return;
1325          while ((status = wait4job(NULL, -1)) != -1) {
1326 <                psl = findpslot(lastpid);
1327 <                if (status) {           /* attempt recovery */
1328 <                        serverdown();   /* check server */
1143 <                        if (psl->rcvf == NULL || (*psl->rcvf)(psl->fout)) {
1144 <                                fprintf(stderr,
1145 <                                        "%s: error rendering frame %d\n",
1146 <                                                progname, psl->fout);
1147 <                                quit(1);
1148 <                        }
1149 <                }
1150 <                psl->pid = 0;           /* free process slot */
1151 <                if (!--ncoms)
1152 <                        return;         /* done enough */
1326 >                serverdown();           /* update server status */
1327 >                if (--ncoms == 0)
1328 >                        break;          /* done enough */
1329          }
1330   }
1331  
# Line 1161 | Line 1337 | int    maxcopies;
1337   {
1338          int     retstatus = 0;
1339          int     hostcopies;
1340 <        char    com1buf[10240], *com1, *endcom1;
1340 >        char    buf[10240], *com1, *s;
1341          int     status;
1342 +        int     pfd;
1343 +        register int    n;
1344          register PSERVER        *ps;
1345  
1346          if (!silent)
1347 <                printf("\t%s &\n", com);        /* echo command */
1347 >                printf("\t%s\n", com);  /* echo command */
1348          if (noaction)
1349                  return(0);
1350          fflush(stdout);
# Line 1174 | Line 1352 | int    maxcopies;
1352          for (ps = pslist; ps != NULL; ps = ps->next) {
1353                  hostcopies = 0;
1354                  if (maxcopies > 1 && ps->nprocs > 1 && ppins != NULL) {
1355 <                        strcpy(com1=com1buf, com);      /* build -PP command */
1355 >                        strcpy(com1=buf, com);  /* build -PP command */
1356                          sprintf(com1+(ppins-com), " -PP %s/%s.persist",
1357                                          vval(DIRECTORY), phostname(ps));
1358                          strcat(com1, ppins);
1359 <                        endcom1 = com1 + strlen(com1);
1182 <                        sprintf(endcom1, "; kill `sed -n '1s/^[^ ]* //p' %s/%s.persist`",
1183 <                                        vval(DIRECTORY), phostname(ps));
1184 <                } else {
1359 >                } else
1360                          com1 = com;
1361 <                        endcom1 = NULL;
1361 >                while (maxcopies > 0) {
1362 >                        s = savestr(com1);
1363 >                        if (startjob(ps, s, donecom) != -1) {
1364 >                                sleep(20);
1365 >                                hostcopies++;
1366 >                                maxcopies--;
1367 >                        } else {
1368 >                                freestr(s);
1369 >                                break;
1370 >                        }
1371                  }
1188                while (maxcopies > 0 &&
1189                                startjob(ps, savestr(com1), donecom) != -1) {
1190                        sleep(10);
1191                        hostcopies++;
1192                        maxcopies--;
1193                        if (endcom1 != NULL)
1194                                *endcom1 = '\0';
1195                }
1372                  if (!silent && hostcopies) {
1373                          if (hostcopies > 1)
1374                                  printf("\t%d duplicate processes", hostcopies);
# Line 1204 | Line 1380 | int    maxcopies;
1380          }
1381                                          /* wait for jobs to finish */
1382          while ((status = wait4job(NULL, -1)) != -1)
1383 <                if (status)
1384 <                        retstatus += !serverdown();     /* check server */
1383 >                retstatus += status && !serverdown();
1384 >                                        /* terminate parallel rpict's */
1385 >        for (ps = pslist; ps != NULL; ps = ps->next) {
1386 >                sprintf(buf, "%s/%s.persist", vval(DIRECTORY), phostname(ps));
1387 >                if ((pfd = open(buf, O_RDONLY)) >= 0) {
1388 >                        n = read(pfd, buf, sizeof(buf)-1);      /* get PID */
1389 >                        buf[n] = '\0';
1390 >                        close(pfd);
1391 >                        for (n = 0; buf[n] && !isspace(buf[n]); n++)
1392 >                                ;
1393 >                                                                /* terminate */
1394 >                        sprintf(buf, "kill -ALRM %d", atoi(buf+n));
1395 >                        wait4job(ps, startjob(ps, buf, NULL));
1396 >                }
1397 >        }
1398          return(retstatus);
1399   }
1400  
# Line 1243 | Line 1432 | int    vc;
1432          fprintf(stderr, "%s: bad value for variable '%s'\n",
1433                          progname, vnam(vc));
1434          quit(1);
1435 + }
1436 +
1437 +
1438 + char *
1439 + dirfile(df, path)               /* separate path into directory and file */
1440 + char    *df;
1441 + register char   *path;
1442 + {
1443 +        register int    i;
1444 +        int     psep;
1445 +
1446 +        for (i = 0, psep = -1; path[i]; i++)
1447 +                if (path[i] == '/')
1448 +                        psep = i;
1449 +        if (df != NULL)
1450 +                if (psep == 0) {
1451 +                        df[0] = '/';
1452 +                        df[1] = '\0';
1453 +                } else if (psep > 0) {
1454 +                        strncpy(df, path, psep);
1455 +                        df[psep] = '\0';
1456 +                } else
1457 +                        df[0] = '\0';
1458 +        return(path+psep+1);
1459 + }
1460 +
1461 +
1462 + int
1463 + getblur(double *bf)             /* get # blur samples (and fraction) */
1464 + {
1465 +        double  blurf;
1466 +        int     nblur;
1467 +        char    *s;
1468 +
1469 +        if (!vdef(MBLUR)) {
1470 +                if (bf != NULL)
1471 +                        *bf = 0.0;
1472 +                return(0);
1473 +        }
1474 +        blurf = atof(vval(MBLUR));
1475 +        if (blurf < 0.0)
1476 +                blurf = 0.0;
1477 +        if (bf != NULL)
1478 +                *bf = blurf;
1479 +        if (blurf <= FTINY)
1480 +                return(0);
1481 +        s = sskip(vval(MBLUR));
1482 +        if (!*s)
1483 +                return(DEF_NBLUR);
1484 +        nblur = atoi(s);
1485 +        if (nblur <= 0)
1486 +                return(1);
1487 +        return(nblur);
1488   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines