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 1.33 by greg, Thu Apr 18 14:35:26 1991 UTC vs.
Revision 1.34 by greg, Mon Nov 11 14:01:57 1991 UTC

# Line 1 | Line 1
1 + /* Copyright (c) 1991 Regents of the University of California */
2 +
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
5   #endif
# Line 16 | Line 18 | static char SCCSid[] = "$SunId$ LBL";
18  
19   #include "color.h"
20  
21 + #include "resolu.h"
22 +
23   #ifndef BSD
24   #define vfork           fork
25   #endif
# Line 58 | Line 62 | double ourexp = -1;                    /* output picture exposure */
62   VIEW    theirview = STDVIEW;            /* input view */
63   int     gotview;                        /* got input view? */
64   int     wrongformat = 0;                /* input in another format? */
65 < int     thresolu, tvresolu;             /* input resolution */
65 > RESOLU  tresolu;                        /* input resolution */
66   double  theirexp;                       /* input picture exposure */
67   double  theirs2ours[4][4];              /* transformation matrix */
68   int     hasmatrix = 0;                  /* has transformation matrix */
# Line 279 | Line 283 | char   *pfile, *zspec;
283          gotview = 0;
284          printf("%s:\n", pfile);
285          getheader(pfp, headline, NULL);
286 <        if (wrongformat || !gotview ||
283 <                fgetresolu(&thresolu, &tvresolu, pfp) != (YMAJOR|YDECR)) {
284 <
286 >        if (wrongformat || !gotview || !fgetsresolu(&tresolu, pfp)) {
287                  fprintf(stderr, "%s: picture format error\n", pfile);
288                  exit(1);
289          }
# Line 296 | Line 298 | char   *pfile, *zspec;
298                                          /* compute transformation */
299          hasmatrix = pixform(theirs2ours, &theirview, &ourview);
300                                          /* allocate scanlines */
301 <        scanin = (COLR *)malloc(thresolu*sizeof(COLR));
302 <        zin = (float *)malloc(thresolu*sizeof(float));
303 <        plast = (struct position *)calloc(thresolu, sizeof(struct position));
301 >        scanin = (COLR *)malloc(scanlen(&tresolu)*sizeof(COLR));
302 >        zin = (float *)malloc(scanlen(&tresolu)*sizeof(float));
303 >        plast = (struct position *)calloc(scanlen(&tresolu),
304 >                        sizeof(struct position));
305          if (scanin == NULL || zin == NULL || plast == NULL)
306                  syserror();
307                                          /* get z specification or file */
# Line 309 | Line 312 | char   *pfile, *zspec;
312                          perror(zspec);
313                          exit(1);
314                  }
315 <                for (x = 0; x < thresolu; x++)
315 >                for (x = scanlen(&tresolu); x-- > 0; )
316                          zin[x] = zvalue;
317          }
318                                          /* load image */
319 <        for (y = tvresolu-1; y >= 0; y--) {
320 <                if (freadcolrs(scanin, thresolu, pfp) < 0) {
319 >        for (y = 0; y < numscans(&tresolu); y++) {
320 >                if (freadcolrs(scanin, scanlen(&tresolu), pfp) < 0) {
321                          fprintf(stderr, "%s: read error\n", pfile);
322                          exit(1);
323                  }
324 <                if (zfd != -1 && read(zfd,(char *)zin,thresolu*sizeof(float))
325 <                                < thresolu*sizeof(float)) {
324 >                if (zfd != -1 && read(zfd,(char *)zin,
325 >                                scanlen(&tresolu)*sizeof(float))
326 >                                < scanlen(&tresolu)*sizeof(float)) {
327                          fprintf(stderr, "%s: read error\n", zspec);
328                          exit(1);
329                  }
# Line 388 | Line 392 | struct position        *lasty;         /* input/output */
392          register int    x;
393  
394          lastx.z = 0;
395 <        for (x = thresolu-1; x >= 0; x--) {
396 <                pos[0] = (x+.5)/thresolu;
393 <                pos[1] = (y+.5)/tvresolu;
395 >        for (x = scanlen(&tresolu); x-- > 0; ) {
396 >                pix2loc(pos, &tresolu, x, y);
397                  pos[2] = zline[x];
398                  if (movepixel(pos) < 0) {
399                          lasty[x].z = lastx.z = 0;       /* mark invalid */
# Line 503 | Line 506 | FVECT  pos;
506          pt[0] += direc[0]*pos[2];
507          pt[1] += direc[1]*pos[2];
508          pt[2] += direc[2]*pos[2];
509 <        viewpixel(&pos[0], &pos[1], &pos[2], &ourview, pt);
509 >        viewloc(pos, &ourview, pt);
510          if (pos[2] <= 0)
511                  return(-1);
512          return(0);
# Line 621 | Line 624 | writepicture()                         /* write out picture */
624   {
625          int     y;
626  
627 <        fputresolu(YMAJOR|YDECR, hresolu, vresolu, stdout);
627 >        fprtresolu(hresolu, vresolu, stdout);
628          for (y = vresolu-1; y >= 0; y--)
629                  if (fwritecolrs(pscan(y), hresolu, stdout) < 0)
630                          syserror();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines