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

Comparing ray/src/util/dctimestep.c (file contents):
Revision 2.52 by greg, Sat Mar 22 01:27:22 2025 UTC vs.
Revision 2.55 by greg, Sat Jun 7 05:09:46 2025 UTC

# Line 14 | Line 14 | static const char RCSid[] = "$Id$";
14   #include "platform.h"
15   #include "resolu.h"
16  
17 char    *progname;                      /* global argv[0] */
18
17   /* Sum together a set of images and write result to fout */
18   static int
19   sum_images(const char *fspec, const CMATRIX *cv, FILE *fout)
20   {
21 +        static int      runcnt = 0;
22          int     myDT = DTfromHeader;
23          COLR    *scanline = NULL;
24          CMATRIX *pmat = NULL;
# Line 28 | Line 27 | sum_images(const char *fspec, const CMATRIX *cv, FILE
27  
28          if (cv->ncols != 1)
29                  error(INTERNAL, "expected vector in sum_images()");
30 <        for (i = 0; i < cv->nrows; i++) {
31 <                const COLORV    *scv = cv_lval(cv,i);
30 >        for (i = cv->nrows; i-- > 0; ) {
31 >                const int       r = runcnt&1 ? i : cv->nrows-1 - i;
32 >                const COLORV    *scv = cv_lval(cv,r);
33                  int             flat_file = 0;
34                  char            fname[1024];
35                  FILE            *fp;
# Line 39 | Line 39 | sum_images(const char *fspec, const CMATRIX *cv, FILE
39                  char            *err;
40                                                          /* check for zero */
41                  if ((scv[RED] == 0) & (scv[GRN] == 0) & (scv[BLU] == 0) &&
42 <                                (myDT != DTfromHeader) | (i < cv->nrows-1))
42 >                                (myDT != DTfromHeader) | (i > 0))
43                          continue;
44                                                          /* open next picture */
45 <                sprintf(fname, fspec, i);
45 >                sprintf(fname, fspec, r);
46                  if ((fp = fopen(fname, "rb")) == NULL) {
47                          sprintf(errmsg, "cannot open picture '%s'", fname);
48                          error(SYSTEM, errmsg);
# Line 107 | Line 107 | sum_images(const char *fspec, const CMATRIX *cv, FILE
107          free(scanline);
108          i = cm_write(pmat, myDT, fout);                 /* write picture */
109          cm_free(pmat);                                  /* free data */
110 +        ++runcnt;                                       /* for zig-zagging */
111          return(i);
112   }
113  
# Line 177 | Line 178 | main(int argc, char *argv[])
178          CMATRIX         *cmtx;          /* component vector/matrix result */
179          char            fnbuf[256];
180          int             a, i;
181 <
182 <        progname = argv[0];
181 >                                        /* set global progname */
182 >        fixargv0(argv[0]);
183                                          /* get options */
184          for (a = 1; a < argc && argv[a][0] == '-'; a++)
185                  switch (argv[a][1]) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines