Skip to content

Commit

Permalink
release: 0.11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
joshstoik1 committed Oct 5, 2023
2 parents 2a0de23 + 2d9af93 commit 33fadb9
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 54 deletions.
43 changes: 21 additions & 22 deletions CREDITS.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
# Project Dependencies
Package: refract
Version: 0.10.5
Generated: 2023-09-18 03:49:58 UTC
Version: 0.11.0
Generated: 2023-10-05 21:34:55 UTC

| Package | Version | Author(s) | License |
| ---- | ---- | ---- | ---- |
| [adler](https://github.com/jonas-schievink/adler.git) | 1.0.2 | [Jonas Schievink](mailto:jonasschievink@gmail.com) | 0BSD, Apache-2.0, or MIT |
| [ahash](https://github.com/tkaitchuck/ahash) | 0.8.3 | [Tom Kaitchuck](mailto:tom.kaitchuck@gmail.com) | Apache-2.0 or MIT |
| [argyle](https://github.com/Blobfolio/argyle) | 0.6.8 | [Blobfolio, LLC.](mailto:hello@blobfolio.com) | WTFPL |
| [atk](https://github.com/gtk-rs/gtk3-rs) | 0.18.0 | The gtk-rs Project Developers | MIT |
| [atk-sys](https://github.com/gtk-rs/gtk3-rs) | 0.18.0 | The gtk-rs Project Developers | MIT |
| [bitflags](https://github.com/bitflags/bitflags) | 1.3.2 | The Rust Project Developers | Apache-2.0 or MIT |
| [bitflags](https://github.com/bitflags/bitflags) | 2.4.0 | The Rust Project Developers | Apache-2.0 or MIT |
| [bytemuck](https://github.com/Lokathor/bytemuck) | 1.14.0 | [Lokathor](mailto:zefria@gmail.com) | Apache-2.0, MIT, or Zlib |
| [cairo-rs](https://github.com/gtk-rs/gtk-rs-core) | 0.18.2 | The gtk-rs Project Developers | MIT |
| [cairo-sys-rs](https://github.com/gtk-rs/gtk-rs-core) | 0.18.2 | The gtk-rs Project Developers | MIT |
| [cfg-if](https://github.com/alexcrichton/cfg-if) | 1.0.0 | [Alex Crichton](mailto:alex@alexcrichton.com) | Apache-2.0 or MIT |
| [crc32fast](https://github.com/srijs/rust-crc32fast) | 1.3.2 | [Sam Rijs](mailto:srijs@airpost.net) and [Alex Crichton](mailto:alex@alexcrichton.com) | Apache-2.0 or MIT |
| [crossbeam-channel](https://github.com/crossbeam-rs/crossbeam) | 0.5.8 | | Apache-2.0 or MIT |
| [crossbeam-deque](https://github.com/crossbeam-rs/crossbeam) | 0.8.3 | | Apache-2.0 or MIT |
| [crossbeam-epoch](https://github.com/crossbeam-rs/crossbeam) | 0.9.15 | | Apache-2.0 or MIT |
| [crossbeam-utils](https://github.com/crossbeam-rs/crossbeam) | 0.8.16 | | Apache-2.0 or MIT |
| [dactyl](https://github.com/Blobfolio/dactyl) | 0.5.1 | [Blobfolio, LLC.](mailto:hello@blobfolio.com) | WTFPL |
| [dactyl](https://github.com/Blobfolio/dactyl) | 0.5.2 | [Blobfolio, LLC.](mailto:hello@blobfolio.com) | WTFPL |
| [dowser](https://github.com/Blobfolio/dowser) | 0.8.0 | [Blobfolio, LLC.](mailto:hello@blobfolio.com) | WTFPL |
| [either](https://github.com/bluss/either) | 1.9.0 | bluss | Apache-2.0 or MIT |
| [equivalent](https://github.com/cuviper/equivalent) | 1.0.1 | | Apache-2.0 or MIT |
| [fastrand](https://github.com/smol-rs/fastrand) | 2.0.0 | [Stjepan Glavina](mailto:stjepang@gmail.com) | Apache-2.0 or MIT |
| [fastrand](https://github.com/smol-rs/fastrand) | 2.0.1 | [Stjepan Glavina](mailto:stjepang@gmail.com) | Apache-2.0 or MIT |
| [field-offset](https://github.com/Diggsey/rust-field-offset) | 0.3.6 | [Diggory Blake](mailto:diggsey@googlemail.com) | Apache-2.0 or MIT |
| [flate2](https://github.com/rust-lang/flate2-rs) | 1.0.27 | [Alex Crichton](mailto:alex@alexcrichton.com) and [Josh Triplett](mailto:josh@joshtriplett.org) | Apache-2.0 or MIT |
| [futures-channel](https://github.com/rust-lang/futures-rs) | 0.3.28 | | Apache-2.0 or MIT |
| [futures-core](https://github.com/rust-lang/futures-rs) | 0.3.28 | | Apache-2.0 or MIT |
| [futures-executor](https://github.com/rust-lang/futures-rs) | 0.3.28 | | Apache-2.0 or MIT |
Expand All @@ -45,23 +47,23 @@
| [gtk](https://github.com/gtk-rs/gtk3-rs) | 0.18.1 | The gtk-rs Project Developers | MIT |
| [gtk-sys](https://github.com/gtk-rs/gtk3-rs) | 0.18.0 | The gtk-rs Project Developers | MIT |
| [gtk3-macros](https://github.com/gtk-rs/gtk3-rs) | 0.18.0 | The gtk-rs Project Developers | MIT |
| [hashbrown](https://github.com/rust-lang/hashbrown) | 0.14.0 | [Amanieu d'Antras](mailto:amanieu@gmail.com) | Apache-2.0 or MIT |
| [hashbrown](https://github.com/rust-lang/hashbrown) | 0.14.1 | [Amanieu d'Antras](mailto:amanieu@gmail.com) | Apache-2.0 or MIT |
| [heck](https://github.com/withoutboats/heck) | 0.4.1 | [Without Boats](mailto:woboats@gmail.com) | Apache-2.0 or MIT |
| [indexmap](https://github.com/bluss/indexmap) | 2.0.0 | | Apache-2.0 or MIT |
| [indexmap](https://github.com/bluss/indexmap) | 2.0.2 | | Apache-2.0 or MIT |
| [jpeg-decoder](https://github.com/image-rs/jpeg-decoder) | 0.3.0 | The image-rs Developers | Apache-2.0 or MIT |
| [jpegxl-sys](https://github.com/inflation/jpegxl-rs) | 0.8.2+libjxl-0.8.2 | [Inflation](mailto:me@shimotsuki.ink) | GPL-3.0-or-later |
| [libaom-sys](https://github.com/njaard/libavif-rs) | 0.14.0 | [Charles Samuels](mailto:ks@ks.ax), [Paolo Barbolini](mailto:paolo@paolo565.org), and [Kornel](mailto:kornel@geekhood.net) | BSD-2-Clause |
| [libavif-sys](https://github.com/njaard/libavif-rs) | 0.14.3 | [Charles Samuels](mailto:ks@ks.ax) and [Paolo Barbolini](mailto:paolo@paolo565.org) | BSD-2-Clause |
| [libc](https://github.com/rust-lang/libc) | 0.2.148 | The Rust Project Developers | Apache-2.0 or MIT |
| [libwebp-sys2](https://github.com/qnighy/libwebp-sys2-rs) | 0.1.9 | [Masaki Hara](mailto:ackie.h.gmai@gmail.com) | BSD-3-Clause |
| [libz-sys](https://github.com/rust-lang/libz-sys) | 1.1.12 | [Alex Crichton](mailto:alex@alexcrichton.com), [Josh Triplett](mailto:josh@joshtriplett.org), and [Sebastian Thiel](mailto:sebastian.thiel@icloud.com) | Apache-2.0 or MIT |
| [link-cplusplus](https://github.com/dtolnay/link-cplusplus) | 1.0.9 | [David Tolnay](mailto:dtolnay@gmail.com) | Apache-2.0 or MIT |
| [memchr](https://github.com/BurntSushi/memchr) | 2.6.3 | [Andrew Gallant](mailto:jamslam@gmail.com) and bluss | MIT or Unlicense |
| [lodepng](https://github.com/kornelski/lodepng-rust.git) | 3.9.1 | [Kornel](mailto:kornel@geekhood.net) and [Lode Vandevenne](mailto:lvandeve@gmail.com) | Zlib |
| [memchr](https://github.com/BurntSushi/memchr) | 2.6.4 | [Andrew Gallant](mailto:jamslam@gmail.com) and bluss | MIT or Unlicense |
| [memoffset](https://github.com/Gilnaa/memoffset) | 0.9.0 | [Gilad Naaman](mailto:gilad.naaman@gmail.com) | MIT |
| [miniz_oxide](https://github.com/Frommi/miniz_oxide/tree/master/miniz_oxide) | 0.7.1 | [Frommi](mailto:daniil.liferenko@gmail.com) and [oyvindln](mailto:oyvindln@users.noreply.github.com) | Apache-2.0, MIT, or Zlib |
| [num-traits](https://github.com/rust-num/num-traits) | 0.2.16 | The Rust Project Developers | Apache-2.0 or MIT |
| [num_cpus](https://github.com/seanmonstar/num_cpus) | 1.16.0 | [Sean McArthur](mailto:sean@seanmonstar.com) | Apache-2.0 or MIT |
| [once_cell](https://github.com/matklad/once_cell) | 1.18.0 | [Aleksey Kladov](mailto:aleksey.kladov@gmail.com) | Apache-2.0 or MIT |
| [oxford_join](https://github.com/Blobfolio/oxford_join) | 0.2.8 | [Blobfolio, LLC.](mailto:hello@blobfolio.com) | WTFPL |
| [oxford_join](https://github.com/Blobfolio/oxford_join) | 0.2.9 | [Blobfolio, LLC.](mailto:hello@blobfolio.com) | WTFPL |
| [pango](https://github.com/gtk-rs/gtk-rs-core) | 0.18.0 | The gtk-rs Project Developers | MIT |
| [pango-sys](https://github.com/gtk-rs/gtk-rs-core) | 0.18.0 | The gtk-rs Project Developers | MIT |
| [pin-project-lite](https://github.com/taiki-e/pin-project-lite) | 0.2.13 | | Apache-2.0 or MIT |
Expand All @@ -71,24 +73,21 @@
| [proc-macro-error-attr](https://gitlab.com/CreepySkeleton/proc-macro-error) | 1.0.4 | [CreepySkeleton](mailto:creepy-skeleton@yandex.ru) | Apache-2.0 or MIT |
| [proc-macro2](https://github.com/dtolnay/proc-macro2) | 1.0.67 | [David Tolnay](mailto:dtolnay@gmail.com) and [Alex Crichton](mailto:alex@alexcrichton.com) | Apache-2.0 or MIT |
| [quote](https://github.com/dtolnay/quote) | 1.0.33 | [David Tolnay](mailto:dtolnay@gmail.com) | Apache-2.0 or MIT |
| [rayon](https://github.com/rayon-rs/rayon) | 1.7.0 | [Niko Matsakis](mailto:niko@alum.mit.edu) and [Josh Stone](mailto:cuviper@gmail.com) | Apache-2.0 or MIT |
| [rayon-core](https://github.com/rayon-rs/rayon) | 1.11.0 | [Niko Matsakis](mailto:niko@alum.mit.edu) and [Josh Stone](mailto:cuviper@gmail.com) | Apache-2.0 or MIT |
| [refract_core](https://github.com/Blobfolio/refract) | 0.10.5 | [Josh Stoik](mailto:josh@blobfolio.com) | WTFPL |
| [rayon](https://github.com/rayon-rs/rayon) | 1.8.0 | [Niko Matsakis](mailto:niko@alum.mit.edu) and [Josh Stone](mailto:cuviper@gmail.com) | Apache-2.0 or MIT |
| [rayon-core](https://github.com/rayon-rs/rayon) | 1.12.0 | [Niko Matsakis](mailto:niko@alum.mit.edu) and [Josh Stone](mailto:cuviper@gmail.com) | Apache-2.0 or MIT |
| [refract_core](https://github.com/Blobfolio/refract) | 0.11.0 | [Josh Stoik](mailto:josh@blobfolio.com) | WTFPL |
| [rgb](https://github.com/kornelski/rust-rgb) | 0.8.36 | [Kornel Lesiński](mailto:kornel@geekhood.net) | MIT |
| [scopeguard](https://github.com/bluss/scopeguard) | 1.2.0 | bluss | Apache-2.0 or MIT |
| [serde](https://github.com/serde-rs/serde) | 1.0.188 | [Erick Tryzelaar](mailto:erick.tryzelaar@gmail.com) and [David Tolnay](mailto:dtolnay@gmail.com) | Apache-2.0 or MIT |
| [serde_spanned](https://github.com/toml-rs/toml) | 0.6.3 | | Apache-2.0 or MIT |
| [slab](https://github.com/tokio-rs/slab) | 0.4.9 | [Carl Lerche](mailto:me@carllerche.com) | MIT |
| [smallvec](https://github.com/servo/rust-smallvec) | 1.11.0 | The Servo Project Developers | Apache-2.0 or MIT |
| [spng](https://github.com/aloucks/spng-rs) | 0.1.0 | [Aaron Loucks](mailto:aloucks@cofront.net) | Apache-2.0 or MIT |
| [spng-sys](https://github.com/aloucks/spng-rs) | 0.1.0 | [Aaron Loucks](mailto:aloucks@cofront.net) | Apache-2.0 or MIT |
| [smallvec](https://github.com/servo/rust-smallvec) | 1.11.1 | The Servo Project Developers | Apache-2.0 or MIT |
| [syn](https://github.com/dtolnay/syn) | 1.0.109 | [David Tolnay](mailto:dtolnay@gmail.com) | Apache-2.0 or MIT |
| [syn](https://github.com/dtolnay/syn) | 2.0.37 | [David Tolnay](mailto:dtolnay@gmail.com) | Apache-2.0 or MIT |
| [syn](https://github.com/dtolnay/syn) | 2.0.38 | [David Tolnay](mailto:dtolnay@gmail.com) | Apache-2.0 or MIT |
| [tempfile](https://github.com/Stebalien/tempfile) | 3.8.0 | [Steven Allen](mailto:steven@stebalien.com), The Rust Project Developers, [Ashley Mannix](mailto:ashleymannix@live.com.au), and [Jason White](mailto:me@jasonwhite.io) | Apache-2.0 or MIT |
| [thiserror](https://github.com/dtolnay/thiserror) | 1.0.48 | [David Tolnay](mailto:dtolnay@gmail.com) | Apache-2.0 or MIT |
| [thiserror-impl](https://github.com/dtolnay/thiserror) | 1.0.48 | [David Tolnay](mailto:dtolnay@gmail.com) | Apache-2.0 or MIT |
| [thiserror](https://github.com/dtolnay/thiserror) | 1.0.49 | [David Tolnay](mailto:dtolnay@gmail.com) | Apache-2.0 or MIT |
| [thiserror-impl](https://github.com/dtolnay/thiserror) | 1.0.49 | [David Tolnay](mailto:dtolnay@gmail.com) | Apache-2.0 or MIT |
| [toml_datetime](https://github.com/toml-rs/toml) | 0.6.3 | [Alex Crichton](mailto:alex@alexcrichton.com) | Apache-2.0 or MIT |
| [toml_edit](https://github.com/toml-rs/toml) | 0.19.15 | [Andronik Ordian](mailto:write@reusable.software) and [Ed Page](mailto:eopage@gmail.com) | Apache-2.0 or MIT |
| [unicode-ident](https://github.com/dtolnay/unicode-ident) | 1.0.12 | [David Tolnay](mailto:dtolnay@gmail.com) | Apache-2.0 AND Unicode-DFS-2016 or MIT |
| [winnow](https://github.com/winnow-rs/winnow) | 0.5.15 | | MIT |
| [write_atomic](https://github.com/Blobfolio/write_atomic) | 0.4.1 | [Blobfolio, LLC.](mailto:hello@blobfolio.com) | WTFPL |
| [write_atomic](https://github.com/Blobfolio/write_atomic) | 0.5.0 | [Blobfolio, LLC.](mailto:hello@blobfolio.com) | WTFPL |
6 changes: 3 additions & 3 deletions refract/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[package]
name = "refract"
version = "0.10.5"
version = "0.11.0"
license = "WTFPL"
authors = ["Josh Stoik <josh@blobfolio.com>"]
edition = "2021"
rust-version = "1.70"
rust-version = "1.73"
description = "Guided AVIF/JPEG XL/WebP conversion for JPEG and PNG sources."
repository = "https://github.com/Blobfolio/refract"
readme = "README.md"
Expand Down Expand Up @@ -100,7 +100,7 @@ dactyl = "0.5"
dowser = "0.8.*"
gtk = "=0.18.1"
oxford_join = "0.2.*"
write_atomic = "0.4.*"
write_atomic = "0.5.*"

[dependencies.refract_core]
path = "../refract_core"
Expand Down
7 changes: 3 additions & 4 deletions refract/src/share.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ impl Share {
-> (SisterTx, MainTx, SisterRx) {
let (tx, rx) = crossbeam_channel::bounded(8);
let (tx2, rx2) = crossbeam_channel::bounded(8);
GLOBAL.with(|global| {
*global.borrow_mut() = Some((window, rx, tx2.clone()));
GLOBAL.with_borrow_mut(|global| {
*global = Some((window, rx, tx2.clone()));
});

(tx, tx2, rx2)
Expand Down Expand Up @@ -152,8 +152,7 @@ pub(super) enum ShareFeedback {
/// This will panic if the global data is missing from the thread. This
/// shouldn't actually happen, though.
fn get_share() {
GLOBAL.with(|global| {
let ptr = global.borrow();
GLOBAL.with_borrow(|ptr| {
let (ui, rx, tx) = ptr.as_ref()
.expect("Missing main thread state.");

Expand Down
9 changes: 6 additions & 3 deletions refract_core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "refract_core"
version = "0.10.5"
version = "0.11.0"
license = "WTFPL"
authors = ["Josh Stoik <josh@blobfolio.com>"]
edition = "2021"
Expand All @@ -14,9 +14,12 @@ publish = false
dactyl = "0.5.*"
jpeg-decoder = "=0.3.0"
link-cplusplus = "1.0.*"
num_cpus = "=1.16.0"
rgb = "0.8.*"
spng = "=0.1.0"

[dependencies.lodepng]
version = "3.9.*"
default-features = false
features = [ "rust_backend" ]

[dependencies.argyle]
version = "0.6.*"
Expand Down
2 changes: 1 addition & 1 deletion refract_core/src/enc/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ impl EncodeIter<'_> {
if 0 == self.flags & FLAG_NO_LOSSY {
let quality = self.steps.next()?;
match self.lossy(quality, self.flags) {
Ok(_) => Some(()),
Ok(()) => Some(()),
Err(RefractError::TooBig) => {
// This was too big, so drop a step and see if the
// next-next quality works out.
Expand Down
6 changes: 4 additions & 2 deletions refract_core/src/kind/avif.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ impl LibAvifDecoder {
}

// Set up the threads.
let threads = i32::try_from(num_cpus::get())
let threads = std::thread::available_parallelism().ok()
.and_then(|n| i32::try_from(n.get()).ok())
.unwrap_or(1)
.max(1);

Expand Down Expand Up @@ -218,7 +219,8 @@ impl TryFrom<NonZeroU8> for LibAvifEncoder {
let (q, aq) = quality_to_quantizers(quality);

// Total threads.
let threads = i32::try_from(num_cpus::get())
let threads = std::thread::available_parallelism().ok()
.and_then(|n| i32::try_from(n.get()).ok())
.unwrap_or(1)
.max(1);

Expand Down
10 changes: 8 additions & 2 deletions refract_core/src/kind/jxl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ use jpegxl_sys::{
use std::{
ffi::c_void,
mem::MaybeUninit,
num::NonZeroU8,
num::{
NonZeroU8,
NonZeroUsize,
},
};

#[cfg(feature = "decode_ng")]
Expand Down Expand Up @@ -398,7 +401,10 @@ impl LibJxlThreadParallelRunner {
/// # New instance!
fn new() -> Result<Self, RefractError> {
let threads = unsafe {
JxlThreadParallelRunnerCreate(std::ptr::null(), num_cpus::get())
JxlThreadParallelRunnerCreate(
std::ptr::null(),
std::thread::available_parallelism().map_or(1, NonZeroUsize::get),
)
};
if threads.is_null() { Err(RefractError::Encode) }
else { Ok(Self(threads)) }
Expand Down
28 changes: 13 additions & 15 deletions refract_core/src/kind/png/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ use crate::{
DecoderResult,
},
};
use lodepng::{
Bitmap,
RGBA,
};



Expand All @@ -24,28 +28,22 @@ impl Decoder for ImagePng {
// Grab the RGBA pixels, width, and height.
let (mut raw, width, height): (Vec<u8>, usize, usize) = {
// Parse the file.
let decoder = spng::Decoder::new(raw)
.with_output_format(spng::Format::Rgba8)
.with_decode_flags(spng::DecodeFlags::TRANSPARENCY);
let (info, mut reader) = decoder.read_info()
let Bitmap::<RGBA> { buffer, width, height } = lodepng::decode32(raw)
.map_err(|_| RefractError::Decode)?;

// Grab the dimensions.
let width = usize::try_from(info.width)
.map_err(|_| RefractError::Overflow)?;
let height = usize::try_from(info.height)
.map_err(|_| RefractError::Overflow)?;

// The pixel buffer should match the dimensions..
let size = width.checked_mul(height).and_then(|x| x.checked_mul(4))
.ok_or(RefractError::Overflow)?;
if info.buffer_size != size {
return Err(RefractError::Decode);
}

// Throw the pixels into a buffer.
let mut out = vec![0; size];
reader.next_frame(&mut out).map_err(|_| RefractError::Decode)?;
let mut out = Vec::with_capacity(size);
for RGBA { r, g, b, a } in buffer {
out.push(r);
out.push(g);
out.push(b);
out.push(a);
}
if out.len() != size { return Err(RefractError::Decode); }

(out, width, height)
};
Expand Down
4 changes: 2 additions & 2 deletions release/man/refract.1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.TH "REFRACT" "1" "September 2023" "Refract v0.10.5" "User Commands"
.TH "REFRACT" "1" "October 2023" "Refract v0.11.0" "User Commands"
.SH NAME
Refract \- Manual page for refract v0.10.5.
Refract \- Manual page for refract v0.11.0.
.SH DESCRIPTION
Guided AVIF/JPEG XL/WebP conversion for JPEG and PNG sources.
.SS USAGE:
Expand Down

0 comments on commit 33fadb9

Please sign in to comment.