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.32 by gwlarson, Fri Jul 16 16:11:31 1999 UTC vs.
Revision 2.35 by schorsch, Mon Jun 30 14:59:12 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1999 Silicon Graphics, Inc. */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ SGI";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   * Interpolate and extrapolate pictures with different view parameters.
6   *
7   *      Greg Ward       09Dec89
8   */
9  
10 < #include "standard.h"
10 > #include "copyright.h"
11  
12   #include <ctype.h>
13 + #include <string.h>
14  
15 + #include "standard.h"
16 + #include "rtprocess.h" /* Windows: must come before color.h */
17   #include "view.h"
18
18   #include "color.h"
19  
21 #include "resolu.h"
22
20   #define LOG2            0.69314718055994530942
21  
22   #define pscan(y)        (ourpict+(y)*hresolu)
# Line 89 | Line 86 | double theirexp;                       /* input picture exposure */
86   MAT4    theirs2ours;                    /* transformation matrix */
87   int     hasmatrix = 0;                  /* has transformation matrix */
88  
89 < int     PDesc[3] = {-1,-1,-1};          /* rtrace process descriptor */
93 < #define childpid        (PDesc[2])
89 > static SUBPROC PDesc = SP_INACTIVE; /* rtrace process descriptor */
90   unsigned short  queue[PACKSIZ][2];      /* pending pixels */
91   int     packsiz;                        /* actual packet size */
92   int     queuesiz = 0;                   /* number of pixels pending */
# Line 213 | Line 209 | char   *argv[];
209                          if (argv[an][2] != 'f')
210                                  goto badopt;
211                          check(3,"s");
212 <                        gotvfile = viewfile(argv[++an], &ourview, 0, 0);
212 >                        gotvfile = viewfile(argv[++an], &ourview, NULL);
213                          if (gotvfile < 0)
214                                  syserror(argv[an]);
215                          else if (gotvfile == 0) {
# Line 279 | Line 275 | char   *argv[];
275                  syserror(progname);
276                                                          /* new header */
277          newheader("RADIANCE", stdout);
278 +        fputnow(stdout);
279                                                          /* run pictures */
280          do {
281 <                bzero((char *)ourzbuf, hresolu*vresolu*sizeof(float));
281 >                memset((char *)ourzbuf, '\0', hresolu*vresolu*sizeof(float));
282                  for (i = an; i < argc; i += 2)
283                          addpicture(argv[i], argv[i+1]);
284                  if (fillo&F_BACK)                       /* fill in spaces */
# Line 473 | Line 470 | char   *pfile, *zspec;
470          if (xlim == NULL)
471                  syserror(progname);
472          if (!getperim(xlim, &ylim, zin, zfd)) { /* overlapping area? */
473 <                free((char *)zin);
474 <                free((char *)xlim);
473 >                free((void *)zin);
474 >                free((void *)xlim);
475                  if (zfd != -1)
476                          close(zfd);
477                  fclose(pfp);
# Line 493 | Line 490 | char   *pfile, *zspec;
490                          exit(1);
491                  }
492          if (zfd != -1 && lseek(zfd,
493 <                        (long)ylim.min*scanlen(&tresolu)*sizeof(float), 0) < 0)
493 >                        (off_t)ylim.min*scanlen(&tresolu)*sizeof(float), 0) < 0)
494                  syserror(zspec);
495                                          /* load image */
496          for (y = ylim.min; y <= ylim.max; y++) {
# Line 508 | Line 505 | char   *pfile, *zspec;
505                  addscanline(xlim+y, y, scanin, zin, plast);
506          }
507                                          /* clean up */
508 <        free((char *)xlim);
509 <        free((char *)scanin);
510 <        free((char *)zin);
511 <        free((char *)plast);
508 >        free((void *)xlim);
509 >        free((void *)scanin);
510 >        free((void *)zin);
511 >        free((void *)plast);
512          fclose(pfp);
513          if (zfd != -1)
514                  close(zfd);
# Line 760 | Line 757 | int    zfd;
757          yl->min = 32000; yl->max = 0;           /* search for points on image */
758          for (y = step - 1; y < numscans(&tresolu); y += step) {
759                  if (zfd != -1) {
760 <                        if (lseek(zfd, (long)y*scanlen(&tresolu)*sizeof(float),
760 >                        if (lseek(zfd, (off_t)y*scanlen(&tresolu)*sizeof(float),
761                                          0) < 0)
762                                  syserror("lseek");
763                          if (read(zfd, (char *)zline,
# Line 921 | Line 918 | int    samp;
918                                  xback = -2;
919                          }
920          }
921 <        free((char *)yback);
921 >        free((void *)yback);
922   }
923  
924  
# Line 965 | Line 962 | clipaft()                      /* perform aft clipping as indicated */
962                                                  continue;
963                                  }
964                                  if (averaging)
965 <                                        bzero(sscan(y)[x], sizeof(COLOR));
965 >                                        memset(sscan(y)[x], '\0', sizeof(COLOR));
966                                  else
967 <                                        bzero(pscan(y)[x], sizeof(COLR));
967 >                                        memset(pscan(y)[x], '\0', sizeof(COLR));
968                                  zscan(y)[x] = 0.0;
969                          }
970          }
# Line 1099 | Line 1096 | char   *prog, *args;
1096          int     rval;
1097          register char   **wp, *cp;
1098  
1099 <        if (childpid != -1) {
1099 >        if (PDesc.running) {
1100                  fprintf(stderr, "%s: too many calculations\n", progname);
1101                  exit(1);
1102          }
# Line 1118 | Line 1115 | char   *prog, *args;
1115          }
1116          *wp = NULL;
1117                                                  /* start process */
1118 <        if ((rval = open_process(PDesc, argv)) < 0)
1118 >        if ((rval = open_process(&PDesc, argv)) < 0)
1119                  syserror(progname);
1120          if (rval == 0) {
1121                  fprintf(stderr, "%s: command not found\n", argv[0]);
# Line 1133 | Line 1130 | char   *prog, *args;
1130  
1131   caldone()                               /* done with calculation */
1132   {
1133 <        if (childpid == -1)
1133 >        if (!PDesc.running)
1134                  return;
1135          clearqueue();
1136 <        close_process(PDesc);
1140 <        childpid = -1;
1136 >        close_process(&PDesc);
1137   }
1138  
1139  
# Line 1172 | Line 1168 | clearqueue()                           /* process queue */
1168                  *fbp++ = dir[0]; *fbp++ = dir[1]; *fbp++ = dir[2];
1169          }
1170                                          /* mark end and get results */
1171 <        bzero((char *)fbp, 6*sizeof(float));
1172 <        if (process(PDesc, fbuf, fbuf, 4*sizeof(float)*(queuesiz+1),
1171 >        memset((char *)fbp, '\0', 6*sizeof(float));
1172 >        if (process(&PDesc, (char *)fbuf, (char *)fbuf,
1173 >                        4*sizeof(float)*(queuesiz+1),
1174                          6*sizeof(float)*(queuesiz+1)) !=
1175                          4*sizeof(float)*(queuesiz+1)) {
1176                  fprintf(stderr, "%s: error reading from rtrace process\n",

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines