27 |
|
/* minimum box count for adaptive partition */ |
28 |
|
#define MINSAMP 7 |
29 |
|
/* maximum distance^2 before color reassign */ |
30 |
< |
#define MAXDST2 5 |
30 |
> |
#define MAXDST2 12 |
31 |
|
/* maximum frame buffer depth */ |
32 |
|
#define FBDEPTH 8 |
33 |
|
/* map a color */ |
42 |
|
#define prim(cn) ((cn)&3) |
43 |
|
#define pval(cn) ((cn)>>2) |
44 |
|
/* our color table */ |
45 |
< |
struct tabent { |
45 |
> |
static struct tabent { |
46 |
|
long sum[3]; /* sum of colors using this entry */ |
47 |
|
long n; /* number of colors */ |
48 |
|
short ent[3]; /* current table value */ |
61 |
|
new_ctab(ncolors) /* start new color table with max ncolors */ |
62 |
|
int ncolors; |
63 |
|
{ |
64 |
< |
if (ncolors < 1 || ncolors > 1<<FBDEPTH) |
64 |
> |
if (ncolors < 1) |
65 |
|
return(0); |
66 |
+ |
if (ncolors > 1<<FBDEPTH) |
67 |
+ |
ncolors = 1<<FBDEPTH; |
68 |
|
/* clear color table */ |
69 |
|
bzero(clrtab, sizeof(clrtab)); |
70 |
|
/* partition color space */ |