Back to index

radiance  4R0+20100331
Classes | Functions | Variables
falsecolor.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  FCstruct

Functions

FCstructfcInit (BYTE fcscale[256][3])
int fcFixedLinear (FCstruct *fcs, double Lwmax)
int fcFixedLog (FCstruct *fcs, double Lwmin, double Lwmax)
int fcLinearMapping (FCstruct *fcs, TMstruct *tms, double pctile)
int fcLogMapping (FCstruct *fcs, TMstruct *tms, double pctile)
int fcMapPixels (FCstruct *fcs, BYTE *ps, TMbright *ls, int len)
int fcIsLogMap (FCstruct *fcs)
FCstructfcDup (FCstruct *fcs)
void fcDone (FCstruct *fcs)

Variables

BYTE fcDefaultScale [256][3]

Class Documentation

struct FCstruct

Definition at line 14 of file falsecolor.h.

Class Members
BYTE * lumap
TMbright mbrmax
TMbright mbrmin
BYTE(* scale

Function Documentation

void fcDone ( FCstruct fcs)

Definition at line 205 of file falsecolor.c.

{
       if (fcs == NULL)
              return;
       if (fcs->lumap != NULL)
              free((void *)fcs->lumap);
       free((void *)fcs);
}
FCstruct* fcDup ( FCstruct fcs)

Definition at line 182 of file falsecolor.c.

{
       FCstruct      *fcnew;

       if (fcs == NULL)
              return(NULL);
       fcnew = fcInit(fcs->scale);
       if (fcnew == NULL)
              return(NULL);
       if (fcs->lumap != NULL) {
              fcnew->lumap = (BYTE *)malloc(sizeof(BYTE)*(fcs->mbrmax -
                                                 fcs->mbrmin + 1));
              if (fcnew->lumap == NULL)
                     return(fcnew);
              fcnew->mbrmin = fcs->mbrmin; fcnew->mbrmax = fcs->mbrmax;
              memcpy((void *)fcnew->lumap, (void *)fcs->lumap,
                            sizeof(BYTE)*(fcs->mbrmax - fcs->mbrmin + 1));
       }
       return(fcnew);
}

Here is the call graph for this function:

int fcFixedLinear ( FCstruct fcs,
double  Lwmax 
)

Definition at line 36 of file falsecolor.c.

{
       double mult;
       int    i;

       if ((fcs == NULL) | (Lwmax <= MINLUM))
              return(TM_E_ILLEGAL);
       if (fcs->lumap != NULL)
              free((void *)fcs->lumap);
       fcs->mbrmin = tmCvLuminance(Lwmax/256.);
       fcs->mbrmax = tmCvLuminance(Lwmax);
       fcs->lumap = (BYTE *)malloc(sizeof(BYTE)*(fcs->mbrmax - fcs->mbrmin + 1));
       if (fcs->lumap == NULL)
              return(TM_E_NOMEM);
       mult = 255.999/tmLuminance(fcs->mbrmax);
       for (i = fcs->mbrmin; i <= fcs->mbrmax; i++)
              fcs->lumap[i - fcs->mbrmin] = (int)(mult * tmLuminance(i));
       returnOK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int fcFixedLog ( FCstruct fcs,
double  Lwmin,
double  Lwmax 
)

Definition at line 58 of file falsecolor.c.

{
       int    i;

       if ((fcs == NULL) | (Lwmin <= MINLUM) | (Lwmax <= Lwmin))
              return(TM_E_ILLEGAL);
       if (fcs->lumap != NULL)
              free((void *)fcs->lumap);
       fcs->mbrmin = tmCvLuminance(Lwmin);
       fcs->mbrmax = tmCvLuminance(Lwmax);
       if (fcs->mbrmin >= fcs->mbrmax) {
              fcs->lumap = NULL;
              return(TM_E_ILLEGAL);
       }
       fcs->lumap = (BYTE *)malloc(sizeof(BYTE)*(fcs->mbrmax - fcs->mbrmin + 1));
       if (fcs->lumap == NULL)
              return(TM_E_NOMEM);
       for (i = fcs->mbrmax - fcs->mbrmin; i >= 0; i--)
              fcs->lumap[i] = 256L * i / (fcs->mbrmax - fcs->mbrmin + 1);
       returnOK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

FCstruct* fcInit ( BYTE  fcscale[256][3])

Definition at line 21 of file falsecolor.c.

{
       FCstruct      *fcs = (FCstruct *)malloc(sizeof(FCstruct));
       
       if (fcs == NULL)
              return(NULL);
       fcs->mbrmin = 10; fcs->mbrmax = -10;
       fcs->lumap = NULL;
       if ((fcs->scale = fcscale) == NULL)
              fcs->scale = fcDefaultScale;
       return(fcs);
}

Here is the caller graph for this function:

int fcIsLogMap ( FCstruct fcs)

Definition at line 166 of file falsecolor.c.

{
       int    miderr;

       if (fcs == NULL || fcs->lumap == NULL)
              return(-1);
       
       miderr = (fcs->mbrmax - fcs->mbrmin)/2;
       miderr = fcs->lumap[miderr] -
                     256L * miderr / (fcs->mbrmax - fcs->mbrmin + 1);

       return((-1 <= miderr) & (miderr <= 1));
}
int fcLinearMapping ( FCstruct fcs,
TMstruct tms,
double  pctile 
)

Definition at line 82 of file falsecolor.c.

{
       int           i, histlen;
       int32         histot, cnt;
       int           brt0;

       if ((fcs == NULL) | (tms == NULL) || (tms->histo == NULL) |
                     (0 > pctile) | (pctile >= 50))
              return(TM_E_ILLEGAL);
       i = HISTI(tms->hbrmin);
       brt0 = HISTV(i);
       histlen = HISTI(tms->hbrmax) + 1 - i;
       histot = 0;
       for (i = histlen; i--; )
              histot += tms->histo[i];
       cnt = histot * pctile / 100;
       for (i = histlen; i--; )
              if ((cnt -= tms->histo[i]) < 0)
                     break;
       if (i <= 0)
              return(TM_E_TMFAIL);
       return(fcFixedLinear(fcs, tmLuminance(brt0 + i*HISTEP)));
}

Here is the call graph for this function:

int fcLogMapping ( FCstruct fcs,
TMstruct tms,
double  pctile 
)

Definition at line 108 of file falsecolor.c.

{
       int           i, histlen;
       int32         histot, cnt;
       int           brt0, wbrmin, wbrmax;

       if ((fcs == NULL) | (tms == NULL) || (tms->histo == NULL) |
                     (.0 > pctile) | (pctile >= 50.))
              return(TM_E_ILLEGAL);
       i = HISTI(tms->hbrmin);
       brt0 = HISTV(i);
       histlen = HISTI(tms->hbrmax) + 1 - i;
       histot = 0;
       for (i = histlen; i--; )
              histot += tms->histo[i];
       cnt = histot * pctile * .01;
       for (i = 0; i < histlen; i++)
              if ((cnt -= tms->histo[i]) < 0)
                     break;
       if (i >= histlen)
              return(TM_E_TMFAIL);
       wbrmin = brt0 + i*HISTEP;
       cnt = histot * pctile * .01;
       for (i = histlen; i--; )
              if ((cnt -= tms->histo[i]) < 0)
                     break;
       wbrmax = brt0 + i*HISTEP;
       if (wbrmax <= wbrmin)
              return(TM_E_TMFAIL);
       return(fcFixedLog(fcs, tmLuminance(wbrmin), tmLuminance(wbrmax)));
}

Here is the call graph for this function:

int fcMapPixels ( FCstruct fcs,
BYTE ps,
TMbright ls,
int  len 
)

Definition at line 142 of file falsecolor.c.

{
       int    li;

       if (fcs == NULL || (fcs->lumap == NULL) | (fcs->scale == NULL))
              return(TM_E_ILLEGAL);
       if ((ps == NULL) | (ls == NULL) | (len < 0))
              return(TM_E_ILLEGAL);
       while (len--) {
              if ((li = *ls++) < fcs->mbrmin)
                     li = 0;
              else if (li > fcs->mbrmax)
                     li = 255;
              else
                     li = fcs->lumap[li - fcs->mbrmin];
              *ps++ = fcs->scale[li][RED];
              *ps++ = fcs->scale[li][GRN];
              *ps++ = fcs->scale[li][BLU];
       }
       returnOK;
}

Variable Documentation

Definition at line 214 of file falsecolor.c.