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

Comparing ray/src/util/ranimove2.c (file contents):
Revision 3.3 by schorsch, Mon Jun 30 14:59:13 2003 UTC vs.
Revision 3.6 by schorsch, Fri Mar 26 21:36:20 2004 UTC

# Line 21 | Line 21 | static const char      RCSid[] = "$Id$";
21  
22   int     cerrzero;               /* is cerrmap all zeroes? */
23  
24 + static int ppri_cmp(const void *pp1, const void *pp2);
25 + static int ray_refine(int       n);
26 + static long refine_rays(long    nrays);
27  
28 < int
29 < refine_first()                  /* initial refinement pass */
28 >
29 > extern int
30 > refine_first(void)                      /* initial refinement pass */
31   {
32          int     *esamp = (int *)zprev;  /* OK to reuse */
33          int     hl_erri = errori(HL_ERR);
# Line 51 | Line 55 | refine_first()                 /* initial refinement pass */
55                  if (xmbuffer[n] == MO_UNK)
56                          continue;
57                  xp = x + xmbuffer[n];
58 <                if ((xp < 0 | xp >= hres))
58 >                if ((xp < 0) | (xp >= hres))
59                          continue;
60                  yp = y + ymbuffer[n];
61 <                if ((yp < 0 | yp >= vres))
61 >                if ((yp < 0) | (yp >= vres))
62                          continue;
63                  np = fndx(xp, yp);
64                                          /* make sure we hit same object */
# Line 117 | Line 121 | struct ConspSum {
121   static double   pixel_deg;      /* base pixel frequency */
122   static int      fhsiz, fvsiz;   /* foveal subimage size */
123  
124 + static void clr_consp(struct ConspSum *cs);
125 + static void sum_consp(struct ConspSum *cdest, struct ConspSum *cs);
126 + static void est_consp(int x0, int y0, int x1, int y1, struct ConspSum *cs);
127 + static void subconspicuity(int x0, int y0, int x1, int y1, struct ConspSum *cs);
128 +
129   static void
130 < clr_consp(cs)                   /* initialize a conspicuity sum */
131 < register struct ConspSum        *cs;
130 > clr_consp(                      /* initialize a conspicuity sum */
131 >        register struct ConspSum        *cs
132 > )
133   {
134          if (cs == NULL)
135                  return;
# Line 132 | Line 142 | register struct ConspSum       *cs;
142   }
143  
144   static void
145 < sum_consp(cdest, cs)            /* sum in conspicuity result */
146 < register struct ConspSum        *cdest, *cs;
145 > sum_consp(              /* sum in conspicuity result */
146 >        register struct ConspSum        *cdest,
147 >        register struct ConspSum        *cs
148 > )
149   {
150 <        if ((cdest == NULL | cs == NULL))
150 >        if ((cdest == NULL) | (cs == NULL))
151                  return;
152          addcolor(cdest->vsum, cs->vsum);
153          addcolor(cdest->v2sum, cs->v2sum);
# Line 148 | Line 160 | register struct ConspSum       *cdest, *cs;
160   }
161  
162   static void
163 < est_consp(x0,y0,x1,y1, cs)      /* estimate error conspicuity & update */
164 < int     x0, y0, x1, y1;
165 < register struct ConspSum        *cs;
163 > est_consp(      /* estimate error conspicuity & update */
164 >        int     x0,
165 >        int     y0,
166 >        int     x1,
167 >        int     y1,
168 >        register struct ConspSum        *cs
169 > )
170   {
171          double  rad2, mtn2, cpd, vm, vr, csf, eest;
172                                                  /* do we care? */
# Line 165 | Line 181 | register struct ConspSum       *cs;
181          } else
182                  eest = estimaterr(cs->vsum, cs->v2sum, cs->nsamp, cs->nsamp);
183          
184 <        if ((x0 == x1-1 & y0 == y1-1)) {        /* update pixel error */
184 >        if ((x0 == x1-1) & (y0 == y1-1)) {      /* update pixel error */
185                  int     n = fndx(x0, y0);
186                  int     ai;
187                  int     ne;
# Line 228 | Line 244 | register struct ConspSum       *cs;
244   }
245  
246   static void
247 < subconspicuity(x0,y0,x1,y1, cs) /* compute subportion of conspicuity */
248 < int     x0, y0, x1, y1;
249 < struct ConspSum *cs;
247 > subconspicuity( /* compute subportion of conspicuity */
248 >        int     x0,
249 >        int     y0,
250 >        int     x1,
251 >        int     y1,
252 >        struct ConspSum *cs
253 > )
254   {
255          struct ConspSum mysum;
256          int     i;
257  
258 <        if ((x0 >= x1 | y0 >= y1))
258 >        if ((x0 >= x1) | (y0 >= y1))
259                  error(CONSISTENCY, "bad call to subconspicuity");
260  
261          clr_consp(&mysum);                      /* prepare sum */
262  
263 <        if ((x0 == x1-1 & y0 == y1-1)) {        /* single pixel */
263 >        if ((x0 == x1-1) & (y0 == y1-1)) {      /* single pixel */
264                  double  hls;
265                  register int    n = fndx(x0, y0);
266                  if (sbuffer[n]) {
# Line 289 | Line 309 | struct ConspSum        *cs;
309          sum_consp(cs, &mysum);
310   }
311  
312 < void
313 < conspicuity()                   /* compute conspicuous error map */
312 > extern void
313 > conspicuity(void)                       /* compute conspicuous error map */
314   {
315          int     fhres, fvres;
316          int     fx, fy;
# Line 330 | Line 350 | static struct AmbSum {
350  
351  
352   static int
353 < ppri_cmp(pp1, pp2)              /* pixel priority comparison */
354 < const void *pp1, *pp2;
353 > ppri_cmp(               /* pixel priority comparison */
354 >        const void *pp1,
355 >        const void *pp2
356 > )
357   {
358          double  se1 = cerrmap[*(const int *)pp1];
359          double  se2 = cerrmap[*(const int *)pp2];
# Line 351 | Line 373 | const void *pp1, *pp2;
373  
374  
375   static int
376 < ray_refine(n)                   /* refine the given pixel by tracing a ray */
377 < register int    n;
376 > ray_refine(                     /* refine the given pixel by tracing a ray */
377 >        register int    n
378 > )
379   {
380          RAY     ir;
358        int     neigh[NSAMPOK];
359        int     nc;
381          COLOR   ctmp;
382          int     i;
383  
# Line 389 | Line 410 | register int   n;
410                  if (sbuffer[n] != 1)
411                          error(CONSISTENCY, "bad code in ray_refine");
412                  if (getambcolor(ctmp, obuffer[n]) &&
413 <                                (colval(ctmp,RED) > 0.01 &
414 <                                 colval(ctmp,GRN) > 0.01 &
415 <                                 colval(ctmp,BLU) > 0.01)) {
413 >                                (colval(ctmp,RED) > 0.01) &
414 >                                (colval(ctmp,GRN) > 0.01) &
415 >                                (colval(ctmp,BLU) > 0.01)) {
416                          for (i = 0; i < 3; i++)
417                                  asump->diffsum[i] +=
418                                      (colval(ir.rcol,i) - colval(cbuffer[n],i))
# Line 419 | Line 440 | register int   n;
440  
441  
442   static long
443 < refine_rays(nrays)              /* compute refinement rays */
444 < long    nrays;
443 > refine_rays(            /* compute refinement rays */
444 >        long    nrays
445 > )
446   {
447          int     *pord;
448          int     ntodo;
# Line 428 | Line 450 | long   nrays;
450          int     i;
451                                          /* skip if nothing significant */
452          if (ndtset && cerrzero)
453 <                return;
453 >                return(0);
454                                          /* initialize priority list */
455          pord = (int *)malloc(sizeof(int)*hres*vres);
456          for (i = hres*vres; i--; )
# Line 463 | Line 485 | long   nrays;
485   }
486  
487  
488 < int
489 < refine_frame(pass)              /* refine current frame */
490 < int     pass;
488 > extern int
489 > refine_frame(           /* refine current frame */
490 >        int     pass
491 > )
492   {
493          static double   rtime_used = 0;
494          static long     ray_cnt = 0;
495          static double   ctime_used = 0;
496          static int      csp_cnt = 0;
497 <        int     timed = (fcur > fbeg | pass > 0 | quickstart);
497 >        int     timed = (fcur > fbeg) | (pass > 0) | (quickstart);
498          double  time_start, rtime_start, time_done;
499          struct AmbSum   myAmbSum;
500          long    rays_todo, nr;
501          register int    n;
502                                          /* IBR refinement? */
503 <        if ((pass == 0 & fcur > fbeg))
503 >        if ((pass == 0) & (fcur > fbeg))
504                  return(refine_first());
505                                          /* any time left? */
506          time_start = getTime();
# Line 554 | Line 577 | if (pass == 1) {
577                                          /* compute refinement rays */
578          if (!silent) {
579                  printf("\tRefinement pass %d...",
580 <                                pass+1, rays_todo);
580 >                                pass+1); /*, rays_todo); */
581                  fflush(stdout);
582          }
583          if (asump != NULL)              /* flag low-quality samples */
# Line 564 | Line 587 | if (pass == 1) {
587                                          /* trace those rays */
588          nr = refine_rays(rays_todo);
589          if (!silent)
590 <                printf("traced %d HQ rays\n", nr);
590 >                printf("traced %ld HQ rays\n", nr);
591          if (nr <= 0)
592                  return(0);
593                                          /* update timing stats */
# Line 599 | Line 622 | if (pass == 1) {
622          return(1);
623   nomore:
624                                          /* make sure error map is updated */
625 <        if ((fcur == fbeg | pass > 1))
625 >        if ((fcur == fbeg) | (pass > 1))
626                  comp_frame_error();
627          return(0);
628   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines