From bb6bfe970f41cb30a672b0f802505dcea7202213 Mon Sep 17 00:00:00 2001 From: Pareilart <147240473+Pareilart@users.noreply.github.com> Date: Sat, 7 Nov 2026 16:21:11 +0100 Subject: [PATCH] LR-BEHAV-RENDER-FIDELITY: V7's tone easing stated in slider units, and checked through FinishParams (#523) Small amounts ease off too (Shadows +10 at 0.88 of V6's): the release notes, process versions and tone_slider's doc said they were unchanged. The checklist rows define a as slider / 100, and the LRC-DEV-PROCESS row lists V6 and V7. A test reads the calibrated strengths from FinishParams. From review. --- crates/pipeline/src/finish.rs | 33 +++++++++++++++++++++++++++++++-- docs/parity-checklist.md | 6 +++--- docs/process-versions.md | 2 +- docs/whats-new.md | 2 +- 4 files changed, 36 insertions(+), 7 deletions(-) diff --git a/crates/pipeline/src/finish.rs b/crates/pipeline/src/finish.rs index 074aad4b98..14a14c46ed 100644 --- a/crates/pipeline/src/finish.rs +++ b/crates/pipeline/src/finish.rs @@ -332,7 +332,8 @@ pub const SHADOWS_EASE: f64 = 1.33; /// A global Highlights or Shadows slider (−100..100) as the strength the local tone operator takes (−1..1). /// /// Up to V6 the strength is the slider's, linearly. From V7 it eases off as the amount grows, `a / (1 + ease·|a|)` -/// for `a` = slider / 100: unchanged for small amounts (slope 1 at 0), and at most `1 / (1 + ease)` of V6's at ±100. +/// for `a` = slider / 100: slope 1 at 0, so small amounts change least (Shadows +10 acts at 0.88 of V6's), and +/// `1 / (1 + ease)` of V6's at ±100. /// Fitted to 56 Lightroom exports of real portrait edits (Canon raws, Highlights −48 to −100, Shadows +40 to +100): /// V6 left their darkest tones about 6 L* above the exports and their brightest about 5 below; the amounts that /// cancel that are about 0.6 of V6's at Shadows +52 and 0.43 at +100, and 0.52 at Highlights −100. Masks keep @@ -952,7 +953,8 @@ mod tests { } let v7 = |v: f64, ease: f64| tone_slider(v, ease, Process::V7); assert_eq!(v7(0.0, SHADOWS_EASE), 0.0); - assert!((v7(1.0, SHADOWS_EASE) - 0.01).abs() < 2e-4, "small amounts are as before"); + assert!((v7(1.0, SHADOWS_EASE) - 0.01).abs() < 2e-4, "slope 1 at 0"); + assert!((v7(10.0, SHADOWS_EASE) / 0.1 - 0.883).abs() < 0.005, "Shadows +10 eases off by about 12 %"); assert!((v7(100.0, SHADOWS_EASE) - 0.43).abs() < 0.005); assert!((v7(52.0, SHADOWS_EASE) - 0.307).abs() < 0.005); assert!((v7(-100.0, HIGHLIGHTS_EASE) + 0.52).abs() < 0.005); @@ -994,6 +996,33 @@ mod tests { assert!(v7 > base && v7 < v6, "Shadows still lifts the darks, less than V6: none {base}, V6 {v6}, V7 {v7}"); } + #[test] + fn a_render_takes_the_calibrated_tone_strengths() { + // the strengths that matched the Lightroom exports: Shadows +52 → ~0.31 (0.6 of V6's), +100 → 0.43, + // Highlights −100 → −0.52; V6 takes the slider's + let params = |p: Process, highlights: f64, shadows: f64| { + let mut s = DevelopSettings { process: p.version(), ..Default::default() }; + (s.light.highlights, s.light.shadows) = (highlights, shadows); + let frame = crate::geometry::Frame::new(64, 8, &s, false); + let info = SourceInfo::default(); + let fp = FinishParams::new(FinishParamsInput { + settings: &s, + frame: &frame, + info: &info, + image_size: (64, 8), + px_per_long: 64.0, + air_pre: 0.0, + space: OutputSpace::Srgb, + }); + (fp.hl, fp.sh) + }; + for (highlights, shadows, hl, sh) in [(0.0, 52.0, 0.0, 0.307), (-100.0, 100.0, -0.521, 0.429)] { + let (got_hl, got_sh) = params(Process::V7, highlights, shadows); + assert!((got_hl - hl).abs() < 0.002 && (got_sh - sh).abs() < 0.002, "V7 {highlights}/{shadows}: {got_hl}, {got_sh}"); + assert_eq!(params(Process::V6, highlights, shadows), ((highlights / 100.0) as f32, (shadows / 100.0) as f32)); + } + } + #[test] fn grain_noise_is_finite_for_degenerate_coordinates() { for (x, y) in [(f32::NAN, 1.0), (1.0, f32::INFINITY), (f32::NEG_INFINITY, f32::NAN)] { diff --git a/docs/parity-checklist.md b/docs/parity-checklist.md index 1b4cf4ec0d..3de476cc4e 100644 --- a/docs/parity-checklist.md +++ b/docs/parity-checklist.md @@ -181,8 +181,8 @@ differences and missing bindings are in [ui-parity.md](ui-parity.md#shortcuts). | LR-EDIT-HDR-MODE | HDR editing | P2 | ✅ | `cmd:develop.hdr`, `ctl:hdr.maxEv`, `crates/ui-egui/src/panels/edit.rs` (`hdr_row`) | HDR button next to B&W in the Edit panel header, as Lightroom (Visualize HDR and the headroom limit in the Light panel while it's on, sliding open and shut with the histogram's layout change); see Q. HDR | | LR-EDIT-LIGHT-EXPOSURE | Exposure | P0 | ✅ | `ctl:light.exposure` | Alt/Option-drag shows highlight clipping (black, clipped channels in colour) | | LR-EDIT-LIGHT-CONTRAST | Contrast | P0 | 🟡 | `ctl:light.contrast` | From process V4, global Contrast on the camera-look path is fitted per channel in ProPhoto with the sRGB transfer. Check response error 0.136 to 0.038 stops on six held-out Sony photos. Other sources and local adjustments retain V2; broader parity remains unverified (`docs/light-v3.md`). | -| LR-EDIT-LIGHT-HIGHLIGHTS | Highlights | P0 | ✅ | `ctl:light.highlights`, `crates/raw/src/highlight.rs` | sensor-clipped highlights stay neutral when Highlights (or Exposure, Whites) darkens them: fully clipped content is rebuilt to the neutral of the colour model applied after it, partly clipped content takes its colour from reliable unclipped content nearby (not from dark objects, lens fringes or another surface beside it) and white where there is none, and pale partly clipped content (a white sky) turns white on its way to clipping (#523); binned previews and thumbnails decide clipping per sample before averaging (`develop_binned_masked`, `highlight::reconstruct_masked`), so a block with one clipped specular sample keeps its mean instead of jumping to the clip level, which reconstruction turned into green speckles at 500 px (#548) From process V2 the Highlights/Shadows base is the edge-aware filter of the 0.15 %-of-long-edge median of log luminance: twigs and fine texture take their surroundings' shift, so bright areas keep their local contrast as with Exposure (V1's base kept ~0.6 of it at −100, #632); region edges stay sharp. Alt/Option-drag shows highlight clipping From process V7 the global amount eases off as it grows (`a / (1 + 0.92·abs(a))`), fitted to Lightroom exports (#523). | -| LR-EDIT-LIGHT-SHADOWS | Shadows | P0 | ✅ | `ctl:light.shadows` | From process V2, the same base as Highlights: dark areas keep their local contrast when lifted (#632). Alt/Option-drag shows shadow clipping (white, clipped channels in colour) From process V7 the global amount eases off as it grows (`a / (1 + 1.33·abs(a))`), fitted to Lightroom exports (#523). | +| LR-EDIT-LIGHT-HIGHLIGHTS | Highlights | P0 | ✅ | `ctl:light.highlights`, `crates/raw/src/highlight.rs` | sensor-clipped highlights stay neutral when Highlights (or Exposure, Whites) darkens them: fully clipped content is rebuilt to the neutral of the colour model applied after it, partly clipped content takes its colour from reliable unclipped content nearby (not from dark objects, lens fringes or another surface beside it) and white where there is none, and pale partly clipped content (a white sky) turns white on its way to clipping (#523); binned previews and thumbnails decide clipping per sample before averaging (`develop_binned_masked`, `highlight::reconstruct_masked`), so a block with one clipped specular sample keeps its mean instead of jumping to the clip level, which reconstruction turned into green speckles at 500 px (#548) From process V2 the Highlights/Shadows base is the edge-aware filter of the 0.15 %-of-long-edge median of log luminance: twigs and fine texture take their surroundings' shift, so bright areas keep their local contrast as with Exposure (V1's base kept ~0.6 of it at −100, #632); region edges stay sharp. Alt/Option-drag shows highlight clipping From process V7 the global amount eases off as it grows: the operator's strength is `a / (1 + 0.92·abs(a))` for `a` = slider / 100 (0.52 at −100, against 1 up to V6), fitted to Lightroom exports (#523). | +| LR-EDIT-LIGHT-SHADOWS | Shadows | P0 | ✅ | `ctl:light.shadows` | From process V2, the same base as Highlights: dark areas keep their local contrast when lifted (#632). Alt/Option-drag shows shadow clipping (white, clipped channels in colour) From process V7 the global amount eases off as it grows: the operator's strength is `a / (1 + 1.33·abs(a))` for `a` = slider / 100 (0.43 at +100, against 1 up to V6), fitted to Lightroom exports (#523). | | LR-EDIT-LIGHT-WHITES | Whites | P0 | 🟡 | `ctl:light.whites`, `crates/pipeline/src/visualize.rs` | V4 preserves V2 Whites for both signs. Calibration is a planned follow-up; measured V2 check response error is 0.075 stops on the Sony test photos (`docs/light-v3.md`). Alt/Option-drag shows highlight clipping (black, clipped channels in colour) | | LR-EDIT-LIGHT-BLACKS | Blacks | P0 | 🟡 | `ctl:light.blacks`, `crates/pipeline/src/visualize.rs` | From process V4, global Blacks on the camera-look path uses a fitted per-channel/luminance mix. Check response error 0.424 to 0.077 stops on six held-out Sony photos; deepest tones still differ. Other sources and local adjustments retain V2 (`docs/light-v3.md`). Alt/Option-drag shows shadow clipping (white, clipped channels in colour) | | LR-EDIT-LIGHT-CURVE-PARAM | Parametric curve | P0 | ✅ | `ctl:curve.highlights`, `ctl:curve.lights`, `ctl:curve.darks`, `ctl:curve.shadows`, `ctl:curve.split*`, `crates/pipeline/src/curve.rs` | the graph draws the renderer's own curve model; dragging the line moves the region under the pointer (one undo step) | @@ -732,7 +732,7 @@ From `08-lightroom-classic-extras.md` (Classic-only features) and part 2 of `06- | LRC-DEV-CALIB | Calibration panel | P1 | ✅ | `ctl:calibration.*` | | | LRC-DEV-TAT | Targeted adjustment tools | P1 | ✅ | `cmd:develop.targeted` (`target`: curve / hue / sat / lum) | | | LRC-DEV-DEFAULTS | Per-camera raw defaults | P1 | ✅ | `cmd:library.preferences` (`camera`, `import.perCamera`), `crates/ui-egui/src/dialogs/settings.rs` | Settings → Import: raw default and per-camera presets | -| LRC-DEV-PROCESS | Process versions, Update to Current Process | P1 | ✅ | `cmd:develop.updateProcess`, `cmd:develop.reset`, `cmd:develop.get`, `crates/develop/src/settings.rs`, `crates/pipeline/src/finish.rs`, `docs/process-versions.md` | Each photo keeps its saved rendering process. V1 is legacy, V2 preserves Highlights/Shadows detail, V3 is pixel-scale sharpening, V4 calibrates camera-look Contrast and Blacks, V5 rolls raw tone curves off into white in stops (#1632). New photos and Reset use the latest; Update is one undoable step and never downgrades a future number. Copy/paste/sync preserve the receiving process. Persistent render keys include the resolved process from V3 on; V1/V2 keys remain unchanged. | +| LRC-DEV-PROCESS | Process versions, Update to Current Process | P1 | ✅ | `cmd:develop.updateProcess`, `cmd:develop.reset`, `cmd:develop.get`, `crates/develop/src/settings.rs`, `crates/pipeline/src/finish.rs`, `docs/process-versions.md` | Each photo keeps its saved rendering process. V1 is legacy, V2 preserves Highlights/Shadows detail, V3 is pixel-scale sharpening, V4 calibrates camera-look Contrast and Blacks, V5 rolls raw tone curves off into white in stops (#1632), V6 takes colour noise reduction to the joint method (#815), V7 eases global Highlights and Shadows off at large amounts and has negative Texture and the Global grading wheel act less, as measured against Lightroom exports (#523). New photos and Reset use the latest; Update is one undoable step and never downgrades a future number. Copy/paste/sync preserve the receiving process. Persistent render keys include the resolved process from V3 on; V1/V2 keys remain unchanged. | | LRC-DEV-VIEWOPTIONS | Develop view options | P2 | 🟡 | `cmd:view.viewOptions`, `crates/ui-egui/src/dialogs/settings.rs` (`view_options`) | View ▸ View Options… (⌘J), the Loupe View part: Show Info Overlay with Info 1 / Info 2, and the three lines of each (none, file name, capture date, dimensions, exposure, camera, lens, camera + lens) with Use Defaults; Show Briefly When Photo Changes under each Info (one at most): with the overlay off, that Info shows for 3 s each time the loupe changes photo; General's Show message when loading or rendering photos (on by default; off, the loupe does not say "Rendering…"); applied as they change, saved with the app settings; `view.viewOptions {info1, info2, briefly, loupeMessages}` sets them for agents. Not yet: the Grid View tab, more fields (ratings, metadata, copy name), the video-frame option | | LRC-DEV-LOUPEOVERLAY | Loupe overlay: layout image | P2 | 🟡 | `cmd:view.chooseLayoutImage`, `cmd:view.layoutImage`, `cmd:view.layoutImageOpacity`, `cmd:view.layoutImageMatte`, `crates/ui-egui/src/panels/layout_overlay.rs` | View ▸ Loupe Overlay: a PNG with transparency (a cover layout, a banner's safe areas) fitted and centred over the loupe photo, following zoom and pan; opacity and matte (the photo darkened outside the graphic's box) in steps; ⌥⌘O shows / hides it; read off the UI thread; saved with the UI state. Not yet: the Grid and Guides overlays, moving and resizing the layout with ⌘ held, free opacity / matte sliders | | LRC-DEV-VIDEO | Video frame capture | P2 | ⬜ | | | diff --git a/docs/process-versions.md b/docs/process-versions.md index 16c84bb2ae..9e66a0a92a 100644 --- a/docs/process-versions.md +++ b/docs/process-versions.md @@ -15,7 +15,7 @@ stronger Light sliders, issue #196) without changing a single photo someone has | **V4** | V3 plus calibrated global Contrast (per channel) and Blacks (per-channel/luminance mix) on raws with a camera tone curve. Whites behaves exactly as V2, both signs; its calibration is a planned follow-up. Other sources and local adjustments retain V2 operators. See [calibrated Light operators](light-v3.md). | | **V5** | V4 plus: a raw's tone curve rolls off into white in stops instead of reaching it within about a stop of the sensor's white, so raising Exposure keeps the highlights the sensor recorded (issue #1632). **Camera curve** (the look fitted to the embedded JPEG, or a DNG's `ProfileToneCurve`; `CameraTone`): past its last knot `CameraTone::apply_rolloff` closes the gap to white by `gap / (1 + c·(2^t − 1))` at `t` stops past the knot, with `c` matching the curve's slope there and the gap halving every stop in the end (`tone::ROLLOFF_STOPS`); `ToneMap::camera_rolloff_hdr` builds the table from it. Under V1 to V4 the curve past its last knot (fitted only to camera JPEG tones below 0.85, so 1 to 3 stops below the sensor's white on most photos) closes on white exponentially in linear light: the sensor's white renders at 8-bit 246 to 254 at Exposure 0 and 254 to 255 from Exposure +1. On the 11 CC0 corpus files with a fitted look (8 Sony, 2 Nikon, 1 Fujifilm) it now renders at 239 to 250 at Exposure 0 and 247 to 253 at +1. A DNG curve that reaches white at the sensor's white renders as before. **Generic curve** (raws without a camera curve, `ToneMap::rolloff_hdr`): from half a stop below its white point (`tone::GENERIC_KNEE_STOPS`) the same shoulder takes over, with the extended Reinhard curve's value and slope at the join, where V1 to V4 clip at the white point (scene 1.18 at default settings, ¼ stop above the sensor's white). The sensor's white renders at about 235, 248 and 252 at Exposure 0, +1 and +2 (V1 to V4: 239, 255, 255; the CC0 Canon R8 file and 6 CC0 DNGs without a camera curve). Content past the old clip point, such as a clipped sky, now renders up to 15 codes below white at Exposure 0 and reaches 255 about 5 stops past the sensor's white. Below the last knot or the join, JPEGs and other display-referred sources, and the camera fit itself are unchanged; CPU and GPU share the tone LUT. | | **V6** | V5 plus: colour noise reduction filters the linear colour differences R−Y and B−Y with the joint method (issue #815, `docs/nr-color-joint.md`): edge-aware weights from a denoised guide shared by both differences, anisotropic diffusion over scales, a brake for isolated colour specks; Y is kept exactly. V1 to V5 keep the blurred chromaticity (`local::denoise`). CPU (`local::denoise`) and GPU (`render::denoise`) branch on `local::joint_colour_nr`. Renders with Color 0 are the same as V2's. | -| **V7** (the latest) | V6 plus: global Highlights and Shadows ease off at large amounts (`finish::tone_slider`): the strength the local tone operator takes is `a / (1 + ease·abs(a))` for `a` = slider / 100, so small amounts are unchanged (slope 1 at 0) and ±100 acts at 0.52 (Highlights, ease 0.92) and 0.43 (Shadows, ease 1.33) of V6's. Fitted to 56 Lightroom exports of real portrait edits of Canon raws (Highlights −48 to −100, Shadows +40 to +100), against which V6 rendered the darkest tones about 6 L* too light and the brightest about 5 L* too dark. Masks keep their linear amounts; amounts between 0 and ±40 had no exports to check. CPU and GPU take the strength from `FinishParams`. Renders with both sliders at 0 are the same as V6's. Also from V7: a negative global Texture smooths at 0.67 of V6's strength (`finish::texture_slider`; at −27, V6 left the 1–8 px detail of four full-size Lightroom exports of Canon EOS R6 edits at 0.87–0.94 of theirs, and 0.67 brings it to 0.94–1.02); and the global colour-grading wheel tints at 0.45 of the other wheels at the same saturation (`colorops::global_wheel`; V6 left photos graded Global 10 and 16 about +2 b* warmer than the exports). Positive Texture, the shadows, midtones and highlights wheels and masks are unchanged. | +| **V7** (the latest) | V6 plus: global Highlights and Shadows ease off at large amounts (`finish::tone_slider`): the strength the local tone operator takes is `a / (1 + ease·abs(a))` for `a` = slider / 100, so the easing grows with the amount (slope 1 at 0; Shadows +10 acts at 0.88 of V6's, Highlights −10 at 0.92) and ±100 acts at 0.52 (Highlights, ease 0.92) and 0.43 (Shadows, ease 1.33) of V6's. Fitted to 56 Lightroom exports of real portrait edits of Canon raws (Highlights −48 to −100, Shadows +40 to +100), against which V6 rendered the darkest tones about 6 L* too light and the brightest about 5 L* too dark. Masks keep their linear amounts; amounts between 0 and ±40 had no exports to check. CPU and GPU take the strength from `FinishParams`. Renders with both sliders at 0 are the same as V6's. Also from V7: a negative global Texture smooths at 0.67 of V6's strength (`finish::texture_slider`; at −27, V6 left the 1–8 px detail of four full-size Lightroom exports of Canon EOS R6 edits at 0.87–0.94 of theirs, and 0.67 brings it to 0.94–1.02); and the global colour-grading wheel tints at 0.45 of the other wheels at the same saturation (`colorops::global_wheel`; V6 left photos graded Global 10 and 16 about +2 b* warmer than the exports). Positive Texture, the shadows, midtones and highlights wheels and masks are unchanged. | ## The rule diff --git a/docs/whats-new.md b/docs/whats-new.md index 60d8eeb724..8c83602a62 100644 --- a/docs/whats-new.md +++ b/docs/whats-new.md @@ -4,7 +4,7 @@ ### Highlights and Shadows closer to Lightroom (process V7) - Global Highlights and Shadows ease off at large amounts as Lightroom's do (issue #523): ±100 acts at about half of - what it did (0.52 of it for Highlights, 0.43 for Shadows), +52 Shadows at 0.6, and small amounts are as before. + what it did (0.52 of it for Highlights, 0.43 for Shadows), +52 Shadows at 0.6, and small amounts less so (about 12 % less at +10 Shadows, 8 % at −10 Highlights). Strong Shadows no longer lift the darkest tones about 6 L* above Lightroom's render of the same edit, nor strong Highlights pull the brightest about 5 L* below it. Masks keep their amounts. New photos get it; photos edited before keep their look until Update to Current Process.