From 8870869e5d20dedc14d3fbad262e7e30760b9831 Mon Sep 17 00:00:00 2001 From: Martijn Gribnau Date: Thu, 1 Oct 2020 05:26:17 +0200 Subject: [PATCH 1/4] Add preliminary support for AVIF encoding --- Cargo.lock | 250 +++++++++++++++++++++++++++++++- components/sic_core/Cargo.toml | 9 +- components/sic_io/src/format.rs | 4 +- 3 files changed, 259 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c63b534a5..d213fce32 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -36,6 +36,26 @@ name = "anyhow" version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "arbitrary" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "arg_enum_proc_macro" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "arrayvec" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "atty" version = "0.2.14" @@ -51,11 +71,24 @@ name = "autocfg" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "avif-serialize" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "bitflags" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "bitstream-io" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "block-buffer" version = "0.7.3" @@ -103,6 +136,18 @@ name = "cfg-if" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "chrono" +version = "0.4.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.77 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "clap" version = "2.33.3" @@ -314,7 +359,7 @@ dependencies = [ [[package]] name = "image" version = "0.23.10" -source = "registry+https://github.com/rust-lang/crates.io-index" +source = "git+https://github.com/foresterre/image.git?branch=foresterre/fix/av1-image-output-format#d8db88a28ce652dd472992fb0e9925ee3fae0387" dependencies = [ "bytemuck 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -324,10 +369,24 @@ dependencies = [ "num-rational 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", "png 0.16.7 (registry+https://github.com/rust-lang/crates.io-index)", + "ravif 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rgb 0.8.25 (registry+https://github.com/rust-lang/crates.io-index)", "scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "tiff 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "image" +version = "0.23.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytemuck 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "num-iter 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "num-rational 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "imageproc" version = "0.21.0" @@ -344,6 +403,11 @@ dependencies = [ "rusttype 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "imgref" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "inflate" version = "0.4.5" @@ -352,6 +416,16 @@ dependencies = [ "adler32 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "interpolate_name" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "itertools" version = "0.9.0" @@ -392,6 +466,14 @@ dependencies = [ "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "loop9" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "imgref 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "lzw" version = "0.10.0" @@ -444,6 +526,16 @@ dependencies = [ "adler 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "noop_proc_macro" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "noop_proc_macro" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "num" version = "0.1.42" @@ -485,6 +577,16 @@ dependencies = [ "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "num-derive" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "num-integer" version = "0.1.43" @@ -572,6 +674,11 @@ dependencies = [ "syn 1.0.42 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "paste" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "pest" version = "2.1.3" @@ -688,6 +795,48 @@ dependencies = [ "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rav1e" +version = "0.4.0-alpha" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "arbitrary 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "arg_enum_proc_macro 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bitstream-io 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "interpolate_name 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.77 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "noop_proc_macro 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num-derive 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "paste 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rayon 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "simd_helpers 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "thiserror 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)", + "v_frame 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "vergen 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "ravif" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "avif-serialize 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "imgref 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "loop9 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rav1e 0.4.0-alpha (registry+https://github.com/rust-lang/crates.io-index)", + "rayon 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rgb 0.8.25 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rawpointer" version = "0.1.0" @@ -732,6 +881,14 @@ name = "regex-syntax" version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "rgb" +version = "0.8.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytemuck 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rulinalg" version = "0.4.2" @@ -741,6 +898,14 @@ dependencies = [ "num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rusttype" version = "0.9.2" @@ -768,6 +933,19 @@ name = "scopeguard" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "sha-1" version = "0.8.2" @@ -818,7 +996,7 @@ dependencies = [ name = "sic_core" version = "0.14.0" dependencies = [ - "image 0.23.10 (registry+https://github.com/rust-lang/crates.io-index)", + "image 0.23.10 (git+https://github.com/foresterre/image.git?branch=foresterre/fix/av1-image-output-format)", ] [[package]] @@ -866,6 +1044,14 @@ dependencies = [ "sic_core 0.14.0", ] +[[package]] +name = "simd_helpers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "strsim" version = "0.8.0" @@ -941,6 +1127,16 @@ dependencies = [ "miniz_oxide 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "time" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.77 (registry+https://github.com/rust-lang/crates.io-index)", + "wasi 0.10.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "ttf-parser" version = "0.6.2" @@ -971,11 +1167,31 @@ name = "unicode-xid" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "v_frame" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "noop_proc_macro 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "num-derive 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "vec_map" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "vergen" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "chrono 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "walkdir" version = "2.3.1" @@ -991,6 +1207,11 @@ name = "wasi" version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "wasi" +version = "0.10.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "weezl" version = "0.1.0" @@ -1030,9 +1251,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum aho-corasick 0.7.13 (registry+https://github.com/rust-lang/crates.io-index)" = "043164d8ba5c4c3035fec9bbee8647c0261d788f3474306f93bb65901cae0e86" "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" "checksum anyhow 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)" = "6b602bfe940d21c130f3895acd65221e8a61270debe89d628b9cb4e3ccb8569b" +"checksum arbitrary 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0922a3e746b5a44e111e5603feb6704e5cc959116f66737f50bb5cbd264e9d87" +"checksum arg_enum_proc_macro 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9bc19845baa31d32d189d8020bc8d76bf735e4587c9eba9cf561003ba4c93908" +"checksum arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8" "checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" "checksum autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" +"checksum avif-serialize 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "da8cdb6eb15e3168b18be740ee80086c59305316c10dcc3cf6a92814df19659f" "checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" +"checksum bitstream-io 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "71b66dc4e6b6d83f3afd41eb3006cd332a60d4e18496a31f2caa4069914d773f" "checksum block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" "checksum block-padding 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" "checksum bstr 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "31accafdb70df7871592c058eca3985b71104e15ac32f64706022c58867da931" @@ -1040,6 +1266,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum bytemuck 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "41aa2ec95ca3b5c54cf73c91acf06d24f4495d5f1b1c12506ae3483d646177ac" "checksum byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" "checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" +"checksum chrono 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)" = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" "checksum clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)" = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" "checksum color_quant 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0dbbb57365263e881e805dc77d94697c9118fd94d8da011240555aa7b23445bd" "checksum conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299" @@ -1063,15 +1290,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" "checksum hermit-abi 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c30f6d0bc6b00693347368a67d41b58f2fb851215ff1da49e90fe2c5c667151" "checksum ignore 0.4.16 (registry+https://github.com/rust-lang/crates.io-index)" = "22dcbf2a4a289528dbef21686354904e1c694ac642610a9bff9e7df730d9ec72" +"checksum image 0.23.10 (git+https://github.com/foresterre/image.git?branch=foresterre/fix/av1-image-output-format)" = "" "checksum image 0.23.10 (registry+https://github.com/rust-lang/crates.io-index)" = "985fc06b1304d19c28d5c562ed78ef5316183f2b0053b46763a0b94862373c34" "checksum imageproc 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b0fbd0ced24e3bc65052406fa6466203fe9c8d1990a3327567433e47109ed1a" +"checksum imgref 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d8767843be7909b5b3ffd9b52cdc042882b94e2cfe0c00abc4ce1c301cb1fcae" "checksum inflate 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "1cdb29978cc5797bd8dcc8e5bf7de604891df2a8dc576973d71a281e916db2ff" +"checksum interpolate_name 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b4b35f4a811037cfdcd44c5db40678464b2d5d248fc1abeeaaa125b370d47f17" "checksum itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" "checksum jpeg-decoder 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)" = "cc797adac5f083b8ff0ca6f6294a999393d76e197c36488e2ef732c4715f6fa3" "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" "checksum libc 0.2.77 (registry+https://github.com/rust-lang/crates.io-index)" = "f2f96b10ec2560088a8e76961b00d47107b3a625fecb76dedb29ee7ccbf98235" "checksum linked-hash-map 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8dd5a6d5999d9907cda8ed67bbd137d3af8085216c2ac62de5be860bd41f304a" "checksum log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" +"checksum loop9 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a703804431e5927454bcaf2b2a162595e95db931130c2728c18d050090f69940" "checksum lzw 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d947cbb889ed21c2a84be6ffbaebf5b4e0f4340638cba0444907e38b56be084" "checksum maplit 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" "checksum matrixmultiply 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "dcad67dcec2d58ff56f6292582377e6921afdf3bfbd533e26fb8900ae575e002" @@ -1080,10 +1311,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum memoffset 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "043175f069eda7b85febe4a74abbaeff828d9f8b448515d3151a14a3542811aa" "checksum miniz_oxide 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "791daaae1ed6889560f8c4359194f56648355540573244a5448a83ba1ecc7435" "checksum miniz_oxide 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4d7559a8a40d0f97e1edea3220f698f78b1c5ab67532e49f68fde3910323b722" +"checksum noop_proc_macro 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5ff36f3ca83b4b06a6080c42f67d97a8b0f009224d7db3a87744ff2e33a0c146" +"checksum noop_proc_macro 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8" "checksum num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "4703ad64153382334aa8db57c637364c322d3372e097840c72000dabdcf6156e" "checksum num 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ab3e176191bc4faad357e3122c4747aa098ac880e88b168f106386128736cf4a" "checksum num-bigint 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b7f3fc75e3697059fb1bc465e3d8cca6cf92f56854f201158b3f9c77d5a3cfa0" "checksum num-complex 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b05ad05bd8977050b171b3f6b48175fea6e0565b7981059b486075e1026a9fb5" +"checksum num-derive 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6f09b9841adb6b5e1f89ef7087ea636e0fd94b2851f887c1e3eb5d5f8228fab3" "checksum num-integer 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "8d59457e662d541ba17869cf51cf177c0b5f0cbf476c66bdc90bf1edac4f875b" "checksum num-iter 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e6b7c748f995c4c29c5f5ae0248536e04a5739927c74ec0fa564805094b9f" "checksum num-rational 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a5b4d7360f362cfb50dde8143501e6940b22f644be75a4cc90b2d81968908138" @@ -1094,6 +1328,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum owned_ttf_parser 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9f923fb806c46266c02ab4a5b239735c144bdeda724a50ed058e5226f594cde3" "checksum parameterized 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4b71f64f20ea2670c68680576b4e5dcebde46c6724b1999fa0e078b867eb99ff" "checksum parameterized-macro 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a28065af8de1867c0eee6b63abe828452fe3e886ab37b45f566c5c36a7d55f35" +"checksum paste 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0520af26d4cf99643dbbe093a61507922b57232d9978d8491fdc8f7b44573c8c" "checksum pest 2.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53" "checksum pest_derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "833d1ae558dc601e9a60366421196a8d94bc0ac980476d0b67e1d0988d72b2d0" "checksum pest_generator 2.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "99b8db626e31e5b81787b9783425769681b347011cc59471e33ea46d2ea0cf55" @@ -1107,17 +1342,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" "checksum rand_distr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "96977acbdd3a6576fb1d27391900035bf3863d4a16422973a409b488cf29ffb2" "checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +"checksum rav1e 0.4.0-alpha (registry+https://github.com/rust-lang/crates.io-index)" = "41aeb7a837c5d26277488e69a14a0656440701d01cbf46462274564c52da4d41" +"checksum ravif 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "718e4e74121da818c10444947c92c08afc31a292c438137d45f246bc5bedd00c" "checksum rawpointer 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ebac11a9d2e11f2af219b8b8d833b76b1ea0e054aa0e8d8e9e4cbde353bdf019" "checksum rayon 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf6960dc9a5b4ee8d3e4c5787b4a112a8818e0290a42ff664ad60692fdf2032" "checksum rayon-core 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e8c4fec834fb6e6d2dd5eece3c7b432a52f0ba887cf40e595190c4107edc08bf" "checksum regex 1.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3780fcf44b193bc4d09f36d2a3c87b251da4a046c87795a0d35f4f927ad8e6" "checksum regex-syntax 0.6.18 (registry+https://github.com/rust-lang/crates.io-index)" = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8" +"checksum rgb 0.8.25 (registry+https://github.com/rust-lang/crates.io-index)" = "287f3c3f8236abb92d8b7e36797f19159df4b58f0a658cc3fb6dd3004b1f3bd3" "checksum rulinalg 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "04ada202c9685e1d72a7420c578e92b358dbf807d3dfabb676a3dab9cc3bb12f" +"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum rusttype 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dc7c727aded0be18c5b80c1640eae0ac8e396abf6fa8477d96cb37d18ee5ec59" "checksum same-file 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" "checksum scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8" "checksum scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" "checksum sha-1 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df" +"checksum simd_helpers 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "95890f873bec569a0362c235787f3aca6e1e887302ba4840839bcc6459c42da6" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" "checksum strum 0.19.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3924a58d165da3b7b2922c667ab0673c7b5fd52b5c19ea3442747bcb3cd15abe" "checksum strum_macros 0.19.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2d2ab682ecdcae7f5f45ae85cd7c1e6c8e68ea42c8a612d47fedf831c037146a" @@ -1127,14 +1369,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum thiserror-impl 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)" = "bd80fc12f73063ac132ac92aceea36734f04a1d93c1240c6944e23a3b8841793" "checksum thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14" "checksum tiff 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3f3b8a87c4da944c3f27e5943289171ac71a6150a79ff6bacfff06d159dfff2f" +"checksum time 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)" = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" "checksum ttf-parser 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3e5d7cd7ab3e47dda6e56542f4bbf3824c15234958c6e1bd6aaa347e93499fdc" "checksum typenum 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" "checksum ucd-trie 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" "checksum unicode-segmentation 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0" "checksum unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" "checksum unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" +"checksum v_frame 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b7b2be1a8136ee3f6c319ab5c4e4b4c02891e7701d358798213392a7109a2d9e" "checksum vec_map 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" +"checksum vergen 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ce50d8996df1f85af15f2cd8d33daae6e479575123ef4314a51a70a230739cb" "checksum walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" +"checksum wasi 0.10.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" "checksum wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" "checksum weezl 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a3d2f24b6c3aa92fb33279566dbebf1cbe66b03a73f09aa69cf8cf14d2f9feb9" "checksum winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" diff --git a/components/sic_core/Cargo.toml b/components/sic_core/Cargo.toml index 274503b18..28dce26a9 100644 --- a/components/sic_core/Cargo.toml +++ b/components/sic_core/Cargo.toml @@ -8,4 +8,11 @@ license = "MIT" repository = "https://github.com/foresterre/sic" [dependencies] -image = "0.23.10" +#image = { version = "0.23.10", features = ["avif"] } +# FIXME / HACK: Our exporter requires ImageOutputFormat to be defined for a serializable format +# As of image: 0.23.10 this is not the case, but AVIF support (which is implemented by the image crate) +# for sic requires it. We could work around it in our code, but it would require quite a refactor, or +# an even dirtier hack than this temporary one. This hack makes it no longer possible for us to publish +# to crates.io however. So, next time we prior to making a release, we have to verify whether we do need to work around +# this issue or not. PR which would fix it is located at: https://github.com/image-rs/image/pull/1320 +image = { git = "https://github.com/foresterre/image.git", branch = "foresterre/fix/av1-image-output-format", features = ["avif"] } diff --git a/components/sic_io/src/format.rs b/components/sic_io/src/format.rs index 45fe74b06..6ba942c0b 100644 --- a/components/sic_io/src/format.rs +++ b/components/sic_io/src/format.rs @@ -86,6 +86,7 @@ impl EncodingFormatByIdentifier for DetermineEncodingFormat { /// Identifiers are based on common output file extensions. fn by_identifier(&self, identifier: &str) -> Result { match identifier.to_ascii_lowercase().as_str() { + "avif" => Ok(image::ImageOutputFormat::Avif), "bmp" => Ok(image::ImageOutputFormat::Bmp), "farbfeld" => Ok(image::ImageOutputFormat::Farbfeld), "gif" => Ok(image::ImageOutputFormat::Gif), @@ -142,10 +143,11 @@ mod tests { use super::*; const INPUT_FORMATS: &[&str] = &[ - "bmp", "farbfeld", "gif", "ico", "jpg", "jpeg", "png", "pbm", "pgm", "ppm", "pam", + "avif", "bmp", "farbfeld", "gif", "ico", "jpg", "jpeg", "png", "pbm", "pgm", "ppm", "pam", ]; const EXPECTED_VALUES: &[image::ImageOutputFormat] = &[ + image::ImageOutputFormat::Avif, image::ImageOutputFormat::Bmp, image::ImageOutputFormat::Farbfeld, image::ImageOutputFormat::Gif, From f6a28f38759697ceff5b190143b22cc084006f99 Mon Sep 17 00:00:00 2001 From: Martijn Gribnau Date: Sun, 4 Oct 2020 04:26:27 +0200 Subject: [PATCH 2/4] Set image crate version to 0.23.0 again --- Cargo.lock | 33 ++++++++++----------------------- components/sic_core/Cargo.toml | 9 +-------- 2 files changed, 11 insertions(+), 31 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d213fce32..7bc23c8f7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -46,9 +46,9 @@ name = "arg_enum_proc_macro" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.42 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -359,7 +359,7 @@ dependencies = [ [[package]] name = "image" version = "0.23.10" -source = "git+https://github.com/foresterre/image.git?branch=foresterre/fix/av1-image-output-format#d8db88a28ce652dd472992fb0e9925ee3fae0387" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytemuck 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -375,18 +375,6 @@ dependencies = [ "tiff 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "image" -version = "0.23.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bytemuck 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "num-iter 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", - "num-rational 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "imageproc" version = "0.21.0" @@ -421,9 +409,9 @@ name = "interpolate_name" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.42 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -582,9 +570,9 @@ name = "num-derive" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.42 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -815,7 +803,7 @@ dependencies = [ "paste 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rayon 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rayon 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "simd_helpers 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)", @@ -833,7 +821,7 @@ dependencies = [ "loop9 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "rav1e 0.4.0-alpha (registry+https://github.com/rust-lang/crates.io-index)", - "rayon 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rayon 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "rgb 0.8.25 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -996,7 +984,7 @@ dependencies = [ name = "sic_core" version = "0.14.0" dependencies = [ - "image 0.23.10 (git+https://github.com/foresterre/image.git?branch=foresterre/fix/av1-image-output-format)", + "image 0.23.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1290,7 +1278,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" "checksum hermit-abi 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c30f6d0bc6b00693347368a67d41b58f2fb851215ff1da49e90fe2c5c667151" "checksum ignore 0.4.16 (registry+https://github.com/rust-lang/crates.io-index)" = "22dcbf2a4a289528dbef21686354904e1c694ac642610a9bff9e7df730d9ec72" -"checksum image 0.23.10 (git+https://github.com/foresterre/image.git?branch=foresterre/fix/av1-image-output-format)" = "" "checksum image 0.23.10 (registry+https://github.com/rust-lang/crates.io-index)" = "985fc06b1304d19c28d5c562ed78ef5316183f2b0053b46763a0b94862373c34" "checksum imageproc 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b0fbd0ced24e3bc65052406fa6466203fe9c8d1990a3327567433e47109ed1a" "checksum imgref 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d8767843be7909b5b3ffd9b52cdc042882b94e2cfe0c00abc4ce1c301cb1fcae" diff --git a/components/sic_core/Cargo.toml b/components/sic_core/Cargo.toml index 28dce26a9..f1e9ebc26 100644 --- a/components/sic_core/Cargo.toml +++ b/components/sic_core/Cargo.toml @@ -8,11 +8,4 @@ license = "MIT" repository = "https://github.com/foresterre/sic" [dependencies] -#image = { version = "0.23.10", features = ["avif"] } -# FIXME / HACK: Our exporter requires ImageOutputFormat to be defined for a serializable format -# As of image: 0.23.10 this is not the case, but AVIF support (which is implemented by the image crate) -# for sic requires it. We could work around it in our code, but it would require quite a refactor, or -# an even dirtier hack than this temporary one. This hack makes it no longer possible for us to publish -# to crates.io however. So, next time we prior to making a release, we have to verify whether we do need to work around -# this issue or not. PR which would fix it is located at: https://github.com/image-rs/image/pull/1320 -image = { git = "https://github.com/foresterre/image.git", branch = "foresterre/fix/av1-image-output-format", features = ["avif"] } +image = { version = "0.23.10", features = ["avif"] } From ab8ebf6b7d6c61c2a723b1494d69de299e66b241 Mon Sep 17 00:00:00 2001 From: Martijn Gribnau Date: Sun, 4 Oct 2020 06:01:36 +0200 Subject: [PATCH 3/4] Fix adding support for AVIF through the image crate This is a bit of a hack, since we depend on the ImageOutputFormat which did not yet have an Avif entry for image crate v0.23.10. This has been contributed, but it is not released yet. Thus we have to call the encoder separately, which would require quite a bit of refactoring for a simple change (or we could wait I suppose), which would then revert the refactoring. For now however, I decided to add support, but use a environment variable to signal that the ImageOutputFormat is actually not Farb when the id "avif" is found, but Avif instead. Obviously this should be fixed when image crate `>v0.23.10` will be released. --- components/sic_io/src/conversion.rs | 20 +++++++++++++++++++- components/sic_io/src/format.rs | 12 +++++++++--- resources/wh1616.png | Bin 0 -> 637 bytes src/cli/pipeline/mod.rs | 16 +++++++--------- 4 files changed, 35 insertions(+), 13 deletions(-) create mode 100644 resources/wh1616.png diff --git a/components/sic_io/src/conversion.rs b/components/sic_io/src/conversion.rs index 915904957..0f88a086a 100644 --- a/components/sic_io/src/conversion.rs +++ b/components/sic_io/src/conversion.rs @@ -2,6 +2,7 @@ use crate::errors::SicIoError; use image::buffer::ConvertBuffer; use image::DynamicImage; use sic_core::image; +use sic_core::image::GenericImageView; use std::io::Write; #[derive(Clone, Copy, Debug)] @@ -44,7 +45,24 @@ impl<'a> ConversionWriter<'a> { None => &self.image, }; - ConversionWriter::save_to(writer, &export_buffer, output_format) + // FIXME remove: https://github.com/foresterre/sic/issues/597 + if std::env::var("SIC_AVIF_HACK").is_ok() { + let avif_encoder = image::avif::AvifEncoder::new(writer); + avif_encoder + .write_image( + &export_buffer.to_bytes(), + export_buffer.width(), + export_buffer.height(), + export_buffer.color(), + ) + .map_err(SicIoError::ImageError)?; + + std::env::remove_var("SIC_AVIF_HACK"); + + Ok(()) + } else { + ConversionWriter::save_to(writer, &export_buffer, output_format) + } } /// Some image output format types require color type pre-processing. diff --git a/components/sic_io/src/format.rs b/components/sic_io/src/format.rs index 6ba942c0b..d076eb758 100644 --- a/components/sic_io/src/format.rs +++ b/components/sic_io/src/format.rs @@ -86,7 +86,12 @@ impl EncodingFormatByIdentifier for DetermineEncodingFormat { /// Identifiers are based on common output file extensions. fn by_identifier(&self, identifier: &str) -> Result { match identifier.to_ascii_lowercase().as_str() { - "avif" => Ok(image::ImageOutputFormat::Avif), + "avif" => { + // FIXME: Dirty hack + // - https://github.com/foresterre/sic/issues/597 + std::env::set_var("SIC_AVIF_HACK", "1"); + Ok(image::ImageOutputFormat::Farbfeld) + } "bmp" => Ok(image::ImageOutputFormat::Bmp), "farbfeld" => Ok(image::ImageOutputFormat::Farbfeld), "gif" => Ok(image::ImageOutputFormat::Gif), @@ -143,11 +148,12 @@ mod tests { use super::*; const INPUT_FORMATS: &[&str] = &[ - "avif", "bmp", "farbfeld", "gif", "ico", "jpg", "jpeg", "png", "pbm", "pgm", "ppm", "pam", + //"avif", + "bmp", "farbfeld", "gif", "ico", "jpg", "jpeg", "png", "pbm", "pgm", "ppm", "pam", ]; const EXPECTED_VALUES: &[image::ImageOutputFormat] = &[ - image::ImageOutputFormat::Avif, + // image::ImageOutputFormat::Avif, image::ImageOutputFormat::Bmp, image::ImageOutputFormat::Farbfeld, image::ImageOutputFormat::Gif, diff --git a/resources/wh1616.png b/resources/wh1616.png new file mode 100644 index 0000000000000000000000000000000000000000..267807aad567c8f4a2dccc802e3b5f6e6ec99b1a GIT binary patch literal 637 zcmV-@0)qXCP)=hMgw(ub*4pR)^DR&ik0yVeGKM(PWW?(ewIp4WQd6QQ<;zl5 zx&P18OifMJy1N6=@nTsY!_c`0)rw{PoLE-%6dccRm2db9lGDtW=#_@%J%ZkCxVUa; ziG8@-fq^GIZp8m2hfI4a1@Gt36NA1xaIMy|s;_hQ2+=KhqFXpPgb~@_yY>s^hiCp5 zZ3zYd000SaNLh0L01sgR01sgSs6VG^0002ANklY}7XcnTvzvpnN>)Rai7W@s!x(mpww;bB0oW=Jf+autz&25Eu?pg-d)XgVNMGsrLi XO%Ekz{a#hU00000NkvXXu0mjf`Bo8} literal 0 HcmV?d00001 diff --git a/src/cli/pipeline/mod.rs b/src/cli/pipeline/mod.rs index 0df03ac3a..f8ff42e3d 100644 --- a/src/cli/pipeline/mod.rs +++ b/src/cli/pipeline/mod.rs @@ -149,7 +149,7 @@ fn create_format_decider( io_device: &PathVariant, config: &Config, ) -> anyhow::Result { - let encoding_format_determiner = DetermineEncodingFormat { + let format_resolver = DetermineEncodingFormat { pnm_sample_encoding: if config.encoding_settings.pnm_use_ascii_format { Some(image::pnm::SampleEncoding::Ascii) } else { @@ -163,15 +163,13 @@ fn create_format_decider( }; let format = match &config.forced_output_format { - Some(format) => encoding_format_determiner - .by_identifier(format) - .fallback_if( - config.encoding_settings.image_output_format_fallback, - guess_output_by_identifier, - format, - )?, + Some(format) => format_resolver.by_identifier(format).fallback_if( + config.encoding_settings.image_output_format_fallback, + guess_output_by_identifier, + format, + )?, None => match io_device { - PathVariant::Path(out) => encoding_format_determiner.by_extension(out).fallback_if( + PathVariant::Path(out) => format_resolver.by_extension(out).fallback_if( config.encoding_settings.image_output_format_fallback, guess_output_by_path, out, From e652b4502ae52f9f3f2d78aed79d5db671639297 Mon Sep 17 00:00:00 2001 From: Martijn Gribnau Date: Sun, 4 Oct 2020 06:59:32 +0200 Subject: [PATCH 4/4] Remove pinned version (MSRV) guarantee It's barely necessary since this is a binary project, not a library project. --- .github/workflows/ci.yml | 2 +- README.md | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ca007227d..38856d0d0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,7 +23,7 @@ jobs: # pinned rust version :: ubuntu - build: pinned os: ubuntu-18.04 - rust: 1.42.0 + rust: 1.43.0 # latest rust stable :: ubuntu - build: stable diff --git a/README.md b/README.md index 213e28765..c62ecd884 100644 --- a/README.md +++ b/README.md @@ -22,12 +22,13 @@ Pre build binary: see [releases](https://github.com/foresterre/sic/releases). From the source: - Setup rust and cargo (for example using [rustup](https://rustup.rs/))
- Current [MSRV](https://github.com/foresterre/cargo-msrv): 1.35 (edition 2018 is required); - we aim to always develop against the latest stable release. - Clone this repo: `git clone https://github.com/foresterre/sic.git` - Switch to this repo: `cd sic` - Build a release: `cargo build --release` +**MSRV when building from source:** + +Expects development against the latest Rust stable version, but may work on older versions. ### Usage