10 |
|
#include <stdio.h> |
11 |
|
#include <math.h> |
12 |
|
#include <ctype.h> |
13 |
+ |
#include <time.h> |
14 |
|
#include "tiffio.h" |
15 |
|
#include "color.h" |
16 |
|
#include "resolu.h" |
161 |
|
if (i != argc-2) |
162 |
|
goto userr; |
163 |
|
/* consistency checks */ |
164 |
< |
if (CHK(C_GRY)) |
164 |
> |
if (CHK(C_GRY)) { |
165 |
|
if (cvts.phot == PHOTOMETRIC_RGB) |
166 |
|
cvts.phot = PHOTOMETRIC_MINISBLACK; |
167 |
|
else { |
168 |
|
cvts.phot = PHOTOMETRIC_LOGL; |
169 |
|
cvts.comp = COMPRESSION_SGILOG; |
170 |
|
} |
171 |
+ |
} |
172 |
|
if (CHK(C_TWRD|C_TFLT) == (C_TWRD|C_TFLT)) |
173 |
|
goto userr; |
174 |
|
|
208 |
|
(CHK(C_GRY) ? 1 : 3); |
209 |
|
cvts.r.p = (char *)malloc(rsiz*cvts.xmax); |
210 |
|
cvts.t.p = (char *)malloc(tsiz*cvts.xmax); |
211 |
< |
if (cvts.r.p == NULL | cvts.t.p == NULL) |
211 |
> |
if ((cvts.r.p == NULL) | (cvts.t.p == NULL)) |
212 |
|
quiterr("no memory to allocate scanline buffers"); |
213 |
|
} |
214 |
|
|
543 |
|
cvts.tf = Color2RRGGBB; |
544 |
|
SET(C_RFLT); |
545 |
|
} else if (CHK(C_TFLT)) { |
546 |
+ |
TIFFSetField(cvts.tif, TIFFTAG_SAMPLEFORMAT, |
547 |
+ |
SAMPLEFORMAT_IEEEFP); |
548 |
|
cvts.tf = Color2RfGfBf; |
549 |
|
SET(C_RFLT); |
550 |
|
} else |
557 |
|
cvts.tf = Color2GGry; |
558 |
|
SET(C_RFLT); |
559 |
|
} else if (CHK(C_TFLT)) { |
560 |
+ |
TIFFSetField(cvts.tif, TIFFTAG_SAMPLEFORMAT, |
561 |
+ |
SAMPLEFORMAT_IEEEFP); |
562 |
|
cvts.tf = Color2Gryf; |
563 |
|
SET(C_RFLT); |
564 |
|
} else |
660 |
|
RRGGBB2Color(y) /* read/convert/write RGB16->COLOR scanline */ |
661 |
|
uint32 y; |
662 |
|
{ |
663 |
< |
int dogamma = cvts.gamcor < 0.99 | cvts.gamcor > 1.01; |
663 |
> |
int dogamma = (cvts.gamcor < 0.99) | (cvts.gamcor > 1.01); |
664 |
|
register double d; |
665 |
|
register int x; |
666 |
|
|
807 |
|
GGry2Color(y) /* read/convert/write G16->COLOR scanline */ |
808 |
|
uint32 y; |
809 |
|
{ |
810 |
< |
int dogamma = cvts.gamcor < 0.99 | cvts.gamcor > 1.01; |
810 |
> |
int dogamma = (cvts.gamcor < 0.99) | (cvts.gamcor > 1.01); |
811 |
|
double m; |
812 |
|
register double d; |
813 |
|
register int x; |
837 |
|
Color2GGry(y) /* read/convert/write COLOR->G16 scanline */ |
838 |
|
uint32 y; |
839 |
|
{ |
840 |
< |
int dogamma = cvts.gamcor < 0.99 | cvts.gamcor > 1.01; |
840 |
> |
int dogamma = (cvts.gamcor < 0.99) | (cvts.gamcor > 1.01); |
841 |
|
float m = pow(2.,(double)cvts.bradj); |
842 |
|
register int x; |
843 |
|
|
926 |
|
Color2RRGGBB(y) /* read/convert/write COLOR->RGB16 scanline */ |
927 |
|
uint32 y; |
928 |
|
{ |
929 |
< |
int dogamma = cvts.gamcor < 0.99 | cvts.gamcor > 1.01; |
929 |
> |
int dogamma = (cvts.gamcor < 0.99) | (cvts.gamcor > 1.01); |
930 |
|
float m = pow(2.,(double)cvts.bradj); |
931 |
|
register int x, i; |
932 |
|
|