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

Comparing ray/src/util/ranimove1.c (file contents):
Revision 3.18 by greg, Fri Sep 28 22:20:49 2012 UTC vs.
Revision 3.19 by greg, Sun Sep 30 19:18:41 2012 UTC

# Line 55 | Line 55 | static void init_frame_sample(void);
55  
56  
57   #if 0
58 < extern void
58 > void
59   write_map(              /* write out float map (debugging) */
60          float   *mp,
61          char    *fn
# Line 185 | Line 185 | sample_here(           /* 4x4 quincunx sample at this pixel? */
185   }
186  
187  
188 < extern void
188 > void
189   sample_pos(     /* compute jittered sample position */
190          double  hv[2],
191          int     x,
# Line 202 | Line 202 | sample_pos(    /* compute jittered sample position */
202   }
203  
204  
205 < extern double
205 > double
206   sample_wt(              /* compute interpolant sample weight */
207          int     xo,
208          int yo
# Line 236 | Line 236 | offset_cmp(            /* compare offset distances */
236   }
237  
238  
239 < extern int
239 > int
240   getclosest(     /* get nc closest neighbors on same object */
241          int     *iarr,
242          int     nc,
# Line 452 | Line 452 | init_frame_sample(void)                /* sample our initial frame *
452   }
453  
454  
455 < extern int
455 > int
456   getambcolor(            /* get ambient color for object if we can */
457                  COLOR   clr,
458                  int     obj
# Line 520 | Line 520 | getambcolor(           /* get ambient color for object if we ca
520   }
521  
522  
523 < extern double
523 > double
524   estimaterr(             /* estimate relative error from samples */
525                  COLOR   cs,
526                  COLOR   cs2,
# Line 546 | Line 546 | estimaterr(            /* estimate relative error from samples *
546   }
547  
548  
549 < extern double
549 > double
550   comperr(                /* estimate relative error in neighborhood */
551                  int     *neigh,
552                  int     nc,
# Line 582 | Line 582 | comperr(               /* estimate relative error in neighborhood *
582   }
583  
584  
585 < extern void
585 > void
586   comp_frame_error(void)          /* initialize frame error values */
587   {
588          uby8    *edone = NULL;
# Line 610 | Line 610 | comp_frame_error(void)         /* initialize frame error valu
610                   * by the returned ray value -- we take half of this.
611                   */
612                  edone = (uby8 *)calloc(hres*vres, sizeof(uby8));
613 <                for (y = vres; y--; )
614 <                    for (x = hres; x--; ) {
615 <                        n = fndx(x, y);
613 >                for (n = hres*vres; n--; ) {
614                          if ((abuffer[n] != ALOWQ) | (obuffer[n] == OVOID))
615                                  continue;
616                          if (!getambcolor(objamb, obuffer[n]))
# Line 629 | Line 627 | comp_frame_error(void)         /* initialize frame error valu
627                          else if (i >= ADISTANT/2) i = ADISTANT/2-1;
628                          abuffer[n] = i;
629                          edone[n] = 1;
630 <                    }
630 >                }
631          }
632                                          /* final statistical estimate */
633          for (y = vres; y--; )
# Line 661 | Line 659 | comp_frame_error(void)         /* initialize frame error valu
659   }
660  
661  
662 < extern void
662 > void
663   init_frame(void)                        /* render base (low quality) frame */
664   {
665          int     restart;
# Line 718 | Line 716 | init_frame(void)                       /* render base (low quality) frame
716   }
717  
718  
719 < extern void
719 > void
720   filter_frame(void)                      /* interpolation, motion-blur, and exposure */
721   {
722 <        double  expval = expspec_val(getexp(fcur));
723 <        int     x, y;
724 <        int     neigh[NPINTERP];
725 <        int     nc;
726 <        COLOR   cval;
727 <        double  w, wsum;
728 <        int     n;
722 >        const double    expval = expspec_val(getexp(fcur));
723 >        int             x, y;
724 >        int             neigh[NPINTERP];
725 >        int             nc;
726 >        COLOR           cval;
727 >        double          w, wsum;
728 >        int             n;
729  
730   #if 0
731          /* XXX TEMPORARY!! */
# Line 747 | Line 745 | filter_frame(void)                     /* interpolation, motion-blur, an
745                  fflush(stdout);
746          }
747                                          /* normalize samples */
748 <        for (y = vres; y--; )
751 <            for (x = hres; x--; ) {
752 <                n = fndx(x, y);
748 >        for (n = hres*vres; n--; ) {
749                  if (sbuffer[n] <= 1)
750                          continue;
751                  w = 1.0/(double)sbuffer[n];
752                  scalecolor(cbuffer[n], w);
753 <            }
753 >        }
754                                          /* interpolate samples */
755          for (y = vres; y--; )
756              for (x = hres; x--; ) {
# Line 861 | Line 857 | filter_frame(void)                     /* interpolation, motion-blur, an
857                          }
858                      }
859                                          /* compute final results */
860 <                for (y = vres; y--; )
865 <                    for (x = hres; x--; ) {
866 <                        n = fndx(x, y);
860 >                for (n = hres*vres; n--; ) {
861                          if (wbuffer[n] <= FTINY)
862                                  continue;
863 <                        w = 1./wbuffer[n];
863 >                        w = expval/wbuffer[n];
864                          scalecolor(outbuffer[n], w);
865 <                    }
866 <        } else
867 <                for (n = hres*vres; n--; )
868 <                        copycolor(outbuffer[n], cbuffer[n]);
865 >                }
866 >        } else {                        /* no blur -- just exposure */
867 >                memcpy(outbuffer, cbuffer, sizeof(COLOR)*hres*vres);
868 >                for (n = ((expval < 0.99) | (expval > 1.01))*hres*vres; n--; )
869 >                        scalecolor(outbuffer[n], expval);
870 >        }
871          /*
872             for (n = hres*vres; n--; )
873                     if (!sbuffer[n])
874                             setcolor(outbuffer[n], 0., 0., 0.);
875           */
880        /* adjust exposure */
881        if ((expval < 0.99) | (expval > 1.01))
882                for (n = hres*vres; n--; )
883                        scalecolor(outbuffer[n], expval);
876   #if 0
877          {
878                  float   *sbuf = (float *)malloc(sizeof(float)*hres*vres);
# Line 896 | Line 888 | filter_frame(void)                     /* interpolation, motion-blur, an
888   }
889  
890  
891 < extern void
891 > void
892   send_frame(void)                        /* send frame to destination */
893   {
894          char    fname[1024];
# Line 1002 | Line 994 | writerr:
994   }
995  
996  
997 < extern void
997 > void
998   free_frame(void)                        /* free frame allocation */
999   {
1000          if (cbuffer == NULL)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines