--- ray/src/px/neuclrtab.c 1994/11/21 15:56:20 2.6 +++ ray/src/px/neuclrtab.c 1994/11/22 12:19:21 2.7 @@ -257,7 +257,7 @@ int n; #define true 1 /* network defs */ -#define netsize 256 /* number of colours - can change this */ +#define netsize clrtabsiz /* number of colours - can change this */ #define maxnetpos (netsize-1) #define netbiasshift 4 /* bias for colour values */ #define ncycles 100 /* no. of learning cycles */ @@ -272,7 +272,7 @@ int n; #define betagamma (intbias<<(gammashift-betashift)) /* defs for decreasing radius factor */ -#define initrad (netsize>>3) /* for 256 cols, radius starts */ +#define initrad (256>>3) /* for 256 cols, radius starts */ #define radiusbiasshift 6 /* at 32.0 biased by 6 bits */ #define radiusbias (((int) 1)<=0)) { - if (i=0)) { + if (i= bestd) i = clrtabsiz; /* stop iter */ + if (dist >= bestd) i = netsize; /* stop iter */ else { i++; if (dist<0) dist = -dist; @@ -418,7 +418,7 @@ register int b,g,r; /* finds closest neuron (min dist) and updates freq */ /* finds best neuron (min dist-bias) and returns position */ /* for frequently chosen neurons, freq[i] is high and bias[i] is negative */ -/* bias[i] = gamma*((1/clrtabsiz)-freq[i]) */ +/* bias[i] = gamma*((1/netsize)-freq[i]) */ int contest(b,g,r) /* accepts biased BGR values */ register int b,g,r; @@ -434,7 +434,7 @@ register int b,g,r; p = bias; f = freq; - for (i=0; iclrtabsiz) hi=clrtabsiz; + hi = i+rad; if (hi>netsize) hi=netsize; j = i+1; k = i-1; @@ -572,7 +572,7 @@ unbiasnet() { int i,j; - for (i=0; i>= netbiasshift; network[i][3] = i; /* record colour no */ @@ -587,7 +587,7 @@ cpyclrtab() { register int i,j,k; - for (j=0; j