Skip to content

Commit

Permalink
Adjust command line presets to take advantage of the 50% speedup gain…
Browse files Browse the repository at this point in the history
…ed by removing memory options
  • Loading branch information
Josh Holmer committed Jan 31, 2018
1 parent 66c1662 commit d614bba
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
15 changes: 10 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down
14 changes: 7 additions & 7 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down

0 comments on commit d614bba

Please sign in to comment.