mirror of
https://github.com/storytold/lightcraft.git
synced 2026-11-25 12:02:13 +01:00
test(pipeline): preserve visible local Clarity in RAW development (#4664)
* test(pipeline): prove visible mask clarity reaches the render * test: format local clarity regression * test: isolate Clarity scheduler borrow --------- Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
1 parent
fd564fdf98
commit
bbb529f64b
1 file changed
+22
-1
@@ -1,4 +1,4 @@
|
||||
//! Pixel tests of the local (mask) Noise, Moiré and Defringe sliders.
|
||||
//! Pixel tests of the local (mask) adjustment sliders.
|
||||
|
||||
use lightcraft_develop::{DevelopSettings, LocalAdjustments, Mask, MaskComponent, MaskOp, MaskShape};
|
||||
use lightcraft_geom::Point;
|
||||
@@ -45,6 +45,27 @@ fn chroma(p: [u8; 4]) -> f32 {
|
||||
p[0] as f32 - p[2] as f32
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn local_clarity_changes_only_the_visible_mask() {
|
||||
// Two identical midtone edges, well inside and well outside the mask.
|
||||
let src = Rgb32f::from_fn(W, H, |x, _| [if x % (W / 2) < W / 4 { 0.10 } else { 0.28 }; 3]);
|
||||
let mut s = left_mask(LocalAdjustments::default());
|
||||
let neutral = shot(&src, &s);
|
||||
let clarity_plane = |s: &DevelopSettings| crate::local::plane_sigmas(s, W as f64, W as f64, crate::Quality::Full).clarity;
|
||||
assert!(clarity_plane(&s).is_none());
|
||||
|
||||
s.masks[0].adjust.clarity = 100.0;
|
||||
assert!(clarity_plane(&s).is_some());
|
||||
let visible = shot(&src, &s);
|
||||
let peak = |center| (center - 4..=center + 4).map(|x| visible.get(x, H / 2)[1].abs_diff(neutral.get(x, H / 2)[1])).max().unwrap_or(0);
|
||||
assert!(peak(W / 4) >= 3, "visible Clarity must move the inside edge by at least 3/255");
|
||||
assert!(peak(3 * W / 4) <= 1, "the far outside edge must stay within 1/255");
|
||||
|
||||
s.masks[0].visible = false;
|
||||
assert!(clarity_plane(&s).is_none());
|
||||
assert!(shot(&src, &s).data == neutral.data, "hidden Clarity must not affect the render");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn local_noise_smooths_luminance_noise_inside_the_mask() {
|
||||
let src = Rgb32f::from_fn(W, H, |x, y| [0.18 * (1.0 + 0.12 * noise(x, y, 1)); 3]);
|
||||
|
||||
Reference in new issue
Block a user