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

Comparing ray/src/px/pfilt.c (file contents):
Revision 2.15 by greg, Mon Oct 16 12:04:36 1995 UTC vs.
Revision 2.19 by greg, Wed Oct 2 16:56:16 1996 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1992 Regents of the University of California */
1 > /* Copyright (c) 1996 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 17 | Line 17 | static char SCCSid[] = "$SunId$ LBL";
17  
18   #include  "color.h"
19  
20 + #include  "view.h"
21 +
22   #include  "resolu.h"
23  
24   #include  "paths.h"
# Line 64 | Line 66 | int  correctaspect = 0;                /* aspect ratio correction? *
66  
67   int  wrongformat = 0;
68  
69 + VIEW  ourview = STDVIEW;
70 + int  gotview = 0;
71 + int  wrapfilt = 0;              /* wrap filter horizontally? */
72 +
73 + int  estatus = 0;               /* exit status (for non-fatal errors) */
74 +
75   int  xrad;                      /* x search radius */
76   int  yrad;                      /* y search radius */
77   int  xbrad;                     /* x box size */
# Line 147 | Line 155 | char  **argv;
155                                          fprintf(stderr,
156                                                  "%s: exposure out of range\n",
157                                                          argv[0]);
158 <                                        exit(1);
158 >                                        quit(1);
159                                  }
160                                  switch (argv[i][2]) {
161                                  case '\0':
# Line 267 | Line 275 | char  **argv;
275          }
276          if (!(order & YMAJOR))
277                  inpaspect = 1.0/inpaspect;
278 +                                        /* wrap around for cylindrical view? */
279 +        wrapfilt = gotview && ourview.type == VT_CYL &&
280 +                        ourview.horiz >= 360.-FTINY && order & YMAJOR;
281                                          /* compute output resolution */
282          if (ncols <= 0)
283                  ncols = x_c*xres + .5;
# Line 298 | Line 309 | char  **argv;
309          }
310          pass2(fin);
311  
312 <        quit(0);
312 >        quit(estatus);
313   }
314  
315  
# Line 339 | Line 350 | char  *s;
350                          ourbright = xyz_bright;
351                  else
352                          wrongformat = !globmatch(PICFMT, fmt);
353 <        }
353 >        } else if (isview(s) && sscanview(&ourview, s) > 0)
354 >                gotview++;
355   }
356  
357  
# Line 382 | Line 394 | FILE  *in;
394                                          progname, (int)(100L*i/yres));
395                          yres = i;
396                          y_r = (double)nrows/yres;
397 +                        estatus++;
398                          break;
399                  }
400                  pass1scan(scan, i);
# Line 401 | Line 414 | FILE  *in;
414          scan2init();
415          yread = 0;
416          for (r = 0; r < nrows; r++) {
417 <                ycent = (long)r*yres/nrows;
417 >                ycent = (r+.5)*yres/nrows;
418                  while (yread <= ycent+yrad) {
419                          if (yread < yres) {
420                                  if (freadscan(scanin[yread%barsize],
# Line 418 | Line 431 | FILE  *in;
431                  if (obarsize > 0)
432                          scan2sync(r);
433                  for (c = 0; c < ncols; c++) {
434 <                        xcent = (long)c*xres/ncols;
434 >                        xcent = (c+.5)*xres/ncols;
435                          if (thresh > FTINY)
436                                  dothresh(xcent, ycent, c, r);
437                          else if (rad > FTINY)
# Line 454 | Line 467 | scan2init()                    /* prepare scanline arrays */
467                          rad *= (y_r + x_c)/2.0;
468  
469                  if (thresh > FTINY) {
457                        xrad = CHECKRAD*THRESHRAD*rad/x_c + xbrad;
458                        yrad = CHECKRAD*THRESHRAD*rad/y_r + ybrad;
470                          orad = CHECKRAD*THRESHRAD*rad + 1;
471 +                        xrad = orad/x_c + xbrad;
472 +                        yrad = orad/y_r + ybrad;
473                          obarsize = 2*orad + 1;
474                  } else {
475                          xrad = CHECKRAD*rad/x_c + 1;
# Line 526 | Line 539 | int  r;
539          int  ybot;
540          register int  c;
541                                          /* average input scanlines */
542 <        while (nextrow < r+orad && nextrow < nrows) {
543 <                ybot = (long)nextrow*yres/nrows;
542 >        while (nextrow <= r+orad && nextrow < nrows) {
543 >                ybot = (nextrow+.5)*yres/nrows;
544                  for (c = 0; c < ncols; c++) {
545 <                        dobox(ctmp, (int)((long)c*xres/ncols),ybot, c,nextrow);
545 >                        dobox(ctmp, (int)((c+.5)*xres/ncols),ybot, c,nextrow);
546                          greybar[nextrow%obarsize][c] = (*ourbright)(ctmp);
547                  }
548                                          /* and zero output scanline */
# Line 553 | Line 566 | scan2flush()                   /* flush output buffer */
566                          break;
567          if (fflush(stdout) < 0) {
568                  fprintf(stderr, "%s: write error at end of pass2\n", progname);
569 <                exit(1);
569 >                quit(1);
570          }
571   }
572  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines