182 |
|
returnErr(TM_E_TMINVAL); |
183 |
|
if ((ls == NULL) | (scan == NULL) | (len < 0)) |
184 |
|
returnErr(TM_E_ILLEGAL); |
185 |
< |
if (cs != TM_NOCHROM && fabs(curgam - tms->mongam) < .02) { |
185 |
> |
if (cs != TM_NOCHROM && fabs(tms->mongam - curgam) > .02) { |
186 |
|
curgam = tms->mongam; /* (re)build table */ |
187 |
|
for (i = 1024; i--; ) |
188 |
|
gamtab[i] = (int)(256.*pow((i+.5)/1024., 1./curgam)); |
195 |
|
cmon[GRN] = tms->inpsf*scan[i][GRN]; |
196 |
|
cmon[BLU] = tms->inpsf*scan[i][BLU]; |
197 |
|
} |
198 |
+ |
#ifdef isnan |
199 |
+ |
if (isnan(cmon[RED]) || isinf(cmon[RED])) cmon[RED] = .0f; |
200 |
+ |
if (isnan(cmon[GRN]) || isinf(cmon[GRN])) cmon[GRN] = .0f; |
201 |
+ |
if (isnan(cmon[BLU]) || isinf(cmon[BLU])) cmon[BLU] = .0f; |
202 |
+ |
#endif |
203 |
|
/* world luminance */ |
204 |
|
lum = tms->clf[RED]*cmon[RED] + |
205 |
|
tms->clf[GRN]*cmon[GRN] + |