63 |
|
nsamples = npixels/samplefac; |
64 |
|
if (nsamples < 600) |
65 |
|
return(-1); |
66 |
< |
thesamples = (BYTE *)malloc((nsamples+1)*3); |
66 |
> |
thesamples = (BYTE *)malloc(nsamples*3); |
67 |
|
if (thesamples == NULL) |
68 |
|
return(-1); |
69 |
|
cursamp = thesamples; |
75 |
|
cumprob = 0.; |
76 |
|
while ((cumprob += (1.-cumprob)*nsleft/(npleft-sv)) < rval) |
77 |
|
sv++; |
78 |
< |
setskip(cursamp, sv); |
79 |
< |
cursamp += 3; |
80 |
< |
npleft -= sv; |
78 |
> |
if (nsleft == nsamples) |
79 |
> |
skipcount = sv; |
80 |
> |
else { |
81 |
> |
setskip(cursamp, sv); |
82 |
> |
cursamp += 3; |
83 |
> |
} |
84 |
> |
npleft -= sv+1; |
85 |
|
nsleft--; |
86 |
|
} |
87 |
< |
setskip(cursamp, 0); /* dummy tagged onto end */ |
87 |
> |
setskip(cursamp, npleft); /* tag on end to skip the rest */ |
88 |
|
cursamp = thesamples; |
85 |
– |
skipcount = nskip(cursamp); |
89 |
|
return(0); |
90 |
|
} |
91 |
|
|
94 |
|
register BYTE col[]; |
95 |
|
{ |
96 |
|
if (!skipcount--) { |
97 |
+ |
skipcount = nskip(cursamp); |
98 |
|
cursamp[0] = col[BLU]; |
99 |
|
cursamp[1] = col[GRN]; |
100 |
|
cursamp[2] = col[RED]; |
101 |
|
cursamp += 3; |
98 |
– |
skipcount = nskip(cursamp); |
102 |
|
} |
103 |
|
} |
104 |
|
|
109 |
|
{ |
110 |
|
while (n > skipcount) { |
111 |
|
cs += skipcount; |
112 |
+ |
n -= skipcount+1; |
113 |
+ |
skipcount = nskip(cursamp); |
114 |
|
cursamp[0] = cs[0][BLU]; |
115 |
|
cursamp[1] = cs[0][GRN]; |
116 |
|
cursamp[2] = cs[0][RED]; |
117 |
|
cs++; |
113 |
– |
n -= skipcount+1; |
118 |
|
cursamp += 3; |
115 |
– |
skipcount = nskip(cursamp); |
119 |
|
} |
120 |
|
skipcount -= n; |
121 |
|
} |
252 |
|
|
253 |
|
#define initrad 32 |
254 |
|
#define radiusdec 30 |
255 |
< |
#define alphadec; 30 |
255 |
> |
#define alphadec 30 |
256 |
|
|
257 |
|
/* defs for freq and bias */ |
258 |
|
#define gammashift 10 |
312 |
|
|
313 |
|
for (i=0; i<clrtabsiz; i++) { |
314 |
|
p = network[i]; |
315 |
< |
p[0] = i << netbiasshift; |
316 |
< |
p[1] = i << netbiasshift; |
317 |
< |
p[2] = i << netbiasshift; |
318 |
< |
freq[i] = intbias >> 8; /* 1/256 */ |
315 |
> |
p[0] = |
316 |
> |
p[1] = |
317 |
> |
p[2] = (i<<(netbiasshift+8))/clrtabsiz; |
318 |
> |
freq[i] = intbias/clrtabsiz; /* 1/256 */ |
319 |
|
bias[i] = 0; |
320 |
|
} |
321 |
|
} |
357 |
|
start = i; |
358 |
|
} |
359 |
|
} |
360 |
< |
netindex[previous] = (start+clrtabsiz-1)>>1; |
361 |
< |
for (j=previous+1; j<clrtabsiz; j++) netindex[j] = clrtabsiz-1; |
360 |
> |
netindex[previous] = (start+255)>>1; |
361 |
> |
for (j=previous+1; j<256; j++) netindex[j] = 255; |
362 |
|
} |
363 |
|
|
364 |
|
|