--- ray/src/px/pfilt.c 1990/09/13 09:46:00 1.10 +++ ray/src/px/pfilt.c 1990/12/08 13:23:47 1.14 @@ -17,6 +17,7 @@ static char SCCSid[] = "$SunId$ LBL"; #include "color.h" extern char *malloc(); +extern float *matchlamp(); #define CHECKRAD 1.5 /* radius to check for filtering */ @@ -44,8 +45,11 @@ double spread = 1e-4; /* spread for star points */ char *tfname = NULL; +char *lampdat = "lamp.tab"; /* lamp data file */ + int xres, yres; /* resolution of input */ double inpaspect = 1.0; /* pixel aspect ratio of input */ +int correctaspect = 0; /* aspect ratio correction? */ int xrad; /* x window size */ int yrad; /* y window size */ @@ -66,6 +70,8 @@ char **argv; extern long ftell(); extern int quit(), headline(); FILE *fin; + float *lampcolor; + char *lamptype = NULL; long fpos; double outaspect = 0.0; double d; @@ -103,6 +109,9 @@ char **argv; } else nrows = atoi(argv[i]); break; + case 'c': + correctaspect = !correctaspect; + break; case 'p': i++; outaspect = atof(argv[i]); @@ -130,6 +139,12 @@ char **argv; } i++; break; + case 'f': + lampdat = argv[++i]; + break; + case 't': + lamptype = argv[++i]; + break; case '1': singlepass = 1; break; @@ -163,7 +178,20 @@ char **argv; } else break; - + /* get lamp data (if necessary) */ + if (lamptype != NULL) { + if (loadlamps(lampdat) < 0) + quit(1); + if ((lampcolor = matchlamp(lamptype)) == NULL) { + fprintf(stderr, "%s: unknown lamp type\n", lamptype); + quit(1); + } + colval(exposure,RED) /= lampcolor[0]; + colval(exposure,GRN) /= lampcolor[1]; + colval(exposure,BLU) /= lampcolor[2]; + freelamps(); + } + /* open input file */ if (i == argc) { if (singlepass) fin = stdin; @@ -281,6 +309,7 @@ FILE *in; fprintf(stderr, "%s: warning - partial frame (%d%%)\n", progname, 100*i/yres); yres = i; + y_r = (double)nrows/yres; break; } pass1scan(scan, i); @@ -367,9 +396,11 @@ scan2init() /* prepare scanline arrays */ quit(1); } /* record pixel aspect and exposure */ - d = x_c / y_r; - if (d < .99 || d > 1.01) - fputaspect(d, stdout); + if (!correctaspect) { + d = x_c / y_r; + if (d < .99 || d > 1.01) + fputaspect(d, stdout); + } d = bright(exposure); if (d < .995 || d > 1.005) fputexpos(d, stdout);