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.19 by greg, Sun Sep 30 19:18:41 2012 UTC vs.
Revision 3.24 by greg, Sat Nov 17 20:15:51 2018 UTC

# Line 16 | Line 16 | static const char      RCSid[] = "$Id$";
16   #include "platform.h"
17   #include "ranimove.h"
18   #include "otypes.h"
19 + #include "otspecial.h"
20   #include "source.h"
21   #include "random.h"
22  
# Line 48 | Line 49 | double         hlsmax;         /* maximum high-level saliency this f
49  
50  
51   static void next_frame(void);
52 < static int sample_here(int      x, int  y);
53 < static int offset_cmp(const void        *p1, const void *p2);
54 < static void setmotion(int       n, FVECT        wpos);
52 > static int sample_here(int x, int y);
53 > static int offset_cmp(const void *p1, const void *p2);
54 > static void setmotion(int n, FVECT wpos);
55   static void init_frame_sample(void);
56  
57  
# Line 145 | Line 146 | next_frame(void)                       /* prepare next frame buffer */
146                          error(SYSTEM, "out of memory in init_frame");
147                  for (n = hres*vres; n--; ) {
148                          zprev[n] = -1.f;
149 <                        xmbuffer[n] = ymbuffer[n] = MO_UNK;
149 <                        oprev[n] = OVOID;
149 >                        oprev[n] = OVOID;
150                  }
151                  frm_stop = getTime() + rtperfrm;
152          } else {
# Line 330 | Line 330 | setmotion(             /* compute motion vector for this pixel */
330                  multp3(ovp, wpos, obj_move[moi].bxfm);
331                  wpos = ovp;
332          }
333 <        viewloc(ovp, &vwprev, wpos);
334 <        if (ovp[2] <= FTINY)
333 >        if (viewloc(ovp, &vwprev, wpos) <= 0)
334                  return;
335          xp = (int)(ovp[0]*hres);
336          yp = (int)(ovp[1]*vres);
# Line 363 | Line 362 | init_frame_sample(void)                /* sample our initial frame *
362              for (x = hres; x--; ) {
363                  double  hv[2];
364                  n = fndx(x, y);
365 <                xmbuffer[n] = MO_UNK;
367 <                ymbuffer[n] = MO_UNK;
365 >                xmbuffer[n] = ymbuffer[n] = MO_UNK;
366                  sample_pos(hv, x, y, 0);
367                  ir.rmax = viewray(ir.rorg, ir.rdir, &vw, hv[0], hv[1]);
368                  if (ir.rmax < -FTINY) {
# Line 739 | Line 737 | filter_frame(void)                     /* interpolation, motion-blur, an
737                  free((void *)ebuf);
738          }
739   #endif
742
740          if (!silent) {
741                  printf("\tFiltering frame\n");
742                  fflush(stdout);
# Line 957 | Line 954 | send_frame(void)                       /* send frame to destination */
954          if (vdef(MNAME)) {              /* output motion buffer */
955                  unsigned short  *mbuffer = (unsigned short *)malloc(
956                                                  sizeof(unsigned short)*3*hres);
957 <                int             x;
957 >                int             x, n;
958                  if (mbuffer == NULL)
959 <                        error(SYSTEM, "out of memory in send_frame()");
959 >                        error(SYSTEM, "out of memory in send_frame");
960                  sprintf(fname, vval(MNAME), fcur);
961                  strcat(fname, ".mvo");
962                  fp = fopen(fname, "w");
# Line 975 | Line 972 | send_frame(void)                       /* send frame to destination */
972                  }
973                  for (y = vres; y--; ) {
974                          for (x = hres; x--; ) {
975 <                                mbuffer[3*x] = xmbuffer[fndx(x,y)] + 0x8000;
976 <                                mbuffer[3*x+1] = ymbuffer[fndx(x,y)] + 0x8000;
977 <                                mbuffer[3*x+2] = (oprev[fndx(x,y)]!=OVOID)*0x8000;
975 >                                n = fndx(x,y);
976 >                                mbuffer[3*x] = xmbuffer[n] + 0x8000;
977 >                                mbuffer[3*x+1] = ymbuffer[n] + 0x8000;
978 >                                mbuffer[3*x+2] = (oprev[n]!=OVOID)*0x8000;
979                          }
980                          if (fwrite(mbuffer, sizeof(*mbuffer),
981                                                  3*hres, fp) != 3*hres)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines