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.29 by greg, Sat Feb 22 02:07:30 2003 UTC vs.
Revision 2.42 by schorsch, Tue Oct 21 19:19:29 2003 UTC

# Line 1 | Line 1
1   #ifndef lint
2 < static const char       RCSid[] = "$Id$";
2 > static const char RCSid[] = "$Id$";
3   #endif
4   /*
5   * Radiance animation control program
# Line 13 | Line 13 | static const char      RCSid[] = "$Id$";
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 < */
16 > #include "copyright.h"
17  
73 #include "standard.h"
18   #include <ctype.h>
19   #include <sys/stat.h>
20 +
21 + #include "standard.h"
22 + #include "paths.h"
23   #include "view.h"
24   #include "vars.h"
25   #include "netproc.h"
# Line 81 | Line 28 | static const char      RCSid[] = "$Id$";
28   #define DEF_NBLUR       5
29   #endif
30                                  /* default remote shell */
84 #ifdef _AUX_SOURCE
85 #define REMSH           "remsh"
86 #else
31   #define REMSH           "rsh"
88 #endif
32                                  /* input variables (alphabetical by name) */
33   #define ANIMATE         0               /* animation command */
34   #define ARCHIVE         1               /* archiving command */
# Line 535 | Line 478 | char   *rfargs;
478                          pippt = NULL;
479                  }
480          if (pippt != NULL)
481 <                strcpy(pippt, "> /dev/null");   /* nothing to match */
481 >                strcpy(pippt, "> " NULL_DEVICE);        /* nothing to match */
482          else {
483                  sprintf(cp, ")[ \t]*=' > %s/radset.var", vval(DIRECTORY));
484                  cp += 11;               /* point to file name */
# Line 684 | Line 627 | filterframes()                         /* catch up with filtering */
627          if (astat.tnext < astat.fnext)  /* other work to do first */
628                  return;
629                                          /* filter each view */
630 <        for (i = astat.fnext; i < astat.rnext; i++) {
631 <                if ((vp = getview(i)) == NULL) {        /* get view i */
632 <                        fprintf(stderr,
690 <                        "%s: unexpected error reading view for frame %d\n",
691 <                                        progname, i);
692 <                        quit(1);
693 <                }
694 <                dofilt(i, vp, getexp(i), 0);            /* filter frame */
695 <        }
630 >        for (i = astat.fnext; i < astat.rnext; i++)
631 >                dofilt(i, 0);
632 >
633          bwait(0);                       /* wait for filter processes */
634          archive();                      /* archive originals */
635          astat.fnext = i;                /* update status */
# Line 853 | Line 790 | int    frame;
790                  return(1);
791                                          /* add frame to recovered list */
792          if (nrfrms)
793 <                rfrm = (int *)realloc((char *)rfrm, (nrfrms+1)*sizeof(int));
793 >                rfrm = (int *)realloc((void *)rfrm, (nrfrms+1)*sizeof(int));
794          else
795                  rfrm = (int *)malloc(sizeof(int));
796          if (rfrm == NULL) {
# Line 869 | Line 806 | int
806   frecover(frame)                         /* recover filtered frame */
807   int     frame;
808   {
809 <        VIEW    *vp;
873 <        char    *ex;
874 <
875 <        vp = getview(frame);
876 <        ex = getexp(frame);
877 <        if (dofilt(frame, vp, ex, 2) && dofilt(frame, vp, ex, 1))
809 >        if (dofilt(frame, 2) && dofilt(frame, 1))
810                  return(1);
811          return(0);
812   }
# Line 924 | Line 856 | archive()                      /* archive and remove renderings */
856  
857  
858   int
859 < dofilt(frame, vp, ep, rvr)                      /* filter frame */
859 > dofilt(frame, rvr)                              /* filter frame */
860   int     frame;
929 VIEW    *vp;
930 char    *ep;
861   int     rvr;
862   {
863          extern int      frecover();
864          static int      iter = 0;
865          double  blurf;
866          int     nblur = getblur(&blurf);
867 +        VIEW    *vp = getview(frame);
868 +        char    *ep = getexp(frame);
869          char    fnbefore[128], fnafter[128], *fbase;
870          char    combuf[1024], fname0[128], fname1[128];
871          int     usepinterp, usepfilt, nora_rgbe;
872          int     frseq[2];
873                                                  /* check what is needed */
874 +        if (vp == NULL) {
875 +                 fprintf(stderr,
876 +                        "%s: unexpected error reading view for frame %d\n",
877 +                                          progname, frame);
878 +                quit(1);
879 +        }
880 +        if (ep == NULL) {
881 +                 fprintf(stderr,
882 +                        "%s: unexpected error reading exposure for frame %d\n",
883 +                                          progname, frame);
884 +                quit(1);
885 +        }
886          usepinterp = (nblur > 1);
887 <        usepfilt = pfiltalways | ep==NULL;
887 >        usepfilt = pfiltalways | (ep==NULL);
888          if (ep != NULL && !strcmp(ep, "1"))
889                  ep = "+0";
890          nora_rgbe = strcmp(vval(OVERSAMP),"1") || ep==NULL ||
# Line 1011 | Line 955 | int    rvr;
955                                  putc('\n', fp); fclose(fp);
956                          }
957                          sprintf(combuf,
958 <                        "(pmblur %.3f %d %s %s; rm -f %s %s) | pinterp -B",
958 >                        "(pmblur %.3f %d %s %s; rm -f %s %s) | pinterp -B -a",
959                                          blurf, nblur,
960                                          fname0, fname1, fname0, fname1);
961                          iter++;
# Line 1026 | Line 970 | int    rvr;
970                  if (usepfilt)
971                          sprintf(combuf+strlen(combuf), " %s", rresopt);
972                  else
973 <                        sprintf(combuf+strlen(combuf), " %s -e %s",
973 >                        sprintf(combuf+strlen(combuf), " -a %s -e %s",
974                                          fresopt, ep);
975                  sprintf(combuf+strlen(combuf), " %s.unf %s.zbf",
976                                  fnbefore, fnbefore);
# Line 1087 | Line 1031 | int    n;
1031                          fclose(viewfp);
1032                          viewfp = NULL;
1033                          viewnum = 0;
1034 <                        copystruct(&curview, &stdview);
1034 >                        curview = stdview;
1035                  }
1036                  return(NULL);
1037          }
# Line 1103 | Line 1047 | int    n;
1047                          perror(vval(VIEWFILE));
1048                          quit(1);
1049                  }
1050 <                copystruct(&curview, &stdview);
1050 >                curview = stdview;
1051                  viewnum = 0;
1052          }
1053          if (n < 0) {                            /* get next view */
# Line 1355 | Line 1299 | int    maxcopies;
1299                          strcpy(com1=buf, com);  /* build -PP command */
1300                          sprintf(com1+(ppins-com), " -PP %s/%s.persist",
1301                                          vval(DIRECTORY), phostname(ps));
1302 +                        unlink(com1+(ppins-com)+5);
1303                          strcat(com1, ppins);
1304                  } else
1305                          com1 = com;
# Line 1415 | Line 1360 | rmfile(fn)                     /* remove a file */
1360   char    *fn;
1361   {
1362          if (!silent)
1363 < #ifdef MSDOS
1363 > #ifdef _WIN32
1364                  printf("\tdel %s\n", fn);
1365   #else
1366                  printf("\trm -f %s\n", fn);
# Line 1446 | Line 1391 | register char  *path;
1391          for (i = 0, psep = -1; path[i]; i++)
1392                  if (path[i] == '/')
1393                          psep = i;
1394 <        if (df != NULL)
1394 >        if (df != NULL) {
1395                  if (psep == 0) {
1396                          df[0] = '/';
1397                          df[1] = '\0';
# Line 1455 | Line 1400 | register char  *path;
1400                          df[psep] = '\0';
1401                  } else
1402                          df[0] = '\0';
1403 +        }
1404          return(path+psep+1);
1405   }
1406  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines