MCPcopy Create free account
hub / github.com/DentonW/DevIL / alterneigh

Function alterneigh

DevIL/src-IL/src/il_neuquant.cpp:301–334  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

299// ---------------------------------------------------------------------------------
300
301void alterneigh(ILint rad, ILint i, ILint b, ILint g, ILint r)
302{
303 ILint j,k,lo,hi,a;
304 ILint *p, *q;
305
306 lo = i-rad; if (lo<-1) lo=-1;
307 hi = i+rad; if (hi>netsizethink) hi=netsizethink;
308
309 j = i+1;
310 k = i-1;
311 q = radpower;
312 while ((j<hi) || (k>lo)) {
313 a = (*(++q));
314 if (j<hi) {
315 p = network[j];
316 *p -= (a*(*p - b)) / alpharadbias;
317 p++;
318 *p -= (a*(*p - g)) / alpharadbias;
319 p++;
320 *p -= (a*(*p - r)) / alpharadbias;
321 j++;
322 }
323 if (k>lo) {
324 p = network[k];
325 *p -= (a*(*p - b)) / alpharadbias;
326 p++;
327 *p -= (a*(*p - g)) / alpharadbias;
328 p++;
329 *p -= (a*(*p - r)) / alpharadbias;
330 k--;
331 }
332 }
333 return;
334}
335
336
337// Main Learning Loop

Callers 1

learnFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected