Optimize filter mode 5 SAD loop
This commit is contained in:
parent
548c69cad7
commit
9302caed59
2 changed files with 5 additions and 6 deletions
|
|
@ -1,3 +1,6 @@
|
|||
**Version 0.3.1 (unreleased)**
|
||||
- Performance optimizations
|
||||
|
||||
**Version 0.3.0**
|
||||
- Properly decode interlaced images
|
||||
- [SEMVER_MINOR] Allow converting between progressive and interlaced images ([#3](https://github.com/shssoichiro/oxipng/issues/3))
|
||||
|
|
|
|||
|
|
@ -473,12 +473,8 @@ impl PngData {
|
|||
let (best_filter, best_line) = trials.iter()
|
||||
.min_by_key(|x| {
|
||||
x.1.iter().fold(0u64, |acc, &x| {
|
||||
let signed: i16 = if x > 127 {
|
||||
(x as i16) - 256
|
||||
} else {
|
||||
x as i16
|
||||
};
|
||||
acc + signed.abs() as u64
|
||||
let signed = x as i8;
|
||||
acc + (signed as i16).abs() as u64
|
||||
})
|
||||
})
|
||||
.unwrap();
|
||||
|
|
|
|||
Loading…
Reference in a new issue