Skip to content
Open
Show file tree
Hide file tree
Changes from 131 commits
Commits
Show all changes
146 commits
Select commit Hold shift + click to select a range
6d29e03
LR-BEHAV-RENDER-FIDELITY: process V8, Whites and the tone curves meas…
smi-leonivkovic Nov 10, 2026
1835f3a
LR-EDIT-COLOR-MIXER-HSL: process V8, the colour mixer measured agains…
smi-leonivkovic Nov 10, 2026
65bbb4c
LR-EDIT-COLOR-GRADING: process V8, Colour Grading measured against Li…
smi-leonivkovic Nov 10, 2026
b16fd0c
LR-BEHAV-RENDER-FIDELITY: doc comments for the V8 curve stage, Gap 3 …
smi-leonivkovic Nov 11, 2026
3fd3930
Merge branch 'lr-v8-tone' into lr-v8-color
smi-leonivkovic Nov 11, 2026
a8280a6
LR-EDIT-COLOR-MIXER-HSL: test that V8 leaves the mixer to the mixer s…
smi-leonivkovic Nov 11, 2026
2f93829
Merge branch 'lr-v8-color' into lr-v8-grading
smi-leonivkovic Nov 11, 2026
4fd64f8
LR-EDIT-COLOR-GRADING: mixer docs name V8's grading stage, doc commen…
smi-leonivkovic Nov 11, 2026
969ab28
LR-BEHAV-RENDER-FIDELITY: process V8, Lightroom's default base curve …
smi-leonivkovic Nov 11, 2026
6cb4e5b
Merge remote-tracking branch 'origin/main' into lr-v8-tone
smi-leonivkovic Nov 11, 2026
9188e4d
Merge branch 'lr-v8-tone' into lr-v8-color
smi-leonivkovic Nov 11, 2026
815ebe6
LR-BEHAV-RENDER-FIDELITY: what's new names process 9 (#523)
smi-leonivkovic Nov 11, 2026
95b9016
Merge branch 'lr-v8-tone' into lr-v8-color
smi-leonivkovic Nov 11, 2026
c067d02
Merge branch 'lr-v8-color' into lr-v8-grading
smi-leonivkovic Nov 11, 2026
8e4cc71
Merge branch 'lr-v8-grading' into lr-v8-base
smi-leonivkovic Nov 11, 2026
472a014
LR-EDIT-LIGHT-HIGHLIGHTS: process V9, Highlights relative to the fram…
smi-leonivkovic Nov 11, 2026
7689bf4
Merge remote-tracking branch 'origin/main' into lr-v8-grading
smi-leonivkovic Nov 11, 2026
7b71468
Merge branch 'lr-v8-grading' into lr-v8-base
smi-leonivkovic Nov 11, 2026
5562093
Merge branch 'lr-v8-base' into lr-v9-highlights
smi-leonivkovic Nov 11, 2026
0793d08
LR-BEHAV-RENDER-FIDELITY: exposure offsets measured for the Lumix S5,…
smi-leonivkovic Nov 11, 2026
8332eba
Merge branch 'lr-v8-base' into lr-v9-highlights
smi-leonivkovic Nov 11, 2026
5fed65c
LR-EDIT-CALIB: process V9, Calibration's primaries measured against L…
smi-leonivkovic Nov 11, 2026
fc55dde
LR-BEHAV-RENDER-FIDELITY: review fixes: neutral-render claims, Whites…
smi-leonivkovic Nov 11, 2026
92f35bb
Merge branch 'lr-v8-tone' into lr-v8-color
smi-leonivkovic Nov 11, 2026
c7c5ee2
LR-EDIT-COLOR-MIXER-HSL: review fixes: each slider's amount bracket o…
smi-leonivkovic Nov 11, 2026
9815bad
Merge branch 'lr-v8-color' into lr-v8-grading
smi-leonivkovic Nov 11, 2026
7196856
Merge branch 'lr-v8-grading' into lr-v8-base
smi-leonivkovic Nov 11, 2026
6a6d20c
Merge branch 'lr-v8-base' into lr-v9-highlights
smi-leonivkovic Nov 11, 2026
c920ecd
LR-EDIT-LIGHT-HIGHLIGHTS: review fixes: one proxy size for every outp…
smi-leonivkovic Nov 11, 2026
5bb9828
Merge branch 'lr-v9-highlights' into lr-v9-calibration
smi-leonivkovic Nov 11, 2026
5154467
LR-BEHAV-RENDER-FIDELITY: review fixes: measured curve tables only at…
smi-leonivkovic Nov 11, 2026
93c9132
Merge lr-v8-tone into lr-v8-color; review fixes: V1 to V8 also run th…
smi-leonivkovic Nov 11, 2026
e43cb44
Merge lr-v8-color into lr-v8-grading (#523)
smi-leonivkovic Nov 11, 2026
dfede7b
LR-EDIT-COLOR-GRADING: review fix: damping linear between its angle b…
smi-leonivkovic Nov 11, 2026
23d5484
Merge lr-v8-grading into lr-v8-base (#523)
smi-leonivkovic Nov 11, 2026
aa217b4
Merge lr-v8-base into lr-v9-highlights (#523)
smi-leonivkovic Nov 11, 2026
96b417c
LR-EDIT-LIGHT-HIGHLIGHTS: review fix: the range's two percentiles by …
smi-leonivkovic Nov 11, 2026
2546012
Merge lr-v9-highlights into lr-v9-calibration; review fix: V1 to V8 r…
smi-leonivkovic Nov 11, 2026
30c8319
LR-EDIT-COLOR-GRADING: rustfmt (#523)
smi-leonivkovic Nov 11, 2026
b40d6aa
Merge branch 'lr-v8-grading' into lr-v8-base
smi-leonivkovic Nov 11, 2026
fbd15ac
Merge branch 'lr-v8-base' into lr-v9-highlights
smi-leonivkovic Nov 11, 2026
f952dd2
Merge branch 'lr-v9-highlights' into lr-v9-calibration
smi-leonivkovic Nov 11, 2026
7d20abd
LR-BEHAV-RENDER-FIDELITY: review fix: Calibration runs before the ton…
smi-leonivkovic Nov 11, 2026
1d03da3
Merge lr-v8-color into lr-v8-grading (#523)
smi-leonivkovic Nov 11, 2026
c58e425
Merge branch 'lr-v8-grading' into lr-v8-base
smi-leonivkovic Nov 11, 2026
33a7a81
Merge branch 'lr-v8-base' into lr-v9-highlights
smi-leonivkovic Nov 11, 2026
9fbc3a7
Merge lr-v9-highlights into lr-v9-calibration (#523)
smi-leonivkovic Nov 11, 2026
b1f6a66
LR-EDIT-LIGHT-CURVE-PARAM: the parametric graph draws and drags the c…
smi-leonivkovic Nov 11, 2026
0bbd0fc
LR-BEHAV-RENDER-FIDELITY: review fixes: the chart tool refuses render…
smi-leonivkovic Nov 11, 2026
e0193c8
Merge branch 'lr-v8-tone' into lr-v8-color
smi-leonivkovic Nov 11, 2026
b0e9b29
Merge branch 'lr-v8-tone' into lr-v9-curve-graph
smi-leonivkovic Nov 11, 2026
568e53d
Merge branch 'lr-v8-color' into lr-v8-grading
smi-leonivkovic Nov 11, 2026
b94de27
Merge branch 'lr-v8-grading' into lr-v8-base
smi-leonivkovic Nov 11, 2026
0c45586
Merge branch 'lr-v8-base' into lr-v9-highlights
smi-leonivkovic Nov 11, 2026
c286ce7
Merge branch 'lr-v9-highlights' into lr-v9-calibration
smi-leonivkovic Nov 11, 2026
6f565fe
LR-EDIT-LIGHT-CURVE-PARAM: review fixes: a graph drag searches the cu…
smi-leonivkovic Nov 11, 2026
a8b4d7e
LR-BEHAV-RENDER-FIDELITY: review fixes: the measured tables are read …
smi-leonivkovic Nov 11, 2026
00405c3
Merge branch 'lr-v8-tone' into lr-v8-color
smi-leonivkovic Nov 11, 2026
2a379ff
Merge branch 'lr-v8-color' into lr-v8-grading
smi-leonivkovic Nov 11, 2026
ff287d9
Merge branch 'lr-v8-grading' into lr-v8-base
smi-leonivkovic Nov 11, 2026
7736176
Merge branch 'lr-v8-base' into lr-v9-highlights
smi-leonivkovic Nov 11, 2026
0b26397
Merge branch 'lr-v8-tone' into lr-v9-curve-graph
smi-leonivkovic Nov 11, 2026
b8e25a2
Merge branch 'lr-v9-highlights' into lr-v9-calibration
smi-leonivkovic Nov 11, 2026
8bec5c5
LR-EDIT-LIGHT-CURVE-PARAM: review fixes: doc comments on the graph's …
smi-leonivkovic Nov 11, 2026
3437e59
Merge remote-tracking branch 'origin/main' into lr-v8-tone
smi-leonivkovic Nov 14, 2026
099c0f9
Merge branch 'lr-v8-tone' into lr-v8-color
smi-leonivkovic Nov 14, 2026
c51da98
Merge branch 'lr-v8-color' into lr-v8-grading
smi-leonivkovic Nov 14, 2026
a1f5477
Merge branch 'lr-v8-grading' into lr-v8-base
smi-leonivkovic Nov 14, 2026
db37d2d
Merge branch 'lr-v8-base' into lr-v9-highlights
smi-leonivkovic Nov 14, 2026
ec9aa5c
Merge branch 'lr-v9-highlights' into lr-v9-calibration
smi-leonivkovic Nov 14, 2026
5ba1722
Merge branch 'lr-v8-tone' into lr-v9-curve-graph
smi-leonivkovic Nov 14, 2026
14909c4
curve_stage: say in apply's doc that values above white are added bac…
smi-leonivkovic Nov 18, 2026
f54fd34
LR-EDIT-LIGHT-CURVE-PARAM: the parametric graph's fix from #4126 land…
smi-leonivkovic Nov 20, 2026
03de271
Merge origin/main into lr-v8-tone
smi-leonivkovic Nov 20, 2026
789c1a0
LR-BEHAV-RENDER-FIDELITY: Whites and the parametric regions are a fit…
smi-leonivkovic Nov 24, 2026
d1ce3c8
Merge branch 'lr-v8-tone' into lr-v8-color
smi-leonivkovic Nov 24, 2026
c9dfb53
LR-EDIT-COLOR-MIXER-HSL: the colour mixer is a fitted model, not a me…
smi-leonivkovic Nov 24, 2026
3cabaf9
Merge branch 'lr-v8-color' into lr-v8-grading
smi-leonivkovic Nov 24, 2026
13fac86
LR-EDIT-COLOR-GRADING: Colour Grading is a fitted model, not measured…
smi-leonivkovic Nov 24, 2026
18409da
Merge branch 'lr-v8-grading' into lr-v8-base
smi-leonivkovic Nov 24, 2026
fde6f70
LR-BEHAV-RENDER-FIDELITY: the default base curve is 12 fitted knots, …
smi-leonivkovic Nov 24, 2026
fc152cf
Merge branch 'lr-v8-base' into lr-v9-highlights
smi-leonivkovic Nov 24, 2026
c19fa4f
LR-EDIT-LIGHT-HIGHLIGHTS: measure the frame's range after the camera'…
smi-leonivkovic Nov 24, 2026
7bc54cc
Merge branch 'lr-v9-highlights' into lr-v9-calibration
smi-leonivkovic Nov 24, 2026
77309c5
LR-EDIT-COLOR-CALIB: Calibration's primaries are a fitted 3x3 matrix,…
smi-leonivkovic Nov 24, 2026
18020ec
Merge branch 'lr-v8-grading' into lr-v8-base
smi-leonivkovic Nov 24, 2026
0fd6668
LR-EDIT-COLOR-GRADING: grading-stage.md reports the fitted series on …
smi-leonivkovic Nov 24, 2026
5827a97
Merge branch 'lr-v9-highlights' into lr-v9-calibration
smi-leonivkovic Nov 24, 2026
cd6195b
LR-BEHAV-RENDER-FIDELITY: default-tone.md reports the fitted series o…
smi-leonivkovic Nov 24, 2026
e95acd3
Merge branch 'lr-v8-base' into lr-v9-highlights
smi-leonivkovic Nov 24, 2026
69e90ef
LR-EDIT-COLOR-CALIB: mixer-stage.md describes Calibration's matrix an…
smi-leonivkovic Nov 24, 2026
f2c8629
Merge branch 'lr-v9-highlights' into lr-v9-calibration
smi-leonivkovic Nov 24, 2026
cfc8c22
LR-EDIT-COLOR-GRADING: as_chunks for the model's constant groups (cli…
smi-leonivkovic Nov 24, 2026
0f6b536
Merge branch 'lr-v8-grading' into lr-v8-base
smi-leonivkovic Nov 24, 2026
6ecbabe
Merge branch 'lr-v8-base' into lr-v9-highlights
smi-leonivkovic Nov 24, 2026
e18b7a3
perf(gpu): one OkLCh round trip for Calibration and the mixer
smi-leonivkovic Nov 29, 2026
7c0e8ea
Merge main into lr-v8-tone (#523)
smi-leonivkovic Dec 2, 2026
be29de8
Merge remote-tracking branch 'origin/main' into lr-v8-tone
smi-leonivkovic Dec 3, 2026
5ae163c
Merge lr-v8-tone (with main) into lr-v8-color (#523)
smi-leonivkovic Dec 3, 2026
c1d63a2
Merge lr-v8-color (with main) into lr-v8-grading (#523)
smi-leonivkovic Dec 3, 2026
880c540
Merge lr-v8-grading (with main) into lr-v8-base (#523)
smi-leonivkovic Dec 3, 2026
a68a055
Merge lr-v8-base (with main) into lr-v9-highlights (#523)
smi-leonivkovic Dec 3, 2026
bb22f94
test(finish): pin the legacy render test to process V16 (#523)
smi-leonivkovic Dec 3, 2026
e38ffdb
Merge lr-v9-highlights (with main) into lr-v9-calibration (#523)
smi-leonivkovic Dec 3, 2026
a91155b
Merge branch 'lr-v8-base' into lr-v9-highlights
smi-leonivkovic Dec 3, 2026
8495512
refactor(default_tone): from V17 as a comparison, as the curve stage …
smi-leonivkovic Dec 3, 2026
cedbc2d
refactor(hs_range): from V17 as a comparison, as the curve stage gate…
smi-leonivkovic Dec 3, 2026
c538115
Merge branch 'lr-v9-highlights' into lr-v9-calibration
smi-leonivkovic Dec 3, 2026
1f53475
test(curve): the drag test allows the framework's drag threshold, not…
smi-leonivkovic Dec 3, 2026
4f01fd1
Merge branch 'lr-v8-tone' into lr-v8-color
smi-leonivkovic Dec 3, 2026
19cfa00
Merge branch 'lr-v8-color' into lr-v8-grading
smi-leonivkovic Dec 3, 2026
9f2b85c
Merge branch 'lr-v8-grading' into lr-v8-base
smi-leonivkovic Dec 3, 2026
fc045bc
Merge branch 'lr-v8-base' into lr-v9-highlights
smi-leonivkovic Dec 3, 2026
cafbdc4
Merge branch 'lr-v9-highlights' into lr-v9-calibration
smi-leonivkovic Dec 3, 2026
ff7529a
Merge main into lr-v8-tone: the series moves to process V18 (#523)
smi-leonivkovic Dec 3, 2026
a85845d
test(proraw): V18's curve stage leaves Whites to the ProRAW chain; V1…
smi-leonivkovic Dec 3, 2026
2722f97
fix(curve_stage): Refine Saturation restores the colour after Whites …
smi-leonivkovic Dec 3, 2026
5a58233
fix(curve_input): under V18 sample where the curve stage reads (#523)
smi-leonivkovic Dec 3, 2026
de0c5a8
fix(tools): the tone charts' manifest carries the tool's prefix and f…
smi-leonivkovic Dec 3, 2026
ee3071e
Merge lr-v8-tone into lr-v8-color: the series moves to process V18 (#…
smi-leonivkovic Dec 3, 2026
72cd3a9
Merge lr-v8-color into lr-v8-grading: the series moves to process V18…
smi-leonivkovic Dec 3, 2026
87df28f
Merge lr-v8-grading into lr-v8-base: the series moves to process V18 …
smi-leonivkovic Dec 3, 2026
9a9eb2c
Merge lr-v8-base into lr-v9-highlights: the series moves to process V…
smi-leonivkovic Dec 3, 2026
0fc750f
Merge lr-v9-highlights into lr-v9-calibration: the series moves to pr…
smi-leonivkovic Dec 3, 2026
023c93c
test(gpu): the curve-input prefix test names V17, where the sample is…
smi-leonivkovic Dec 3, 2026
5b4db64
Merge branch 'lr-v8-base' into lr-v9-highlights
smi-leonivkovic Dec 3, 2026
e246094
Merge branch 'lr-v8-tone' into lr-v8-color
smi-leonivkovic Dec 3, 2026
5fcf5c9
Merge branch 'lr-v8-color' into lr-v8-grading
smi-leonivkovic Dec 3, 2026
c08c72d
Merge branch 'lr-v8-grading' into lr-v8-base
smi-leonivkovic Dec 3, 2026
f9caf1d
fix(local_tone): drop the import apply_framed needed; main's apply_in…
smi-leonivkovic Dec 3, 2026
779fffe
Merge branch 'lr-v9-highlights' into lr-v9-calibration
smi-leonivkovic Dec 3, 2026
a8872ab
fix(curve_input): on ProRAW the sample's curve stage leaves Whites to…
smi-leonivkovic Dec 3, 2026
fbf3704
Merge lr-v8-tone into lr-v8-color; curve-stage.md names V18's colour …
smi-leonivkovic Dec 3, 2026
ff2898d
Merge branch 'lr-v8-color' into lr-v8-grading
smi-leonivkovic Dec 3, 2026
642aab4
fix(smart): back to encoding 4; previews never stored default_tone, s…
smi-leonivkovic Dec 3, 2026
952ce4e
Merge lr-v8-base into lr-v9-highlights; hs-range.md: the range is mea…
smi-leonivkovic Dec 3, 2026
895e227
Merge branch 'lr-v9-highlights' into lr-v9-calibration
smi-leonivkovic Dec 3, 2026
e2261e1
docs(parity): the default curve's exposure offsets cover four Lumix b…
smi-leonivkovic Dec 3, 2026
3a86623
docs(parity): the default curve's exposure offsets cover four Lumix b…
smi-leonivkovic Dec 3, 2026
08676c6
Merge branch 'lr-v9-highlights' into lr-v9-calibration
smi-leonivkovic Dec 3, 2026
587ed53
docs: V17's Apple ProRAW uses its chain's fitted Whites, not V2 White…
smi-leonivkovic Dec 3, 2026
6f70731
Merge branch 'lr-v8-tone' into lr-v8-color
smi-leonivkovic Dec 3, 2026
3c308bf
Merge branch 'lr-v8-color' into lr-v8-grading
smi-leonivkovic Dec 3, 2026
9917c4a
Merge branch 'lr-v8-grading' into lr-v8-base
smi-leonivkovic Dec 3, 2026
1abc15e
Merge branch 'lr-v8-base' into lr-v9-highlights
smi-leonivkovic Dec 3, 2026
4be5707
Merge branch 'lr-v9-highlights' into lr-v9-calibration
smi-leonivkovic Dec 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions crates/develop/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,17 @@ pub enum Process {
/// V16, with Apple ProRAW's tone sliders running in Lightroom's fitted tone chain
/// (`lightcraft_pipeline::proraw`).
V17,
/// V17, with Whites and the parametric curve from a fitted model, and the tone curves applied
/// hue-preserving: Whites, the parametric and point curve in linear ProPhoto RGB, then the red, green and
/// blue curves per channel, before the colour stage (`lightcraft_pipeline::curve_stage`,
/// `docs/curve-stage.md`).
V18,
}

impl Process {
/// Every process, oldest first (`ProcessVersion(9)` names none and renders as V8; 11 and 12 name none and
/// render as V10).
pub const ALL: [Process; 14] = [
pub const ALL: [Process; 15] = [
Process::V1,
Process::V2,
Process::V3,
Expand All @@ -147,8 +152,9 @@ impl Process {
Process::V15,
Process::V16,
Process::V17,
Process::V18,
];
pub const LATEST: Process = Process::V17;
pub const LATEST: Process = Process::V18;

pub const fn version(self) -> ProcessVersion {
match self {
Expand All @@ -166,6 +172,7 @@ impl Process {
Process::V15 => ProcessVersion(15),
Process::V16 => ProcessVersion(16),
Process::V17 => ProcessVersion(17),
Process::V18 => ProcessVersion(18),
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions crates/engine/src/files/load.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,12 @@ fn load_bytes_now(
let proraw =
(dcp.is_none() && camera_look.is_none()).then(|| proraw_tone(&raw, t.baseline_exposure as f32, &img.data)).flatten().map(Arc::new);
let local_tone = local_tone(&raw);
// From process V18 a profile without a tone curve of its own (Adobe Standard) renders with the fitted
// default curve, shifted by the camera's measured exposure offset (`lightcraft_pipeline::default_tone`).
let default_tone = dcp.filter(|p| p.color.profile.tone_curve.is_none()).map(|_| {
let m = &raw.metadata;
lightcraft_pipeline::default_tone::camera_ev(m.make.as_deref().unwrap_or(""), m.model.as_deref().unwrap_or(""))
});
let (temp, tint) = scale.as_shot(xy);
return Ok((
img,
Expand All @@ -271,6 +277,7 @@ fn load_bytes_now(
legacy_relative_wb: scale.legacy_relative,
camera_color,
camera_tone,
default_tone,
mattes,
local_tone,
proraw,
Expand Down
11 changes: 9 additions & 2 deletions crates/engine/src/smart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,11 @@ const ENC_FIELD: &str = "enc";
/// reads as 0, which makes every proxy from before this version stale. Version 2 is the first to
/// record the field at all (a version 1 proxy is stored at JPEG quality 92, which this build
/// raises to [`JPEG_QUALITY`]); version 3 is the first to store the decoder facts in the tail;
/// version 4 adds Apple ProRAW's profile curve for Lightroom's tone chain (process V17). A stale
/// version 4 adds Apple ProRAW's profile curve for Lightroom's tone chain (process V17); version 5
/// records whether the raw's profile lacks a tone curve, for process V18's default curve. A stale
/// proxy whose original is offline is kept as it is (see [`is_stale`]).
/// Crate-visible so the look-marker test pins the marker format to it instead of to a literal.
pub(crate) const ENCODE_VERSION: u64 = 4;
pub(crate) const ENCODE_VERSION: u64 = 5;

/// The version of how a raw's preview-size source is decoded from its sensor data, apart from the camera-look fit
/// (`camera_preview::LOOK_VERSION`). A smart preview keeps that source, so a raw's proxy written by an older one is
Expand Down Expand Up @@ -117,6 +118,10 @@ struct SmartFacts {
lens: Option<lightcraft_develop::EmbeddedLens>,
camera_color: Option<lightcraft_pipeline::CameraColor>,
local_tone: Option<lightcraft_pipeline::local_tone::LocalTone>,
/// `SourceInfo::default_tone` (absent before version 5: such a proxy is rebuilt when its original is online, and
/// one whose original is offline renders on the camera tone it stored, as before process V18's default curve).
#[serde(default)]
default_tone: Option<f32>,
/// Apple ProRAW's profile curve for Lightroom's tone chain (absent before version 4: such a
/// proxy renders ProRAW on the camera-curve path, retaining V16 behavior).
#[serde(default, deserialize_with = "lenient_proraw")]
Expand Down Expand Up @@ -239,6 +244,7 @@ pub(crate) fn encode_with_lens_key(img: &Rgb32f, info: Option<&SourceInfo>, lens
lens: i.lens,
camera_color: i.camera_color.as_deref().cloned(),
local_tone: i.local_tone.as_deref().cloned(),
default_tone: i.default_tone,
proraw: i.proraw.as_deref().cloned(),
mattes: matte_list,
};
Expand Down Expand Up @@ -287,6 +293,7 @@ pub fn decode(bytes: &[u8]) -> Result<(Rgb32f, Option<CameraTone>, Option<Source
lens: f.lens,
camera_color: f.camera_color.map(Arc::new),
camera_tone: tone,
default_tone: f.default_tone,
mattes: (!mattes.is_empty()).then(|| Arc::new(mattes)),
local_tone: f.local_tone.map(Arc::new),
proraw: f.proraw.map(Arc::new),
Expand Down
23 changes: 23 additions & 0 deletions crates/engine/src/tests/dcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,29 @@ fn a_profile_without_a_tone_curve_keeps_the_photos_contrast() {
assert!((tone.apply(0.18) - 0.45).abs() < 0.01, "{}", tone.apply(0.18));
}

/// Process V18 (`lightcraft_pipeline::default_tone`): a profile without a tone curve marks the source for the fitted
/// default curve (a camera with no measured offset: 0 stops); a profile with a curve, or no profile, does not. Up to
/// V7 the base tone stays the file's own.
#[test]
fn a_profile_without_a_tone_curve_gets_the_default_curve_from_v9() {
use lightcraft_develop::{DevelopSettings, Process};
use lightcraft_raw::profile::ToneCurve;
let dng = crate::tests_xmp::synthetic_dng_with(None, Default::default());
let (_, plain) = crate::files::load_bytes(&dng, 64).unwrap();
assert_eq!(plain.default_tone, None);
let (_, info) = crate::files::load_bytes_with(&dng, 64, Some(&swapping_profile("Swap"))).unwrap();
assert_eq!(info.default_tone, Some(0.0));
let mut curved = swapping_profile("Curved");
curved.color.profile.tone_curve = ToneCurve::from_tag(&[0.0, 0.0, 0.18, 0.45, 1.0, 1.0]);
assert_eq!(crate::files::load_bytes_with(&dng, 64, Some(&curved)).unwrap().1.default_tone, None);
let on = |p: Process| DevelopSettings { process: p.version(), ..Default::default() };
let (v7, v17) =
(lightcraft_pipeline::finish::base_tone(&on(Process::V7), &info, 1.0), lightcraft_pipeline::finish::base_tone(&on(Process::V18), &info, 1.0));
let lr = lightcraft_pipeline::default_tone::curve(0.0).unwrap();
assert!((v17.apply(0.18) - lr.apply(0.18)).abs() < 0.01, "{} vs {}", v17.apply(0.18), lr.apply(0.18));
assert!((v7.apply(0.18) - lr.apply(0.18)).abs() > 0.01, "V7 keeps the file's own tone: {}", v7.apply(0.18));
}

#[test]
fn import_choose_cache_persist_and_delete() {
let dir = temp_dir("session");
Expand Down
12 changes: 12 additions & 0 deletions crates/gpu/src/ctx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,18 @@ fn constants() -> String {
let rows: Vec<String> = m.iter().map(|r| format!("vec3<f32>({:?}, {:?}, {:?})", r[0], r[1], r[2])).collect();
s += &format!("const {name} = array<vec3<f32>, 3>({});\n", rows.join(", "));
}
{
use lightcraft_pipeline::hs_range as hr;
s += &format!(
"const HS_H_AMP: f32 = {:?};\nconst HS_H_SPAN: f32 = {:?};\nconst HS_H_POW: f32 = {:?};\nconst HS_H_REACH: f32 = {:?};\nconst HS_H_AMP_MIN: f32 = {:?};\nconst HS_H_AMP_MAX: f32 = {:?};\n",
hr::H_AMP,
hr::H_SPAN,
hr::H_POW,
hr::H_REACH,
hr::H_AMP_RANGE.0,
hr::H_AMP_RANGE.1
);
}
s += &format!(
"const TONE_MIN_EV: f32 = {LUT_MIN_EV:?};\nconst TONE_MAX_EV: f32 = {LUT_MAX_EV:?};\nconst TONE_N: u32 = {LUT_N}u;\nconst CHROMA_N: u32 = {CHROMA_N}u;\n"
);
Expand Down
85 changes: 71 additions & 14 deletions crates/gpu/src/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,21 @@ const FIELDS: &[(&str, usize)] = &[
("SRGB_OFF", 1),
("CURVE_OFF", 1),
("CURVES", 1),
("STAGE", 1),
("STAGE_OFF", 1),
("STAGE_REFINE", 1),
("MSTAGE", 1),
("MSTAGE_OFF", 1),
("MSTAGE_MIX", 1),
("MSTAGE_CAL", 1),
("MSTAGE_CAL_OFF", 1),
("MGRADE", 1),
("MGRADE_OFF", 1),
("RGB_TONE", 1),
("HS_RANGE", 1),
("HS_RANGE_LO", 1),
("HS_RANGE_HI", 1),
("STAGE_WHITES", 1),
("GAIN", 1),
("EV", 1),
("AIR", 1),
Expand Down Expand Up @@ -296,20 +311,46 @@ pub fn finish_block(fp: &FinishParams, masks: &[[f32; MASK_TERMS]], present: &Pr
let srgb_off = aux.len();
aux.extend_from_slice(&srgb_lut()[..]);
let curve_off = aux.len();
if let Some(c) = &fp.curves {
for l in c {
if l.v.len() != CURVE_N as usize {
// a wrong-length curve would shift every later aux offset (CURVE_OFF, MASK_OFF and
// the mask terms that follow) and make the kernel read the wrong data. `fail()`
// records the failure on this thread so the render falls back to the CPU; the
// partial `(p, aux)` returned here is never bound to a pipeline.
fail(FailKind::Fatal, format!("curve table has {} entries, expected {}", l.v.len(), CURVE_N));
// `p` is only assembled below the curve loop, so an empty block is as good as any:
// the caller (render.rs) gates on `failed()` right after this returns and bails to
// the CPU fallback before indexing `p` or uploading `aux`.
return (Vec::new(), aux);
}
aux.extend_from_slice(&l.v);
let stage_off = curve_off + fp.curves.as_ref().map_or(0, |c| c.len() * CURVE_N as usize);
// process V18's stage (red, green, blue, then the base table) or the earlier processes' curves
// (and Whites alone after the base table, when Refine Saturation needs it)
let tables = fp.curves.iter().flatten().chain(fp.curve_stage.iter().flat_map(|c| c.chan.iter().chain([&c.base]).chain(c.whites.iter())));
for l in tables {
if l.v.len() != CURVE_N as usize {
// a wrong-length curve would shift every later aux offset (CURVE_OFF, MASK_OFF and
// the mask terms that follow) and make the kernel read the wrong data. `fail()`
// records the failure on this thread so the render falls back to the CPU; the
// partial `(p, aux)` returned here is never bound to a pipeline.
fail(FailKind::Fatal, format!("curve table has {} entries, expected {}", l.v.len(), CURVE_N));
// `p` is only assembled below the curve loop, so an empty block is as good as any:
// the caller (render.rs) gates on `failed()` right after this returns and bails to
// the CPU fallback before indexing `p` or uploading `aux`.
return (Vec::new(), aux);
}
aux.extend_from_slice(&l.v);
}
// process V18's mixer stage: calibration's table, then the mixer's, each after the 9 chroma and 3 lightness keys
let mstage_cal_off = aux.len();
if let Some((cs, t)) = fp.mixer_stage.as_ref().and_then(|cs| cs.calibration.as_deref().map(|t| (cs, t))) {
aux.extend(cs.chroma.iter().flatten());
aux.extend_from_slice(&cs.light);
aux.extend_from_slice(&t[..]);
}
let mstage_off = aux.len();
if let Some((cs, t)) = fp.mixer_stage.as_ref().and_then(|cs| cs.table.as_deref().map(|t| (cs, t))) {
aux.extend(cs.chroma.iter().flatten());
aux.extend_from_slice(&cs.light);
aux.extend_from_slice(&t[..]);
}
// process V18's Colour Grading: the Luminance curve, then per wheel its tint, damping and profile
let mgrade_off = aux.len();
let mgrade = fp.ops.measured_grading.as_ref();
if let Some(g) = mgrade {
aux.extend_from_slice(&g.lum);
for w in &g.wheels {
aux.extend_from_slice(&w.tint);
aux.extend(w.damping.iter().flatten());
aux.extend_from_slice(&w.profile);
}
}
let mask_off = aux.len();
Expand Down Expand Up @@ -358,6 +399,22 @@ 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("STAGE", fp.curve_stage.is_some());
p.u("STAGE_OFF", stage_off as u32);
p.f("STAGE_REFINE", fp.curve_stage.as_ref().map_or(1.0, |c| c.refine));
p.b("MSTAGE", fp.mixer_stage.is_some());
p.u("MSTAGE_OFF", mstage_off as u32);
p.b("MSTAGE_MIX", fp.mixer_stage.as_ref().is_some_and(|cs| cs.table.is_some()));
p.b("MSTAGE_CAL", fp.mixer_stage.as_ref().is_some_and(|cs| cs.calibration.is_some()));
p.u("MSTAGE_CAL_OFF", mstage_cal_off as u32);
// 0: off, else 1 + the number of wheels with a tint
p.u("MGRADE", mgrade.map_or(0, |g| 1 + g.wheels.len() as u32));
p.u("MGRADE_OFF", mgrade_off as u32);
p.b("RGB_TONE", fp.rgb_tone);
p.b("HS_RANGE", fp.hs_range.is_some());
p.f("HS_RANGE_LO", fp.hs_range.map_or(0.0, |r| r.lo));
p.f("HS_RANGE_HI", fp.hs_range.map_or(0.0, |r| r.hi));
p.b("STAGE_WHITES", fp.curve_stage.as_ref().is_some_and(|c| c.whites.is_some()));
p.f("REFINE_SAT", fp.refine_sat);
p.f("GAIN", fp.gain);
p.f("EV", fp.ev);
Expand Down
1 change: 1 addition & 0 deletions crates/gpu/src/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,7 @@ pub fn render(
image_size: (w, h),
px_per_long: plan.px_per_long,
air_pre: prep.air,
hs_range: plan.hs_range,
space: req.space,
draft: req.quality == lightcraft_pipeline::Quality::Draft,
});
Expand Down
Loading