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

Method target_mse

src/attr.rs:295–303  ·  view source on GitHub ↗

`max_mse`, `target_mse`, user asked for perfect quality

(&self, hist_items_len: usize)

Source from the content-addressed store, hash-verified

293
294 /// `max_mse`, `target_mse`, user asked for perfect quality
295 pub(crate) fn target_mse(&self, hist_items_len: usize) -> (Option<f64>, f64, bool) {
296 let max_mse = self.max_mse.map(|mse| mse * if hist_items_len <= MAX_COLORS { 0.33 } else { 1. });
297 let aim_for_perfect_quality = self.target_mse == 0.;
298 let mut target_mse = self.target_mse.max((f64::from(1 << self.min_posterization_output) / 1024.).powi(2));
299 if let Some(max_mse) = max_mse {
300 target_mse = target_mse.min(max_mse);
301 }
302 (max_mse, target_mse, aim_for_perfect_quality)
303 }
304
305 /// returns iterations, `iteration_limit`
306 #[must_use]

Callers 3

newMethod · 0.80
countersFunction · 0.80
getsetFunction · 0.80

Calls

no outgoing calls

Tested by 2

countersFunction · 0.64
getsetFunction · 0.64