Back to index

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

Go to the source code of this file.

Typedefs

typedef double brightfunc_t (COLOR c)

Functions

void pass1init (void)
void pass1default (void)
void pass1scan (COLOR *scan, int y)
void pass2init (void)
void pass2scan (COLOR *scan, int y)
void initmask (void)
void dobox (COLOR csum, int xcent, int ycent, int c, int r)
void dogauss (COLOR csum, int xcent, int ycent, int c, int r)
void dothresh (int xcent, int ycent, int ccent, int rcent)

Variables

double CHECKRAD
double rad
double thresh
int nrows
int ncols
int xres
int yres
int avghot
double hotlvl
int npts
double spread
char * progname
COLOR exposure
double x_c
double y_r
int xrad
int yrad
int xbrad
int ybrad
int barsize
COLOR ** scanin
COLORscanout
COLOR ** scoutbar
float ** greybar
int obarsize
int orad
int wrapfilt
brightfunc_tourbright

Typedef Documentation

typedef double brightfunc_t(COLOR c)

Definition at line 42 of file pfilt.h.


Function Documentation

void dobox ( COLOR  csum,
int  xcent,
int  ycent,
int  c,
int  r 
)

Definition at line 85 of file pf3.c.

{
       int  wsum;
       double  d;
       int  y;
       register int  x, offs;
       register COLOR       *scan;
       
       wsum = 0;
       setcolor(csum, 0.0, 0.0, 0.0);
       for (y = ycent+1-ybrad; y <= ycent+ybrad; y++) {
              if (y < 0) continue;
              if (y >= yres) break;
              d = y_r < 1.0 ? y_r*y - (r+.5) : (double)(y - ycent);
              if (d < -0.5) continue;
              if (d >= 0.5) break;
              scan = scanin[y%barsize];
              for (x = xcent+1-xbrad; x <= xcent+xbrad; x++) {
                     offs = x < 0 ? xres : x >= xres ? -xres : 0;
                     if (offs && !wrapfilt)
                            continue;
                     d = x_c < 1.0 ? x_c*x - (c+.5) : (double)(x - xcent);
                     if (d < -0.5) continue;
                     if (d >= 0.5) break;
                     wsum++;
                     addcolor(csum, scan[x+offs]);
              }
       }
       if (wsum > 1) {
              d = 1.0/wsum;
              scalecolor(csum, d);
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void dogauss ( COLOR  csum,
int  xcent,
int  ycent,
int  c,
int  r 
)

Definition at line 127 of file pf3.c.

{
       double  dy, dx, weight, wsum;
       COLOR  ctmp;
       int  y;
       register int  x, offs;
       register COLOR       *scan;

       wsum = FTINY;
       setcolor(csum, 0.0, 0.0, 0.0);
       for (y = ycent-yrad; y <= ycent+yrad; y++) {
              if (y < 0) continue;
              if (y >= yres) break;
              dy = (y_r*(y+.5) - (r+.5))/rad;
              scan = scanin[y%barsize];
              for (x = xcent-xrad; x <= xcent+xrad; x++) {
                     offs = x < 0 ? xres : x >= xres ? -xres : 0;
                     if (offs && !wrapfilt)
                            continue;
                     dx = (x_c*(x+.5) - (c+.5))/rad;
                     weight = lookgauss(dx*dx + dy*dy);
                     wsum += weight;
                     copycolor(ctmp, scan[x+offs]);
                     scalecolor(ctmp, weight);
                     addcolor(csum, ctmp);
              }
       }
       weight = 1.0/wsum;
       scalecolor(csum, weight);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void dothresh ( int  xcent,
int  ycent,
int  ccent,
int  rcent 
)

Definition at line 166 of file pf3.c.

{
       double  d;
       int  r, y, offs;
       register int  c, x;
       register float  *gscan;
                                   /* compute ring sums */
       memset((char *)ringsum, '\0', (orad+1)*sizeof(float));
       memset((char *)ringwt, '\0', (orad+1)*sizeof(short));
       for (r = -orad; r <= orad; r++) {
              if (rcent+r < 0) continue;
              if (rcent+r >= nrows) break;
              gscan = greybar[(rcent+r)%obarsize];
              for (c = -orad; c <= orad; c++) {
                     offs = ccent+c < 0 ? ncols :
                                   ccent+c >= ncols ? -ncols : 0;
                     if (offs && !wrapfilt)
                            continue;
                     x = ringndx[c*c + r*r];
                     if (x < 0) continue;
                     ringsum[x] += gscan[ccent+c+offs];
                     ringwt[x]++;
              }
       }
                                   /* filter each subpixel */
       for (y = ycent+1-ybrad; y <= ycent+ybrad; y++) {
              if (y < 0) continue;
              if (y >= yres) break;
              d = y_r < 1.0 ? y_r*y - (rcent+.5) : (double)(y - ycent);
              if (d < -0.5) continue;
              if (d >= 0.5) break;
              for (x = xcent+1-xbrad; x <= xcent+xbrad; x++) {
                     offs = x < 0 ? xres : x >= xres ? -xres : 0;
                     if (offs && !wrapfilt)
                            continue;
                     d = x_c < 1.0 ? x_c*x - (ccent+.5) : (double)(x - xcent);
                     if (d < -0.5) continue;
                     if (d >= 0.5) break;
                     sumans(x, y, rcent, ccent,
                     pickfilt((*ourbright)(scanin[y%barsize][x+offs])));
              }
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void initmask ( void  )

Definition at line 35 of file pf3.c.

{
       int  gtabsiz;
       double  gaussN;
       double  d;
       register int  x;

       gtabsiz = 111*CHECKRAD*CHECKRAD;
       gausstable = (float *)malloc(gtabsiz*sizeof(float));
       if (gausstable == NULL)
              goto memerr;
       d = x_c*y_r*0.25/(rad*rad);
       gausstable[0] = exp(-d);
       for (x = 1; x < gtabsiz; x++)
              if (x*0.1 <= d)
                     gausstable[x] = gausstable[0];
              else
                     gausstable[x] = exp(-x*0.1);
       if (obarsize == 0)
              return;
                                   /* compute integral of filter */
       gaussN = PI*d*exp(-d);                    /* plateau */
       for (d = sqrt(d)+0.05; d <= RSCA*CHECKRAD; d += 0.1)
              gaussN += 0.1*2.0*PI*d*exp(-d*d);
                                   /* normalize filter */
       gaussN = x_c*y_r/(rad*rad*gaussN);
       for (x = 0; x < gtabsiz; x++)
              gausstable[x] *= gaussN;
                                   /* create ring averages table */
       ringndx = (short *)malloc((2*orad*orad+1)*sizeof(short));
       if (ringndx == NULL)
              goto memerr;
       for (x = 2*orad*orad+1; --x > orad*orad; )
              ringndx[x] = -1;
       do
              ringndx[x] = sqrt((double)x);
       while (x--);
       ringsum = (float *)malloc((orad+1)*sizeof(float));
       ringwt = (short *)malloc((orad+1)*sizeof(short));
       warr = (float *)malloc(obarsize*obarsize*sizeof(float));
       if ((ringsum == NULL) | (ringwt == 0) | (warr == NULL))
              goto memerr;
       return;
memerr:
       fprintf(stderr, "%s: out of memory in initmask\n", progname);
       quit(1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void pass1default ( void  )

Definition at line 49 of file pf2.c.

{
       avgbrt = AVGLVL;
       npix = 1;
       head = NULL;
}

Here is the caller graph for this function:

void pass1init ( void  )

Definition at line 40 of file pf2.c.

{
       avgbrt = 0.0;
       npix = 0;
       head = NULL;
}

Here is the caller graph for this function:

void pass1scan ( COLOR scan,
int  y 
)
void pass2init ( void  )

Definition at line 97 of file pf2.c.

{
       if (!npix) {
              fprintf(stderr, "%s: picture too dark or too bright\n",
                            progname);
              quit(1);
       }
       avgbrt /= (double)npix;

       scalecolor(exposure,  AVGLVL/avgbrt);
       
       sprdfact = spread / (hotlvl * (*ourbright)(exposure))
                     * ((double)xres*xres + (double)yres*yres) / 4.0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void pass2scan ( COLOR scan,
int  y 
)

Variable Documentation

int avghot

Definition at line 45 of file pfilt.c.

int barsize

Definition at line 77 of file pfilt.c.

double CHECKRAD

Definition at line 27 of file pfilt.c.

Definition at line 31 of file pfilt.c.

float** greybar

Definition at line 81 of file pfilt.c.

double hotlvl

Definition at line 47 of file pfilt.c.

int ncols

Definition at line 32 of file histo.c.

int npts

Definition at line 49 of file pfilt.c.

int nrows

Definition at line 37 of file pfilt.c.

int obarsize

Definition at line 82 of file pfilt.c.

int orad

Definition at line 83 of file pfilt.c.

Definition at line 342 of file pcomb.c.

char* progname

Definition at line 21 of file histo.c.

double rad

Definition at line 17 of file genrhgrid.c.

Definition at line 78 of file pfilt.c.

Definition at line 79 of file pfilt.c.

Definition at line 80 of file pfilt.c.

double spread

Definition at line 51 of file pfilt.c.

double thresh

Definition at line 35 of file pfilt.c.

int wrapfilt

Definition at line 68 of file pfilt.c.

double x_c

Definition at line 40 of file pfilt.c.

int xbrad

Definition at line 74 of file pfilt.c.

int xrad

Definition at line 72 of file pfilt.c.

int xres

Definition at line 20 of file rhpict.c.

double y_r

Definition at line 41 of file pfilt.c.

int ybrad

Definition at line 75 of file pfilt.c.

int yrad

Definition at line 73 of file pfilt.c.

int yres

Definition at line 20 of file rhpict.c.