}
}
fn calc_dist(&mut self) {
- if self.count != 0 {
- self.dist = (self.dist + self.count / 2) / self.count;
- }
}
}
clu1.calc_dist();
clu0.dist + clu1.dist
}
- #[allow(clippy::cyclomatic_complexity)]
+ #[allow(clippy::cognitive_complexity)]
pub fn quantise(&mut self, src: &[Pixel], dst: &mut [[u8; 3]; 256]) {
if src.len() < 3 {
return;
let mut rng = RNG::new();
let mut iterations = 0usize;
let mut do_elbg_step = true;
- while (iterations < 20) && (dist < prev_dist - prev_dist / 1000) {
+ while (iterations < 10) && (dist < prev_dist - prev_dist / 100) {
prev_dist = dist;
for i in 0..256 {
old_cb[i] = self.clusters[i].centroid;