11 |
|
|
12 |
|
#include "copyright.h" |
13 |
|
|
14 |
+ |
#include <string.h> |
15 |
+ |
|
16 |
|
#include "ranimove.h" |
17 |
|
#include "random.h" |
18 |
|
|
38 |
|
printf("\tFirst refinement pass..."); |
39 |
|
fflush(stdout); |
40 |
|
} |
41 |
< |
bzero((void *)esamp, sizeof(int)*hres*vres); |
41 |
> |
memset((void *)esamp, '\0', sizeof(int)*hres*vres); |
42 |
|
/* |
43 |
|
* In our initial pass, we look for lower error pixels from |
44 |
|
* the same objects in the previous frame, and copy them here. |
51 |
|
if (xmbuffer[n] == MO_UNK) |
52 |
|
continue; |
53 |
|
xp = x + xmbuffer[n]; |
54 |
< |
if ((xp < 0 | xp >= hres)) |
54 |
> |
if ((xp < 0) | (xp >= hres)) |
55 |
|
continue; |
56 |
|
yp = y + ymbuffer[n]; |
57 |
< |
if ((yp < 0 | yp >= vres)) |
57 |
> |
if ((yp < 0) | (yp >= vres)) |
58 |
|
continue; |
59 |
|
np = fndx(xp, yp); |
60 |
|
/* make sure we hit same object */ |
135 |
|
sum_consp(cdest, cs) /* sum in conspicuity result */ |
136 |
|
register struct ConspSum *cdest, *cs; |
137 |
|
{ |
138 |
< |
if ((cdest == NULL | cs == NULL)) |
138 |
> |
if ((cdest == NULL) | (cs == NULL)) |
139 |
|
return; |
140 |
|
addcolor(cdest->vsum, cs->vsum); |
141 |
|
addcolor(cdest->v2sum, cs->v2sum); |
165 |
|
} else |
166 |
|
eest = estimaterr(cs->vsum, cs->v2sum, cs->nsamp, cs->nsamp); |
167 |
|
|
168 |
< |
if ((x0 == x1-1 & y0 == y1-1)) { /* update pixel error */ |
168 |
> |
if ((x0 == x1-1) & (y0 == y1-1)) { /* update pixel error */ |
169 |
|
int n = fndx(x0, y0); |
170 |
|
int ai; |
171 |
|
int ne; |
235 |
|
struct ConspSum mysum; |
236 |
|
int i; |
237 |
|
|
238 |
< |
if ((x0 >= x1 | y0 >= y1)) |
238 |
> |
if ((x0 >= x1) | (y0 >= y1)) |
239 |
|
error(CONSISTENCY, "bad call to subconspicuity"); |
240 |
|
|
241 |
|
clr_consp(&mysum); /* prepare sum */ |
242 |
|
|
243 |
< |
if ((x0 == x1-1 & y0 == y1-1)) { /* single pixel */ |
243 |
> |
if ((x0 == x1-1) & (y0 == y1-1)) { /* single pixel */ |
244 |
|
double hls; |
245 |
|
register int n = fndx(x0, y0); |
246 |
|
if (sbuffer[n]) { |
296 |
|
int fx, fy; |
297 |
|
/* reuse previous z-buffer */ |
298 |
|
cerrmap = (float *)zprev; |
299 |
< |
bzero((void *)cerrmap, sizeof(float)*hres*vres); |
299 |
> |
memset((void *)cerrmap, '\0', sizeof(float)*hres*vres); |
300 |
|
cerrzero = 1; |
301 |
|
/* compute base pixel frequency */ |
302 |
|
pixel_deg = .5*(hres/vw.horiz + vres/vw.vert); |
389 |
|
if (sbuffer[n] != 1) |
390 |
|
error(CONSISTENCY, "bad code in ray_refine"); |
391 |
|
if (getambcolor(ctmp, obuffer[n]) && |
392 |
< |
(colval(ctmp,RED) > 0.01 & |
393 |
< |
colval(ctmp,GRN) > 0.01 & |
394 |
< |
colval(ctmp,BLU) > 0.01)) { |
392 |
> |
(colval(ctmp,RED) > 0.01) & |
393 |
> |
(colval(ctmp,GRN) > 0.01) & |
394 |
> |
(colval(ctmp,BLU) > 0.01)) { |
395 |
|
for (i = 0; i < 3; i++) |
396 |
|
asump->diffsum[i] += |
397 |
|
(colval(ir.rcol,i) - colval(cbuffer[n],i)) |
428 |
|
int i; |
429 |
|
/* skip if nothing significant */ |
430 |
|
if (ndtset && cerrzero) |
431 |
< |
return; |
431 |
> |
return(0); |
432 |
|
/* initialize priority list */ |
433 |
|
pord = (int *)malloc(sizeof(int)*hres*vres); |
434 |
|
for (i = hres*vres; i--; ) |
471 |
|
static long ray_cnt = 0; |
472 |
|
static double ctime_used = 0; |
473 |
|
static int csp_cnt = 0; |
474 |
< |
int timed = (fcur > fbeg | pass > 0 | quickstart); |
474 |
> |
int timed = (fcur > fbeg) | (pass > 0) | (quickstart); |
475 |
|
double time_start, rtime_start, time_done; |
476 |
|
struct AmbSum myAmbSum; |
477 |
|
long rays_todo, nr; |
478 |
|
register int n; |
479 |
|
/* IBR refinement? */ |
480 |
< |
if ((pass == 0 & fcur > fbeg)) |
480 |
> |
if ((pass == 0) & (fcur > fbeg)) |
481 |
|
return(refine_first()); |
482 |
|
/* any time left? */ |
483 |
|
time_start = getTime(); |
599 |
|
return(1); |
600 |
|
nomore: |
601 |
|
/* make sure error map is updated */ |
602 |
< |
if ((fcur == fbeg | pass > 1)) |
602 |
> |
if ((fcur == fbeg) | (pass > 1)) |
603 |
|
comp_frame_error(); |
604 |
|
return(0); |
605 |
|
} |