Tweaked output size and speed

This commit is contained in:
Logan 2024-09-04 21:49:07 -05:00
parent f619f7dda8
commit bb28723ef0
3 changed files with 25 additions and 14 deletions

27
Cargo.lock generated
View file

@ -17,6 +17,12 @@ version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
[[package]]
name = "adler2"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627"
[[package]]
name = "ahash"
version = "0.8.7"
@ -127,7 +133,7 @@ dependencies = [
"cc",
"cfg-if",
"libc",
"miniz_oxide",
"miniz_oxide 0.7.1",
"object",
"rustc-demangle",
]
@ -416,7 +422,7 @@ dependencies = [
"flume",
"half",
"lebe",
"miniz_oxide",
"miniz_oxide 0.7.1",
"rayon-core",
"smallvec",
"zune-inflate",
@ -447,12 +453,12 @@ dependencies = [
[[package]]
name = "flate2"
version = "1.0.28"
version = "1.0.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e"
checksum = "324a1be68054ef05ad64b861cc9eaf1d623d2d8cb25b4bf2cb9cdd902b4bf253"
dependencies = [
"crc32fast",
"miniz_oxide",
"miniz_oxide 0.8.0",
]
[[package]]
@ -1013,6 +1019,15 @@ dependencies = [
"simd-adler32",
]
[[package]]
name = "miniz_oxide"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1"
dependencies = [
"adler2",
]
[[package]]
name = "mio"
version = "0.8.11"
@ -1220,7 +1235,7 @@ dependencies = [
"crc32fast",
"fdeflate",
"flate2",
"miniz_oxide",
"miniz_oxide 0.7.1",
]
[[package]]

View file

@ -15,12 +15,6 @@ bytemuck = {version="1.14", features=["derive"]}
futures-intrusive = "0.5"
rust-cgi = "0.7"
[profile.dev]
opt-level=1
# codegen-units = 1
# lto = "fat"
[profile.release]
opt-level=3
codegen-units = 1

View file

@ -76,14 +76,16 @@ pub enum Error {
}
pub async fn make_quickdraw() -> Option<Arc<Mutex<QuickDraw>>> {
Some(Arc::new(Mutex::new(QuickDraw::new(512, 512, 1000).await?)))
Some(Arc::new(Mutex::new(
QuickDraw::new(WIDTH as u32, HEIGHT as u32, 1000).await?,
)))
}
pub async fn make_gif(
input: &[u8],
draw: Arc<Mutex<QuickDraw>>,
) -> Result<Vec<u8>, Error> {
const STEP: usize = 20;
const STEP: usize = 30;
const RADIUS: f32 = 7.0;
let image = image::io::Reader::new(Cursor::new(input.to_vec().as_slice()))
.with_guessed_format()