diff --git a/ATTRIBUTION.md b/ATTRIBUTION.md index 2f78b6b5e..7043e6128 100644 --- a/ATTRIBUTION.md +++ b/ATTRIBUTION.md @@ -155,4 +155,10 @@ under [`docs/brand/LICENSE-brand.txt`](docs/brand/LICENSE-brand.txt). Forks and | `docs/brand/artcraft-mark.png` | ArtCraft Team | Original work: first-party ArtCraft brand mark (ArtCraft symbol ("A" mark), blue) | ArtCraft brand terms, not open source (`docs/brand/LICENSE-brand.txt`) | | `docs/brand/artcraft-mark.svg` | ArtCraft Team | Original work: first-party ArtCraft brand mark (ArtCraft symbol ("A" mark), blue) | ArtCraft brand terms, not open source (`docs/brand/LICENSE-brand.txt`) | -- Appearance theme previews, drawn procedurally from original shapes: `crates/ui-egui/src/panels/settings.rs` (original work, MIT OR Apache-2.0). +- Appearance theme previews, drawn procedurally from original shapes: `crates/ui-egui/src/panels/settings.rs` (original work, MIT OR Apache-2.0). + +## Synthetic test audio + +| Asset | Author | Source | Licence | +|---|---|---|---| +| `crates/media/tests/fixtures/pce61-ffmpeg.aac-fixture` | Dylan M. Taylor | Original sine waves; reproducible recipe in `crates/media/tests/fixtures/README.md` | MIT OR Apache-2.0 | diff --git a/Cargo.lock b/Cargo.lock index 50fb268df..326846f83 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -129,6 +129,15 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "aligned" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee4508988c62edf04abd8d92897fca0c2995d907ce1dfeaf369dac3716a40685" +dependencies = [ + "as-slice", +] + [[package]] name = "aligned-vec" version = "0.6.4" @@ -138,21 +147,6 @@ dependencies = [ "equator", ] -[[package]] -name = "alloc-no-stdlib" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2fb6cfd47bf496ff64095c20eaba0c201404ee38714d4142fcfa1dc334fcc7a" - -[[package]] -name = "alloc-stdlib" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b5c1865780388bfa186411ab5f247819487fc4864c6e9c3106611fa347586e1" -dependencies = [ - "alloc-no-stdlib", -] - [[package]] name = "allocator-api2" version = "0.2.21" @@ -215,6 +209,18 @@ dependencies = [ "libc", ] +[[package]] +name = "anyhow" +version = "1.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" + +[[package]] +name = "arbitrary" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bc62ac97cc33321f50863d514c3bc38a453947a8f9e781137e47c7401020aed" + [[package]] name = "arboard" version = "3.6.1" @@ -236,6 +242,17 @@ dependencies = [ "x11rb", ] +[[package]] +name = "arg_enum_proc_macro" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + [[package]] name = "arrayref" version = "0.3.9" @@ -257,6 +274,15 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b" +[[package]] +name = "as-slice" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "516b6b4f0e40d50dcda9365d53964ec74560ad4284da2e7fc97122cd83174516" +dependencies = [ + "stable_deref_trait", +] + [[package]] name = "ash" version = "0.38.0+1.3.281" @@ -446,6 +472,40 @@ version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" +[[package]] +name = "av-scenechange" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f321d77c20e19b92c39e7471cf986812cbb46659d2af674adc4331ef3f18394" +dependencies = [ + "aligned", + "anyhow", + "arg_enum_proc_macro", + "arrayvec", + "log", + "num-rational", + "num-traits", + "pastey 0.1.1", + "rayon", + "thiserror 2.0.21", + "v_frame", + "y4m", +] + +[[package]] +name = "av1-grain" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cfddb07216410377231960af4fcab838eaa12e013417781b78bd95ee22077f8" +dependencies = [ + "anyhow", + "arrayvec", + "log", + "nom", + "num-rational", + "v_frame", +] + [[package]] name = "base64" version = "0.23.1" @@ -504,6 +564,15 @@ version = "2.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" +[[package]] +name = "bitstream-io" +version = "4.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7eff00be299a18769011411c9def0d827e8f2d7bf0c3dbf53633147a8867fd1f" +dependencies = [ + "no_std_io2", +] + [[package]] name = "block-buffer" version = "0.10.4" @@ -555,7 +624,7 @@ dependencies = [ "boa_macros", "boa_string", "indexmap", - "num-bigint", + "num-bigint 0.5.1", "rustc-hash 2.1.3", "strum", ] @@ -589,13 +658,13 @@ dependencies = [ "icu_normalizer", "indexmap", "intrusive-collections", - "itertools", - "num-bigint", + "itertools 0.15.0", + "num-bigint 0.5.1", "num-integer", "num-traits", "num_enum", "oneshot", - "pastey", + "pastey 0.2.3", "portable-atomic", "rand 0.10.3", "regress", @@ -668,7 +737,7 @@ dependencies = [ "boa_macros", "fast-float2", "icu_properties", - "num-bigint", + "num-bigint 0.5.1", "num-traits", "regress", "rustc-hash 2.1.3", @@ -682,7 +751,7 @@ checksum = "30bf86c2bcff5bf2547acbfc516c5d3108ca527cb131511d749bf6fbef762c0e" dependencies = [ "fast-float2", "itoa", - "pastey", + "pastey 0.2.3", "rustc-hash 2.1.3", "ryu-js", "static_assertions", @@ -713,14 +782,10 @@ dependencies = [ ] [[package]] -name = "brotli-decompressor" -version = "6.3.2" +name = "built" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc031cd87c6529082b0b65c604e86af0ed7744841b17ccfe60b1e31fa606179e" -dependencies = [ - "alloc-no-stdlib", - "alloc-stdlib", -] +checksum = "5c0e531d93d39c34eef561e929e8a7f86d77a5af08aac4f6d6e39976c51858e9" [[package]] name = "bumpalo" @@ -1114,6 +1179,17 @@ dependencies = [ "libc", ] +[[package]] +name = "craft-aaf" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=b3643af6477326e840f86be78c89357f5308ba1d#b3643af6477326e840f86be78c89357f5308ba1d" +dependencies = [ + "craft-audio 0.1.0 (git+https://github.com/storytold/craft-libs?rev=b3643af6477326e840f86be78c89357f5308ba1d)", + "craft-cfb 0.1.0 (git+https://github.com/storytold/craft-libs?rev=b3643af6477326e840f86be78c89357f5308ba1d)", + "craft-timeline 0.1.0 (git+https://github.com/storytold/craft-libs?rev=b3643af6477326e840f86be78c89357f5308ba1d)", + "thiserror 2.0.21", +] + [[package]] name = "craft-aep" version = "0.1.0" @@ -1128,6 +1204,40 @@ dependencies = [ "thiserror 2.0.21", ] +[[package]] +name = "craft-audio" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=82062077bba679ba5236e2d1a391f02d1533cbab#82062077bba679ba5236e2d1a391f02d1533cbab" +dependencies = [ + "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=82062077bba679ba5236e2d1a391f02d1533cbab)", + "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=82062077bba679ba5236e2d1a391f02d1533cbab)", + "log", + "rayon", + "symphonia 0.6.1", + "thiserror 2.0.21", +] + +[[package]] +name = "craft-audio" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=b3643af6477326e840f86be78c89357f5308ba1d#b3643af6477326e840f86be78c89357f5308ba1d" +dependencies = [ + "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=b3643af6477326e840f86be78c89357f5308ba1d)", + "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=b3643af6477326e840f86be78c89357f5308ba1d)", + "log", + "thiserror 2.0.21", +] + +[[package]] +name = "craft-cfb" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=7f3fdc0dfebd03f33a241f91f916e9a78d3e5c93#7f3fdc0dfebd03f33a241f91f916e9a78d3e5c93" + +[[package]] +name = "craft-cfb" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=b3643af6477326e840f86be78c89357f5308ba1d#b3643af6477326e840f86be78c89357f5308ba1d" + [[package]] name = "craft-cms" version = "0.1.0" @@ -1169,6 +1279,14 @@ dependencies = [ "thiserror 2.0.21", ] +[[package]] +name = "craft-dpx" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=82062077bba679ba5236e2d1a391f02d1533cbab#82062077bba679ba5236e2d1a391f02d1533cbab" +dependencies = [ + "thiserror 2.0.21", +] + [[package]] name = "craft-ecproj-format" version = "0.1.0" @@ -1233,35 +1351,10 @@ dependencies = [ "writeable", ] -[[package]] -name = "craft-image-codecs" -version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87#5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87" -dependencies = [ - "craft-jpeg", - "craft-metadata", - "crc32fast", - "exr", - "flate2", - "half", - "hayro-jpeg2000", - "image", - "image-webp", - "jpeg-encoder", - "png", - "rayon", - "serde_json", - "thiserror 2.0.21", - "tiff", - "zune-core", - "zune-jpeg", - "zune-jpegxl", -] - [[package]] name = "craft-jpeg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87#5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87" +source = "git+https://github.com/storytold/craft-libs?rev=937ac93c5cf3cd4b6a81e195b078fe161eb081b9#937ac93c5cf3cd4b6a81e195b078fe161eb081b9" dependencies = [ "thiserror 2.0.21", ] @@ -1287,7 +1380,16 @@ dependencies = [ [[package]] name = "craft-media" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0ad6c1e1d297908915f4be315b0fcfc9be7b5d4#f0ad6c1e1d297908915f4be315b0fcfc9be7b5d4" +source = "git+https://github.com/storytold/craft-libs?rev=82062077bba679ba5236e2d1a391f02d1533cbab#82062077bba679ba5236e2d1a391f02d1533cbab" +dependencies = [ + "chrono", + "thiserror 2.0.21", +] + +[[package]] +name = "craft-media" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=b3643af6477326e840f86be78c89357f5308ba1d#b3643af6477326e840f86be78c89357f5308ba1d" dependencies = [ "thiserror 2.0.21", ] @@ -1301,18 +1403,6 @@ dependencies = [ "serde_json", ] -[[package]] -name = "craft-metadata" -version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87#5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87" -dependencies = [ - "brotli-decompressor", - "chrono", - "craft-tiff", - "quick-xml 0.41.0", - "serde", -] - [[package]] name = "craft-mime" version = "0.1.0" @@ -1359,7 +1449,7 @@ dependencies = [ [[package]] name = "craft-psd" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=e836b6fd893eca3fbe5880f000dbf446c3a32fcc#e836b6fd893eca3fbe5880f000dbf446c3a32fcc" +source = "git+https://github.com/storytold/craft-libs?rev=ce2ec507c2e6a6a078a5f450f641487f8931816d#ce2ec507c2e6a6a078a5f450f641487f8931816d" dependencies = [ "encoding_rs", "flate2", @@ -1378,13 +1468,26 @@ dependencies = [ "objc2-app-kit 0.3.2", ] +[[package]] +name = "craft-raw" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=bea91b1861eea3889bec9d26338076f2ff31c4ac#bea91b1861eea3889bec9d26338076f2ff31c4ac" +dependencies = [ + "craft-tiff", + "miniz_oxide 0.9.1", + "rayon", + "serde", + "thiserror 2.0.21", + "zune-core", + "zune-jpeg", +] + [[package]] name = "craft-svg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87#5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87" +source = "git+https://github.com/storytold/craft-libs?rev=77686f24fe8665c21369f1b593f4d65a973e2a45#77686f24fe8665c21369f1b593f4d65a973e2a45" dependencies = [ - "craft-image-codecs", - "craft-xml", + "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=77686f24fe8665c21369f1b593f4d65a973e2a45)", "flate2", "kurbo", "quick-xml 0.41.0", @@ -1394,15 +1497,77 @@ dependencies = [ "vectorcraft-pathops", ] +[[package]] +name = "craft-tga" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=82062077bba679ba5236e2d1a391f02d1533cbab#82062077bba679ba5236e2d1a391f02d1533cbab" +dependencies = [ + "thiserror 2.0.21", +] + [[package]] name = "craft-tiff" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87#5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87" +source = "git+https://github.com/storytold/craft-libs?rev=bea91b1861eea3889bec9d26338076f2ff31c4ac#bea91b1861eea3889bec9d26338076f2ff31c4ac" dependencies = [ "serde", "thiserror 2.0.21", ] +[[package]] +name = "craft-time" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=0d6dd8bed815b8366869a800d2bf22588ca62dcb#0d6dd8bed815b8366869a800d2bf22588ca62dcb" +dependencies = [ + "serde", + "thiserror 2.0.21", +] + +[[package]] +name = "craft-time" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=57288edafdc45552e30481cc649021de446abfa0#57288edafdc45552e30481cc649021de446abfa0" +dependencies = [ + "serde", + "thiserror 2.0.21", +] + +[[package]] +name = "craft-time" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=b3643af6477326e840f86be78c89357f5308ba1d#b3643af6477326e840f86be78c89357f5308ba1d" +dependencies = [ + "serde", + "thiserror 2.0.21", +] + +[[package]] +name = "craft-timeline" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=0d6dd8bed815b8366869a800d2bf22588ca62dcb#0d6dd8bed815b8366869a800d2bf22588ca62dcb" +dependencies = [ + "craft-time 0.1.0 (git+https://github.com/storytold/craft-libs?rev=0d6dd8bed815b8366869a800d2bf22588ca62dcb)", +] + +[[package]] +name = "craft-timeline" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=57288edafdc45552e30481cc649021de446abfa0#57288edafdc45552e30481cc649021de446abfa0" +dependencies = [ + "craft-time 0.1.0 (git+https://github.com/storytold/craft-libs?rev=57288edafdc45552e30481cc649021de446abfa0)", + "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=57288edafdc45552e30481cc649021de446abfa0)", + "serde", + "serde_json", +] + +[[package]] +name = "craft-timeline" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=b3643af6477326e840f86be78c89357f5308ba1d#b3643af6477326e840f86be78c89357f5308ba1d" +dependencies = [ + "craft-time 0.1.0 (git+https://github.com/storytold/craft-libs?rev=b3643af6477326e840f86be78c89357f5308ba1d)", +] + [[package]] name = "craft-ui" version = "0.1.0" @@ -1472,6 +1637,17 @@ dependencies = [ "thiserror 2.0.21", ] +[[package]] +name = "craft-video" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=82062077bba679ba5236e2d1a391f02d1533cbab#82062077bba679ba5236e2d1a391f02d1533cbab" +dependencies = [ + "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=82062077bba679ba5236e2d1a391f02d1533cbab)", + "rav1e", + "rayon", + "thiserror 2.0.21", +] + [[package]] name = "craft-webp" version = "0.1.0" @@ -1484,13 +1660,51 @@ dependencies = [ [[package]] name = "craft-xml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87#5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87" +source = "git+https://github.com/storytold/craft-libs?rev=57288edafdc45552e30481cc649021de446abfa0#57288edafdc45552e30481cc649021de446abfa0" dependencies = [ "quick-xml 0.41.0", "serde", "thiserror 2.0.21", ] +[[package]] +name = "craft-xml" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=77686f24fe8665c21369f1b593f4d65a973e2a45#77686f24fe8665c21369f1b593f4d65a973e2a45" +dependencies = [ + "quick-xml 0.41.0", + "serde", + "thiserror 2.0.21", +] + +[[package]] +name = "craft-xml" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=82062077bba679ba5236e2d1a391f02d1533cbab#82062077bba679ba5236e2d1a391f02d1533cbab" +dependencies = [ + "quick-xml 0.41.0", + "serde", + "thiserror 2.0.21", +] + +[[package]] +name = "craft-xml" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=b3643af6477326e840f86be78c89357f5308ba1d#b3643af6477326e840f86be78c89357f5308ba1d" +dependencies = [ + "quick-xml 0.41.0", + "serde", + "thiserror 2.0.21", +] + +[[package]] +name = "craft-y4m" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=25c7a8959cf70cf8c3f076d05baadb0990710569#25c7a8959cf70cf8c3f076d05baadb0990710569" +dependencies = [ + "thiserror 2.0.21", +] + [[package]] name = "craft-zip" version = "0.1.0" @@ -1863,10 +2077,10 @@ dependencies = [ name = "effectcraft-export" version = "0.24.1" dependencies = [ - "craft-audio", + "craft-audio 0.1.0 (git+https://github.com/storytold/craft-libs?rev=5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87)", "craft-gif", "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87)", - "craft-video", + "craft-video 0.1.0 (git+https://github.com/storytold/craft-libs?rev=5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87)", "effectcraft-color", "effectcraft-effects", "effectcraft-keyframe", @@ -1976,6 +2190,7 @@ dependencies = [ name = "effectcraft-interchange" version = "0.24.1" dependencies = [ + "craft-timeline 0.1.0 (git+https://github.com/storytold/craft-libs?rev=0d6dd8bed815b8366869a800d2bf22588ca62dcb)", "effectcraft-color", "effectcraft-keyframe", "effectcraft-project", @@ -2026,9 +2241,9 @@ dependencies = [ name = "effectcraft-media" version = "0.24.1" dependencies = [ - "craft-audio", + "craft-audio 0.1.0 (git+https://github.com/storytold/craft-libs?rev=5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87)", "craft-docpath", - "craft-dpx", + "craft-dpx 0.1.0 (git+https://github.com/storytold/craft-libs?rev=5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87)", "craft-exr", "craft-gif", "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87)", @@ -2080,6 +2295,7 @@ dependencies = [ "effectcraft-raster", "kurbo", "linesweeper", + "log", "tiny-skia 0.12.0", ] @@ -2373,7 +2589,7 @@ dependencies = [ "bitflags 2.13.2", "emath", "epaint", - "itertools", + "itertools 0.15.0", "log", "nohash-hasher", "profiling", @@ -2435,7 +2651,7 @@ dependencies = [ "ahash", "egui", "enum-map", - "itertools", + "itertools 0.15.0", "log", "profiling", ] @@ -2725,129 +2941,70 @@ dependencies = [ "libc", ] -[[package]] -name = "filmcraft-aac" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" -dependencies = [ - "filmcraft-bitstream", - "thiserror 2.0.21", -] - -[[package]] -name = "filmcraft-ac3" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" -dependencies = [ - "thiserror 2.0.21", -] - -[[package]] -name = "filmcraft-apv" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" -dependencies = [ - "filmcraft-bitstream", - "rayon", - "thiserror 2.0.21", -] - -[[package]] -name = "filmcraft-av1" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" -dependencies = [ - "filmcraft-bitstream", - "rayon", - "thiserror 2.0.21", -] - -[[package]] -name = "filmcraft-avi" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" - [[package]] name = "filmcraft-bitstream" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" +version = "0.20.1" +source = "git+https://github.com/storytold/filmcraft?rev=3f137a7ed420cac79b32145f5243b7f98b31f71c#3f137a7ed420cac79b32145f5243b7f98b31f71c" dependencies = [ - "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=f0ad6c1e1d297908915f4be315b0fcfc9be7b5d4)", + "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=82062077bba679ba5236e2d1a391f02d1533cbab)", ] [[package]] name = "filmcraft-cfb" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" +version = "0.20.1" +source = "git+https://github.com/storytold/filmcraft?rev=3f137a7ed420cac79b32145f5243b7f98b31f71c#3f137a7ed420cac79b32145f5243b7f98b31f71c" +dependencies = [ + "craft-cfb 0.1.0 (git+https://github.com/storytold/craft-libs?rev=7f3fdc0dfebd03f33a241f91f916e9a78d3e5c93)", +] [[package]] name = "filmcraft-codecs" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" +version = "0.20.1" +source = "git+https://github.com/storytold/filmcraft?rev=3f137a7ed420cac79b32145f5243b7f98b31f71c#3f137a7ed420cac79b32145f5243b7f98b31f71c" dependencies = [ - "filmcraft-aac", - "filmcraft-ac3", - "filmcraft-apv", - "filmcraft-av1", - "filmcraft-avi", + "craft-audio 0.1.0 (git+https://github.com/storytold/craft-libs?rev=82062077bba679ba5236e2d1a391f02d1533cbab)", + "craft-jpeg", + "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=82062077bba679ba5236e2d1a391f02d1533cbab)", + "craft-video 0.1.0 (git+https://github.com/storytold/craft-libs?rev=82062077bba679ba5236e2d1a391f02d1533cbab)", + "craft-y4m", "filmcraft-bitstream", "filmcraft-color", - "filmcraft-dnx", "filmcraft-frame", - "filmcraft-h264", - "filmcraft-hevc", "filmcraft-isobmff", "filmcraft-matroska", "filmcraft-media", - "filmcraft-mpa", - "filmcraft-mpeg2v", - "filmcraft-mpegts", - "filmcraft-mxf", - "filmcraft-ogg", - "filmcraft-opus", - "filmcraft-prores", "filmcraft-time", - "filmcraft-vp8", - "filmcraft-vp9", - "image", "log", "rayon", - "symphonia", + "symphonia 0.5.5", "thiserror 2.0.21", "web-time", ] [[package]] name = "filmcraft-color" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" +version = "0.20.1" +source = "git+https://github.com/storytold/filmcraft?rev=3f137a7ed420cac79b32145f5243b7f98b31f71c#3f137a7ed420cac79b32145f5243b7f98b31f71c" dependencies = [ "serde", ] [[package]] name = "filmcraft-dng" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" +version = "0.20.1" +source = "git+https://github.com/storytold/filmcraft?rev=3f137a7ed420cac79b32145f5243b7f98b31f71c#3f137a7ed420cac79b32145f5243b7f98b31f71c" dependencies = [ - "rayon", - "thiserror 2.0.21", -] - -[[package]] -name = "filmcraft-dnx" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" -dependencies = [ - "filmcraft-bitstream", + "craft-raw", + "craft-tiff", + "image", "rayon", "thiserror 2.0.21", ] [[package]] name = "filmcraft-frame" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" +version = "0.20.1" +source = "git+https://github.com/storytold/filmcraft?rev=3f137a7ed420cac79b32145f5243b7f98b31f71c#3f137a7ed420cac79b32145f5243b7f98b31f71c" dependencies = [ "filmcraft-color", "filmcraft-time", @@ -2857,44 +3014,26 @@ dependencies = [ [[package]] name = "filmcraft-geom" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" +version = "0.20.1" +source = "git+https://github.com/storytold/filmcraft?rev=3f137a7ed420cac79b32145f5243b7f98b31f71c#3f137a7ed420cac79b32145f5243b7f98b31f71c" dependencies = [ "serde", ] -[[package]] -name = "filmcraft-h264" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" -dependencies = [ - "filmcraft-bitstream", - "rayon", - "thiserror 2.0.21", -] - -[[package]] -name = "filmcraft-hevc" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" -dependencies = [ - "filmcraft-bitstream", - "rayon", - "thiserror 2.0.21", -] - [[package]] name = "filmcraft-interchange" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" +version = "0.20.1" +source = "git+https://github.com/storytold/filmcraft?rev=3f137a7ed420cac79b32145f5243b7f98b31f71c#3f137a7ed420cac79b32145f5243b7f98b31f71c" dependencies = [ + "craft-aaf", + "craft-audio 0.1.0 (git+https://github.com/storytold/craft-libs?rev=82062077bba679ba5236e2d1a391f02d1533cbab)", + "craft-timeline 0.1.0 (git+https://github.com/storytold/craft-libs?rev=57288edafdc45552e30481cc649021de446abfa0)", "filmcraft-cfb", "filmcraft-color", "filmcraft-geom", "filmcraft-media", "filmcraft-project", "filmcraft-time", - "roxmltree", "serde", "serde_json", "thiserror 2.0.21", @@ -2902,25 +3041,29 @@ dependencies = [ [[package]] name = "filmcraft-isobmff" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" +version = "0.20.1" +source = "git+https://github.com/storytold/filmcraft?rev=3f137a7ed420cac79b32145f5243b7f98b31f71c#3f137a7ed420cac79b32145f5243b7f98b31f71c" dependencies = [ - "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=f0ad6c1e1d297908915f4be315b0fcfc9be7b5d4)", + "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=82062077bba679ba5236e2d1a391f02d1533cbab)", ] [[package]] name = "filmcraft-matroska" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" +version = "0.20.1" +source = "git+https://github.com/storytold/filmcraft?rev=3f137a7ed420cac79b32145f5243b7f98b31f71c#3f137a7ed420cac79b32145f5243b7f98b31f71c" dependencies = [ - "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=f0ad6c1e1d297908915f4be315b0fcfc9be7b5d4)", + "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=82062077bba679ba5236e2d1a391f02d1533cbab)", ] [[package]] name = "filmcraft-media" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" +version = "0.20.1" +source = "git+https://github.com/storytold/filmcraft?rev=3f137a7ed420cac79b32145f5243b7f98b31f71c#3f137a7ed420cac79b32145f5243b7f98b31f71c" dependencies = [ + "craft-audio 0.1.0 (git+https://github.com/storytold/craft-libs?rev=82062077bba679ba5236e2d1a391f02d1533cbab)", + "craft-dpx 0.1.0 (git+https://github.com/storytold/craft-libs?rev=82062077bba679ba5236e2d1a391f02d1533cbab)", + "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=82062077bba679ba5236e2d1a391f02d1533cbab)", + "craft-tga", "filmcraft-color", "filmcraft-dng", "filmcraft-frame", @@ -2931,54 +3074,10 @@ dependencies = [ "thiserror 2.0.21", ] -[[package]] -name = "filmcraft-mpa" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" -dependencies = [ - "filmcraft-bitstream", - "thiserror 2.0.21", -] - -[[package]] -name = "filmcraft-mpeg2v" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" -dependencies = [ - "rayon", - "thiserror 2.0.21", -] - -[[package]] -name = "filmcraft-mpegts" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" -dependencies = [ - "thiserror 2.0.21", -] - -[[package]] -name = "filmcraft-mxf" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" -dependencies = [ - "chrono", -] - -[[package]] -name = "filmcraft-ogg" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" - -[[package]] -name = "filmcraft-opus" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" - [[package]] name = "filmcraft-project" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" +version = "0.20.1" +source = "git+https://github.com/storytold/filmcraft?rev=3f137a7ed420cac79b32145f5243b7f98b31f71c#3f137a7ed420cac79b32145f5243b7f98b31f71c" dependencies = [ "filmcraft-color", "filmcraft-geom", @@ -2987,42 +3086,15 @@ dependencies = [ "serde", "serde_json", "thiserror 2.0.21", -] - -[[package]] -name = "filmcraft-prores" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" -dependencies = [ - "filmcraft-bitstream", - "rayon", - "thiserror 2.0.21", + "url", ] [[package]] name = "filmcraft-time" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" +version = "0.20.1" +source = "git+https://github.com/storytold/filmcraft?rev=3f137a7ed420cac79b32145f5243b7f98b31f71c#3f137a7ed420cac79b32145f5243b7f98b31f71c" dependencies = [ - "serde", -] - -[[package]] -name = "filmcraft-vp8" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" -dependencies = [ - "thiserror 2.0.21", -] - -[[package]] -name = "filmcraft-vp9" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" -dependencies = [ - "filmcraft-bitstream", - "rayon", - "thiserror 2.0.21", + "craft-timeline 0.1.0 (git+https://github.com/storytold/craft-libs?rev=57288edafdc45552e30481cc649021de446abfa0)", ] [[package]] @@ -3612,9 +3684,6 @@ name = "hayro-jpeg2000" version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c75ab947623ef4ccaa7acf0579edf7cbb5a73838e3839a7be73335e522f433a1" -dependencies = [ - "fearless_simd", -] [[package]] name = "hayro-syntax" @@ -3876,7 +3945,6 @@ dependencies = [ "moxcms", "num-traits", "png", - "qoi", "tiff", "zune-core", "zune-jpeg", @@ -3902,12 +3970,32 @@ dependencies = [ "hashbrown 0.17.1", ] +[[package]] +name = "interpolate_name" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + [[package]] name = "intrusive-collections" version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4275b20e6057cd7733fd8df8a5a31701e4fe44497dad0f3fa0e1c4fb971506be" +[[package]] +name = "itertools" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" +dependencies = [ + "either", +] + [[package]] name = "itertools" version = "0.15.0" @@ -4007,12 +4095,6 @@ dependencies = [ "libc", ] -[[package]] -name = "jpeg-encoder" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b454d911ac55068f53495488d8ccd0646eaa540c033a28ee15b07838afafb01f" - [[package]] name = "js-sys" version = "0.3.106" @@ -4098,6 +4180,16 @@ version = "0.2.189" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2" +[[package]] +name = "libfuzzer-sys" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9fd2f41a1cba099f79a0b6b6c35656cf7c03351a7bae8ff0f28f25270f929d2" +dependencies = [ + "arbitrary", + "cc", +] + [[package]] name = "libloading" version = "0.8.9" @@ -4212,6 +4304,16 @@ dependencies = [ "rawpointer", ] +[[package]] +name = "maybe-rayon" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ea1f30cedd69f0a2954655f7188c6a834246d2bcf1e315e2ac40c4b24dc9519" +dependencies = [ + "cfg-if", + "rayon", +] + [[package]] name = "md-5" version = "0.10.6" @@ -4404,6 +4506,12 @@ dependencies = [ "jni-sys 0.3.1", ] +[[package]] +name = "new_debug_unreachable" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" + [[package]] name = "nix" version = "0.31.3" @@ -4416,6 +4524,15 @@ dependencies = [ "libc", ] +[[package]] +name = "no_std_io2" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "418abd1b6d34fbf6cae440dc874771b0525a604428704c76e48b29a5e67b8003" +dependencies = [ + "memchr", +] + [[package]] name = "nohash-hasher" version = "0.2.0" @@ -4431,6 +4548,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "noop_proc_macro" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8" + [[package]] name = "ntapi" version = "0.4.3" @@ -4449,6 +4572,16 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "num-bigint" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c89e69e7e0f03bea5ef08013795c25018e101932225a656383bd384495ecc367" +dependencies = [ + "num-integer", + "num-traits", +] + [[package]] name = "num-bigint" version = "0.5.1" @@ -4496,6 +4629,17 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-rational" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" +dependencies = [ + "num-bigint 0.4.8", + "num-integer", + "num-traits", +] + [[package]] name = "num-traits" version = "0.2.19" @@ -5003,6 +5147,12 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "pastey" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35fb2e5f958ec131621fdd531e9fc186ed768cbe395337403ae56c17a74c68ec" + [[package]] name = "pastey" version = "0.2.3" @@ -5284,6 +5434,19 @@ name = "profiling" version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d595e54a326bc53c1c197b32d295e14b169e3cfeaa8dc82b529f947fba6bcf5" +dependencies = [ + "profiling-procmacros", +] + +[[package]] +name = "profiling-procmacros" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4488a4a36b9a4ba6b9334a32a39971f77c1436ec82c38707bce707699cc3bbcb" +dependencies = [ + "quote", + "syn 2.0.119", +] [[package]] name = "proptest" @@ -5334,15 +5497,6 @@ version = "0.1.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d55d956fa96f5ec02be2e13af0e20391a5aa83d6a074e3ad368959d0fab299ea" -[[package]] -name = "qoi" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f6d64c71eb498fe9eae14ce4ec935c555749aef511cca85b5568910d6e48001" -dependencies = [ - "bytemuck", -] - [[package]] name = "quick-error" version = "1.2.3" @@ -5465,6 +5619,40 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca45419789ae5a7899559e9512e58ca889e41f04f1f2445e9f4b290ceccd1d08" +[[package]] +name = "rav1e" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43b6dd56e85d9483277cde964fd1bdb0428de4fec5ebba7540995639a21cb32b" +dependencies = [ + "aligned-vec", + "arbitrary", + "arg_enum_proc_macro", + "arrayvec", + "av-scenechange", + "av1-grain", + "bitstream-io", + "built", + "cfg-if", + "interpolate_name", + "itertools 0.14.0", + "libc", + "libfuzzer-sys", + "log", + "maybe-rayon", + "new_debug_unreachable", + "noop_proc_macro", + "num-derive", + "num-traits", + "paste", + "profiling", + "rand 0.9.5", + "rand_chacha", + "simd_helpers", + "thiserror 2.0.21", + "v_frame", +] + [[package]] name = "raw-cpuid" version = "11.6.0" @@ -5573,6 +5761,12 @@ dependencies = [ "bitflags 2.13.2", ] +[[package]] +name = "regex-lite" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cab834c73d247e67f4fae452806d17d3c7501756d98c8808d7c9c7aa7d18f973" + [[package]] name = "regex-syntax" version = "0.8.11" @@ -6004,6 +6198,15 @@ dependencies = [ "simdutf8", ] +[[package]] +name = "simd_helpers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95890f873bec569a0362c235787f3aca6e1e887302ba4840839bcc6459c42da6" +dependencies = [ + "quote", +] + [[package]] name = "simdutf8" version = "0.1.5" @@ -6239,17 +6442,40 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5773a4c030a19d9bfaa090f49746ff35c75dfddfa700df7a5939d5e076a57039" dependencies = [ "lazy_static", - "symphonia-bundle-flac", - "symphonia-bundle-mp3", - "symphonia-codec-aac", - "symphonia-codec-alac", - "symphonia-codec-pcm", - "symphonia-codec-vorbis", - "symphonia-core", - "symphonia-format-isomp4", - "symphonia-format-ogg", - "symphonia-format-riff", - "symphonia-metadata", + "symphonia-bundle-flac 0.5.5", + "symphonia-bundle-mp3 0.5.5", + "symphonia-codec-aac 0.5.5", + "symphonia-codec-alac 0.5.5", + "symphonia-codec-pcm 0.5.5", + "symphonia-codec-vorbis 0.5.5", + "symphonia-core 0.5.5", + "symphonia-format-isomp4 0.5.5", + "symphonia-format-ogg 0.5.5", + "symphonia-format-riff 0.5.5", + "symphonia-metadata 0.5.5", +] + +[[package]] +name = "symphonia" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7edef6a96b696d4e0cab5ee9ebb7ca155ed95f30a6b45bbb8b97d2727f02424" +dependencies = [ + "lazy_static", + "symphonia-bundle-flac 0.6.1", + "symphonia-bundle-mp3 0.6.1", + "symphonia-codec-aac 0.6.1", + "symphonia-codec-adpcm", + "symphonia-codec-alac 0.6.1", + "symphonia-codec-pcm 0.6.1", + "symphonia-codec-vorbis 0.6.1", + "symphonia-core 0.6.1", + "symphonia-format-caf", + "symphonia-format-isomp4 0.6.1", + "symphonia-format-mkv", + "symphonia-format-ogg 0.6.1", + "symphonia-format-riff 0.6.1", + "symphonia-metadata 0.6.1", ] [[package]] @@ -6259,11 +6485,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c91565e180aea25d9b80a910c546802526ffd0072d0b8974e3ebe59b686c9976" dependencies = [ "log", - "symphonia-core", - "symphonia-metadata", + "symphonia-core 0.5.5", + "symphonia-metadata 0.5.5", "symphonia-utils-xiph", ] +[[package]] +name = "symphonia-bundle-flac" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6405d5c34ff6f8f7ca08a4101efe66d21e180f7322ef9359900a0e55698a7892" +dependencies = [ + "log", + "symphonia-common", + "symphonia-core 0.6.1", + "symphonia-metadata 0.6.1", +] + [[package]] name = "symphonia-bundle-mp3" version = "0.5.5" @@ -6272,8 +6510,19 @@ checksum = "4872dd6bb56bf5eac799e3e957aa1981086c3e613b27e0ac23b176054f7c57ed" dependencies = [ "lazy_static", "log", - "symphonia-core", - "symphonia-metadata", + "symphonia-core 0.5.5", + "symphonia-metadata 0.5.5", +] + +[[package]] +name = "symphonia-bundle-mp3" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98ea5ffc8716bff677dfb3b01b420c7b758de901a72b8c330bf2040ab74b4add" +dependencies = [ + "lazy_static", + "log", + "symphonia-core 0.6.1", ] [[package]] @@ -6284,7 +6533,29 @@ checksum = "4c263845aa86881416849c1729a54c7f55164f8b96111dba59de46849e73a790" dependencies = [ "lazy_static", "log", - "symphonia-core", + "symphonia-core 0.5.5", +] + +[[package]] +name = "symphonia-codec-aac" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5bf8e39552d34a3c4c98333370e62f48c92456d2e814f273b5c3ad7c4a5f45c" +dependencies = [ + "lazy_static", + "log", + "symphonia-common", + "symphonia-core 0.6.1", +] + +[[package]] +name = "symphonia-codec-adpcm" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "445932ecb0c59362fde9c082dd63a75380650c5077fdb8b80b8cac850442a74c" +dependencies = [ + "log", + "symphonia-core 0.6.1", ] [[package]] @@ -6294,7 +6565,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8413fa754942ac16a73634c9dfd1500ed5c61430956b33728567f667fdd393ab" dependencies = [ "log", - "symphonia-core", + "symphonia-core 0.5.5", +] + +[[package]] +name = "symphonia-codec-alac" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "920a78f96f3cf62932d0c497959c0cc2100ef36b03c7ca1417b260f432a482d8" +dependencies = [ + "log", + "symphonia-common", + "symphonia-core 0.6.1", ] [[package]] @@ -6304,7 +6586,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4e89d716c01541ad3ebe7c91ce4c8d38a7cf266a3f7b2f090b108fb0cb031d95" dependencies = [ "log", - "symphonia-core", + "symphonia-core 0.5.5", +] + +[[package]] +name = "symphonia-codec-pcm" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e04ba75686acbe43542fdd374571195f0530c0b7785ca25cc6840e9c6c4b6eea" +dependencies = [ + "log", + "symphonia-core 0.6.1", ] [[package]] @@ -6314,10 +6606,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f025837c309cd69ffef572750b4a2257b59552c5399a5e49707cc5b1b85d1c73" dependencies = [ "log", - "symphonia-core", + "symphonia-core 0.5.5", "symphonia-utils-xiph", ] +[[package]] +name = "symphonia-codec-vorbis" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73d90b4fcf796137cc683c538282804ff9629f8ad9dbfd881fcbba331ac4e986" +dependencies = [ + "log", + "symphonia-common", + "symphonia-core 0.6.1", +] + +[[package]] +name = "symphonia-common" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2acc3fcc18ec9b8cdd48614e259c4cf0d27b71d41e5d9b120b42c5adab12d7c4" +dependencies = [ + "log", + "symphonia-core 0.6.1", + "symphonia-metadata 0.6.1", +] + [[package]] name = "symphonia-core" version = "0.5.5" @@ -6331,6 +6645,31 @@ dependencies = [ "log", ] +[[package]] +name = "symphonia-core" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01c412864d599d4750d0c3d684d7e093ec05e5309681ef5252cc1096a437f6e0" +dependencies = [ + "bitflags 2.13.2", + "bytemuck", + "lazy_static", + "log", + "num-complex", + "smallvec", +] + +[[package]] +name = "symphonia-format-caf" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab64327ee1920531c5bf86cf7e9cd1a599d57013ddc30691da62683cefc65191" +dependencies = [ + "log", + "symphonia-common", + "symphonia-core 0.6.1", +] + [[package]] name = "symphonia-format-isomp4" version = "0.5.5" @@ -6339,11 +6678,35 @@ checksum = "243739585d11f81daf8dac8d9f3d18cc7898f6c09a259675fc364b382c30e0a5" dependencies = [ "encoding_rs", "log", - "symphonia-core", - "symphonia-metadata", + "symphonia-core 0.5.5", + "symphonia-metadata 0.5.5", "symphonia-utils-xiph", ] +[[package]] +name = "symphonia-format-isomp4" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e681a70e1870d34e02abf1dbc51e4267c3f1827801474e8870be8c689fc4dc3" +dependencies = [ + "log", + "symphonia-common", + "symphonia-core 0.6.1", + "symphonia-metadata 0.6.1", +] + +[[package]] +name = "symphonia-format-mkv" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d015c5c0558864665894b3f4cbd95e10abb01b9c868e751c72670f326a56360e" +dependencies = [ + "lazy_static", + "log", + "symphonia-common", + "symphonia-core 0.6.1", +] + [[package]] name = "symphonia-format-ogg" version = "0.5.5" @@ -6351,11 +6714,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b4955c67c1ed3aa8ae8428d04ca8397fbef6a19b2b051e73b5da8b1435639cb" dependencies = [ "log", - "symphonia-core", - "symphonia-metadata", + "symphonia-core 0.5.5", + "symphonia-metadata 0.5.5", "symphonia-utils-xiph", ] +[[package]] +name = "symphonia-format-ogg" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b5495e7f7e3c7035328d82b6d6e377eef289bb0c4105bdeb557fc93a833f994" +dependencies = [ + "log", + "symphonia-common", + "symphonia-core 0.6.1", + "symphonia-metadata 0.6.1", +] + [[package]] name = "symphonia-format-riff" version = "0.5.5" @@ -6364,8 +6739,20 @@ checksum = "c2d7c3df0e7d94efb68401d81906eae73c02b40d5ec1a141962c592d0f11a96f" dependencies = [ "extended", "log", - "symphonia-core", - "symphonia-metadata", + "symphonia-core 0.5.5", + "symphonia-metadata 0.5.5", +] + +[[package]] +name = "symphonia-format-riff" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ff70929083a8c1a5f6cd7c904b6071c7914ad04739b510c2f7239dfc9b7dabe" +dependencies = [ + "extended", + "log", + "symphonia-core 0.6.1", + "symphonia-metadata 0.6.1", ] [[package]] @@ -6377,7 +6764,20 @@ dependencies = [ "encoding_rs", "lazy_static", "log", - "symphonia-core", + "symphonia-core 0.5.5", +] + +[[package]] +name = "symphonia-metadata" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83713a97705d77bdef7cdbc0768fd6e5a54e4cd7e48d60a806ae85639e2c87c6" +dependencies = [ + "lazy_static", + "log", + "regex-lite", + "smallvec", + "symphonia-core 0.6.1", ] [[package]] @@ -6386,8 +6786,8 @@ version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee27c85ab799a338446b68eec77abf42e1a6f1bb490656e121c6e27bfbab9f16" dependencies = [ - "symphonia-core", - "symphonia-metadata", + "symphonia-core 0.5.5", + "symphonia-metadata 0.5.5", ] [[package]] @@ -6941,6 +7341,17 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "v_frame" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "666b7727c8875d6ab5db9533418d7c764233ac9c0cff1d469aec8fa127597be2" +dependencies = [ + "aligned-vec", + "num-traits", + "wasm-bindgen", +] + [[package]] name = "vectorcraft-geom" version = "0.18.0" @@ -8222,6 +8633,12 @@ dependencies = [ "tempfile", ] +[[package]] +name = "y4m" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5a4b21e1a62b67a2970e6831bc091d7b87e119e7f9791aef9702e3bef04448" + [[package]] name = "yoke" version = "0.8.3" @@ -8499,15 +8916,6 @@ dependencies = [ "zune-core", ] -[[package]] -name = "zune-jpegxl" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cba11ecd07cc23351500e840ae03841b7e4997923ec8e4832ee3ae199ea0b6b4" -dependencies = [ - "zune-core", -] - [[package]] name = "zvariant" version = "5.15.0" diff --git a/Cargo.toml b/Cargo.toml index 2ff526134..efc4f1954 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,242 +1,243 @@ -[workspace] -resolver = "3" -members = ["crates/*", "apps/*", "xtask"] -default-members = ["crates/*", "apps/*"] - -[workspace.package] -version = "0.24.1" -edition = "2024" -license = "MIT OR Apache-2.0" -rust-version = "1.95" -repository = "https://github.com/storytold/effectcraft" - -[workspace.dependencies] -craft-mime = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87" } -craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "808730f49b9637b7909fe2ae56f9d63fdb100cae", version = "=0.1.0", default-features = false, features = ["read"] } -craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87" } -craft-quit = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87" } -craft-ecproj-format = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87" } -craft-dpx = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87" } -craft-ps = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "808730f49b9637b7909fe2ae56f9d63fdb100cae", default-features = false, features = ["read"] } -craft-exr = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87" } -craft-gif = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87" } -craft-psd = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "e836b6fd893eca3fbe5880f000dbf446c3a32fcc" } -craft-svg = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87" } -craft-webp = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87" } -craft-lottie = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87" } -craft-mesh = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87", default-features = false, features = ["stl", "obj", "gltf", "fbx"] } -craft-aep = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87" } -craft-doc = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87" } -craft-vectorcraft-format = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87" } -# 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 = "5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87", features = ["egui"] } -# internal -effectcraft-time = { path = "crates/time" } -effectcraft-geom = { path = "crates/geom" } -effectcraft-color = { path = "crates/color" } -effectcraft-raster = { path = "crates/raster" } -effectcraft-path = { path = "crates/path" } -effectcraft-keyframe = { path = "crates/keyframe" } -effectcraft-project = { path = "crates/project" } -effectcraft-text = { path = "crates/text" } -effectcraft-effects = { path = "crates/effects" } -effectcraft-track = { path = "crates/track" } -effectcraft-segment = { path = "crates/segment" } -effectcraft-sam2 = { path = "crates/sam2" } -effectcraft-model = { path = "crates/model" } -effectcraft-render = { path = "crates/render" } -effectcraft-gpu = { path = "crates/gpu" } -effectcraft-media = { path = "crates/media" } -effectcraft-export = { path = "crates/export" } -effectcraft-expr = { path = "crates/expr" } -effectcraft-lottie = { path = "crates/lottie" } -effectcraft-interchange = { path = "crates/interchange" } -effectcraft-pdf = { path = "crates/pdf" } -effectcraft-psd = { path = "crates/psd" } -effectcraft-aep = { path = "crates/aep" } -effectcraft-svg = { path = "crates/svg" } -effectcraft-engine = { path = "crates/engine" } -effectcraft-host = { path = "crates/host" } -effectcraft-ui-egui = { path = "crates/ui-egui" } -effectcraft-automation = { path = "crates/automation" } -effectcraft-script = { path = "crates/script" } -effectcraft-plugin = { path = "crates/plugin" } -effectcraft-helper-host = { path = "crates/helper-host" } - -# foundation -thiserror = "2" -serde = { version = "1", features = ["derive", "rc"] } -serde_json = { version = "1", features = ["float_roundtrip"] } -log = "0.4" -# The process's own memory use for the memory accountant (#3301; MIT OR Apache-2.0). -memory-stats = "1.2" -# All date/time conversion goes through chrono (no hand-rolled calendar code beyond the 400-year range extension; AGENTS.md). -chrono = { version = "0.4.45", default-features = false, features = ["std"] } -rayon = "1" -# std::time::Instant/SystemTime on native; the browser clock on wasm32 (std's panic there). -web-time = "1" -gif = "0.14" -proptest = "1" - -# scripting (expressions) -boa_engine = { version = "0.22", default-features = false } -# WebAssembly effect plug-ins (sandboxed interpreter; MIT/Apache-2.0, pure Rust) -wasmi = { version = "2", default-features = false, features = ["std", "validate", "wat", "deterministic", "portable-dispatch"] } - -# geometry / fonts -kurbo = { version = "0.13", features = ["serde"] } -tiny-skia = { version = "0.12", default-features = false, features = ["std", "simd"] } -skrifa = { version = "0.44", default-features = false, features = ["std"] } -harfrust = { version = "0.12", default-features = false, features = ["std"] } -exr = "1.74" -image = { version = "0.25", default-features = false, features = ["png", "jpeg"] } -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 = "5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87", default-features = false, features = ["isobmff", "matroska"] } -craft-audio = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87", default-features = false, features = ["aac-decode", "aac-encode", "opus-decode", "opus-encode"] } -craft-video = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87", 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. -filmcraft-codecs = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" } -filmcraft-media = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" } -filmcraft-frame = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" } -filmcraft-color = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" } -filmcraft-time = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" } -# timeline interchange (EDL, FCP7 XML, FCPXML, OTIO) for Premiere Pro interop (crates/interchange only) -filmcraft-interchange = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" } -filmcraft-project = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" } -filmcraft-geom = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" } - -# gpu (the same wgpu eframe / egui-wgpu use) -wgpu = { version = "30.0.1", features = ["fragile-send-sync-non-atomic-wasm"] } -bytemuck = "1" -pollster = "1" -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 = "5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87", 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"] } -eframe = { version = "0.37", default-features = false } -# Resizable table columns (About ▸ Contributors / Models); no image loaders. -egui_extras = { version = "0.37", default-features = false } -egui_kittest = "0.37" -rfd = "0.17" -cpal = "0.16" -# The operating system's interface language (MIT/Apache-2.0, no dependencies on desktop). -sys-locale = "0.3" - -# Local co-development against a FilmCraft checkout next to this repo: uncomment. -# [patch."https://github.com/storytold/filmcraft"] -# filmcraft-codecs = { path = "../filmcraft/crates/codecs" } -# filmcraft-media = { path = "../filmcraft/crates/media" } -# filmcraft-frame = { path = "../filmcraft/crates/frame" } -# filmcraft-color = { path = "../filmcraft/crates/color" } -# filmcraft-time = { path = "../filmcraft/crates/time" } - -[workspace.lints.rust] -unsafe_code = "forbid" - -[workspace.lints.clippy] -cognitive_complexity = "deny" -too_many_arguments = "deny" -wildcard_imports = "deny" -dbg_macro = "warn" -todo = "warn" -needless_range_loop = "allow" -type_complexity = "allow" - -[profile.dev.package."*"] -opt-level = 2 -debug = false - -[profile.dev] -opt-level = 1 -# Panics and backtraces keep file and line; full debug info only made the many test binaries large. -debug = "line-tables-only" - -# Same settings as `dev`, but with full debug info for interactive debugger sessions: local -# variables, parameters and column breakpoints work. Use `--profile dev-full` when debugging; -# everything else stays on the fast default. See CONTRIBUTING.md, "Setup". -[profile.dev-full] -inherits = "dev" -debug = true - -# Pixel hot loops: keep debug builds interactive. -[profile.dev.package.effectcraft-raster] -opt-level = 3 - -[profile.dev.package.effectcraft-render] -opt-level = 3 - -[profile.dev.package.effectcraft-gpu] -opt-level = 3 - -[profile.dev.package.effectcraft-effects] -opt-level = 3 - -[profile.dev.package.effectcraft-track] -opt-level = 3 - -[profile.dev.package.effectcraft-path] -opt-level = 3 - -[profile.dev.package.effectcraft-media] -opt-level = 3 - -[profile.dev.package.effectcraft-export] -opt-level = 3 - -# craft-libs codec hot loops. -[profile.dev.package.craft-video] -opt-level = 3 - -[profile.dev.package.craft-audio] -opt-level = 3 - -[profile.dev.package.craft-media] -opt-level = 3 - -# FilmCraft codec hot loops (same settings as FilmCraft's own workspace). -[profile.dev.package.filmcraft-h264] -opt-level = 3 - -[profile.dev.package.filmcraft-hevc] -opt-level = 3 - -[profile.dev.package.filmcraft-vp9] -opt-level = 3 - -[profile.dev.package.filmcraft-dnx] -opt-level = 3 - -[profile.dev.package.filmcraft-av1] -opt-level = 3 - -[profile.release] -lto = "thin" -codegen-units = 1 - -[patch.crates-io] -hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "808730f49b9637b7909fe2ae56f9d63fdb100cae", version = "=0.7.2" } -hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "808730f49b9637b7909fe2ae56f9d63fdb100cae", 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" } -epaint_default_fonts = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } -egui = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } -egui-winit = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } -egui-wgpu = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } -egui_glow = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } -egui_extras = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } -egui_kittest = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } -eframe = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } -# Patch a crate only together with the dependency that needs it: an unused patch makes the Nix -# build, which uses vendored sources, fail (`cargo xtask lock-patches`). -winit = { git = "https://github.com/storytold/winit.git", rev = "a517b3846ee8457d84ee4975110bfda6797c44dc" } +[workspace] +resolver = "3" +members = ["crates/*", "apps/*", "xtask"] +default-members = ["crates/*", "apps/*"] + +[workspace.package] +version = "0.24.1" +edition = "2024" +license = "MIT OR Apache-2.0" +rust-version = "1.95" +repository = "https://github.com/storytold/effectcraft" + +[workspace.dependencies] +craft-timeline = { git = "https://github.com/storytold/craft-libs", rev = "0d6dd8bed815b8366869a800d2bf22588ca62dcb", default-features = false } +craft-mime = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87" } +craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "808730f49b9637b7909fe2ae56f9d63fdb100cae", version = "=0.1.0", default-features = false, features = ["read"] } +craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87" } +craft-quit = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87" } +craft-ecproj-format = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87" } +craft-dpx = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87" } +craft-ps = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "808730f49b9637b7909fe2ae56f9d63fdb100cae", default-features = false, features = ["read"] } +craft-exr = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87" } +craft-gif = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87" } +craft-psd = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "ce2ec507c2e6a6a078a5f450f641487f8931816d" } +craft-svg = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "77686f24fe8665c21369f1b593f4d65a973e2a45" } +craft-webp = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87" } +craft-lottie = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87" } +craft-mesh = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87", default-features = false, features = ["stl", "obj", "gltf", "fbx"] } +craft-aep = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87" } +craft-doc = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87" } +craft-vectorcraft-format = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87" } +# 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 = "5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87", features = ["egui"] } +# internal +effectcraft-time = { path = "crates/time" } +effectcraft-geom = { path = "crates/geom" } +effectcraft-color = { path = "crates/color" } +effectcraft-raster = { path = "crates/raster" } +effectcraft-path = { path = "crates/path" } +effectcraft-keyframe = { path = "crates/keyframe" } +effectcraft-project = { path = "crates/project" } +effectcraft-text = { path = "crates/text" } +effectcraft-effects = { path = "crates/effects" } +effectcraft-track = { path = "crates/track" } +effectcraft-segment = { path = "crates/segment" } +effectcraft-sam2 = { path = "crates/sam2" } +effectcraft-model = { path = "crates/model" } +effectcraft-render = { path = "crates/render" } +effectcraft-gpu = { path = "crates/gpu" } +effectcraft-media = { path = "crates/media" } +effectcraft-export = { path = "crates/export" } +effectcraft-expr = { path = "crates/expr" } +effectcraft-lottie = { path = "crates/lottie" } +effectcraft-interchange = { path = "crates/interchange" } +effectcraft-pdf = { path = "crates/pdf" } +effectcraft-psd = { path = "crates/psd" } +effectcraft-aep = { path = "crates/aep" } +effectcraft-svg = { path = "crates/svg" } +effectcraft-engine = { path = "crates/engine" } +effectcraft-host = { path = "crates/host" } +effectcraft-ui-egui = { path = "crates/ui-egui" } +effectcraft-automation = { path = "crates/automation" } +effectcraft-script = { path = "crates/script" } +effectcraft-plugin = { path = "crates/plugin" } +effectcraft-helper-host = { path = "crates/helper-host" } + +# foundation +thiserror = "2" +serde = { version = "1", features = ["derive", "rc"] } +serde_json = { version = "1", features = ["float_roundtrip"] } +log = "0.4" +# The process's own memory use for the memory accountant (#3301; MIT OR Apache-2.0). +memory-stats = "1.2" +# All date/time conversion goes through chrono (no hand-rolled calendar code beyond the 400-year range extension; AGENTS.md). +chrono = { version = "0.4.45", default-features = false, features = ["std"] } +rayon = "1" +# std::time::Instant/SystemTime on native; the browser clock on wasm32 (std's panic there). +web-time = "1" +gif = "0.14" +proptest = "1" + +# scripting (expressions) +boa_engine = { version = "0.22", default-features = false } +# WebAssembly effect plug-ins (sandboxed interpreter; MIT/Apache-2.0, pure Rust) +wasmi = { version = "2", default-features = false, features = ["std", "validate", "wat", "deterministic", "portable-dispatch"] } + +# geometry / fonts +kurbo = { version = "0.13", features = ["serde"] } +tiny-skia = { version = "0.12", default-features = false, features = ["std", "simd"] } +skrifa = { version = "0.44", default-features = false, features = ["std"] } +harfrust = { version = "0.12", default-features = false, features = ["std"] } +exr = "1.74" +image = { version = "0.25", default-features = false, features = ["png", "jpeg"] } +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 = "5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87", default-features = false, features = ["isobmff", "matroska"] } +craft-audio = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87", default-features = false, features = ["aac-decode", "aac-encode", "opus-decode", "opus-encode"] } +craft-video = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87", 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. +filmcraft-codecs = { git = "https://github.com/storytold/filmcraft", rev = "3f137a7ed420cac79b32145f5243b7f98b31f71c" } +filmcraft-media = { git = "https://github.com/storytold/filmcraft", rev = "3f137a7ed420cac79b32145f5243b7f98b31f71c" } +filmcraft-frame = { git = "https://github.com/storytold/filmcraft", rev = "3f137a7ed420cac79b32145f5243b7f98b31f71c" } +filmcraft-color = { git = "https://github.com/storytold/filmcraft", rev = "3f137a7ed420cac79b32145f5243b7f98b31f71c" } +filmcraft-time = { git = "https://github.com/storytold/filmcraft", rev = "3f137a7ed420cac79b32145f5243b7f98b31f71c" } +# timeline interchange (EDL, FCP7 XML, FCPXML, OTIO) for Premiere Pro interop (crates/interchange only) +filmcraft-interchange = { git = "https://github.com/storytold/filmcraft", rev = "3f137a7ed420cac79b32145f5243b7f98b31f71c" } +filmcraft-project = { git = "https://github.com/storytold/filmcraft", rev = "3f137a7ed420cac79b32145f5243b7f98b31f71c" } +filmcraft-geom = { git = "https://github.com/storytold/filmcraft", rev = "3f137a7ed420cac79b32145f5243b7f98b31f71c" } + +# gpu (the same wgpu eframe / egui-wgpu use) +wgpu = { version = "30.0.1", features = ["fragile-send-sync-non-atomic-wasm"] } +bytemuck = "1" +pollster = "1" +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 = "5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87", 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"] } +eframe = { version = "0.37", default-features = false } +# Resizable table columns (About ▸ Contributors / Models); no image loaders. +egui_extras = { version = "0.37", default-features = false } +egui_kittest = "0.37" +rfd = "0.17" +cpal = "0.16" +# The operating system's interface language (MIT/Apache-2.0, no dependencies on desktop). +sys-locale = "0.3" + +# Local co-development against a FilmCraft checkout next to this repo: uncomment. +# [patch."https://github.com/storytold/filmcraft"] +# filmcraft-codecs = { path = "../filmcraft/crates/codecs" } +# filmcraft-media = { path = "../filmcraft/crates/media" } +# filmcraft-frame = { path = "../filmcraft/crates/frame" } +# filmcraft-color = { path = "../filmcraft/crates/color" } +# filmcraft-time = { path = "../filmcraft/crates/time" } + +[workspace.lints.rust] +unsafe_code = "forbid" + +[workspace.lints.clippy] +cognitive_complexity = "deny" +too_many_arguments = "deny" +wildcard_imports = "deny" +dbg_macro = "warn" +todo = "warn" +needless_range_loop = "allow" +type_complexity = "allow" + +[profile.dev.package."*"] +opt-level = 2 +debug = false + +[profile.dev] +opt-level = 1 +# Panics and backtraces keep file and line; full debug info only made the many test binaries large. +debug = "line-tables-only" + +# Same settings as `dev`, but with full debug info for interactive debugger sessions: local +# variables, parameters and column breakpoints work. Use `--profile dev-full` when debugging; +# everything else stays on the fast default. See CONTRIBUTING.md, "Setup". +[profile.dev-full] +inherits = "dev" +debug = true + +# Pixel hot loops: keep debug builds interactive. +[profile.dev.package.effectcraft-raster] +opt-level = 3 + +[profile.dev.package.effectcraft-render] +opt-level = 3 + +[profile.dev.package.effectcraft-gpu] +opt-level = 3 + +[profile.dev.package.effectcraft-effects] +opt-level = 3 + +[profile.dev.package.effectcraft-track] +opt-level = 3 + +[profile.dev.package.effectcraft-path] +opt-level = 3 + +[profile.dev.package.effectcraft-media] +opt-level = 3 + +[profile.dev.package.effectcraft-export] +opt-level = 3 + +# craft-libs codec hot loops. +[profile.dev.package.craft-video] +opt-level = 3 + +[profile.dev.package.craft-audio] +opt-level = 3 + +[profile.dev.package.craft-media] +opt-level = 3 + +# FilmCraft codec hot loops (same settings as FilmCraft's own workspace). +[profile.dev.package.filmcraft-h264] +opt-level = 3 + +[profile.dev.package.filmcraft-hevc] +opt-level = 3 + +[profile.dev.package.filmcraft-vp9] +opt-level = 3 + +[profile.dev.package.filmcraft-dnx] +opt-level = 3 + +[profile.dev.package.filmcraft-av1] +opt-level = 3 + +[profile.release] +lto = "thin" +codegen-units = 1 + +[patch.crates-io] +hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "808730f49b9637b7909fe2ae56f9d63fdb100cae", version = "=0.7.2" } +hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "808730f49b9637b7909fe2ae56f9d63fdb100cae", 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" } +epaint_default_fonts = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } +egui = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } +egui-winit = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } +egui-wgpu = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } +egui_glow = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } +egui_extras = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } +egui_kittest = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } +eframe = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } +# Patch a crate only together with the dependency that needs it: an unused patch makes the Nix +# build, which uses vendored sources, fail (`cargo xtask lock-patches`). +winit = { git = "https://github.com/storytold/winit.git", rev = "a517b3846ee8457d84ee4975110bfda6797c44dc" } diff --git a/crates/effects/src/catalog.rs b/crates/effects/src/catalog.rs index 7fcb024bf..c7eecaaf3 100644 --- a/crates/effects/src/catalog.rs +++ b/crates/effects/src/catalog.rs @@ -147,7 +147,7 @@ pub fn effects_markdown() -> String { - **Status**: {} implemented in full, {partial} partial (what is missing is listed).\n\n", r.len() - partial )); - s.push_str("Effects are addressed by id (`ec..`) or display name in commands, scripts and the control channel, and every parameter by its id (`effects/#1/blurriness`).\n\n"); + s.push_str("Effects are addressed by id (`ec..`) or display name in commands, scripts and the control channel, and every parameter by its id (`effects/#1/blurriness`). A parameter that was renamed keeps its old name working in expressions of older projects: `effect(\"CC Ball Action\")(\"Instability State\")` still reads Scatter Motion.\n\n"); for cat in CATEGORIES { let list: Vec<_> = r.iter().filter(|e| e.category == *cat).collect(); if list.is_empty() { diff --git a/crates/effects/src/migrate.rs b/crates/effects/src/migrate.rs index 702ec9732..146660353 100644 --- a/crates/effects/src/migrate.rs +++ b/crates/effects/src/migrate.rs @@ -44,6 +44,9 @@ pub const PARAM_ID_ALIASES: &[(&str, &str, &str)] = &[ ("ec.key.innerouter", "additionalBackground", "additionalBackground/background1"), // Generate: Radio Waves' growth speed was called Velocity; Velocity now moves the wave. ("ec.generate.radiowaves", "velocity", "waveMotion/expansion"), + // Simulation: CC Ball Action's Instability State is treated as the control After Effects + // 24.2 calls Scatter Motion (#3197; an assumption: 24.2 shows no Instability State). + ("ec.sim.ccballaction", "instabilityState", "scatterMotion"), ]; /// Popup option labels renamed since they were first saved: @@ -192,6 +195,14 @@ fn take_at(g: &mut PropGroup, id: &str) -> Option { } } +/// The position of the property at spec id `id` (`a/b/param`) among its siblings. +fn index_at(g: &PropGroup, id: &str) -> Option { + match id.split_once('/') { + None => g.children.iter().position(|c| matches!(c, Node::Prop(p) if p.match_id == id)), + Some((first, rest)) => index_at(g.sub(first)?, rest), + } +} + fn prop_at<'a>(g: &'a mut PropGroup, id: &str) -> Option<&'a mut Property> { match id.split_once('/') { None => g.get_mut(id), @@ -279,6 +290,12 @@ pub fn upgrade_instance(spec: &EffectSpec, g: &mut PropGroup, ids: &mut Ids, lay // before it moved into a twirl-down group. let found = prop_at(g, ps.id).is_some(); if !found { + // A parameter renamed within its group keeps its place, so expressions that address + // it by index still read it. + let slot = PARAM_ID_ALIASES + .iter() + .filter(|(e, old, new)| *e == spec.id && *new == ps.id && old.rsplit_once('/').map(|(p, _)| p) == new.rsplit_once('/').map(|(p, _)| p)) + .find_map(|(_, old, _)| index_at(g, old)); let moved = PARAM_ID_ALIASES.iter().filter(|(e, _, new)| *e == spec.id && *new == ps.id).find_map(|(_, old, _)| take_at(g, old)).or_else(|| { let leaf = ps.id.rsplit('/').next().unwrap_or(ps.id); // Not when the top-level leaf is an old id of another parameter (Radio @@ -300,9 +317,13 @@ pub fn upgrade_instance(spec: &EffectSpec, g: &mut PropGroup, ids: &mut Ids, lay pr } }; + let at = |sub: &mut PropGroup| match slot { + Some(i) if i <= sub.children.len() => sub.children.insert(i, pr.into()), + _ => sub.children.push(pr.into()), + }; match path.and_then(|path| group_at(g, ids, path)) { - Some(sub) => sub.children.push(pr.into()), - None => g.children.push(pr.into()), + Some(sub) => at(sub), + None => at(g), } } if let Some(pr) = prop_at(g, ps.id) { @@ -631,6 +652,27 @@ mod tests { assert_eq!((&pr.ui, &pr.value), (&ParamUi::Point, &Value::Vec2([20.0, -5.0]))); } + /// #3197 review: an old CC Ball Action saved Instability State as its 8th property; renamed to + /// Scatter Motion it keeps that place, so an expression that reads `effect(..)(8)` still gets + /// the same control (new controls are appended after it). + #[test] + fn upgrade_renames_a_param_in_place_and_keeps_its_index() { + let spec = find("ec.sim.ccballaction").unwrap(); + let mut next = 1; + let mut g = instantiate(spec, &mut Ids(&mut next), "Ball Grid", [100.0, 50.0]); + // The layout an earlier version saved: eight parameters, Instability State last. + let old = ["scatter", "rotationAxis", "rotation", "twistProperty", "twistAngle", "gridSpacing", "ballSize", "scatterMotion"]; + let mut kept: Vec = old.iter().map(|id| take_prop(&mut g, id).unwrap()).collect(); + g.children.clear(); + kept[7].match_id = "instabilityState".into(); + kept[7].value = Value::Scalar(33.0); + g.children.extend(kept.into_iter().map(Node::from)); + assert!(upgrade_instance(spec, &mut g, &mut Ids(&mut next), [100.0, 50.0])); + let ids: Vec<&str> = g.children.iter().take(8).map(|c| c.match_id()).collect(); + assert_eq!(ids, ["scatter", "rotationAxis", "rotation", "twistProperty", "twistAngle", "gridSpacing", "ballSize", "scatterMotion"]); + assert_eq!(g.get("scatterMotion").unwrap().value, Value::Scalar(33.0)); + } + #[test] fn upgrade_moves_params_into_twirl_down_groups() { let spec = find(crate::warp_stab::ID).unwrap(); diff --git a/crates/effects/src/sim/sprites.rs b/crates/effects/src/sim/sprites.rs index 55ba594b4..031bee978 100644 --- a/crates/effects/src/sim/sprites.rs +++ b/crates/effects/src/sim/sprites.rs @@ -93,6 +93,10 @@ pub enum Shape { Disc, /// Lit sphere (upper-left light, specular). Sphere, + /// CC Ball Action's ball: [`Shape::Sphere`]'s light and shine scaled by `|shade|` (1 is the + /// sphere's look, 0 a flat disc; callers keep it finite, the GPU draws the same); a negative + /// `shade` mirrors the light's direction (lit from the lower right). + Ball { shade: f32 }, /// Disc fading linearly to its rim. Faded, /// Thin ring with a highlight. @@ -277,6 +281,24 @@ fn sprite_shade(s: &Sprite, x: f32, y: f32) -> Option { rgb = [rgb[0] * k + spec, rgb[1] * k + spec, rgb[2] * k + spec]; cv } + Shape::Ball { shade } => { + let d = (dx * dx + dy * dy).sqrt(); + let cv = aa(r - d); + if cv <= 0.0 { + return None; + } + let (nx, ny) = (dx / r, dy / r); + let nz = (1.0 - nx * nx - ny * ny).max(0.0).sqrt(); + let m = if shade < 0.0 { -1.0 } else { 1.0 }; + let (lx, ly, lz) = (-0.48 * m, -0.58 * m, 0.66); + let diff = (nx * lx + ny * ly + nz * lz).max(0.0); + let rz = 2.0 * diff * nz - lz; + let st = shade.abs(); + let spec = rz.max(0.0).powi(20) * 0.6 * st; + let k = (1.0 - st * 0.8 * (1.0 - diff)).max(0.0); + rgb = [rgb[0] * k + spec, rgb[1] * k + spec, rgb[2] * k + spec]; + cv + } Shape::Bubble => { let d = (dx * dx + dy * dy).sqrt() / r; if d > 1.0 + 1.0 / r { diff --git a/crates/effects/src/sim2/pixels.rs b/crates/effects/src/sim2/pixels.rs index 2cda428db..4fed8da59 100644 --- a/crates/effects/src/sim2/pixels.rs +++ b/crates/effects/src/sim2/pixels.rs @@ -4,10 +4,91 @@ use super::{Acc, Buf, EffectCtx, IntoParallelIterator, ParallelIterator, Post, S // ------------------------------------------------------------------ CC Ball Action +/// CC Ball Action's Coloring: how a ball takes its colour from the layer under its grid cell. +/// An approximation: After Effects' own meaning is not published beyond "how smooth the +/// balls look". Crisp takes the nearest pixel, Medium keeps EffectCraft's earlier smooth +/// sample at the cell centre (for compatibility), Smooth averages 16 samples over the cell. +pub(super) const BALL_COLORING: &[&str] = &["Crisp", "Medium", "Smooth"]; +pub(super) const BALL_COLORING_MEDIUM: u32 = 1; +/// CC Ball Action's default Shading: the lit sphere (`Shape::Sphere`); 0 draws flat discs. +pub(super) const BALL_SHADING_DEFAULT: f64 = -75.0; +/// CC Ball Action's Displace Property: what pushes a ball towards (high values) or away from +/// (low values) the camera. The option names come from public descriptions; what Radius, +/// Diamond and Spherize compute here is an assumption pending a comparison with After Effects. +pub(super) const BALL_DISPLACE_PROPERTIES: &[&str] = &["Red", "Green", "Blue", "Brightness", "Saturation", "RGB", "Radius", "Diamond", "Spherize"]; +pub(super) const BALL_DISPLACE_BRIGHTNESS: u32 = 3; + pub(super) fn ball_action(ctx: &EffectCtx, b: Buf) -> Buf { ball_action_plan(ctx, &b).finish(b) } +/// A parameter's number, or `default` when the instance does not carry it. +fn f_or(ctx: &EffectCtx, id: &str, default: f64) -> f64 { + ctx.params.values.get(id).map(|v| v.as_f64()).unwrap_or(default) +} + +/// The layer's straight colour and alpha for the ball of the grid cell centred on (`sx`, `sy`) +/// (buffer pixels, cell `cell` buffer pixels wide), by Coloring `coloring`. +fn ball_color(src: &effectcraft_raster::Image, sx: f64, sy: f64, cell: f64, coloring: u32) -> ([f32; 3], f32) { + match coloring { + // Crisp: the pixel under the cell centre. + 0 => unpremul(src.get(sx.floor() as i64, sy.floor() as i64)), + // Smooth: the cell's average (4 × 4 samples, premultiplied). + 2 => { + const N: u32 = 4; + let mut acc = [0.0f32; 4]; + for j in 0..N { + for i in 0..N { + let ox = (f64::from(i) + 0.5) / f64::from(N) - 0.5; + let oy = (f64::from(j) + 0.5) / f64::from(N) - 0.5; + let p = src.sample_bilinear(sx + ox * cell, sy + oy * cell); + for (a, v) in acc.iter_mut().zip(p) { + *a += v; + } + } + } + let n = (N * N) as f32; + unpremul([acc[0] / n, acc[1] / n, acc[2] / n, acc[3] / n]) + } + // Medium: a smooth sample at the cell centre. + _ => unpremul(src.sample_bilinear(sx, sy)), + } +} + +/// CC Ball Action's Displace Property `prop` (0..1) for a ball of straight colour `c` at +/// (`gx`, `gy`) on a `lw` × `lh` layer (`maxr`: half its diagonal). Assumed meanings (not +/// compared with After Effects yet): Radius, Diamond and Spherize are shapes that peak at the +/// layer centre. +fn ball_displace_value(prop: u32, c: [f32; 3], gx: f32, gy: f32, lw: f32, lh: f32, maxr: f32) -> f32 { + let (cx, cy) = (lw * 0.5, lh * 0.5); + let v = match prop { + 0 => c[0], + 1 => c[1], + 2 => c[2], + // Brightness: the brightest channel (HSB brightness). + 3 => c[0].max(c[1]).max(c[2]), + // Saturation: HSB saturation. + 4 => { + let mx = c[0].max(c[1]).max(c[2]); + let mn = c[0].min(c[1]).min(c[2]); + if mx > 0.0 { (mx - mn) / mx } else { 0.0 } + } + // RGB: the channels' mean. + 5 => (c[0] + c[1] + c[2]) / 3.0, + // Radius: high at the centre, low at the corners. + 6 => 1.0 - (gx - cx).hypot(gy - cy) / maxr.max(1.0), + // Diamond: high at the centre, falling linearly to the edge midpoints' diamond. + 7 => 1.0 - ((gx - cx).abs() / cx.max(0.5) + (gy - cy).abs() / cy.max(0.5)) * 0.5, + // Spherize: a hemisphere over the largest centred circle. + _ => { + let rr = cx.min(cy).max(0.5); + let d = (gx - cx).hypot(gy - cy) / rr; + (1.0 - d * d).max(0.0).sqrt() + } + }; + if v.is_finite() { v.clamp(0.0, 1.0) } else { 0.0 } +} + /// CC Ball Action's balls (far to near), coloured by the layer's pixels. fn ball_action_plan(ctx: &EffectCtx, b: &Buf) -> SpritePlan { let pr = ctx.params; @@ -18,7 +99,29 @@ fn ball_action_plan(ctx: &EffectCtx, b: &Buf) -> SpritePlan { let twist = pr.f("twistAngle").to_radians(); let spacing = pr.f("gridSpacing").max(1.0) as f32; let size = pr.f("ballSize") as f32 / 100.0; - let instab = pr.f("instabilityState").to_radians() as f32; + // Scatter Motion, treated as the renamed Instability State (an assumption: After Effects + // 24.2 shows Scatter Motion and no Instability State): turns each ball's scatter direction. + let instab = pr.f("scatterMotion").to_radians() as f32; + let coloring = pr.values.get("coloring").map(|v| v.as_enum()).unwrap_or(BALL_COLORING_MEDIUM); + let shading = f_or(ctx, "shading", BALL_SHADING_DEFAULT); + // Shading: -75 is the lit sphere as it always was, 0 flat discs; the magnitude scales the + // light and shine (strength 1 at 75) and the sign mirrors the light's direction (positive + // lights the balls from the lower right). How this compares with After Effects' sign + // (described as concave versus convex) is unverified, as is the -100..100 range. + let shape = if shading == BALL_SHADING_DEFAULT || !shading.is_finite() { + Shape::Sphere + } else if shading == 0.0 { + Shape::Disc + } else { + // Clamped: a huge value would reach the GPU as an infinite strength (and NaN colours). + Shape::Ball { shade: (-shading.clamp(-100.0, 100.0) / 75.0) as f32 } + }; + // Displace: pushes each ball along z by its Displace Property (high values towards the + // camera, pivoting at the property's middle value); 100 moves the extremes by half the + // layer's diagonal. Scale, direction, pivot and range are EffectCraft's own choice, + // pending a comparison with After Effects. Clamped so huge values stay finite. + let displace = pr.f("displace").clamp(-1000.0, 1000.0) as f32; + let displace_prop = pr.values.get("displaceProperty").map(|v| v.as_enum()).unwrap_or(BALL_DISPLACE_BRIGHTNESS); let seed = ctx.seed.wrapping_mul(0x2545f491); let (lw, lh) = (ctx.layer_size[0] as f32, ctx.layer_size[1] as f32); let s = b.scale as f32; @@ -43,7 +146,7 @@ fn ball_action_plan(ctx: &EffectCtx, b: &Buf) -> SpritePlan { let gx = (i % nx) as f32 * spacing + spacing * 0.5; let gy = (i / nx) as f32 * spacing + spacing * 0.5; let (sx, sy) = b.to_px([gx as f64, gy as f64]); - let (c, a) = unpremul(src.sample_bilinear(sx, sy)); + let (c, a) = ball_color(src, sx, sy, f64::from(spacing * s), coloring); if a <= 0.0 || size <= 0.0 { return None; } @@ -54,11 +157,16 @@ fn ball_action_plan(ctx: &EffectCtx, b: &Buf) -> SpritePlan { _ => crate::util::rgb3([c[0], c[1], c[2], 0.0]).iter().sum::() / 3.0, } as f64; let ang = rot + twist * tp; - // Scatter: random 3D offsets whose direction drifts with the instability state. + // Scatter: random 3D offsets whose direction drifts with Scatter Motion. let ph = h(i, 1, seed) * std::f32::consts::TAU + instab; let sc = scatter * h(i, 2, seed); let off = [(sc * ph.cos()) as f64, (sc * ph.sin()) as f64, (scatter * hs(i, 3, seed)) as f64]; - let p0 = [gx as f64 - cx + off[0], gy as f64 - cy + off[1], off[2]]; + let mut p0 = [gx as f64 - cx + off[0], gy as f64 - cy + off[1], off[2]]; + // Only when set, so Displace 0 leaves every depth (and the far-to-near order) as is. + if displace != 0.0 && displace.is_finite() { + let v = ball_displace_value(displace_prop, c, gx, gy, lw, lh, maxr); + p0[2] -= f64::from(displace / 100.0 * (v - 0.5) * 2.0 * maxr); + } let m = rot_axis(ax, ang); let q: [f64; 3] = std::array::from_fn(|k| m[k][0] * p0[0] + m[k][1] * p0[1] + m[k][2] * p0[2]); if d + q[2] <= d * 0.05 { @@ -67,7 +175,7 @@ fn ball_action_plan(ctx: &EffectCtx, b: &Buf) -> SpritePlan { let persp = d / (d + q[2]); let (bx, by) = b.to_px([cx + q[0] * persp, cy + q[1] * persp]); let r = spacing * 0.5 * size * persp as f32 * s; - Some((q[2], Sprite::new(bx as f32, by as f32, r, [c[0], c[1], c[2], a], Shape::Sphere))) + Some((q[2], Sprite::new(bx as f32, by as f32, r, [c[0], c[1], c[2], a], shape))) }) .collect(); balls.sort_by(|a, b| b.0.total_cmp(&a.0)); diff --git a/crates/effects/src/sim2/registry.rs b/crates/effects/src/sim2/registry.rs index dc64b7097..1e38a504e 100644 --- a/crates/effects/src/sim2/registry.rs +++ b/crates/effects/src/sim2/registry.rs @@ -1,5 +1,7 @@ use super::foam::{FOAM_TEXTURES, foam}; -use super::pixels::{ball_action, pixel_polly, scatterize}; +use super::pixels::{ + BALL_COLORING, BALL_COLORING_MEDIUM, BALL_DISPLACE_BRIGHTNESS, BALL_DISPLACE_PROPERTIES, BALL_SHADING_DEFAULT, ball_action, pixel_polly, scatterize, +}; use super::shatter::{CD_PROPS, CD_SOURCES, SHATTER_PATTERNS, SHATTER_TEXTURE_MODES, card_dance, shatter}; use super::surfaces::{caustics, wave_world}; use super::{EffectSpec, ParamUi, Value, col, num, p, pct, popup, pt, slider, spec}; @@ -80,15 +82,22 @@ pub fn specs() -> Vec { spec( "ec.sim.ccballaction", "Ball Grid", + // After Effects' order and defaults since 24.2 (#3197). Scatter Motion is treated as + // the renamed Instability State (an assumption, `migrate::PARAM_ID_ALIASES`). The + // Shading range is not published; -100..100 is an assumption. vec![ + p("gridSpacing", "Grid Spacing", num(5.0), slider(1.0, 200.0, 1.0, 50.0, 0)), + p("ballSize", "Ball Size", num(100.0), slider(0.0, 400.0, 0.0, 200.0, 1)), + p("coloring", "Coloring", Value::Enum(BALL_COLORING_MEDIUM), popup(BALL_COLORING)), + p("shading", "Shading", num(BALL_SHADING_DEFAULT), slider(-100.0, 100.0, -100.0, 100.0, 1)), p("scatter", "Scatter", num(0.0), slider(0.0, 2000.0, 0.0, 300.0, 1)), + p("scatterMotion", "Scatter Motion", num(0.0), ParamUi::Angle), + p("displace", "Displace", num(0.0), slider(-1000.0, 1000.0, 0.0, 100.0, 1)), + p("displaceProperty", "Displace Property", Value::Enum(BALL_DISPLACE_BRIGHTNESS), popup(BALL_DISPLACE_PROPERTIES)), + p("twistAngle", "Twist Angle", num(0.0), ParamUi::Angle), + p("twistProperty", "Twist Property", Value::Enum(0), popup(&["X Axis", "Y Axis", "Radius", "Brightness"])), p("rotationAxis", "Rotation Axis", Value::Enum(0), popup(&["X Axis", "Y Axis", "Z Axis", "XY Axis", "XZ Axis", "YZ Axis", "XYZ Axis"])), p("rotation", "Rotation", num(0.0), ParamUi::Angle), - p("twistProperty", "Twist Property", Value::Enum(0), popup(&["X Axis", "Y Axis", "Radius", "Brightness"])), - p("twistAngle", "Twist Angle", num(0.0), ParamUi::Angle), - p("gridSpacing", "Grid Spacing", num(4.0), slider(1.0, 200.0, 1.0, 50.0, 0)), - p("ballSize", "Ball Size", num(40.0), slider(0.0, 400.0, 0.0, 200.0, 1)), - p("instabilityState", "Instability State", num(0.0), ParamUi::Angle), ], ball_action, ), diff --git a/crates/effects/src/sim2/tests.rs b/crates/effects/src/sim2/tests.rs index 2ef35b122..6ad6eb21c 100644 --- a/crates/effects/src/sim2/tests.rs +++ b/crates/effects/src/sim2/tests.rs @@ -46,6 +46,138 @@ fn ball_action_draws_balls() { assert!(sum_diff(&a, &sc) > 1.0); } +/// #3197: CC Ball Action has After Effects' controls (since 24.2), in its order, with its +/// defaults: Coloring, Shading, Scatter Motion (formerly Instability State), Displace and +/// Displace Property were missing. +#[test] +fn ball_action_has_after_effects_controls() { + let spec = crate::find("ec.sim.ccballaction").unwrap(); + let names: Vec<&str> = spec.params.iter().map(|p| p.name).collect(); + assert_eq!( + names, + [ + "Grid Spacing", + "Ball Size", + "Coloring", + "Shading", + "Scatter", + "Scatter Motion", + "Displace", + "Displace Property", + "Twist Angle", + "Twist Property", + "Rotation Axis", + "Rotation" + ] + ); + let sp = |id: &str| spec.params.iter().find(|p| p.id == id).unwrap_or_else(|| panic!("no {id}")); + assert_eq!(sp("gridSpacing").default, num(5.0)); + assert_eq!(sp("ballSize").default, num(100.0)); + assert_eq!(sp("coloring").default, Value::Enum(1)); + assert_eq!(sp("coloring").ui, ParamUi::Popup { options: vec!["Crisp".into(), "Medium".into(), "Smooth".into()] }); + assert_eq!(sp("shading").default, num(-75.0)); + assert!(matches!(sp("shading").ui, ParamUi::Slider { min, max, .. } if min <= -100.0 && max >= 100.0)); + assert_eq!(sp("scatterMotion").default, num(0.0)); + assert_eq!(sp("scatterMotion").ui, ParamUi::Angle); + assert_eq!(sp("displace").default, num(0.0)); + let ParamUi::Popup { options } = &sp("displaceProperty").ui else { panic!("Displace Property is a popup") }; + let Value::Enum(d) = sp("displaceProperty").default else { panic!("Displace Property defaults to an option") }; + assert_eq!(options.get(d as usize).map(String::as_str), Some("Brightness")); + // Old projects' Instability State becomes Scatter Motion through `PARAM_ID_ALIASES`; the + // engine test `opening_an_old_project_upgrades_effect_instances` covers every alias. +} + +/// #3197: the new controls at After Effects' defaults draw exactly what CC Ball Action drew +/// before (the lit sphere, a smooth colour sample, no displacement). +#[test] +fn ball_action_new_controls_at_defaults_keep_the_render() { + let base = [("ballSize", num(80.0)), ("scatter", num(6.0)), ("rotationAxis", Value::Enum(1)), ("rotation", num(25.0))]; + let a = run("ec.sim.ccballaction", &base, ramp(32, 32), 0.0); + let mut explicit = base.to_vec(); + explicit.extend([ + ("coloring", Value::Enum(1)), + ("shading", num(-75.0)), + ("scatterMotion", num(0.0)), + ("displace", num(0.0)), + ("displaceProperty", Value::Enum(3)), + ]); + assert_eq!(a, run("ec.sim.ccballaction", &explicit, ramp(32, 32), 0.0)); +} + +/// #3197: Shading 0 removes the built-in light: every ball is the layer's flat colour. The +/// default (-75) shades it; a smaller magnitude shades less, a positive value lights the balls +/// from the other side. +#[test] +fn ball_action_shading_zero_is_flat() { + let c = [0.6, 0.3, 0.2, 1.0]; + let shade = |v: f64| run("ec.sim.ccballaction", &[("ballSize", num(100.0)), ("gridSpacing", num(8.0)), ("shading", num(v))], Image::filled(32, 32, c), 0.0); + let flat = shade(0.0); + let covered: Vec<&[f32; 4]> = flat.data.iter().filter(|p| p[3] > 0.999).collect(); + assert!(!covered.is_empty(), "balls drawn"); + for p in &covered { + for k in 0..3 { + assert!((p[k] / p[3] - c[k]).abs() < 1e-4, "flat colour: {p:?}"); + } + } + let lit = shade(-75.0); + assert!(lit.data.iter().any(|p| p[3] > 0.999 && (0..3).any(|k| (p[k] / p[3] - c[k]).abs() > 0.05)), "the default shading lights and darkens the balls"); + let soft = shade(-30.0); + assert!(sum_diff(&flat, &soft) > 0.1 && sum_diff(&flat, &soft) < sum_diff(&flat, &lit), "less shading, closer to flat"); + assert!(sum_diff(&shade(75.0), &lit) > 1.0, "the sign moves the light"); +} + +/// #3197: Coloring Crisp takes the pixel under each ball's cell centre; Medium samples +/// smoothly between pixels. Grid Spacing 4 puts the cell centres on pixel corners (with the +/// default 5 they fall on pixel centres, where Medium's sample equals Crisp's). +#[test] +fn ball_action_coloring_crisp_takes_the_pixel() { + let mut src = Image::new(32, 32); + for y in 0..32u32 { + for x in 0..32u32 { + src.set(x, y, [x as f32 / 32.0, y as f32 / 32.0, ((x * 7 + y * 3) % 5) as f32 / 4.0, 1.0]); + } + } + let col = |m: u32| { + let v = [("gridSpacing", num(4.0)), ("ballSize", num(100.0)), ("shading", num(0.0)), ("coloring", Value::Enum(m))]; + run("ec.sim.ccballaction", &v, src.clone(), 0.0) + }; + let crisp = col(0); + // Flat, opaque balls of radius 2 centred on (4i + 2, 4j + 2): the pixel to the lower right + // of each centre is fully covered by its ball alone. + for j in 0..8i64 { + for i in 0..8i64 { + let (x, y) = (4 * i + 2, 4 * j + 2); + let (got, want) = (crisp.get(x, y), src.get(x, y)); + assert!((0..4).all(|k| (got[k] - want[k]).abs() < 1e-5), "ball ({i}, {j}): {got:?} vs the pixel {want:?}"); + } + } + assert!(sum_diff(&crisp, &col(1)) > 1.0, "medium blends the pixels"); +} + +/// #3197: a huge Shading (typed or from an expression) is clamped, so the balls stay finite. +#[test] +fn ball_action_huge_shading_stays_finite() { + for v in [1e45, -1e45, f64::MAX] { + let o = run("ec.sim.ccballaction", &[("gridSpacing", num(8.0)), ("shading", num(v))], ramp(32, 32), 0.0); + assert!(o.data.iter().all(|p| p.iter().all(|c| c.is_finite())), "shading {v}"); + assert!(o.data.iter().any(|p| p[3] > 0.0), "shading {v}: balls drawn"); + } +} + +/// #3197: Displace pushes the balls along z by the chosen property (Radius: the centre comes +/// towards the camera and grows); 0 leaves them in the layer's plane. +#[test] +fn ball_action_displace_moves_balls_in_depth() { + let flat = run("ec.sim.ccballaction", &[("ballSize", num(80.0))], ramp(32, 32), 0.0); + let d = run("ec.sim.ccballaction", &[("ballSize", num(80.0)), ("displace", num(60.0)), ("displaceProperty", Value::Enum(6))], ramp(32, 32), 0.0); + assert_eq!(d, run("ec.sim.ccballaction", &[("ballSize", num(80.0)), ("displace", num(60.0)), ("displaceProperty", Value::Enum(6))], ramp(32, 32), 0.0)); + assert!(sum_diff(&flat, &d) > 1.0); + for prop in 0..9 { + let o = run("ec.sim.ccballaction", &[("ballSize", num(80.0)), ("displace", num(400.0)), ("displaceProperty", Value::Enum(prop))], ramp(32, 32), 0.0); + assert!(o.data.iter().all(|p| p.iter().all(|v| v.is_finite())), "property {prop}"); + } +} + #[test] fn pixel_polly_breaks_after_start() { let v = [("forceCenter", pt(16.0, 16.0)), ("gridSpacing", num(4.0))]; diff --git a/crates/effects/tests/it/particle_golden.rs b/crates/effects/tests/it/particle_golden.rs index 0dbf19d76..5d0b255b1 100644 --- a/crates/effects/tests/it/particle_golden.rs +++ b/crates/effects/tests/it/particle_golden.rs @@ -192,7 +192,7 @@ fn cases() -> Vec<(&'static str, Vec)> { vec![ vec![], vec![("scatter", n(20.0)), ("rotationAxis", e(6)), ("rotation", n(40.0)), ("twistProperty", e(3)), ("twistAngle", n(90.0))], - vec![("gridSpacing", n(2.0)), ("ballSize", n(80.0)), ("instabilityState", n(45.0)), ("twistProperty", e(2)), ("twistAngle", n(30.0))], + vec![("gridSpacing", n(2.0)), ("ballSize", n(80.0)), ("scatterMotion", n(45.0)), ("twistProperty", e(2)), ("twistAngle", n(30.0))], ], ), ( @@ -538,26 +538,26 @@ const GOLDEN: &[(&str, u64)] = &[ ("ec.sim.particleplayground/8/32bpc/t1.5", 0xb5b7f0281f26baad), ("ec.sim.particleplayground/8/32bpc/t0.8", 0x8b6934363ef4dcfd), ("ec.sim.particleplayground/8/32bpc/t2.2", 0x0a31c17e8e34b9f5), - ("ec.sim.ccballaction/0/8bpc/t0.5", 0x12698ec8353be38c), - ("ec.sim.ccballaction/0/8bpc/t1.5", 0x12698ec8353be38c), - ("ec.sim.ccballaction/0/8bpc/t0.8", 0x12698ec8353be38c), - ("ec.sim.ccballaction/0/8bpc/t2.2", 0x12698ec8353be38c), - ("ec.sim.ccballaction/0/32bpc/t0.5", 0x3fb733487e120261), - ("ec.sim.ccballaction/0/32bpc/t1.5", 0x3fb733487e120261), - ("ec.sim.ccballaction/0/32bpc/t0.8", 0x3fb733487e120261), - ("ec.sim.ccballaction/0/32bpc/t2.2", 0x3fb733487e120261), - ("ec.sim.ccballaction/0/8bpc/half/t0.5", 0x4946070917cc0945), - ("ec.sim.ccballaction/0/8bpc/half/t1.5", 0x4946070917cc0945), - ("ec.sim.ccballaction/0/8bpc/half/t0.8", 0x4946070917cc0945), - ("ec.sim.ccballaction/0/8bpc/half/t2.2", 0x4946070917cc0945), - ("ec.sim.ccballaction/1/8bpc/t0.5", 0xf34b3be38a4dd468), - ("ec.sim.ccballaction/1/8bpc/t1.5", 0xf34b3be38a4dd468), - ("ec.sim.ccballaction/1/8bpc/t0.8", 0xf34b3be38a4dd468), - ("ec.sim.ccballaction/1/8bpc/t2.2", 0xf34b3be38a4dd468), - ("ec.sim.ccballaction/1/32bpc/t0.5", 0x503b7238edf2912c), - ("ec.sim.ccballaction/1/32bpc/t1.5", 0x503b7238edf2912c), - ("ec.sim.ccballaction/1/32bpc/t0.8", 0x503b7238edf2912c), - ("ec.sim.ccballaction/1/32bpc/t2.2", 0x503b7238edf2912c), + ("ec.sim.ccballaction/0/8bpc/t0.5", 0x5f7401d3d1e5a513), + ("ec.sim.ccballaction/0/8bpc/t1.5", 0x5f7401d3d1e5a513), + ("ec.sim.ccballaction/0/8bpc/t0.8", 0x5f7401d3d1e5a513), + ("ec.sim.ccballaction/0/8bpc/t2.2", 0x5f7401d3d1e5a513), + ("ec.sim.ccballaction/0/32bpc/t0.5", 0x9cf15a7756ab88ed), + ("ec.sim.ccballaction/0/32bpc/t1.5", 0x9cf15a7756ab88ed), + ("ec.sim.ccballaction/0/32bpc/t0.8", 0x9cf15a7756ab88ed), + ("ec.sim.ccballaction/0/32bpc/t2.2", 0x9cf15a7756ab88ed), + ("ec.sim.ccballaction/0/8bpc/half/t0.5", 0xe2e3a624434f8e88), + ("ec.sim.ccballaction/0/8bpc/half/t1.5", 0xe2e3a624434f8e88), + ("ec.sim.ccballaction/0/8bpc/half/t0.8", 0xe2e3a624434f8e88), + ("ec.sim.ccballaction/0/8bpc/half/t2.2", 0xe2e3a624434f8e88), + ("ec.sim.ccballaction/1/8bpc/t0.5", 0x07382912d068a625), + ("ec.sim.ccballaction/1/8bpc/t1.5", 0x07382912d068a625), + ("ec.sim.ccballaction/1/8bpc/t0.8", 0x07382912d068a625), + ("ec.sim.ccballaction/1/8bpc/t2.2", 0x07382912d068a625), + ("ec.sim.ccballaction/1/32bpc/t0.5", 0xa1e843936e72815f), + ("ec.sim.ccballaction/1/32bpc/t1.5", 0xa1e843936e72815f), + ("ec.sim.ccballaction/1/32bpc/t0.8", 0xa1e843936e72815f), + ("ec.sim.ccballaction/1/32bpc/t2.2", 0xa1e843936e72815f), ("ec.sim.ccballaction/2/8bpc/t0.5", 0x0b6bf26753ee4582), ("ec.sim.ccballaction/2/8bpc/t1.5", 0x0b6bf26753ee4582), ("ec.sim.ccballaction/2/8bpc/t0.8", 0x0b6bf26753ee4582), diff --git a/crates/engine/src/tests/lut_files.rs b/crates/engine/src/tests/lut_files.rs index 98c95652a..6f6818b23 100644 --- a/crates/engine/src/tests/lut_files.rs +++ b/crates/engine/src/tests/lut_files.rs @@ -192,7 +192,7 @@ fn an_overridden_lut_file_renders_again() { #[test] fn ocio_files_render_again_from_warm_caches() { let dir = tempfile::tempdir().unwrap(); - let (lut, config, grade) = (dir.path().join("file.cube"), dir.path().join("config.ocio"), dir.path().join("luts/grade.cube")); + let (lut, config, grade) = (dir.path().join("file.cube"), dir.path().join("config.ocio"), dir.path().join("luts").join("grade.cube")); std::fs::create_dir_all(dir.path().join("luts")).unwrap(); write(&lut, BLACK, 1_000); write(&grade, BLACK, 1_000); diff --git a/crates/expr/Cargo.toml b/crates/expr/Cargo.toml index 6f157698b..a0cb29945 100644 --- a/crates/expr/Cargo.toml +++ b/crates/expr/Cargo.toml @@ -11,6 +11,7 @@ workspace = true [dependencies] effectcraft-time = { workspace = true } +effectcraft-effects = { workspace = true } effectcraft-geom = { workspace = true } effectcraft-keyframe = { workspace = true } serde_json = { workspace = true } @@ -25,5 +26,4 @@ boa_engine = { workspace = true, features = ["js"] } [dev-dependencies] effectcraft-color = { workspace = true } -effectcraft-effects = { workspace = true } effectcraft-text = { workspace = true } diff --git a/crates/expr/src/host.rs b/crates/expr/src/host.rs index c397299ae..90ef00c4a 100644 --- a/crates/expr/src/host.rs +++ b/crates/expr/src/host.rs @@ -7,6 +7,7 @@ //! the answers and runs the script again. Expressions are pure functions of these answers, so //! re-running is exact, and the runtime stays free of borrowed state. +use effectcraft_effects::migrate::PARAM_ID_ALIASES; use effectcraft_geom::{Mat3, Mat4}; use effectcraft_keyframe::Value; use effectcraft_project::ae_order::{self, AeChild}; @@ -300,10 +301,24 @@ fn find_child<'g>(g: &'g PropGroup, key: &Key) -> Option<&'g Node> { // An effect by its After Effects match name, an imported placeholder's effect id // (`effect("Pseudo/0.25")`; its match id is one path segment, `Pseudo_0_25`). .or_else(|| g.children.iter().find(|n| matches!(n.as_group().map(|g| &g.kind), Some(GroupKind::Effect { effect }) if effect == name))) + // Last, so a legacy name never shadows a current one. + .or_else(|| legacy_effect_child(g, &c)) } } } +/// A parameter of an effect instance addressed by a name it had when the project was saved +/// ([`PARAM_ID_ALIASES`]): `effect("CC Ball Action")("Instability State")` keeps reading the +/// parameter that is now Scatter Motion. `c` is the compacted (lowercase, no spaces) name. Only +/// renames inside the instance's own top-level group count; moves into twirl-downs do not. +fn legacy_effect_child<'g>(g: &'g PropGroup, c: &str) -> Option<&'g Node> { + let GroupKind::Effect { effect } = &g.kind else { return None }; + PARAM_ID_ALIASES + .iter() + .filter(|(e, old, new)| e == effect && !old.contains('/') && !new.contains('/') && compact(old) == c) + .find_map(|(_, _, new)| g.children.iter().find(|n| n.match_id() == *new)) +} + impl<'a> Resolver<'a> { fn comp(&self, c: u64) -> Option<&'a Comp> { if c == self.ctx.comp_id.0 { Some(self.ctx.comp) } else { self.ctx.project.comp(ItemId(c)) } diff --git a/crates/expr/src/tests.rs b/crates/expr/src/tests.rs index 4329d9c21..e4df95ac4 100644 --- a/crates/expr/src/tests.rs +++ b/crates/expr/src/tests.rs @@ -2145,6 +2145,89 @@ fn bench_evaluation() { } } +/// Layer A with an old-format CC Ball Action: Scatter Motion saved as `instabilityState` +/// ("Instability State"), opened through the migration (#3197). Scatter Motion is 37 and keyed +/// 10 at 0 s, 50 at 2 s. +fn old_ball_action() -> Fx { + let mut f = fx(); + let spec = effectcraft_effects::find("ec.sim.ccballaction").unwrap(); + let mut g = group_push(&mut f.p, |ids| effectcraft_effects::instantiate(spec, ids, "CC Ball Action", [20.0, 20.0])); + let sm = g.prop_mut("scatterMotion").unwrap(); + sm.value = Value::Scalar(37.0); + sm.keys = vec![Keyframe::new(Tick::ZERO, Value::Scalar(10.0)), Keyframe::new(secs(2.0), Value::Scalar(50.0))]; + sm.match_id = "instabilityState".into(); + sm.name = "Instability State".into(); + let mut next = f.p.next_id; + assert!(effectcraft_effects::migrate::upgrade_instance(spec, &mut g, &mut Ids(&mut next), [20.0, 20.0])); + f.p.next_id = next; + assert!(g.prop("scatterMotion").is_some(), "the migration renamed the parameter"); + f.p.comp_mut(f.cid).unwrap().layers[0].props.sub_mut("effects").unwrap().children.push(g.into()); + f +} + +#[test] +fn old_parameter_names_still_resolve_in_expressions() { + let f = old_ball_action(); + for name in ["Instability State", "instabilityState", "instability state", "InstabilityState"] { + // Keyframes still apply: the keyed value at 0 s, not the stored 37. + assert_close!(f.num(&format!("effect('CC Ball Action')('{name}')"), 0.0), 10.0); + assert_close!(f.num(&format!("effect('CC Ball Action')('{name}')"), 2.0), 50.0); + assert_close!(f.num(&format!("effect('CC Ball Action')('{name}').valueAtTime(2)"), 0.0), 50.0); + } + // Current names read the same property, unchanged. + for name in ["Scatter Motion", "scatterMotion"] { + assert_close!(f.num(&format!("effect('CC Ball Action')('{name}')"), 0.0), 10.0); + } +} + +#[test] +fn old_parameter_name_follows_the_parameter_expression() { + let mut f = old_ball_action(); + let p = f.p.comp_mut(f.cid).unwrap().layers[0].props.prop_mut("effects/#2/scatterMotion"); + let p = match p { + Some(p) => p, + None => panic!("scatterMotion at effects/#2"), + }; + p.expr = Some(Expression { text: "123".into(), enabled: true }); + assert_close!(f.num("effect('CC Ball Action')('Instability State')", 0.0), 123.0); +} + +#[test] +fn unknown_parameter_names_still_fail() { + let f = old_ball_action(); + assert!(f.ev(f.a, ROT, "effect('CC Ball Action')('No Such Thing')", 0.0).is_err()); + // Old names only exist on the effect they were renamed on. + assert!(f.ev(f.a, ROT, "effect('Slider Control')('Instability State')", 0.0).is_err()); +} + +/// Every in-group rename in the alias table keeps resolving by its old id and display name. +#[test] +fn every_in_group_alias_resolves_by_its_old_name() { + let mut n = 0; + for (effect, old, new) in effectcraft_effects::migrate::PARAM_ID_ALIASES { + if old.contains('/') || new.contains('/') { + continue; + } + let Some(spec) = effectcraft_effects::find(effect) else { continue }; + let mut f = fx(); + let g = group_push(&mut f.p, |ids| effectcraft_effects::instantiate(spec, ids, "Probe", [20.0, 20.0])); + f.p.comp_mut(f.cid).unwrap().layers[0].props.sub_mut("effects").unwrap().children.push(g.into()); + let (new_name, kind) = { + let l = &f.p.comp(f.cid).unwrap().layers[0]; + let p = l.props.prop(&format!("effects/#2/{new}")).unwrap(); + (p.name.clone(), p.value.clone()) + }; + if !matches!(kind, Value::Scalar(_)) { + continue; + } + let a = f.ev(f.a, ROT, &format!("effect('Probe')('{old}')"), 0.0).unwrap(); + let b = f.ev(f.a, ROT, &format!("effect('Probe')('{new_name}')"), 0.0).unwrap(); + assert_eq!(a, b, "{effect}: {old}"); + n += 1; + } + assert!(n >= 1); +} + /// Viewport clipping must never affect layer-space expression reads (#1388). #[test] fn sample_image_reads_3d_shape_behind_camera_before_and_after_effects() { diff --git a/crates/gpu/src/fx_sim.rs b/crates/gpu/src/fx_sim.rs index 944ca6c07..a3f0f7a0c 100644 --- a/crates/gpu/src/fx_sim.rs +++ b/crates/gpu/src/fx_sim.rs @@ -228,6 +228,8 @@ pub(crate) fn sprite_layer(e: &mut Enc, src: &GpuImage, plan: &SpritePlan) -> Op Shape::Square => (6.0, 0.0, 0.0), Shape::Tri => (7.0, 0.0, 0.0), Shape::Line { dx, dy } => (8.0, dx, dy), + // The strength rides in the (otherwise unused) first segment slot. + Shape::Ball { shade } => (9.0, shade, 0.0), }; let mut rec = [kind, s.x, s.y, s.r, s.c[0], s.c[1], s.c[2], s.c[3], s.rot, dx, dy, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]; match plan.tints.get(i).copied().unwrap_or(Tint::Fixed) { diff --git a/crates/gpu/src/shaders/fx_sim.wgsl b/crates/gpu/src/shaders/fx_sim.wgsl index 7deeac048..cf4a14a03 100644 --- a/crates/gpu/src/shaders/fx_sim.wgsl +++ b/crates/gpu/src/shaders/fx_sim.wgsl @@ -145,6 +145,27 @@ fn fxm_sprite(at: u32, x: f32, y: f32) -> FxmShade { } cov = fxm_aa(m); } + // sim::Shape::Ball (CC Ball Action's Shading): the sphere's light and shine scaled by + // |shade| (data[at + 9]), lit from the lower right when shade < 0. + case 9u: { + let d = sqrt(dx * dx + dy * dy); + let cv = fxm_aa(r - d); + if (cv <= 0.0) { + return fxm_none(); + } + let shade = data[at + 9u]; + let nx = dx / r; + let ny = dy / r; + let nz = sqrt(max(1.0 - nx * nx - ny * ny, 0.0)); + let m = select(1.0, -1.0, shade < 0.0); + let diff = max(nx * (-0.48 * m) + ny * (-0.58 * m) + nz * 0.66, 0.0); + let rz = 2.0 * diff * nz - 0.66; + let st = abs(shade); + let spec = powz(max(rz, 0.0), 20.0) * 0.6 * st; + let k = max(1.0 - st * 0.8 * (1.0 - diff), 0.0); + rgb = rgb * k + spec; + cov = cv; + } default: { let lx = data[at + 9u]; let ly = data[at + 10u]; diff --git a/crates/gpu/src/tests/fx_particles.rs b/crates/gpu/src/tests/fx_particles.rs index e8c3a7ce6..a4d531a37 100644 --- a/crates/gpu/src/tests/fx_particles.rs +++ b/crates/gpu/src/tests/fx_particles.rs @@ -141,7 +141,22 @@ fn ball_action_pixel_polly_scatterize() { 0.0, 0.0, ); - case("ec.sim.ccballaction", &[("gridSpacing", n(2.0)), ("ballSize", n(80.0)), ("instabilityState", n(45.0)), ("twistProperty", e(2))], 0.0, 0.0); + case("ec.sim.ccballaction", &[("gridSpacing", n(2.0)), ("ballSize", n(80.0)), ("scatterMotion", n(45.0)), ("twistProperty", e(2))], 0.0, 0.0); + // #3197: Shading (flat, weaker, stronger, lit from the other side), Coloring, Displace. + for shading in [0.0, -30.0, -100.0, 60.0, 1e45] { + case("ec.sim.ccballaction", &[("ballSize", n(80.0)), ("shading", n(shading))], 0.0, 0.0); + } + for coloring in [0, 2] { + case("ec.sim.ccballaction", &[("ballSize", n(80.0)), ("coloring", e(coloring))], 0.0, 0.0); + } + for prop in [3, 6, 8] { + case( + "ec.sim.ccballaction", + &[("ballSize", n(80.0)), ("rotationAxis", e(1)), ("rotation", n(30.0)), ("displace", n(40.0)), ("displaceProperty", e(prop))], + 0.0, + 0.0, + ); + } for object in 0..4 { case("ec.sim.ccpixelpolly", &[("object", e(object)), ("gridSpacing", n(6.0))], 0.6, 0.0); } diff --git a/crates/host/tests/it/timeline_interop.rs b/crates/host/tests/it/timeline_interop.rs index 9688a409f..8cdc2a4d1 100644 --- a/crates/host/tests/it/timeline_interop.rs +++ b/crates/host/tests/it/timeline_interop.rs @@ -54,6 +54,7 @@ fn still(p: &mut fp::Project, path: &str) -> fp::ItemId { codec: "png".into(), pixel_format: String::new(), color: Default::default(), + color_assumed: None, has_alpha: false, bitrate: None, hdr: None, @@ -75,7 +76,7 @@ fn still(p: &mut fp::Project, path: &str) -> fp::ItemId { identity: None, }; let name = path.rsplit('/').next().unwrap().to_string(); - p.add_item(&name, fp::Label::Iris, fp::ItemKind::Media(clip), None) + p.add_item(&name, fp::Label::Iris, fp::ItemKind::Media(Box::new(clip)), None) } /// V1: red for 2 s; V2: blue at 50 % opacity and 50 % scale; a cross dissolve from red to green diff --git a/crates/interchange/Cargo.toml b/crates/interchange/Cargo.toml index 11dfec333..e2caa613d 100644 --- a/crates/interchange/Cargo.toml +++ b/crates/interchange/Cargo.toml @@ -10,6 +10,7 @@ rust-version.workspace = true workspace = true [dependencies] +craft-timeline = { workspace = true } effectcraft-time = { workspace = true } effectcraft-color = { workspace = true } effectcraft-keyframe = { workspace = true } diff --git a/crates/interchange/src/export.rs b/crates/interchange/src/export.rs index fd396b00b..69ab38aa4 100644 --- a/crates/interchange/src/export.rs +++ b/crates/interchange/src/export.rs @@ -365,7 +365,7 @@ impl Exporter<'_> { let mut clip = media_clip(fp::MediaRef::File { path: path.clone() }, info); clip.offline = f.missing; let bin = self.bin(it.and_then(|i| i.parent)); - let id = self.fp.add_item(&name, fp::Label::Iris, fp::ItemKind::Media(clip), bin); + let id = self.fp.add_item(&name, fp::Label::Iris, fp::ItemKind::Media(Box::new(clip)), bin); self.media.insert(path, id); id } @@ -384,7 +384,7 @@ impl Exporter<'_> { Some(b) } }; - let id = self.fp.add_item(name, fp::Label::Violet, fp::ItemKind::Media(clip), bin); + let id = self.fp.add_item(name, fp::Label::Violet, fp::ItemKind::Media(Box::new(clip)), bin); self.media.insert(r.path.clone(), id); id } @@ -405,7 +405,7 @@ impl Exporter<'_> { ); let clip = media_clip(fp::MediaRef::Generator(Generator::ColorMatte { color: [color[0], color[1], color[2], 1.0] }), info); let bin = self.bin(it.and_then(|i| i.parent)); - let id = self.fp.add_item(&name, fp::Label::Rose, fp::ItemKind::Media(clip), bin); + let id = self.fp.add_item(&name, fp::Label::Rose, fp::ItemKind::Media(Box::new(clip)), bin); self.media.insert(key, id); id } @@ -540,6 +540,9 @@ impl Exporter<'_> { comment: if m.chapter.is_empty() { String::new() } else { m.comment.clone() }, kind: if m.chapter.is_empty() { fp::MarkerKind::Comment } else { fp::MarkerKind::Chapter }, color: fp::Label::Green, + custom_color: None, + author: String::new(), + url: m.url.clone(), }) .collect(); if let Some(seq) = self.fp.sequence_mut(sid) { @@ -733,6 +736,7 @@ fn media_info(name: &str, kind: MediaKind, duration: Tick, video: Option fp::MediaClip { mod tests { use super::*; + #[test] + fn synthesized_video_metadata_does_not_claim_an_inferred_color_profile() { + let info = media_info("clip", MediaKind::Movie, Tick::ZERO, Some((1920, 1080, FrameRate::new(24, 1), 1.0, "raw".into(), true)), false); + let video = info.video.unwrap(); + assert_eq!((video.width, video.height), (1920, 1080)); + assert!(video.color_assumed.is_none()); + assert!(video.has_alpha); + } + /// A folder's bin is the same one each time it is asked for (a cached folder once answered /// `None`, so a folder's second item went to the project root); a non-item has no bin. #[test] diff --git a/crates/interchange/src/import.rs b/crates/interchange/src/import.rs index 6faadd91a..a5336f406 100644 --- a/crates/interchange/src/import.rs +++ b/crates/interchange/src/import.rs @@ -49,78 +49,7 @@ pub struct ImportResult { /// a few levels per nested sequence; parsing several thousand levels overflowed the stack. pub const MAX_DEPTH: usize = 256; -/// The deepest element nesting of an XML document (a quick scan that skips comments, CDATA, -/// processing instructions, declarations and quoted attribute values). -pub(crate) fn xml_depth(b: &[u8]) -> usize { - let (mut i, mut depth, mut max) = (0usize, 0usize, 0usize); - let skip_to = |from: usize, end: &[u8]| b.get(from..).and_then(|r| r.windows(end.len()).position(|w| w == end)).map_or(b.len(), |p| from + p + end.len()); - while let Some(&c) = b.get(i) { - if c != b'<' { - i += 1; - continue; - } - let rest = b.get(i..).unwrap_or_default(); - if rest.starts_with(b""); - } else if rest.starts_with(b""); - } else if rest.starts_with(b""); - } else if rest.starts_with(b""); - } else if rest.starts_with(b""); - } else { - // A start tag: find its end outside quotes; `/>` closes it at once. - let mut j = i + 1; - let mut quote = None; - while let Some(&c) = b.get(j) { - match quote { - Some(q) if c == q => quote = None, - Some(_) => {} - None if c == b'"' || c == b'\'' => quote = Some(c), - None if c == b'>' => break, - None => {} - } - j += 1; - } - if b.get(j.wrapping_sub(1)) != Some(&b'/') { - depth += 1; - max = max.max(depth); - } - i = j + 1; - } - } - max -} - -/// The deepest array / object nesting of a JSON document (strings skipped). -pub(crate) fn json_depth(b: &[u8]) -> usize { - let (mut depth, mut max, mut in_str, mut esc) = (0usize, 0usize, false, false); - for &c in b { - if in_str { - if esc { - esc = false; - } else if c == b'\\' { - esc = true; - } else if c == b'"' { - in_str = false; - } - continue; - } - match c { - b'"' => in_str = true, - b'[' | b'{' => { - depth += 1; - max = max.max(depth); - } - b']' | b'}' => depth = depth.saturating_sub(1), - _ => {} - } - } - max -} +pub(crate) use craft_timeline::preflight::{json_depth, xml_depth}; pub fn import( project: &mut Project, @@ -201,8 +130,8 @@ const EDL_MEDIA_TIME_NOTE: &str = "EDL source timecodes were imported as media t /// The largest start timecode, in frames, a file may have: a day at 1000 fps. const MAX_FILE_TIMECODE: i64 = 24 * 3600 * 1000; -/// The paths an EDL reader guessed (media it flags offline: a line without `SOURCE FILE` names -/// only its clip) that are not inside the list's folder: a clip name of `../x.mov` or an absolute +/// The paths an EDL reader guessed (identified by its `Tape Name` metadata: a line without +/// `SOURCE FILE` names only its clip) that are not inside the list's folder: a clip name of `../x.mov` or an absolute /// one would link a file elsewhere on the disk. They stay placeholders. A `SOURCE FILE` path is /// the list's own choice and is kept, also when another clip guesses the same path. fn guessed_outside(project: &fp::Project, base_dir: Option<&str>) -> HashSet { @@ -219,7 +148,9 @@ fn guessed_outside(project: &fp::Project, base_dir: Option<&str>) -> HashSet filmcraft codec: "png".into(), pixel_format: String::new(), color: Default::default(), + color_assumed: None, has_alpha: false, bitrate: None, hdr: None, @@ -60,7 +61,7 @@ fn media(p: &mut fp::Project, name: &str, path: &str, kind: filmcraft_media::Med proxy: None, identity: None, }; - p.add_item(name, fp::Label::Iris, fp::ItemKind::Media(clip), bin) + p.add_item(name, fp::Label::Iris, fp::ItemKind::Media(Box::new(clip)), bin) } fn rate() -> filmcraft_time::FrameRate { @@ -882,3 +883,17 @@ fn import_finds_each_clips_transitions_without_scanning_the_track() { let mid = m.layers.iter().find(|l| near(l.in_point, t(100.0 - 0.08))).expect("clip 250 extended into its incoming transition"); assert!(near(mid.out_point, t(100.4 + 0.08)), "{}", mid.out_point.seconds()); } + +#[test] +fn edl_explicit_source_file_allows_the_same_path_as_an_outside_guess() { + let edl = b"TITLE: CUT\nFCM: NON-DROP FRAME\n\n001 A001 V C 00:00:00:00 00:00:01:00 00:00:00:00 00:00:01:00\n* FROM CLIP NAME: ../shared.mov\n\n002 A002 V C 00:00:00:00 00:00:01:00 00:00:01:00 00:00:02:00\n* FROM CLIP NAME: named.mov\n* SOURCE FILE: /shared.mov\n"; + let mut asked = Vec::new(); + let mut probe_all = |path: &str| { + asked.push(path.to_string()); + probe(path) + }; + let mut p = Project::default(); + let opts = ImportOptions { name: "hand.edl".into(), edl_frame_rate: Some(25.0), base_dir: Some("/work".into()) }; + import(&mut p, edl, None, &opts, &mut probe_all).unwrap(); + assert_eq!(asked, ["/shared.mov"], "explicit SOURCE FILE permits the shared path, probed once"); +} diff --git a/crates/media/tests/fixtures/README.md b/crates/media/tests/fixtures/README.md new file mode 100644 index 000000000..1e9b6bf45 --- /dev/null +++ b/crates/media/tests/fixtures/README.md @@ -0,0 +1,31 @@ +# Synthetic AAC layout fixture + +`pce61-ffmpeg.aac-fixture` contains only original mathematical sine tones generated for these tests by Dylan M. Taylor. No recorded audio or third-party source/assets were copied; the generated fixture is covered by this repository's license. FFmpeg is a generation tool, not a runtime test dependency. + +Generator: FFmpeg 7.1.5 (Debian 7.1.5-0+deb13u1, AAC encoder Lavc61.19.101). +SHA-256: `07c460636dce4aa4163df8ef35f3b76f1214c38bf217aacd23243e608d87071e`. + +The seven PCM inputs are FL500Hz, FR700Hz, FC300Hz, LFE60Hz, BC900Hz, SL1100Hz, SR1300Hz, each amplitude0.25 at48kHz for2seconds. The real encoder emits its own PCE and matching element tags; unlike the previous synthetic configuration rewrite, no LFE element is mislabeled as an unlisted SCE. + +Reproduce using FFmpeg/ffprobe and Python3: + +```sh +ffmpeg -hide_banner -loglevel error -f lavfi -i 'aevalsrc=0.25*sin(2*PI*500*t)|0.25*sin(2*PI*700*t)|0.25*sin(2*PI*300*t)|0.25*sin(2*PI*60*t)|0.25*sin(2*PI*900*t)|0.25*sin(2*PI*1100*t)|0.25*sin(2*PI*1300*t):s=48000:d=2:c=6.1' -c:a aac -b:a 672k pce61.m4a +ffprobe -v error -show_streams -show_packets -show_data -of json pce61.m4a > pce61.json +python3 - <<'PY' +import json, struct +x = json.load(open('pce61.json')) +def raw(text): + return bytes.fromhex(''.join(line.split(': ', 1)[1].split(' ', 1)[0].replace(' ', '') + for line in text.strip().splitlines())) +asc = raw(x['streams'][0]['extradata']) +units = [raw(p['data']) for p in x['packets']] +assert len(units) == 95 +output = bytearray(b'PCE1') +for record in [asc, *units]: + output += struct.pack('>I', len(record)) + record +open('pce61-ffmpeg.aac-fixture', 'wb').write(output) +PY +``` + +Envelope: ASCII `PCE1`, then a big-endian32-bit length and ASC bytes, then95 length-prefixed raw AAC access units. Container priming trim is deliberately not retained, matching the existing tests' encoder units; measurements start0.5seconds into decoded audio. Other encoder versions can yield different bytes; preserve actual PCE/AU consistency and all existing tone-gain assertions. diff --git a/crates/media/tests/fixtures/pce61-ffmpeg.aac-fixture b/crates/media/tests/fixtures/pce61-ffmpeg.aac-fixture new file mode 100644 index 000000000..d2894ff82 Binary files /dev/null and b/crates/media/tests/fixtures/pce61-ffmpeg.aac-fixture differ diff --git a/crates/media/tests/fixtures/pce61-ffmpeg.aac-fixture.attribution b/crates/media/tests/fixtures/pce61-ffmpeg.aac-fixture.attribution new file mode 100644 index 000000000..3f385a1e4 --- /dev/null +++ b/crates/media/tests/fixtures/pce61-ffmpeg.aac-fixture.attribution @@ -0,0 +1,7 @@ +asset: pce61-ffmpeg.aac-fixture +title: Synthetic seven-channel AAC PCE tone fixture +author: Dylan M. Taylor +source: crates/media/tests/fixtures/README.md (reproducible generation recipe) +license: MIT OR Apache-2.0 +added: 2026-11-16 +notes: Original sine-wave signals, no recorded audio or copied assets. Encoded using FFmpeg 7.1.5. SHA-256 07c460636dce4aa4163df8ef35f3b76f1214c38bf217aacd23243e608d87071e. diff --git a/crates/media/tests/it/aac_layout.rs b/crates/media/tests/it/aac_layout.rs index 896e4f0a7..5adf762b2 100644 --- a/crates/media/tests/it/aac_layout.rs +++ b/crates/media/tests/it/aac_layout.rs @@ -1,7 +1,8 @@ //! Multichannel AAC reaches stereo by where each channel plays, whatever order its channel -//! configuration decodes in (#1701). Fixtures are tones encoded with craft-audio's AAC encoder (no -//! ffmpeg needed, so nothing is skipped), with the configuration rewritten where the coded -//! elements fit another: configurations 11 and 12 code the same elements as the encoder's 7- and +//! configuration decodes in (#1701). Fixtures are tones encoded with craft-audio's AAC encoder, +//! plus a checked-in genuine FFmpeg-generated 6.1-channel fixture (no external tool at test time, nothing skipped). +//! The configuration is rewritten only where the coded elements fit another: configurations 11 +//! and 12 code the same elements as the encoder's 7- and //! 8-channel output, and a program config element can name any of them. use std::f64::consts::PI; @@ -9,7 +10,7 @@ use std::io::Cursor; use std::path::PathBuf; use std::sync::Arc; -use craft_audio::aac::{AudioSpecificConfig, Encoder, EncoderConfig, ProgramConfig}; +use craft_audio::aac::{AudioSpecificConfig, Encoder, EncoderConfig}; use effectcraft_media::{MediaPool, probe, probe_bytes}; use effectcraft_time::Tick; @@ -59,13 +60,6 @@ fn lc(config: u8) -> Option { Some(AudioSpecificConfig::lc(3, config)) } -fn pce(front: Vec<(bool, u8)>, side: Vec<(bool, u8)>, back: Vec<(bool, u8)>, lfe: Vec, comment: &[u8]) -> Option { - let pce = ProgramConfig { object_type: 1, sf_index: 3, front, side, back, lfe, comment: comment.to_vec(), ..Default::default() }; - let mut asc = AudioSpecificConfig::lc(3, 0); - asc.pce = Some(pce); - Some(asc) -} - use Ch::*; fn cases() -> Vec { @@ -80,15 +74,9 @@ fn cases() -> Vec { Case { name: "config12", content: &[C, L, R, Ls, Rs, Ls, Rs, Lfe], asc: lc(12) }, // the encoder's own 6.1: a PCE listing the centre first Case { name: "pce61-centre-first", content: &[C, L, R, Ls, Rs, Cs, Lfe], asc: None }, - // ffmpeg's 6.1 PCE: front pair and centre, a side SCE, a back pair and SCE, no LFE - // element, its channels in ffmpeg's order L R C LFE Cs Ls Rs. The decoder places the - // encoder's SCE 0 in the front SCE, pair 0 front, pair 1 back, SCE 1 in the back SCE (tag - // 1) and the LFE in the side SCE left over (tag 5). - Case { - name: "pce61-ffmpeg", - content: &[C, L, R, Cs, Ls, Rs, Lfe], - asc: pce(vec![(true, 0), (false, 0)], vec![(false, 5)], vec![(true, 1), (false, 1)], vec![], b"Lavc62.28.102"), - }, + // A genuine FFmpeg-generated 6.1-channel PCE and matching coded elements; rewriting only the ASC of + // our encoder's LFE0 stream to claim a side SCE5 would make an invalid access unit. + Case { name: "pce61-ffmpeg", content: &[C, L, R, Cs, Ls, Rs, Lfe], asc: None }, ] } @@ -110,6 +98,32 @@ fn encode(content: &[Ch], adts: bool) -> (Vec, Vec>) { (enc.audio_specific_config(), units) } +/// Preserve the fixture's real element types/tags instead of changing only its ASC. +/// The envelope and reproducible tone-generation recipe are in `tests/fixtures/README.md`. +fn encode_case(case: &Case) -> (Vec, Vec>) { + if case.name == "pce61-ffmpeg" { + let bytes = include_bytes!("../fixtures/pce61-ffmpeg.aac-fixture"); + assert_eq!(&bytes[..4], b"PCE1"); + let mut rest = &bytes[4..]; + let mut record = || { + let len = u32::from_be_bytes(rest[..4].try_into().unwrap()) as usize; + let (data, tail) = rest[4..].split_at(len); + rest = tail; + data.to_vec() + }; + let asc = record(); + let mut units = Vec::new(); + // The generated fixture contains 95 access units (including encoder priming). + for _ in 0..95 { + units.push(record()); + } + assert!(rest.is_empty(), "fixture has no unparsed records"); + return (asc, units); + } + let (asc, units) = encode(case.content, false); + (case.asc.as_ref().map_or(asc, |a| a.to_bytes().expect("ASC")), units) +} + fn mp4(asc: Vec, channels: u32, units: &[Vec]) -> Vec { mp4_after(None, asc, channels, units) } @@ -211,8 +225,7 @@ fn lfe_is_coded(case: &Case, bytes: Vec) { #[test] fn every_aac_layout_mixes_by_speaker_in_mp4() { for case in cases() { - let (asc, units) = encode(case.content, false); - let asc = case.asc.as_ref().map_or(asc, |a| a.to_bytes().expect("ASC")); + let (asc, units) = encode_case(&case); let bytes = mp4(asc, case.content.len() as u32, &units); lfe_is_coded(&case, bytes.clone()); let p = write(&format!("{}.mp4", case.name), &bytes); @@ -228,8 +241,7 @@ fn every_aac_layout_mixes_by_speaker_in_mp4() { #[test] fn matroska_aac_layouts_mix_by_speaker() { for case in cases().into_iter().filter(|c| matches!(c.name, "config12" | "pce61-centre-first" | "pce61-ffmpeg")) { - let (asc, units) = encode(case.content, false); - let asc = case.asc.as_ref().map_or(asc, |a| a.to_bytes().expect("ASC")); + let (asc, units) = encode_case(&case); let p = write(&format!("{}.mkv", case.name), &mkv(asc, case.content.len() as u32, &units)); check(case.name, case.content, &mix(&MediaPool::new(), &probe(&p).expect("probe"))); } @@ -254,8 +266,7 @@ fn an_empty_audio_track_lends_its_configuration_to_no_other() { let case = cases().into_iter().find(|c| c.name == name).expect("case"); let n = case.content.len() as u32; let empty = Some((AudioSpecificConfig::lc(3, empty).to_bytes().expect("ASC"), n)); - let (asc, units) = encode(case.content, false); - let asc = case.asc.as_ref().map_or(asc, |a| a.to_bytes().expect("ASC")); + let (asc, units) = encode_case(&case); let p = write(&format!("{name}-after-empty.mp4"), &mp4_after(empty.clone(), asc.clone(), n, &units)); check(&format!("{name} MP4"), case.content, &mix(&MediaPool::new(), &probe(&p).expect("probe"))); let p = write(&format!("{name}-after-empty.mkv"), &mkv_after(empty, asc, n, &units)); diff --git a/crates/path/Cargo.toml b/crates/path/Cargo.toml index 2e9bc85d9..122c37fe0 100644 --- a/crates/path/Cargo.toml +++ b/crates/path/Cargo.toml @@ -14,5 +14,6 @@ effectcraft-geom = { workspace = true } effectcraft-keyframe = { workspace = true } effectcraft-raster = { workspace = true } kurbo = { workspace = true } +log = { workspace = true } tiny-skia = { workspace = true } linesweeper = "0.5" diff --git a/crates/path/src/ops.rs b/crates/path/src/ops.rs index ba5349312..5c89ce6bc 100644 --- a/crates/path/src/ops.rs +++ b/crates/path/src/ops.rs @@ -351,14 +351,28 @@ fn round_sub(sub: &Sub, r: f64, out: &mut BezPath) { /// join. `copies` copies are made, copy *i* (0-based) offset by `amount · (i + 1 + copy_offset)`, /// all returned in the same compound path. pub fn offset(paths: &[BezPath], amount: f64, join: Join, miter_limit: f64, copies: f64, copy_offset: f64) -> Vec { - let n = copies.round().clamp(1.0, 1000.0) as usize; + offset_within(paths, amount, join, miter_limit, copies, copy_offset, MAX_OPERATOR_SEGMENTS) +} + +/// [`offset`] with each path's result held to `max` elements (its first copy aside). +fn offset_within(paths: &[BezPath], amount: f64, join: Join, miter_limit: f64, copies: f64, copy_offset: f64, max: usize) -> Vec { + let n = pieces_within_budget(paths, copies.round().clamp(1.0, 1000.0) as usize); paths .iter() .map(|p| { let mut out = BezPath::new(); for i in 0..n { let d = amount * (i as f64 + 1.0 + copy_offset); - out.extend(crate::offset::offset_path(p, d, join, miter_limit).elements().iter().copied()); + let copy = crate::offset::offset_path(p, d, join, miter_limit); + // The budget is spent on what `offset_path` returns (an open subpath comes back as + // a closed outline of many segments; a zero offset as the path itself): the first + // copy is always kept, and a copy that would pass the budget is not made, so the + // work stays within a small multiple of it. + if i > 0 && out.elements().len().saturating_add(copy.elements().len()) > max { + log::warn!("path: Offset Paths made {i} of {n} copies; more would pass {max} segments"); + break; + } + out.extend(copy.elements().iter().copied()); } out }) @@ -387,6 +401,14 @@ pub fn twist(paths: &[BezPath], angle_deg: f64, center: [f64; 2]) -> Vec Vec usize { + if sub.closed { 2 } else { 1 } +} + +/// `want` pieces (or copies) per input segment, reduced so the whole output (segments times +/// pieces, plus per-subpath overhead) stays within [`MAX_OPERATOR_SEGMENTS`] (never below 1, so the input itself always passes through). +fn pieces_within_budget(paths: &[BezPath], want: usize) -> usize { + // Count what is subdivided (drawn segments) and keep room for each subpath's own MoveTo/Close. + let (mut segs, mut overhead) = (0usize, 0usize); + for sub in paths.iter().flat_map(subs) { + segs = segs.saturating_add(sub.segs.len()); + overhead = overhead.saturating_add(overhead_of(&sub)); + } + want.min(MAX_OPERATOR_SEGMENTS.saturating_sub(overhead) / segs.max(1)).max(1) +} + /// Split every segment into `m` pieces of equal arc length. Original vertices get the average of /// their incoming and outgoing tangents (so a corner's normal is its bisector). fn resample(sub: &Sub, m: usize) -> Vec { @@ -503,7 +547,7 @@ fn emit(samples: &[Sample], disp: &[Vec2], closed: bool, smooth: bool, handle: f /// `smooth` makes rounded waves instead of sharp zig zags. A closed path with `n` segments ends up /// with `n · (ridges + 1)` vertices (open: one more). pub fn zigzag(paths: &[BezPath], size: f64, ridges: f64, smooth: bool) -> Vec { - let m = ridges.round().clamp(0.0, 1000.0) as usize + 1; + let m = pieces_within_budget(paths, ridges.round().clamp(0.0, 1000.0) as usize + 1); paths .iter() .map(|p| { @@ -586,7 +630,7 @@ pub fn wiggle(paths: &[BezPath], w: &WiggleParams, time_s: f64) -> Vec if w.size == 0.0 { return paths.to_vec(); } - let m = w.detail.round().clamp(0.0, 1000.0) as usize + 1; + let m = pieces_within_budget(paths, w.detail.round().clamp(0.0, 1000.0) as usize + 1); let seed = w.seed.round() as i64 as u64; let t = time_s * w.speed + w.phase_deg / 360.0; let corr = (w.correlation / 100.0).clamp(0.0, 1.0); diff --git a/crates/path/src/ops/tests.rs b/crates/path/src/ops/tests.rs index 1ebdcea5b..e64a55b47 100644 --- a/crates/path/src/ops/tests.rs +++ b/crates/path/src/ops/tests.rs @@ -182,6 +182,25 @@ fn offset_copies() { assert!(close(o[0].bounding_box().width(), 140.0, 1e-3)); } +#[test] +fn offset_copies_are_budgeted_by_the_output_they_return() { + // An open one-segment subpath comes back as a closed outline of several elements, so the copies + // stop when the returned elements pass the budget, not when the input segments would. + let line = || { + let mut p = BezPath::new(); + p.move_to((0.0, 0.0)); + p.line_to((50.0, 0.0)); + p + }; + let one = offset_within(&[line()], 5.0, Join::Round, 4.0, 1.0, 0.0, usize::MAX)[0].elements().len(); + assert!(one > 4, "{one}"); + let o = offset_within(&[line()], 5.0, Join::Round, 4.0, 50.0, 0.0, one * 3); + let moves = o[0].elements().iter().filter(|e| matches!(e, PathEl::MoveTo(_))).count(); + assert!((1..50).contains(&moves) && o[0].elements().len() <= one * 4, "{moves} contours, {} elements", o[0].elements().len()); + // The first copy always comes back, however small the budget. + assert!(!offset_within(&[line()], 5.0, Join::Round, 4.0, 5.0, 0.0, 0)[0].elements().is_empty()); +} + #[test] fn offset_open_path_outlines() { let mut l = BezPath::new(); @@ -246,6 +265,22 @@ fn twist_of_centred_circle_keeps_it_round() { assert_eq!(id[0], sq(0.0, 0.0, 5.0)); } +#[test] +fn twist_keeps_requested_detail_when_the_whole_request_fits_the_budget() { + // One long segment asks for 64 pieces; 20,000 tiny ones ask for one each. Together that is + // far under the budget, so the long one is not cut to what a uniform 64 per segment would allow. + let mut long = BezPath::new(); + long.move_to((0.0, 0.0)); + long.line_to((5000.0, 0.0)); + let mut tiny = BezPath::new(); + tiny.move_to((0.0, 1.0)); + for i in 1..=20_000 { + tiny.line_to((i as f64 * 1e-3, 1.0)); + } + let t = twist(&[long, tiny], 90.0, [0.0, 0.0]); + assert_eq!(t[0].elements().len(), 1 + 64); +} + // ---------------------------------------------------------------- zig zag #[test] @@ -417,3 +452,48 @@ fn normalize_and_filled_area() { let n = crate::boolean::normalize(&p, FillRule::EvenOdd); assert!(close(n.area().abs(), 10000.0, 1e-6)); } + +// ---------------------------------------------------------------- operator budget + +#[test] +fn stacked_expanding_operators_stay_within_the_segment_budget() { + // Three Zig Zags at 1000 ridges would turn a square into 4 · 1001³ segments; each output + // is held to the budget instead, and the last operators still pass the geometry through. + let mut p = vec![sq(0.0, 0.0, 100.0)]; + for _ in 0..3 { + p = zigzag(&p, 1.0, 1000.0, false); + let n: usize = p.iter().map(|q| q.elements().len()).sum(); + assert!(n <= 2 * MAX_OPERATOR_SEGMENTS, "{n}"); + } + let w = wiggle(&p, &WiggleParams { detail: 1000.0, ..Default::default() }, 0.0); + let n: usize = w.iter().map(|q| q.elements().len()).sum(); + assert!(n <= 2 * MAX_OPERATOR_SEGMENTS, "{n}"); + let o = offset(&[sq(0.0, 0.0, 100.0)], 1.0, Join::Miter, 4.0, 1000.0, 0.0); + assert!(!o[0].elements().is_empty()); + // Within the budget nothing changes: 4 segments × 11 pieces. + assert_eq!(vertex_count(&zigzag(&[sq(0.0, 0.0, 100.0)], 1.0, 10.0, false)[0]), 44); +} + +#[test] +fn many_short_open_paths_keep_their_requested_detail_within_the_budget() { + // 1000 open lines at 1000 ridges: 1,001,000 segments fit the budget, so nothing is reduced. + let lines: Vec = (0..1000) + .map(|i| { + let mut p = BezPath::new(); + p.move_to((0.0, i as f64)); + p.line_to((100.0, i as f64)); + p + }) + .collect(); + let z = zigzag(&lines, 1.0, 1000.0, false); + assert!(z.iter().all(|q| q.elements().len() == 1 + 1001)); +} + +#[test] +fn open_subpaths_reserve_one_element_of_overhead() { + // 349,525 open lines: the move-to is the only extra element, so 2 copies fit the budget + // (a closed subpath's extra close-path would leave room for 1). + let line = BezPath::from_vec(vec![PathEl::MoveTo((0.0, 0.0).into()), PathEl::LineTo((1.0, 0.0).into())]); + let lines = vec![line; 349_525]; + assert_eq!(pieces_within_budget(&lines, 3), 2); +} diff --git a/crates/psd/src/pixels.rs b/crates/psd/src/pixels.rs index 4907e21f7..f9b7ca6f3 100644 --- a/crates/psd/src/pixels.rs +++ b/crates/psd/src/pixels.rs @@ -134,46 +134,36 @@ impl Psd { /// Undo ZIP prediction in place; the 32-bit scratch row is charged to `budget`. pub(crate) fn unpredict(&self, v: &mut [u8], w: usize, h: usize, budget: &mut Budget) -> Result<()> { - match self.depth { - 16 => { - for row in v.chunks_exact_mut(w * 2).take(h) { - let mut prev = 0u16; - for c in row.as_chunks_mut::<2>().0 { - let x = u16::from_be_bytes([c[0], c[1]]).wrapping_add(prev); - c.copy_from_slice(&x.to_be_bytes()); - prev = x; - } - } - } - 32 => { - // One scratch row for the whole plane, charged: a wide, short layer passes the - // decode's peak check and would otherwise allocate it on top. - let mut planar = budget.filled(w.checked_mul(4).ok_or_else(|| too_large(w, h))?, 0u8)?; - #[cfg(test)] - counters::bump(&counters::SCRATCH); - for row in v.chunks_exact_mut(w * 4).take(h) { - for i in 1..row.len() { - row[i] = row[i].wrapping_add(row[i - 1]); - } - // Bytes are stored plane by plane (all first bytes, then all second bytes…). - planar.copy_from_slice(row); - for x in 0..w { - for b in 0..4 { - row[x * 4 + b] = planar[b * w + x]; - } - } - } - budget.release(planar.len() as u64); - } - _ => { - for row in v.chunks_exact_mut(w).take(h) { - for i in 1..row.len() { - row[i] = row[i].wrapping_add(row[i - 1]); - } - } - } + // Preserve the reader's recovery behavior: decode only complete rows, at most h. + // The fallback depths historically used byte-wise prediction rather than packed bits. + let depth = match self.depth { + 16 => 16, + 32 => 32, + _ => 8, + }; + let rowb = w.checked_mul(usize::from(depth / 8)).ok_or_else(|| too_large(w, h))?; + if rowb == 0 { + return Ok(()); } - Ok(()) + let rows = (v.len() / rowb).min(h); + let layout = craft_psd::compression::PlaneLayout { + planes: 1, + width: w, + height: rows, + depth, + version: if self.psb { craft_psd::Version::Psb } else { craft_psd::Version::Psd }, + }; + let mut scratch = if depth == 32 { + let scratch = budget.filled(rowb, 0u8)?; + #[cfg(test)] + counters::bump(&counters::SCRATCH); + scratch + } else { + Vec::new() + }; + let result = craft_psd::compression::unpredict_with_scratch(&mut v[..rows * rowb], &layout, &mut scratch); + budget.release(scratch.len() as u64); + result.map_err(|e| Error::Invalid(e.to_string())) } /// Hand every sample of `raw` (`w`×`h`, row-major, in order) to `f` as a float. Samples a short diff --git a/crates/psd/src/tests/opt.rs b/crates/psd/src/tests/opt.rs index 241af0069..79e05a41b 100644 --- a/crates/psd/src/tests/opt.rs +++ b/crates/psd/src/tests/opt.rs @@ -650,3 +650,21 @@ fn placed_bake_solves_the_quad_once() { so.map([1.0, 1.0], 20.0, 10.0); assert_eq!(counters::take(&QUAD), 1); } + +#[test] +fn shared_unpredict_keeps_tail_bytes_and_refuses_unbudgeted_scratch() { + for depth in [8u16, 16, 32] { + let p = Psd { depth, ..base() }; + let (w, h) = (3, 2); + let row = w * usize::from(depth / 8); + let mut actual: Vec = (0..row * 3 + 1).map(|i| (i * 31 % 251) as u8).collect(); + let mut expected = actual.clone(); + ref_unpredict(depth, &mut expected, w, h); + p.unpredict(&mut actual, w, h, &mut Budget::new(u64::MAX)).unwrap(); + assert_eq!(actual, expected, "complete extra rows and partial tails stay untouched"); + } + let p = Psd { depth: 32, ..base() }; + let mut bytes = vec![0x31; 24]; + assert!(p.unpredict(&mut bytes, 3, 2, &mut Budget::new(11)).is_err()); + assert_eq!(bytes, vec![0x31; 24], "budget refusal precedes mutation"); +} diff --git a/crates/render/src/audio.rs b/crates/render/src/audio.rs index 71e18fdaf..a19802eb7 100644 --- a/crates/render/src/audio.rs +++ b/crates/render/src/audio.rs @@ -94,6 +94,11 @@ fn generates(l: &Layer) -> bool { audio_effect_groups(l).any(|(id, _)| audio_fx::generates_audio(id)) } +/// Does an enabled audio effect (Backwards) play the layer's [in, out) span reversed? +pub fn plays_backwards(l: &Layer) -> bool { + audio_effect_groups(l).any(|(id, _)| audio_fx::reverses(id)) +} + /// Does the layer contribute to the mix (Audio switch on and something to hear)? pub fn audible(project: &Project, l: &Layer) -> bool { l.switches.audio @@ -291,7 +296,7 @@ impl MixEnv<'_> { if fx.is_empty() { return self.layer_raw(l, i0, n, false); } - let reversed = fx.iter().any(|(id, _, _)| audio_fx::reverses(id)); + let reversed = plays_backwards(l); let pre_s: f64 = fx.iter().map(|(id, _, p)| audio_fx::preroll(id, p)).sum::().clamp(0.0, MAX_PREROLL_SECONDS); let pre = (pre_s * self.rate as f64).ceil() as usize; let b0 = i0 - pre as i64; diff --git a/crates/svg/src/color.rs b/crates/svg/src/color.rs index 28cb37f83..6cef52096 100644 --- a/crates/svg/src/color.rs +++ b/crates/svg/src/color.rs @@ -1,250 +1,7 @@ -//! CSS colour values (CSS Color Module Level 3): keywords, `#rgb[a]`, `#rrggbb[aa]`, `rgb[a]()`, -//! `hsl[a]()`. +//! SVG paint colours use the shared precision-preserving compatibility parser. +//! Paint references (`none`, `currentColor`, `url`) remain app policy. -/// The CSS colour keywords (CSS Color Module Level 3, §4.3 extended colour keywords). -const NAMED: &[(&str, u32)] = &[ - ("aliceblue", 0xF0F8FF), - ("antiquewhite", 0xFAEBD7), - ("aqua", 0x00FFFF), - ("aquamarine", 0x7FFFD4), - ("azure", 0xF0FFFF), - ("beige", 0xF5F5DC), - ("bisque", 0xFFE4C4), - ("black", 0x000000), - ("blanchedalmond", 0xFFEBCD), - ("blue", 0x0000FF), - ("blueviolet", 0x8A2BE2), - ("brown", 0xA52A2A), - ("burlywood", 0xDEB887), - ("cadetblue", 0x5F9EA0), - ("chartreuse", 0x7FFF00), - ("chocolate", 0xD2691E), - ("coral", 0xFF7F50), - ("cornflowerblue", 0x6495ED), - ("cornsilk", 0xFFF8DC), - ("crimson", 0xDC143C), - ("cyan", 0x00FFFF), - ("darkblue", 0x00008B), - ("darkcyan", 0x008B8B), - ("darkgoldenrod", 0xB8860B), - ("darkgray", 0xA9A9A9), - ("darkgreen", 0x006400), - ("darkgrey", 0xA9A9A9), - ("darkkhaki", 0xBDB76B), - ("darkmagenta", 0x8B008B), - ("darkolivegreen", 0x556B2F), - ("darkorange", 0xFF8C00), - ("darkorchid", 0x9932CC), - ("darkred", 0x8B0000), - ("darksalmon", 0xE9967A), - ("darkseagreen", 0x8FBC8F), - ("darkslateblue", 0x483D8B), - ("darkslategray", 0x2F4F4F), - ("darkslategrey", 0x2F4F4F), - ("darkturquoise", 0x00CED1), - ("darkviolet", 0x9400D3), - ("deeppink", 0xFF1493), - ("deepskyblue", 0x00BFFF), - ("dimgray", 0x696969), - ("dimgrey", 0x696969), - ("dodgerblue", 0x1E90FF), - ("firebrick", 0xB22222), - ("floralwhite", 0xFFFAF0), - ("forestgreen", 0x228B22), - ("fuchsia", 0xFF00FF), - ("gainsboro", 0xDCDCDC), - ("ghostwhite", 0xF8F8FF), - ("gold", 0xFFD700), - ("goldenrod", 0xDAA520), - ("gray", 0x808080), - ("grey", 0x808080), - ("green", 0x008000), - ("greenyellow", 0xADFF2F), - ("honeydew", 0xF0FFF0), - ("hotpink", 0xFF69B4), - ("indianred", 0xCD5C5C), - ("indigo", 0x4B0082), - ("ivory", 0xFFFFF0), - ("khaki", 0xF0E68C), - ("lavender", 0xE6E6FA), - ("lavenderblush", 0xFFF0F5), - ("lawngreen", 0x7CFC00), - ("lemonchiffon", 0xFFFACD), - ("lightblue", 0xADD8E6), - ("lightcoral", 0xF08080), - ("lightcyan", 0xE0FFFF), - ("lightgoldenrodyellow", 0xFAFAD2), - ("lightgray", 0xD3D3D3), - ("lightgreen", 0x90EE90), - ("lightgrey", 0xD3D3D3), - ("lightpink", 0xFFB6C1), - ("lightsalmon", 0xFFA07A), - ("lightseagreen", 0x20B2AA), - ("lightskyblue", 0x87CEFA), - ("lightslategray", 0x778899), - ("lightslategrey", 0x778899), - ("lightsteelblue", 0xB0C4DE), - ("lightyellow", 0xFFFFE0), - ("lime", 0x00FF00), - ("limegreen", 0x32CD32), - ("linen", 0xFAF0E6), - ("magenta", 0xFF00FF), - ("maroon", 0x800000), - ("mediumaquamarine", 0x66CDAA), - ("mediumblue", 0x0000CD), - ("mediumorchid", 0xBA55D3), - ("mediumpurple", 0x9370DB), - ("mediumseagreen", 0x3CB371), - ("mediumslateblue", 0x7B68EE), - ("mediumspringgreen", 0x00FA9A), - ("mediumturquoise", 0x48D1CC), - ("mediumvioletred", 0xC71585), - ("midnightblue", 0x191970), - ("mintcream", 0xF5FFFA), - ("mistyrose", 0xFFE4E1), - ("moccasin", 0xFFE4B5), - ("navajowhite", 0xFFDEAD), - ("navy", 0x000080), - ("oldlace", 0xFDF5E6), - ("olive", 0x808000), - ("olivedrab", 0x6B8E23), - ("orange", 0xFFA500), - ("orangered", 0xFF4500), - ("orchid", 0xDA70D6), - ("palegoldenrod", 0xEEE8AA), - ("palegreen", 0x98FB98), - ("paleturquoise", 0xAFEEEE), - ("palevioletred", 0xDB7093), - ("papayawhip", 0xFFEFD5), - ("peachpuff", 0xFFDAB9), - ("peru", 0xCD853F), - ("pink", 0xFFC0CB), - ("plum", 0xDDA0DD), - ("powderblue", 0xB0E0E6), - ("purple", 0x800080), - ("rebeccapurple", 0x663399), - ("red", 0xFF0000), - ("rosybrown", 0xBC8F8F), - ("royalblue", 0x4169E1), - ("saddlebrown", 0x8B4513), - ("salmon", 0xFA8072), - ("sandybrown", 0xF4A460), - ("seagreen", 0x2E8B57), - ("seashell", 0xFFF5EE), - ("sienna", 0xA0522D), - ("silver", 0xC0C0C0), - ("skyblue", 0x87CEEB), - ("slateblue", 0x6A5ACD), - ("slategray", 0x708090), - ("slategrey", 0x708090), - ("snow", 0xFFFAFA), - ("springgreen", 0x00FF7F), - ("steelblue", 0x4682B4), - ("tan", 0xD2B48C), - ("teal", 0x008080), - ("thistle", 0xD8BFD8), - ("tomato", 0xFF6347), - ("turquoise", 0x40E0D0), - ("violet", 0xEE82EE), - ("wheat", 0xF5DEB3), - ("white", 0xFFFFFF), - ("whitesmoke", 0xF5F5F5), - ("yellow", 0xFFFF00), - ("yellowgreen", 0x9ACD32), -]; - -/// Parse a CSS colour into RGBA 0..1 (`transparent` is RGBA 0). `None` for anything else -/// (`none`, `currentColor` and `url()` are handled by the caller). -pub fn parse_color(s: &str) -> Option<[f64; 4]> { - let s = s.trim(); - let lower = s.to_ascii_lowercase(); - if lower == "transparent" { - return Some([0.0; 4]); - } - if let Some(h) = lower.strip_prefix('#') { - let d: Vec = h.chars().map(|c| c.to_digit(16)).collect::>()?; - let v = |i: usize| d[i] as f64 / 15.0; - let w = |i: usize| (d[i] * 16 + d[i + 1]) as f64 / 255.0; - return Some(match d.len() { - 3 => [v(0), v(1), v(2), 1.0], - 4 => [v(0), v(1), v(2), v(3)], - 6 => [w(0), w(2), w(4), 1.0], - 8 => [w(0), w(2), w(4), w(6)], - _ => return None, - }); - } - if let Some(args) = func(&lower, "rgba").or_else(|| func(&lower, "rgb")) { - let a: Vec<&str> = split_args(args); - if a.len() < 3 { - return None; - } - let comp = |t: &str| -> Option { - Some(if let Some(p) = t.strip_suffix('%') { - p.trim().parse::().ok().filter(|v| v.is_finite())? / 100.0 - } else { - t.parse::().ok().filter(|v| v.is_finite())? / 255.0 - }) - }; - let alpha = a.get(3).map_or(Some(1.0), |t| alpha(t))?; - return Some([comp(a[0])?.clamp(0.0, 1.0), comp(a[1])?.clamp(0.0, 1.0), comp(a[2])?.clamp(0.0, 1.0), alpha]); - } - if let Some(args) = func(&lower, "hsla").or_else(|| func(&lower, "hsl")) { - let a: Vec<&str> = split_args(args); - if a.len() < 3 { - return None; - } - let h = a[0].trim_end_matches("deg").parse::().ok().filter(|v| v.is_finite())?.rem_euclid(360.0) / 360.0; - let s = a[1].trim_end_matches('%').parse::().ok().filter(|v| v.is_finite())?.clamp(0.0, 100.0) / 100.0; - let l = a[2].trim_end_matches('%').parse::().ok().filter(|v| v.is_finite())?.clamp(0.0, 100.0) / 100.0; - let al = a.get(3).map_or(Some(1.0), |t| alpha(t))?; - let [r, g, b] = hsl(h, s, l); - return Some([r, g, b, al]); - } - NAMED.iter().find(|(n, _)| *n == lower).map(|(_, v)| [((v >> 16) & 255) as f64 / 255.0, ((v >> 8) & 255) as f64 / 255.0, (v & 255) as f64 / 255.0, 1.0]) -} - -fn func<'a>(s: &'a str, name: &str) -> Option<&'a str> { - s.strip_prefix(name)?.trim_start().strip_prefix('(')?.strip_suffix(')') -} - -fn split_args(s: &str) -> Vec<&str> { - s.split(|c: char| c == ',' || c == '/' || c.is_whitespace()).filter(|t| !t.is_empty()).collect() -} - -fn alpha(t: &str) -> Option { - Some( - if let Some(p) = t.strip_suffix('%') { - p.parse::().ok().filter(|v| v.is_finite())? / 100.0 - } else { - t.parse::().ok().filter(|v| v.is_finite())? - } - .clamp(0.0, 1.0), - ) -} - -/// CSS HSL → RGB (CSS Color 3 §4.2.4). -fn hsl(h: f64, s: f64, l: f64) -> [f64; 3] { - let m2 = if l <= 0.5 { l * (s + 1.0) } else { l + s - l * s }; - let m1 = l * 2.0 - m2; - let hue = |mut h: f64| { - if h < 0.0 { - h += 1.0; - } - if h > 1.0 { - h -= 1.0; - } - if h * 6.0 < 1.0 { - m1 + (m2 - m1) * h * 6.0 - } else if h * 2.0 < 1.0 { - m2 - } else if h * 3.0 < 2.0 { - m1 + (m2 - m1) * (2.0 / 3.0 - h) * 6.0 - } else { - m1 - } - }; - [hue(h + 1.0 / 3.0), hue(h), hue(h - 1.0 / 3.0)] -} +pub use craft_svg::color::parse_rgba_compat as parse_color; #[cfg(test)] mod tests { @@ -280,3 +37,16 @@ mod tests { assert_eq!(parse_color("nonsense"), None); } } + +#[cfg(test)] +mod shared_precision_tests { + use super::parse_color; + + #[test] + fn shared_parser_keeps_float_channels_and_legacy_clamping() { + assert_eq!(parse_color("rgb(100%,50%,0%)"), Some([1.0, 0.5, 0.0, 1.0])); + assert_eq!(parse_color("rgba(0,0,255,0.123456789123)"), Some([0.0, 0.0, 1.0, 0.123456789123])); + assert_eq!(parse_color("rgb(300,-1,0)"), Some([1.0, 0.0, 0.0, 1.0])); + assert_eq!(parse_color("# fff"), None); + } +} diff --git a/crates/svg/src/lib.rs b/crates/svg/src/lib.rs index fd4baa543..9d4896f27 100644 --- a/crates/svg/src/lib.rs +++ b/crates/svg/src/lib.rs @@ -425,186 +425,12 @@ enum PaintRef { Current, } -/// The most selectors (each entry of a comma list counts) the `