10 |
|
#include <stdio.h> |
11 |
|
#include <math.h> |
12 |
|
#include <ctype.h> |
13 |
+ |
#include <time.h> |
14 |
+ |
#include <string.h> |
15 |
+ |
|
16 |
|
#include "tiffio.h" |
17 |
|
#include "color.h" |
18 |
|
#include "resolu.h" |
96 |
|
|
97 |
|
char *progname; |
98 |
|
|
99 |
+ |
static gethfunc headline; |
100 |
|
|
101 |
+ |
|
102 |
|
main(argc, argv) |
103 |
|
int argc; |
104 |
|
char *argv[]; |
165 |
|
if (i != argc-2) |
166 |
|
goto userr; |
167 |
|
/* consistency checks */ |
168 |
< |
if (CHK(C_GRY)) |
168 |
> |
if (CHK(C_GRY)) { |
169 |
|
if (cvts.phot == PHOTOMETRIC_RGB) |
170 |
|
cvts.phot = PHOTOMETRIC_MINISBLACK; |
171 |
|
else { |
172 |
|
cvts.phot = PHOTOMETRIC_LOGL; |
173 |
|
cvts.comp = COMPRESSION_SGILOG; |
174 |
|
} |
175 |
+ |
} |
176 |
|
if (CHK(C_TWRD|C_TFLT) == (C_TWRD|C_TFLT)) |
177 |
|
goto userr; |
178 |
|
|
212 |
|
(CHK(C_GRY) ? 1 : 3); |
213 |
|
cvts.r.p = (char *)malloc(rsiz*cvts.xmax); |
214 |
|
cvts.t.p = (char *)malloc(tsiz*cvts.xmax); |
215 |
< |
if (cvts.r.p == NULL | cvts.t.p == NULL) |
215 |
> |
if ((cvts.r.p == NULL) | (cvts.t.p == NULL)) |
216 |
|
quiterr("no memory to allocate scanline buffers"); |
217 |
|
} |
218 |
|
|
415 |
|
} |
416 |
|
|
417 |
|
|
418 |
< |
int |
419 |
< |
headline(s) /* process Radiance input header line */ |
420 |
< |
char *s; |
418 |
> |
static int |
419 |
> |
headline( /* process Radiance input header line */ |
420 |
> |
char *s, |
421 |
> |
void *p |
422 |
> |
) |
423 |
|
{ |
424 |
|
static int tmstrlen = 0; |
425 |
|
static int ownstrlen = 0; |
549 |
|
cvts.tf = Color2RRGGBB; |
550 |
|
SET(C_RFLT); |
551 |
|
} else if (CHK(C_TFLT)) { |
552 |
+ |
TIFFSetField(cvts.tif, TIFFTAG_SAMPLEFORMAT, |
553 |
+ |
SAMPLEFORMAT_IEEEFP); |
554 |
|
cvts.tf = Color2RfGfBf; |
555 |
|
SET(C_RFLT); |
556 |
|
} else |
563 |
|
cvts.tf = Color2GGry; |
564 |
|
SET(C_RFLT); |
565 |
|
} else if (CHK(C_TFLT)) { |
566 |
+ |
TIFFSetField(cvts.tif, TIFFTAG_SAMPLEFORMAT, |
567 |
+ |
SAMPLEFORMAT_IEEEFP); |
568 |
|
cvts.tf = Color2Gryf; |
569 |
|
SET(C_RFLT); |
570 |
|
} else |
666 |
|
RRGGBB2Color(y) /* read/convert/write RGB16->COLOR scanline */ |
667 |
|
uint32 y; |
668 |
|
{ |
669 |
< |
int dogamma = cvts.gamcor < 0.99 | cvts.gamcor > 1.01; |
669 |
> |
int dogamma = (cvts.gamcor < 0.99) | (cvts.gamcor > 1.01); |
670 |
|
register double d; |
671 |
|
register int x; |
672 |
|
|
813 |
|
GGry2Color(y) /* read/convert/write G16->COLOR scanline */ |
814 |
|
uint32 y; |
815 |
|
{ |
816 |
< |
int dogamma = cvts.gamcor < 0.99 | cvts.gamcor > 1.01; |
816 |
> |
int dogamma = (cvts.gamcor < 0.99) | (cvts.gamcor > 1.01); |
817 |
|
double m; |
818 |
|
register double d; |
819 |
|
register int x; |
843 |
|
Color2GGry(y) /* read/convert/write COLOR->G16 scanline */ |
844 |
|
uint32 y; |
845 |
|
{ |
846 |
< |
int dogamma = cvts.gamcor < 0.99 | cvts.gamcor > 1.01; |
846 |
> |
int dogamma = (cvts.gamcor < 0.99) | (cvts.gamcor > 1.01); |
847 |
|
float m = pow(2.,(double)cvts.bradj); |
848 |
|
register int x; |
849 |
|
|
932 |
|
Color2RRGGBB(y) /* read/convert/write COLOR->RGB16 scanline */ |
933 |
|
uint32 y; |
934 |
|
{ |
935 |
< |
int dogamma = cvts.gamcor < 0.99 | cvts.gamcor > 1.01; |
935 |
> |
int dogamma = (cvts.gamcor < 0.99) | (cvts.gamcor > 1.01); |
936 |
|
float m = pow(2.,(double)cvts.bradj); |
937 |
|
register int x, i; |
938 |
|
|