233 |
|
#define lengthcount (nsamples*3) |
234 |
|
#define samplefac 1 |
235 |
|
|
236 |
< |
/*----------------------------------------------------------------------*/ |
237 |
< |
/* */ |
238 |
< |
/* NeuQuant */ |
239 |
< |
/* -------- */ |
240 |
< |
/* */ |
241 |
< |
/* Copyright: Anthony Dekker, November 1994 */ |
242 |
< |
/* */ |
243 |
< |
/* This program performs colour quantization of graphics images (SUN */ |
244 |
< |
/* raster files). It uses a Kohonen Neural Network. It produces */ |
245 |
< |
/* better results than existing methods and runs faster, using minimal */ |
246 |
< |
/* space (8kB plus the image itself). The algorithm is described in */ |
247 |
< |
/* the paper "Kohonen Neural Networks for Optimal Colour Quantization" */ |
248 |
< |
/* to appear in the journal "Network: Computation in Neural Systems". */ |
249 |
< |
/* It is a significant improvement of an earlier algorithm. */ |
250 |
< |
/* */ |
251 |
< |
/* This program is distributed free for academic use or for evaluation */ |
252 |
< |
/* by commercial organizations. */ |
253 |
< |
/* */ |
254 |
< |
/* Usage: NeuQuant -n inputfile > outputfile */ |
255 |
< |
/* */ |
256 |
< |
/* where n is a sampling factor for neural learning. */ |
257 |
< |
/* */ |
258 |
< |
/* Program performance compared with other methods is as follows: */ |
259 |
< |
/* */ |
260 |
< |
/* Algorithm | Av. CPU Time | Quantization Error */ |
261 |
< |
/* ------------------------------------------------------------- */ |
262 |
< |
/* NeuQuant -3 | 314 | 5.55 */ |
263 |
< |
/* NeuQuant -10 | 119 | 5.97 */ |
264 |
< |
/* NeuQuant -30 | 65 | 6.53 */ |
265 |
< |
/* Oct-Trees | 141 | 8.96 */ |
266 |
< |
/* Median Cut (XV -best) | 420 | 9.28 */ |
267 |
< |
/* Median Cut (XV -slow) | 72 | 12.15 */ |
268 |
< |
/* */ |
269 |
< |
/* Author's address: Dept of ISCS, National University of Singapore */ |
270 |
< |
/* Kent Ridge, Singapore 0511 */ |
271 |
< |
/* Email: [email protected] */ |
272 |
< |
/*----------------------------------------------------------------------*/ |
236 |
> |
/* NeuQuant Neural-Net Quantization Algorithm Interface |
237 |
> |
* ---------------------------------------------------- |
238 |
> |
* |
239 |
> |
* Copyright (c) 1994 Anthony Dekker |
240 |
> |
* |
241 |
> |
* NEUQUANT Neural-Net quantization algorithm by Anthony Dekker, 1994. |
242 |
> |
* See "Kohonen neural networks for optimal colour quantization" |
243 |
> |
* in "Network: Computation in Neural Systems" Vol. 5 (1994) pp 351-367. |
244 |
> |
* for a discussion of the algorithm. |
245 |
> |
* See also http://members.ozemail.com.au/~dekker/NEUQUANT.HTML |
246 |
> |
* |
247 |
> |
* Any party obtaining a copy of these files from the author, directly or |
248 |
> |
* indirectly, is granted, free of charge, a full and unrestricted irrevocable, |
249 |
> |
* world-wide, paid up, royalty-free, nonexclusive right and license to deal |
250 |
> |
* in this software and documentation files (the "Software"), including without |
251 |
> |
* limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, |
252 |
> |
* and/or sell copies of the Software, and to permit persons who receive |
253 |
> |
* copies from any such party to do so, with the only requirement being |
254 |
> |
* that this copyright notice remain intact. |
255 |
> |
*/ |
256 |
|
|
257 |
|
#define bool int |
258 |
|
#define false 0 |