Tweak eval cmp key for more consistent results (#671)
This changes the evaluator to prefer a later image instead of an earlier one in the case of a tie. This gives more consistent results since the baseline is always added last. I also removed bit depth from the key since the uncompressed size should cover that. Fixes #649. (Mostly. I did discover another possible but very rare issue: if multiple colours tie for "most popular edge colour" in the luma sort, the sort may affect which one is actually picked and multiple runs may flip-flop back and forth)
This commit is contained in:
parent
14b8b0e93a
commit
8a44cdbc84
1 changed files with 3 additions and 3 deletions
|
|
@ -23,7 +23,7 @@ pub(crate) struct Candidate {
|
||||||
pub idat_data: Vec<u8>,
|
pub idat_data: Vec<u8>,
|
||||||
pub filtered: Vec<u8>,
|
pub filtered: Vec<u8>,
|
||||||
pub filter: RowFilter,
|
pub filter: RowFilter,
|
||||||
// first wins tie-breaker
|
// For determining tie-breaker
|
||||||
nth: usize,
|
nth: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -32,9 +32,9 @@ impl Candidate {
|
||||||
(
|
(
|
||||||
self.idat_data.len() + self.image.key_chunks_size(),
|
self.idat_data.len() + self.image.key_chunks_size(),
|
||||||
self.image.data.len(),
|
self.image.data.len(),
|
||||||
self.image.ihdr.bit_depth,
|
|
||||||
self.filter,
|
self.filter,
|
||||||
self.nth,
|
// Prefer the later image added (e.g. baseline, which is always added last)
|
||||||
|
usize::MAX - self.nth,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue