18 |
|
|
19 |
|
/* Initialize new false color mapping */ |
20 |
|
FCstruct * |
21 |
< |
fcInit(BYTE fcscale[256][3]) |
21 |
> |
fcInit(uby8 fcscale[256][3]) |
22 |
|
{ |
23 |
|
FCstruct *fcs = (FCstruct *)malloc(sizeof(FCstruct)); |
24 |
|
|
44 |
|
free((void *)fcs->lumap); |
45 |
|
fcs->mbrmin = tmCvLuminance(Lwmax/256.); |
46 |
|
fcs->mbrmax = tmCvLuminance(Lwmax); |
47 |
< |
fcs->lumap = (BYTE *)malloc(sizeof(BYTE)*(fcs->mbrmax - fcs->mbrmin + 1)); |
47 |
> |
fcs->lumap = (uby8 *)malloc(sizeof(uby8)*(fcs->mbrmax - fcs->mbrmin + 1)); |
48 |
|
if (fcs->lumap == NULL) |
49 |
|
return(TM_E_NOMEM); |
50 |
|
mult = 255.999/tmLuminance(fcs->mbrmax); |
69 |
|
fcs->lumap = NULL; |
70 |
|
return(TM_E_ILLEGAL); |
71 |
|
} |
72 |
< |
fcs->lumap = (BYTE *)malloc(sizeof(BYTE)*(fcs->mbrmax - fcs->mbrmin + 1)); |
72 |
> |
fcs->lumap = (uby8 *)malloc(sizeof(uby8)*(fcs->mbrmax - fcs->mbrmin + 1)); |
73 |
|
if (fcs->lumap == NULL) |
74 |
|
return(TM_E_NOMEM); |
75 |
|
for (i = fcs->mbrmax - fcs->mbrmin; i >= 0; i--) |
89 |
|
(0 > pctile) | (pctile >= 50)) |
90 |
|
return(TM_E_ILLEGAL); |
91 |
|
i = HISTI(tms->hbrmin); |
92 |
< |
brt0 = MINBRT + HISTEP/2 + i*HISTEP; |
92 |
> |
brt0 = HISTV(i); |
93 |
|
histlen = HISTI(tms->hbrmax) + 1 - i; |
94 |
|
histot = 0; |
95 |
|
for (i = histlen; i--; ) |
115 |
|
(.0 > pctile) | (pctile >= 50.)) |
116 |
|
return(TM_E_ILLEGAL); |
117 |
|
i = HISTI(tms->hbrmin); |
118 |
< |
brt0 = MINBRT + HISTEP/2 + i*HISTEP; |
118 |
> |
brt0 = HISTV(i); |
119 |
|
histlen = HISTI(tms->hbrmax) + 1 - i; |
120 |
|
histot = 0; |
121 |
|
for (i = histlen; i--; ) |
139 |
|
|
140 |
|
/* Apply false color mapping to pixel values */ |
141 |
|
int |
142 |
< |
fcMapPixels(FCstruct *fcs, BYTE *ps, TMbright *ls, int len) |
142 |
> |
fcMapPixels(FCstruct *fcs, uby8 *ps, TMbright *ls, int len) |
143 |
|
{ |
144 |
|
int li; |
145 |
|
|
189 |
|
if (fcnew == NULL) |
190 |
|
return(NULL); |
191 |
|
if (fcs->lumap != NULL) { |
192 |
< |
fcnew->lumap = (BYTE *)malloc(sizeof(BYTE)*(fcs->mbrmax - |
192 |
> |
fcnew->lumap = (uby8 *)malloc(sizeof(uby8)*(fcs->mbrmax - |
193 |
|
fcs->mbrmin + 1)); |
194 |
|
if (fcnew->lumap == NULL) |
195 |
|
return(fcnew); |
196 |
|
fcnew->mbrmin = fcs->mbrmin; fcnew->mbrmax = fcs->mbrmax; |
197 |
|
memcpy((void *)fcnew->lumap, (void *)fcs->lumap, |
198 |
< |
sizeof(BYTE)*(fcs->mbrmax - fcs->mbrmin + 1)); |
198 |
> |
sizeof(uby8)*(fcs->mbrmax - fcs->mbrmin + 1)); |
199 |
|
} |
200 |
|
return(fcnew); |
201 |
|
} |
211 |
|
free((void *)fcs); |
212 |
|
} |
213 |
|
|
214 |
< |
BYTE fcDefaultScale[256][3] = { /* default false color scale */ |
214 |
> |
uby8 fcDefaultScale[256][3] = { /* default false color scale */ |
215 |
|
111,8,132, |
216 |
|
108,7,133, |
217 |
|
105,7,134, |