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.10 by greg, Sat Jun 7 05:09:46 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 33 | Line 36
36   #include "resolu.h"
37   #include "cmglare.h"
38  
36 char    *progname;                      /* global argv[0] */
37
39   /* Sum together a set of images and write result to fout */
40   static int
41   sum_images(const char *fspec, const CMATRIX *cv, FILE *fout)
# Line 67 | Line 68 | sum_images(const char *fspec, const CMATRIX *cv, FILE
68                          error(SYSTEM, errmsg);
69                  }
70                  dt = DTfromHeader;
71 <                if ((err = cm_getheader(&dt, NULL, NULL, NULL, fp)) != NULL)
71 >                if ((err = cm_getheader(&dt, NULL, NULL, NULL, NULL, fp)) != NULL)
72                          error(USER, err);
73                  if ((dt != DTrgbe) & (dt != DTxyze) ||
74                                  !fscnresolu(&xr, &yr, fp)) {
# Line 83 | Line 84 | sum_images(const char *fspec, const CMATRIX *cv, FILE
84                          pmat = cm_alloc(myYR, myXR);
85                          memset(pmat->cmem, 0, sizeof(COLOR)*myXR*myYR);
86                                                          /* finish header */
87 <                        fputformat((char *)cm_fmt_id[myDT], fout);
87 >                        fputformat(cm_fmt_id[myDT], fout);
88                          fputc('\n', fout);
89                          fflush(fout);
90                  } else if ((dt != myDT) | (xr != myXR) | (yr != myYR)) {
# Line 93 | Line 94 | sum_images(const char *fspec, const CMATRIX *cv, FILE
94                  }
95                                                          /* flat file check */
96                  if ((data_start = ftell(fp)) > 0 && fseek(fp, 0L, SEEK_END) == 0) {
97 <                        flat_file = (ftell(fp) == data_start + sizeof(COLR)*xr*yr);
97 >                        flat_file = (ftell(fp) >= data_start + sizeof(COLR)*xr*yr);
98                          if (fseek(fp, data_start, SEEK_SET) < 0) {
99                                  sprintf(errmsg, "cannot seek on picture '%s'", fname);
100                                  error(SYSTEM, errmsg);
# Line 184 | Line 185 | main(int argc, char *argv[])
185          clock_t timer = clock();
186   #endif /* DC_GLARE */
187  
188 <        progname = argv[0];
188 >        fixargv0(argv[0]);
189                                          /* get options */
190          for (a = 1; a < argc && argv[a][0] == '-'; a++)
191                  switch (argv[a][1]) {
# Line 300 | Line 301 | main(int argc, char *argv[])
301          if ((argc-a < 2) | (argc-a > 5))
302                  goto userr;
303          /* single bounce daylight coefficients file */
304 <        direct_path = argv[++a];
304 >        direct_path = argv[a++];
305   #else
306          if ((argc-a < 1) | (argc-a > 4))
307                  goto userr;
# Line 475 | Line 476 | main(int argc, char *argv[])
476                                          fprintf(ofp, "FRAME=%d\n", i);
477                                          fprintf(ofp, "NROWS=%d\n", rvec->nrows);
478                                          fputs("NCOLS=1\nNCOMP=3\n", ofp);
479 <                                        if ((outfmt == 'f') | (outfmt == 'd'))
479 >                                        if ((outfmt == DTfloat) | (outfmt == DTdouble))
480                                                  fputendian(ofp);
481 <                                        fputformat((char *)cm_fmt_id[outfmt], ofp);
481 >                                        fputformat(cm_fmt_id[outfmt], ofp);
482                                          fputc('\n', ofp);
483                                  }
484                                  cm_write(rvec, outfmt, ofp);
# Line 508 | Line 509 | main(int argc, char *argv[])
509                                  fprintf(ofp, "NCOLS=%d\n", rmtx->ncols);
510                                  fputs("NCOMP=3\n", ofp);
511   #endif /* DC_GLARE */
512 <                                if ((outfmt == 'f') | (outfmt == 'd'))
512 >                                if ((outfmt == DTfloat) | (outfmt == DTdouble))
513                                          fputendian(ofp);
514 <                                fputformat((char *)cm_fmt_id[outfmt], ofp);
514 >                                fputformat(cm_fmt_id[outfmt], ofp);
515                                  fputc('\n', ofp);
516                          }
517   #ifdef DC_GLARE

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines