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 1.17 by greg, Wed Jun 5 12:15:30 1991 UTC vs.
Revision 2.3 by greg, Tue Sep 8 15:33:08 1992 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1986 Regents of the University of California */
1 > /* Copyright (c) 1991 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 16 | Line 16 | static char SCCSid[] = "$SunId$ LBL";
16  
17   #include  "color.h"
18  
19 + #include  "resolu.h"
20 +
21 + #include  "paths.h"
22 +
23   extern char  *malloc();
24   extern float  *matchlamp();
25  
# Line 43 | Line 47 | int  npts = 0;                 /* (half) number of points for stars
47  
48   double  spread = 1e-4;          /* spread for star points */
49  
46 #define  TEMPLATE       "/usr/tmp/pfXXXXXX"
47
50   char  *tfname = NULL;
51  
52   char  *lampdat = "lamp.tab";    /* lamp data file */
53  
54 + int  order;                     /* scanline ordering of input */
55   int  xres, yres;                /* resolution of input */
56   double  inpaspect = 1.0;        /* pixel aspect ratio of input */
57   int  correctaspect = 0;         /* aspect ratio correction? */
# Line 69 | Line 72 | main(argc, argv)
72   int  argc;
73   char  **argv;
74   {
75 <        extern char  *mktemp();
73 <        extern double  atof(), pow();
75 >        extern double  pow();
76          extern long  ftell();
77          extern int  quit(), headline();
78          FILE  *fin;
# Line 79 | Line 81 | char  **argv;
81          long  fpos;
82          double  outaspect = 0.0;
83          double  d;
84 <        int  i;
84 >        int  i, j;
85  
86          if (signal(SIGINT, quit) == SIG_IGN)
87                  signal(SIGINT, SIG_IGN);
# Line 196 | Line 198 | char  **argv;
198                          fprintf(stderr, "%s: unknown lamp type\n", lamptype);
199                          quit(1);
200                  }
201 <                colval(exposure,RED) /= lampcolor[0];
202 <                colval(exposure,GRN) /= lampcolor[1];
203 <                colval(exposure,BLU) /= lampcolor[2];
201 >                for (i = 0; i < 3; i++)
202 >                        if (lampcolor[i] > 1e-4)
203 >                                colval(exposure,i) /= lampcolor[i];
204                  freelamps();
205          }
206                                          /* open input file */
# Line 238 | Line 240 | char  **argv;
240                                          /* add new header info. */
241          printargs(i, argv, stdout);
242                                          /* get picture size */
243 <        if (fgetresolu(&xres, &yres, fin) != (YMAJOR|YDECR)) {
243 >        if ((order = fgetresolu(&xres, &yres, fin)) < 0) {
244                  fprintf(stderr, "%s: bad picture size\n", progname);
245                  quit(1);
246          }
247 +        if (!(order & YMAJOR))
248 +                inpaspect = 1.0/inpaspect;
249                                          /* compute output resolution */
250          if (ncols <= 0)
251                  ncols = x_c*xres + .5;
# Line 419 | Line 423 | scan2init()                    /* prepare scanline arrays */
423          }
424                                          /* record pixel aspect ratio */
425          if (!correctaspect) {
426 <                d = x_c / y_r;
426 >                d = order & YMAJOR ? x_c/y_r : y_r/x_c ;
427                  if (!FEQ(d,1.0))
428                          fputaspect(d, stdout);
429          }
# Line 435 | Line 439 | scan2init()                    /* prepare scanline arrays */
439                  fputcolcor(ctmp, stdout);
440          printf("\n");
441                                          /* write out resolution */
442 <        fputresolu(YMAJOR|YDECR, ncols, nrows, stdout);
442 >        fputresolu(order, ncols, nrows, stdout);
443   }
444  
445  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines