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

Comparing ray/src/cv/bsdfrbf.c (file contents):
Revision 2.4 by greg, Wed Mar 20 01:00:22 2013 UTC vs.
Revision 2.5 by greg, Fri Jun 28 23:18:51 2013 UTC

# Line 189 | Line 189 | cull_values(void)
189                  }
190   }
191  
192 + /* Compute minimum BSDF from histogram and clear it */
193 + static void
194 + comp_bsdf_min()
195 + {
196 +        int     cnt;
197 +        int     i, target;
198 +
199 +        cnt = 0;
200 +        for (i = HISTLEN; i--; )
201 +                cnt += bsdf_hist[i];
202 +        if (!cnt) {                             /* shouldn't happen */
203 +                bsdf_min = 0;
204 +                return;
205 +        }
206 +        target = cnt/100;                       /* ignore bottom 1% */
207 +        cnt = 0;
208 +        for (i = 0; cnt <= target; i++)
209 +                cnt += bsdf_hist[i];
210 +        bsdf_min = histval(i-1);
211 +        memset(bsdf_hist, 0, sizeof(bsdf_hist));
212 + }
213 +
214   /* Count up filled nodes and build RBF representation from current grid */
215   RBFNODE *
216   make_rbfrep(void)
# Line 207 | Line 229 | make_rbfrep(void)
229          for (i = 0; i < GRIDRES; i++)
230              for (j = 0; j < GRIDRES; j++)
231                  nn += dsf_grid[i][j].nval;
232 +                                /* compute minimum BSDF */
233 +        comp_bsdf_min();
234                                  /* allocate RBF array */
235          newnode = (RBFNODE *)malloc(sizeof(RBFNODE) + sizeof(RBFVAL)*(nn-1));
236          if (newnode == NULL)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines