| 78 |
|
|
| 79 |
|
void |
| 80 |
|
dobox( /* simple box filter */ |
| 81 |
< |
COLOR csum, |
| 81 |
> |
SCOLOR csum, |
| 82 |
|
int xcent, |
| 83 |
|
int ycent, |
| 84 |
|
int c, |
| 89 |
|
double d; |
| 90 |
|
int y; |
| 91 |
|
int x, offs; |
| 92 |
< |
COLOR *scan; |
| 92 |
> |
COLORV *scan, *scp; |
| 93 |
|
|
| 94 |
|
wsum = 0; |
| 95 |
< |
setcolor(csum, 0.0, 0.0, 0.0); |
| 95 |
> |
scolorblack(csum); |
| 96 |
|
for (y = ycent+1-ybrad; y <= ycent+ybrad; y++) { |
| 97 |
|
if (y < 0) continue; |
| 98 |
|
if (y >= yres) break; |
| 108 |
|
if (d < -0.5) continue; |
| 109 |
|
if (d >= 0.5) break; |
| 110 |
|
wsum++; |
| 111 |
< |
addcolor(csum, scan[x+offs]); |
| 111 |
> |
scp = scan + (x+offs)*NCSAMP; |
| 112 |
> |
saddscolor(csum, scp); |
| 113 |
|
} |
| 114 |
|
} |
| 115 |
|
if (wsum > 1) { |
| 116 |
|
d = 1.0/wsum; |
| 117 |
< |
scalecolor(csum, d); |
| 117 |
> |
scalescolor(csum, d); |
| 118 |
|
} |
| 119 |
|
} |
| 120 |
|
|
| 121 |
|
|
| 122 |
|
void |
| 123 |
|
dogauss( /* gaussian filter */ |
| 124 |
< |
COLOR csum, |
| 124 |
> |
SCOLOR csum, |
| 125 |
|
int xcent, |
| 126 |
|
int ycent, |
| 127 |
|
int c, |
| 129 |
|
) |
| 130 |
|
{ |
| 131 |
|
double dy, dx, weight, wsum; |
| 132 |
< |
COLOR ctmp; |
| 132 |
> |
SCOLOR ctmp; |
| 133 |
|
int y; |
| 134 |
|
int x, offs; |
| 135 |
< |
COLOR *scan; |
| 135 |
> |
COLORV *scan; |
| 136 |
|
|
| 137 |
|
wsum = FTINY; |
| 138 |
< |
setcolor(csum, 0.0, 0.0, 0.0); |
| 138 |
> |
scolorblack(csum); |
| 139 |
|
for (y = ycent-yrad; y <= ycent+yrad; y++) { |
| 140 |
|
if (y < 0) continue; |
| 141 |
|
if (y >= yres) break; |
| 148 |
|
dx = (x_c*(x+.5) - (c+.5))/rad; |
| 149 |
|
weight = lookgauss(dx*dx + dy*dy); |
| 150 |
|
wsum += weight; |
| 151 |
< |
copycolor(ctmp, scan[x+offs]); |
| 152 |
< |
scalecolor(ctmp, weight); |
| 153 |
< |
addcolor(csum, ctmp); |
| 151 |
> |
copyscolor(ctmp, scan+(x+offs)*NCSAMP); |
| 152 |
> |
scalescolor(ctmp, weight); |
| 153 |
> |
saddscolor(csum, ctmp); |
| 154 |
|
} |
| 155 |
|
} |
| 156 |
|
weight = 1.0/wsum; |
| 157 |
< |
scalecolor(csum, weight); |
| 157 |
> |
scalescolor(csum, weight); |
| 158 |
|
} |
| 159 |
|
|
| 160 |
|
|
| 203 |
|
if (d < -0.5) continue; |
| 204 |
|
if (d >= 0.5) break; |
| 205 |
|
sumans(x, y, rcent, ccent, |
| 206 |
< |
pickfilt((*ourbright)(scanin[y%barsize][x+offs]))); |
| 206 |
> |
pickfilt((*ourbright)(scanin[y%barsize]+(x+offs)*NCSAMP))); |
| 207 |
|
} |
| 208 |
|
} |
| 209 |
|
} |
| 280 |
|
) |
| 281 |
|
{ |
| 282 |
|
double dy2, dx; |
| 283 |
< |
COLOR pval, ctmp; |
| 283 |
> |
SCOLOR pval, ctmp; |
| 284 |
|
int ksiz, r, offs; |
| 285 |
|
double pc, pr, norm; |
| 286 |
|
int i, c; |
| 287 |
< |
COLOR *scan; |
| 287 |
> |
COLORV *scan, *scp; |
| 288 |
|
/* |
| 289 |
|
* This normalization method fails at the picture borders because |
| 290 |
|
* a different number of input pixels contribute there. |
| 291 |
|
*/ |
| 292 |
< |
scan = scanin[py%barsize] + (px < 0 ? xres : px >= xres ? -xres : 0); |
| 293 |
< |
copycolor(pval, scan[px]); |
| 292 |
> |
scan = scanin[py%barsize] + (px < 0 ? xres : px >= xres ? -xres : 0)*NCSAMP; |
| 293 |
> |
copyscolor(pval, scan+px*NCSAMP); |
| 294 |
|
pc = x_c*(px+.5); |
| 295 |
|
pr = y_r*(py+.5); |
| 296 |
|
ksiz = CHECKRAD*m*rad + 1; |
| 325 |
|
offs = c < 0 ? ncols : c >= ncols ? -ncols : 0; |
| 326 |
|
if ((offs != 0) & !wrapfilt) |
| 327 |
|
continue; |
| 328 |
< |
copycolor(ctmp, pval); |
| 328 |
> |
copyscolor(ctmp, pval); |
| 329 |
|
dx = norm*warr[i++]; |
| 330 |
< |
scalecolor(ctmp, dx); |
| 331 |
< |
addcolor(scan[c+offs], ctmp); |
| 330 |
> |
scalescolor(ctmp, dx); |
| 331 |
> |
scp = scan + (c+offs)*NCSAMP; |
| 332 |
> |
saddscolor(scp, ctmp); |
| 333 |
|
} |
| 334 |
|
} |
| 335 |
|
} |