MCPcopy Create free account
hub / github.com/ImageOptim/libimagequant / palette_from_histogram

Function palette_from_histogram

src/quant.rs:457–464  ·  view source on GitHub ↗
(hist: &HistogramInternal, max_colors: PalLen)

Source from the content-addressed store, hash-verified

455
456#[cold]
457fn palette_from_histogram(hist: &HistogramInternal, max_colors: PalLen) -> (PalF, Option<f64>) {
458 let mut hist_pal = PalF::new();
459 for item in hist.items.iter() {
460 hist_pal.push(item.color, PalPop::new(item.perceptual_weight));
461 }
462
463 (hist_pal.with_fixed_colors(max_colors, &hist.fixed_colors), Some(0.))
464}
465
466pub(crate) fn quality_to_mse(quality: u8) -> f64 {
467 if quality == 0 {

Callers 1

find_best_paletteFunction · 0.85

Calls 3

newFunction · 0.85
pushMethod · 0.80
with_fixed_colorsMethod · 0.80

Tested by

no test coverage detected