diff --git a/crates/aep/src/export/fx_defs.rs b/crates/aep/src/export/fx_defs.rs index 4ac2eb5db..3656a9f09 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), @@ -729,7 +728,6 @@ mod tests { ("ec.obsolete.gaussianlegacy", "blurriness", 3463), ("ec.perspective.dropshadow", "softness", 3464), ("ec.blur.compound", "maximumBlur", 3465), - ("ec.blur.sharpen", "amount", 3466), ("ec.blur.ccradial", "amount", 3468), ("ec.time.pixelmotionblur", "shutterAngle", 3481), ("ec.time.pixelmotionblur", "shutterSamples", 3482), diff --git a/crates/effects/src/misc.rs b/crates/effects/src/misc.rs index 69a30505a..6e709e739 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), ], @@ -795,7 +795,7 @@ pub fn specs() -> Vec { ], radial, ), - spec("ec.blur.sharpen", "Sharpen", "Blur & Sharpen", vec![p("amount", "Sharpen Amount", num(0.0), slider(0.0, 500.0, 0.0, 100.0, 0))], sharpen), + spec("ec.blur.sharpen", "Sharpen", "Blur & Sharpen", vec![p("amount", "Sharpen Amount", num(0.0), slider(0.0, 4000.0, 0.0, 100.0, 0))], sharpen), spec( "ec.blur.unsharp", "Unsharp Mask", @@ -1037,6 +1037,68 @@ 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!(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)); + 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:?}"); + } + } + } + } + + /// #3466: Sharpen Amount takes After Effects' valid range, 0..4000, and keeps its 0..100 + /// slider. `prop.set` and the value editors clamp to the hard range. + #[test] + fn sharpen_amount_takes_the_after_effects_range() { + let spec = crate::find("ec.blur.sharpen").unwrap(); + let ui = &spec.params.iter().find(|p| p.id == "amount").unwrap().ui; + assert!( + matches!(ui, ParamUi::Slider { min, max, slider_min, slider_max, .. } + if *min == 0.0 && *max == 4000.0 && *slider_min == 0.0 && *slider_max == 100.0), + "{ui:?}" + ); + } + + /// #3466: at the new top of the range the render stays linear in Amount and finite on 32 bpc + /// over-range input: colour moves away from the blur by Amount / 50 of the difference + /// (2000 → 4000 doubles it), never below 0, and alpha is untouched. + #[test] + fn sharpen_is_linear_and_finite_up_to_amount_4000() { + let mut img = edge(); + for y in 0..8 { + for x in 0..20 { + img.set(x, y, [1000.0, 1000.0, 1000.0, 1.0]); + } + } + let sharpen = |a: f64| run_fx("ec.blur.sharpen", &[("amount", num(a))], img.clone(), 0.0, EffectEnv::default()).img; + let (half, top) = (sharpen(2000.0), sharpen(4000.0)); + for y in 0..8 { + for x in 0..40 { + let (i, h, t) = (img.get(x, y), half.get(x, y), top.get(x, y)); + assert_eq!(t[3], i[3], "alpha at {x}"); + for c in 0..3 { + assert!(t[c].is_finite() && t[c] >= 0.0, "({x}, {y}): {t:?}"); + if t[c] > 0.0 && h[c] > 0.0 { + let (dh, dt) = (h[c] - i[c], t[c] - i[c]); + assert!((dt - 2.0 * dh).abs() <= 1e-3 * dt.abs().max(1.0), "({x}, {y}): {dh} {dt}"); + } + } + } + } + // The bright side of the edge moves 80 × its difference from the blur: far past 10 × the input. + assert!(top.get(19, 4)[0] > 1000.0 * 10.0, "{:?}", top.get(19, 4)); + } + #[test] fn fractional_box_blur_radius_is_continuous() { let row = |v| blurred_row("ec.blur.fastbox", "radius", v); diff --git a/crates/engine/src/analysis/frames_key/legacy.rs b/crates/engine/src/analysis/frames_key/legacy.rs index 882c82d80..f3403b309 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,40 @@ 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)) } +/// 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), +]; + +/// 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. diff --git a/crates/engine/src/tests/effect_ranges.rs b/crates/engine/src/tests/effect_ranges.rs index a28746fe5..8a97388c9 100644 --- a/crates/engine/src/tests/effect_ranges.rs +++ b/crates/engine/src/tests/effect_ranges.rs @@ -61,6 +61,7 @@ const ROWS: &[(u32, &str, &str, f64, f64)] = &[ (3471, "ec.distort.transform", "scaleWidth", -30000.0, 30000.0), (3470, "ec.distort.turbulentdisplace", "evolutionOptions/randomSeed", 0.0, 100000.0), (3467, "ec.blur.radial", "amount", 0.0, 1000.0), + (3460, "ec.blur.gaussian", "blurriness", 0.0, 30000.0), (3469, "ec.distort.turbulentdisplace", "amount", -10000.0, 10000.0), (3492, "ec.distort.ccpowerpin", "expandTop", -200.0, 1000.0), (3492, "ec.distort.ccpowerpin", "expandLeft", -200.0, 1000.0), @@ -68,6 +69,7 @@ const ROWS: &[(u32, &str, &str, f64, f64)] = &[ (3492, "ec.distort.ccpowerpin", "expandBottom", -200.0, 1000.0), (3486, "ec.noise.fractal", "subSettings/subScaling", 10.0, 10000.0), (3486, "ec.noise.turbulent", "subSettings/subScaling", 10.0, 10000.0), + (3466, "ec.blur.sharpen", "amount", 0.0, 4000.0), ]; fn path(effect: &str, param: &str) -> String { @@ -169,6 +171,23 @@ fn projects_saved_with_the_narrower_ranges_open_with_the_new_ones() { } } +/// #3466: Sharpen Amount clamps just outside After Effects' 0..4000, and an undo after a +/// clamped set restores the value from before it. +#[test] +fn sharpen_amount_clamps_outside_the_after_effects_range() { + let (mut s, l, _) = session(); + let (e, p) = ("ec.blur.sharpen", "amount"); + for (v, want) in [(4001.0, 4000.0), (-1.0, 0.0)] { + set(&mut s, l, e, p, 1000.0); + assert_eq!(set(&mut s, l, e, p, v), json!(want), "{v}: prop.set reply"); + assert_eq!(read(&mut s, l, e, p), want, "{v}"); + assert!(s.undo()); + assert_eq!(read(&mut s, l, e, p), 1000.0, "{v}: undo"); + assert!(s.redo()); + assert_eq!(read(&mut s, l, e, p), want, "{v}: redo"); + } +} + /// The property at `path` (`group/param`) in an effect instance. fn prop_mut<'a>(g: &'a mut PropGroup, path: &str) -> Option<&'a mut effectcraft_project::Property> { match path.split_once('/') { diff --git a/crates/gpu/src/shaders/kernels.wgsl b/crates/gpu/src/shaders/kernels.wgsl index e038a9ee8..3e3cc3d73 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..d08276504 100644 --- a/crates/gpu/src/tests.rs +++ b/crates/gpu/src/tests.rs @@ -760,6 +760,35 @@ 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); + } +} + +/// #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/crates/gpu/src/tests/fx_noise.rs b/crates/gpu/src/tests/fx_noise.rs index 1bfdd9e56..cdb8f1837 100644 --- a/crates/gpu/src/tests/fx_noise.rs +++ b/crates/gpu/src/tests/fx_noise.rs @@ -75,6 +75,8 @@ fn edge_preserving_blurs() { fn sharpen_and_unsharp_mask() { effect_case("ec.blur.sharpen", &[("amount", n(60.0))]); effect_case("ec.blur.sharpen", &[("amount", n(250.0))]); + // #3466: the top of After Effects' range (80 × the difference from the blur). + effect_case("ec.blur.sharpen", &[("amount", n(4000.0))]); effect_case("ec.blur.unsharp", &[("amount", n(120.0)), ("radius", n(4.0))]); effect_case("ec.blur.unsharp", &[("amount", n(80.0)), ("radius", n(2.5)), ("threshold", n(12.0))]); } diff --git a/docs/effects-parity.md b/docs/effects-parity.md index 175fbf4e5..cb49dc0dc 100644 --- a/docs/effects-parity.md +++ b/docs/effects-parity.md @@ -65,9 +65,11 @@ the GPU is performance, not parity. | Date | Change | Summary | |---|---|---| | 2026-11-17 | minor | Radial Blur: Amount takes After Effects' valid range 0..1000 (slider and default unchanged); Zoom past 200 spreads its samples from the centre outwards instead of sampling the layer mirrored through the centre (CPU and GPU; not yet measured against After Effects past Amount 200) | +| 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-17 | minor | Turbulent Displace: Amount takes After Effects' recorded valid range, −10000..10000 (default and the −200..200 slider unchanged). Past it (an expression's value) Amount is bounded to 2^24 px and a NaN Amount leaves the layer unchanged, so padding and sampling stay finite (CPU and GPU). Locked pinning on a layer under a pixel across no longer crashes | | 2026-11-17 | minor | Fractal and Turbulent Noise: Sub Scaling takes After Effects' 10..10000 (slider and default unchanged), and above 100 each octave is larger than the last instead of being capped at 100; octave scales stay finite at Complexity 20 (CPU and GPU) | | 2026-11-17 | minor | CC Power Pin: Expansion (Top, Left, Right, Bottom) takes After Effects' minimum of −200 % (hard range −200..1000; defaults and sliders unchanged). When two opposite sides add up to less than −100 % the source rectangle flips (CPU and GPU) | +| 2026-11-17 | minor | Sharpen: Amount takes After Effects' recorded valid range, 0..4000 (was 0..500; default and the 0..100 slider unchanged). Sharpen stays linear in Amount and finite up to 4000, CPU and GPU agree there | | 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) |