From d614bba3ac9d9ba762c921f732ad1b6cf8f3cf74 Mon Sep 17 00:00:00 2001 From: Josh Holmer Date: Wed, 31 Jan 2018 14:07:03 -0500 Subject: [PATCH] Adjust command line presets to take advantage of the 50% speedup gained by removing memory options --- CHANGELOG.md | 3 +++ src/lib.rs | 15 ++++++++++----- src/main.rs | 14 +++++++------- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b87d55fc..8da7ee74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ - This improves decompression speed by 15%. Compression speed is not affected. - [SEMVER_MAJOR] This also obsoletes the `-zm` command line option and the `memory` key on the `Options` struct. - Presets will be updated automatically. This means that presets 3 and higher will run significantly more quickly. + - Adjust the presets, now that memory is no longer an option. + - `-o3` now tests all filter types. This will result in 50% more trials than before, but may give up to 10% more compression gain. + - `-o4` and higher now test all alpha optimization types. This adds 5 trials specific to the alpha channel. Only transparent images are affected. ### Version 0.19.0 - [SEMVER_MAJOR] Default to overwriting the input file if `out_file` is not set. diff --git a/src/lib.rs b/src/lib.rs index 4ce1f96e..38c29967 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -188,14 +188,19 @@ impl Options { self } - fn apply_preset_3(self) -> Self { - self.apply_preset_2() - } - - fn apply_preset_4(mut self) -> Self { + fn apply_preset_3(mut self) -> Self { for i in 1..5 { self.filter.insert(i); } + self + } + + fn apply_preset_4(mut self) -> Self { + self.alphas.insert(AlphaOptim::White); + self.alphas.insert(AlphaOptim::Up); + self.alphas.insert(AlphaOptim::Down); + self.alphas.insert(AlphaOptim::Left); + self.alphas.insert(AlphaOptim::Right); self.apply_preset_3() } diff --git a/src/main.rs b/src/main.rs index 95c8840a..d89d10f9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -200,13 +200,13 @@ fn main() { } })) .after_help("Optimization levels: - -o 0 => --zc 3 --nz (0 or 1 trials) - -o 1 => --zc 9 (1 trial, determined heuristically) - -o 2 => --zc 9 --zs 0-3 -f 0,5 (8 trials) - -o 3 => --zc 9 --zs 0-3 -f 0,5 (8 trials, currently identical to preset 3) - -o 4 => --zc 9 --zs 0-3 -f 0-5 (24 trials) - -o 5 => --zc 3-9 --zs 0-3 -f 0-5 (96 trials) - -o 6 => --zc 1-9 --zs 0-3 -f 0-5 (180 trials) + -o 0 => --zc 3 --nz (0 or 1 trials) + -o 1 => --zc 9 (1 trial, determined heuristically) + -o 2 => --zc 9 --zs 0-3 -f 0,5 (8 trials) + -o 3 => --zc 9 --zs 0-3 -f 0-5 (24 trials) + -o 4 => --zc 9 --zs 0-3 -f 0-5 -a (24 trials + 6 alpha trials) + -o 5 => --zc 3-9 --zs 0-3 -f 0-5 -a (96 trials + 6 alpha trials) + -o 6 => --zc 1-9 --zs 0-3 -f 0-5 -a (180 trials + 6 alpha trials) Manually specifying a compression option (zc, zs, etc.) will override the optimization preset, regardless of the order you write the arguments.")