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.16 by greg, Wed Feb 14 20:19:52 1996 UTC vs.
Revision 2.20 by gwlarson, Tue Oct 27 09:08:26 1998 UTC

# 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 321 | Line 332 | COLOR  clr;
332   double  (*ourbright)() = rgb_bright;
333  
334  
335 + int
336   headline(s)                             /* process line from header */
337   char  *s;
338   {
# Line 339 | Line 351 | char  *s;
351                          ourbright = xyz_bright;
352                  else
353                          wrongformat = !globmatch(PICFMT, fmt);
354 <        }
354 >        } else if (isview(s) && sscanview(&ourview, s) > 0)
355 >                gotview++;
356 >        return(0);
357   }
358  
359  
# Line 382 | Line 396 | FILE  *in;
396                                          progname, (int)(100L*i/yres));
397                          yres = i;
398                          y_r = (double)nrows/yres;
399 +                        estatus++;
400                          break;
401                  }
402                  pass1scan(scan, i);
# Line 401 | Line 416 | FILE  *in;
416          scan2init();
417          yread = 0;
418          for (r = 0; r < nrows; r++) {
419 <                ycent = (long)r*yres/nrows;
419 >                ycent = (r+.5)*yres/nrows;
420                  while (yread <= ycent+yrad) {
421                          if (yread < yres) {
422                                  if (freadscan(scanin[yread%barsize],
# Line 418 | Line 433 | FILE  *in;
433                  if (obarsize > 0)
434                          scan2sync(r);
435                  for (c = 0; c < ncols; c++) {
436 <                        xcent = (long)c*xres/ncols;
436 >                        xcent = (c+.5)*xres/ncols;
437                          if (thresh > FTINY)
438                                  dothresh(xcent, ycent, c, r);
439                          else if (rad > FTINY)
# Line 527 | Line 542 | int  r;
542          register int  c;
543                                          /* average input scanlines */
544          while (nextrow <= r+orad && nextrow < nrows) {
545 <                ybot = (long)nextrow*yres/nrows;
545 >                ybot = (nextrow+.5)*yres/nrows;
546                  for (c = 0; c < ncols; c++) {
547 <                        dobox(ctmp, (int)((long)c*xres/ncols),ybot, c,nextrow);
547 >                        dobox(ctmp, (int)((c+.5)*xres/ncols),ybot, c,nextrow);
548                          greybar[nextrow%obarsize][c] = (*ourbright)(ctmp);
549                  }
550                                          /* and zero output scanline */
# Line 553 | Line 568 | scan2flush()                   /* flush output buffer */
568                          break;
569          if (fflush(stdout) < 0) {
570                  fprintf(stderr, "%s: write error at end of pass2\n", progname);
571 <                exit(1);
571 >                quit(1);
572          }
573   }
574  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines