Merge branch 'master' into libdeflater
This commit is contained in:
commit
a059faa9a1
6 changed files with 28 additions and 47 deletions
24
Cargo.lock
generated
24
Cargo.lock
generated
|
|
@ -154,7 +154,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "deflate"
|
name = "deflate"
|
||||||
version = "0.7.20"
|
version = "0.8.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
@ -181,7 +181,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "image"
|
name = "image"
|
||||||
version = "0.23.0"
|
version = "0.23.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytemuck 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bytemuck 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
@ -189,7 +189,7 @@ dependencies = [
|
||||||
"num-iter 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
|
"num-iter 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"num-rational 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"num-rational 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
"num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"png 0.15.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"png 0.16.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
@ -202,7 +202,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "itertools"
|
name = "itertools"
|
||||||
version = "0.8.2"
|
version = "0.9.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
@ -302,8 +302,8 @@ dependencies = [
|
||||||
"clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"cloudflare-zlib 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cloudflare-zlib 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"image 0.23.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"image 0.23.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libdeflater 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libdeflater 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"miniz_oxide 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"miniz_oxide 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"num_cpus 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"num_cpus 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
@ -315,12 +315,12 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "png"
|
name = "png"
|
||||||
version = "0.15.3"
|
version = "0.16.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"deflate 0.7.20 (registry+https://github.com/rust-lang/crates.io-index)",
|
"deflate 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"inflate 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"inflate 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
@ -464,13 +464,13 @@ dependencies = [
|
||||||
"checksum crossbeam-epoch 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace"
|
"checksum crossbeam-epoch 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace"
|
||||||
"checksum crossbeam-queue 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c695eeca1e7173472a32221542ae469b3e9aac3a4fc81f7696bcad82029493db"
|
"checksum crossbeam-queue 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c695eeca1e7173472a32221542ae469b3e9aac3a4fc81f7696bcad82029493db"
|
||||||
"checksum crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8"
|
"checksum crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8"
|
||||||
"checksum deflate 0.7.20 (registry+https://github.com/rust-lang/crates.io-index)" = "707b6a7b384888a70c8d2e8650b3e60170dfc6a67bb4aa67b6dfca57af4bedb4"
|
"checksum deflate 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "050ef6de42a33903b30a7497b76b40d3d58691d4d3eec355348c122444a388f0"
|
||||||
"checksum either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3"
|
"checksum either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3"
|
||||||
"checksum glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
|
"checksum glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
|
||||||
"checksum hermit-abi 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1010591b26bbfe835e9faeabeb11866061cc7dcebffd56ad7d0942d0e61aefd8"
|
"checksum hermit-abi 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1010591b26bbfe835e9faeabeb11866061cc7dcebffd56ad7d0942d0e61aefd8"
|
||||||
"checksum image 0.23.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ef4e336ec01a678e7ab692914c641181528e8656451e6252f8f9e33728882eaf"
|
"checksum image 0.23.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9062b90712d25bc6bb165d110aa59c6b47c849246e341e7b86a98daff9d49f60"
|
||||||
"checksum inflate 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "1cdb29978cc5797bd8dcc8e5bf7de604891df2a8dc576973d71a281e916db2ff"
|
"checksum inflate 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "1cdb29978cc5797bd8dcc8e5bf7de604891df2a8dc576973d71a281e916db2ff"
|
||||||
"checksum itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484"
|
"checksum itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b"
|
||||||
"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||||
"checksum libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)" = "eb147597cdf94ed43ab7a9038716637d2d1bf2bc571da995d0028dec06bd3018"
|
"checksum libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)" = "eb147597cdf94ed43ab7a9038716637d2d1bf2bc571da995d0028dec06bd3018"
|
||||||
"checksum libdeflater 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "66dca08b13369865b2f6dca1dd05f833985cbe6c12a676b04d55f78b85e80246"
|
"checksum libdeflater 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "66dca08b13369865b2f6dca1dd05f833985cbe6c12a676b04d55f78b85e80246"
|
||||||
|
|
@ -482,7 +482,7 @@ dependencies = [
|
||||||
"checksum num-rational 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "da4dc79f9e6c81bef96148c8f6b8e72ad4541caa4a24373e900a36da07de03a3"
|
"checksum num-rational 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "da4dc79f9e6c81bef96148c8f6b8e72ad4541caa4a24373e900a36da07de03a3"
|
||||||
"checksum num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "c62be47e61d1842b9170f0fdeec8eba98e60e90e5446449a0545e5152acd7096"
|
"checksum num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "c62be47e61d1842b9170f0fdeec8eba98e60e90e5446449a0545e5152acd7096"
|
||||||
"checksum num_cpus 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "46203554f085ff89c235cd12f7075f3233af9b11ed7c9e16dfe2560d03313ce6"
|
"checksum num_cpus 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "46203554f085ff89c235cd12f7075f3233af9b11ed7c9e16dfe2560d03313ce6"
|
||||||
"checksum png 0.15.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ef859a23054bbfee7811284275ae522f0434a3c8e7f4b74bd4a35ae7e1c4a283"
|
"checksum png 0.16.1 (registry+https://github.com/rust-lang/crates.io-index)" = "46060468187c21c00ffa2a920690b29997d7fd543f5a4d400461e4a7d4fccde8"
|
||||||
"checksum rayon 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "db6ce3297f9c85e16621bb8cca38a06779ffc31bb8184e1be4bed2be4678a098"
|
"checksum rayon 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "db6ce3297f9c85e16621bb8cca38a06779ffc31bb8184e1be4bed2be4678a098"
|
||||||
"checksum rayon-core 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "08a89b46efaf957e52b18062fb2f4660f8b8a4dde1807ca002690868ef2c85a9"
|
"checksum rayon-core 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "08a89b46efaf957e52b18062fb2f4660f8b8a4dde1807ca002690868ef2c85a9"
|
||||||
"checksum rgb 0.8.16 (registry+https://github.com/rust-lang/crates.io-index)" = "5ec4ab2cf0b27e111e266e161cf7f9efd20125a161190da1c0945c4a4408fef3"
|
"checksum rgb 0.8.16 (registry+https://github.com/rust-lang/crates.io-index)" = "5ec4ab2cf0b27e111e266e161cf7f9efd20125a161190da1c0945c4a4408fef3"
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ required-features = ["binary"]
|
||||||
bit-vec = "^0.6.0"
|
bit-vec = "^0.6.0"
|
||||||
byteorder = "^1.0.0"
|
byteorder = "^1.0.0"
|
||||||
crc = "^1.2.0"
|
crc = "^1.2.0"
|
||||||
itertools = "^0.8.0"
|
itertools = "^0.9.0"
|
||||||
num_cpus = "^1.0.0"
|
num_cpus = "^1.0.0"
|
||||||
zopfli = "^0.4.0"
|
zopfli = "^0.4.0"
|
||||||
miniz_oxide = "0.3"
|
miniz_oxide = "0.3"
|
||||||
|
|
|
||||||
6
package-lock.json
generated
6
package-lock.json
generated
|
|
@ -177,9 +177,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"minimist": {
|
"minimist": {
|
||||||
"version": "1.2.0",
|
"version": "1.2.5",
|
||||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
|
||||||
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
|
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"normalize-package-data": {
|
"normalize-package-data": {
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,6 @@ use std::thread;
|
||||||
|
|
||||||
struct Candidate {
|
struct Candidate {
|
||||||
image: PngData,
|
image: PngData,
|
||||||
// compressed size multiplier. Fudge factor to prefer more promising formats.
|
|
||||||
bias: f32,
|
|
||||||
// if false, that's baseline file to throw away
|
// if false, that's baseline file to throw away
|
||||||
is_reduction: bool,
|
is_reduction: bool,
|
||||||
filter: u8,
|
filter: u8,
|
||||||
|
|
@ -42,30 +40,16 @@ impl Comparator {
|
||||||
fn evaluate(&mut self, new: Candidate) {
|
fn evaluate(&mut self, new: Candidate) {
|
||||||
// a tie-breaker is required to make evaluation deterministic
|
// a tie-breaker is required to make evaluation deterministic
|
||||||
let is_best = if let Some(ref old) = self.best_result {
|
let is_best = if let Some(ref old) = self.best_result {
|
||||||
// ordering is important - later file gets to use bias over earlier, but not the other way
|
|
||||||
// (this way bias=0 replaces, but doesn't forbid later optimizations)
|
|
||||||
let new_len = (new.image.idat_data.len() as f64
|
|
||||||
* if new.nth > old.nth {
|
|
||||||
f64::from(new.bias)
|
|
||||||
} else {
|
|
||||||
1.0
|
|
||||||
}) as usize;
|
|
||||||
let old_len = (old.image.idat_data.len() as f64
|
|
||||||
* if new.nth < old.nth {
|
|
||||||
f64::from(old.bias)
|
|
||||||
} else {
|
|
||||||
1.0
|
|
||||||
}) as usize;
|
|
||||||
// choose smallest compressed, or if compresses the same, smallest uncompressed, or cheaper filter
|
// choose smallest compressed, or if compresses the same, smallest uncompressed, or cheaper filter
|
||||||
let new = (
|
let new = (
|
||||||
new_len,
|
new.image.idat_data.len(),
|
||||||
new.image.raw.data.len(),
|
new.image.raw.data.len(),
|
||||||
new.image.raw.ihdr.bit_depth,
|
new.image.raw.ihdr.bit_depth,
|
||||||
new.filter,
|
new.filter,
|
||||||
new.nth,
|
new.nth,
|
||||||
);
|
);
|
||||||
let old = (
|
let old = (
|
||||||
old_len,
|
old.image.idat_data.len(),
|
||||||
old.image.raw.data.len(),
|
old.image.raw.data.len(),
|
||||||
old.image.raw.ihdr.bit_depth,
|
old.image.raw.ihdr.bit_depth,
|
||||||
old.filter,
|
old.filter,
|
||||||
|
|
@ -141,17 +125,15 @@ impl Evaluator {
|
||||||
|
|
||||||
/// Set baseline image. It will be used only to measure minimum compression level required
|
/// Set baseline image. It will be used only to measure minimum compression level required
|
||||||
pub fn set_baseline(&self, image: Arc<PngImage>) {
|
pub fn set_baseline(&self, image: Arc<PngImage>) {
|
||||||
self.try_image_inner(image, 1.0, false)
|
self.try_image_inner(image, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Check if the image is smaller than others
|
/// Check if the image is smaller than others
|
||||||
/// Bias is a value in 0..=1 range. Compressed size is multiplied by
|
pub fn try_image(&self, image: Arc<PngImage>) {
|
||||||
/// this fraction when comparing to the best, so 0.95 allows 5% larger size.
|
self.try_image_inner(image, true)
|
||||||
pub fn try_image(&self, image: Arc<PngImage>, bias: f32) {
|
|
||||||
self.try_image_inner(image, bias, true)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn try_image_inner(&self, image: Arc<PngImage>, bias: f32, is_reduction: bool) {
|
fn try_image_inner(&self, image: Arc<PngImage>, is_reduction: bool) {
|
||||||
let nth = self.nth.fetch_add(1, SeqCst);
|
let nth = self.nth.fetch_add(1, SeqCst);
|
||||||
// These clones are only cheap refcounts
|
// These clones are only cheap refcounts
|
||||||
let deadline = self.deadline.clone();
|
let deadline = self.deadline.clone();
|
||||||
|
|
@ -186,7 +168,6 @@ impl Evaluator {
|
||||||
idat_data,
|
idat_data,
|
||||||
raw: Arc::clone(&image),
|
raw: Arc::clone(&image),
|
||||||
},
|
},
|
||||||
bias,
|
|
||||||
filter,
|
filter,
|
||||||
is_reduction,
|
is_reduction,
|
||||||
nth,
|
nth,
|
||||||
|
|
|
||||||
10
src/lib.rs
10
src/lib.rs
|
|
@ -741,7 +741,7 @@ fn perform_reductions(
|
||||||
if let Some(interlacing) = opts.interlace {
|
if let Some(interlacing) = opts.interlace {
|
||||||
if let Some(reduced) = png.change_interlacing(interlacing) {
|
if let Some(reduced) = png.change_interlacing(interlacing) {
|
||||||
png = Arc::new(reduced);
|
png = Arc::new(reduced);
|
||||||
eval.try_image(png.clone(), 0.);
|
eval.try_image(png.clone());
|
||||||
}
|
}
|
||||||
if deadline.passed() {
|
if deadline.passed() {
|
||||||
return;
|
return;
|
||||||
|
|
@ -751,7 +751,7 @@ fn perform_reductions(
|
||||||
if opts.palette_reduction {
|
if opts.palette_reduction {
|
||||||
if let Some(reduced) = reduced_palette(&png) {
|
if let Some(reduced) = reduced_palette(&png) {
|
||||||
png = Arc::new(reduced);
|
png = Arc::new(reduced);
|
||||||
eval.try_image(png.clone(), 0.95);
|
eval.try_image(png.clone());
|
||||||
if opts.verbosity == Some(1) {
|
if opts.verbosity == Some(1) {
|
||||||
report_reduction(&png);
|
report_reduction(&png);
|
||||||
}
|
}
|
||||||
|
|
@ -766,13 +766,13 @@ fn perform_reductions(
|
||||||
let previous = png.clone();
|
let previous = png.clone();
|
||||||
let bits = reduced.ihdr.bit_depth;
|
let bits = reduced.ihdr.bit_depth;
|
||||||
png = Arc::new(reduced);
|
png = Arc::new(reduced);
|
||||||
eval.try_image(png.clone(), 1.0);
|
eval.try_image(png.clone());
|
||||||
if (bits == BitDepth::One || bits == BitDepth::Two)
|
if (bits == BitDepth::One || bits == BitDepth::Two)
|
||||||
&& previous.ihdr.bit_depth != BitDepth::Four
|
&& previous.ihdr.bit_depth != BitDepth::Four
|
||||||
{
|
{
|
||||||
// Also try 16-color mode for all lower bits images, since that may compress better
|
// Also try 16-color mode for all lower bits images, since that may compress better
|
||||||
if let Some(reduced) = reduce_bit_depth(&previous, 4) {
|
if let Some(reduced) = reduce_bit_depth(&previous, 4) {
|
||||||
eval.try_image(Arc::new(reduced), 0.98);
|
eval.try_image(Arc::new(reduced));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if opts.verbosity == Some(1) {
|
if opts.verbosity == Some(1) {
|
||||||
|
|
@ -787,7 +787,7 @@ fn perform_reductions(
|
||||||
if opts.color_type_reduction {
|
if opts.color_type_reduction {
|
||||||
if let Some(reduced) = reduce_color_type(&png) {
|
if let Some(reduced) = reduce_color_type(&png) {
|
||||||
png = Arc::new(reduced);
|
png = Arc::new(reduced);
|
||||||
eval.try_image(png.clone(), 0.96);
|
eval.try_image(png.clone());
|
||||||
if opts.verbosity == Some(1) {
|
if opts.verbosity == Some(1) {
|
||||||
report_reduction(&png);
|
report_reduction(&png);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ pub(crate) fn try_alpha_reductions(
|
||||||
let alphas_iter = alphas.par_iter().with_max_len(1);
|
let alphas_iter = alphas.par_iter().with_max_len(1);
|
||||||
alphas_iter
|
alphas_iter
|
||||||
.filter_map(|&alpha| filtered_alpha_channel(&png, *alpha))
|
.filter_map(|&alpha| filtered_alpha_channel(&png, *alpha))
|
||||||
.for_each(|image| eval.try_image(Arc::new(image), 0.99));
|
.for_each(|image| eval.try_image(Arc::new(image)));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn filtered_alpha_channel(png: &PngImage, optim: AlphaOptim) -> Option<PngImage> {
|
pub fn filtered_alpha_channel(png: &PngImage, optim: AlphaOptim) -> Option<PngImage> {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue