--- ray/src/px/pcond4.c 2003/02/22 02:07:27 3.16 +++ ray/src/px/pcond4.c 2004/11/14 16:57:18 3.19 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: pcond4.c,v 3.16 2003/02/22 02:07:27 greg Exp $"; +static const char RCSid[] = "$Id: pcond4.c,v 3.19 2004/11/14 16:57:18 greg Exp $"; #endif /* * Routines for veiling glare and loss of acuity. @@ -19,8 +19,14 @@ static float (*raydir)[3] = NULL; /* ray direction for #define rdirscan(y) (raydir+(y)*fvxr) +static void compraydir(void); +#if ADJ_VEIL +static void smoothveil(void); +#endif -compraydir() /* compute ray directions */ + +static void +compraydir(void) /* compute ray directions */ { FVECT rorg, rdir; double h, v; @@ -69,7 +75,8 @@ compraydir() /* compute ray directions */ } -compveil() /* compute veiling image */ +extern void +compveil(void) /* compute veiling image */ { double t2, t2sum; COLOR ctmp, vsum; @@ -130,7 +137,8 @@ compveil() /* compute veiling image */ * and added to the foveal image, and the mapping has been * determined. */ -adjveil() /* adjust veil image */ +extern void +adjveil(void) /* adjust veil image */ { float *crfptr = crfimg; COLOR *fovptr = fovimg; @@ -176,7 +184,8 @@ adjveil() /* adjust veil image */ } -smoothveil() /* smooth veil image */ +static void +smoothveil(void) /* smooth veil image */ { COLOR *nveilimg; COLOR *ovptr, *nvptr; @@ -245,9 +254,11 @@ smoothveil() /* smooth veil image */ } #endif -addveil(sl, y) /* add veil to scanline */ -COLOR *sl; -int y; +extern void +addveil( /* add veil to scanline */ + COLOR *sl, + int y +) { int vx, vy; double dx, dy; @@ -287,24 +298,30 @@ typedef struct { SCANBAR *rootbar; /* root scan bar (lowest resolution) */ -float *inpacuD; /* input acuity data (cycles/degree) */ +float *inpacuD = NULL; /* input acuity data (cycles/degree) */ #define tsampr(x,y) inpacuD[(y)*fvxr+(x)] +static COLOR * getascan(SCANBAR *sb, int y); +static void acusample(COLOR col, int x, int y, double sr); +static void ascanval(COLOR col, int x, int y, SCANBAR *sb); +static SCANBAR *sballoc(int se, int ns, int sl); -double -hacuity(La) /* return visual acuity in cycles/degree */ -double La; +extern double +hacuity( /* return visual acuity in cycles/degree */ + double La +) { /* functional fit */ return(17.25*atan(1.4*log10(La) + 0.35) + 25.72); } -COLOR * -getascan(sb, y) /* find/read scanline y for scanbar sb */ -register SCANBAR *sb; -int y; +static COLOR * +getascan( /* find/read scanline y for scanbar sb */ + register SCANBAR *sb, + int y +) { register COLOR *sl0, *sl1, *mysl; register int i; @@ -337,14 +354,19 @@ int y; } -acuscan(scln, y) /* get acuity-sampled scanline */ -COLOR *scln; -int y; +extern void +acuscan( /* get acuity-sampled scanline */ + COLOR *scln, + int y +) { double sr; double dx, dy; int ix, iy; register int x; + + if (inpacuD == NULL) + return; /* compute foveal y position */ iy = dy = (y+.5)/numscans(&inpres)*fvyr - .5; while (iy >= fvyr-1) iy--; @@ -363,10 +385,13 @@ int y; } -acusample(col, x, y, sr) /* interpolate sample at (x,y) using rate sr */ -COLOR col; -int x, y; -double sr; +static void +acusample( /* interpolate sample at (x,y) using rate sr */ + COLOR col, + int x, + int y, + double sr +) { COLOR c1; double d; @@ -385,10 +410,13 @@ double sr; } -ascanval(col, x, y, sb) /* interpolate scanbar at orig. coords (x,y) */ -COLOR col; -int x, y; -SCANBAR *sb; +static void +ascanval( /* interpolate scanbar at orig. coords (x,y) */ + COLOR col, + int x, + int y, + SCANBAR *sb +) { COLOR *sl0, *sl1, c1, c1y; double dx, dy; @@ -433,11 +461,12 @@ SCANBAR *sb; } -SCANBAR * -sballoc(se, ns, sl) /* allocate scanbar */ -int se; /* sampling rate exponent */ -int ns; /* number of scanlines */ -int sl; /* original scanline length */ +static SCANBAR * +sballoc( /* allocate scanbar */ + int se, /* sampling rate exponent */ + int ns, /* number of scanlines */ + int sl /* original scanline length */ +) { SCANBAR *sbarr; register SCANBAR *sb; @@ -462,12 +491,13 @@ int sl; /* original scanline length */ } -initacuity() /* initialize variable acuity sampling */ +extern void +initacuity(void) /* initialize variable acuity sampling */ { FVECT diffx, diffy, cp; double omega, maxsr; register int x, y, i; - + compraydir(); /* compute ray directions */ inpacuD = (float *)malloc(fvxr*fvyr*sizeof(float));