--- ray/src/px/pf2.c 1994/11/09 15:04:52 2.4 +++ ray/src/px/pf2.c 2004/03/28 20:33:14 2.7 @@ -1,41 +1,22 @@ -/* Copyright (c) 1994 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static const char RCSid[] = "$Id: pf2.c,v 2.7 2004/03/28 20:33:14 schorsch Exp $"; #endif - /* * pf2.c - routines used by pfilt. */ #include - +#include #include +#include "rterror.h" #include "random.h" - #include "color.h" +#include "pfilt.h" #define PI 3.14159265359 - #define FTINY (1e-6) -extern int nrows, ncols; /* number of rows and columns for output */ - -extern int xres, yres; /* x and y resolution */ - -extern int avghot; /* true means average in avgbrt spots */ - -extern double hotlvl; /* brightness considered "hot" */ - -extern int npts; /* # of points for stars */ - -extern double spread; /* spread for star points */ - -extern char *progname; - -extern COLOR exposure; /* exposure for frame */ - #define AVGLVL 0.5 /* target mean brightness */ double avgbrt; /* average picture brightness */ @@ -52,8 +33,11 @@ HOTPIX *head; /* head of avgbrt pixel list */ double sprdfact; /* computed spread factor */ +static void starpoint(COLOR fcol, int x, int y, HOTPIX *hp); -pass1init() /* prepare for first pass */ + +extern void +pass1init(void) /* prepare for first pass */ { avgbrt = 0.0; npix = 0; @@ -61,7 +45,8 @@ pass1init() /* prepare for first pass */ } -pass1default() /* for single pass */ +extern void +pass1default(void) /* for single pass */ { avgbrt = AVGLVL; npix = 1; @@ -69,18 +54,19 @@ pass1default() /* for single pass */ } -pass1scan(scan, y) /* process first pass scanline */ -register COLOR *scan; -int y; +extern void +pass1scan( /* process first pass scanline */ + register COLOR *scan, + int y +) { - extern char *malloc(); double cbrt; register int x; register HOTPIX *hp; for (x = 0; x < xres; x++) { - cbrt = bright(scan[x]); + cbrt = (*ourbright)(scan[x]); if (cbrt <= 0) continue; @@ -107,7 +93,8 @@ int y; } -pass2init() /* prepare for final pass */ +extern void +pass2init(void) /* prepare for final pass */ { if (!npix) { fprintf(stderr, "%s: picture too dark or too bright\n", @@ -118,14 +105,16 @@ pass2init() /* prepare for final pass */ scalecolor(exposure, AVGLVL/avgbrt); - sprdfact = spread / (hotlvl * bright(exposure)) + sprdfact = spread / (hotlvl * (*ourbright)(exposure)) * ((double)xres*xres + (double)yres*yres) / 4.0; } -pass2scan(scan, y) /* process final pass scanline */ -register COLOR *scan; -int y; +extern void +pass2scan( /* process final pass scanline */ + register COLOR *scan, + int y +) { int xmin, xmax; register int x; @@ -157,10 +146,13 @@ int y; } -starpoint(fcol, x, y, hp) /* pixel is on the star's point */ -COLOR fcol; -int x, y; -register HOTPIX *hp; +static void +starpoint( /* pixel is on the star's point */ + COLOR fcol, + int x, + int y, + register HOTPIX *hp +) { COLOR ctmp; double d2;