diff --git a/crates/develop/src/settings.rs b/crates/develop/src/settings.rs index a40f094c25f..5b316a28460 100644 --- a/crates/develop/src/settings.rs +++ b/crates/develop/src/settings.rs @@ -84,17 +84,22 @@ pub enum Process { /// Highlights and Shadows keep the local contrast of the tones they move: their edge-aware base /// is taken of a fine median of log luminance (issue #632). V2, + /// Sharpening works at the original photo's pixels (Radius is in them, a view smaller than the + /// photo sharpens the detail it shows), and a raw gets a base look under every profile: a tone + /// curve, a colour matrix and a hue table matched to a reference rendering. + V3, } impl Process { /// Every process, oldest first. - pub const ALL: [Process; 2] = [Process::V1, Process::V2]; - pub const LATEST: Process = Process::V2; + pub const ALL: [Process; 3] = [Process::V1, Process::V2, Process::V3]; + pub const LATEST: Process = Process::V3; pub const fn version(self) -> ProcessVersion { match self { Process::V1 => ProcessVersion(1), Process::V2 => ProcessVersion(2), + Process::V3 => ProcessVersion(3), } } } diff --git a/crates/gpu/src/params.rs b/crates/gpu/src/params.rs index 7f9405492c4..d07ac8275c0 100644 --- a/crates/gpu/src/params.rs +++ b/crates/gpu/src/params.rs @@ -17,6 +17,8 @@ const FIELDS: &[(&str, usize)] = &[ ("SRGB_OFF", 1), ("CURVE_OFF", 1), ("CURVES", 1), + ("LOOK", 1), + ("LOOK_OFF", 1), ("GAIN", 1), ("EV", 1), ("AIR", 1), @@ -28,6 +30,9 @@ const FIELDS: &[(&str, usize)] = &[ ("DEHAZE", 1), ("SHARPEN", 1), ("SHARPEN_MASK", 1), + ("SHARPEN_GAIN", 1), + ("SHARPEN_FINE", 1), + ("SHARPEN_TAPS", 3), ("HAS_CLAR", 1), ("HAS_TEX", 1), ("HAS_DARK", 1), @@ -152,6 +157,10 @@ pub fn finish_block(fp: &FinishParams, masks: &[[f32; MASK_TERMS]], present: &Pr aux.extend_from_slice(&l.v); } } + let look_off = aux.len(); + if fp.look { + aux.extend(lightcraft_pipeline::look_table::TABLE.iter().flatten()); + } let mask_off = aux.len(); for m in masks { aux.extend_from_slice(m); @@ -165,6 +174,8 @@ pub fn finish_block(fp: &FinishParams, masks: &[[f32; MASK_TERMS]], present: &Pr p.u("SRGB_OFF", srgb_off as u32); p.u("CURVE_OFF", curve_off as u32); p.b("CURVES", fp.curves.is_some()); + p.b("LOOK", fp.look); + p.u("LOOK_OFF", look_off as u32); p.f("REFINE_SAT", fp.refine_sat); p.f("GAIN", fp.gain); p.f("EV", fp.ev); @@ -177,6 +188,9 @@ pub fn finish_block(fp: &FinishParams, masks: &[[f32; MASK_TERMS]], present: &Pr p.f("DEHAZE", fp.dehaze); p.f("SHARPEN", fp.sharpen); p.f("SHARPEN_MASK", fp.sharpen_mask); + p.f("SHARPEN_GAIN", lightcraft_pipeline::finish::SHARPEN_GAIN); + p.b("SHARPEN_FINE", fp.sharpen_fine); + p.fs("SHARPEN_TAPS", &fp.sharpen_taps); p.b("HAS_CLAR", present.clarity); p.b("HAS_TEX", present.texture); p.b("HAS_DARK", present.dark); diff --git a/crates/gpu/src/wgsl/finish.wgsl b/crates/gpu/src/wgsl/finish.wgsl index d51308ee0e0..4f4adf3f492 100644 --- a/crates/gpu/src/wgsl/finish.wgsl +++ b/crates/gpu/src/wgsl/finish.wgsl @@ -252,6 +252,68 @@ fn out_encode(v: f32) -> f32 { return 1.099 * pow(l, 0.45) - 0.099; } +// `lightcraft_pipeline::look_table::apply`: linear Rec.2020 through the base look's hue table +// (OkLCh; 24 hues × 5 chromas × 6 lightnesses, trilinear, hue wrapping), stored in `aux` at LOOK_OFF. +fn look_node(i: u32) -> vec3 { + let o = pu(F_LOOK_OFF) + 3u * i; + return vec3(aux[o], aux[o + 1u], aux[o + 2u]); +} + +fn look_apply(rgb: vec3) -> vec3 { + let lab = oklab(max(rgb, vec3(0.0))); + let l = lab.x; + let c = length(lab.yz); + // (`look_table::NEUTRAL_CHROMA`) + if (!(l > 0.0) || !(c > 5e-4)) { + return rgb; + } + let h = atan2(lab.z, lab.y); + let hf = fract(h / 6.283185307) * 24.0; + let h0 = u32(floor(hf)) % 24u; + let th = hf - floor(hf); + let cf = clamp(c / 0.05, 0.0, 4.0 - 1e-4); + let c0 = u32(floor(cf)); + let tc = cf - floor(cf); + let lf = clamp(l / 0.2, 0.0, 5.0 - 1e-4); + let l0 = u32(floor(lf)); + let tl = lf - floor(lf); + var v = vec3(0.0); + for (var dh = 0u; dh < 2u; dh++) { + let wh = select(1.0 - th, th, dh == 1u); + for (var dc = 0u; dc < 2u; dc++) { + let wc = select(1.0 - tc, tc, dc == 1u); + for (var dl = 0u; dl < 2u; dl++) { + let wl = select(1.0 - tl, tl, dl == 1u); + let i = (((h0 + dh) % 24u) * 5u + (c0 + dc)) * 6u + (l0 + dl); + v += wh * wc * wl * look_node(i); + } + } + } + let h2 = h + v.x; + let c2 = c * exp(v.y); + return oklab_inv(vec3(l * exp(v.z), c2 * cos(h2), c2 * sin(h2))); +} + +// `lightcraft_pipeline::finish::blur5`: log_l at (x, y) through the separable five-tap +// SHARPEN_TAPS (centre, ±1, ±2), edges clamped; rows summed first, as the CPU does. +fn sharpen_blur(x: u32, y: u32, w: u32, h: u32) -> f32 { + var sum = 0.0; + for (var dy = -2; dy <= 2; dy++) { + let wy = pf(F_SHARPEN_TAPS + u32(abs(dy))); + if (wy == 0.0) { + continue; + } + let yy = u32(clamp(i32(y) + dy, 0, i32(h) - 1)); + var row = 0.0; + for (var dx = -2; dx <= 2; dx++) { + let xx = u32(clamp(i32(x) + dx, 0, i32(w) - 1)); + row += pf(F_SHARPEN_TAPS + u32(abs(dx))) * log_l[yy * w + xx]; + } + sum += wy * row; + } + return sum; +} + @compute @workgroup_size(16, 16) fn main(@builtin(global_invocation_id) gid: vec3) { let w = pu(F_W); @@ -378,19 +440,30 @@ fn main(@builtin(global_invocation_id) gid: vec3) { delta += cl * 0.85 * det * (0.35 + 0.65 * mid); } let tx = pf(F_TEX) + lt[8]; - let sp = lt[13] * 0.6 + pf(F_SHARPEN); - if ((tx != 0.0 || sp != 0.0) && pu(F_HAS_TEX) != 0u) { + if (tx != 0.0 && pu(F_HAS_TEX) != 0u) { let det = l_pre - tex[i]; let tame = 1.0 - 0.6 * sstep(0.4, 1.6, abs(det)); delta += tx * 1.1 * clamp(det, -1.0, 1.0) * tame; - if (sp != 0.0) { - let sm = pf(F_SHARPEN_MASK); - var mk = 1.0; - if (sm > 0.0) { - mk = sstep(sm * 0.25, sm * 0.25 + 0.15, abs(det)); - } - delta += sp * 1.3 * clamp(det, -0.8, 0.8) * mk; + } + // sharpening: from V3 an unsharp mask at the original's pixels (SHARPEN_TAPS), before it the + // texture band + let sp = lt[13] * 0.6 + pf(F_SHARPEN); + let fine = pu(F_SHARPEN_FINE) != 0u; + if (sp != 0.0 && (fine || pu(F_HAS_TEX) != 0u)) { + var det = 0.0; + var gain = 1.3; + if (fine) { + det = l_pre - sharpen_blur(x, y, w, h); + gain = pf(F_SHARPEN_GAIN); + } else { + det = l_pre - tex[i]; + } + let sm = pf(F_SHARPEN_MASK); + var mk = 1.0; + if (sm > 0.0) { + mk = sstep(sm * 0.25, sm * 0.25 + 0.15, abs(det)); } + delta += sp * gain * clamp(det, -0.8, 0.8) * mk; } // local Noise: smooth (or, negative, boost) small-amplitude detail, keep edges if (l_noise != 0.0 && pu(F_HAS_TEX) != 0u) { @@ -467,6 +540,11 @@ fn main(@builtin(global_invocation_id) gid: vec3) { } } + // --- the base look's hue table (display-referred, before the output conversion) + if (pu(F_LOOK) != 0u) { + d = look_apply(d); + } + // --- gamut map to the output space (desaturate towards luminance until in range) let om = array, 3>( vec3(pf(F_OUT_M), pf(F_OUT_M + 1u), pf(F_OUT_M + 2u)), diff --git a/crates/pipeline/src/finish.rs b/crates/pipeline/src/finish.rs index eb65d51a2b9..110c7db5147 100644 --- a/crates/pipeline/src/finish.rs +++ b/crates/pipeline/src/finish.rs @@ -5,7 +5,7 @@ use lightcraft_color::spline::{Lut1, MonotoneCurve}; use lightcraft_color::transfer::linear_to_srgb; use lightcraft_develop::{DevelopSettings, LocalAdjustments, Process, ToneCurve, VignetteStyle}; use lightcraft_geom::Point; -use lightcraft_raster::Rgba8; +use lightcraft_raster::{Plane, Rgba8}; use crate::colorops::ColorOps; use crate::geometry::Frame; @@ -20,15 +20,94 @@ fn smooth(e0: f32, e1: f32, x: f32) -> f32 { t * t * (3.0 - 2.0 * t) } -/// Parametric region curve (encoded domain) composed with the master point curve. -fn curve_luts(c: &ToneCurve) -> Option<[Lut1; 3]> { +/// The base tone curve of a raw (encoded 0..1, `(in, out)`; the Color profile's look): an S that +/// deepens blacks and shadows and brightens highlights while holding the mid-tones. Matched +/// black-box, by tone quantiles, to Lightroom exports (Adobe Color) of three raws at the same +/// settings: at each level the median of the three photos' curves (a dark, underexposed scene +/// wanted darker mid-tones than the other two; the median follows the two that agree). No number +/// comes from Adobe's software. +const COLOR_CURVE: [(f64, f64); 14] = [ + (0.0, 0.0), + (4.0 / 255.0, 1.0 / 255.0), + (8.0 / 255.0, 4.7 / 255.0), + (16.0 / 255.0, 10.3 / 255.0), + (24.0 / 255.0, 17.7 / 255.0), + (32.0 / 255.0, 25.3 / 255.0), + (48.0 / 255.0, 40.6 / 255.0), + (64.0 / 255.0, 58.8 / 255.0), + (96.0 / 255.0, 94.3 / 255.0), + (128.0 / 255.0, 129.3 / 255.0), + (160.0 / 255.0, 163.0 / 255.0), + (192.0 / 255.0, 185.7 / 255.0), + (224.0 / 255.0, 222.3 / 255.0), + (1.0, 1.0), +]; + +/// The base colour of a raw (linear Rec.2020, row-major; the Color profile's look), applied before +/// the tone map: a 3×3 that keeps every colour's luminance (its rows weighted by Rec.2020's +/// luminance sum to those weights) and neutral neutral (white balance decides what is neutral; each +/// row sums to 1), and moves chromaticity the way a Lightroom export (Adobe Color) of the same raw +/// renders it, fitted black-box by weighted least squares on the aligned exports of three raws +/// (each photo weighted equally, the two shot at a custom white balance with their own +/// white-balance difference fitted out). It turns the warm, slightly green grey a camera-JPEG look +/// gives near-neutral subjects towards the magenta-leaning grey of that rendering. No number comes +/// from Adobe's software. +const COLOR_MATRIX: [[f64; 3]; 3] = [[0.96239, 0.19774, -0.16013], [-0.00966, 0.95648, 0.05318], [0.27707, -0.37840, 1.10133]]; + +/// Whether `s`'s process sharpens at the original photo's pixels ([`sharpen_taps`], from V3); before +/// V3 sharpening reads the texture band, a fixed fraction of the frame. +pub fn sharpens_at_original_pixels(s: &DevelopSettings) -> bool { + match s.process.process() { + Process::V1 | Process::V2 => false, + Process::V3 => true, + } +} + +/// Whether `s`'s process gives a raw the base look ([`COLOR_CURVE`], [`COLOR_MATRIX`], +/// [`crate::look_table`]): from V3. +pub fn has_base_look(s: &DevelopSettings) -> bool { + match s.process.process() { + Process::V1 | Process::V2 => false, + Process::V3 => true, + } +} + +/// Entries of the tone-curve tables. +const CURVE_N: usize = 1024; + +/// The base look of a raw ([`COLOR_CURVE`] as a table): the Color profile's tone, and the base the +/// other profiles' looks are deltas on (`profiles::effective`), as a base profile is in Lightroom. +/// Raws only: a JPEG or TIFF keeps the rendering it has. Under HDR the curves continue with slope 1 +/// above SDR white (see `finish_with`). +fn color_look(s: &DevelopSettings, info: &SourceInfo) -> Option { + if !info.raw || !has_base_look(s) { + return None; + } + let curve = MonotoneCurve::new(&COLOR_CURVE); + Some(Lut1::from_fn(CURVE_N, |x| (curve.eval(f64::from(x)) as f32).clamp(0.0, 1.0))) +} + +/// The base look's colour ([`COLOR_MATRIX`]) under the user's calibration matrix `user`: raws only, +/// as [`color_look`]. +fn color_calibration(s: &DevelopSettings, info: &SourceInfo, user: Option<[[f32; 3]; 3]>) -> Option<[[f32; 3]; 3]> { + if !info.raw || !has_base_look(s) { + return user; + } + let u = user.map_or([[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]], |m| m.map(|row| row.map(f64::from))); + // the user's calibration after the look: u · look + Some(std::array::from_fn(|r| std::array::from_fn(|c| (0..3).map(|j| u[r][j] * COLOR_MATRIX[j][c]).sum::() as f32))) +} + +/// Parametric region curve (encoded domain) composed with the master point curve, over the +/// profile's `look` curve when it has one (the look is underneath the user's curves). +fn curve_luts(c: &ToneCurve, look: Option<&Lut1>) -> Option<[Lut1; 3]> { let parametric = c.highlights != 0.0 || c.lights != 0.0 || c.darks != 0.0 || c.shadows != 0.0; let master = !ToneCurve::point_curve_is_identity(&c.master); let chans = [&c.red, &c.green, &c.blue].map(|p| !ToneCurve::point_curve_is_identity(p)); if !parametric && !master && !chans.iter().any(|b| *b) { - return None; + return look.map(|l| std::array::from_fn(|_| l.clone())); } - const N: usize = 1024; + const N: usize = CURVE_N; let (s1, s2, s3) = ((c.split_shadows / 100.0) as f32, (c.split_mid / 100.0) as f32, (c.split_highlights / 100.0) as f32); let regions = [(0.0, s1, c.shadows), (s1, s2, c.darks), (s2, s3, c.lights), (s3, 1.0, c.highlights)]; let mut base = Lut1::from_fn(N, |x| { @@ -48,6 +127,9 @@ fn curve_luts(c: &ToneCurve) -> Option<[Lut1; 3]> { for i in 1..N { base.v[i] = base.v[i].max(base.v[i - 1]); } + if let Some(l) = look { + base = base.compose(l); + } let to_pts = |p: &[Point]| p.iter().map(|q| (q.x, q.y)).collect::>(); if master { base = MonotoneCurve::new(&to_pts(&c.master)).to_lut(N).compose(&base); @@ -176,6 +258,11 @@ pub struct FinishParams { pub dehaze: f32, pub sharpen: f32, pub sharpen_mask: f32, + /// Sharpening's blur ([`sharpen_taps`]): weights of the pixel and of those 1 and 2 px away + /// (per axis), for a Radius in the original photo's pixels at this render's scale. + pub sharpen_taps: [f32; 3], + /// Sharpening at the original's pixels ([`sharpens_at_original_pixels`]); else the texture band. + pub sharpen_fine: bool, /// Airlight after and before exposure, exposure gain and EV (see [`crate::Prepared`]). pub air: f32, pub air_pre: f32, @@ -195,6 +282,54 @@ pub struct FinishParams { /// Peak linear output relative to SDR white: 1 for SDR renders; `2^max_ev` for an HDR render /// ([`OutputDepth::F32Hdr`] with HDR on), which keeps values above 1 instead of clipping them. pub peak: f32, + /// The base look's hue table ([`crate::look_table`]) applies: a raw. + pub look: bool, +} + +/// Output pixels per pixel of the original photo (at most 1): what a radius given in the +/// original's pixels (Sharpening's) spans in this render. +fn original_scale(info: &SourceInfo, frame: &Frame, px_per_long: f64) -> f32 { + let src_long = frame.ow.max(frame.oh).round().max(1.0) as usize; + crate::local::detail_scale(px_per_long, info.native_long.unwrap_or(0).max(src_long)) +} + +/// Strength of Sharpening's detail (log2 luminance per unit Amount/150), and the Gaussian width per +/// unit of Radius (original pixels). Calibrated against a Lightroom export of the same raw at the +/// same settings (Amount 40, Radius 1.0): image-wide detail at the finest three octaves within 10 %. +pub const SHARPEN_GAIN: f32 = 6.0; +pub const SHARPEN_RADIUS_SCALE: f32 = 1.5; + +/// `plane` at (`x`, `y`) blurred by the separable five-tap `taps` ([`sharpen_taps`]), edges clamped. +fn blur5(plane: &Plane, x: usize, y: usize, taps: &[f32; 3]) -> f32 { + let (x, y) = (x as isize, y as isize); + let mut sum = 0.0; + for dy in -2isize..=2 { + let wy = taps.get(dy.unsigned_abs()).copied().unwrap_or(0.0); + if wy == 0.0 { + continue; + } + let row = (-2isize..=2).map(|dx| taps.get(dx.unsigned_abs()).copied().unwrap_or(0.0) * plane.get_clamped(x + dx, y + dy)).sum::(); + sum += wy * row; + } + sum +} + +/// Separable blur weights `[centre, ±1 px, ±2 px]` (summing to 1 over the five taps) for an +/// unsharp mask of radius `sigma` output pixels. Sharpening works at the original photo's pixels: +/// a view smaller than the photo gets the blur that sharpening at full size and scaling down +/// leaves, a fraction of a pixel, so it sharpens the finest detail the view shows (a Gaussian of +/// the same width would sample to no blur at all). Radii past ~1.5 px are cut at 2 px. +pub fn sharpen_taps(sigma: f32) -> [f32; 3] { + let sigma = if sigma.is_finite() { sigma.clamp(0.05, 4.0) } else { 0.05 }; + if sigma < 0.7 { + // [c, 1 − 2c, c] with a Gaussian's response at a third of the sampling rate (it meets the + // sampled Gaussian below at about 0.7 px) + let c = ((1.0 - (-2.0 * std::f32::consts::PI.powi(2) * sigma * sigma / 9.0).exp()) / 3.0).min(0.25); + return [1.0 - 2.0 * c, c, 0.0]; + } + let g = |k: f32| (-k * k / (2.0 * sigma * sigma)).exp(); + let sum = g(0.0) + 2.0 * g(1.0) + 2.0 * g(2.0); + [g(0.0) / sum, g(1.0) / sum, g(2.0) / sum] } impl FinishParams { @@ -226,12 +361,13 @@ impl FinishParams { let peak = s.hdr.peak(); FinishParams { peak, - calib: if calibration { crate::colorops::calibration_matrix(&s.calibration) } else { None }, + look: info.raw && has_base_look(s), + calib: color_calibration(s, info, if calibration { crate::colorops::calibration_matrix(&s.calibration) } else { None }), shadow_tint: if calibration { (s.calibration.shadows_tint / 100.0) as f32 } else { 0.0 }, tone: base_tone(s, info, peak), lut: crate::lut::get(&s.profile.id).map(|l| (l, (s.profile.amount / 100.0).clamp(0.0, 2.0) as f32)), ops: ColorOps::new(s), - curves: curve_luts(&s.curve), + curves: curve_luts(&s.curve, color_look(s, info).as_ref()), refine_sat: (s.curve.refine_saturation / 100.0).clamp(0.0, 1.0) as f32, vig: if effects { vignette(s) } else { None }, to_out: space.from_working(), @@ -245,6 +381,8 @@ impl FinishParams { dehaze, sharpen: (s.detail.sharpen_amount / 150.0) as f32, sharpen_mask: (s.detail.sharpen_masking / 100.0) as f32, + sharpen_fine: sharpens_at_original_pixels(s), + sharpen_taps: sharpen_taps(s.detail.sharpen_radius as f32 * SHARPEN_RADIUS_SCALE * original_scale(info, frame, px_per_long)), air: air_pre * gain, air_pre, gain, @@ -280,8 +418,9 @@ impl FinishParams { pub fn base_tone(s: &DevelopSettings, info: &SourceInfo, peak: f32) -> ToneMap { let l = &s.light; match s.process.process() { - // V2 changes the Highlights/Shadows base (`local::tone_base`), not the tone map - Process::V1 | Process::V2 => match info.camera_tone.as_ref().filter(|_| info.raw) { + // V2 changes the Highlights/Shadows base (`local::tone_base`) and V3 sharpening and the base + // look (later in this stage: `sharpens_at_original_pixels`, `has_base_look`), not the tone map + Process::V1 | Process::V2 | Process::V3 => match info.camera_tone.as_ref().filter(|_| info.raw) { Some(curve) => ToneMap::camera_hdr(curve, l.contrast, l.whites, l.blacks, peak), None if info.raw => ToneMap::hdr(l.contrast, l.whites, l.blacks, peak), None => ToneMap::display_hdr(l.contrast, l.whites, l.blacks, peak), @@ -501,17 +640,26 @@ pub(crate) fn finish_with( delta += cl * 0.85 * det * (0.35 + 0.65 * mid); } let tx = tex + l_tex; - let sp = l_sharp * 0.6 + sharpen; - if (tx != 0.0 || sp != 0.0) + if tx != 0.0 && let Some(b) = &p.texture_blur { let det = l_pre - b.data[i]; let tame = 1.0 - 0.6 * smooth(0.4, 1.6, det.abs()); delta += tx * 1.1 * det.clamp(-1.0, 1.0) * tame; - if sp != 0.0 { - let m = if sharpen_mask > 0.0 { smooth(sharpen_mask * 0.25, sharpen_mask * 0.25 + 0.15, det.abs()) } else { 1.0 }; - delta += sp * 1.3 * det.clamp(-0.8, 0.8) * m; - } + } + // sharpening: from V3 an unsharp mask at the original's pixels (`sharpen_taps`), before + // it the texture band + let sp = l_sharp * 0.6 + sharpen; + let det = if sp == 0.0 { + None + } else if fp.sharpen_fine { + Some((l_pre - blur5(&p.log_l, x, y, &fp.sharpen_taps), SHARPEN_GAIN)) + } else { + p.texture_blur.as_ref().map(|b| (l_pre - b.data[i], 1.3)) + }; + if let Some((det, gain)) = det { + let m = if sharpen_mask > 0.0 { smooth(sharpen_mask * 0.25, sharpen_mask * 0.25 + 0.15, det.abs()) } else { 1.0 }; + delta += sp * gain * det.clamp(-0.8, 0.8) * m; } // local Noise: smooth (or, negative, boost) small-amplitude detail, keep edges if l_noise != 0.0 @@ -581,6 +729,11 @@ pub(crate) fn finish_with( } } + // --- the base look's hue table (display-referred, before the output conversion) + if fp.look { + d = crate::look_table::apply(d); + } + // --- gamut map to the output space (desaturate towards luminance until in range); // soft proofing maps into the proof space first and shows that in the output space let mut warn = None; @@ -773,6 +926,43 @@ fn enc(v: f32) -> u8 { mod tests { use super::*; + #[test] + fn v3_sharpens_every_photo_and_gives_only_raws_a_base_look() { + use lightcraft_develop::ProcessVersion; + let params = |v: u32, raw: bool| { + let s = DevelopSettings { process: ProcessVersion(v), ..DevelopSettings::default() }; + let info = SourceInfo { raw, ..SourceInfo::default() }; + let frame = Frame::new(300, 200, &s, true); + FinishParams::new(&s, &frame, &info, 300, 200, 300.0, 1.0, OutputSpace::Srgb) + }; + for v in [1, 2] { + // an edit made before V3 renders as it did: no base look, sharpening on the texture band + let p = params(v, true); + assert!(!p.look && p.curves.is_none() && p.calib.is_none() && !p.sharpen_fine, "V{v}"); + } + let p = params(3, true); + assert!(p.look && p.curves.is_some() && p.calib.is_some() && p.sharpen_fine, "V3 raw"); + // a rendered file keeps its own look, whatever the process + let p = params(3, false); + assert!(!p.look && p.curves.is_none() && p.calib.is_none() && p.sharpen_fine, "V3 JPEG"); + } + + #[test] + fn sharpening_blur_is_normalised_and_grows_with_its_radius() { + let total = |t: [f32; 3]| t[0] + 2.0 * t[1] + 2.0 * t[2]; + let mut last = 0.0; + for sigma in [0.1f32, 0.3, 0.55, 0.69, 0.71, 1.0, 1.5, 3.0] { + let t = sharpen_taps(sigma); + assert!((total(t) - 1.0).abs() < 1e-5, "{sigma}: {t:?}"); + assert!(t.iter().all(|w| (0.0..=1.0).contains(w)), "{sigma}: {t:?}"); + // the share off the centre pixel (how much it blurs) never shrinks as the radius grows + assert!(1.0 - t[0] >= last - 1e-3, "{sigma}: {t:?}"); + last = 1.0 - t[0]; + } + // nonsense radii fall back to a near-identity blur instead of NaN weights + assert!(sharpen_taps(f32::NAN)[0] > 0.9); + } + #[test] fn refine_saturation_restores_the_pre_curve_saturation() { let before = [0.5, 0.3, 0.2]; diff --git a/crates/pipeline/src/lib.rs b/crates/pipeline/src/lib.rs index 455cec02217..3ac93f39e42 100644 --- a/crates/pipeline/src/lib.rs +++ b/crates/pipeline/src/lib.rs @@ -32,6 +32,7 @@ pub mod finish; pub mod geometry; pub mod local; pub mod local_tone; +pub mod look_table; pub mod lut; pub mod masks; pub mod optics; diff --git a/crates/pipeline/src/local.rs b/crates/pipeline/src/local.rs index 679acabfe7a..f3ef3dbe717 100644 --- a/crates/pipeline/src/local.rs +++ b/crates/pipeline/src/local.rs @@ -273,7 +273,7 @@ pub fn base_detail_radius(px_per_long: f64) -> usize { pub fn tone_base_detail(s: &DevelopSettings, px_per_long: f64) -> usize { match s.process.process() { Process::V1 => 0, - Process::V2 => base_detail_radius(px_per_long), + Process::V2 | Process::V3 => base_detail_radius(px_per_long), } } @@ -501,11 +501,12 @@ pub fn plane_sigmas(s: &DevelopSettings, px_per_long: f64, q: Quality) -> PlaneS if q == Quality::Draft { sigma.min(24.0) } else { sigma } }); let clarity = (s.effects.clarity != 0.0 || local_any(|a| a.clarity)).then(|| (0.012 * ppl).max(1.0)); - // local Noise and Defringe read the fine detail band too + // local Noise and Defringe read the fine detail band too, and sharpening before V3 (from V3 + // it reads its own few pixels of `log_l`: `finish::sharpen_taps`) + let sharpen_band = !crate::finish::sharpens_at_original_pixels(s) && (s.detail.sharpen_amount != 0.0 || local_any(|a| a.sharpness)); let texture = (s.effects.texture != 0.0 - || s.detail.sharpen_amount != 0.0 + || sharpen_band || local_any(|a| a.texture) - || local_any(|a| a.sharpness) || local_any(|a| a.noise) || s.masks.iter().any(|m| m.adjust.defringe > 0.0)) .then(|| (0.0018 * ppl).max(0.6)); diff --git a/crates/pipeline/src/look_table.rs b/crates/pipeline/src/look_table.rs new file mode 100644 index 00000000000..c7211e0f009 --- /dev/null +++ b/crates/pipeline/src/look_table.rs @@ -0,0 +1,221 @@ +//! The base look's hue table: a raw's display-referred colour moved by hue, chroma and lightness +//! (OkLCh), after the tone map and before the output conversion. The [`finish`](crate::finish) +//! stage applies it to raws (the Color profile's look, the base of the others); the GPU path reads +//! the same table ([`TABLE`]) and interpolates it the same way. +//! +//! Nodes are 24 hues (15° apart, from OkLab's +a axis) × 5 chromas (0, 0.05 … 0.20; beyond the +//! last, its value) × 6 lightnesses (0, 0.2 … 1.0). Each holds a hue shift (radians) and the +//! natural logs of a chroma and a lightness scale; between nodes the values are trilinear (hue +//! wrapping round). Chroma-0 nodes are zero, so neutral stays neutral. +//! +//! The values were fitted black-box to Lightroom exports (Adobe Color) of three raws (warm greys +//! and a gold-lettered die; a room with blues, greens, reds, wood and pink; a cyan figure on wood) +//! and Lightcraft's renders of them at the same settings, each photo's white-balance difference +//! fitted out first, by regularised least squares that keeps hues the photo lacks at no change, +//! smooths across neighbours and balances rare colours against common ones (the saturated gold of a +//! die against the grey resin around it) and weighs the photos equally. No number comes from +//! Adobe's software. + +use lightcraft_color::perceptual::{lab_to_lch, lch_to_lab, oklab_from_2020, oklab_to_2020}; + +/// Hue, chroma and lightness divisions. +pub const NH: usize = 24; +pub const NC: usize = 5; +pub const NL: usize = 6; +/// Chroma and lightness between nodes. +pub const C_STEP: f32 = 0.05; +pub const L_STEP: f32 = 0.2; + +/// OkLab chroma at or below which a colour is neutral and left alone: a grey's computed chroma is +/// float noise (up to ~1e-4), which would otherwise pick up a sliver of the next node's values. +pub const NEUTRAL_CHROMA: f32 = 5e-4; + +/// `[hue shift, ln chroma scale, ln lightness scale]` by `(hue * NC + chroma) * NL + lightness`. +#[rustfmt::skip] +pub static TABLE: [[f32; 3]; NH * NC * NL] = [ + [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], + [0.15880, -0.05252, 0.04102], [0.18868, -0.15236, 0.00126], [0.07729, -0.26765, 0.00451], [0.06889, -0.10910, -0.02380], [0.15619, 0.00287, -0.00848], [0.17320, 0.05023, -0.00227], + [0.22421, -0.02154, 0.04087], [0.24923, -0.02452, 0.04480], [0.12953, -0.18463, -0.01435], [0.20855, -0.09041, 0.00031], [0.25882, 0.00917, -0.00013], [0.24904, 0.03925, 0.00113], + [0.25967, 0.00313, 0.04203], [0.26180, 0.02947, 0.06248], [0.26180, 0.00655, 0.06523], [0.26180, 0.01514, 0.02938], [0.26180, 0.05357, 0.00411], [0.26180, 0.04245, 0.00465], + [0.26180, 0.00860, 0.03877], [0.26180, 0.01933, 0.04944], [0.26180, 0.03792, 0.07214], [0.26180, 0.03624, 0.04520], [0.26180, 0.04531, 0.01100], [0.26180, 0.03994, 0.00755], + [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], + [0.23574, -0.06242, 0.07517], [0.26180, -0.14787, 0.02476], [0.26180, -0.17171, 0.00687], [0.19465, -0.10031, -0.00605], [0.26180, 0.04400, 0.00552], [0.26180, 0.17619, 0.00341], + [0.26180, -0.03281, 0.05362], [0.26180, -0.02107, 0.06420], [0.26180, -0.10001, 0.05784], [0.26180, -0.06934, 0.03570], [0.26180, 0.01711, 0.01806], [0.26180, 0.06531, 0.01077], + [0.26180, -0.01299, 0.04694], [0.26180, -0.00161, 0.06174], [0.26180, -0.01107, 0.09262], [0.26180, 0.01035, 0.07430], [0.26180, 0.03986, 0.02539], [0.26180, 0.04473, 0.01457], + [0.26180, -0.00594, 0.04248], [0.26180, -0.00090, 0.05133], [0.26180, -0.00183, 0.06670], [0.26180, 0.00658, 0.05193], [0.26180, 0.02998, 0.02537], [0.26180, 0.03571, 0.01592], + [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], + [0.25845, -0.07126, 0.07986], [0.26180, -0.14248, -0.01134], [0.26180, -0.01109, -0.00351], [0.16155, -0.03078, -0.00762], [0.26180, 0.14742, 0.02418], [0.26180, 0.28227, 0.00323], + [0.26180, -0.04655, 0.04185], [0.26180, -0.03574, 0.02475], [0.26180, -0.03868, 0.00921], [0.26180, 0.00169, 0.02777], [0.26180, 0.07441, 0.02368], [0.26180, 0.08170, 0.01442], + [0.26180, -0.02795, 0.03563], [0.26180, -0.02177, 0.03845], [0.26180, -0.00367, 0.06109], [0.26180, 0.03639, 0.06370], [0.26180, 0.05153, 0.02650], [0.26180, 0.04107, 0.01640], + [0.26180, -0.01855, 0.03358], [0.26180, -0.01451, 0.03715], [0.26180, -0.00573, 0.04460], [0.26180, 0.01246, 0.04031], [0.26180, 0.02714, 0.02412], [0.26180, 0.02877, 0.01644], + [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], + [0.22280, -0.08357, 0.02851], [0.26180, -0.15451, -0.08333], [0.09256, 0.06954, 0.02877], [0.05251, -0.07414, 0.00556], [0.26180, 0.14071, 0.05650], [0.26180, -0.04322, 0.01799], + [0.26180, -0.06574, 0.01610], [0.26180, -0.09928, -0.01642], [0.26180, -0.20469, -0.04943], [0.26180, -0.07149, -0.00183], [0.26180, 0.03176, 0.04269], [0.26180, -0.03192, 0.01667], + [0.26180, -0.04035, 0.01789], [0.26180, -0.04765, 0.01093], [0.26180, -0.05623, 0.00854], [0.26180, -0.01175, 0.01741], [0.26180, 0.01602, 0.01424], [0.26180, -0.00070, 0.01031], + [0.26180, -0.02611, 0.01963], [0.26180, -0.02584, 0.01838], [0.26180, -0.02094, 0.01849], [0.26180, -0.00111, 0.01794], [0.26180, 0.01342, 0.01251], [0.26180, 0.01164, 0.00962], + [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], + [0.14965, -0.07537, 0.03372], [0.19092, -0.11860, -0.04089], [-0.02388, -0.15396, 0.00684], [-0.03479, 0.09789, -0.00176], [0.13533, 0.50000, -0.05682], [0.23582, -0.50000, 0.02489], + [0.23767, -0.06007, 0.00896], [0.26180, -0.09136, -0.01951], [0.26180, -0.17945, -0.05538], [0.22807, -0.16089, -0.05120], [0.14595, -0.05634, -0.04141], [0.22515, -0.22972, -0.00372], + [0.26180, -0.03495, 0.00749], [0.26180, -0.04325, -0.00111], [0.26180, -0.05259, -0.00902], [0.21301, -0.01972, -0.01065], [0.18188, 0.00396, -0.02430], [0.22402, -0.04032, -0.00518], + [0.26180, -0.02013, 0.00897], [0.26180, -0.02040, 0.00604], [0.26180, -0.01615, 0.00328], [0.24812, 0.00124, 0.00127], [0.23167, 0.01363, -0.00316], [0.23472, 0.00528, -0.00064], + [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], + [0.13967, -0.05651, 0.03259], [0.21036, -0.12467, -0.03289], [0.20222, -0.34468, -0.02203], [0.10652, -0.22950, -0.01242], [-0.06207, 0.50000, -0.02481], [0.13415, -0.13463, -0.00008], + [0.21268, -0.03394, 0.00714], [0.24560, -0.05103, -0.01099], [0.26180, -0.06233, -0.00854], [0.20619, -0.01665, -0.01146], [0.08399, 0.15842, -0.03850], [0.15483, -0.05353, -0.01265], + [0.23407, -0.01153, 0.00284], [0.24513, -0.01328, -0.00260], [0.24668, -0.00700, -0.00335], [0.21147, 0.02395, -0.00099], [0.17179, 0.06216, -0.01398], [0.18152, 0.01869, -0.00759], + [0.23836, 0.00059, 0.00289], [0.24192, 0.00303, 0.00079], [0.23862, 0.01169, -0.00034], [0.21999, 0.02957, -0.00105], [0.20052, 0.04446, -0.00469], [0.19644, 0.03625, -0.00385], + [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], + [0.17185, -0.01148, 0.01855], [0.26180, -0.03801, -0.04661], [0.25187, 0.00663, -0.02592], [0.11070, 0.17824, -0.01675], [-0.01584, 0.50000, -0.01267], [0.05985, 0.18672, -0.00289], + [0.20993, 0.00889, 0.00243], [0.25921, 0.01307, -0.01105], [0.26180, 0.05241, 0.00260], [0.24987, 0.11431, 0.00953], [0.16869, 0.24545, 0.00241], [0.13214, 0.11976, -0.00297], + [0.21575, 0.02373, -0.00068], [0.22942, 0.02986, -0.00382], [0.23427, 0.04872, -0.00087], [0.22280, 0.07972, 0.00317], [0.19402, 0.11471, 0.00195], [0.16340, 0.08884, -0.00245], + [0.21496, 0.03100, -0.00101], [0.21878, 0.03661, -0.00200], [0.21717, 0.04919, -0.00141], [0.20489, 0.06699, -0.00049], [0.18608, 0.08145, -0.00147], [0.17226, 0.07719, -0.00253], + [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], + [0.16165, 0.03491, 0.00696], [0.26180, 0.05685, -0.04482], [0.26180, 0.12741, -0.01759], [0.12163, 0.17758, -0.00679], [0.05276, 0.24592, -0.00144], [0.05235, 0.13329, -0.00127], + [0.19364, 0.05322, -0.00180], [0.23871, 0.06960, -0.01206], [0.26072, 0.10158, -0.00144], [0.23650, 0.13679, 0.00656], [0.15457, 0.17565, 0.00346], [0.11179, 0.13313, -0.00071], + [0.19399, 0.06082, -0.00383], [0.20718, 0.07084, -0.00576], [0.21318, 0.08886, -0.00259], [0.20492, 0.10978, 0.00158], [0.17072, 0.12640, 0.00144], [0.13904, 0.11463, -0.00140], + [0.19052, 0.06358, -0.00427], [0.19410, 0.07058, -0.00460], [0.19289, 0.08275, -0.00335], [0.18184, 0.09616, -0.00172], [0.16181, 0.10525, -0.00163], [0.14600, 0.10352, -0.00239], + [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], + [0.13857, 0.07842, 0.01371], [0.26106, 0.16340, -0.00571], [0.26180, 0.23158, -0.01503], [0.11287, 0.17716, -0.00319], [0.04899, 0.13777, 0.00148], [0.03971, 0.09756, -0.00044], + [0.16712, 0.09278, -0.00251], [0.20762, 0.12298, -0.00794], [0.24168, 0.15045, -0.00456], [0.19770, 0.14938, 0.00077], [0.11339, 0.14362, -0.00003], [0.08318, 0.12395, -0.00144], + [0.16609, 0.09376, -0.00671], [0.17713, 0.10647, -0.00778], [0.18211, 0.12134, -0.00576], [0.16469, 0.12849, -0.00280], [0.12752, 0.12996, -0.00232], [0.10571, 0.12315, -0.00293], + [0.16220, 0.09297, -0.00769], [0.16436, 0.10033, -0.00772], [0.16139, 0.11032, -0.00647], [0.14771, 0.11762, -0.00476], [0.12712, 0.12050, -0.00403], [0.11331, 0.11871, -0.00404], + [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], + [0.10989, 0.09929, -0.00148], [0.21202, 0.21365, -0.02987], [0.21635, 0.27215, -0.02037], [0.07046, 0.18034, -0.00406], [0.00951, 0.13813, 0.00338], [0.01561, 0.09196, -0.00028], + [0.13248, 0.11704, -0.00985], [0.16143, 0.15521, -0.01568], [0.17450, 0.18544, -0.01079], [0.11492, 0.16657, -0.00524], [0.06227, 0.14443, -0.00284], [0.04667, 0.12437, -0.00310], + [0.13279, 0.11735, -0.01184], [0.13840, 0.13132, -0.01291], [0.13517, 0.14525, -0.01075], [0.10990, 0.14521, -0.00772], [0.08145, 0.13845, -0.00597], [0.06724, 0.13056, -0.00553], + [0.13052, 0.11574, -0.01220], [0.12971, 0.12299, -0.01219], [0.12258, 0.13139, -0.01085], [0.10596, 0.13460, -0.00888], [0.08735, 0.13295, -0.00745], [0.07631, 0.12964, -0.00686], + [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], + [0.07115, 0.08882, -0.01303], [0.11112, 0.13792, -0.05940], [0.10310, 0.21769, -0.04049], [-0.00504, 0.19963, -0.00699], [-0.04339, 0.15782, 0.00257], [-0.01613, 0.09991, -0.00096], + [0.09337, 0.12253, -0.01789], [0.10091, 0.14852, -0.02733], [0.08783, 0.18158, -0.02207], [0.03850, 0.18020, -0.01166], [0.00869, 0.15787, -0.00610], [0.00584, 0.13303, -0.00545], + [0.09868, 0.13085, -0.01771], [0.09645, 0.14286, -0.01942], [0.08320, 0.15708, -0.01739], [0.05691, 0.15918, -0.01320], [0.03576, 0.14991, -0.01006], [0.02720, 0.13935, -0.00888], + [0.09956, 0.13157, -0.01731], [0.09488, 0.13821, -0.01745], [0.08270, 0.14598, -0.01616], [0.06404, 0.14806, -0.01377], [0.04736, 0.14379, -0.01163], [0.03863, 0.13851, -0.01054], + [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], + [0.04647, 0.08539, -0.01584], [0.05327, 0.10253, -0.04135], [0.00385, 0.19366, -0.03803], [-0.11686, 0.29798, -0.00569], [-0.11342, 0.20404, 0.00549], [-0.05549, 0.11592, -0.00140], + [0.06519, 0.12945, -0.02183], [0.05848, 0.15040, -0.02878], [0.02369, 0.19192, -0.02711], [-0.03182, 0.21973, -0.01652], [-0.04665, 0.18444, -0.00927], [-0.03715, 0.14585, -0.00830], + [0.07289, 0.14211, -0.02240], [0.06422, 0.15358, -0.02407], [0.04153, 0.17024, -0.02303], [0.01104, 0.17724, -0.01885], [-0.00649, 0.16335, -0.01475], [-0.01100, 0.14707, -0.01295], + [0.07581, 0.14369, -0.02215], [0.06755, 0.14995, -0.02248], [0.05019, 0.15758, -0.02160], [0.02831, 0.15925, -0.01920], [0.01184, 0.15192, -0.01652], [0.00427, 0.14356, -0.01498], + [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], + [0.04412, 0.10832, -0.01551], [0.06717, 0.15899, -0.03241], [-0.08532, 0.34585, -0.03899], [-0.26180, 0.50000, -0.00373], [-0.21150, 0.27310, 0.00846], [-0.10239, 0.12537, -0.00239], + [0.05581, 0.14898, -0.02462], [0.04494, 0.18017, -0.03093], [-0.01725, 0.24027, -0.03413], [-0.10120, 0.29028, -0.02682], [-0.10049, 0.21884, -0.01559], [-0.07906, 0.15125, -0.01256], + [0.06176, 0.15536, -0.02660], [0.04949, 0.16847, -0.02869], [0.01755, 0.18686, -0.02956], [-0.02201, 0.19466, -0.02669], [-0.04001, 0.17223, -0.02109], [-0.04303, 0.14568, -0.01806], + [0.06449, 0.15352, -0.02678], [0.05379, 0.15918, -0.02750], [0.03169, 0.16510, -0.02748], [0.00490, 0.16408, -0.02560], [-0.01404, 0.15217, -0.02233], [-0.02233, 0.13913, -0.02016], + [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], + [0.05248, 0.15075, -0.02003], [0.09488, 0.28005, -0.04755], [-0.21393, 0.50000, -0.08597], [-0.26180, 0.50000, -0.07695], [-0.26180, 0.31004, -0.00999], [-0.15486, 0.08095, -0.00562], + [0.06399, 0.17408, -0.02864], [0.05668, 0.21695, -0.03748], [-0.00612, 0.25357, -0.05190], [-0.09832, 0.26312, -0.06449], [-0.12651, 0.24854, -0.03217], [-0.11358, 0.12300, -0.01864], + [0.06716, 0.16630, -0.03096], [0.05551, 0.17849, -0.03396], [0.02215, 0.18553, -0.03783], [-0.02470, 0.18049, -0.03867], [-0.05470, 0.16154, -0.02946], [-0.06348, 0.12117, -0.02383], + [0.06766, 0.15841, -0.03132], [0.05664, 0.16150, -0.03252], [0.03254, 0.16057, -0.03361], [0.00063, 0.15197, -0.03272], [-0.02482, 0.13604, -0.02863], [-0.03689, 0.11744, -0.02562], + [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], + [0.06056, 0.19500, -0.01697], [0.01337, 0.46123, -0.00199], [-0.21118, 0.50000, -0.02141], [-0.13538, 0.35630, -0.08627], [-0.26180, 0.15402, -0.00012], [-0.26180, -0.14685, 0.00018], + [0.08886, 0.19032, -0.03056], [0.08732, 0.23964, -0.03248], [0.07516, 0.17999, -0.03949], [-0.02451, 0.12600, -0.04985], [-0.13572, 0.20562, -0.02525], [-0.14577, 0.01453, -0.01935], + [0.08801, 0.16793, -0.03478], [0.08184, 0.17517, -0.03684], [0.05847, 0.15631, -0.03993], [0.00364, 0.12913, -0.04147], [-0.04957, 0.11348, -0.03287], [-0.07025, 0.06018, -0.02777], + [0.08349, 0.15494, -0.03555], [0.07464, 0.15357, -0.03676], [0.05215, 0.14141, -0.03805], [0.01524, 0.12121, -0.03765], [-0.01952, 0.09935, -0.03349], [-0.03753, 0.07537, -0.03028], + [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], + [0.14793, 0.17700, -0.03579], [0.26180, 0.37338, -0.06610], [0.20062, 0.41789, -0.02080], [-0.13373, 0.15457, -0.20196], [-0.19371, -0.32433, -0.03642], [-0.26180, -0.50000, -0.00216], + [0.14588, 0.17812, -0.04047], [0.20876, 0.21864, -0.04897], [0.25934, 0.15917, -0.05080], [0.08242, 0.05215, -0.07544], [-0.07492, -0.05117, -0.04211], [-0.14079, -0.17373, -0.02559], + [0.12016, 0.15573, -0.04058], [0.12848, 0.15799, -0.04372], [0.11689, 0.12924, -0.04656], [0.04695, 0.07943, -0.05052], [-0.02168, 0.02698, -0.04033], [-0.05608, -0.02263, -0.03298], + [0.10505, 0.14244, -0.03993], [0.10034, 0.13740, -0.04145], [0.08070, 0.11773, -0.04296], [0.03957, 0.08621, -0.04314], [-0.00127, 0.05229, -0.03860], [-0.02409, 0.02575, -0.03475], + [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], + [0.17632, 0.14779, -0.04444], [0.26180, 0.30816, -0.08488], [0.26180, 0.24356, -0.05515], [-0.09461, 0.09774, -0.23180], [-0.13683, -0.32931, -0.05630], [-0.15078, -0.50000, -0.01016], + [0.16612, 0.15186, -0.04712], [0.23019, 0.18288, -0.05865], [0.23800, 0.14133, -0.06349], [0.05995, 0.04325, -0.09366], [-0.03685, -0.10055, -0.05317], [-0.07573, -0.19439, -0.03179], + [0.13539, 0.13478, -0.04469], [0.14500, 0.13440, -0.04866], [0.12932, 0.10694, -0.05218], [0.06166, 0.05418, -0.05703], [0.00443, -0.00906, -0.04559], [-0.02450, -0.05270, -0.03700], + [0.11796, 0.12407, -0.04280], [0.11451, 0.11755, -0.04458], [0.09588, 0.09637, -0.04631], [0.05691, 0.06181, -0.04670], [0.01935, 0.02402, -0.04191], [-0.00187, -0.00158, -0.03774], + [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], + [0.13524, 0.10676, -0.04560], [0.25723, 0.20038, -0.08520], [0.26180, 0.21413, -0.07790], [0.11121, 0.01610, -0.16796], [-0.07029, -0.18592, -0.04775], [-0.07798, -0.22776, -0.01666], + [0.14556, 0.11826, -0.04813], [0.18011, 0.13710, -0.05966], [0.18168, 0.11728, -0.06462], [0.08422, 0.03317, -0.08158], [0.00136, -0.06428, -0.05046], [-0.02696, -0.11252, -0.03354], + [0.12997, 0.11008, -0.04503], [0.13454, 0.10849, -0.04892], [0.12066, 0.08793, -0.05192], [0.07345, 0.04359, -0.05451], [0.02868, -0.00646, -0.04486], [0.00633, -0.03674, -0.03754], + [0.11885, 0.10358, -0.04271], [0.11525, 0.09747, -0.04443], [0.09958, 0.07940, -0.04591], [0.06902, 0.04933, -0.04587], [0.03886, 0.01706, -0.04161], [0.02172, -0.00343, -0.03791], + [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], + [0.09762, 0.06964, -0.04026], [0.15262, 0.11084, -0.07258], [0.18612, 0.14384, -0.05764], [0.08128, 0.04928, -0.08632], [-0.00920, -0.05817, -0.03868], [-0.01722, -0.07390, -0.02004], + [0.11881, 0.08749, -0.04403], [0.13448, 0.09762, -0.05343], [0.13103, 0.09196, -0.05426], [0.07909, 0.04364, -0.05963], [0.02941, -0.01449, -0.04268], [0.01078, -0.04132, -0.03182], + [0.11768, 0.08711, -0.04145], [0.11848, 0.08576, -0.04465], [0.10737, 0.07335, -0.04624], [0.07768, 0.04413, -0.04669], [0.04811, 0.01057, -0.04021], [0.03280, -0.00917, -0.03503], + [0.11422, 0.08444, -0.03929], [0.11071, 0.07996, -0.04076], [0.09877, 0.06724, -0.04178], [0.07745, 0.04559, -0.04139], [0.05619, 0.02215, -0.03818], [0.04392, 0.00746, -0.03538], + [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], + [0.07792, 0.04705, -0.03567], [0.11414, 0.06968, -0.06869], [0.10354, 0.10326, -0.04641], [0.05510, 0.08365, -0.06281], [0.01742, 0.01607, -0.03268], [0.01173, -0.00733, -0.01907], + [0.10067, 0.06627, -0.03760], [0.10805, 0.07419, -0.04632], [0.09963, 0.07756, -0.04493], [0.07222, 0.05851, -0.04723], [0.04677, 0.02238, -0.03602], [0.03607, 0.00279, -0.02834], + [0.10887, 0.06923, -0.03493], [0.10809, 0.06949, -0.03784], [0.09942, 0.06429, -0.03888], [0.08189, 0.04877, -0.03894], [0.06470, 0.02742, -0.03448], [0.05541, 0.01402, -0.03079], + [0.11153, 0.06852, -0.03292], [0.10866, 0.06620, -0.03431], [0.10036, 0.05902, -0.03530], [0.08690, 0.04585, -0.03514], [0.07356, 0.03043, -0.03296], [0.06569, 0.02043, -0.03097], + [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], + [0.06171, 0.04289, -0.02670], [0.07682, 0.07869, -0.05590], [0.06638, 0.10268, -0.04018], [0.04891, 0.14055, -0.06707], [0.03523, 0.05004, -0.03106], [0.02785, 0.01972, -0.01751], + [0.09138, 0.05450, -0.02768], [0.09312, 0.06577, -0.03618], [0.08517, 0.07448, -0.03721], [0.07204, 0.07601, -0.04187], [0.06161, 0.04435, -0.03130], [0.05625, 0.02627, -0.02445], + [0.10823, 0.05590, -0.02543], [0.10683, 0.05840, -0.02860], [0.10083, 0.05860, -0.03071], [0.09180, 0.05326, -0.03187], [0.08354, 0.03879, -0.02852], [0.07872, 0.02887, -0.02563], + [0.11622, 0.05536, -0.02368], [0.11443, 0.05511, -0.02532], [0.10972, 0.05251, -0.02696], [0.10270, 0.04623, -0.02770], [0.09553, 0.03678, -0.02657], [0.09098, 0.03016, -0.02529], + [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], + [0.05933, 0.03734, -0.00608], [0.06497, 0.08227, -0.02719], [0.04569, 0.11096, -0.03465], [0.02613, 0.21058, -0.07049], [0.03766, 0.06871, -0.02863], [0.03920, 0.03066, -0.01521], + [0.09468, 0.04257, -0.01295], [0.09199, 0.05548, -0.02196], [0.08045, 0.06749, -0.03005], [0.07376, 0.08616, -0.03721], [0.07683, 0.05338, -0.02641], [0.07792, 0.03604, -0.01990], + [0.11963, 0.04292, -0.01267], [0.11806, 0.04654, -0.01661], [0.11375, 0.04964, -0.02122], [0.11129, 0.05204, -0.02400], [0.11027, 0.04270, -0.02174], [0.10875, 0.03560, -0.01953], + [0.13262, 0.04285, -0.01146], [0.13264, 0.04398, -0.01346], [0.13208, 0.04448, -0.01621], [0.13128, 0.04351, -0.01845], [0.12847, 0.03893, -0.01883], [0.12549, 0.03506, -0.01840], + [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], + [0.06951, 0.01901, 0.01301], [0.06233, 0.04665, -0.00820], [0.01385, 0.08221, -0.03101], [-0.03601, 0.20300, -0.06111], [0.03585, 0.06016, -0.02344], [0.05503, 0.03001, -0.01175], + [0.11266, 0.02330, 0.00345], [0.10220, 0.02916, -0.00918], [0.07369, 0.02935, -0.02853], [0.07706, 0.05889, -0.03105], [0.10104, 0.04321, -0.02012], [0.10989, 0.03487, -0.01423], + [0.14657, 0.02748, 0.00286], [0.14551, 0.02959, -0.00200], [0.14167, 0.02948, -0.01013], [0.14875, 0.03787, -0.01393], [0.15460, 0.03818, -0.01354], [0.15315, 0.03593, -0.01228], + [0.16422, 0.02987, 0.00380], [0.16819, 0.03163, 0.00206], [0.17524, 0.03354, -0.00121], [0.18401, 0.03657, -0.00580], [0.18195, 0.03723, -0.00929], [0.17583, 0.03615, -0.01026], + [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], + [0.10468, -0.01167, 0.05002], [0.09875, -0.02505, 0.03917], [-0.00661, -0.07143, -0.02981], [-0.04868, 0.00024, -0.04633], [0.06480, 0.01638, -0.01677], [0.09148, 0.02510, -0.00735], + [0.15220, -0.00133, 0.02355], [0.12872, -0.00892, 0.00201], [0.02666, -0.08960, -0.06038], [0.10085, -0.04412, -0.02605], [0.15369, 0.01449, -0.01239], [0.16412, 0.02973, -0.00735], + [0.19325, 0.01217, 0.02177], [0.19881, 0.01375, 0.01899], [0.19544, -0.00261, 0.00596], [0.22637, 0.01271, 0.00071], [0.23500, 0.03279, -0.00410], [0.21923, 0.03546, -0.00405], + [0.21224, 0.01800, 0.02179], [0.22612, 0.02169, 0.02318], [0.25316, 0.02608, 0.02402], [0.26180, 0.03131, 0.01377], [0.26180, 0.03693, 0.00181], [0.24569, 0.03697, -0.00123], +]; + +/// `rgb` (linear Rec.2020) through [`TABLE`]. +pub fn apply(rgb: [f32; 3]) -> [f32; 3] { + let [l, c, h] = lab_to_lch(oklab_from_2020(rgb.map(|v| v.max(0.0)))); + if !(l > 0.0 && c > NEUTRAL_CHROMA && h.is_finite()) { + return rgb; + } + let v = lookup(l, c, h); + let lab = lch_to_lab([l * v[2].exp(), c * v[1].exp(), h + v[0]]); + oklab_to_2020(lab) +} + +/// The table's trilinear value at OkLCh `(l, c, h)`. +fn lookup(l: f32, c: f32, h: f32) -> [f32; 3] { + let hf = (h / std::f32::consts::TAU).rem_euclid(1.0) * NH as f32; + let h0 = (hf.floor() as usize) % NH; + let th = hf - hf.floor(); + let cf = (c / C_STEP).clamp(0.0, (NC - 1) as f32 - 1e-4); + let c0 = cf.floor() as usize; + let tc = cf - c0 as f32; + let lf = (l / L_STEP).clamp(0.0, (NL - 1) as f32 - 1e-4); + let l0 = lf.floor() as usize; + let tl = lf - l0 as f32; + let mut out = [0.0f32; 3]; + for (dh, wh) in [(0, 1.0 - th), (1, th)] { + for (dc, wc) in [(0, 1.0 - tc), (1, tc)] { + for (dl, wl) in [(0, 1.0 - tl), (1, tl)] { + let i = (((h0 + dh) % NH) * NC + (c0 + dc)) * NL + (l0 + dl); + let node = TABLE.get(i).copied().unwrap_or([0.0; 3]); + let w = wh * wc * wl; + for (o, n) in out.iter_mut().zip(node) { + *o += w * n; + } + } + } + } + out +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn neutral_stays_neutral_and_values_stay_finite() { + for v in [0.0f32, 0.02, 0.18, 0.5, 1.0, 4.0] { + let out = apply([v; 3]); + assert!(out.iter().all(|x| (x - v).abs() < 1e-4), "{v}: {out:?}"); + } + for rgb in [[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0], [0.8, 0.4, 0.1], [-0.1, 0.3, 2.0], [f32::NAN, 0.2, 0.2]] { + let out = apply(rgb); + assert!(out.iter().all(|x| x.is_finite()) || rgb.iter().any(|x| x.is_nan()), "{rgb:?}: {out:?}"); + } + } + + #[test] + fn neutral_nodes_are_zero_and_moves_are_bounded() { + for (i, n) in TABLE.iter().enumerate() { + if (i / NL).is_multiple_of(NC) { + assert_eq!(*n, [0.0; 3], "node {i}"); + } + assert!(n[0].abs() <= 15f32.to_radians() + 1e-4 && n[1].abs() <= 0.5 + 1e-4 && n[2].abs() <= 0.5 + 1e-4, "node {i}: {n:?}"); + } + } +} diff --git a/crates/pipeline/src/profiles.rs b/crates/pipeline/src/profiles.rs index c519b2a34b1..f70e1fca1ab 100644 --- a/crates/pipeline/src/profiles.rs +++ b/crates/pipeline/src/profiles.rs @@ -6,6 +6,9 @@ //! vectors to the user's wheels) and point-curve fades (black/white output levels composed after //! the user's point curves). The CPU pipeline and the GPU path both render [`effective`] //! settings, so a profile needs no kernel of its own. No look adds grain. +//! +//! Under every profile a raw has a base look, the Color profile's own: a tone curve and a colour +//! matrix (`finish::COLOR_CURVE`, `finish::COLOR_MATRIX`). The looks here are deltas on it. use std::borrow::Cow; diff --git a/crates/pipeline/src/tests.rs b/crates/pipeline/src/tests.rs index 910705497e9..d6c55595f99 100644 --- a/crates/pipeline/src/tests.rs +++ b/crates/pipeline/src/tests.rs @@ -262,6 +262,9 @@ fn exposure_after_spatial_filters_equals_exposing_the_source() { let src = scene(); let info = SourceInfo { raw: true, ..Default::default() }; let mut s = typical_edits(); + // (sharpening is shift-equivariant too, being on log luminance, but as an unsharp mask it + // magnifies the level or two that clipped highlights already differ by: not what this checks) + s.detail.sharpen_amount = 0.0; s.light.exposure = 1.3; let a = render(&src, &info, &s, &RenderRequest::fit(200, 200)).image; let g = 2f32.powf(1.3); @@ -272,6 +275,26 @@ fn exposure_after_spatial_filters_equals_exposing_the_source() { assert!(d <= 2, "max difference {d}"); } +/// Sharpening (on log luminance) commutes with exposure where nothing clips: what the test above +/// leaves out. +#[test] +fn sharpening_is_unchanged_by_exposure_where_nothing_clips() { + let src = scene().map(|c| c.map(|v| v * 0.25)); + let info = SourceInfo { raw: true, ..Default::default() }; + let mut s = DevelopSettings::default(); + s.detail.sharpen_amount = 80.0; + s.light.exposure = 1.0; + let a = render(&src, &info, &s, &RenderRequest::fit(200, 200)).image; + s.light.exposure = 0.0; + let b = render(&src.map(|c| c.map(|v| v * 2.0)), &info, &s, &RenderRequest::fit(200, 200)).image; + let d = max_diff(&a, &b); + assert!(d <= 2, "max difference {d}"); + // and it did sharpen + s.detail.sharpen_amount = 0.0; + let plain = render(&src.map(|c| c.map(|v| v * 2.0)), &info, &s, &RenderRequest::fit(200, 200)).image; + assert!(max_diff(&b, &plain) > 4, "sharpening changed nothing"); +} + #[test] fn color_range_sampling_respects_disabled_sections() { use crate::{MaskView, Overlay, color_range_sample}; diff --git a/docs/parity-checklist.md b/docs/parity-checklist.md index 4e05317933e..c2b26ce0cf7 100644 --- a/docs/parity-checklist.md +++ b/docs/parity-checklist.md @@ -1,6 +1,6 @@ # Lightroom parity checklist -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-15 · **Change:** minor (LRC-PRINT-PAGE: Print Page Options) · **Target:** Adobe Lightroom Classic 15.5 / Lightroom 9.6 +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-18 · **Change:** minor (LR-BEHAV-RENDER-FIDELITY: process V3) · **Target:** Adobe Lightroom Classic 15.5 / Lightroom 9.6 The measured, row-by-row checklist: one row per Lightroom feature, menu item and shortcut, what we have and what is missing. It answers *does the feature exist?* (feature breadth). Whether it is good @@ -465,7 +465,7 @@ differences and missing bindings are in [ui-parity.md](ui-parity.md#shortcuts). | LR-BEHAV-OFFLINE | Offline editing | P1 | ✅ | | local-first: everything works offline | | LR-BEHAV-WEB-SAFETY | Library safety in the browser build | P1 | 🟡 | `cmd:file.backupLibrary`, `cmd:file.restoreLibrary`, `apps/lightcraft-web/src/safety.rs`, `apps/lightcraft-web/src/backup.rs`, `apps/lightcraft-web/src/files.rs` | web only (experimental): Back Up Library (zip of the catalog and every stored original) and a non-destructive Restore; failed saves show as unsaved and are retried; a photo that can't be stored isn't added; one tab per library (Web Locks); notices for storage that isn't persistent and for a library that can't open; `?reset` asks first; a panic shows a message. Missing: `?safe` start, deleting originals of removed photos, zip64 (backups > 4 GB) | | LR-BEHAV-GPU | GPU acceleration | P0 | ✅ | `crates/gpu/src/render.rs`, `cmd:app.gpu`, `docs/gpu-pipeline.md`, `crates/ui-egui/src/panels/notices.rs` | CPU fallback per render on device limits, out of memory, device errors / loss, incomplete or black results (`perf.gpuReason`, `perf.gpuFallback`; each render reports its own reason — `lightcraft_gpu::try_render`, `gpuFallback` per exported file — issue #675); short submissions for slow iGPUs; backend choice (DX12 only on Windows, `LIGHTCRAFT_GPU_BACKEND` / `WGPU_BACKEND`), device created after the window opens, crash sentinel (issue #136); a GPU lost while LightCraft runs (driver reset) stops it with that message and turns GPU rendering off for the next start, which says why (issue #1337; the window's renderer can't survive the lost device); quitting waits (up to 2 s) for renders in flight and starts no new GPU work, so none is inside the driver when the process exits (`crates/gpu/src/exit.rs`, issue #620; seen crashing only on Linux + NVIDIA, other drivers unverified); with GPU rendering on and no adapter found at all (e.g. no Vulkan loader on NixOS outside `nix develop`), the desktop app says once per session that it renders on the CPU and points to Help ▸ System Info (`gpu_notice`; not when the GPU is turned off or only a software adapter exists); no tiling beyond the buffer limit (CPU) | -| LR-BEHAV-RENDER-FIDELITY | Rendering matches Lightroom | P1 | 🟡 | `crates/pipeline/src/lib.rs`, `crates/pipeline/src/tone.rs` | every slider exists and works, but the character of the result (tone curve shape, highlight recovery, texture / clarity / dehaze, noise reduction, sharpening, default look) is tuned by eye; there is no systematic side-by-side comparison against Lightroom on the same CC0 raws. Needs a fidelity suite: Lightroom reference renders kept only in the local `plan/` (never committed), compared per slider and preset with a perceptual metric. Tuning that changes how existing settings render ships as a new process version (LRC-DEV-PROCESS, `docs/process-versions.md`) | +| LR-BEHAV-RENDER-FIDELITY | Rendering matches Lightroom | P1 | 🟡 | `crates/pipeline/src/lib.rs`, `crates/pipeline/src/tone.rs` | every slider exists and works, but the character of the result (tone curve shape, highlight recovery, texture / clarity / dehaze, noise reduction, sharpening, default look) is tuned by eye; there is no systematic side-by-side comparison against Lightroom on the same CC0 raws. Needs a fidelity suite: Lightroom reference renders kept only in the local `plan/` (never committed), compared per slider and preset with a perceptual metric. Tuning that changes how existing settings render ships as a new process version (LRC-DEV-PROCESS, `docs/process-versions.md`). Process V3 is a first such step: Sharpening (Amount 40, Radius 1.0) calibrated against Lightroom exports, and a raw base look (tone curve, colour matrix, hue table `crates/pipeline/src/look_table.rs`) fitted black-box to Lightroom exports of three Canon EOS 5D Mark III raws, the references kept local; one camera and three scenes, so still 🟡 | | LR-BEHAV-DRAGDROP | Drag and drop | P1 | ✅ | `crates/ui-egui/src/lib.rs`, `crates/ui-egui/src/panels/grid.rs` (`drag_feedback`), `crates/ui-egui/src/panels/left.rs` (`drop_target`, `album_drag_over`, `top_level_drop_target`, `drag_auto_scroll`) | files → app (import); grid photos → an album row (adds the selection, with a count badge while dragging); sidebar album / folder rows → a folder (moves it; its name follows the pointer); a drag of albums or grid photos near the top or bottom edge of the sidebar scrolls it (faster nearer the edge, only while the pointer is over the sidebar) | | LR-BEHAV-TOAST | Toast notifications | P1 | ✅ | `crates/ui-egui/src/panels/mod.rs` | | | LR-BEHAV-DIALOGS | Dialogs fit the window | P1 | ✅ | `crates/ui-egui/src/panels/dialogs.rs` (`dialog_body`, `list_height`), `crates/ui-egui/src/tests_dialog_fit.rs` | a dialog taller than the window (Export on a 1366×768 screen, issue #781) never runs off it: its options scroll while the title bar and the Cancel / OK row stay on screen; lists that scroll on their own (What's New, All Metadata, shortcuts, smart-album rules, credits) get shorter first; dialogs that fit look as before; Import keeps its own resizable, scrolling window | @@ -797,6 +797,7 @@ Latin stays upright. Advanced Japanese composition remains open. Regression cove | Date | Change | Summary | |---|---|---| +| 2026-10-18 | minor | LR-BEHAV-RENDER-FIDELITY: process V3, Sharpening at the original's pixels calibrated against Lightroom exports and a raw base look (tone curve, colour matrix, hue table) fitted to them; status unchanged (🟡) | | 2026-10-14 | patch | LR-EXP-TYPE: opaque 8-bit PNG/TIFF/WebP use RGB; transparent exports retain alpha (#1670). Statuses and feature counts unchanged. | | 2026-10-15 | minor | LRC-PRINT-PAGE: Page Options (Page Numbers, Page Info, Crop Marks) on Single Image and Contact Sheet pages, in the Print dialog, `print.set` and templates; still 🟡 (no identity plate, watermark, photo info or Cut Guides) | | 2026-10-15 | minor | LR-IMP-FORMATS: Hasselblad 3FR and FFF show their uncompressed RGB preview (no JPEG in these files) in the grid and loupe until developed, and as the stand-in when a file fails to decode; status unchanged (🟡) | diff --git a/docs/process-versions.md b/docs/process-versions.md index ea31d395072..332f4ce61de 100644 --- a/docs/process-versions.md +++ b/docs/process-versions.md @@ -8,7 +8,8 @@ stronger Light sliders, issue #196) without changing a single photo someone has | Process | What it changes | |---|---| | **V1** | LightCraft's rendering from before process versions existed. Frozen. | -| **V2** (the latest) | Highlights and Shadows keep fine detail (issue #632): their base layer (`local::tone_base`) is the edge-aware filter of a separable median of log luminance (radius 0.15 % of the long edge, at most 24 px, `local::BASE_DETAIL`) instead of log luminance itself, so twigs, lines and texture take their surroundings' shift and keep their contrast; region edges stay sharp. CPU (`local::prepare`) and GPU prepare branch on `local::tone_base_detail` (0 = no median under V1); the base plane is cached per process (`local::BaseKey`). Renders without Highlights or Shadows (global or local) are the same as V1's. Tone map unchanged. | +| **V2** | Highlights and Shadows keep fine detail (issue #632): their base layer (`local::tone_base`) is the edge-aware filter of a separable median of log luminance (radius 0.15 % of the long edge, at most 24 px, `local::BASE_DETAIL`) instead of log luminance itself, so twigs, lines and texture take their surroundings' shift and keep their contrast; region edges stay sharp. CPU (`local::prepare`) and GPU prepare branch on `local::tone_base_detail` (0 = no median under V1); the base plane is cached per process (`local::BaseKey`). Renders without Highlights or Shadows (global or local) are the same as V1's. Tone map unchanged. | +| **V3** (the latest) | Sharpening works at the original photo's pixels: Radius is in them, and a view smaller than the photo gets the blur that sharpening at full size and scaling down leaves (`finish::sharpen_taps`, a five-tap blur of `log_l` read in the finish stage on CPU and GPU; `finish::SHARPEN_GAIN`, `finish::SHARPEN_RADIUS_SCALE`). Before V3 it read the texture band, about 0.18 % of the frame at any size, and Radius did nothing. A raw also gets a base look under every profile (`finish::has_base_look`): a tone curve (`finish::COLOR_CURVE`), a colour matrix that keeps luminance and neutral (`finish::COLOR_MATRIX`, before the tone map) and a hue / chroma / lightness table (`look_table`, OkLCh, display-referred, before the output conversion), all fitted black-box to Lightroom exports (Adobe Color) of three raws at the same settings (LR-BEHAV-RENDER-FIDELITY). JPEGs and other rendered files keep their own look. Tone map unchanged. | ## The rule