112 |
|
int brt0, wbrmin, wbrmax; |
113 |
|
|
114 |
|
if ((fcs == NULL) | (tms == NULL) || (tms->histo == NULL) | |
115 |
< |
(0 > pctile) | (pctile >= 50)) |
115 |
> |
(.0 > pctile) | (pctile >= 50.)) |
116 |
|
return(TM_E_ILLEGAL); |
117 |
|
i = (tms->hbrmin-MINBRT)/HISTEP; |
118 |
|
brt0 = MINBRT + HISTEP/2 + i*HISTEP; |
120 |
|
histot = 0; |
121 |
|
for (i = histlen; i--; ) |
122 |
|
histot += tms->histo[i]; |
123 |
< |
cnt = histot * pctile / 100; |
123 |
> |
cnt = histot * pctile * .01; |
124 |
|
for (i = 0; i < histlen; i++) |
125 |
|
if ((cnt -= tms->histo[i]) < 0) |
126 |
|
break; |
127 |
|
if (i >= histlen) |
128 |
|
return(TM_E_TMFAIL); |
129 |
|
wbrmin = brt0 + i*HISTEP; |
130 |
< |
cnt = histot * pctile / 100; |
130 |
> |
cnt = histot * pctile * .01; |
131 |
|
for (i = histlen; i--; ) |
132 |
|
if ((cnt -= tms->histo[i]) < 0) |
133 |
|
break; |
165 |
|
int |
166 |
|
fcIsLogMap(FCstruct *fcs) |
167 |
|
{ |
168 |
< |
int midval; |
168 |
> |
int miderr; |
169 |
|
|
170 |
|
if (fcs == NULL || fcs->lumap == NULL) |
171 |
|
return(-1); |
172 |
< |
midval = fcs->lumap[(fcs->mbrmax - fcs->mbrmin)/2]; |
173 |
< |
return((127 <= midval) & (midval <= 129)); |
172 |
> |
|
173 |
> |
miderr = fcs->lumap[(fcs->mbrmax - fcs->mbrmin)/2] - |
174 |
> |
128L * (fcs->mbrmax - fcs->mbrmin) / |
175 |
> |
(fcs->mbrmax - fcs->mbrmin + 1); |
176 |
> |
|
177 |
> |
return((-1 <= miderr) & (miderr <= 1)); |
178 |
|
} |
179 |
|
|
180 |
|
/* Duplicate a false color structure */ |