--- ray/src/util/ranimove2.c 2005/04/19 01:15:07 3.8 +++ ray/src/util/ranimove2.c 2023/11/17 20:02:08 3.12 @@ -1,10 +1,10 @@ #ifndef lint -static const char RCSid[] = "$Id: ranimove2.c,v 3.8 2005/04/19 01:15:07 greg Exp $"; +static const char RCSid[] = "$Id: ranimove2.c,v 3.12 2023/11/17 20:02:08 greg Exp $"; #endif /* * ranimove2.c * - * Frame refinement routines for ranimate(1). + * Frame refinement routines for ranimove(1). * * Created by Gregory Ward on Wed Jan 08 2003. */ @@ -26,7 +26,7 @@ static int ray_refine(int n); static long refine_rays(long nrays); -extern int +int refine_first(void) /* initial refinement pass */ { int *esamp = (int *)zprev; /* OK to reuse */ @@ -34,7 +34,7 @@ refine_first(void) /* initial refinement pass */ int nextra = 0; int x, y, xp, yp; int neigh; - register int n, np; + int n, np; if (sizeof(int) < sizeof(*zprev)) error(CONSISTENCY, "code error in refine_first"); @@ -128,7 +128,7 @@ static void subconspicuity(int x0, int y0, int x1, int static void clr_consp( /* initialize a conspicuity sum */ - register struct ConspSum *cs + struct ConspSum *cs ) { if (cs == NULL) @@ -143,8 +143,8 @@ clr_consp( /* initialize a conspicuity sum */ static void sum_consp( /* sum in conspicuity result */ - register struct ConspSum *cdest, - register struct ConspSum *cs + struct ConspSum *cdest, + struct ConspSum *cs ) { if ((cdest == NULL) | (cs == NULL)) @@ -165,7 +165,7 @@ est_consp( /* estimate error conspicuity & update */ int y0, int x1, int y1, - register struct ConspSum *cs + struct ConspSum *cs ) { double rad2, mtn2, cpd, vm, vr, csf, eest; @@ -236,7 +236,7 @@ est_consp( /* estimate error conspicuity & update */ /* put into map */ for ( ; y0 < y1; y0++) { float *em0 = cerrmap + fndx(x0, y0); - register float *emp = em0 + (x1-x0); + float *emp = em0 + (x1-x0); while (emp-- > em0) if (eest > *emp) *emp = eest; @@ -263,7 +263,7 @@ subconspicuity( /* compute subportion of conspicuity * if ((x0 == x1-1) & (y0 == y1-1)) { /* single pixel */ double hls; - register int n = fndx(x0, y0); + int n = fndx(x0, y0); if (sbuffer[n]) { copycolor(mysum.vsum, cbuffer[n]); copycolor(mysum.v2sum, val2map[n]); @@ -310,7 +310,7 @@ subconspicuity( /* compute subportion of conspicuity * sum_consp(cs, &mysum); } -extern void +void conspicuity(void) /* compute conspicuous error map */ { int fhres, fvres; @@ -375,11 +375,11 @@ ppri_cmp( /* pixel priority comparison */ static int ray_refine( /* refine the given pixel by tracing a ray */ - register int n + int n ) { RAY ir; - COLOR ctmp; + COLOR rcol, ctmp, csqr; int i; if (n < 0) { /* fetching stragglers */ @@ -407,6 +407,7 @@ ray_refine( /* refine the given pixel by tracing a r } else ray_trace(&ir); } + scolor_rgb(rcol, ir.rcol); if (abuffer[n] == ALOWQ && asump != NULL) { if (sbuffer[n] != 1) error(CONSISTENCY, "bad code in ray_refine"); @@ -416,24 +417,22 @@ ray_refine( /* refine the given pixel by tracing a r (colval(ctmp,BLU) > 0.01)) { for (i = 0; i < 3; i++) asump->diffsum[i] += - (colval(ir.rcol,i) - colval(cbuffer[n],i)) + (colval(rcol,i) - colval(cbuffer[n],i)) / colval(ctmp,i); asump->nsamps++; } sbuffer[n] = 0; } - setcolor(ctmp, - colval(ir.rcol,RED)*colval(ir.rcol,RED), - colval(ir.rcol,GRN)*colval(ir.rcol,GRN), - colval(ir.rcol,BLU)*colval(ir.rcol,BLU)); + copycolor(csqr, rcol); + multcolor(csqr, rcol); if (!sbuffer[n]) { /* first sample */ - copycolor(cbuffer[n], ir.rcol); - copycolor(val2map[n], ctmp); + copycolor(cbuffer[n], rcol); + copycolor(val2map[n], csqr); abuffer[n] = AHIGHQ; sbuffer[n] = 1; } else { /* else sum in sample */ - addcolor(cbuffer[n], ir.rcol); - addcolor(val2map[n], ctmp); + addcolor(cbuffer[n], rcol); + addcolor(val2map[n], csqr); sbuffer[n]++; } return(n); @@ -463,7 +462,8 @@ refine_rays( /* compute refinement rays */ i = 0; /* trace rays in list */ for (rdone = 0; rdone < nrays; rdone++) { - if (ndtset && i >= 1000 && cerrmap[pord[i]] <= FTINY) + if (ndtset && (i >= 1000) & (i < ntodo) && + cerrmap[pord[i]] <= FTINY) ntodo = i; if (i >= ntodo) { /* redo conspicuity & priority */ while (ray_refine(-1) >= 0) @@ -486,7 +486,7 @@ refine_rays( /* compute refinement rays */ } -extern int +int refine_frame( /* refine current frame */ int pass ) @@ -499,7 +499,7 @@ refine_frame( /* refine current frame */ double time_start, rtime_start, time_done; struct AmbSum myAmbSum; long rays_todo, nr; - register int n; + int n; /* IBR refinement? */ if ((pass == 0) & (fcur > fbeg)) return(refine_first());