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.2 by greg, Thu Dec 19 14:51:52 1991 UTC vs.
Revision 2.8 by greg, Fri Jun 18 16:20:16 1993 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1991 Regents of the University of California */
1 > /* Copyright (c) 1992 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 10 | Line 10 | static char SCCSid[] = "$SunId$ LBL";
10   *     9/26/85
11   */
12  
13 < #include  <stdio.h>
13 > #include  "standard.h"
14  
15   #include  <signal.h>
16  
# Line 18 | Line 18 | static char SCCSid[] = "$SunId$ LBL";
18  
19   #include  "resolu.h"
20  
21 < extern char  *malloc();
21 > #include  "paths.h"
22 >
23   extern float  *matchlamp();
24  
25 < #define  FEQ(a,b)       ((a) >= .98*(b) && (a) <= 1.02*(b))
25 > #define  FEQ(a,b)       ((a) >= .98*(b) && (a) <= 1.02*(b))
26  
27 < #define  CHECKRAD       1.5     /* radius to check for filtering */
27 > #define  CHECKRAD       1.5     /* radius to check for filtering */
28  
29   COLOR  exposure = WHTCOLOR;     /* exposure for the frame */
30  
31 < double  rad = 0.0;              /* output pixel radius for filtering */
31 > double  rad = 0.0;              /* output pixel radius for filtering */
32  
33   int  nrows = 0;                 /* number of rows for output */
34   int  ncols = 0;                 /* number of columns for output */
35  
36 < double  x_c = 1.0;              /* ratio of output x size to input */
37 < double  y_r = 1.0;              /* ratio of output y size to input */
36 > double  x_c = 1.0;              /* ratio of output x size to input */
37 > double  y_r = 1.0;              /* ratio of output y size to input */
38  
39   int  singlepass = 0;            /* true means skip first pass */
40  
41   int  avghot = 0;                /* true means average in bright spots */
42  
43 < double  hotlvl = 1000.0;        /* level considered "hot" */
43 > double  hotlvl = 100.0;         /* level considered "hot" */
44  
45   int  npts = 0;                  /* (half) number of points for stars */
46  
47 < double  spread = 1e-4;          /* spread for star points */
47 > double  spread = 1e-4;          /* spread for star points */
48  
48 #define  TEMPLATE       "/usr/tmp/pfXXXXXX"
49
49   char  *tfname = NULL;
50  
51   char  *lampdat = "lamp.tab";    /* lamp data file */
52  
53   int  order;                     /* scanline ordering of input */
54   int  xres, yres;                /* resolution of input */
55 < double  inpaspect = 1.0;        /* pixel aspect ratio of input */
55 > double  inpaspect = 1.0;        /* pixel aspect ratio of input */
56   int  correctaspect = 0;         /* aspect ratio correction? */
57  
58   int  wrongformat = 0;
# Line 72 | Line 71 | main(argc, argv)
71   int  argc;
72   char  **argv;
73   {
75        extern char  *mktemp();
76        extern double  pow();
74          extern long  ftell();
75          extern int  quit(), headline();
76          FILE  *fin;
77          float  *lampcolor;
78          char  *lamptype = NULL;
79          long  fpos;
80 <        double  outaspect = 0.0;
81 <        double  d;
80 >        double  outaspect = 0.0;
81 >        double  d;
82          int  i, j;
83 <
83 > #ifdef MSDOS
84 >        extern int  _fmode;
85 >        _fmode = O_BINARY;
86 >        setmode(fileno(stdin), O_BINARY);
87 >        setmode(fileno(stdout), O_BINARY);
88 > #endif
89          if (signal(SIGINT, quit) == SIG_IGN)
90                  signal(SIGINT, SIG_IGN);
91          if (signal(SIGHUP, quit) == SIG_IGN)
92                  signal(SIGINT, SIG_IGN);
93          signal(SIGTERM, quit);
94          signal(SIGPIPE, quit);
95 < #ifdef  SIGXCPU
95 > #ifdef  SIGXCPU
96          signal(SIGXCPU, quit);
97          signal(SIGXFSZ, quit);
98   #endif
99  
100 <        progname = argv[0];
100 >        progname = argv[0] = fixargv0(argv[0]);
101  
102          for (i = 1; i < argc; i++)
103                  if (argv[i][0] == '-')
# Line 290 | Line 292 | char  *s;
292          fputs(s, stdout);               /* copy to output */
293          if (isaspect(s))                /* get aspect ratio */
294                  inpaspect *= aspectval(s);
295 +        else if (isexpos(s))
296 +                hotlvl *= exposval(s);
297          else if (isformat(s)) {
298                  formatval(fmt, s);
299                  wrongformat = strcmp(fmt, COLRFMT);
# Line 327 | Line 331 | FILE  *in;
331          }
332          for (i = 0; i < yres; i++) {
333                  if (freadscan(scan, xres, in) < 0) {
334 <                        nrows = nrows * i / yres;       /* adjust frame */
334 >                        nrows = (long)nrows * i / yres; /* adjust frame */
335                          if (nrows <= 0) {
336                                  fprintf(stderr, "%s: empty frame\n", progname);
337                                  quit(1);
338                          }
339                          fprintf(stderr, "%s: warning - partial frame (%d%%)\n",
340 <                                        progname, 100*i/yres);
340 >                                        progname, (int)(100L*i/yres));
341                          yres = i;
342                          y_r = (double)nrows/yres;
343                          break;
# Line 350 | Line 354 | FILE  *in;
354          int  yread;
355          int  ycent, xcent;
356          int  r, c;
357 <        
357 >        
358          pass2init();
359          scan2init();
360          yread = 0;
# Line 393 | Line 397 | FILE  *in;
397   scan2init()                     /* prepare scanline arrays */
398   {
399          COLOR   ctmp;
400 <        double  d;
400 >        double  d;
401          register int  i;
402  
403          if (rad <= 0.0) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines