ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/falsecolor.c
(Generate patch)

Comparing ray/src/common/falsecolor.c (file contents):
Revision 3.5 by greg, Fri Nov 18 22:50:20 2005 UTC vs.
Revision 3.6 by greg, Thu Jan 26 03:13:36 2006 UTC

# Line 112 | Line 112 | fcLogMapping(FCstruct *fcs, TMstruct *tms, double pcti
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;
# Line 120 | Line 120 | fcLogMapping(FCstruct *fcs, TMstruct *tms, double pcti
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;
# Line 165 | Line 165 | fcMapPixels(FCstruct *fcs, BYTE *ps, TMbright *ls, int
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 */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines