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**
|
**Version 0.3.0**
|
||||||
- Properly decode interlaced images
|
- Properly decode interlaced images
|
||||||
- [SEMVER_MINOR] Allow converting between progressive and interlaced images ([#3](https://github.com/shssoichiro/oxipng/issues/3))
|
- [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()
|
let (best_filter, best_line) = trials.iter()
|
||||||
.min_by_key(|x| {
|
.min_by_key(|x| {
|
||||||
x.1.iter().fold(0u64, |acc, &x| {
|
x.1.iter().fold(0u64, |acc, &x| {
|
||||||
let signed: i16 = if x > 127 {
|
let signed = x as i8;
|
||||||
(x as i16) - 256
|
acc + (signed as i16).abs() as u64
|
||||||
} else {
|
|
||||||
x as i16
|
|
||||||
};
|
|
||||||
acc + signed.abs() as u64
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue