Skip to content

Commit

Permalink
release: 3.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
joshstoik1 committed Dec 10, 2024
2 parents 456685d + c3ab23f commit 34c361e
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 76 deletions.
49 changes: 17 additions & 32 deletions CREDITS.md
Original file line number Diff line number Diff line change
@@ -1,54 +1,44 @@
# Project Dependencies
Package: flaca
Version: 3.1.10
Version: 3.2.0
Target: x86_64-unknown-linux-gnu
Generated: 2024-11-29 03:53:45 UTC
Generated: 2024-12-10 20:29:03 UTC

| Package | Version | Author(s) | License |
| ---- | ---- | ---- | ---- |
| [ahash](https://github.com/tkaitchuck/ahash) | 0.8.11 | [Tom Kaitchuck](mailto:[email protected]) | MIT OR Apache-2.0 |
| [anstream](https://github.com/rust-cli/anstyle.git) ⚒️ | 0.6.18 | | MIT OR Apache-2.0 |
| [anstyle](https://github.com/rust-cli/anstyle.git) ⚒️ | 1.0.10 | | MIT OR Apache-2.0 |
| [anstyle-parse](https://github.com/rust-cli/anstyle.git) ⚒️ | 0.2.6 | | MIT OR Apache-2.0 |
| [anstyle-query](https://github.com/rust-cli/anstyle.git) ⚒️ | 1.1.2 | | MIT OR Apache-2.0 |
| [**argyle**](https://github.com/Blobfolio/argyle) | 0.10.1 | [Josh Stoik](mailto:[email protected]) | WTFPL |
| [**bindgen**](https://github.com/rust-lang/rust-bindgen) ⚒️ | 0.70.1 | [Jyun-Yan You](mailto:[email protected]), [Emilio Cobos Álvarez](mailto:[email protected]), [Nick Fitzgerald](mailto:[email protected]), and The Servo project developers | BSD-3-Clause |
| [**bindgen**](https://github.com/rust-lang/rust-bindgen) ⚒️ | 0.71.1 | [Jyun-Yan You](mailto:[email protected]), [Emilio Cobos Álvarez](mailto:[email protected]), [Nick Fitzgerald](mailto:[email protected]), and The Servo project developers | BSD-3-Clause |
| [bitflags](https://github.com/bitflags/bitflags) | 2.6.0 | The Rust Project Developers | MIT OR Apache-2.0 |
| [bitvec](https://github.com/bitvecto-rs/bitvec) | 1.0.1 | | MIT |
| [bytecount](https://github.com/llogiq/bytecount) | 0.6.8 | [Andre Bogus](mailto:[email protected]) and [Joshua Landau](mailto:[email protected]) | Apache-2.0 OR MIT |
| [bytemuck](https://github.com/Lokathor/bytemuck) | 1.20.0 | [Lokathor](mailto:[email protected]) | Zlib OR Apache-2.0 OR MIT |
| [**cc**](https://github.com/rust-lang/cc-rs) ⚒️ | 1.2.1 | [Alex Crichton](mailto:[email protected]) | MIT OR Apache-2.0 |
| [**cc**](https://github.com/rust-lang/cc-rs) ⚒️ | 1.2.3 | [Alex Crichton](mailto:[email protected]) | MIT OR Apache-2.0 |
| [cexpr](https://github.com/jethrogb/rust-cexpr) ⚒️ | 0.6.0 | [Jethro Beekman](mailto:[email protected]) | Apache-2.0 OR MIT |
| [cfg-if](https://github.com/alexcrichton/cfg-if) | 1.0.0 | [Alex Crichton](mailto:[email protected]) | MIT OR Apache-2.0 |
| [cfg_aliases](https://github.com/katharostech/cfg_aliases) ⚒️ | 0.2.1 | [Zicklag](mailto:[email protected]) | MIT |
| [clang-sys](https://github.com/KyleMayes/clang-sys) ⚒️ | 1.8.1 | [Kyle Mayes](mailto:[email protected]) | Apache-2.0 |
| [clap](https://github.com/clap-rs/clap) ⚒️ | 4.5.21 | | MIT OR Apache-2.0 |
| [clap_builder](https://github.com/clap-rs/clap) ⚒️ | 4.5.21 | | MIT OR Apache-2.0 |
| [clap_lex](https://github.com/clap-rs/clap) ⚒️ | 0.7.3 | | MIT OR Apache-2.0 |
| [clap_mangen](https://github.com/clap-rs/clap) ⚒️ | 0.2.24 | | MIT OR Apache-2.0 |
| [colorchoice](https://github.com/rust-cli/anstyle.git) ⚒️ | 1.0.3 | | MIT OR Apache-2.0 |
| [**crc32fast**](https://github.com/srijs/rust-crc32fast) | 1.4.2 | [Sam Rijs](mailto:[email protected]) and [Alex Crichton](mailto:[email protected]) | MIT OR Apache-2.0 |
| [**crossbeam-channel**](https://github.com/crossbeam-rs/crossbeam) | 0.5.13 | | MIT OR Apache-2.0 |
| [crossbeam-utils](https://github.com/crossbeam-rs/crossbeam) | 0.8.20 | | MIT OR Apache-2.0 |
| [**ctrlc**](https://github.com/Detegr/rust-ctrlc.git) | 3.4.5 | [Antti Keränen](mailto:[email protected]) | MIT OR Apache-2.0 |
| [**dactyl**](https://github.com/Blobfolio/dactyl) | 0.8.0 | [Josh Stoik](mailto:[email protected]) | WTFPL |
| [**dowser**](https://github.com/Blobfolio/dowser) | 0.10.1 | [Josh Stoik](mailto:[email protected]) | WTFPL |
| [**dactyl**](https://github.com/Blobfolio/dactyl) | 0.9.0 | [Josh Stoik](mailto:[email protected]) | WTFPL |
| [**dowser**](https://github.com/Blobfolio/dowser) | 0.11.0 | [Josh Stoik](mailto:[email protected]) | WTFPL |
| [dunce](https://gitlab.com/kornelski/dunce) ⚒️ | 1.0.5 | [Kornel](mailto:[email protected]) | CC0-1.0 OR MIT-0 OR Apache-2.0 |
| [either](https://github.com/rayon-rs/either) ⚒️ | 1.13.0 | bluss | MIT OR Apache-2.0 |
| [equivalent](https://github.com/cuviper/equivalent) | 1.0.1 | | Apache-2.0 OR MIT |
| [fastrand](https://github.com/smol-rs/fastrand) | 2.2.0 | [Stjepan Glavina](mailto:[email protected]) | Apache-2.0 OR MIT |
| **flapfli** | 3.1.10 | [Josh Stoik](mailto:[email protected]) | WTFPL |
| [fastrand](https://github.com/smol-rs/fastrand) | 2.3.0 | [Stjepan Glavina](mailto:[email protected]) | Apache-2.0 OR MIT |
| **flapfli** | 3.2.0 | [Josh Stoik](mailto:[email protected]) | WTFPL |
| [funty](https://github.com/myrrlyn/funty) | 2.0.0 | [myrrlyn](mailto:[email protected]) | MIT |
| [**fyi_msg**](https://github.com/Blobfolio/fyi) | 1.3.0 | [Josh Stoik](mailto:[email protected]) | WTFPL |
| [**fyi_msg**](https://github.com/Blobfolio/fyi) | 1.4.0 | [Josh Stoik](mailto:[email protected]) | WTFPL |
| [glob](https://github.com/rust-lang/glob) ⚒️ | 0.3.1 | The Rust Project Developers | MIT OR Apache-2.0 |
| [hashbrown](https://github.com/rust-lang/hashbrown) | 0.15.2 | [Amanieu d'Antras](mailto:[email protected]) | MIT OR Apache-2.0 |
| [indexmap](https://github.com/indexmap-rs/indexmap) | 2.6.0 | | Apache-2.0 OR MIT |
| [is_terminal_polyfill](https://github.com/polyfill-rs/is_terminal_polyfill) ⚒️ | 1.70.1 | | MIT OR Apache-2.0 |
| [indexmap](https://github.com/indexmap-rs/indexmap) | 2.7.0 | | Apache-2.0 OR MIT |
| [itertools](https://github.com/rust-itertools/itertools) ⚒️ | 0.13.0 | bluss | MIT OR Apache-2.0 |
| [**libc**](https://github.com/rust-lang/libc) | 0.2.166 | The Rust Project Developers | MIT OR Apache-2.0 |
| [**libc**](https://github.com/rust-lang/libc) | 0.2.168 | The Rust Project Developers | MIT OR Apache-2.0 |
| [libdeflate-sys](https://github.com/adamkewley/libdeflater) | 1.22.0 | [Adam Kewley](mailto:[email protected]) | Apache-2.0 |
| [libdeflater](https://github.com/adamkewley/libdeflater) | 1.22.0 | [Adam Kewley](mailto:[email protected]) | Apache-2.0 |
| [libloading](https://github.com/nagisa/rust_libloading/) ⚒️ | 0.8.5 | [Simonas Kazlauskas](mailto:[email protected]) | ISC |
| [libloading](https://github.com/nagisa/rust_libloading/) ⚒️ | 0.8.6 | [Simonas Kazlauskas](mailto:[email protected]) | ISC |
| [linux-raw-sys](https://github.com/sunfishcode/linux-raw-sys) | 0.4.14 | [Dan Gohman](mailto:[email protected]) | Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT |
| [**lodepng**](https://github.com/lvandeve/lodepng) | 2024.10.15 | Lode Vandevenne | Zlib |
| [log](https://github.com/rust-lang/log) | 0.4.22 | The Rust Project Developers | MIT OR Apache-2.0 |
Expand All @@ -59,7 +49,7 @@
| [nix](https://github.com/nix-rust/nix) | 0.29.0 | The nix-rust Project Developers | MIT |
| [nom](https://github.com/Geal/nom) ⚒️ | 7.1.3 | [email protected] | MIT |
| [once_cell](https://github.com/matklad/once_cell) | 1.20.2 | [Aleksey Kladov](mailto:[email protected]) | MIT OR Apache-2.0 |
| [**oxipng**](https://github.com/shssoichiro/oxipng) | 9.1.2 | [Joshua Holmer](mailto:[email protected]) | MIT |
| [**oxipng**](https://github.com/shssoichiro/oxipng) | 9.1.3 | [Joshua Holmer](mailto:[email protected]) | MIT |
| [prettyplease](https://github.com/dtolnay/prettyplease) ⚒️ | 0.2.25 | [David Tolnay](mailto:[email protected]) | MIT OR Apache-2.0 |
| [proc-macro2](https://github.com/dtolnay/proc-macro2) ⚒️ | 1.0.92 | [David Tolnay](mailto:[email protected]) and [Alex Crichton](mailto:[email protected]) | MIT OR Apache-2.0 |
| [quote](https://github.com/dtolnay/quote) ⚒️ | 1.0.37 | [David Tolnay](mailto:[email protected]) | MIT OR Apache-2.0 |
Expand All @@ -68,21 +58,16 @@
| [regex-automata](https://github.com/rust-lang/regex/tree/master/regex-automata) ⚒️ | 0.4.9 | The Rust Project Developers and [Andrew Gallant](mailto:[email protected]) | MIT OR Apache-2.0 |
| [regex-syntax](https://github.com/rust-lang/regex/tree/master/regex-syntax) ⚒️ | 0.8.5 | The Rust Project Developers and [Andrew Gallant](mailto:[email protected]) | MIT OR Apache-2.0 |
| [rgb](https://github.com/kornelski/rust-rgb) | 0.8.50 | [Kornel Lesiński](mailto:[email protected]) and [James Forster](mailto:[email protected]) | MIT |
| [roff](https://github.com/rust-cli/roff-rs) ⚒️ | 0.2.2 | | MIT OR Apache-2.0 |
| [rustc-hash](https://github.com/rust-lang-nursery/rustc-hash) | 1.1.0 | The Rust Project Developers | Apache-2.0 OR MIT |
| [rustc_version](https://github.com/djc/rustc-version-rs) ⚒️ | 0.4.1 | | MIT OR Apache-2.0 |
| [rustix](https://github.com/bytecodealliance/rustix) | 0.38.41 | [Dan Gohman](mailto:[email protected]) and [Jakub Konka](mailto:[email protected]) | Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT |
| [semver](https://github.com/dtolnay/semver) ⚒️ | 1.0.23 | [David Tolnay](mailto:[email protected]) | MIT OR Apache-2.0 |
| [rustc-hash](https://github.com/rust-lang/rustc-hash) | 2.1.0 | The Rust Project Developers | Apache-2.0 OR MIT |
| [rustix](https://github.com/bytecodealliance/rustix) | 0.38.42 | [Dan Gohman](mailto:[email protected]) and [Jakub Konka](mailto:[email protected]) | Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT |
| [shlex](https://github.com/comex/rust-shlex) ⚒️ | 1.3.0 | [comex](mailto:[email protected]), [Fenhl](mailto:[email protected]), [Adrian Taylor](mailto:[email protected]), [Alex Touchet](mailto:[email protected]), [Daniel Parks](mailto:dp+[email protected]), and [Garrett Berg](mailto:[email protected]) | MIT OR Apache-2.0 |
| [strsim](https://github.com/rapidfuzz/strsim-rs) ⚒️ | 0.11.1 | [Danny Guo](mailto:[email protected]) and [maxbachmann](mailto:[email protected]) | MIT |
| [syn](https://github.com/dtolnay/syn) ⚒️ | 2.0.89 | [David Tolnay](mailto:[email protected]) | MIT OR Apache-2.0 |
| [syn](https://github.com/dtolnay/syn) ⚒️ | 2.0.90 | [David Tolnay](mailto:[email protected]) | MIT OR Apache-2.0 |
| [tap](https://github.com/myrrlyn/tap) | 1.0.1 | [Elliott Linder](mailto:[email protected]) and [myrrlyn](mailto:[email protected]) | MIT |
| [tempfile](https://github.com/Stebalien/tempfile) | 3.14.0 | [Steven Allen](mailto:[email protected]), The Rust Project Developers, [Ashley Mannix](mailto:[email protected]), and [Jason White](mailto:[email protected]) | MIT OR Apache-2.0 |
| [terminal_size](https://github.com/eminence/terminal-size) | 0.4.0 | [Andrew Chin](mailto:[email protected]) | MIT OR Apache-2.0 |
| [terminal_size](https://github.com/eminence/terminal-size) | 0.4.1 | [Andrew Chin](mailto:[email protected]) | MIT OR Apache-2.0 |
| [unicode-ident](https://github.com/dtolnay/unicode-ident) ⚒️ | 1.0.14 | [David Tolnay](mailto:[email protected]) | (MIT OR Apache-2.0) AND Unicode-3.0 |
| [unicode-width](https://github.com/unicode-rs/unicode-width) | 0.2.0 | [kwantam](mailto:[email protected]) and [Manish Goregaokar](mailto:[email protected]) | MIT OR Apache-2.0 |
| [**utc2k**](https://github.com/Blobfolio/utc2k) | 0.11.1 | [Josh Stoik](mailto:[email protected]) | WTFPL |
| [utf8parse](https://github.com/alacritty/vte) ⚒️ | 0.2.2 | [Joe Wilm](mailto:[email protected]) and [Christian Duerr](mailto:[email protected]) | Apache-2.0 OR MIT |
| [version_check](https://github.com/SergioBenitez/version_check) ⚒️ | 0.9.5 | [Sergio Benitez](mailto:[email protected]) | MIT OR Apache-2.0 |
| [**write_atomic**](https://github.com/Blobfolio/write_atomic) | 0.5.2 | [Josh Stoik](mailto:[email protected]) | WTFPL |
| [wyz](https://github.com/myrrlyn/wyz) | 0.5.1 | [myrrlyn](mailto:[email protected]) | MIT |
Expand Down
12 changes: 6 additions & 6 deletions flaca/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "flaca"
version = "3.1.10"
version = "3.2.0"
license = "WTFPL"
authors = ["Josh Stoik <[email protected]>"]
edition = "2021"
Expand Down Expand Up @@ -120,14 +120,14 @@ repository = "https://github.com/lvandeve/lodepng"

[build-dependencies]
argyle = "0.10.*"
dowser = "0.10.*"
dowser = "0.11.*"

[dependencies]
argyle = "0.10.*"
crossbeam-channel = "=0.5.*"
ctrlc = "=3.4.5"
dactyl = "0.8.*"
dowser = "0.10.*"
dactyl = "0.9.*"
dowser = "0.11.*"
libc = "0.2.*"
utc2k = "0.11.*"
write_atomic = "0.5.*"
Expand All @@ -137,7 +137,7 @@ version = "*"
path = "../flapfli"

[dependencies.fyi_msg]
version = "1.3.*"
version = "1.4.*"
features = [ "progress" ]

[dependencies.mozjpeg-sys]
Expand All @@ -146,6 +146,6 @@ default-features = false
features = [ "jpegtran", "nasm_simd", "unwinding" ]

[dependencies.oxipng]
version = "=9.1.2"
version = "=9.1.3"
default-features = false
features = [ "freestanding" ]
4 changes: 2 additions & 2 deletions flaca/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,10 +304,10 @@ fn crunch_pretty(rx: &Receiver::<&Path>, progress: &Progless, kinds: ImageKind)
SKIPPED.fetch_add(1, Relaxed);

if ! matches!(e, EncodingError::Skipped) && noteworthy(kinds, p) {
progress.push_msg(Msg::skipped(format!(
let _res = progress.push_msg(Msg::skipped(format!(
"{name} \x1b[2m({})\x1b[0m",
e.as_str(),
)), true);
)));
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions flapfli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "flapfli"
version = "3.1.10"
version = "3.2.0"
license = "WTFPL"
authors = ["Josh Stoik <[email protected]>"]
edition = "2021"
Expand All @@ -19,7 +19,7 @@ exclude = [
crc32fast = "=1.4.*"

[build-dependencies]
bindgen = "0.70.*"
bindgen = "0.71.*"
cc = "1.2.*"

[lib]
Expand Down
42 changes: 19 additions & 23 deletions flapfli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,29 +93,27 @@ pub fn optimize(src: &[u8]) -> Option<EncodedPNG> {

// Find the right strategy.
let mut enc = LodePNGState::encoder(&dec)?;
let mut out = EncodedPNG::new();
let strategy = best_strategy(&img, &mut enc, &mut out);
let strategy = best_strategy(&img, &mut enc);

// Now re-re-encode with zopfli and the best strategy.
enc.set_strategy(strategy);
enc.set_zopfli();
if enc.encode(&img, &mut out) {
// For really small images, we might be able to save even more by
// nuking the palette.
if out.size < 4096 && LodePNGColorType::LCT_PALETTE.is_match(&out) {
if let Some(out2) = enc.try_small(&img) {
if out2.size < out.size && out2.size < src.len() {
// We improved again!
return Some(out2);
}
let out = enc.encode(&img)?;

// For really small images, we might be able to save even more by
// nuking the palette.
if out.size < 4096 && LodePNGColorType::LCT_PALETTE.is_match(&out) {
if let Some(out2) = enc.try_small(&img) {
if out2.size < out.size && out2.size < src.len() {
// We improved again!
return Some(out2);
}
}

// We improved!
if out.size < src.len() { return Some(out); }
}

None
// We improved!
if out.size < src.len() { Some(out) }
else { None }
}

#[track_caller]
Expand Down Expand Up @@ -146,11 +144,7 @@ pub(crate) const fn unreachable() {
///
/// Skipping zopfli here saves _a ton_ of processing time and (almost) never
/// changes the answer, so it's a shortcut worth taking.
fn best_strategy(
img: &DecodedImage,
enc: &mut LodePNGState,
out: &mut EncodedPNG,
) -> LodePNGFilterStrategy {
fn best_strategy(img: &DecodedImage, enc: &mut LodePNGState) -> LodePNGFilterStrategy {
let mut best_size = usize::MAX;
let mut best_strategy = LodePNGFilterStrategy::LFS_ZERO;

Expand All @@ -165,9 +159,11 @@ fn best_strategy(
LodePNGFilterStrategy::LFS_BRUTE_FORCE,
] {
enc.set_strategy(strategy);
if enc.encode(img, out) && out.size < best_size {
best_size = out.size;
best_strategy = strategy;
if let Some(out) = enc.encode(img) {
if out.size < best_size {
best_size = out.size;
best_strategy = strategy;
}
}
}

Expand Down
16 changes: 7 additions & 9 deletions flapfli/src/lodepng.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,18 +181,18 @@ impl LodePNGState {
#[expect(unsafe_code, reason = "For FFI.")]
/// # Encode!
///
/// Encode the image, returning `true` if lodepng was happy and the output
/// is non-empty.
pub(super) fn encode(&mut self, img: &DecodedImage, out: &mut EncodedPNG) -> bool {
// Reset the size.
out.size = 0;
/// Encode the image, returning it if lodepng was happy and the output is
/// non-empty.
pub(super) fn encode(&mut self, img: &DecodedImage) -> Option<EncodedPNG> {
let mut out = EncodedPNG::new();

// Safety: a non-zero response is an error.
let res = unsafe {
lodepng_encode(&mut out.buf, &mut out.size, img.buf.as_ptr(), img.w.get(), img.h.get(), self)
};

0 == res && ! out.is_null()
if 0 == res && ! out.is_null() { Some(out) }
else { None }
}

#[expect(unsafe_code, reason = "For FFI.")]
Expand Down Expand Up @@ -277,9 +277,7 @@ impl LodePNGState {
else { self.info_png.color.key_defined = 0; }

// Re-encode it and see what happens!
let mut out = EncodedPNG::new();
if self.encode(img, &mut out) { Some(out) }
else { None }
self.encode(img)
}
}

Expand Down
4 changes: 2 additions & 2 deletions release/man/flaca.1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.TH "FLACA" "1" "November 2024" "flaca v3.1.10" "User Commands"
.TH "FLACA" "1" "December 2024" "flaca v3.2.0" "User Commands"
.SH NAME
FLACA \- Manual page for flaca v3.1.10.
FLACA \- Manual page for flaca v3.2.0.
.SH DESCRIPTION
Brute\-force, lossless JPEG and PNG compression.
.SS USAGE:
Expand Down

0 comments on commit 34c361e

Please sign in to comment.