7 |
|
* Added white-balance adjustment 10/01 (GW). |
8 |
|
*/ |
9 |
|
|
10 |
– |
#include <stdio.h> |
10 |
|
#include <math.h> |
11 |
|
#include <ctype.h> |
13 |
– |
#include <time.h> |
14 |
– |
#include <string.h> |
12 |
|
|
13 |
+ |
#include "rtio.h" |
14 |
+ |
#include "platform.h" |
15 |
|
#include "tiffio.h" |
16 |
|
#include "color.h" |
17 |
|
#include "resolu.h" |
190 |
|
exit(0); |
191 |
|
userr: |
192 |
|
fprintf(stderr, |
193 |
< |
"Usage: %s [-z|-L|-l|-f|-w][-b][-e +/-stops][-g gamma] {in.pic|-} out.tif\n", |
193 |
> |
"Usage: %s [-z|-L|-l|-f|-w][-b][-e +/-stops][-g gamma] {in.hdr|-} out.tif\n", |
194 |
|
progname); |
195 |
|
fprintf(stderr, |
196 |
< |
" Or: %s -r [-x][-e +/-stops][-g gamma] in.tif [out.pic|-]\n", |
196 |
> |
" Or: %s -r [-x][-e +/-stops][-g gamma] in.tif [out.hdr|-]\n", |
197 |
|
progname); |
198 |
|
exit(1); |
199 |
|
} |
361 |
|
quiterr("unknown input image resolution"); |
362 |
|
|
363 |
|
if (!TIFFGetField(cvts.tif, TIFFTAG_STONITS, &cvts.stonits)) |
364 |
< |
cvts.stonits = 1.; |
364 |
> |
cvts.stonits = -1.; |
365 |
|
|
366 |
|
if (!TIFFGetField(cvts.tif, TIFFTAG_DATETIME, &cp)) |
367 |
|
cvts.capdate[0] = '\0'; |
379 |
|
if (cvts.pixrat < .99 || cvts.pixrat > 1.01) |
380 |
|
fputaspect(cvts.pixrat, cvts.rfp); |
381 |
|
if (CHK(C_XYZE)) { |
382 |
< |
fputexpos(pow(2.,(double)cvts.bradj)/cvts.stonits, cvts.rfp); |
382 |
> |
if (cvts.stonits > .0) |
383 |
> |
fputexpos(pow(2.,(double)cvts.bradj)/cvts.stonits, cvts.rfp); |
384 |
|
fputformat(CIEFMT, cvts.rfp); |
385 |
|
} else { |
386 |
|
if (CHK(C_PRIM)) |
387 |
|
fputprims(cvts.prims, cvts.rfp); |
388 |
< |
fputexpos(WHTEFFICACY*pow(2.,(double)cvts.bradj)/cvts.stonits, |
389 |
< |
cvts.rfp); |
388 |
> |
if (cvts.stonits > .0) |
389 |
> |
fputexpos(WHTEFFICACY*pow(2.,(double)cvts.bradj)/cvts.stonits, |
390 |
> |
cvts.rfp); |
391 |
|
fputformat(COLRFMT, cvts.rfp); |
392 |
|
} |
393 |
|
if (cvts.capdate[0]) |
414 |
|
cvts.rfp = stdout; |
415 |
|
else if ((cvts.rfp = fopen(av[ac+1], "w")) == NULL) |
416 |
|
quiterr("cannot open Radiance output picture"); |
417 |
+ |
SET_FILE_BINARY(cvts.rfp); |
418 |
|
/* start output header */ |
419 |
|
newheader("RADIANCE", cvts.rfp); |
420 |
|
printargs(ac, av, cvts.rfp); |
440 |
|
{ |
441 |
|
static int tmstrlen = 0; |
442 |
|
static int ownstrlen = 0; |
443 |
< |
char fmt[32]; |
443 |
> |
char fmt[MAXFMTLEN]; |
444 |
|
|
445 |
|
if (!tmstrlen) |
446 |
|
tmstrlen = strlen(TMSTR); |
634 |
|
cvts.rfp = stdin; |
635 |
|
else if ((cvts.rfp = fopen(av[ac], "r")) == NULL) |
636 |
|
quiterr("cannot open Radiance input picture"); |
637 |
+ |
SET_FILE_BINARY(cvts.rfp); |
638 |
|
/* open TIFF file */ |
639 |
|
if ((cvts.tif = TIFFOpen(av[ac+1], "w")) == NULL) |
640 |
|
quiterr("cannot open TIFF output"); |