| 55 |
|
|
| 56 |
|
|
| 57 |
|
#if 0 |
| 58 |
< |
extern void |
| 58 |
> |
void |
| 59 |
|
write_map( /* write out float map (debugging) */ |
| 60 |
|
float *mp, |
| 61 |
|
char *fn |
| 185 |
|
} |
| 186 |
|
|
| 187 |
|
|
| 188 |
< |
extern void |
| 188 |
> |
void |
| 189 |
|
sample_pos( /* compute jittered sample position */ |
| 190 |
|
double hv[2], |
| 191 |
|
int x, |
| 202 |
|
} |
| 203 |
|
|
| 204 |
|
|
| 205 |
< |
extern double |
| 205 |
> |
double |
| 206 |
|
sample_wt( /* compute interpolant sample weight */ |
| 207 |
|
int xo, |
| 208 |
|
int yo |
| 236 |
|
} |
| 237 |
|
|
| 238 |
|
|
| 239 |
< |
extern int |
| 239 |
> |
int |
| 240 |
|
getclosest( /* get nc closest neighbors on same object */ |
| 241 |
|
int *iarr, |
| 242 |
|
int nc, |
| 452 |
|
} |
| 453 |
|
|
| 454 |
|
|
| 455 |
< |
extern int |
| 455 |
> |
int |
| 456 |
|
getambcolor( /* get ambient color for object if we can */ |
| 457 |
|
COLOR clr, |
| 458 |
|
int obj |
| 520 |
|
} |
| 521 |
|
|
| 522 |
|
|
| 523 |
< |
extern double |
| 523 |
> |
double |
| 524 |
|
estimaterr( /* estimate relative error from samples */ |
| 525 |
|
COLOR cs, |
| 526 |
|
COLOR cs2, |
| 546 |
|
} |
| 547 |
|
|
| 548 |
|
|
| 549 |
< |
extern double |
| 549 |
> |
double |
| 550 |
|
comperr( /* estimate relative error in neighborhood */ |
| 551 |
|
int *neigh, |
| 552 |
|
int nc, |
| 582 |
|
} |
| 583 |
|
|
| 584 |
|
|
| 585 |
< |
extern void |
| 585 |
> |
void |
| 586 |
|
comp_frame_error(void) /* initialize frame error values */ |
| 587 |
|
{ |
| 588 |
|
uby8 *edone = NULL; |
| 610 |
|
* by the returned ray value -- we take half of this. |
| 611 |
|
*/ |
| 612 |
|
edone = (uby8 *)calloc(hres*vres, sizeof(uby8)); |
| 613 |
< |
for (y = vres; y--; ) |
| 614 |
< |
for (x = hres; x--; ) { |
| 615 |
< |
n = fndx(x, y); |
| 613 |
> |
for (n = hres*vres; n--; ) { |
| 614 |
|
if ((abuffer[n] != ALOWQ) | (obuffer[n] == OVOID)) |
| 615 |
|
continue; |
| 616 |
|
if (!getambcolor(objamb, obuffer[n])) |
| 627 |
|
else if (i >= ADISTANT/2) i = ADISTANT/2-1; |
| 628 |
|
abuffer[n] = i; |
| 629 |
|
edone[n] = 1; |
| 630 |
< |
} |
| 630 |
> |
} |
| 631 |
|
} |
| 632 |
|
/* final statistical estimate */ |
| 633 |
|
for (y = vres; y--; ) |
| 659 |
|
} |
| 660 |
|
|
| 661 |
|
|
| 662 |
< |
extern void |
| 662 |
> |
void |
| 663 |
|
init_frame(void) /* render base (low quality) frame */ |
| 664 |
|
{ |
| 665 |
|
int restart; |
| 716 |
|
} |
| 717 |
|
|
| 718 |
|
|
| 719 |
< |
extern void |
| 719 |
> |
void |
| 720 |
|
filter_frame(void) /* interpolation, motion-blur, and exposure */ |
| 721 |
|
{ |
| 722 |
< |
double expval = expspec_val(getexp(fcur)); |
| 723 |
< |
int x, y; |
| 724 |
< |
int neigh[NPINTERP]; |
| 725 |
< |
int nc; |
| 726 |
< |
COLOR cval; |
| 727 |
< |
double w, wsum; |
| 728 |
< |
int n; |
| 722 |
> |
const double expval = expspec_val(getexp(fcur)); |
| 723 |
> |
int x, y; |
| 724 |
> |
int neigh[NPINTERP]; |
| 725 |
> |
int nc; |
| 726 |
> |
COLOR cval; |
| 727 |
> |
double w, wsum; |
| 728 |
> |
int n; |
| 729 |
|
|
| 730 |
|
#if 0 |
| 731 |
|
/* XXX TEMPORARY!! */ |
| 745 |
|
fflush(stdout); |
| 746 |
|
} |
| 747 |
|
/* normalize samples */ |
| 748 |
< |
for (y = vres; y--; ) |
| 751 |
< |
for (x = hres; x--; ) { |
| 752 |
< |
n = fndx(x, y); |
| 748 |
> |
for (n = hres*vres; n--; ) { |
| 749 |
|
if (sbuffer[n] <= 1) |
| 750 |
|
continue; |
| 751 |
|
w = 1.0/(double)sbuffer[n]; |
| 752 |
|
scalecolor(cbuffer[n], w); |
| 753 |
< |
} |
| 753 |
> |
} |
| 754 |
|
/* interpolate samples */ |
| 755 |
|
for (y = vres; y--; ) |
| 756 |
|
for (x = hres; x--; ) { |
| 857 |
|
} |
| 858 |
|
} |
| 859 |
|
/* compute final results */ |
| 860 |
< |
for (y = vres; y--; ) |
| 865 |
< |
for (x = hres; x--; ) { |
| 866 |
< |
n = fndx(x, y); |
| 860 |
> |
for (n = hres*vres; n--; ) { |
| 861 |
|
if (wbuffer[n] <= FTINY) |
| 862 |
|
continue; |
| 863 |
< |
w = 1./wbuffer[n]; |
| 863 |
> |
w = expval/wbuffer[n]; |
| 864 |
|
scalecolor(outbuffer[n], w); |
| 865 |
< |
} |
| 866 |
< |
} else |
| 867 |
< |
for (n = hres*vres; n--; ) |
| 868 |
< |
copycolor(outbuffer[n], cbuffer[n]); |
| 865 |
> |
} |
| 866 |
> |
} else { /* no blur -- just exposure */ |
| 867 |
> |
memcpy(outbuffer, cbuffer, sizeof(COLOR)*hres*vres); |
| 868 |
> |
for (n = ((expval < 0.99) | (expval > 1.01))*hres*vres; n--; ) |
| 869 |
> |
scalecolor(outbuffer[n], expval); |
| 870 |
> |
} |
| 871 |
|
/* |
| 872 |
|
for (n = hres*vres; n--; ) |
| 873 |
|
if (!sbuffer[n]) |
| 874 |
|
setcolor(outbuffer[n], 0., 0., 0.); |
| 875 |
|
*/ |
| 880 |
– |
/* adjust exposure */ |
| 881 |
– |
if ((expval < 0.99) | (expval > 1.01)) |
| 882 |
– |
for (n = hres*vres; n--; ) |
| 883 |
– |
scalecolor(outbuffer[n], expval); |
| 876 |
|
#if 0 |
| 877 |
|
{ |
| 878 |
|
float *sbuf = (float *)malloc(sizeof(float)*hres*vres); |
| 888 |
|
} |
| 889 |
|
|
| 890 |
|
|
| 891 |
< |
extern void |
| 891 |
> |
void |
| 892 |
|
send_frame(void) /* send frame to destination */ |
| 893 |
|
{ |
| 894 |
|
char fname[1024]; |
| 994 |
|
} |
| 995 |
|
|
| 996 |
|
|
| 997 |
< |
extern void |
| 997 |
> |
void |
| 998 |
|
free_frame(void) /* free frame allocation */ |
| 999 |
|
{ |
| 1000 |
|
if (cbuffer == NULL) |