From 0627dd0e4b0c88e15bd2ce40e056033ecd8684b4 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 13 Nov 2026 15:07:00 +0000 Subject: [PATCH 01/12] Use shared ZIP codec for dotLottie imports --- Cargo.lock | 90 +++++++++++++++++--------- Cargo.toml | 42 ++++++------- crates/lottie/src/import.rs | 8 +-- crates/lottie/src/tests.rs | 18 ++++++ crates/lottie/src/zip.rs | 122 +----------------------------------- 5 files changed, 107 insertions(+), 173 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e6450c078..8e4ae1211 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1092,26 +1092,26 @@ dependencies = [ [[package]] name = "craft-aep" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" [[package]] name = "craft-audio" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" dependencies = [ - "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9)", + "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef)", "thiserror 2.0.21", ] [[package]] name = "craft-docpath" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" [[package]] name = "craft-dpx" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" dependencies = [ "thiserror 2.0.21", ] @@ -1119,7 +1119,7 @@ dependencies = [ [[package]] name = "craft-ecproj-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" dependencies = [ "serde", "serde_json", @@ -1129,12 +1129,12 @@ dependencies = [ [[package]] name = "craft-eps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" [[package]] name = "craft-exr" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" dependencies = [ "serde_json", ] @@ -1142,17 +1142,17 @@ dependencies = [ [[package]] name = "craft-fonts-build" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" [[package]] name = "craft-gif" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" [[package]] name = "craft-i18n" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" dependencies = [ "fixed_decimal", "icu_decimal", @@ -1175,8 +1175,9 @@ dependencies = [ [[package]] name = "craft-lottie" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" dependencies = [ + "craft-zip", "serde_json", "thiserror 2.0.21", ] @@ -1184,7 +1185,7 @@ dependencies = [ [[package]] name = "craft-media" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" dependencies = [ "thiserror 2.0.21", ] @@ -1200,7 +1201,7 @@ dependencies = [ [[package]] name = "craft-mesh" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" dependencies = [ "miniz_oxide 0.9.1", "serde_json", @@ -1209,7 +1210,7 @@ dependencies = [ [[package]] name = "craft-pdf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" dependencies = [ "hayro-syntax", "thiserror 2.0.21", @@ -1218,7 +1219,7 @@ dependencies = [ [[package]] name = "craft-psd" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" dependencies = [ "encoding_rs", "flate2", @@ -1229,7 +1230,7 @@ dependencies = [ [[package]] name = "craft-quit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" dependencies = [ "dispatch2", "egui", @@ -1240,19 +1241,21 @@ dependencies = [ [[package]] name = "craft-svg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" dependencies = [ "craft-xml", "flate2", "kurbo", "roxmltree", "thiserror 2.0.21", + "vectorcraft-geom", + "vectorcraft-pathops", ] [[package]] name = "craft-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" dependencies = [ "craft-fonts-build", "craft-i18n", @@ -1273,7 +1276,7 @@ dependencies = [ [[package]] name = "craft-update" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" dependencies = [ "chrono", "dunce", @@ -1300,9 +1303,9 @@ dependencies = [ [[package]] name = "craft-video" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" dependencies = [ - "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9)", + "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef)", "rayon", "thiserror 2.0.21", ] @@ -1310,7 +1313,7 @@ dependencies = [ [[package]] name = "craft-webp" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" dependencies = [ "thiserror 2.0.21", ] @@ -1318,12 +1321,22 @@ dependencies = [ [[package]] name = "craft-xml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" dependencies = [ "quick-xml 0.41.0", "thiserror 2.0.21", ] +[[package]] +name = "craft-zip" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +dependencies = [ + "flate2", + "thiserror 2.0.21", + "zip 9.1.3", +] + [[package]] name = "crc32fast" version = "1.5.2" @@ -1683,7 +1696,7 @@ name = "effectcraft-export" version = "0.24.1" dependencies = [ "craft-audio", - "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9)", + "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef)", "craft-video", "effectcraft-color", "effectcraft-effects", @@ -1852,7 +1865,7 @@ dependencies = [ "craft-dpx", "craft-exr", "craft-gif", - "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9)", + "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef)", "craft-webp", "effectcraft-color", "effectcraft-effects", @@ -3422,7 +3435,7 @@ checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a" [[package]] name = "hayro-jbig2" version = "0.3.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" dependencies = [ "hayro-ccitt", ] @@ -3436,7 +3449,7 @@ checksum = "c75ab947623ef4ccaa7acf0579edf7cbb5a73838e3839a7be73335e522f433a1" [[package]] name = "hayro-syntax" version = "0.7.2" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" dependencies = [ "hayro-jbig2", "hayro-jpeg2000", @@ -6683,6 +6696,27 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "vectorcraft-geom" +version = "0.18.0" +source = "git+https://github.com/storytold/vectorcraft.git?rev=6b3a6b8788ebcb420d69449199cbdf323888d27e#6b3a6b8788ebcb420d69449199cbdf323888d27e" +dependencies = [ + "kurbo", + "serde", + "thiserror 2.0.21", +] + +[[package]] +name = "vectorcraft-pathops" +version = "0.18.0" +source = "git+https://github.com/storytold/vectorcraft.git?rev=6b3a6b8788ebcb420d69449199cbdf323888d27e#6b3a6b8788ebcb420d69449199cbdf323888d27e" +dependencies = [ + "kurbo", + "linesweeper", + "thiserror 2.0.21", + "vectorcraft-geom", +] + [[package]] name = "vello_common" version = "0.2.0" diff --git a/Cargo.toml b/Cargo.toml index 1b80048f2..4deece869 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,22 +11,22 @@ rust-version = "1.95" repository = "https://github.com/storytold/effectcraft" [workspace.dependencies] -craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9", version = "=0.1.0", default-features = false, features = ["read"] } -craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } -craft-quit = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } -craft-ecproj-format = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } -craft-dpx = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } -craft-eps = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } -craft-exr = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } -craft-gif = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } -craft-psd = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } -craft-svg = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } -craft-webp = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } -craft-lottie = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } -craft-mesh = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9", default-features = false, features = ["stl", "obj", "gltf", "fbx"] } -craft-aep = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } +craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef", version = "=0.1.0", default-features = false, features = ["read"] } +craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } +craft-quit = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } +craft-ecproj-format = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } +craft-dpx = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } +craft-eps = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } +craft-exr = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } +craft-gif = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } +craft-psd = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } +craft-svg = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } +craft-webp = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } +craft-lottie = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } +craft-mesh = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef", default-features = false, features = ["stl", "obj", "gltf", "fbx"] } +craft-aep = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } # craft-update: app-specific pretend versions apply to startup and manual checks. -craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "47107f660191de2f0b425569506f4daa4faadac9", features = ["egui"] } +craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef", features = ["egui"] } # internal effectcraft-time = { path = "crates/time" } effectcraft-geom = { path = "crates/geom" } @@ -90,9 +90,9 @@ same-file = "1.0" tempfile = "3.27" # codecs + containers shared by the Craft apps (crates/media, crates/export); keep all three on one rev. -craft-media = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9", default-features = false, features = ["isobmff", "matroska"] } -craft-audio = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9", default-features = false, features = ["aac-decode", "aac-encode", "opus-decode"] } -craft-video = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9", features = ["h264-encode", "prores", "hevc-encode", "vp9-encode", "av1", "threads"] } +craft-media = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef", default-features = false, features = ["isobmff", "matroska"] } +craft-audio = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef", default-features = false, features = ["aac-decode", "aac-encode", "opus-decode"] } +craft-video = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef", features = ["h264-encode", "prores", "hevc-encode", "vp9-encode", "av1", "threads"] } # footage decoding: FilmCraft's pure-Rust crates, pinned to a revision (plan/adr/0001). # Only `crates/media`, `crates/export` and `crates/interchange` may depend on these. @@ -122,7 +122,7 @@ half = "2.7" # ui # Shared frontend components; keep this dependency above the engine boundary. # Shared UI and the complete egui family select reviewed immutable commits below. -craft-ui = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9", features = ["serde"] } +craft-ui = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef", features = ["serde"] } # `default_fonts` and `monochrome_emoji_fonts` are explicit: the app's `FontDefinitions::default()` # and its `✔`/`▣` chrome glyphs need both, and kittest's own dev-dependencies do not propagate. egui = { version = "0.37", default-features = false, features = ["default_fonts", "monochrome_emoji_fonts"] } @@ -231,8 +231,8 @@ lto = "thin" codegen-units = 1 [patch.crates-io] -hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9", version = "=0.7.2" } -hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9", version = "=0.3.0" } +hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef", version = "=0.7.2" } +hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef", version = "=0.3.0" } ecolor = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } emath = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } epaint = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } diff --git a/crates/lottie/src/import.rs b/crates/lottie/src/import.rs index 6534727dc..22dd8ad21 100644 --- a/crates/lottie/src/import.rs +++ b/crates/lottie/src/import.rs @@ -41,7 +41,7 @@ pub struct ImportResult { pub warnings: Vec, } -/// The Lottie document inside raw bytes (plain JSON, or a stored dotLottie archive), read into +/// The Lottie document inside raw bytes (plain JSON, or a dotLottie archive), read into /// `craft-lottie`'s model within its default limits. fn document(bytes: &[u8]) -> Result { let read = |b: &[u8]| { @@ -51,12 +51,12 @@ fn document(bytes: &[u8]) -> Result { }) }; if bytes.starts_with(b"PK") { - let entries = crate::zip::read_stored(bytes); + let entries = crate::zip::read_entries(bytes).map_err(|e| LottieError::Parse(format!("dotLottie ZIP: {e}")))?; let anim = entries .iter() .find(|(n, _)| n.starts_with("animations/") && n.ends_with(".json")) .or_else(|| entries.iter().find(|(n, _)| n.ends_with(".json") && n != "manifest.json")) - .ok_or_else(|| LottieError::Parse("dotLottie archive without an uncompressed animation".into()))?; + .ok_or_else(|| LottieError::Parse("dotLottie archive without a JSON animation".into()))?; return read(&anim.1); } read(bytes) @@ -102,7 +102,7 @@ fn external_image(stored: &str, base_dir: &str) -> Result { } } -/// Import a Lottie document (JSON or a stored `.lottie` archive) into `project` as a new +/// Import a Lottie document (JSON or a `.lottie` archive) into `project` as a new /// composition. `store` saves embedded images and returns the file path to use; /// `base_dir` resolves external image references. pub fn import( diff --git a/crates/lottie/src/tests.rs b/crates/lottie/src/tests.rs index 35c52026d..cf8543fdf 100644 --- a/crates/lottie/src/tests.rs +++ b/crates/lottie/src/tests.rs @@ -799,6 +799,24 @@ fn dotlottie_archive_roundtrip() { assert_eq!(q.comp(imp.comp).unwrap().layers.len(), 1); } +#[test] +fn deflated_dotlottie_archive_imports() { + let (mut p, cid) = setup(); + let l = solid_layer(&mut p, cid, [0.0, 1.0, 0.0], 40, 40); + push(&mut p, cid, l); + let res = export_comp(&p, cid, &ExportOptions::default(), &no_read).unwrap(); + let manifest = serde_json::to_vec(&serde_json::json!({"version":"1","animations":[{"id":"main"}]})).unwrap(); + let animation = serde_json::to_vec(&res.json).unwrap(); + let zip = craft_lottie::zip::try_store_with_compression( + &[("manifest.json".into(), manifest), ("animations/main.json".into(), animation)], + craft_lottie::zip::Compression::Deflated, + ) + .unwrap(); + let mut q = Project::default(); + let imp = import(&mut q, &zip, "compressed", "", &mut |_| None).unwrap(); + assert_eq!(q.comp(imp.comp).unwrap().layers.len(), 1); +} + // ---------------------------------------------------------------- hand-written fixtures fn fixture(name: &str) -> (Project, ItemId, Vec) { diff --git a/crates/lottie/src/zip.rs b/crates/lottie/src/zip.rs index 2a11dfa25..b47e7cab2 100644 --- a/crates/lottie/src/zip.rs +++ b/crates/lottie/src/zip.rs @@ -1,121 +1,3 @@ -//! A minimal ZIP writer (stored entries, PKWARE APPNOTE 6.3 local headers + central directory) -//! for `.lottie` (dotLottie) archives. +//! Shared stored-entry ZIP functions used by dotLottie imports and exports. -fn crc32(data: &[u8]) -> u32 { - let mut crc = 0xFFFF_FFFFu32; - for &b in data { - crc ^= b as u32; - for _ in 0..8 { - crc = if crc & 1 != 0 { (crc >> 1) ^ 0xEDB8_8320 } else { crc >> 1 }; - } - } - !crc -} - -/// Build a ZIP archive with the given (name, bytes) entries, uncompressed. -pub fn store(entries: &[(String, Vec)]) -> Vec { - let mut out = Vec::new(); - let mut central = Vec::new(); - let put16 = |v: &mut Vec, x: u16| v.extend_from_slice(&x.to_le_bytes()); - let put32 = |v: &mut Vec, x: u32| v.extend_from_slice(&x.to_le_bytes()); - for (name, data) in entries { - let offset = out.len() as u32; - let crc = crc32(data); - let n = name.as_bytes(); - // Local file header. - put32(&mut out, 0x0403_4b50); - put16(&mut out, 20); // version needed - put16(&mut out, 0x0800); // flags: UTF-8 names - put16(&mut out, 0); // stored - put16(&mut out, 0); // time - put16(&mut out, 0x21); // date (1980-01-01) - put32(&mut out, crc); - put32(&mut out, data.len() as u32); - put32(&mut out, data.len() as u32); - put16(&mut out, n.len() as u16); - put16(&mut out, 0); - out.extend_from_slice(n); - out.extend_from_slice(data); - // Central directory record. - put32(&mut central, 0x0201_4b50); - put16(&mut central, 20); // made by - put16(&mut central, 20); - put16(&mut central, 0x0800); - put16(&mut central, 0); - put16(&mut central, 0); - put16(&mut central, 0x21); - put32(&mut central, crc); - put32(&mut central, data.len() as u32); - put32(&mut central, data.len() as u32); - put16(&mut central, n.len() as u16); - put16(&mut central, 0); // extra - put16(&mut central, 0); // comment - put16(&mut central, 0); // disk - put16(&mut central, 0); // internal attrs - put32(&mut central, 0); // external attrs - put32(&mut central, offset); - central.extend_from_slice(n); - } - let cd_offset = out.len() as u32; - let cd_len = central.len() as u32; - out.extend_from_slice(¢ral); - put32(&mut out, 0x0605_4b50); - put16(&mut out, 0); - put16(&mut out, 0); - put16(&mut out, entries.len() as u16); - put16(&mut out, entries.len() as u16); - put32(&mut out, cd_len); - put32(&mut out, cd_offset); - put16(&mut out, 0); - out -} - -/// Whether an entry name is a relative path inside the archive: not absolute (`/…`, `\…`), no -/// drive (`C:…`) and no `..` component. -fn is_relative_name(name: &str) -> bool { - let drive = name.as_bytes().get(1) == Some(&b':'); - !name.starts_with(['/', '\\']) && !drive && !name.split(['/', '\\']).any(|c| c == "..") -} - -/// Read the stored (uncompressed) entries of a ZIP archive written by [`store`] or any other -/// writer that did not compress. Compressed entries and entries whose names are not relative -/// paths inside the archive are skipped. -pub fn read_stored(data: &[u8]) -> Vec<(String, Vec)> { - let mut out = vec![]; - let mut i = 0usize; - let u16_at = |p: usize| data.get(p..p + 2).map(|b| u16::from_le_bytes([b[0], b[1]]) as usize); - let u32_at = |p: usize| data.get(p..p + 4).map(|b| u32::from_le_bytes([b[0], b[1], b[2], b[3]]) as usize); - while u32_at(i) == Some(0x0403_4b50) { - let (Some(method), Some(size), Some(nlen), Some(xlen)) = (u16_at(i + 8), u32_at(i + 18), u16_at(i + 26), u16_at(i + 28)) else { break }; - let name_start = i + 30; - let body = name_start + nlen + xlen; - let (Some(name), Some(bytes)) = (data.get(name_start..name_start + nlen), data.get(body..body + size)) else { break }; - let name = String::from_utf8_lossy(name).to_string(); - if method == 0 && is_relative_name(&name) { - out.push((name, bytes.to_vec())); - } - i = body + size; - } - out -} - -#[cfg(test)] -mod tests { - #[test] - fn crc_and_roundtrip() { - assert_eq!(super::crc32(b"123456789"), 0xCBF4_3926); - let z = super::store(&[("a.json".into(), b"{}".to_vec()), ("b/c.txt".into(), b"hello".to_vec())]); - let back = super::read_stored(&z); - assert_eq!(back.len(), 2); - assert_eq!(back[1].0, "b/c.txt"); - assert_eq!(back[1].1, b"hello"); - } - - #[test] - fn entries_outside_the_archive_root_are_skipped() { - let names = ["../up.txt", "a/../../up.txt", "/abs/x", "\\abs\\x", "C:\\x", "c:x", "a\\..\\x", "ok/x.txt", "ok/..x"]; - let z = super::store(&names.iter().map(|n| (n.to_string(), b"x".to_vec())).collect::>()); - let back: Vec = super::read_stored(&z).into_iter().map(|(n, _)| n).collect(); - assert_eq!(back, ["ok/x.txt", "ok/..x"]); - } -} +pub use craft_lottie::zip::{Limits, read_entries, read_entries_with_limits, read_stored, store, try_store, try_store_with_compression}; From e48c1c7c98df52a62a382e146eeb0369b34d70d3 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 13 Nov 2026 15:51:49 +0000 Subject: [PATCH 02/12] chore: pin shared libraries to merged dotlottie --- Cargo.lock | 58 +++++++++++++++++++++++++++--------------------------- Cargo.toml | 42 +++++++++++++++++++-------------------- 2 files changed, 50 insertions(+), 50 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8e4ae1211..a44dcc111 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1092,26 +1092,26 @@ dependencies = [ [[package]] name = "craft-aep" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" [[package]] name = "craft-audio" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" dependencies = [ - "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef)", + "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90)", "thiserror 2.0.21", ] [[package]] name = "craft-docpath" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" [[package]] name = "craft-dpx" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" dependencies = [ "thiserror 2.0.21", ] @@ -1119,7 +1119,7 @@ dependencies = [ [[package]] name = "craft-ecproj-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" dependencies = [ "serde", "serde_json", @@ -1129,12 +1129,12 @@ dependencies = [ [[package]] name = "craft-eps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" [[package]] name = "craft-exr" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" dependencies = [ "serde_json", ] @@ -1142,17 +1142,17 @@ dependencies = [ [[package]] name = "craft-fonts-build" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" [[package]] name = "craft-gif" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" [[package]] name = "craft-i18n" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" dependencies = [ "fixed_decimal", "icu_decimal", @@ -1175,7 +1175,7 @@ dependencies = [ [[package]] name = "craft-lottie" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" dependencies = [ "craft-zip", "serde_json", @@ -1185,7 +1185,7 @@ dependencies = [ [[package]] name = "craft-media" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" dependencies = [ "thiserror 2.0.21", ] @@ -1201,7 +1201,7 @@ dependencies = [ [[package]] name = "craft-mesh" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" dependencies = [ "miniz_oxide 0.9.1", "serde_json", @@ -1210,7 +1210,7 @@ dependencies = [ [[package]] name = "craft-pdf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" dependencies = [ "hayro-syntax", "thiserror 2.0.21", @@ -1219,7 +1219,7 @@ dependencies = [ [[package]] name = "craft-psd" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" dependencies = [ "encoding_rs", "flate2", @@ -1230,7 +1230,7 @@ dependencies = [ [[package]] name = "craft-quit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" dependencies = [ "dispatch2", "egui", @@ -1241,7 +1241,7 @@ dependencies = [ [[package]] name = "craft-svg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" dependencies = [ "craft-xml", "flate2", @@ -1255,7 +1255,7 @@ dependencies = [ [[package]] name = "craft-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" dependencies = [ "craft-fonts-build", "craft-i18n", @@ -1276,7 +1276,7 @@ dependencies = [ [[package]] name = "craft-update" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" dependencies = [ "chrono", "dunce", @@ -1303,9 +1303,9 @@ dependencies = [ [[package]] name = "craft-video" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" dependencies = [ - "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef)", + "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90)", "rayon", "thiserror 2.0.21", ] @@ -1313,7 +1313,7 @@ dependencies = [ [[package]] name = "craft-webp" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" dependencies = [ "thiserror 2.0.21", ] @@ -1321,7 +1321,7 @@ dependencies = [ [[package]] name = "craft-xml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" dependencies = [ "quick-xml 0.41.0", "thiserror 2.0.21", @@ -1330,7 +1330,7 @@ dependencies = [ [[package]] name = "craft-zip" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" dependencies = [ "flate2", "thiserror 2.0.21", @@ -1696,7 +1696,7 @@ name = "effectcraft-export" version = "0.24.1" dependencies = [ "craft-audio", - "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef)", + "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90)", "craft-video", "effectcraft-color", "effectcraft-effects", @@ -1865,7 +1865,7 @@ dependencies = [ "craft-dpx", "craft-exr", "craft-gif", - "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef)", + "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90)", "craft-webp", "effectcraft-color", "effectcraft-effects", @@ -3435,7 +3435,7 @@ checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a" [[package]] name = "hayro-jbig2" version = "0.3.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" dependencies = [ "hayro-ccitt", ] @@ -3449,7 +3449,7 @@ checksum = "c75ab947623ef4ccaa7acf0579edf7cbb5a73838e3839a7be73335e522f433a1" [[package]] name = "hayro-syntax" version = "0.7.2" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" dependencies = [ "hayro-jbig2", "hayro-jpeg2000", diff --git a/Cargo.toml b/Cargo.toml index 4deece869..71da0b27f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,22 +11,22 @@ rust-version = "1.95" repository = "https://github.com/storytold/effectcraft" [workspace.dependencies] -craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef", version = "=0.1.0", default-features = false, features = ["read"] } -craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } -craft-quit = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } -craft-ecproj-format = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } -craft-dpx = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } -craft-eps = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } -craft-exr = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } -craft-gif = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } -craft-psd = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } -craft-svg = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } -craft-webp = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } -craft-lottie = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } -craft-mesh = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef", default-features = false, features = ["stl", "obj", "gltf", "fbx"] } -craft-aep = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } +craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90", version = "=0.1.0", default-features = false, features = ["read"] } +craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" } +craft-quit = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" } +craft-ecproj-format = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" } +craft-dpx = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" } +craft-eps = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" } +craft-exr = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" } +craft-gif = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" } +craft-psd = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" } +craft-svg = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" } +craft-webp = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" } +craft-lottie = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" } +craft-mesh = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90", default-features = false, features = ["stl", "obj", "gltf", "fbx"] } +craft-aep = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" } # craft-update: app-specific pretend versions apply to startup and manual checks. -craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef", features = ["egui"] } +craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90", features = ["egui"] } # internal effectcraft-time = { path = "crates/time" } effectcraft-geom = { path = "crates/geom" } @@ -90,9 +90,9 @@ same-file = "1.0" tempfile = "3.27" # codecs + containers shared by the Craft apps (crates/media, crates/export); keep all three on one rev. -craft-media = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef", default-features = false, features = ["isobmff", "matroska"] } -craft-audio = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef", default-features = false, features = ["aac-decode", "aac-encode", "opus-decode"] } -craft-video = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef", features = ["h264-encode", "prores", "hevc-encode", "vp9-encode", "av1", "threads"] } +craft-media = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90", default-features = false, features = ["isobmff", "matroska"] } +craft-audio = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90", default-features = false, features = ["aac-decode", "aac-encode", "opus-decode"] } +craft-video = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90", features = ["h264-encode", "prores", "hevc-encode", "vp9-encode", "av1", "threads"] } # footage decoding: FilmCraft's pure-Rust crates, pinned to a revision (plan/adr/0001). # Only `crates/media`, `crates/export` and `crates/interchange` may depend on these. @@ -122,7 +122,7 @@ half = "2.7" # ui # Shared frontend components; keep this dependency above the engine boundary. # Shared UI and the complete egui family select reviewed immutable commits below. -craft-ui = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef", features = ["serde"] } +craft-ui = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90", features = ["serde"] } # `default_fonts` and `monochrome_emoji_fonts` are explicit: the app's `FontDefinitions::default()` # and its `✔`/`▣` chrome glyphs need both, and kittest's own dev-dependencies do not propagate. egui = { version = "0.37", default-features = false, features = ["default_fonts", "monochrome_emoji_fonts"] } @@ -231,8 +231,8 @@ lto = "thin" codegen-units = 1 [patch.crates-io] -hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef", version = "=0.7.2" } -hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef", version = "=0.3.0" } +hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90", version = "=0.7.2" } +hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90", version = "=0.3.0" } ecolor = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } emath = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } epaint = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } From 9c94c11856fbcd5c2ff87995119563c148ce5519 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 13 Nov 2026 16:25:01 +0000 Subject: [PATCH 03/12] fix ci: track merged craft pdf revision --- xtask/src/pdf_deps.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xtask/src/pdf_deps.rs b/xtask/src/pdf_deps.rs index a4ed9d6dd..ca376bf5d 100644 --- a/xtask/src/pdf_deps.rs +++ b/xtask/src/pdf_deps.rs @@ -5,7 +5,7 @@ use std::process::Command; use serde_json::Value; -const REV: &str = "47107f660191de2f0b425569506f4daa4faadac9"; +const REV: &str = "3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90"; const PACKAGES: &[(&str, &str)] = &[("craft-pdf", "0.1.0"), ("hayro-syntax", "0.7.2"), ("hayro-jbig2", "0.3.0")]; pub fn run(root: &Path) -> Result<(), String> { From 9bb7b55e0d36024f1c61c4e852eed84f9923faac Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 13 Nov 2026 17:11:03 +0000 Subject: [PATCH 04/12] refactor(exr): decode channels with shared craft exr --- Cargo.lock | 94 +++++--- Cargo.toml | 42 ++-- crates/media/Cargo.toml | 2 +- crates/media/src/exr_channels.rs | 367 ++++++++++++------------------- xtask/src/pdf_deps.rs | 2 +- 5 files changed, 232 insertions(+), 275 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e6450c078..64214d619 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1092,26 +1092,26 @@ dependencies = [ [[package]] name = "craft-aep" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=bc3e521bd37e53f2b5b4c55278111b55fd9a40f9#bc3e521bd37e53f2b5b4c55278111b55fd9a40f9" [[package]] name = "craft-audio" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=bc3e521bd37e53f2b5b4c55278111b55fd9a40f9#bc3e521bd37e53f2b5b4c55278111b55fd9a40f9" dependencies = [ - "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9)", + "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=bc3e521bd37e53f2b5b4c55278111b55fd9a40f9)", "thiserror 2.0.21", ] [[package]] name = "craft-docpath" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=bc3e521bd37e53f2b5b4c55278111b55fd9a40f9#bc3e521bd37e53f2b5b4c55278111b55fd9a40f9" [[package]] name = "craft-dpx" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=bc3e521bd37e53f2b5b4c55278111b55fd9a40f9#bc3e521bd37e53f2b5b4c55278111b55fd9a40f9" dependencies = [ "thiserror 2.0.21", ] @@ -1119,7 +1119,7 @@ dependencies = [ [[package]] name = "craft-ecproj-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=bc3e521bd37e53f2b5b4c55278111b55fd9a40f9#bc3e521bd37e53f2b5b4c55278111b55fd9a40f9" dependencies = [ "serde", "serde_json", @@ -1129,30 +1129,34 @@ dependencies = [ [[package]] name = "craft-eps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=bc3e521bd37e53f2b5b4c55278111b55fd9a40f9#bc3e521bd37e53f2b5b4c55278111b55fd9a40f9" [[package]] name = "craft-exr" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=bc3e521bd37e53f2b5b4c55278111b55fd9a40f9#bc3e521bd37e53f2b5b4c55278111b55fd9a40f9" dependencies = [ + "exr", + "flate2", + "half", "serde_json", + "thiserror 2.0.21", ] [[package]] name = "craft-fonts-build" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=bc3e521bd37e53f2b5b4c55278111b55fd9a40f9#bc3e521bd37e53f2b5b4c55278111b55fd9a40f9" [[package]] name = "craft-gif" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=bc3e521bd37e53f2b5b4c55278111b55fd9a40f9#bc3e521bd37e53f2b5b4c55278111b55fd9a40f9" [[package]] name = "craft-i18n" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=bc3e521bd37e53f2b5b4c55278111b55fd9a40f9#bc3e521bd37e53f2b5b4c55278111b55fd9a40f9" dependencies = [ "fixed_decimal", "icu_decimal", @@ -1175,8 +1179,9 @@ dependencies = [ [[package]] name = "craft-lottie" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=bc3e521bd37e53f2b5b4c55278111b55fd9a40f9#bc3e521bd37e53f2b5b4c55278111b55fd9a40f9" dependencies = [ + "craft-zip", "serde_json", "thiserror 2.0.21", ] @@ -1184,7 +1189,7 @@ dependencies = [ [[package]] name = "craft-media" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=bc3e521bd37e53f2b5b4c55278111b55fd9a40f9#bc3e521bd37e53f2b5b4c55278111b55fd9a40f9" dependencies = [ "thiserror 2.0.21", ] @@ -1200,7 +1205,7 @@ dependencies = [ [[package]] name = "craft-mesh" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=bc3e521bd37e53f2b5b4c55278111b55fd9a40f9#bc3e521bd37e53f2b5b4c55278111b55fd9a40f9" dependencies = [ "miniz_oxide 0.9.1", "serde_json", @@ -1209,7 +1214,7 @@ dependencies = [ [[package]] name = "craft-pdf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=bc3e521bd37e53f2b5b4c55278111b55fd9a40f9#bc3e521bd37e53f2b5b4c55278111b55fd9a40f9" dependencies = [ "hayro-syntax", "thiserror 2.0.21", @@ -1218,7 +1223,7 @@ dependencies = [ [[package]] name = "craft-psd" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=bc3e521bd37e53f2b5b4c55278111b55fd9a40f9#bc3e521bd37e53f2b5b4c55278111b55fd9a40f9" dependencies = [ "encoding_rs", "flate2", @@ -1229,7 +1234,7 @@ dependencies = [ [[package]] name = "craft-quit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=bc3e521bd37e53f2b5b4c55278111b55fd9a40f9#bc3e521bd37e53f2b5b4c55278111b55fd9a40f9" dependencies = [ "dispatch2", "egui", @@ -1240,19 +1245,21 @@ dependencies = [ [[package]] name = "craft-svg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=bc3e521bd37e53f2b5b4c55278111b55fd9a40f9#bc3e521bd37e53f2b5b4c55278111b55fd9a40f9" dependencies = [ "craft-xml", "flate2", "kurbo", "roxmltree", "thiserror 2.0.21", + "vectorcraft-geom", + "vectorcraft-pathops", ] [[package]] name = "craft-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=bc3e521bd37e53f2b5b4c55278111b55fd9a40f9#bc3e521bd37e53f2b5b4c55278111b55fd9a40f9" dependencies = [ "craft-fonts-build", "craft-i18n", @@ -1273,7 +1280,7 @@ dependencies = [ [[package]] name = "craft-update" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=bc3e521bd37e53f2b5b4c55278111b55fd9a40f9#bc3e521bd37e53f2b5b4c55278111b55fd9a40f9" dependencies = [ "chrono", "dunce", @@ -1300,9 +1307,9 @@ dependencies = [ [[package]] name = "craft-video" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=bc3e521bd37e53f2b5b4c55278111b55fd9a40f9#bc3e521bd37e53f2b5b4c55278111b55fd9a40f9" dependencies = [ - "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9)", + "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=bc3e521bd37e53f2b5b4c55278111b55fd9a40f9)", "rayon", "thiserror 2.0.21", ] @@ -1310,7 +1317,7 @@ dependencies = [ [[package]] name = "craft-webp" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=bc3e521bd37e53f2b5b4c55278111b55fd9a40f9#bc3e521bd37e53f2b5b4c55278111b55fd9a40f9" dependencies = [ "thiserror 2.0.21", ] @@ -1318,12 +1325,22 @@ dependencies = [ [[package]] name = "craft-xml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=bc3e521bd37e53f2b5b4c55278111b55fd9a40f9#bc3e521bd37e53f2b5b4c55278111b55fd9a40f9" dependencies = [ "quick-xml 0.41.0", "thiserror 2.0.21", ] +[[package]] +name = "craft-zip" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=bc3e521bd37e53f2b5b4c55278111b55fd9a40f9#bc3e521bd37e53f2b5b4c55278111b55fd9a40f9" +dependencies = [ + "flate2", + "thiserror 2.0.21", + "zip 9.1.3", +] + [[package]] name = "crc32fast" version = "1.5.2" @@ -1683,7 +1700,7 @@ name = "effectcraft-export" version = "0.24.1" dependencies = [ "craft-audio", - "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9)", + "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=bc3e521bd37e53f2b5b4c55278111b55fd9a40f9)", "craft-video", "effectcraft-color", "effectcraft-effects", @@ -1852,7 +1869,7 @@ dependencies = [ "craft-dpx", "craft-exr", "craft-gif", - "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9)", + "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=bc3e521bd37e53f2b5b4c55278111b55fd9a40f9)", "craft-webp", "effectcraft-color", "effectcraft-effects", @@ -3422,7 +3439,7 @@ checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a" [[package]] name = "hayro-jbig2" version = "0.3.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=bc3e521bd37e53f2b5b4c55278111b55fd9a40f9#bc3e521bd37e53f2b5b4c55278111b55fd9a40f9" dependencies = [ "hayro-ccitt", ] @@ -3436,7 +3453,7 @@ checksum = "c75ab947623ef4ccaa7acf0579edf7cbb5a73838e3839a7be73335e522f433a1" [[package]] name = "hayro-syntax" version = "0.7.2" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=bc3e521bd37e53f2b5b4c55278111b55fd9a40f9#bc3e521bd37e53f2b5b4c55278111b55fd9a40f9" dependencies = [ "hayro-jbig2", "hayro-jpeg2000", @@ -6683,6 +6700,27 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "vectorcraft-geom" +version = "0.18.0" +source = "git+https://github.com/storytold/vectorcraft.git?rev=6b3a6b8788ebcb420d69449199cbdf323888d27e#6b3a6b8788ebcb420d69449199cbdf323888d27e" +dependencies = [ + "kurbo", + "serde", + "thiserror 2.0.21", +] + +[[package]] +name = "vectorcraft-pathops" +version = "0.18.0" +source = "git+https://github.com/storytold/vectorcraft.git?rev=6b3a6b8788ebcb420d69449199cbdf323888d27e#6b3a6b8788ebcb420d69449199cbdf323888d27e" +dependencies = [ + "kurbo", + "linesweeper", + "thiserror 2.0.21", + "vectorcraft-geom", +] + [[package]] name = "vello_common" version = "0.2.0" diff --git a/Cargo.toml b/Cargo.toml index 1b80048f2..83af23a17 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,22 +11,22 @@ rust-version = "1.95" repository = "https://github.com/storytold/effectcraft" [workspace.dependencies] -craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9", version = "=0.1.0", default-features = false, features = ["read"] } -craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } -craft-quit = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } -craft-ecproj-format = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } -craft-dpx = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } -craft-eps = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } -craft-exr = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } -craft-gif = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } -craft-psd = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } -craft-svg = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } -craft-webp = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } -craft-lottie = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } -craft-mesh = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9", default-features = false, features = ["stl", "obj", "gltf", "fbx"] } -craft-aep = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } +craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "bc3e521bd37e53f2b5b4c55278111b55fd9a40f9", version = "=0.1.0", default-features = false, features = ["read"] } +craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "bc3e521bd37e53f2b5b4c55278111b55fd9a40f9" } +craft-quit = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "bc3e521bd37e53f2b5b4c55278111b55fd9a40f9" } +craft-ecproj-format = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "bc3e521bd37e53f2b5b4c55278111b55fd9a40f9" } +craft-dpx = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "bc3e521bd37e53f2b5b4c55278111b55fd9a40f9" } +craft-eps = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "bc3e521bd37e53f2b5b4c55278111b55fd9a40f9" } +craft-exr = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "bc3e521bd37e53f2b5b4c55278111b55fd9a40f9", features = ["decode"] } +craft-gif = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "bc3e521bd37e53f2b5b4c55278111b55fd9a40f9" } +craft-psd = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "bc3e521bd37e53f2b5b4c55278111b55fd9a40f9" } +craft-svg = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "bc3e521bd37e53f2b5b4c55278111b55fd9a40f9" } +craft-webp = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "bc3e521bd37e53f2b5b4c55278111b55fd9a40f9" } +craft-lottie = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "bc3e521bd37e53f2b5b4c55278111b55fd9a40f9" } +craft-mesh = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "bc3e521bd37e53f2b5b4c55278111b55fd9a40f9", default-features = false, features = ["stl", "obj", "gltf", "fbx"] } +craft-aep = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "bc3e521bd37e53f2b5b4c55278111b55fd9a40f9" } # craft-update: app-specific pretend versions apply to startup and manual checks. -craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "47107f660191de2f0b425569506f4daa4faadac9", features = ["egui"] } +craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "bc3e521bd37e53f2b5b4c55278111b55fd9a40f9", features = ["egui"] } # internal effectcraft-time = { path = "crates/time" } effectcraft-geom = { path = "crates/geom" } @@ -90,9 +90,9 @@ same-file = "1.0" tempfile = "3.27" # codecs + containers shared by the Craft apps (crates/media, crates/export); keep all three on one rev. -craft-media = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9", default-features = false, features = ["isobmff", "matroska"] } -craft-audio = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9", default-features = false, features = ["aac-decode", "aac-encode", "opus-decode"] } -craft-video = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9", features = ["h264-encode", "prores", "hevc-encode", "vp9-encode", "av1", "threads"] } +craft-media = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "bc3e521bd37e53f2b5b4c55278111b55fd9a40f9", default-features = false, features = ["isobmff", "matroska"] } +craft-audio = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "bc3e521bd37e53f2b5b4c55278111b55fd9a40f9", default-features = false, features = ["aac-decode", "aac-encode", "opus-decode"] } +craft-video = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "bc3e521bd37e53f2b5b4c55278111b55fd9a40f9", features = ["h264-encode", "prores", "hevc-encode", "vp9-encode", "av1", "threads"] } # footage decoding: FilmCraft's pure-Rust crates, pinned to a revision (plan/adr/0001). # Only `crates/media`, `crates/export` and `crates/interchange` may depend on these. @@ -122,7 +122,7 @@ half = "2.7" # ui # Shared frontend components; keep this dependency above the engine boundary. # Shared UI and the complete egui family select reviewed immutable commits below. -craft-ui = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9", features = ["serde"] } +craft-ui = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "bc3e521bd37e53f2b5b4c55278111b55fd9a40f9", features = ["serde"] } # `default_fonts` and `monochrome_emoji_fonts` are explicit: the app's `FontDefinitions::default()` # and its `✔`/`▣` chrome glyphs need both, and kittest's own dev-dependencies do not propagate. egui = { version = "0.37", default-features = false, features = ["default_fonts", "monochrome_emoji_fonts"] } @@ -231,8 +231,8 @@ lto = "thin" codegen-units = 1 [patch.crates-io] -hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9", version = "=0.7.2" } -hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9", version = "=0.3.0" } +hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "bc3e521bd37e53f2b5b4c55278111b55fd9a40f9", version = "=0.7.2" } +hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "bc3e521bd37e53f2b5b4c55278111b55fd9a40f9", version = "=0.3.0" } ecolor = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } emath = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } epaint = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } diff --git a/crates/media/Cargo.toml b/crates/media/Cargo.toml index f744c684c..05e05b09c 100644 --- a/crates/media/Cargo.toml +++ b/crates/media/Cargo.toml @@ -32,7 +32,6 @@ filmcraft-mpegts = { workspace = true } filmcraft-frame = { workspace = true } filmcraft-color = { workspace = true } filmcraft-time = { workspace = true } -exr = { workspace = true } image = { workspace = true, features = ["gif", "webp", "tiff", "bmp", "exr", "tga", "hdr"] } rayon = { workspace = true } serde_json = { workspace = true } @@ -40,6 +39,7 @@ thiserror = { workspace = true } log = { workspace = true } [dev-dependencies] +exr = { workspace = true } # Writes the animated GIFs of the tests. gif = { workspace = true } tempfile = { workspace = true } diff --git a/crates/media/src/exr_channels.rs b/crates/media/src/exr_channels.rs index 96b0173cd..ee3cc3ed3 100644 --- a/crates/media/src/exr_channels.rs +++ b/crates/media/src/exr_channels.rs @@ -1,5 +1,5 @@ //! Auxiliary channels from multi-layer OpenEXR files (depth, object / material IDs, normals, -//! Cryptomatte, …) for the 3D Channel effects, read with the pure-Rust `exr` crate. +//! Cryptomatte, …) for the 3D Channel effects, read through the shared `craft-exr` decoder. //! //! Every channel of every layer becomes a plane named `layer.channel` (or just `channel` for //! the unnamed layer), placed in the display window (pixels outside a layer's data window are @@ -18,12 +18,6 @@ use std::sync::{Arc, Mutex, OnceLock, PoisonError}; use effectcraft_raster::channels3d::{BACKGROUND_DEPTH, split_channel}; use effectcraft_raster::{AuxChannels, Image}; use effectcraft_render::reads::{ReadFile, ReadFiles}; -use exr::block::UncompressedBlock; -use exr::block::chunk::TileCoordinates; -use exr::image::read::image::ReadImage; -use exr::image::read::layers::{ChannelsReader, ReadAllLayers, ReadChannels}; -use exr::meta::attribute::SampleType; -use exr::meta::header::Header; use crate::convert::{AlphaOp, float_to_image}; @@ -35,179 +29,20 @@ const MAX_DISPLAY_PIXELS: usize = 1 << 28; use craft_exr::channels::{is_depth, part_channel_name as channel_name}; pub use craft_exr::cryptomatte::parse_manifest; -/// The part name channels are prefixed with (`None`: unnamed). -fn part_name(header: &Header) -> Option { - header.own_attributes.layer_name.as_ref().map(|t| t.to_string()).filter(|s| !s.is_empty()) -} - /// Why an OpenEXR file's pixels can't be decoded when its headers name a compression this build /// can't decompress (HTJ2K, OpenEXR 3.4's High-Throughput JPEG 2000): the decoders only said /// "no non-deep rgb channels" or showed a transparent frame (#482). `None` for other files. pub fn unsupported_compression(bytes: &[u8]) -> Option<&'static str> { - use exr::compression::Compression; - let meta = exr::meta::MetaData::read_from_buffered(std::io::Cursor::new(bytes), false).ok()?; - meta.headers + let mut limits = craft_exr::decode::Limits::default(); + limits.max_pixels = u64::MAX; + limits.max_bytes = u64::MAX; + craft_exr::decode::parts(bytes, &limits) + .ok()? .iter() - .any(|h| matches!(h.compression, Compression::HTJ2K32 | Compression::HTJ2K256)) + .any(|part| matches!(part.compression.as_str(), "HTJ2K32" | "HTJ2K256")) .then_some("OpenEXR HTJ2K compression isn't supported yet: re-save the file with ZIP, PIZ or DWAA compression") } -/// Which channels a decode keeps, by plane name, and the display window they are placed in -/// (the first part's, as the `exr` crate reports the image's). -struct Planes<'k> { - keep: &'k dyn Fn(&str) -> bool, - display: exr::meta::attribute::IntegerBounds, -} - -/// One part's kept channels while it is decoded: each line of samples goes straight into its -/// channel's display-window plane (no copy of the part's samples in their own type first). -struct PlanesReader { - /// Per channel of the part: its plane name, sample type and plane (`None`: not kept). - planes: Vec)>>, - /// The data window's position in the display window, and the data window's and display - /// window's sizes. - offset: (i64, i64), - layer: (usize, usize), - display: (usize, usize), - f16s: Vec, - u32s: Vec, - f32s: Vec, - /// The part's channel indices of exact `R`, `G`, `B` and `A`, when it has R, G and B. - rgb: Option<([usize; 3], Option)>, - /// The part's display window differs from the first part's. - own_display: bool, -} - -/// A decoded part: its kept planes (in channel order) and what [`PlanesReader`] found. -struct PartPlanes { - planes: Vec<(String, Vec)>, - /// Positions in `planes` of the part's R, G, B (and A) channels, when it has them and keeps - /// them all. - rgb: Option<([usize; 3], Option)>, - has_rgb: bool, - exact: bool, -} - -impl<'s> ReadChannels<'s> for Planes<'_> { - type Reader = PlanesReader; - - fn create_channels_reader(&'s self, header: &Header) -> exr::error::Result { - if header.deep { - return Err(exr::error::Error::NotSupported("deep data".into())); - } - let dw = self.display; - let display = (dw.size.0, dw.size.1); - // Each channel is a display-window plane: a 60000² window over a 1×1 data window was a - // multi-gigabyte allocation per channel (#2141). - let n = display.0.checked_mul(display.1).filter(|n| *n > 0 && *n <= MAX_DISPLAY_PIXELS).ok_or(exr::error::Error::Invalid("display window".into()))?; - let prefix = part_name(header); - let pos = header.own_attributes.layer_position; - let offset = (i64::from(pos.0) - i64::from(dw.position.0), i64::from(pos.1) - i64::from(dw.position.1)); - let planes = header - .channels - .list - .iter() - .map(|ch| { - let name = channel_name(prefix.as_deref(), &ch.name.to_string()); - let fill = if is_depth(&name) { BACKGROUND_DEPTH } else { 0.0 }; - (self.keep)(&name).then(|| (name, ch.sample_type, vec![fill; n])) - }) - .collect(); - let find = |c: &str| header.channels.find_index_of_channel(&exr::meta::attribute::Text::from(c)); - let rgb = match (find("R"), find("G"), find("B")) { - (Some(r), Some(g), Some(b)) => Some(([r, g, b], find("A"))), - _ => None, - }; - Ok(PlanesReader { - planes, - offset, - layer: (header.layer_size.0, header.layer_size.1), - display, - f16s: vec![], - u32s: vec![], - f32s: vec![], - rgb, - own_display: header.shared_attributes.display_window != dw, - }) - } -} - -impl ChannelsReader for PlanesReader { - type Channels = PartPlanes; - - fn filter_block(&self, tile: TileCoordinates) -> bool { - tile.is_largest_resolution_level() && self.planes.iter().any(Option::is_some) - } - - fn read_block(&mut self, header: &Header, block: UncompressedBlock) -> exr::error::UnitResult { - let ((lw, lh), (w, h)) = (self.layer, self.display); - for line in block.lines(&header.channels) { - let Some(Some((_, kind, plane))) = self.planes.get_mut(line.location.channel) else { continue }; - let (x0, y, count) = (line.location.position.0, line.location.position.1, line.location.sample_count); - // The samples of data-window row `y`, columns `x0..x0 + count`, at display row `ty` - // from display column `tx0`; clipped to the display window. - if y >= lh || x0.checked_add(count).is_none_or(|end| end > lw) { - continue; - } - let Some(ty) = usize::try_from(y as i64 + self.offset.1).ok().filter(|ty| *ty < h) else { continue }; - let tx0 = x0 as i64 + self.offset.0; - let skip = usize::try_from(-tx0).unwrap_or(0).min(count); - let tx = usize::try_from(tx0.max(0)).unwrap_or(usize::MAX); - let take = (count - skip).min(w.saturating_sub(tx)); - let start = ty.checked_mul(w).and_then(|row| row.checked_add(tx)); - let Some(dst) = start.filter(|_| take > 0).and_then(|s| plane.get_mut(s..s.checked_add(take)?)) else { continue }; - match kind { - SampleType::F16 => { - self.f16s.resize(count, exr::prelude::f16::ZERO); - line.read_samples_into_slice(&mut self.f16s)?; - for (d, s) in dst.iter_mut().zip(self.f16s.iter().skip(skip)) { - *d = s.to_f32(); - } - } - SampleType::F32 => { - self.f32s.resize(count, 0.0); - line.read_samples_into_slice(&mut self.f32s)?; - for (d, s) in dst.iter_mut().zip(self.f32s.iter().skip(skip)) { - *d = *s; - } - } - SampleType::U32 => { - self.u32s.resize(count, 0); - line.read_samples_into_slice(&mut self.u32s)?; - for (d, s) in dst.iter_mut().zip(self.u32s.iter().skip(skip)) { - *d = *s as f32; - } - } - } - } - Ok(()) - } - - fn into_channels(self) -> PartPlanes { - // Positions of the kept channels among the kept planes. - let mut at = vec![None; self.planes.len()]; - let mut planes = Vec::with_capacity(self.planes.len()); - for (i, p) in self.planes.into_iter().enumerate() { - if let Some((name, _, data)) = p { - if let Some(slot) = at.get_mut(i) { - *slot = Some(planes.len()); - } - planes.push((name, data)); - } - } - let kept = |i: usize| at.get(i).copied().flatten(); - let has_rgb = self.rgb.is_some(); - let rgb = self.rgb.and_then(|([r, g, b], a)| { - let a = match a { - Some(a) => Some(kept(a)?), - None => None, - }; - Some(([kept(r)?, kept(g)?, kept(b)?], a)) - }); - PartPlanes { planes, rgb, has_rgb, exact: !self.own_display } - } -} - /// How the `image` crate's OpenEXR decoder would show a file: the first part with exact `R`, `G` /// and `B` channels (alpha `A` when it has one, else opaque), placed in the display window with /// 0 outside the data window. @@ -253,73 +88,103 @@ enum Refused { TooLarge(String), } -/// Bytes the planes of the channels `keep` names would take (`None`: not a readable header). -fn planes_bytes(meta: &exr::meta::MetaData, keep: &dyn Fn(&str) -> bool) -> Option { - let dw = meta.headers.first()?.shared_attributes.display_window; - let n = dw.size.0.checked_mul(dw.size.1)?; - let mut kept = 0usize; - for header in meta.headers.iter() { - let prefix = part_name(header); - kept = kept.saturating_add(header.channels.list.iter().filter(|ch| keep(&channel_name(prefix.as_deref(), &ch.name.to_string()))).count()); - } - Some(n.saturating_mul(kept).saturating_mul(std::mem::size_of::())) +/// Bytes the selected channels occupy in the first part's display window. The channel cache +/// reserves this before decoding so concurrent imports cannot exceed its soft budget. +fn planes_bytes(infos: &[craft_exr::decode::PartInfo], keep: &dyn Fn(&str) -> bool) -> Option { + let display = infos.first()?.display_window; + let pixels = u64::from(display.width).checked_mul(u64::from(display.height))?; + let selected = infos.iter().try_fold(0u64, |total, part| { + let count = part.channels.iter().filter(|channel| keep(&channel_name(part.name.as_deref(), &channel.name))).count() as u64; + total.checked_add(count) + })?; + usize::try_from(pixels.checked_mul(selected)?.checked_mul(4)?).ok() } -/// Decode the channels of an EXR file's bytes that `keep` names (by plane name). +/// Decode selected EXR channels through craft-exr, which places each selected block directly +/// into its bounded display-window plane. fn decode(bytes: &[u8], keep: &dyn Fn(&str) -> bool) -> Result { - let meta = exr::meta::MetaData::read_from_buffered(std::io::Cursor::new(bytes), false).map_err(|_| Refused::Unreadable)?; - let display = meta.headers.first().ok_or(Refused::Unreadable)?.shared_attributes.display_window; - let need = planes_bytes(&meta, keep).ok_or(Refused::Unreadable)?; - if need > MAX_DECODE_BYTES { - let gb = |b: usize| b as f64 / f64::from(1u32 << 30); + use craft_exr::decode::{self, Error as ExrError, Limits}; + + let mut limits = Limits::default(); + limits.max_pixels = MAX_DISPLAY_PIXELS as u64; + limits.max_bytes = MAX_DECODE_BYTES as u64; + // Header-only checks must not charge channels this caller does not decode. The shared display + // decoder independently checks the exact selected display planes before allocating them. + let mut header_limits = limits; + header_limits.max_width = u32::MAX; + header_limits.max_height = u32::MAX; + header_limits.max_pixels = u64::MAX; + header_limits.max_bytes = u64::MAX; + let infos = decode::parts(bytes, &header_limits).map_err(|e| match e { + ExrError::LimitExceeded(message) => Refused::TooLarge(message), + _ => Refused::Unreadable, + })?; + let display = infos.first().ok_or(Refused::Unreadable)?.display_window; + let needed = planes_bytes(&infos, keep).filter(|bytes| *bytes > 0).ok_or(Refused::Unreadable)?; + if needed > MAX_DECODE_BYTES { + let gb = |b: u64| b as f64 / f64::from(1u32 << 30); return Err(Refused::TooLarge(format!( "its {}×{} OpenEXR channels need {:.1} GB of memory, more than the {:.1} GB one file may use", - display.size.0, - display.size.1, - gb(need), - gb(MAX_DECODE_BYTES) + display.width, + display.height, + gb(needed as u64), + gb(MAX_DECODE_BYTES as u64), ))); } - let read = ReadImage::new(ReadAllLayers { read_channels: Planes { keep, display } }, |_| {}); - let img = read.from_buffered(std::io::Cursor::new(bytes)).map_err(|_| Refused::Unreadable)?; - let dw = img.attributes.display_window; - let mut aux = AuxChannels::new(dw.size.0 as u32, dw.size.1 as u32, 1.0); + + let mut aux = AuxChannels::new(display.width, display.height, 1.0); let mut crypto: HashMap, Option)> = HashMap::new(); - let mut collect_meta = |other: &HashMap| { - for (k, v) in other { - let key = k.to_string(); + let mut rgb = Rgb::None; + for info in infos { + for (key, value) in &info.text_attributes { let Some(rest) = key.strip_prefix("cryptomatte/") else { continue }; let Some((id, field)) = rest.split_once('/') else { continue }; - let exr::meta::attribute::AttributeValue::Text(t) = v else { continue }; - let e = crypto.entry(id.to_string()).or_default(); + let entry = crypto.entry(id.to_string()).or_default(); match field { - "name" => e.0 = Some(t.to_string()), - "manifest" => e.1 = Some(t.to_string()), + "name" => entry.0 = Some(value.clone()), + "manifest" => entry.1 = Some(value.clone()), _ => {} } } - }; - collect_meta(&img.attributes.other); - let mut rgb = Rgb::None; - for layer in img.layer_data { - collect_meta(&layer.attributes.other); - let part = layer.channel_data; - if rgb == Rgb::None && part.has_rgb { + let prefix = info.name.as_deref(); + let exact = info.display_window == display; + let rgb_indices = ["R", "G", "B"].map(|wanted| info.channels.iter().position(|channel| channel.name == wanted)); + let has_rgb = rgb_indices.iter().all(Option::is_some); + let alpha_index = info.channels.iter().position(|channel| channel.name == "A"); + let mut part = decode::decode_display_part( + bytes, + info.index, + keep, + &|name| { + if is_depth(name) { BACKGROUND_DEPTH } else { 0.0 } + }, + &limits, + ) + .map_err(|error| match error { + ExrError::LimitExceeded(message) => Refused::TooLarge(message), + _ => Refused::Unreadable, + })?; + if rgb == Rgb::None && has_rgb { let base = aux.channels.len(); - rgb = match part.rgb { - Some(([r, g, b], a)) if part.exact => { - let picked = [Some(r), Some(g), Some(b), a]; - let depth = picked.iter().flatten().any(|i| part.planes.get(*i).is_some_and(|(n, _)| is_depth(n))); - if depth { Rgb::Unsupported } else { Rgb::Planes([base + r, base + g, base + b], a.map(|a| base + a)) } + let locate = |raw: usize| { + let name = channel_name(prefix, &info.channels.get(raw)?.name); + part.channels.iter().position(|channel| channel.name == name) + }; + rgb = match (rgb_indices[0].and_then(locate), rgb_indices[1].and_then(locate), rgb_indices[2].and_then(locate)) { + (Some(r), Some(g), Some(b)) if exact => { + let a = alpha_index.and_then(locate); + let depth = + [Some(r), Some(g), Some(b), a].into_iter().flatten().any(|i| part.channels.get(i).is_some_and(|channel| is_depth(&channel.name))); + if depth { Rgb::Unsupported } else { Rgb::Planes([base + r, base + g, base + b], a.map(|i| base + i)) } } _ => Rgb::Unsupported, }; } - aux.channels.extend(part.planes); + aux.channels.extend(part.channels.drain(..).map(|channel| (channel.name, channel.samples))); } for (_, (name, manifest)) in crypto { - if let (Some(n), Some(m)) = (name, manifest) { - aux.manifests.push((n, parse_manifest(&m))); + if let (Some(name), Some(manifest)) = (name, manifest) { + aux.manifests.push((name, parse_manifest(&manifest))); } } aux.manifests.sort(); @@ -389,11 +254,16 @@ fn picture_names(aux: &AuxChannels) -> Option<([String; 3], Option)> { /// headers, then only those channels decoded; in a multi-part file the other parts' pixels are /// not even decompressed), with the names of its planes. fn picture_only(bytes: &[u8]) -> Result<(Decoded, [String; 3], Option), Refused> { - let meta = exr::meta::MetaData::read_from_buffered(std::io::Cursor::new(bytes), false).map_err(|_| Refused::Unreadable)?; + let mut limits = craft_exr::decode::Limits::default(); + limits.max_width = u32::MAX; + limits.max_height = u32::MAX; + limits.max_pixels = u64::MAX; + limits.max_bytes = u64::MAX; + let meta = craft_exr::decode::parts(bytes, &limits).map_err(|_| Refused::Unreadable)?; let mut names = AuxChannels::new(0, 0, 1.0); - for header in meta.headers.iter() { - let prefix = part_name(header); - names.channels.extend(header.channels.list.iter().map(|ch| (channel_name(prefix.as_deref(), &ch.name.to_string()), vec![]))); + for part in meta { + let prefix = part.name.as_deref(); + names.channels.extend(part.channels.iter().map(|ch| (channel_name(prefix, &ch.name), vec![]))); } let (rgb, a) = picture_names(&names).ok_or(Refused::Unreadable)?; // Planes are looked up by name ignoring case, so every channel that could answer is kept. @@ -672,8 +542,13 @@ impl ChannelCache { /// Decode the file at `path` whose bytes are `bytes` for `slot` (see [`ChannelCache::get`]). fn decode_file(&self, path: &str, slot: &Slot, bytes: &[u8]) -> Option> { // The planes it will allocate count against the budget while it decodes. - if let Ok(meta) = exr::meta::MetaData::read_from_buffered(std::io::Cursor::new(bytes), false) - && let Some(need) = planes_bytes(&meta, &|_| true) + let mut limits = craft_exr::decode::Limits::default(); + limits.max_width = u32::MAX; + limits.max_height = u32::MAX; + limits.max_pixels = u64::MAX; + limits.max_bytes = u64::MAX; + if let Ok(infos) = craft_exr::decode::parts(bytes, &limits) + && let Some(need) = planes_bytes(&infos, &|_| true) { self.account(slot, need.min(MAX_DECODE_BYTES)); } @@ -1242,6 +1117,50 @@ mod tests { assert!(aux.get("ViewLayer.Combined.R").is_some()); } + #[test] + fn multipart_fallback_filters_channels_and_reserves_display_planes() { + use exr::prelude::*; + let part = |name: &str, pos: (i32, i32), size: (usize, usize), channels: Vec>| { + let attrs = LayerAttributes { layer_name: Some(Text::from(name)), layer_position: Vec2(pos.0, pos.1), ..Default::default() }; + Layer::new(size, attrs, Encoding::FAST_LOSSLESS, AnyChannels::sort(channels.into())) + }; + let (w, h) = (2usize, 1usize); + let bytes = file( + vec![ + part("Depth", (0, 0), (1, 1), vec![AnyChannel::new("Z", FlatSamples::F32(vec![7.0]))]), + part( + "Beauty", + (1, 1), + (w, h), + vec![ + AnyChannel::new("R", FlatSamples::F32(vec![0.1; w * h])), + AnyChannel::new("G", FlatSamples::F32(vec![0.2; w * h])), + AnyChannel::new("B", FlatSamples::F32(vec![0.3; w * h])), + ], + ), + ], + IntegerBounds::from_dimensions((3, 2)), + ); + let mut limits = craft_exr::decode::Limits::default(); + limits.max_width = u32::MAX; + limits.max_height = u32::MAX; + limits.max_pixels = u64::MAX; + limits.max_bytes = u64::MAX; + let parts = craft_exr::decode::parts(&bytes, &limits).unwrap(); + assert_eq!(planes_bytes(&parts, &|name| name == "Beauty.R"), Some(3 * 2 * 4)); + assert_eq!(planes_bytes(&parts, &|_| false), Some(0)); + + let selected = decode(&bytes, &|name| name == "Beauty.R").unwrap(); + assert_eq!(selected.aux.channels.iter().map(|(name, _)| name.as_str()).collect::>(), ["Beauty.R"]); + assert_eq!(selected.aux.get("Beauty.R").unwrap(), [0.0, 0.0, 0.0, 0.0, 0.1, 0.1]); + + // The old app decoder selected the named beauty part when the first part was depth-only, + // and placed its data into the shared display window; retain that layered-picture result. + let image = layered_image(&bytes).unwrap().to_rgba32f(); + assert_eq!(image.get_pixel(1, 1).0, [0.1, 0.2, 0.3, 1.0]); + assert_eq!(image.get_pixel(0, 0).0, [0.0, 0.0, 0.0, 1.0]); + } + /// Straight RGBA of [`layered_image`] at pixel 0 for a file of single-value channels. fn picture>(channels: &[(S, f32)]) -> Vec { use exr::prelude::*; diff --git a/xtask/src/pdf_deps.rs b/xtask/src/pdf_deps.rs index a4ed9d6dd..d16ba14ee 100644 --- a/xtask/src/pdf_deps.rs +++ b/xtask/src/pdf_deps.rs @@ -5,7 +5,7 @@ use std::process::Command; use serde_json::Value; -const REV: &str = "47107f660191de2f0b425569506f4daa4faadac9"; +const REV: &str = "bc3e521bd37e53f2b5b4c55278111b55fd9a40f9"; const PACKAGES: &[(&str, &str)] = &[("craft-pdf", "0.1.0"), ("hayro-syntax", "0.7.2"), ("hayro-jbig2", "0.3.0")]; pub fn run(root: &Path) -> Result<(), String> { From b68249c47b37b048b9de90aeb21a8acea50579da Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 13 Nov 2026 17:18:13 +0000 Subject: [PATCH 05/12] test(lottie): cover archive without animation --- crates/lottie/src/tests.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/crates/lottie/src/tests.rs b/crates/lottie/src/tests.rs index cf8543fdf..19f8a4c32 100644 --- a/crates/lottie/src/tests.rs +++ b/crates/lottie/src/tests.rs @@ -12,7 +12,7 @@ use effectcraft_render::render_frame; use effectcraft_time::{FrameRate, Tick}; use serde_json::{Value as Json, json}; -use crate::{ExportOptions, export_comp, import}; +use crate::{ExportOptions, LottieError, export_comp, import}; fn s(x: f64) -> Tick { Tick::from_seconds_f64(x) @@ -799,6 +799,14 @@ fn dotlottie_archive_roundtrip() { assert_eq!(q.comp(imp.comp).unwrap().layers.len(), 1); } +#[test] +fn dotlottie_archive_without_animation_is_rejected() { + let zip = craft_lottie::zip::try_store(&[("manifest.json".into(), b"{}".to_vec())]).unwrap(); + let mut project = Project::default(); + let err = import(&mut project, &zip, "empty archive", "", &mut |_| None).unwrap_err(); + assert!(matches!(err, LottieError::Parse(message) if message.contains("without a JSON animation"))); +} + #[test] fn deflated_dotlottie_archive_imports() { let (mut p, cid) = setup(); From f9ffd91a3b947f52a2d71b6254942d11aa06e924 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 13 Nov 2026 20:01:08 +0000 Subject: [PATCH 06/12] Run EffectCraft coverage tests in one shard --- .github/workflows/sonarcloud.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 8f1aa5ad5..7d193b610 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -20,5 +20,8 @@ jobs: uses: storytold/craft-common-actions/.github/workflows/sonarcloud.yml@main with: timeout-minutes: 120 + # GPU tests share a process-local lock; separate coverage shards create independent + # software Vulkan devices, bypassing that lock and potentially contending on llvmpipe. + shards: 1 fonts-ref: b076417b5880bd4154bd22f00695b1d28c6bea83 secrets: inherit From dd3c6e968da0920d36f2e5bb5aa35b30076c754c Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sat, 14 Nov 2026 20:00:53 +0000 Subject: [PATCH 07/12] test(ui): serialize GPU picker integration --- crates/ui-egui/tests/it/ui_crypto_pick.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/ui-egui/tests/it/ui_crypto_pick.rs b/crates/ui-egui/tests/it/ui_crypto_pick.rs index 03e49ca18..d863e73f7 100644 --- a/crates/ui-egui/tests/it/ui_crypto_pick.rs +++ b/crates/ui-egui/tests/it/ui_crypto_pick.rs @@ -632,6 +632,7 @@ fn clicks_wait_for_the_probe_and_edits_popups_dialogs_and_comp_switches_end_or_b /// each Resolution. Skips without a GPU adapter. #[test] fn picks_on_the_gpu_viewer() { + let _gpu = crate::gpu_test::lock(); let Some(probe) = effectcraft_gpu::Gpu::headless() else { eprintln!("no GPU adapter: skipping"); return; From 4e8cd4638b22221cfda8626e09804b9de16ffbb7 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sun, 15 Nov 2026 00:34:59 +0000 Subject: [PATCH 08/12] ci: serialize one-shard Sonar coverage tests --- .github/workflows/sonarcloud.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 7d193b610..1bc7c9f8b 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -17,11 +17,12 @@ concurrency: jobs: sonarcloud: # Track shared CI improvements on main. - uses: storytold/craft-common-actions/.github/workflows/sonarcloud.yml@main + uses: storytold/craft-common-actions/.github/workflows/sonarcloud.yml@72d2fbfb3dd1bf27e1bdc7107be72c70749c6876 with: timeout-minutes: 120 # GPU tests share a process-local lock; separate coverage shards create independent # software Vulkan devices, bypassing that lock and potentially contending on llvmpipe. shards: 1 + rust-test-threads: "1" fonts-ref: b076417b5880bd4154bd22f00695b1d28c6bea83 secrets: inherit From df79630f6f2e00d099c07def39b0230cb759e328 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sun, 15 Nov 2026 01:36:12 +0000 Subject: [PATCH 09/12] ci: use merged test thread limit for Sonar coverage --- .github/workflows/sonarcloud.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 1bc7c9f8b..6adc57765 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -17,7 +17,7 @@ concurrency: jobs: sonarcloud: # Track shared CI improvements on main. - uses: storytold/craft-common-actions/.github/workflows/sonarcloud.yml@72d2fbfb3dd1bf27e1bdc7107be72c70749c6876 + uses: storytold/craft-common-actions/.github/workflows/sonarcloud.yml@main with: timeout-minutes: 120 # GPU tests share a process-local lock; separate coverage shards create independent From 85903800ddbd9d1d4160b902e8b45f8060b39c4c Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sun, 15 Nov 2026 14:46:37 -0500 Subject: [PATCH 10/12] Account selected EXR planes per part and skip unused parts --- crates/media/src/exr_channels.rs | 42 +++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/crates/media/src/exr_channels.rs b/crates/media/src/exr_channels.rs index ebd77f855..13e3c9d93 100644 --- a/crates/media/src/exr_channels.rs +++ b/crates/media/src/exr_channels.rs @@ -88,16 +88,19 @@ enum Refused { TooLarge(String), } -/// Bytes the selected channels occupy in the first part's display window. The channel cache +/// Bytes the selected channels occupy in each part's own display window. The channel cache /// reserves this before decoding so concurrent imports cannot exceed its soft budget. fn planes_bytes(infos: &[craft_exr::decode::PartInfo], keep: &dyn Fn(&str) -> bool) -> Option { - let display = infos.first()?.display_window; - let pixels = u64::from(display.width).checked_mul(u64::from(display.height))?; - let selected = infos.iter().try_fold(0u64, |total, part| { + infos.first()?; + let total = infos.iter().try_fold(0u64, |total, part| { let count = part.channels.iter().filter(|channel| keep(&channel_name(part.name.as_deref(), &channel.name))).count() as u64; - total.checked_add(count) + if count == 0 { + return Some(total); + } + let pixels = u64::from(part.display_window.width).checked_mul(u64::from(part.display_window.height))?; + total.checked_add(pixels.checked_mul(count)?.checked_mul(4)?) })?; - usize::try_from(pixels.checked_mul(selected)?.checked_mul(4)?).ok() + usize::try_from(total).ok() } /// Decode selected EXR channels through craft-exr, which places each selected block directly @@ -151,6 +154,14 @@ fn decode(bytes: &[u8], keep: &dyn Fn(&str) -> bool) -> Result let rgb_indices = ["R", "G", "B"].map(|wanted| info.channels.iter().position(|channel| channel.name == wanted)); let has_rgb = rgb_indices.iter().all(Option::is_some); let alpha_index = info.channels.iter().position(|channel| channel.name == "A"); + // Metadata above still belongs to the file, but an ignored part must not allocate or + // impose its pixel/deep-data limits on the selected picture channels. + if !info.channels.iter().any(|channel| keep(&channel_name(prefix, &channel.name))) { + if rgb == Rgb::None && has_rgb { + rgb = Rgb::Unsupported; + } + continue; + } let mut part = decode::decode_display_part( bytes, info.index, @@ -1172,6 +1183,25 @@ mod tests { assert_eq!(planes_bytes(&parts, &|name| name == "Beauty.R"), Some(3 * 2 * 4)); assert_eq!(planes_bytes(&parts, &|_| false), Some(0)); + // Different display windows must not reserve every part at the first part's size. + let mut varied = parts.clone(); + varied[0].display_window.width = 1; + varied[0].display_window.height = 1; + varied[1].display_window.width = 10; + varied[1].display_window.height = 20; + assert_eq!(planes_bytes(&varied, &|_| true), Some(4 + 10 * 20 * 3 * 4)); + assert_eq!(planes_bytes(&varied, &|name| name == "Beauty.R"), Some(10 * 20 * 4)); + varied[1].display_window.width = u32::MAX; + varied[1].display_window.height = u32::MAX; + assert_eq!(planes_bytes(&varied, &|_| true), None); + assert_eq!(planes_bytes(&varied, &|name| name == "Depth.Z"), Some(4)); + + // Skipping the RGB part preserves the first-RGB fallback state and depth samples. + let depth = decode(&bytes, &|name| name == "Depth.Z").unwrap(); + assert_eq!(depth.rgb, Rgb::Unsupported); + assert_eq!(depth.aux.channels.len(), 1); + assert_eq!(depth.aux.get("Depth.Z").unwrap()[0], 7.0); + let selected = decode(&bytes, &|name| name == "Beauty.R").unwrap(); assert_eq!(selected.aux.channels.iter().map(|(name, _)| name.as_str()).collect::>(), ["Beauty.R"]); assert_eq!(selected.aux.get("Beauty.R").unwrap(), [0.0, 0.0, 0.0, 0.0, 0.1, 0.1]); From 3b4f35eba40dda453fe0a980fa8ab63b0f29c1bb Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sun, 15 Nov 2026 22:13:24 -0500 Subject: [PATCH 11/12] Keep dotLottie cutover separate from coverage PR 3654 --- .github/workflows/sonarcloud.yml | 4 ---- crates/ui-egui/tests/it/ui_crypto_pick.rs | 1 - 2 files changed, 5 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 6adc57765..8f1aa5ad5 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -20,9 +20,5 @@ jobs: uses: storytold/craft-common-actions/.github/workflows/sonarcloud.yml@main with: timeout-minutes: 120 - # GPU tests share a process-local lock; separate coverage shards create independent - # software Vulkan devices, bypassing that lock and potentially contending on llvmpipe. - shards: 1 - rust-test-threads: "1" fonts-ref: b076417b5880bd4154bd22f00695b1d28c6bea83 secrets: inherit diff --git a/crates/ui-egui/tests/it/ui_crypto_pick.rs b/crates/ui-egui/tests/it/ui_crypto_pick.rs index c9ed63ef3..5aa923698 100644 --- a/crates/ui-egui/tests/it/ui_crypto_pick.rs +++ b/crates/ui-egui/tests/it/ui_crypto_pick.rs @@ -635,7 +635,6 @@ fn clicks_wait_for_the_probe_and_edits_popups_dialogs_and_comp_switches_end_or_b /// each Resolution. Skips without a GPU adapter. #[test] fn picks_on_the_gpu_viewer() { - let _gpu = crate::gpu_test::lock(); let Some(probe) = effectcraft_gpu::Gpu::headless() else { eprintln!("no GPU adapter: skipping"); return; From 234273d9b86cfd447b73732efd36698d092d2c0f Mon Sep 17 00:00:00 2001 From: FredApps <153173854+FredApps@users.noreply.github.com> Date: Mon, 16 Nov 2026 07:44:53 +0100 Subject: [PATCH 12/12] docs(exr): note the shared decoder's all-channel data-window bound --- crates/media/src/exr_channels.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/media/src/exr_channels.rs b/crates/media/src/exr_channels.rs index 13e3c9d93..3463cf663 100644 --- a/crates/media/src/exr_channels.rs +++ b/crates/media/src/exr_channels.rs @@ -112,7 +112,10 @@ fn decode(bytes: &[u8], keep: &dyn Fn(&str) -> bool) -> Result limits.max_pixels = MAX_DISPLAY_PIXELS as u64; limits.max_bytes = MAX_DECODE_BYTES as u64; // Header-only checks must not charge channels this caller does not decode. The shared display - // decoder independently checks the exact selected display planes before allocating them. + // decoder independently checks the exact selected display planes before allocating them. It + // also bounds a selected part's data window across all of its channels (decoded blocks carry + // every channel before the unused ones are dropped), so a part whose full channel set exceeds + // `max_bytes` is refused even when the kept planes alone would fit. let mut header_limits = limits; header_limits.max_width = u32::MAX; header_limits.max_height = u32::MAX;