| 68 |
|
ncomp = ncompval(s); |
| 69 |
|
return(1); |
| 70 |
|
} |
| 71 |
– |
if (isexpos(s)) { |
| 72 |
– |
if (fabs(1. - exposval(s)) > 0.04) |
| 73 |
– |
fputs("Warning - ignoring EXPOSURE setting\n", stderr); |
| 74 |
– |
return(1); |
| 75 |
– |
} |
| 71 |
|
if (formatval(fmt, s)) { |
| 72 |
|
for (in_type = DTend; --in_type > DTfromHeader; ) |
| 73 |
|
if (!strcmp(fmt, cm_fmt_id[in_type])) |
| 150 |
|
int |
| 151 |
|
checkline(char *s, void *p) |
| 152 |
|
{ |
| 153 |
< |
int *xyres = (int *)p; |
| 154 |
< |
char fmt[MAXFMTLEN]; |
| 153 |
> |
static int exposWarned = 0; |
| 154 |
> |
int *xyres = (int *)p; |
| 155 |
> |
char fmt[MAXFMTLEN]; |
| 156 |
|
|
| 157 |
|
if (!strncmp(s, "NCOLS=", 6)) { |
| 158 |
|
xyres[0] = atoi(s+6); |
| 172 |
|
return(1); |
| 173 |
|
} |
| 174 |
|
if (isexpos(s)) { |
| 175 |
< |
if (fabs(1. - exposval(s)) > 0.04) |
| 176 |
< |
fputs("Warning - ignoring EXPOSURE setting\n", stderr); |
| 175 |
> |
if (!exposWarned && fabs(1. - exposval(s)) > 0.04) { |
| 176 |
> |
fputs("Warning - ignoring EXPOSURE setting(s)\n", |
| 177 |
> |
stderr); |
| 178 |
> |
exposWarned++; |
| 179 |
> |
} |
| 180 |
|
return(1); |
| 181 |
|
} |
| 182 |
|
if (formatval(fmt, s)) { |
| 227 |
|
if (!ospec) { |
| 228 |
|
ospec = "<stdout>"; |
| 229 |
|
fp = stdout; |
| 231 |
– |
SET_FILE_BINARY(fp); |
| 230 |
|
} else if (ospec[0] == '!') { |
| 231 |
|
if (!(fp = popen(ospec+1, "w"))) { |
| 232 |
|
fprintf(stderr, "Cannot start: %s\n", ospec); |
| 233 |
|
return(NULL); |
| 234 |
|
} |
| 235 |
< |
SET_FILE_BINARY(fp); |
| 238 |
< |
} else if (!(fp = fopen(ospec, "wb"))) { |
| 235 |
> |
} else if (!(fp = fopen(ospec, "w"))) { |
| 236 |
|
fprintf(stderr, "%s: cannot open for writing\n", ospec); |
| 237 |
|
return(NULL); |
| 238 |
|
} |
| 239 |
+ |
SET_FILE_BINARY(fp); |
| 240 |
|
newheader("RADIANCE", fp); |
| 241 |
|
if (cmtx->info) /* prepend matrix metadata */ |
| 242 |
|
fputs(cmtx->info, fp); |
| 474 |
|
maplen = dstart + yres*xres*i; |
| 475 |
|
imap = mmap(NULL, maplen, PROT_READ, |
| 476 |
|
MAP_FILE|MAP_SHARED, fileno(finp), 0); |
| 477 |
< |
fclose(finp); /* will load from map (randomly) */ |
| 477 |
> |
fclose(finp); /* will read from map (randomly) */ |
| 478 |
|
if (imap == MAP_FAILED) { |
| 479 |
|
fprintf(stderr, "%s: unable to map input file\n", fbuf); |
| 480 |
|
return(0); |
| 500 |
|
} |
| 501 |
|
} |
| 502 |
|
munmap(imap, maplen); |
| 503 |
< |
} /* write out accumulated column result */ |
| 503 |
> |
} /* write accumulated column picture/matrix */ |
| 504 |
|
sprintf(fbuf, out_spec, c); |
| 505 |
|
fout = open_output(fbuf, c); |
| 506 |
|
if (!fout) |
| 525 |
|
} |
| 526 |
|
free(osum); |
| 527 |
|
free(syarr); |
| 528 |
< |
if (coff) /* children return here... */ |
| 528 |
> |
if (coff) /* child processes return here... */ |
| 529 |
|
return(1); |
| 530 |
|
c = 0; /* ...but parent waits for children */ |
| 531 |
|
while (++coff < nprocs) { |
| 577 |
|
if ((argc-a < 1) | (argc-a > 2) || argv[a][0] == '-') |
| 578 |
|
goto userr; |
| 579 |
|
in_spec = argv[a]; |
| 580 |
< |
cmtx = rmx_load(argv[a+1], RMPnone); /* may load from stdin */ |
| 580 |
> |
cmtx = rmx_load(argv[a+1], RMPnone); /* loads from stdin if a+1==argc */ |
| 581 |
|
if (cmtx == NULL) |
| 582 |
|
return(1); /* error reported */ |
| 583 |
+ |
if (nprocs > cmtx->ncols) |
| 584 |
+ |
nprocs = cmtx->ncols; |
| 585 |
|
#if defined(_WIN32) || defined(_WIN64) |
| 586 |
|
if (nprocs > 1) { |
| 587 |
|
fprintf(stderr, "%s: warning - Windows only allows -N 1\n", argv[0]); |
| 588 |
|
nprocs = 1; |
| 589 |
|
} |
| 590 |
|
#else |
| 591 |
– |
if (nprocs > cmtx->ncols) |
| 592 |
– |
nprocs = cmtx->ncols; |
| 591 |
|
if ((nprocs > 1) & !out_spec) { |
| 592 |
|
fprintf(stderr, "%s: multi-processing result cannot go to stdout\n", |
| 593 |
|
argv[0]); |