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

Comparing ray/src/px/pcond4.c (file contents):
Revision 3.8 by greg, Tue Oct 8 12:48:00 1996 UTC vs.
Revision 3.9 by greg, Thu Oct 10 16:36:39 1996 UTC

# Line 241 | Line 241 | int    y;
241          register int    x;
242                                          /* compute foveal y position */
243          iy = dy = (y+.5)/numscans(&inpres)*fvyr - .5;
244 <        if (iy >= fvyr-1) iy--;
244 >        while (iy >= fvyr-1) iy--;
245          dy -= (double)iy;
246          for (x = 0; x < scanlen(&inpres); x++) {
247                                          /* compute foveal x position */
248                  ix = dx = (x+.5)/scanlen(&inpres)*fvxr - .5;
249 <                if (ix >= fvxr-1) ix--;
249 >                while (ix >= fvxr-1) ix--;
250                  dx -= (double)ix;
251                                          /* interpolate sample rate */
252                  sr = (1.-dy)*((1.-dx)*tsampr(ix,iy) + dx*tsampr(ix+1,iy)) +
# Line 302 | Line 302 | SCANBAR        *sb;
302          dy -= (double)iy;
303                                          /* get scanlines */
304          sl0 = getascan(sb, iy);
305 + #ifdef DEBUG
306          if (sl0 == NULL) {
307                  fprintf(stderr, "%s: internal - cannot backspace in ascanval\n",
308                                  progname);
309 <                exit(1);
309 >                abort();
310          }
311 + #endif
312          sl1 = getascan(sb, iy+1);
313                                          /* 2D linear interpolation */
314          copycolor(col, sl0[ix]);
# Line 322 | Line 324 | SCANBAR        *sb;
324          scalecolor(col, 1.-dy);
325          scalecolor(c1y, dy);
326          addcolor(col, c1y);
327 +        for (ix = 0; ix < 3; ix++)      /* make sure no negative */
328 +                if (colval(col,ix) < 0.)
329 +                        colval(col,ix) = 0.;
330   }
331  
332  
333   SCANBAR *
334 < sballoc(sr, ns, sl)             /* allocate scanbar */
335 < int     sr;             /* sampling rate */
334 > sballoc(se, ns, sl)             /* allocate scanbar */
335 > int     se;             /* sampling rate exponent */
336   int     ns;             /* number of scanlines */
337   int     sl;             /* original scanline length */
338   {
339          SCANBAR *sbarr;
340          register SCANBAR        *sb;
341  
342 <        sbarr = sb = (SCANBAR *)malloc((sr+1)*sizeof(SCANBAR));
342 >        sbarr = sb = (SCANBAR *)malloc((se+1)*sizeof(SCANBAR));
343          if (sb == NULL)
344                  syserror("malloc");
345          do {
346 <                sb->sdata = (COLOR *)malloc((sl>>sr)*ns*sizeof(COLOR));
346 >                sb->sampe = se;
347 >                sb->len = sl>>se;
348 >                sb->nscans = ns;
349 >                sb->sdata = (COLOR *)malloc(sb->len*ns*sizeof(COLOR));
350                  if (sb->sdata == NULL)
351                          syserror("malloc");
344                sb->sampe = sr;
345                sb->nscans = ns;
346                sb->len = sl>>sr;
352                  sb->nread = 0;
353                  ns <<= 1;
354                  sb++;
355 <        } while (--sr >= 0);
355 >        } while (--se >= 0);
356          return(sbarr);
357   }
358  
# Line 388 | Line 393 | initacuity()                   /* initialize variable acuity sampling
393                  tsampr(x,fvyr-1) = tsampr(x,fvyr-2);
394          }
395          for (y = 0; y < fvyr; y++) {
396 <                tsampr(y,0) = tsampr(y,1);
397 <                tsampr(y,fvxr-1) = tsampr(y,fvxr-2);
396 >                tsampr(0,y) = tsampr(1,y);
397 >                tsampr(fvxr-1,y) = tsampr(fvxr-2,y);
398          }
399                                          /* initialize with next power of two */
400          rootbar = sballoc((int)(log(maxsr)/log(2.))+1, 2, scanlen(&inpres));

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines