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

Comparing ray/src/px/pinterp.c (file contents):
Revision 2.17 by greg, Fri Dec 23 17:23:05 1994 UTC vs.
Revision 2.21 by greg, Mon Dec 26 21:02:31 1994 UTC

# Line 20 | Line 20 | static char SCCSid[] = "$SunId$ LBL";
20  
21   #include "resolu.h"
22  
23 + #define LOG2            0.69314718055994530942
24 +
25   #define pscan(y)        (ourpict+(y)*hresolu)
26 + #define sscan(y)        (ourspict+(y)*hresolu)
27 + #define wscan(y)        (ourweigh+(y)*hresolu)
28   #define zscan(y)        (ourzbuf+(y)*hresolu)
29 + #define averaging       (ourweigh != NULL)
30  
31 + #define MAXWT           1000.           /* maximum pixel weight (averaging) */
32 +
33   #define F_FORE          1               /* fill foreground */
34   #define F_BACK          2               /* fill background */
35  
# Line 46 | Line 53 | double pixaspect = 1.0;                /* pixel aspect ratio */
53  
54   double  zeps = .02;                     /* allowed z epsilon */
55  
56 < COLR    *ourpict;                       /* output picture */
56 > COLR    *ourpict;                       /* output picture (COLR's) */
57 > COLOR   *ourspict;                      /* output pixel sums (averaging) */
58 > float   *ourweigh = NULL;               /* output pixel weights (averaging) */
59   float   *ourzbuf;                       /* corresponding z-buffer */
60  
61   char    *progname;
# Line 56 | Line 65 | int    fillsamp = 0;                   /* sample separation (0 == inf) */
65   extern int      backfill(), rcalfill(); /* fill functions */
66   int     (*fillfunc)() = backfill;       /* selected fill function */
67   COLR    backcolr = BLKCOLR;             /* background color */
68 + COLOR   backcolor = BLKCOLOR;           /* background color (float) */
69   double  backz = 0.0;                    /* background z value */
70   int     normdist = 1;                   /* normalized distance? */
71 < double  ourexp = -1;                    /* output picture exposure */
71 > double  ourexp = -1;                    /* original picture exposure */
72 > int     expadj = 0;                     /* exposure adjustment (f-stops) */
73 > double  rexpadj = 1;                    /* real exposure adjustment */
74  
75   VIEW    theirview = STDVIEW;            /* input view */
76   int     gotview;                        /* got input view? */
77   int     wrongformat = 0;                /* input in another format? */
78   RESOLU  tresolu;                        /* input resolution */
79   double  theirexp;                       /* input picture exposure */
80 < double  theirs2ours[4][4];              /* transformation matrix */
80 > MAT4    theirs2ours;                    /* transformation matrix */
81   int     hasmatrix = 0;                  /* has transformation matrix */
82  
83   int     PDesc[3] = {-1,-1,-1};          /* rtrace process descriptor */
# Line 74 | Line 86 | unsigned short queue[PACKSIZ][2];      /* pending pixels */
86   int     packsiz;                        /* actual packet size */
87   int     queuesiz;                       /* number of pixels pending */
88  
89 + extern double   movepixel();
90  
91 +
92   main(argc, argv)                        /* interpolate pictures */
93   int     argc;
94   char    *argv[];
# Line 83 | Line 97 | char   *argv[];
97                                  badarg(argc-i-1,argv+i+1,al)) \
98                                  goto badopt
99          int     gotvfile = 0;
100 +        int     doavg = -1;
101          char    *zfile = NULL;
102 +        char    *expcomp = NULL;
103          char    *err;
104          int     i, rval;
105  
# Line 96 | Line 112 | char   *argv[];
112                          continue;
113                  }
114                  switch (argv[i][1]) {
115 +                case 'e':                               /* exposure */
116 +                        check(2,"f");
117 +                        expcomp = argv[++i];
118 +                        break;
119                  case 't':                               /* threshold */
120                          check(2,"f");
121                          zeps = atof(argv[++i]);
122                          break;
123 +                case 'a':                               /* average */
124 +                        check(2,NULL);
125 +                        doavg = 1;
126 +                        break;
127 +                case 'q':                               /* quick (no avg.) */
128 +                        check(2,NULL);
129 +                        doavg = 0;
130 +                        break;
131                  case 'n':                               /* dist. normalized? */
132                          check(2,NULL);
133                          normdist = !normdist;
# Line 129 | Line 157 | char   *argv[];
157                          case 'c':                               /* color */
158                                  check(3,"fff");
159                                  fillfunc = backfill;
160 <                                setcolr(backcolr, atof(argv[i+1]),
160 >                                setcolor(backcolor, atof(argv[i+1]),
161                                          atof(argv[i+2]), atof(argv[i+3]));
162 +                                setcolr(backcolr, colval(backcolor,RED),
163 +                                                colval(backcolor,GRN),
164 +                                                colval(backcolor,BLU));
165                                  i += 3;
166                                  break;
167                          case 'z':                               /* z value */
# Line 190 | Line 221 | char   *argv[];
221                  goto userr;
222          if (fillsamp == 1)
223                  fillo &= ~F_BACK;
224 +        if (doavg < 0)
225 +                doavg = (argc-i) > 2;
226 +        if (expcomp != NULL)
227 +                if (expcomp[0] == '+' | expcomp[0] == '-') {
228 +                        expadj = atof(expcomp) + (expcomp[0]=='+' ? .5 : -.5);
229 +                        if (doavg)
230 +                                rexpadj = pow(2.0, atof(expcomp));
231 +                        else
232 +                                rexpadj = pow(2.0, (double)expadj);
233 +                } else {
234 +                        if (!isflt(expcomp))
235 +                                goto userr;
236 +                        rexpadj = atof(expcomp);
237 +                        expadj = log(rexpadj)/LOG2 + (rexpadj>1 ? .5 : -.5);
238 +                        if (!doavg)
239 +                                rexpadj = pow(2.0, (double)expadj);
240 +                }
241                                                  /* set view */
242          if ((err = setview(&ourview)) != NULL) {
243                  fprintf(stderr, "%s: %s\n", progname, err);
# Line 197 | Line 245 | char   *argv[];
245          }
246          normaspect(viewaspect(&ourview), &pixaspect, &hresolu, &vresolu);
247                                                  /* allocate frame */
248 <        ourpict = (COLR *)bmalloc(hresolu*vresolu*sizeof(COLR));
248 >        if (doavg) {
249 >                ourspict = (COLOR *)bmalloc(hresolu*vresolu*sizeof(COLOR));
250 >                ourweigh = (float *)bmalloc(hresolu*vresolu*sizeof(float));
251 >                if (ourspict == NULL | ourweigh == NULL)
252 >                        syserror(progname);
253 >        } else {
254 >                ourpict = (COLR *)bmalloc(hresolu*vresolu*sizeof(COLR));
255 >                if (ourpict == NULL)
256 >                        syserror(progname);
257 >        }
258          ourzbuf = (float *)bmalloc(hresolu*vresolu*sizeof(float));
259 <        if (ourpict == NULL || ourzbuf == NULL)
259 >        if (ourzbuf == NULL)
260                  syserror(progname);
261          bzero((char *)ourzbuf, hresolu*vresolu*sizeof(float));
262                                                          /* new header */
# Line 223 | Line 280 | char   *argv[];
280                  fprintview(&ourview, stdout);
281                  putc('\n', stdout);
282          }
283 <        if (pixaspect < .99 || pixaspect > 1.01)
283 >        if (pixaspect < .99 | pixaspect > 1.01)
284                  fputaspect(pixaspect, stdout);
285 <        if (ourexp > 0 && (ourexp < .995 || ourexp > 1.005))
285 >        if (ourexp > 0)
286 >                ourexp *= rexpadj;
287 >        else
288 >                ourexp = rexpadj;
289 >        if (ourexp < .995 | ourexp > 1.005)
290                  fputexpos(ourexp, stdout);
291          fputformat(COLRFMT, stdout);
292          putc('\n', stdout);
# Line 238 | Line 299 | char   *argv[];
299          exit(0);
300   userr:
301          fprintf(stderr,
302 <        "Usage: %s [view opts][-t eps][-z zout][-fT][-n] pfile zspec ..\n",
302 >        "Usage: %s [view opts][-t eps][-z zout][-e spec][-a|-q][-fT][-n] pfile zspec ..\n",
303                          progname);
304          exit(1);
305   #undef check
# Line 308 | Line 369 | char   *pfile, *zspec;
369          if ((zfd = open(zspec, O_RDONLY)) == -1) {
370                  double  zvalue;
371                  register int    x;
372 <                if (!isfloat(zspec) || (zvalue = atof(zspec)) <= 0.0)
372 >                if (!isflt(zspec) || (zvalue = atof(zspec)) <= 0.0)
373                          syserror(zspec);
374                  for (x = scanlen(&tresolu); x-- > 0; )
375                          zin[x] = zvalue;
# Line 364 | Line 425 | char   *pfile, *zspec;
425  
426  
427   pixform(xfmat, vw1, vw2)                /* compute view1 to view2 matrix */
428 < register double xfmat[4][4];
428 > register MAT4   xfmat;
429   register VIEW   *vw1, *vw2;
430   {
431          double  m4t[4][4];
# Line 413 | Line 474 | struct position        *lasty;         /* input/output */
474   {
475          FVECT   pos;
476          struct position lastx, newpos;
477 +        double  wt;
478          register int    x;
479  
480          lastx.z = 0;
481          for (x = xl->max; x >= xl->min; x--) {
482                  pix2loc(pos, &tresolu, x, y);
483                  pos[2] = zline[x];
484 <                if (movepixel(pos) < 0) {
484 >                if ((wt = movepixel(pos)) <= FTINY) {
485                          lasty[x].z = lastx.z = 0;       /* mark invalid */
486                          continue;
487                  }
488 +                                        /* add pixel to our image */
489                  newpos.x = pos[0] * hresolu;
490                  newpos.y = pos[1] * vresolu;
491                  newpos.z = zline[x];
492 <                                        /* add pixel to our image */
493 <                if (pos[0] >= 0 && newpos.x < hresolu
494 <                                && pos[1] >= 0 && newpos.y < vresolu) {
495 <                        addpixel(&newpos, &lastx, &lasty[x], pline[x], pos[2]);
433 <                        lasty[x].x = lastx.x = newpos.x;
434 <                        lasty[x].y = lastx.y = newpos.y;
435 <                        lasty[x].z = lastx.z = newpos.z;
436 <                } else
437 <                        lasty[x].z = lastx.z = 0;       /* mark invalid */
492 >                addpixel(&newpos, &lastx, &lasty[x], pline[x], wt, pos[2]);
493 >                lasty[x].x = lastx.x = newpos.x;
494 >                lasty[x].y = lastx.y = newpos.y;
495 >                lasty[x].z = lastx.z = newpos.z;
496          }
497   }
498  
499  
500 < addpixel(p0, p1, p2, pix, z)            /* fill in pixel parallelogram */
500 > addpixel(p0, p1, p2, pix, w, z)         /* fill in pixel parallelogram */
501   struct position *p0, *p1, *p2;
502   COLR    pix;
503 + double  w;
504   double  z;
505   {
506          double  zt = 2.*zeps*p0->z;             /* threshold */
507 +        COLOR   pval;                           /* converted+weighted pixel */
508          int     s1x, s1y, s2x, s2y;             /* step sizes */
509          int     l1, l2, c1, c2;                 /* side lengths and counters */
510          int     p1isy;                          /* p0p1 along y? */
# Line 458 | Line 518 | double z;
518                  l1 = ABS(s1x);
519                  if (p1isy = (ABS(s1y) > l1))
520                          l1 = ABS(s1y);
521 +                else if (l1 < 1)
522 +                        l1 = 1;
523          } else {
524                  l1 = s1x = s1y = 1;
525                  p1isy = -1;
# Line 473 | Line 535 | double z;
535                          if (p1isy != 0 && ABS(s2x) > l2)
536                                  l2 = ABS(s2x);
537                  }
538 +                if (l2 < 1)
539 +                        l2 = 1;
540          } else
541                  l2 = s2x = s2y = 1;
542                                          /* fill the parallelogram */
543 +        if (averaging) {
544 +                colr_color(pval, pix);
545 +                scalecolor(pval, w);
546 +        }
547          for (c1 = l1; c1-- > 0; ) {
548                  x1 = p0->x + c1*s1x/l1;
549                  y1 = p0->y + c1*s1y/l1;
# Line 486 | Line 554 | double z;
554                          y = y1 + c2*s2y/l2;
555                          if (y < 0 || y >= vresolu)
556                                  continue;
557 <                        if (zscan(y)[x] <= 0 || zscan(y)[x]-z
557 >                        if (averaging) {
558 >                                if (zscan(y)[x] <= 0 || zscan(y)[x]-z
559                                                  > zeps*zscan(y)[x]) {
560 <                                zscan(y)[x] = z;
560 >                                        copycolor(sscan(y)[x], pval);
561 >                                        wscan(y)[x] = w;
562 >                                        zscan(y)[x] = z;
563 >                                } else if (z-zscan(y)[x] <= zeps*zscan(y)[x]) {
564 >                                        addcolor(sscan(y)[x], pval);
565 >                                        wscan(y)[x] += w;
566 >                                }
567 >                        } else if (zscan(y)[x] <= 0 || zscan(y)[x]-z
568 >                                                > zeps*zscan(y)[x]) {
569                                  copycolr(pscan(y)[x], pix);
570 +                                zscan(y)[x] = z;
571                          }
572                  }
573          }
574   }
575  
576  
577 + double
578 + movepixel(pos)                          /* reposition image point */
579 + register FVECT  pos;
580 + {
581 +        FVECT   pt, tdir, odir;
582 +        double  d;
583 +        register int    i;
584 +        
585 +        if (pos[2] <= 0)                /* empty pixel */
586 +                return(0);
587 +        if (!averaging && hasmatrix) {
588 +                pos[0] += theirview.hoff - .5;
589 +                pos[1] += theirview.voff - .5;
590 +                if (theirview.type == VT_PER) {
591 +                        if (normdist)                   /* adjust distance */
592 +                                pos[2] /= sqrt(1. + pos[0]*pos[0]*theirview.hn2
593 +                                                + pos[1]*pos[1]*theirview.vn2);
594 +                        pos[0] *= pos[2];
595 +                        pos[1] *= pos[2];
596 +                }
597 +                multp3(pos, pos, theirs2ours);
598 +                if (pos[2] <= 0)
599 +                        return(0);
600 +                if (ourview.type == VT_PER) {
601 +                        pos[0] /= pos[2];
602 +                        pos[1] /= pos[2];
603 +                }
604 +                pos[0] += .5 - ourview.hoff;
605 +                pos[1] += .5 - ourview.voff;
606 +        } else {
607 +                if (viewray(pt, tdir, &theirview, pos[0], pos[1]) < -FTINY)
608 +                        return(0);
609 +                if (!normdist && theirview.type == VT_PER)      /* adjust */
610 +                        pos[2] *= sqrt(1. + pos[0]*pos[0]*theirview.hn2
611 +                                        + pos[1]*pos[1]*theirview.vn2);
612 +                pt[0] += tdir[0]*pos[2];
613 +                pt[1] += tdir[1]*pos[2];
614 +                pt[2] += tdir[2]*pos[2];
615 +                viewloc(pos, &ourview, pt);
616 +                if (pos[2] <= 0)
617 +                        return(0);
618 +        }
619 +        if (pos[0] < 0 || pos[0] >= 1-FTINY || pos[1] < 0 || pos[1] >= 1-FTINY)
620 +                return(0);
621 +        if (!averaging)
622 +                return(1);
623 +        if (ourview.type == VT_PAR)             /* compute our direction */
624 +                VCOPY(odir, ourview.vdir);
625 +        else
626 +                for (i = 0; i < 3; i++)
627 +                        odir[i] = (pt[i] - ourview.vp[i])/pos[2];
628 +        d = DOT(odir,tdir);                     /* compute pixel weight */
629 +        if (d >= 1.-1./MAXWT/MAXWT)
630 +                return(MAXWT);          /* clip to maximum weight */
631 +        return(1./sqrt(1.-d));
632 + }
633 +
634 +
635   getperim(xl, yl, zline, zfd)            /* compute overlapping image area */
636   register struct bound   *xl;
637   struct bound    *yl;
# Line 535 | Line 671 | int    zfd;
671                  for (x = scanlen(&tresolu); (x -= step) > 0; ) {
672                          pix2loc(pos, &tresolu, x, y);
673                          pos[2] = zline[x];
674 <                        if (movepixel(pos) == 0 && pos[0] >= 0 &&
539 <                                        pos[0] < 1 && pos[1] >= 0 &&
540 <                                        pos[1] < 1) {
674 >                        if (movepixel(pos) > FTINY) {
675                                  xl[y].max = x + step - 1;
676                                  xl[y].min = x - step + 1;       /* x min */
677                                  if (xl[y].min < 0)
# Line 545 | Line 679 | int    zfd;
679                                  for (x = step - 1; x < xl[y].max; x += step) {
680                                          pix2loc(pos, &tresolu, x, y);
681                                          pos[2] = zline[x];
682 <                                        if (movepixel(pos) == 0 &&
549 <                                                        pos[0] >= 0 &&
550 <                                                        pos[0] < 1 &&
551 <                                                        pos[1] >= 0 &&
552 <                                                        pos[1] < 1) {
682 >                                        if (movepixel(pos) > FTINY) {
683                                                  xl[y].min = x - step + 1;
684                                                  break;
685                                          }
# Line 561 | Line 691 | int    zfd;
691                          }
692                  }
693                                                          /* fill in between */
694 <                if (xl[y].min < xl[y-step].min)
694 >                if (y < step) {
695                          xl[y-1].min = xl[y].min;
566                else
567                        xl[y-1].min = xl[y-step].min;
568                if (xl[y].max > xl[y-step].max)
696                          xl[y-1].max = xl[y].max;
697 <                else
698 <                        xl[y-1].max = xl[y-step].max;
697 >                } else {
698 >                        if (xl[y].min < xl[y-step].min)
699 >                                xl[y-1].min = xl[y].min;
700 >                        else
701 >                                xl[y-1].min = xl[y-step].min;
702 >                        if (xl[y].max > xl[y-step].max)
703 >                                xl[y-1].max = xl[y].max;
704 >                        else
705 >                                xl[y-1].max = xl[y-step].max;
706 >                }
707                  for (x = 2; x < step; x++)
708                          copystruct(xl+y-x, xl+y-1);
709          }
710          if (yl->max >= numscans(&tresolu))
711                  yl->max = numscans(&tresolu) - 1;
712 +        y -= step;
713          for (x = numscans(&tresolu) - 1; x > y; x--)    /* fill bottom rows */
714                  copystruct(xl+x, xl+y);
715          return(yl->max >= yl->min);
716   }
717  
718  
583 movepixel(pos)                          /* reposition image point */
584 FVECT   pos;
585 {
586        double  d0, d1;
587        FVECT   pt, direc;
588        
589        if (pos[2] <= 0)                /* empty pixel */
590                return(-1);
591        if (normdist && theirview.type == VT_PER) {     /* adjust distance */
592                d0 = pos[0] + theirview.hoff - .5;
593                d1 = pos[1] + theirview.voff - .5;
594                pos[2] /= sqrt(1. + d0*d0*theirview.hn2 + d1*d1*theirview.vn2);
595        }
596        if (hasmatrix) {
597                pos[0] += theirview.hoff - .5;
598                pos[1] += theirview.voff - .5;
599                if (theirview.type == VT_PER) {
600                        pos[0] *= pos[2];
601                        pos[1] *= pos[2];
602                }
603                multp3(pos, pos, theirs2ours);
604                if (pos[2] <= 0)
605                        return(-1);
606                if (ourview.type == VT_PER) {
607                        pos[0] /= pos[2];
608                        pos[1] /= pos[2];
609                }
610                pos[0] += .5 - ourview.hoff;
611                pos[1] += .5 - ourview.voff;
612                return(0);
613        }
614        if (viewray(pt, direc, &theirview, pos[0], pos[1]) < -FTINY)
615                return(-1);
616        pt[0] += direc[0]*pos[2];
617        pt[1] += direc[1]*pos[2];
618        pt[2] += direc[2]*pos[2];
619        viewloc(pos, &ourview, pt);
620        if (pos[2] <= 0)
621                return(-1);
622        return(0);
623 }
624
625
719   backpicture(fill, samp)                 /* background fill algorithm */
720   int     (*fill)();
721   int     samp;
# Line 693 | Line 786 | int    samp;
786                                                  < zscan(y)[xback] ) ) {
787                                          if (samp > 0 && ABS(x-xback) >= samp)
788                                                  goto fillit;
789 <                                        copycolr(pscan(y)[x],pscan(y)[xback]);
789 >                                        if (averaging) {
790 >                                                copycolor(sscan(y)[x],
791 >                                                        sscan(y)[xback]);
792 >                                                wscan(y)[x] = wscan(y)[xback];
793 >                                        } else
794 >                                                copycolr(pscan(y)[x],
795 >                                                        pscan(y)[xback]);
796                                          zscan(y)[x] = zscan(y)[xback];
797                                  } else {
798                                          if (samp > 0 && ABS(y-yback[x]) > samp)
799                                                  goto fillit;
800 <                                        copycolr(pscan(y)[x],pscan(yback[x])[x]);
800 >                                        if (averaging) {
801 >                                                copycolor(sscan(y)[x],
802 >                                                        sscan(yback[x])[x]);
803 >                                                wscan(y)[x] =
804 >                                                        wscan(yback[x])[x];
805 >                                        } else
806 >                                                copycolr(pscan(y)[x],
807 >                                                        pscan(yback[x])[x]);
808                                          zscan(y)[x] = zscan(yback[x])[x];
809                                  }
810                                  continue;
# Line 754 | Line 860 | clipaft()                      /* perform aft clipping as indicated */
860                                                  sqrt(vx*vx*ourview.hn2 + yzn2))
861                                                  continue;
862                                  }
863 <                                bzero(pscan(y)[x], sizeof(COLR));
863 >                                if (averaging)
864 >                                        bzero(sscan(y)[x], sizeof(COLOR));
865 >                                else
866 >                                        bzero(pscan(y)[x], sizeof(COLR));
867                                  zscan(y)[x] = 0.0;
868                          }
869          }
870   }
871  
872  
873 < writepicture()                          /* write out picture */
873 > writepicture()                          /* write out picture (alters buffer) */
874   {
875          int     y;
876 +        register int    x;
877 +        double  d;
878  
879          fprtresolu(hresolu, vresolu, stdout);
880          for (y = vresolu-1; y >= 0; y--)
881 <                if (fwritecolrs(pscan(y), hresolu, stdout) < 0)
882 <                        syserror(progname);
881 >                if (averaging) {
882 >                        for (x = 0; x < hresolu; x++) { /* average pixels */
883 >                                d = rexpadj/wscan(y)[x];
884 >                                scalecolor(sscan(y)[x], d);
885 >                        }
886 >                        if (fwritescan(sscan(y), hresolu, stdout) < 0)
887 >                                syserror(progname);
888 >                } else {
889 >                        if (expadj)
890 >                                shiftcolrs(pscan(y), hresolu, expadj);
891 >                        if (fwritecolrs(pscan(y), hresolu, stdout) < 0)
892 >                                syserror(progname);
893 >                }
894   }
895  
896  
897   writedistance(fname)                    /* write out z file */
898   char    *fname;
899   {
900 <        int     donorm = normdist && ourview.type == VT_PER;
900 >        int     donorm = normdist && ourview.type == VT_PER &&
901 >                        !averaging && hasmatrix;
902          int     fd;
903          int     y;
904          float   *zout;
# Line 808 | Line 931 | char   *fname;
931   }
932  
933  
811 isfloat(s)                              /* see if string is floating number */
812 register char   *s;
813 {
814        for ( ; *s; s++)
815                if ((*s < '0' || *s > '9') && *s != '.' && *s != '-'
816                                && *s != 'e' && *s != 'E' && *s != '+')
817                        return(0);
818        return(1);
819 }
820
821
934   backfill(x, y)                          /* fill pixel with background */
935   int     x, y;
936   {
937 <        register BYTE   *dest = pscan(y)[x];
938 <
939 <        copycolr(dest, backcolr);
937 >        if (averaging) {
938 >                copycolor(sscan(y)[x], backcolor);
939 >                wscan(y)[x] = 1;
940 >        } else
941 >                copycolr(pscan(y)[x], backcolr);
942          zscan(y)[x] = backz;
943   }
944  
# Line 924 | Line 1038 | clearqueue()                           /* process queue */
1038                          fbp[1] *= ourexp;
1039                          fbp[2] *= ourexp;
1040                  }
1041 <                setcolr(pscan(queue[i][1])[queue[i][0]],
1042 <                                fbp[0], fbp[1], fbp[2]);
1041 >                if (averaging) {
1042 >                        setcolor(sscan(queue[i][1])[queue[i][0]],
1043 >                                        fbp[0], fbp[1], fbp[2]);
1044 >                        wscan(queue[i][1])[queue[i][0]] = 1;
1045 >                } else
1046 >                        setcolr(pscan(queue[i][1])[queue[i][0]],
1047 >                                        fbp[0], fbp[1], fbp[2]);
1048                  zscan(queue[i][1])[queue[i][0]] = fbp[3];
1049                  fbp += 4;
1050          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines