static void makemap_addi(i_quantize *, i_img **imgs, int count);
static void makemap_mediancut(i_quantize *, i_img **imgs, int count);
static void makemap_mono(i_quantize *);
+static void makemap_gray(i_quantize *, int step);
static int makemap_palette(i_quantize *, i_img **imgs, int count);
makemap_mono(quant);
break;
+ case mc_gray:
+ makemap_gray(quant, 1);
+ break;
+
+ case mc_gray4:
+ makemap_gray(quant, 85);
+ break;
+
+ case mc_gray16:
+ makemap_gray(quant, 17);
+ break;
+
case mc_addi:
default:
makemap_addi(quant, imgs, count);
quant->mc_count = 2;
}
+static void
+makemap_gray(i_quantize *quant, int step) {
+ int gray = 0;
+ int i = 0;
+
+ while (gray < 256) {
+ setcol(quant->mc_colors+i, gray, gray, gray, 255);
+ ++i;
+ gray += step;
+ }
+ quant->mc_count = i;
+}
+
static void
makemap_webmap(i_quantize *quant) {
int r, g, b;
void
cr_hashindex(cvec clr[256],int cnum,hashbox hb[512]) {
- int bx,mind,cd,cumcnt,bst_idx,i;
+ int bx,mind,cd,cumcnt,i;
/* printf("indexing... \n");*/
cumcnt=0;
mind=196608;
for(i=0; i<cnum; i++) {
cd = maxdist(bx,&clr[i]);
- if (cd < mind) { mind=cd; bst_idx=i; }
+ if (cd < mind) { mind=cd; }
}
hb[bx].cnt=0;