17 |
|
#include "color.h" |
18 |
|
|
19 |
|
extern char *malloc(); |
20 |
+ |
extern float *matchlamp(); |
21 |
|
|
22 |
|
#define CHECKRAD 1.5 /* radius to check for filtering */ |
23 |
|
|
45 |
|
|
46 |
|
char *tfname = NULL; |
47 |
|
|
48 |
+ |
char *lampdat = "lamp.tab"; /* lamp data file */ |
49 |
+ |
|
50 |
|
int xres, yres; /* resolution of input */ |
51 |
|
double inpaspect = 1.0; /* pixel aspect ratio of input */ |
52 |
+ |
int correctaspect = 0; /* aspect ratio correction? */ |
53 |
|
|
54 |
|
int xrad; /* x window size */ |
55 |
|
int yrad; /* y window size */ |
70 |
|
extern long ftell(); |
71 |
|
extern int quit(), headline(); |
72 |
|
FILE *fin; |
73 |
+ |
float *lampcolor; |
74 |
+ |
char *lamptype = NULL; |
75 |
|
long fpos; |
76 |
|
double outaspect = 0.0; |
77 |
|
double d; |
109 |
|
} else |
110 |
|
nrows = atoi(argv[i]); |
111 |
|
break; |
112 |
+ |
case 'c': |
113 |
+ |
correctaspect = !correctaspect; |
114 |
+ |
break; |
115 |
|
case 'p': |
116 |
|
i++; |
117 |
|
outaspect = atof(argv[i]); |
139 |
|
} |
140 |
|
i++; |
141 |
|
break; |
142 |
+ |
case 'f': |
143 |
+ |
lampdat = argv[++i]; |
144 |
+ |
break; |
145 |
+ |
case 't': |
146 |
+ |
lamptype = argv[++i]; |
147 |
+ |
break; |
148 |
|
case '1': |
149 |
|
singlepass = 1; |
150 |
|
break; |
178 |
|
} |
179 |
|
else |
180 |
|
break; |
181 |
< |
|
181 |
> |
/* get lamp data (if necessary) */ |
182 |
> |
if (lamptype != NULL) { |
183 |
> |
if (loadlamps(lampdat) < 0) |
184 |
> |
quit(1); |
185 |
> |
if ((lampcolor = matchlamp(lamptype)) == NULL) { |
186 |
> |
fprintf(stderr, "%s: unknown lamp type\n", lamptype); |
187 |
> |
quit(1); |
188 |
> |
} |
189 |
> |
colval(exposure,RED) /= lampcolor[0]; |
190 |
> |
colval(exposure,GRN) /= lampcolor[1]; |
191 |
> |
colval(exposure,BLU) /= lampcolor[2]; |
192 |
> |
freelamps(); |
193 |
> |
} |
194 |
> |
/* open input file */ |
195 |
|
if (i == argc) { |
196 |
|
if (singlepass) |
197 |
|
fin = stdin; |
309 |
|
fprintf(stderr, "%s: warning - partial frame (%d%%)\n", |
310 |
|
progname, 100*i/yres); |
311 |
|
yres = i; |
312 |
+ |
y_r = (double)nrows/yres; |
313 |
|
break; |
314 |
|
} |
315 |
|
pass1scan(scan, i); |
396 |
|
quit(1); |
397 |
|
} |
398 |
|
/* record pixel aspect and exposure */ |
399 |
< |
d = x_c / y_r; |
400 |
< |
if (d < .99 || d > 1.01) |
401 |
< |
fputaspect(d, stdout); |
399 |
> |
if (!correctaspect) { |
400 |
> |
d = x_c / y_r; |
401 |
> |
if (d < .99 || d > 1.01) |
402 |
> |
fputaspect(d, stdout); |
403 |
> |
} |
404 |
|
d = bright(exposure); |
405 |
|
if (d < .995 || d > 1.005) |
406 |
|
fputexpos(d, stdout); |