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.36 by schorsch, Mon Jul 21 22:30:18 2003 UTC vs.
Revision 2.38 by greg, Mon Oct 20 16:01:55 2003 UTC

# Line 13 | Line 13 | static const char      RCSid[] = "$Id$";
13   #include <string.h>
14  
15   #include "standard.h"
16 + #include "platform.h"
17   #include "rtprocess.h" /* Windows: must come before color.h */
18   #include "view.h"
19   #include "color.h"
# Line 27 | Line 28 | static const char      RCSid[] = "$Id$";
28   #define averaging       (ourweigh != NULL)
29   #define blurring        (ourbpict != NULL)
30   #define usematrix       (hasmatrix & !averaging)
31 < #define zisnorm         (!usematrix | ourview.type != VT_PER)
31 > #define zisnorm         ((!usematrix) | (ourview.type != VT_PER))
32  
33   #define MAXWT           1000.           /* maximum pixel weight (averaging) */
34  
# Line 233 | Line 234 | char   *argv[];
234          if (doavg < 0)
235                  doavg = (argc-an) > 2;
236          if (expcomp != NULL) {
237 <                if (expcomp[0] == '+' | expcomp[0] == '-') {
237 >                if ((expcomp[0] == '+') | (expcomp[0] == '-')) {
238                          expadj = atof(expcomp) + (expcomp[0]=='+' ? .5 : -.5);
239                          if (doavg | doblur)
240                                  rexpadj = pow(2.0, atof(expcomp));
# Line 259 | Line 260 | char   *argv[];
260          if (doavg) {
261                  ourspict = (COLOR *)bmalloc(hresolu*vresolu*sizeof(COLOR));
262                  ourweigh = (float *)bmalloc(hresolu*vresolu*sizeof(float));
263 <                if (ourspict == NULL | ourweigh == NULL)
263 >                if ((ourspict == NULL) | (ourweigh == NULL))
264                          syserror(progname);
265          } else {
266                  ourpict = (COLR *)bmalloc(hresolu*vresolu*sizeof(COLR));
# Line 299 | Line 300 | char   *argv[];
300                  fprintview(&avgview, stdout);
301                  putc('\n', stdout);
302          }
303 <        if (pixaspect < .99 | pixaspect > 1.01)
303 >        if ((pixaspect < .99) | (pixaspect > 1.01))
304                  fputaspect(pixaspect, stdout);
305          if (ourexp > 0)
306                  ourexp *= rexpadj;
307          else
308                  ourexp = rexpadj;
309 <        if (ourexp < .995 | ourexp > 1.005)
309 >        if ((ourexp < .995) | (ourexp > 1.005))
310                  fputexpos(ourexp, stdout);
311          if (strcmp(ourfmt, PICFMT))             /* print format if known */
312                  fputformat(ourfmt, stdout);
# Line 448 | Line 449 | char   *pfile, *zspec;
449                  ourexp = theirexp;
450          else if (ABS(theirexp-ourexp) > .01*ourexp)
451                  fprintf(stderr, "%s: different exposure (warning)\n", pfile);
452 <        if (err = setview(&theirview)) {
452 >        if ( (err = setview(&theirview)) ) {
453                  fprintf(stderr, "%s: %s\n", pfile, err);
454                  exit(1);
455          }
# Line 482 | Line 483 | char   *pfile, *zspec;
483          scanin = (COLR *)malloc(scanlen(&tresolu)*sizeof(COLR));
484          plast = (struct position *)calloc(scanlen(&tresolu),
485                          sizeof(struct position));
486 <        if (scanin == NULL | plast == NULL)
486 >        if ((scanin == NULL) | (plast == NULL))
487                  syserror(progname);
488                                          /* skip to starting point */
489          for (y = 0; y < ylim.min; y++)
# Line 491 | Line 492 | char   *pfile, *zspec;
492                          exit(1);
493                  }
494          if (zfd != -1 && lseek(zfd,
495 <                        (off_t)ylim.min*scanlen(&tresolu)*sizeof(float), 0) < 0)
495 >                        (off_t)ylim.min*scanlen(&tresolu)*sizeof(float),
496 >                        SEEK_SET) < 0)
497                  syserror(zspec);
498                                          /* load image */
499          for (y = ylim.min; y <= ylim.max; y++) {
# Line 522 | Line 524 | register VIEW  *vw1, *vw2;
524   {
525          double  m4t[4][4];
526  
527 <        if (vw1->type != VT_PER & vw1->type != VT_PAR)
527 >        if ((vw1->type != VT_PER) & (vw1->type != VT_PAR))
528                  return(0);
529 <        if (vw2->type != VT_PER & vw2->type != VT_PAR)
529 >        if ((vw2->type != VT_PER) & (vw2->type != VT_PAR))
530                  return(0);
531          setident4(xfmat);
532          xfmat[0][0] = vw1->hvec[0];
# Line 608 | Line 610 | double z;
610                  s1x = p1->x - p0->x;
611                  s1y = p1->y - p0->y;
612                  l1 = ABS(s1x);
613 <                if (p1isy = (ABS(s1y) > l1))
613 >                if ( (p1isy = (ABS(s1y) > l1)) )
614                          l1 = ABS(s1y);
615                  else if (l1 < 1)
616                          l1 = 1;
# Line 641 | Line 643 | double z;
643                  y1 = p0->y + c1*s1y/l1;
644                  for (c2 = l2; c2-- > 0; ) {
645                          x = x1 + c2*s2x/l2;
646 <                        if (x < 0 | x >= hresolu)
646 >                        if ((x < 0) | (x >= hresolu))
647                                  continue;
648                          y = y1 + c2*s2y/l2;
649 <                        if (y < 0 | y >= vresolu)
649 >                        if ((y < 0) | (y >= vresolu))
650                                  continue;
651                          if (averaging) {
652                                  if (zscan(y)[x] <= 0 || zscan(y)[x]-z
# Line 678 | Line 680 | register FVECT pos;
680          if (usematrix) {
681                  pos[0] += theirview.hoff - .5;
682                  pos[1] += theirview.voff - .5;
683 <                if (normdist & theirview.type == VT_PER)
683 >                if (normdist & (theirview.type == VT_PER))
684                          d = sqrt(1. + pos[0]*pos[0]*theirview.hn2
685                                          + pos[1]*pos[1]*theirview.vn2);
686                  else
# Line 702 | Line 704 | register FVECT pos;
704          } else {
705                  if (viewray(pt, tdir, &theirview, pos[0], pos[1]) < -FTINY)
706                          return(0);
707 <                if (!normdist & theirview.type == VT_PER)       /* adjust */
707 >                if ((!normdist) & (theirview.type == VT_PER))   /* adjust */
708                          pos[2] *= sqrt(1. + pos[0]*pos[0]*theirview.hn2
709                                          + pos[1]*pos[1]*theirview.vn2);
710                  pt[0] += tdir[0]*pos[2];
# Line 712 | Line 714 | register FVECT pos;
714                  if (pos[2] <= 0)
715                          return(0);
716          }
717 <        if (pos[0] < 0 | pos[0] >= 1-FTINY | pos[1] < 0 | pos[1] >= 1-FTINY)
717 >        if ((pos[0] < 0) | (pos[0] >= 1-FTINY) | (pos[1] < 0) | (pos[1] >= 1-FTINY))
718                  return(0);
719          if (!averaging)
720                  return(1);
# Line 759 | Line 761 | int    zfd;
761          for (y = step - 1; y < numscans(&tresolu); y += step) {
762                  if (zfd != -1) {
763                          if (lseek(zfd, (off_t)y*scanlen(&tresolu)*sizeof(float),
764 <                                        0) < 0)
764 >                                        SEEK_SET) < 0)
765                                  syserror("lseek");
766                          if (read(zfd, (char *)zline,
767                                          scanlen(&tresolu)*sizeof(float))
# Line 940 | Line 942 | int    (*fill)();
942   clipaft()                       /* perform aft clipping as indicated */
943   {
944          register int    x, y;
945 <        int     adjtest = ourview.type == VT_PER & zisnorm;
945 >        int     adjtest = (ourview.type == VT_PER) & zisnorm;
946          double  tstdist;
947          double  yzn2, vx;
948  
# Line 1048 | Line 1050 | writedistance(fname)                   /* write out z file (alters buf
1050   char    *fname;
1051   {
1052          int     donorm = normdist & !zisnorm ? 1 :
1053 <                        ourview.type == VT_PER & !normdist & zisnorm ? -1 : 0;
1053 >                        (ourview.type == VT_PER) & !normdist & zisnorm ? -1 : 0;
1054          int     fd;
1055          int     y;
1056  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines