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

Comparing ray/src/px/pf3.c (file contents):
Revision 2.18 by schorsch, Sun Mar 28 20:33:14 2004 UTC vs.
Revision 2.20 by greg, Thu Dec 7 21:15:54 2023 UTC

# Line 7 | Line 7 | static const char RCSid[] = "$Id$";
7   *     8/13/86
8   */
9  
10 #include  "standard.h"
11
12 #include  <string.h>
13
14 #include  "color.h"
10   #include  "pfilt.h"
11  
12   #define  RSCA           1.13    /* square-radius multiplier: sqrt(4/PI) */
# Line 25 | Line 20 | short  *ringwt;                        /* weight (count) of ring values */
20   short  *ringndx;                /* ring index table */
21   float  *warr;                   /* array of pixel weights */
22  
23 < #define  lookgauss(x)           gausstable[(int)(10.*(x)+.5)]
23 > #define  lookgauss(x)           gausstable[(int)(20.*(x)+.5)]
24  
25   static double pickfilt(double  p0);
26   static void sumans(int  px, int  py, int  rcent, int  ccent, double  m);
27  
28  
29 < extern void
29 > void
30   initmask(void)                  /* initialize gaussian lookup table */
31   {
32          int  gtabsiz;
33          double  gaussN;
34          double  d;
35 <        register int  x;
35 >        int  x;
36  
37 <        gtabsiz = 111*CHECKRAD*CHECKRAD;
37 >        gtabsiz = 444*CHECKRAD*CHECKRAD;
38          gausstable = (float *)malloc(gtabsiz*sizeof(float));
39          if (gausstable == NULL)
40                  goto memerr;
41          d = x_c*y_r*0.25/(rad*rad);
42          gausstable[0] = exp(-d);
43          for (x = 1; x < gtabsiz; x++)
44 <                if (x*0.1 <= d)
44 >                if (x*0.05 <= d)
45                          gausstable[x] = gausstable[0];
46                  else
47 <                        gausstable[x] = exp(-x*0.1);
47 >                        gausstable[x] = exp(-x*0.05);
48          if (obarsize == 0)
49                  return;
50                                          /* compute integral of filter */
# Line 81 | Line 76 | memerr:
76   }
77  
78  
79 < extern void
79 > void
80   dobox(                  /* simple box filter */
81          COLOR  csum,
82          int  xcent,
# Line 93 | Line 88 | dobox(                 /* simple box filter */
88          int  wsum;
89          double  d;
90          int  y;
91 <        register int  x, offs;
92 <        register COLOR  *scan;
91 >        int  x, offs;
92 >        COLOR   *scan;
93          
94          wsum = 0;
95          setcolor(csum, 0.0, 0.0, 0.0);
# Line 123 | Line 118 | dobox(                 /* simple box filter */
118   }
119  
120  
121 < extern void
121 > void
122   dogauss(                /* gaussian filter */
123          COLOR  csum,
124          int  xcent,
# Line 135 | Line 130 | dogauss(               /* gaussian filter */
130          double  dy, dx, weight, wsum;
131          COLOR  ctmp;
132          int  y;
133 <        register int  x, offs;
134 <        register COLOR  *scan;
133 >        int  x, offs;
134 >        COLOR   *scan;
135  
136          wsum = FTINY;
137          setcolor(csum, 0.0, 0.0, 0.0);
# Line 162 | Line 157 | dogauss(               /* gaussian filter */
157   }
158  
159  
160 < extern void
160 > void
161   dothresh(       /* gaussian threshold filter */
162          int  xcent,
163          int  ycent,
# Line 172 | Line 167 | dothresh(      /* gaussian threshold filter */
167   {
168          double  d;
169          int  r, y, offs;
170 <        register int  c, x;
171 <        register float  *gscan;
170 >        int  c, x;
171 >        float  *gscan;
172                                          /* compute ring sums */
173          memset((char *)ringsum, '\0', (orad+1)*sizeof(float));
174          memset((char *)ringwt, '\0', (orad+1)*sizeof(short));
# Line 222 | Line 217 | pickfilt(                      /* find filter multiplier for p0 */
217          double  t, num, denom, avg, wsum;
218          double  mlimit[2];
219          int  ilimit = 4.0/TEPS;
220 <        register int  i;
220 >        int  i;
221                                  /* iterative search for m */
222          mlimit[0] = 1.0; mlimit[1] = orad/rad/CHECKRAD;
223          do {
# Line 287 | Line 282 | sumans(                /* sum input pixel to output */
282          COLOR  pval, ctmp;
283          int  ksiz, r, offs;
284          double  pc, pr, norm;
285 <        register int  i, c;
286 <        register COLOR  *scan;
285 >        int  i, c;
286 >        COLOR   *scan;
287          /*
288           * This normalization method fails at the picture borders because
289           * a different number of input pixels contribute there.
# Line 327 | Line 322 | sumans(                /* sum input pixel to output */
322                  scan = scoutbar[r%obarsize];
323                  for (c = ccent-ksiz; c <= ccent+ksiz; c++) {
324                          offs = c < 0 ? ncols : c >= ncols ? -ncols : 0;
325 <                        if (offs && !wrapfilt)
325 >                        if ((offs != 0) & !wrapfilt)
326                                  continue;
327                          copycolor(ctmp, pval);
328                          dx = norm*warr[i++];

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines