Compare commits

...

2 commits
v0.1.0 ... main

Author SHA1 Message Date
asonix 45f5238f45 demo script - hash first frame
All checks were successful
/ tests (push) Successful in 45s
/ clippy (push) Successful in 13s
/ check (aarch64-unknown-linux-musl) (push) Successful in 7s
/ check (armv7-unknown-linux-musleabihf) (push) Successful in 7s
/ check (x86_64-unknown-linux-musl) (push) Successful in 6s
2024-03-06 13:28:59 -06:00
asonix e5efa1e4f8 Calculate exact capacity needed for hash 2024-03-06 13:27:03 -06:00
2 changed files with 4 additions and 4 deletions

View file

@ -7,12 +7,12 @@ if ! [ -f "$1" ]; then
exit 1;
fi
json=$(magick convert "$1" JSON:-)
json=$(magick convert "$1[0]" JSON:-)
width=$(echo $json | jq '.[0].image.geometry.width')
height=$(echo $json | jq '.[0].image.geometry.height')
magick convert "$1" RGBA:- | \
magick convert "$1[0]" RGBA:- | \
cargo r --example stdin --release -- \
--width $width \
--height $height

View file

@ -358,11 +358,11 @@ impl Encoder {
}
}
let mut blurhash = String::with_capacity(30);
let (_, dc) = self.factors[0];
let ac = &self.factors[1..];
let mut blurhash = String::with_capacity(1 + 1 + 4 + 2 * ac.len());
let size_flag = self.components.x - 1 + (self.components.y - 1) * 9;
base83::encode(size_flag, 1, &mut blurhash);