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.20 by gwlarson, Tue Oct 27 09:08:26 1998 UTC vs.
Revision 2.28 by schorsch, Fri Jan 2 12:47:01 2004 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1996 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char RCSid[] = "$Id$";
3   #endif
6
4   /*
5   *  pfilt.c - program to post-process picture file.
6   *
# Line 11 | Line 8 | static char SCCSid[] = "$SunId$ LBL";
8   *     6/23/93  Added additional buffers for value spreading
9   */
10  
11 < #include  "standard.h"
11 > #include  "copyright.h"
12  
13   #include  <signal.h>
14 + #include  <string.h>
15  
16 + #include  "platform.h"
17 + #include  "standard.h"
18   #include  "color.h"
19
19   #include  "view.h"
21
22 #include  "resolu.h"
23
20   #include  "paths.h"
21  
22   extern float  *matchlamp();
23  
24   #define  FEQ(a,b)       ((a) >= .98*(b) && (a) <= 1.02*(b))
25  
26 < double   CHECKRAD = 1.5;        /* radius to check for filtering */
26 > double   CHECKRAD = 2.0;        /* radius to check for filtering */
27  
28   #define  THRESHRAD      5.0     /* maximum sample spread in output */
29  
# Line 87 | Line 83 | int  orad = 0;                 /* output window radius */
83  
84   char  *progname;
85  
86 + static gethfunc headline;
87  
88 +
89   main(argc, argv)
90   int  argc;
91   char  **argv;
92   {
95        extern long  ftell();
96        extern int  quit(), headline();
93          FILE  *fin;
94          float  *lampcolor;
95          char  *lamptype = NULL;
# Line 101 | Line 97 | char  **argv;
97          double  outaspect = 0.0;
98          double  d;
99          int  i, j;
100 < #ifdef MSDOS
101 <        extern int  _fmode;
102 <        _fmode = O_BINARY;
107 <        setmode(fileno(stdin), O_BINARY);
108 <        setmode(fileno(stdout), O_BINARY);
109 < #endif
100 >        SET_DEFAULT_BINARY();
101 >        SET_FILE_BINARY(stdin);
102 >        SET_FILE_BINARY(stdout);
103          if (signal(SIGINT, quit) == SIG_IGN)
104                  signal(SIGINT, SIG_IGN);
105 + #ifdef SIGHUP
106          if (signal(SIGHUP, quit) == SIG_IGN)
107                  signal(SIGHUP, SIG_IGN);
108 + #endif
109          signal(SIGTERM, quit);
110 + #ifdef SIGPIPE
111          signal(SIGPIPE, quit);
112 + #endif
113   #ifdef  SIGXCPU
114          signal(SIGXCPU, quit);
115          signal(SIGXFSZ, quit);
# Line 205 | Line 202 | char  **argv;
202                          case 'm':
203                                  thresh = atof(argv[++i]);
204                                  if (rad <= FTINY)
205 <                                        rad = 1.0;
205 >                                        rad = 0.6;
206                                  break;
207                          case 'b':
208                                  rad = thresh = 0.0;
# Line 332 | Line 329 | COLOR  clr;
329   double  (*ourbright)() = rgb_bright;
330  
331  
332 < int
333 < headline(s)                             /* process line from header */
334 < char  *s;
332 > static int
333 > headline(                               /* process line from header */
334 >        char    *s,
335 >        void    *p
336 > )
337   {
338          char  fmt[32];
339  
# Line 401 | Line 400 | FILE  *in;
400                  }
401                  pass1scan(scan, i);
402          }
403 <        free((char *)scan);
403 >        free((void *)scan);
404   }
405  
406  
# Line 494 | Line 493 | scan2init()                    /* prepare scanline arrays */
493          if (obarsize > 0) {
494                  scoutbar = (COLOR **)malloc(obarsize*sizeof(COLOR *));
495                  greybar = (float **)malloc(obarsize*sizeof(float *));
496 <                if (scoutbar == NULL | greybar == NULL)
496 >                if ((scoutbar == NULL) | (greybar == NULL))
497                          goto memerr;
498                  for (i = 0; i < obarsize; i++) {
499                          scoutbar[i] = (COLOR *)malloc(ncols*sizeof(COLOR));
500                          greybar[i] = (float *)malloc(ncols*sizeof(float));
501 <                        if (scoutbar[i] == NULL | greybar[i] == NULL)
501 >                        if ((scoutbar[i] == NULL) | (greybar[i] == NULL))
502                                  goto memerr;
503                  }
504          } else {
# Line 548 | Line 547 | int  r;
547                          greybar[nextrow%obarsize][c] = (*ourbright)(ctmp);
548                  }
549                                          /* and zero output scanline */
550 <                bzero((char *)scoutbar[nextrow%obarsize], ncols*sizeof(COLOR));
550 >                memset((char *)scoutbar[nextrow%obarsize], '\0', ncols*sizeof(COLOR));
551                  nextrow++;
552          }
553                                          /* point to top scanline for output */
# Line 573 | Line 572 | scan2flush()                   /* flush output buffer */
572   }
573  
574  
575 + void
576   quit(code)              /* remove temporary file and exit */
577   int  code;
578   {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines