for (r = 0; r < 256; r+=0x33)
for (g = 0; g < 256; g+=0x33)
for (b = 0; b < 256; b += 0x33)
- setcol(quant->mc_colors+i++, r, g, b, 0);
+ setcol(quant->mc_colors+i++, r, g, b, 255);
quant->mc_count = i;
}
break;
i_palidx *result;
mm_log((1, "quant_translate(quant %p, img %p)\n", quant, img));
+ /* there must be at least one color in the paletted (though even that
+ isn't very useful */
+ if (quant->mc_count == 0) {
+ i_push_error(0, "no colors available for translation");
+ return NULL;
+ }
+
result = mymalloc(img->xsize * img->ysize);
switch (quant->translate) {
i_sample_t *line;
const int *sample_indices;
+ mm_log((1, "makemap_addi(quant %p { mc_count=%d, mc_colors=%p }, imgs %p, count %d)\n",
+ quant, quant->mc_count, quant->mc_colors, imgs, count));
+
i_mempool_init(&mp);
clr = i_mempool_alloc(&mp, sizeof(cvec) * quant->mc_size);
}
/* mymalloc doesn't clear memory, so I think we need this */
for (; i < quant->mc_size; ++i) {
+ /*clr[i].r = clr[i].g = clr[i].b = 0;*/
+ clr[i].dr = 0;
+ clr[i].dg = 0;
+ clr[i].db = 0;
clr[i].fixed = 0;
clr[i].mcount = 0;
}
quant->mc_count = cnum;
#endif
+#if 0
+ mm_log((1, "makemap_addi returns - quant.mc_count = %d\n", quant->mc_count));
+ for (i = 0; i < quant->mc_count; ++i)
+ mm_log((5, " map entry %d: (%d, %d, %d)\n", i, clr[i].r, clr[i].g, clr[i].b));
+#endif
+
i_mempool_destroy(&mp);
}