| 18 |
|
VIEW myview = STDVIEW; /* current output view */ |
| 19 |
|
int xres = 512, yres = 512; /* max. horizontal and vertical resolution */ |
| 20 |
|
char *outspec = NULL; /* output file specification */ |
| 21 |
+ |
double randfrac = -1.; /* random resampling fraction */ |
| 22 |
|
double pixaspect = 1.; /* pixel aspect ratio */ |
| 23 |
|
int seqstart = 0; /* sequence start frame */ |
| 24 |
|
double expval = 1.; /* exposure value */ |
| 75 |
|
goto userr; |
| 76 |
|
outspec = argv[++i]; |
| 77 |
|
break; |
| 78 |
+ |
case 'r': /* random sampling */ |
| 79 |
+ |
if (badarg(argc-i-1,argv+i+1,"f")) |
| 80 |
+ |
goto userr; |
| 81 |
+ |
randfrac = atof(argv[++i]); |
| 82 |
+ |
break; |
| 83 |
+ |
case 's': /* smooth sampling */ |
| 84 |
+ |
randfrac = -1.; |
| 85 |
+ |
break; |
| 86 |
|
case 'S': /* sequence start */ |
| 87 |
|
if (badarg(argc-i-1,argv+i+1,"i")) |
| 88 |
|
goto userr; |
| 89 |
|
seqstart = atoi(argv[++i]); |
| 90 |
|
break; |
| 91 |
|
case 'v': /* view file */ |
| 92 |
< |
if (argv[i][1]!='f' || badarg(argc-i-1,argv+i+1,"s")) |
| 92 |
> |
if (argv[i][2]!='f' || badarg(argc-i-1,argv+i+1,"s")) |
| 93 |
|
goto userr; |
| 94 |
|
rval = viewfile(argv[++i], &myview, NULL); |
| 95 |
|
if (rval < 0) { |
| 120 |
|
quit(0); /* all done! */ |
| 121 |
|
userr: |
| 122 |
|
fprintf(stderr, |
| 123 |
< |
"Usage: %s [-w][-pa pa][-pe ex][-x hr][-y vr][-S stfn][-o outp][view] input.hdk\n", |
| 123 |
> |
"Usage: %s [-w][-r rf][-pa pa][-pe ex][-x hr][-y vr][-S stfn][-o outp][view] input.hdk\n", |
| 124 |
|
progname); |
| 125 |
|
quit(1); |
| 126 |
|
} |
| 180 |
|
bil[i].b = bl[i].bi; |
| 181 |
|
} |
| 182 |
|
hdloadbeams(bil, nb, pixBeam); |
| 183 |
< |
pixFlush(); |
| 183 |
> |
pixFinish(randfrac); |
| 184 |
|
free((char *)bil); |
| 185 |
|
} |
| 186 |
|
|
| 229 |
|
int |
| 230 |
|
endpicture() /* finish and write out pixels */ |
| 231 |
|
{ |
| 232 |
< |
int nunrend = 0; |
| 233 |
< |
int v; |
| 232 |
> |
int lastr = -1, nunrend = 0; |
| 233 |
> |
int4 lastp, lastrp; |
| 234 |
> |
register int4 p; |
| 235 |
|
register double d; |
| 226 |
– |
register int p; |
| 236 |
|
/* compute final pixel values */ |
| 237 |
|
for (p = hres*vres; p--; ) { |
| 238 |
|
if (myweight[p] <= FTINY) { |
| 239 |
+ |
if (lastr >= 0) |
| 240 |
+ |
if (p/hres == lastp/hres) |
| 241 |
+ |
copycolor(mypixel[p], mypixel[lastp]); |
| 242 |
+ |
else |
| 243 |
+ |
copycolor(mypixel[p], mypixel[lastrp]); |
| 244 |
|
nunrend++; |
| 245 |
|
continue; |
| 246 |
|
} |
| 247 |
|
d = expval/myweight[p]; |
| 248 |
|
scalecolor(mypixel[p], d); |
| 249 |
+ |
if ((lastp=p)/hres != lastr) |
| 250 |
+ |
lastr = (lastrp=p)/hres; |
| 251 |
|
} |
| 252 |
|
/* write each scanline */ |
| 253 |
< |
for (v = vres; v--; ) |
| 254 |
< |
if (fwritescan(mypixel+v*hres, hres, stdout) < 0) |
| 253 |
> |
for (p = vres; p--; ) |
| 254 |
> |
if (fwritescan(mypixel+p*hres, hres, stdout) < 0) |
| 255 |
|
return(-1); |
| 256 |
|
if (fflush(stdout) == EOF) |
| 257 |
|
return(-1); |