From 4b4d2730863d958b2d6f4d87f5f7b89009c44d7a Mon Sep 17 00:00:00 2001 From: arnav-hiwarkar Date: Tue, 17 Nov 2026 16:06:36 +0530 Subject: [PATCH 1/4] #3460: legacy Roto Brush keys hash Gaussian Blur's 0.24 Blurriness range Roto Brush Input Keys saved by 0.22-0.24 hashed each effect above the brush through its derived Debug text, UI hints included. Opening a project replaces an instance's hints with the current spec's, so widening a range would stop those keys matching and drop the frozen matte. The legacy text now puts back the slider range 0.24 shipped for parameters listed in SLIDERS_0_24, starting with Gaussian Blur's Blurriness. --- .../engine/src/analysis/frames_key/legacy.rs | 31 +++++++++++++++++-- crates/engine/src/tests/analysis_signature.rs | 15 ++++++++- 2 files changed, 43 insertions(+), 3 deletions(-) diff --git a/crates/engine/src/analysis/frames_key/legacy.rs b/crates/engine/src/analysis/frames_key/legacy.rs index 882c82d80..4b1b090a5 100644 --- a/crates/engine/src/analysis/frames_key/legacy.rs +++ b/crates/engine/src/analysis/frames_key/legacy.rs @@ -2,7 +2,7 @@ //! keyed with them. They hash derived `Debug` text, so `tests::analysis_signature` pins keys //! those releases saved: if a type change alters this text, write that part out here. -use effectcraft_project::{Footage, ItemId, ItemKind, Layer, LayerSource, Project, Uid}; +use effectcraft_project::{Footage, GroupKind, ItemId, ItemKind, Layer, LayerSource, ParamUi, Project, PropGroup, Uid}; use super::fnv; @@ -41,12 +41,39 @@ pub(crate) fn input_key_of(mut s: String, layer: &Layer, uid: Uid) -> String { if g.uid == uid { break; } - s.push_str(&format!("{g:?}")); + s.push_str(&effect_text(g)); } } format!("{:016x}", fnv(&s)) } +/// The slider ranges 0.22–0.24 gave effect parameters whose range has changed since, as +/// (effect, parameter path, [min, max, slider min, slider max], decimals). Those releases hashed +/// each effect's UI hints into the Roto Brush Input Key, and opening a project replaces an +/// instance's hints with the current ones, so [`effect_text`] puts these back. A range change +/// above a Roto Brush would otherwise drop the analysis such a key kept: add a row with it. +#[rustfmt::skip] +const SLIDERS_0_24: &[(&str, &str, [f64; 4], u8)] = &[ + ("ec.blur.gaussian", "blurriness", [0.0, 3000.0, 0.0, 50.0], 1), +]; + +/// An effect instance as 0.22–0.24 wrote it into a Roto Brush Input Key: its derived `Debug`, +/// with the [`SLIDERS_0_24`] ranges in place of today's. +pub(crate) fn effect_text(g: &PropGroup) -> String { + let GroupKind::Effect { effect } = &g.kind else { return format!("{g:?}") }; + let mut rows = SLIDERS_0_24.iter().filter(|r| r.0 == effect).peekable(); + if rows.peek().is_none() { + return format!("{g:?}"); + } + let mut g = g.clone(); + for &(_, path, [min, max, slider_min, slider_max], decimals) in rows { + if let Some(p) = g.prop_mut(path).filter(|p| matches!(p.ui, ParamUi::Slider { .. })) { + p.ui = ParamUi::Slider { min, max, slider_min, slider_max, decimals }; + } + } + format!("{g:?}") +} + /// A footage item as 0.23–0.24 wrote it into a signature (without `placed_page` before 0.23), /// with `missing` in place of the item's. pub(crate) fn footage_text(f: &Footage, missing: bool, placed_page: bool) -> String { diff --git a/crates/engine/src/tests/analysis_signature.rs b/crates/engine/src/tests/analysis_signature.rs index 045e279de..a4ab86264 100644 --- a/crates/engine/src/tests/analysis_signature.rs +++ b/crates/engine/src/tests/analysis_signature.rs @@ -5,7 +5,7 @@ use effectcraft_effects::camera_tracker::{TRACKS, TRACKS_KEY}; use effectcraft_effects::roto::{FROZEN, INPUT_KEY}; use effectcraft_effects::warp_stab::{ANALYSIS, ANALYSIS_KEY}; use effectcraft_keyframe::Value; -use effectcraft_project::{ItemId, LayerId, Project}; +use effectcraft_project::{GroupKind, ItemId, LayerId, ParamUi, Project}; use serde_json::json; use crate::Session; @@ -93,6 +93,19 @@ fn analyses_saved_by_0_24_survive_edits_that_keep_their_frames() { assert_eq!(saved(&s), before); } +/// 0.24 hashed each effect's UI hints into the Roto Brush's key, and opening a project takes the +/// current ones: the legacy text puts back Gaussian Blur's 0.24 Blurriness range (#3460). +#[test] +fn legacy_roto_keys_hash_the_0_24_blurriness_range() { + let s = open(ANALYSED_0_24); + let layer = s.project.comp(COMP).unwrap().layer(CLIP).unwrap(); + let is_blur = |kind: &GroupKind| matches!(kind, GroupKind::Effect { effect } if effect == "ec.blur.gaussian"); + let blur = layer.effects().and_then(|fx| fx.groups().find(|g| is_blur(&g.kind))).expect("the fixture has a Gaussian Blur above the Roto Brush"); + let mut as_0_24 = blur.clone(); + as_0_24.get_mut("blurriness").unwrap().ui = ParamUi::Slider { min: 0.0, max: 3000.0, slider_min: 0.0, slider_max: 50.0, decimals: 1 }; + assert_eq!(crate::analysis::frames_key::legacy::effect_text(blur), format!("{as_0_24:?}")); +} + /// The text keys are made from today, written field by field (#3536). It changes only when this /// test is changed with it: a new field of a type it writes doesn't compile until it is decided /// in `analysis::frames_key`, and renaming a field or variant doesn't change it. From 8d603d9db8bd1b97a6effb0d793f33cc7d6f3c24 Mon Sep 17 00:00:00 2001 From: arnav-hiwarkar Date: Tue, 17 Nov 2026 16:06:36 +0530 Subject: [PATCH 2/4] #3460: GPU box passes count repeated edge pixels instead of visiting them Each box-pass thread started its running sum by reading all 2r+1 pixels of its window, even past the end of the line. At Gaussian Blur's Blurriness 30000 the radius is about 15000 px, so most of those reads were the same edge pixel or zero. Sum the pixels inside the line once and add the repeated edges times their count, as the CPU pass does. Apple M5 (Metal), 4096 x 4096, three passes per axis, repeated edges: r = 15000 went from about 185 ms to 75 ms; r = 1500 is unchanged (80 ms). --- crates/gpu/src/shaders/kernels.wgsl | 18 +++++++++++++++++- crates/gpu/src/tests.rs | 21 +++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/crates/gpu/src/shaders/kernels.wgsl b/crates/gpu/src/shaders/kernels.wgsl index a123b70ca..2f52b3b48 100644 --- a/crates/gpu/src/shaders/kernels.wgsl +++ b/crates/gpu/src/shaders/kernels.wgsl @@ -289,9 +289,25 @@ fn box_pass(gid: vec3, horizontal: bool) { } let norm = 1.0 / f32(2 * r + 1); var acc = vec4(0.0); - for (var i = b0 - r; i <= b0 + r; i++) { + // The starting window, as the CPU sums it: the pixels inside the line once each, and the + // repeated edge pixels counted rather than visited (a radius far past the line, such as + // Gaussian Blur's at Blurriness 30000, would otherwise loop over it once per pixel). + let lo = b0 - r; + let hi = b0 + r; + for (var i = max(lo, 0); i <= min(hi, n - 1); i++) { acc += line_get(horizontal, line, i, n, repeat); } + if (repeat) { + let before = f32(max(-lo, 0)); + let after = f32(max(hi - (n - 1), 0)); + // A zero count adds nothing (0 * NaN would be NaN). + if (before > 0.0) { + acc += line_get(horizontal, line, 0, n, repeat) * before; + } + if (after > 0.0) { + acc += line_get(horizontal, line, n - 1, n, repeat) * after; + } + } let b1 = min(b0 + block, n); for (var i = b0; i < b1; i++) { if (horizontal) { diff --git a/crates/gpu/src/tests.rs b/crates/gpu/src/tests.rs index 1d2782262..23e67d722 100644 --- a/crates/gpu/src/tests.rs +++ b/crates/gpu/src/tests.rs @@ -760,6 +760,27 @@ fn box_blur_horizontal_rows_match_cpu_beyond_256() { } } +/// #3460: a box radius far past the image (Gaussian Blur's at Blurriness 30000 is about 15000 px) +/// starts each running sum as the CPU does, the pixels inside once and the repeated edges +/// counted, so the GPU matches it along rows and columns, with and without repeated edges. +#[test] +fn box_passes_with_a_radius_far_past_the_image_match_cpu() { + let Some(g) = gpu() else { return }; + let img = pattern(5, 96, 40); + let up = g.ctx.upload_image(&img).expect("upload"); + let tol = tolerance(BitDepth::Bpc32); + for repeat in [true, false] { + let mut e = crate::context::Enc::new(&g.ctx); + let r = [15_000usize; 3]; + let out = crate::effects::box_passes(&mut e, &up, &r, &r, repeat); + let got = e.download(&out).expect("download"); + let want = effectcraft_raster::box_blur(&img, 15_000, 15_000, 3, repeat); + assert_eq!((got.width, got.height), (want.width, want.height)); + let d = diff(&want, &got, tol); + assert_eq!(d.over, 0, "repeat {repeat}: max {} at {:?} on {}", d.max, d.worst, g.ctx.name); + } +} + #[test] fn gpu_effects_match_cpu() { // Sigma 3 px and up and even radii, so the half-scale pass stays on the GPU too (#1939). From ef7dd7f3d181a66e43fb532e041d55a1b6d762da Mon Sep 17 00:00:00 2001 From: arnav-hiwarkar Date: Tue, 17 Nov 2026 16:06:36 +0530 Subject: [PATCH 3/4] #3460: Gaussian Blur: Blurriness takes After Effects' range 0..30000 After Effects records Blurriness as valid from 0 to 30000; the hard range was 0..3000, so prop.set and the value editors clamped 4000 to 3000. The default (0) and the 0..50 slider stay as they were. Padding stays within the effect pixel budget at the new maximum, on the CPU and the GPU. Tests: the engine round trip (prop.set, undo/redo, save/reopen, older projects) gets a row, the aep guard drops its known-narrower row, and the CPU and GPU render at 30000 is checked bounded, finite and matching. --- crates/aep/src/export/fx_defs.rs | 1 - crates/effects/src/misc.rs | 21 ++++++++++++++++++++- crates/engine/src/tests/effect_ranges.rs | 1 + crates/gpu/src/tests.rs | 8 ++++++++ docs/effects-parity.md | 1 + 5 files changed, 30 insertions(+), 2 deletions(-) diff --git a/crates/aep/src/export/fx_defs.rs b/crates/aep/src/export/fx_defs.rs index 338e00fc5..ee24879c6 100644 --- a/crates/aep/src/export/fx_defs.rs +++ b/crates/aep/src/export/fx_defs.rs @@ -720,7 +720,6 @@ mod tests { /// issue is fixed; the test fails on a row that is no longer needed. #[rustfmt::skip] const KNOWN_NARROWER: &[(&str, &str, u32)] = &[ - ("ec.blur.gaussian", "blurriness", 3460), ("ec.blur.fastbox", "radius", 3461), ("ec.blur.channel", "redBlurriness", 3462), ("ec.blur.channel", "greenBlurriness", 3462), diff --git a/crates/effects/src/misc.rs b/crates/effects/src/misc.rs index 9c7131657..11a273888 100644 --- a/crates/effects/src/misc.rs +++ b/crates/effects/src/misc.rs @@ -756,7 +756,7 @@ pub fn specs() -> Vec { "Gaussian Blur", "Blur & Sharpen", vec![ - p("blurriness", "Blurriness", num(0.0), slider(0.0, 3000.0, 0.0, 50.0, 1)), + p("blurriness", "Blurriness", num(0.0), slider(0.0, 30000.0, 0.0, 50.0, 1)), p("dimensions", "Blur Dimensions", Value::Enum(0), dims()), p("repeatEdge", "Repeat Edge Pixels", Value::Bool(false), ParamUi::Checkbox), ], @@ -1036,6 +1036,25 @@ mod tests { assert_ne!(row(2.0), row(2.4)); } + /// #3460: Blurriness goes up to After Effects' 30000. There the padding stays within the + /// effect pixel budget, every pixel stays finite, and Repeat Edge Pixels still repeats the + /// layer's edges: a layer white on the left and black on the right blurs to an even grey. + #[test] + fn gaussian_blur_at_the_highest_blurriness_is_bounded() { + for repeat in [false, true] { + let out = run_fx("ec.blur.gaussian", &[("blurriness", num(30000.0)), ("repeatEdge", Value::Bool(repeat))], edge(), 0.0, EffectEnv::default()); + let (w, h) = (out.img.width, out.img.height); + assert!(u64::from(w) * u64::from(h) <= 16_777_216, "repeat {repeat}: {w} x {h}"); + assert!(out.img.data.iter().flatten().all(|v| v.is_finite()), "repeat {repeat}"); + if repeat { + assert_eq!((w, h), (40, 8)); + for p in &out.img.data { + assert!(p[..3].iter().all(|v| (v - 0.5).abs() < 0.01) && (p[3] - 1.0).abs() < 1e-4, "{p:?}"); + } + } + } + } + #[test] fn fractional_box_blur_radius_is_continuous() { let row = |v| blurred_row("ec.blur.fastbox", "radius", v); diff --git a/crates/engine/src/tests/effect_ranges.rs b/crates/engine/src/tests/effect_ranges.rs index 7deaaa911..49721e136 100644 --- a/crates/engine/src/tests/effect_ranges.rs +++ b/crates/engine/src/tests/effect_ranges.rs @@ -60,6 +60,7 @@ const ROWS: &[(u32, &str, &str, f64, f64)] = &[ (3471, "ec.distort.transform", "scaleHeight", -30000.0, 30000.0), (3471, "ec.distort.transform", "scaleWidth", -30000.0, 30000.0), (3470, "ec.distort.turbulentdisplace", "evolutionOptions/randomSeed", 0.0, 100000.0), + (3460, "ec.blur.gaussian", "blurriness", 0.0, 30000.0), ]; fn path(effect: &str, param: &str) -> String { diff --git a/crates/gpu/src/tests.rs b/crates/gpu/src/tests.rs index 23e67d722..d08276504 100644 --- a/crates/gpu/src/tests.rs +++ b/crates/gpu/src/tests.rs @@ -781,6 +781,14 @@ fn box_passes_with_a_radius_far_past_the_image_match_cpu() { } } +/// #3460: Gaussian Blur's highest Blurriness, 30000, renders the same on the GPU as on the CPU, +/// with the padding cut to the effect pixel budget and with Repeat Edge Pixels. +#[test] +fn gaussian_blur_at_the_highest_blurriness_matches_cpu() { + effect_case("ec.blur.gaussian", &[("blurriness", n(30000.0))]); + effect_case("ec.blur.gaussian", &[("blurriness", n(30000.0)), ("repeatEdge", Value::Bool(true))]); +} + #[test] fn gpu_effects_match_cpu() { // Sigma 3 px and up and even radii, so the half-scale pass stays on the GPU too (#1939). diff --git a/docs/effects-parity.md b/docs/effects-parity.md index b07c624f8..6675bc131 100644 --- a/docs/effects-parity.md +++ b/docs/effects-parity.md @@ -64,6 +64,7 @@ the GPU is performance, not parity. | Date | Change | Summary | |---|---|---| +| 2026-11-17 | minor | Gaussian Blur: Blurriness takes After Effects' recorded valid range 0..30000 (was 0..3000; default and 0..50 slider unchanged). Padding stays within the effect pixel budget at the top of the range (CPU and GPU), and Roto Brush analyses 0.24 saved below a Gaussian Blur still match (#3460) | | 2026-11-12 | minor | Parameters take After Effects' recorded valid ranges (hard range; defaults and sliders unchanged): Levels (Individual Controls) levels −10000..10000 and Gamma from 0; 4-Color Gradient Blend to 10000 and Jitter to 500 %; Change Color Hue Transform ±1800°; Noise HLS (and Auto) amounts to 1000 % and Grain Size from 0; Grid Border to 2000; Venetian Blinds Width 1..32000 and Feather to 32000; Radial Wipe Feather to 32000; Scatter Amount to 1000; Beam thicknesses to 4000; Transform Scale ±30000 %; Turbulent Displace Random Seed to 100000. A test checks every mapped parameter's range against the recorded table (CPU and GPU) | | 2026-10-19 | minor | Glow (original colours): bright pass per channel, 8 × (value − threshold + 0.061), measured against After Effects 2026 (CPU and GPU) | | 2026-10-19 | minor | Glow (colour channels): the glow covers the layer's blurred alpha, blur σ = 0.384 × radius, measured against After Effects 2026 renders (CPU and GPU) | From 969286ae7615bb4c1fc13ad7768b8f2a8074bace Mon Sep 17 00:00:00 2001 From: arnav-hiwarkar Date: Tue, 17 Nov 2026 16:52:08 +0530 Subject: [PATCH 4/4] #3460: review: name the open follow-up for SLIDERS_0_24, use the shared pixel budget in the test The table holds only Gaussian Blur's row; the ranges changed since 0.24.1 by other work are tracked in #3815. The 30000 render test checks the buffer against crate::pixel_budget instead of a copied constant. --- crates/effects/src/misc.rs | 2 +- crates/engine/src/analysis/frames_key/legacy.rs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/effects/src/misc.rs b/crates/effects/src/misc.rs index 11a273888..08c2c5a73 100644 --- a/crates/effects/src/misc.rs +++ b/crates/effects/src/misc.rs @@ -1044,7 +1044,7 @@ mod tests { for repeat in [false, true] { let out = run_fx("ec.blur.gaussian", &[("blurriness", num(30000.0)), ("repeatEdge", Value::Bool(repeat))], edge(), 0.0, EffectEnv::default()); let (w, h) = (out.img.width, out.img.height); - assert!(u64::from(w) * u64::from(h) <= 16_777_216, "repeat {repeat}: {w} x {h}"); + assert!(f64::from(w) * f64::from(h) <= crate::pixel_budget(40.0, 8.0), "repeat {repeat}: {w} x {h}"); assert!(out.img.data.iter().flatten().all(|v| v.is_finite()), "repeat {repeat}"); if repeat { assert_eq!((w, h), (40, 8)); diff --git a/crates/engine/src/analysis/frames_key/legacy.rs b/crates/engine/src/analysis/frames_key/legacy.rs index 4b1b090a5..f3403b309 100644 --- a/crates/engine/src/analysis/frames_key/legacy.rs +++ b/crates/engine/src/analysis/frames_key/legacy.rs @@ -47,11 +47,12 @@ pub(crate) fn input_key_of(mut s: String, layer: &Layer, uid: Uid) -> String { format!("{:016x}", fnv(&s)) } -/// The slider ranges 0.22–0.24 gave effect parameters whose range has changed since, as +/// Slider ranges as 0.22–0.24 gave them, for parameters whose range has changed since, as /// (effect, parameter path, [min, max, slider min, slider max], decimals). Those releases hashed /// each effect's UI hints into the Roto Brush Input Key, and opening a project replaces an /// instance's hints with the current ones, so [`effect_text`] puts these back. A range change /// above a Roto Brush would otherwise drop the analysis such a key kept: add a row with it. +/// Not every range changed since 0.24.1 has its row yet (#3815). #[rustfmt::skip] const SLIDERS_0_24: &[(&str, &str, [f64; 4], u8)] = &[ ("ec.blur.gaussian", "blurriness", [0.0, 3000.0, 0.0, 50.0], 1),