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

Comparing src/util/dcglare.c (file contents):
Revision 2.2 by greg, Tue Sep 10 17:25:02 2019 UTC vs.
Revision 2.9 by greg, Fri Jun 6 19:11:21 2025 UTC

# Line 1 | Line 1
1 + #ifndef lint
2 + static const char RCSid[] = "$Id$";
3 + #endif
4   /*
5   * Compute time-step glare using imageless DGP calculation method.
6   *
# Line 27 | Line 30
30   */
31  
32   #include <ctype.h>
33 + #include "paths.h"
34   #include "platform.h"
35   #include "standard.h"
36   #include "cmatrix.h"
37   #include "resolu.h"
38   #include "cmglare.h"
39  
36 char    *progname;                      /* global argv[0] */
37
40   /* Sum together a set of images and write result to fout */
41   static int
42   sum_images(const char *fspec, const CMATRIX *cv, FILE *fout)
# Line 67 | Line 69 | sum_images(const char *fspec, const CMATRIX *cv, FILE
69                          error(SYSTEM, errmsg);
70                  }
71                  dt = DTfromHeader;
72 <                if ((err = cm_getheader(&dt, NULL, NULL, NULL, fp)) != NULL)
72 >                if ((err = cm_getheader(&dt, NULL, NULL, NULL, NULL, fp)) != NULL)
73                          error(USER, err);
74                  if ((dt != DTrgbe) & (dt != DTxyze) ||
75                                  !fscnresolu(&xr, &yr, fp)) {
# Line 83 | Line 85 | sum_images(const char *fspec, const CMATRIX *cv, FILE
85                          pmat = cm_alloc(myYR, myXR);
86                          memset(pmat->cmem, 0, sizeof(COLOR)*myXR*myYR);
87                                                          /* finish header */
88 <                        fputformat((char *)cm_fmt_id[myDT], fout);
88 >                        fputformat(cm_fmt_id[myDT], fout);
89                          fputc('\n', fout);
90                          fflush(fout);
91                  } else if ((dt != myDT) | (xr != myXR) | (yr != myYR)) {
# Line 93 | Line 95 | sum_images(const char *fspec, const CMATRIX *cv, FILE
95                  }
96                                                          /* flat file check */
97                  if ((data_start = ftell(fp)) > 0 && fseek(fp, 0L, SEEK_END) == 0) {
98 <                        flat_file = (ftell(fp) == data_start + sizeof(COLR)*xr*yr);
98 >                        flat_file = (ftell(fp) >= data_start + sizeof(COLR)*xr*yr);
99                          if (fseek(fp, data_start, SEEK_SET) < 0) {
100                                  sprintf(errmsg, "cannot seek on picture '%s'", fname);
101                                  error(SYSTEM, errmsg);
# Line 184 | Line 186 | main(int argc, char *argv[])
186          clock_t timer = clock();
187   #endif /* DC_GLARE */
188  
189 <        progname = argv[0];
189 >        fixargv0(argv[0]);
190                                          /* get options */
191          for (a = 1; a < argc && argv[a][0] == '-'; a++)
192                  switch (argv[a][1]) {
# Line 300 | Line 302 | main(int argc, char *argv[])
302          if ((argc-a < 2) | (argc-a > 5))
303                  goto userr;
304          /* single bounce daylight coefficients file */
305 <        direct_path = argv[++a];
305 >        direct_path = argv[a++];
306   #else
307          if ((argc-a < 1) | (argc-a > 4))
308                  goto userr;
# Line 475 | Line 477 | main(int argc, char *argv[])
477                                          fprintf(ofp, "FRAME=%d\n", i);
478                                          fprintf(ofp, "NROWS=%d\n", rvec->nrows);
479                                          fputs("NCOLS=1\nNCOMP=3\n", ofp);
480 <                                        if ((outfmt == 'f') | (outfmt == 'd'))
480 >                                        if ((outfmt == DTfloat) | (outfmt == DTdouble))
481                                                  fputendian(ofp);
482 <                                        fputformat((char *)cm_fmt_id[outfmt], ofp);
482 >                                        fputformat(cm_fmt_id[outfmt], ofp);
483                                          fputc('\n', ofp);
484                                  }
485                                  cm_write(rvec, outfmt, ofp);
# Line 508 | Line 510 | main(int argc, char *argv[])
510                                  fprintf(ofp, "NCOLS=%d\n", rmtx->ncols);
511                                  fputs("NCOMP=3\n", ofp);
512   #endif /* DC_GLARE */
513 <                                if ((outfmt == 'f') | (outfmt == 'd'))
513 >                                if ((outfmt == DTfloat) | (outfmt == DTdouble))
514                                          fputendian(ofp);
515 <                                fputformat((char *)cm_fmt_id[outfmt], ofp);
515 >                                fputformat(cm_fmt_id[outfmt], ofp);
516                                  fputc('\n', ofp);
517                          }
518   #ifdef DC_GLARE

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines