11 |
|
#include "copyright.h" |
12 |
|
|
13 |
|
#include <signal.h> |
14 |
< |
#include <string.h> |
15 |
< |
|
14 |
> |
#include "pfilt.h" |
15 |
|
#include "platform.h" |
17 |
– |
#include "standard.h" |
18 |
– |
#include "color.h" |
19 |
– |
#include "view.h" |
16 |
|
#include "paths.h" |
17 |
+ |
#include "view.h" |
18 |
|
|
22 |
– |
extern float *matchlamp(); |
23 |
– |
|
19 |
|
#define FEQ(a,b) ((a) >= .98*(b) && (a) <= 1.02*(b)) |
20 |
|
|
21 |
|
double CHECKRAD = 2.0; /* radius to check for filtering */ |
79 |
|
char *progname; |
80 |
|
|
81 |
|
static gethfunc headline; |
82 |
+ |
static brightfunc_t rgb_bright; |
83 |
+ |
static brightfunc_t xyz_bright; |
84 |
+ |
static void copyfile(FILE *in, FILE *out); |
85 |
+ |
static void pass1(FILE *in); |
86 |
+ |
static void pass2(FILE *in); |
87 |
+ |
static void scan2init(void); |
88 |
+ |
static void scan2sync(int r); |
89 |
+ |
static void scan2flush(void); |
90 |
|
|
91 |
|
|
92 |
< |
main(argc, argv) |
93 |
< |
int argc; |
94 |
< |
char **argv; |
92 |
> |
int |
93 |
> |
main( |
94 |
> |
int argc, |
95 |
> |
char **argv |
96 |
> |
) |
97 |
|
{ |
98 |
|
FILE *fin; |
99 |
|
float *lampcolor; |
312 |
|
pass2(fin); |
313 |
|
|
314 |
|
quit(estatus); |
315 |
+ |
return estatus; /* pro forma return */ |
316 |
|
} |
317 |
|
|
318 |
|
|
319 |
< |
double |
320 |
< |
rgb_bright(clr) |
321 |
< |
COLOR clr; |
319 |
> |
static double |
320 |
> |
rgb_bright( |
321 |
> |
COLOR clr |
322 |
> |
) |
323 |
|
{ |
324 |
|
return(bright(clr)); |
325 |
|
} |
326 |
|
|
327 |
|
|
328 |
< |
double |
329 |
< |
xyz_bright(clr) |
330 |
< |
COLOR clr; |
328 |
> |
static double |
329 |
> |
xyz_bright( |
330 |
> |
COLOR clr |
331 |
> |
) |
332 |
|
{ |
333 |
|
return(clr[CIEY]); |
334 |
|
} |
335 |
|
|
336 |
|
|
337 |
< |
double (*ourbright)() = rgb_bright; |
337 |
> |
brightfunc_t *ourbright = rgb_bright; |
338 |
|
|
331 |
– |
|
339 |
|
static int |
340 |
|
headline( /* process line from header */ |
341 |
|
char *s, |
342 |
|
void *p |
343 |
|
) |
344 |
|
{ |
345 |
< |
char fmt[32]; |
345 |
> |
char fmt[MAXFMTLEN]; |
346 |
|
|
347 |
|
fputs(s, stdout); /* copy to output */ |
348 |
|
if (isaspect(s)) /* get aspect ratio */ |
363 |
|
} |
364 |
|
|
365 |
|
|
366 |
< |
copyfile(in, out) /* copy a file */ |
367 |
< |
register FILE *in, *out; |
366 |
> |
static void |
367 |
> |
copyfile( /* copy a file */ |
368 |
> |
FILE *in, |
369 |
> |
FILE *out |
370 |
> |
) |
371 |
|
{ |
372 |
< |
register int c; |
372 |
> |
int c; |
373 |
|
|
374 |
|
while ((c = getc(in)) != EOF) |
375 |
|
putc(c, out); |
381 |
|
} |
382 |
|
|
383 |
|
|
384 |
< |
pass1(in) /* first pass of picture file */ |
385 |
< |
FILE *in; |
384 |
> |
static void |
385 |
> |
pass1( /* first pass of picture file */ |
386 |
> |
FILE *in |
387 |
> |
) |
388 |
|
{ |
389 |
|
int i; |
390 |
|
COLOR *scan; |
416 |
|
} |
417 |
|
|
418 |
|
|
419 |
< |
pass2(in) /* last pass on file, write to stdout */ |
420 |
< |
FILE *in; |
419 |
> |
static void |
420 |
> |
pass2( /* last pass on file, write to stdout */ |
421 |
> |
FILE *in |
422 |
> |
) |
423 |
|
{ |
424 |
|
int yread; |
425 |
|
int ycent, xcent; |
469 |
|
} |
470 |
|
|
471 |
|
|
472 |
< |
scan2init() /* prepare scanline arrays */ |
472 |
> |
static void |
473 |
> |
scan2init(void) /* prepare scanline arrays */ |
474 |
|
{ |
475 |
|
COLOR ctmp; |
476 |
|
double d; |
477 |
< |
register int i; |
477 |
> |
int i; |
478 |
|
|
479 |
|
xbrad = xres/ncols/2 + 1; |
480 |
|
ybrad = yres/nrows/2 + 1; |
547 |
|
} |
548 |
|
|
549 |
|
|
550 |
< |
scan2sync(r) /* synchronize grey averages and output scan */ |
551 |
< |
int r; |
550 |
> |
static void |
551 |
> |
scan2sync( /* synchronize grey averages and output scan */ |
552 |
> |
int r |
553 |
> |
) |
554 |
|
{ |
555 |
|
static int nextrow = 0; |
556 |
|
COLOR ctmp; |
557 |
|
int ybot; |
558 |
< |
register int c; |
558 |
> |
int c; |
559 |
|
/* average input scanlines */ |
560 |
|
while (nextrow <= r+orad && nextrow < nrows) { |
561 |
|
ybot = (nextrow+.5)*yres/nrows; |
575 |
|
} |
576 |
|
|
577 |
|
|
578 |
< |
scan2flush() /* flush output buffer */ |
578 |
> |
static void |
579 |
> |
scan2flush(void) /* flush output buffer */ |
580 |
|
{ |
581 |
< |
register int r; |
581 |
> |
int r; |
582 |
|
|
583 |
|
for (r = nrows-orad; r < nrows; r++) |
584 |
|
if (fwritescan(scoutbar[r%obarsize], ncols, stdout) < 0) |