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.5 by schorsch, Mon Jul 21 22:30:19 2003 UTC vs.
Revision 3.7 by schorsch, Tue Oct 21 19:19:29 2003 UTC

# Line 106 | Line 106 | next_frame()                   /* prepare next frame buffer */
106                          pixaspect = 1.;
107                          /* fall through */
108                  case 3:
109 <                        if ((hres > 0 & vres > 0))
109 >                        if ((hres > 0) & (vres > 0))
110                                  break;
111                          /* fall through */
112                  default:
# Line 125 | Line 125 | next_frame()                   /* prepare next frame buffer */
125                  zprev = (float *)malloc(sizeof(float)*hres*vres);
126                  oprev = (OBJECT *)malloc(sizeof(OBJECT)*hres*vres);
127                  aprev = (BYTE *)malloc(sizeof(BYTE)*hres*vres);
128 <                if ((cbuffer==NULL | zbuffer==NULL | obuffer==NULL |
129 <                                xmbuffer==NULL | ymbuffer==NULL |
130 <                                abuffer==NULL | sbuffer==NULL |
131 <                                cprev==NULL | zprev == NULL |
132 <                                oprev==NULL | aprev==NULL))
128 >                if ((cbuffer==NULL) | (zbuffer==NULL) | (obuffer==NULL) |
129 >                                (xmbuffer==NULL) | (ymbuffer==NULL) |
130 >                                (abuffer==NULL) | (sbuffer==NULL) |
131 >                                (cprev==NULL) | (zprev == NULL) |
132 >                                (oprev==NULL) | (aprev==NULL))
133                          error(SYSTEM, "out of memory in init_frame");
134                  frm_stop = getTime() + rtperfrm;
135          } else {
# Line 186 | Line 186 | sample_wt(xo, yo)              /* compute interpolant sample weigh
186   int     xo, yo;
187   {
188          static double   etab[400];
189 <        int     rad2 = xo*xo + yo*yo;
189 >        /* we can't use the name rad2 here, for some reason Visual C
190 >           thinks that is a constant (compiler bug?) */
191 >        int     rad_2 = xo*xo + yo*yo;
192          int     i;
193  
194          if (etab[0] <= FTINY)           /* initialize exponent table */
# Line 194 | Line 196 | int    xo, yo;
196                          etab[i] = exp(-0.1*i);
197  
198                                          /* look up Gaussian */
199 <        i = (int)((10.*3./(double)SAMPDIST2)*rad2 + .5);
199 >        i = (int)((10.*3./(double)SAMPDIST2)*rad_2 + .5);
200          if (i >= 400)
201                  return(0.0);
202          return(etab[i]);
# Line 224 | Line 226 | int    x, y;
226                                          /* get our object number */
227          myobj = obuffer[fndx(x, y)];
228                                          /* special case for borders */
229 <        if ((x < SAMPDIST | x >= hres-SAMPDIST |
230 <                        y < SAMPDIST | y >= vres-SAMPDIST)) {
229 >        if ((x < SAMPDIST) | (x >= hres-SAMPDIST) |
230 >                        (y < SAMPDIST) | (y >= vres-SAMPDIST)) {
231                  int     tndx[NSCHECK][2];
232                  nf = 0;
233                  for (j = y - SAMPDIST; j <= y + SAMPDIST; j++) {
# Line 237 | Line 239 | int    x, y;
239                          i0 = fndx(i, j);
240                          if (!sbuffer[i0])
241                                  continue;
242 <                        if ((myobj != OVOID & obuffer[i0] != myobj))
242 >                        if ((myobj != OVOID) & (obuffer[i0] != myobj))
243                                  continue;
244                          tndx[nf][0] = (i-x)*(i-x) + (j-y)*(j-y);
245                          tndx[nf][1] = i0;
# Line 252 | Line 254 | int    x, y;
254                  return(nf);
255          }
256                                          /* initialize offset array */
257 <        if ((hres != hro | vres != vro)) {
257 >        if ((hres != hro) | (vres != vro)) {
258                  int     toffs[NSCHECK][2];
259                  i0 = fndx(SAMPDIST, SAMPDIST);
260                  nf = 0;
# Line 271 | Line 273 | int    x, y;
273          }
274                                          /* find up to nc neighbors */
275          i0 = fndx(x, y);
276 <        for (j = 0, nf = 0; (j < NSCHECK & nf < nc); j++) {
276 >        for (j = 0, nf = 0; (j < NSCHECK) & (nf < nc); j++) {
277                  i = i0 + ioffs[j];
278 <                if (sbuffer[i] && (myobj == OVOID | obuffer[i] == myobj))
278 >                if (sbuffer[i] && (myobj == OVOID) | (obuffer[i] == myobj))
279                          iarr[nf++] = i;
280          }
281                                          /* return number found */
# Line 309 | Line 311 | FVECT  wpos;
311          yp = (int)(ovp[1]*vres);
312          xmbuffer[n] = xp - (n % hres);
313          ymbuffer[n] = yp - (n / hres);
314 <        if ((xp < 0 | xp >= hres))
314 >        if ((xp < 0) | (xp >= hres))
315                  return;
316 <        if ((yp < 0 | yp >= vres))
316 >        if ((yp < 0) | (yp >= vres))
317                  return;
318          n = fndx(xp, yp);
319 <        if ((zprev[n] < 0.97*ovp[2] | zprev[n] > 1.03*ovp[2]))
319 >        if ((zprev[n] < 0.97*ovp[2]) | (zprev[n] > 1.03*ovp[2]))
320                  oprev[n] = OVOID;       /* assume it's a bad match */
321   }
322  
# Line 407 | Line 409 | init_frame_sample()            /* sample our initial frame */
409                  n = fndx(x, y);
410                  if ((obj = obuffer[n]) == OVOID)
411                          continue;
412 <                if ((obuffer[n+1] != OVOID & obuffer[n+1] != obj)) {
412 >                if ((obuffer[n+1] != OVOID) & (obuffer[n+1] != obj)) {
413                          obuffer[n] = OVOID;
414                          obuffer[n+1] = OVOID;
415                  }
416 <                if ((obuffer[n+hres] != OVOID & obuffer[n+hres] != obj)) {
416 >                if ((obuffer[n+hres] != OVOID) & (obuffer[n+hres] != obj)) {
417                          obuffer[n] = OVOID;
418                          obuffer[n+hres] = OVOID;
419                  }
# Line 432 | Line 434 | int    obj;
434          if (obj == OVOID)
435                  return(0);
436          op = objptr(obj);
437 <        if ((op->otype == OBJ_INSTANCE & op->omod == OVOID))
437 >        if ((op->otype == OBJ_INSTANCE) & (op->omod == OVOID))
438                  return(0);
439                                          /* search for material */
440          do {
# Line 529 | Line 531 | int    ns0;
531                                          /* add together samples */
532          setcolor(csum, 0., 0., 0.);
533          setcolor(csum2, 0., 0., 0.);
534 <        for (i = 0, ns = 0; (i < nc & ns < NSAMPOK); i++) {
534 >        for (i = 0, ns = 0; (i < nc) & (ns < NSAMPOK); i++) {
535                  n = neigh[i];
536                  addcolor(csum, cbuffer[n]);
537                  if (val2map != NULL) {
# Line 581 | Line 583 | comp_frame_error()             /* initialize frame error values *
583                  for (y = vres; y--; )
584                      for (x = hres; x--; ) {
585                          n = fndx(x, y);
586 <                        if ((abuffer[n] != ALOWQ | obuffer[n] == OVOID))
586 >                        if ((abuffer[n] != ALOWQ) | (obuffer[n] == OVOID))
587                                  continue;
588                          if (!getambcolor(objamb, obuffer[n]))
589                                  continue;
# Line 790 | Line 792 | write_map(cerrmap, "outcmap.pic");
792                                  scalecolor(cval, w);
793                                  while (cnt)
794                                          if (rise2 >= run2) {
795 <                                                if ((xl >= 0 & xl < hres &
796 <                                                        yl >= 0 & yl < vres)) {
795 >                                                if ((xl >= 0) & (xl < hres) &
796 >                                                        (yl >= 0) & (yl < vres)) {
797                                                          n2 = fndx(xl, yl);
798                                                          addcolor(outbuffer[n2],
799                                                                          cval);
# Line 811 | Line 813 | write_map(cerrmap, "outcmap.pic");
813                                  scalecolor(cval, w);
814                                  while (cnt)
815                                          if (run2 >= rise2) {
816 <                                                if ((xl >= 0 & xl < hres &
817 <                                                        yl >= 0 & yl < vres)) {
816 >                                                if ((xl >= 0) & (xl < hres) &
817 >                                                        (yl >= 0) & (yl < vres)) {
818                                                          n2 = fndx(xl, yl);
819                                                          addcolor(outbuffer[n2],
820                                                                          cval);
# Line 845 | Line 847 | for (n = hres*vres; n--; )
847                  setcolor(outbuffer[n], 0., 0., 0.);
848   */
849                                  /* adjust exposure */
850 <        if ((expval < 0.99 | expval > 1.01))
850 >        if ((expval < 0.99) | (expval > 1.01))
851                  for (n = hres*vres; n--; )
852                          scalecolor(outbuffer[n], expval);
853   return;
# Line 890 | Line 892 | send_frame()                   /* send frame to destination */
892          fputnow(fp);
893          fputs(VIEWSTR, fp); fprintview(&vw, fp); fputc('\n', fp);
894          d = expspec_val(getexp(fcur));
895 <        if ((d < 0.99 | d > 1.01))
895 >        if ((d < 0.99) | (d > 1.01))
896                  fputexpos(d, fp);
897          d = viewaspect(&vw) * hres / vres;
898 <        if ((d < 0.99 | d > 1.01))
898 >        if ((d < 0.99) | (d > 1.01))
899                  fputaspect(d, fp);
900          fputformat(COLRFMT, fp);
901          fputc('\n', fp);                /* end header */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines