1 |
+ |
#ifndef lint |
2 |
+ |
static const char RCSid[] = "$Id$"; |
3 |
+ |
#endif |
4 |
|
/* |
5 |
|
* Compute time-step glare using imageless DGP calculation method. |
6 |
|
* |
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) |
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)) { |
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)) { |
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); |
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]) { |
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; |
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); |
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 |