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.42 by greg, Tue Jan 18 03:59:41 2005 UTC vs.
Revision 2.49 by greg, Fri Feb 28 05:18:49 2020 UTC

# Line 134 | Line 134 | main(                  /* interpolate pictures */
134          char    *expcomp = NULL;
135          int     i, an, rval;
136  
137 +        SET_DEFAULT_BINARY();
138 +        SET_FILE_BINARY(stdout);
139 +
140          progname = argv[0];
141  
142          for (an = 1; an < argc && argv[an][0] == '-'; an++) {
# Line 358 | Line 361 | headline(                              /* process header string */
361          void    *p
362   )
363   {
364 <        char    fmt[32];
364 >        char    fmt[MAXFMTLEN];
365  
366          if (isheadid(s))
367                  return(0);
# Line 391 | Line 394 | nextview(                              /* get and set next view */
394   {
395          char    linebuf[256];
396          char    *err;
397 <        register int    i;
397 >        int     i;
398  
399          if (fp != NULL) {
400                  do                      /* get new view */
# Line 428 | Line 431 | nextview(                              /* get and set next view */
431   static void
432   compavgview(void)                               /* compute average view */
433   {
434 <        register int    i;
434 >        int     i;
435          double  f;
436  
437          if (nvavg < 2)
# Line 494 | Line 497 | addpicture(            /* add picture to output */
497          zin = (float *)malloc(scanlen(&tresolu)*sizeof(float));
498          if (zin == NULL)
499                  syserror(progname);
500 <        if ((zfd = open(zspec, O_RDONLY)) == -1) {
500 >        if ((zfd = open_float_depth(zspec, (long)tresolu.xr*tresolu.yr)) < 0) {
501                  double  zvalue;
502 <                register int    x;
502 >                int     x;
503                  if (!isflt(zspec) || (zvalue = atof(zspec)) <= 0.0)
504                          syserror(zspec);
505                  for (x = scanlen(&tresolu); x-- > 0; )
# Line 555 | Line 558 | addpicture(            /* add picture to output */
558  
559   static int
560   pixform(                /* compute view1 to view2 matrix */
561 <        register MAT4   xfmat,
562 <        register VIEW   *vw1,
563 <        register VIEW   *vw2
561 >        MAT4    xfmat,
562 >        VIEW    *vw1,
563 >        VIEW    *vw2
564   )
565   {
566 <        double  m4t[4][4];
566 >        MAT4    m4t;
567  
568          if ((vw1->type != VT_PER) & (vw1->type != VT_PAR))
569                  return(0);
# Line 609 | Line 612 | addscanline(   /* add scanline to output */
612          FVECT   pos;
613          struct position lastx, newpos;
614          double  wt;
615 <        register int    x;
615 >        int     x;
616  
617          lastx.z = 0;
618          for (x = xl->max; x >= xl->min; x--) {
# Line 647 | Line 650 | addpixel(              /* fill in pixel parallelogram */
650          int     l1, l2, c1, c2;                 /* side lengths and counters */
651          int     p1isy;                          /* p0p1 along y? */
652          int     x1, y1;                         /* p1 position */
653 <        register int    x, y;                   /* final position */
653 >        int     x, y;                   /* final position */
654  
655                                          /* compute vector p0p1 */
656          if (fillo&F_FORE && ABS(p1->z-p0->z) <= zt) {
# Line 714 | Line 717 | addpixel(              /* fill in pixel parallelogram */
717  
718   static double
719   movepixel(                              /* reposition image point */
720 <        register FVECT  pos
720 >        FVECT   pos
721   )
722   {
723          FVECT   pt, tdir, odir;
# Line 750 | Line 753 | movepixel(                             /* reposition image point */
753                  if (viewray(pt, tdir, &theirview, pos[0], pos[1]) < -FTINY)
754                          return(0);
755                  if ((!normdist) & (theirview.type == VT_PER))   /* adjust */
756 <                        pos[2] *= sqrt(1. + pos[0]*pos[0]*theirview.hn2
754 <                                        + pos[1]*pos[1]*theirview.vn2);
756 >                        pos[2] /= DOT(theirview.vdir, tdir);
757                  pt[0] += tdir[0]*pos[2];
758                  pt[1] += tdir[1]*pos[2];
759                  pt[2] += tdir[2]*pos[2];
760 <                viewloc(pos, &ourview, pt);
759 <                if (pos[2] <= 0)
760 >                if (viewloc(pos, &ourview, pt) <= 0)
761                          return(0);
762          }
763          if ((pos[0] < 0) | (pos[0] >= 1-FTINY) | (pos[1] < 0) | (pos[1] >= 1-FTINY))
# Line 780 | Line 781 | movepixel(                             /* reposition image point */
781  
782   static int
783   getperim(               /* compute overlapping image area */
784 <        register struct bound   *xl,
784 >        struct bound    *xl,
785          struct bound    *yl,
786          float   *zline,
787          int     zfd
# Line 788 | Line 789 | getperim(              /* compute overlapping image area */
789   {
790          int     step;
791          FVECT   pos;
792 <        register int    x, y;
792 >        int     x, y;
793                                                  /* set up step size */
794          if (scanlen(&tresolu) < numscans(&tresolu))
795                  step = scanlen(&tresolu)/NSTEPS;
# Line 872 | Line 873 | backpicture(                   /* background fill algorithm */
873   {
874          int     *yback, xback;
875          int     y;
876 <        register int    x, i;
876 >        int     x, i;
877                                                          /* get back buffer */
878          yback = (int *)malloc(hresolu*sizeof(int));
879          if (yback == NULL)
# Line 979 | Line 980 | fillpicture(           /* paint in empty pixels using fill */
980          fillfunc_t *fill
981   )
982   {
983 <        register int    x, y;
983 >        int     x, y;
984  
985          for (y = 0; y < vresolu; y++)
986                  for (x = 0; x < hresolu; x++)
# Line 993 | Line 994 | fillpicture(           /* paint in empty pixels using fill */
994   static int
995   clipaft(void)                   /* perform aft clipping as indicated */
996   {
997 <        register int    x, y;
997 >        int     x, y;
998          int     adjtest = (ourview.type == VT_PER) & zisnorm;
999          double  tstdist;
1000          double  yzn2, vx;
# Line 1032 | Line 1033 | addblur(void)                          /* add to blurred picture */
1033   {
1034          COLOR   cval;
1035          double  d;
1036 <        register int    i;
1036 >        int     i;
1037  
1038          if (!blurring)
1039                  return(0);
# Line 1072 | Line 1073 | static void
1073   writepicture(void)                              /* write out picture (alters buffer) */
1074   {
1075          int     y;
1076 <        register int    x;
1076 >        int     x;
1077          double  d;
1078  
1079          fprtresolu(hresolu, vresolu, stdout);
# Line 1115 | Line 1116 | writedistance(                 /* write out z file (alters buffer) *
1116          for (y = vresolu-1; y >= 0; y--) {
1117                  if (donorm) {
1118                          double  vx, yzn2, d;
1119 <                        register int    x;
1119 >                        int     x;
1120                          yzn2 = (y+.5)/vresolu + ourview.voff - .5;
1121                          yzn2 = 1. + yzn2*yzn2*ourview.vn2;
1122                          for (x = 0; x < hresolu; x++) {
# Line 1159 | Line 1160 | calstart(                    /* start fill calculation
1160          char    combuf[512];
1161          char    *argv[64];
1162          int     rval;
1163 <        register char   **wp, *cp;
1163 >        char    **wp, *cp;
1164  
1165 <        if (PDesc.running) {
1165 >        if (PDesc.flags & PF_RUNNING) {
1166                  fprintf(stderr, "%s: too many calculations\n", progname);
1167                  exit(1);
1168          }
# Line 1196 | Line 1197 | calstart(                    /* start fill calculation
1197   static void
1198   caldone(void)                               /* done with calculation */
1199   {
1200 <        if (!PDesc.running)
1200 >        if (!(PDesc.flags & PF_RUNNING))
1201                  return;
1202          clearqueue();
1203          close_process(&PDesc);
# Line 1223 | Line 1224 | clearqueue(void)                               /* process queue */
1224   {
1225          FVECT   orig, dir;
1226          float   fbuf[6*(PACKSIZ+1)];
1227 <        register float  *fbp;
1228 <        register int    i;
1227 >        float   *fbp;
1228 >        int     i;
1229          double  vx, vy;
1230  
1231          if (queuesiz == 0)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines