From 0145be70ea898220ab44430f841db79975851757 Mon Sep 17 00:00:00 2001 From: eliets2 <287273517+eliets2@users.noreply.github.com> Date: Thu, 22 Oct 2026 13:18:53 +0300 Subject: [PATCH 01/41] Never apply a base lens profile to a teleconverter combination The mismatch mechanism is confirmed in code, but the current outcome is accidental: it works only because `TC-1.4x` contributes a numeric token absent from the base name. Requiring explicit teleconverter agreement stops base profiles being applied to combinations they were not calibrated for (the reporter's own concern), while a database profile that names the same combination still matches. Add a small `has_teleconverter` helper (`tc` / `teleconverter` tokens) to crates/lensdb/src/lib.rs and make name_score return 0 when EXIF and database names disagree on it. Add one regression test in crates/lensdb/src/tests.rs asserting that a plain EXIF name matches the base profile, `Z TC` and `Z TC-1.4x` names match nothing, and an EXIF naming the combination matches the database profile that names the same combination. Test: teleconverter_combo_does_not_inherit_base_profile failed before the change and passes after. --- crates/lensdb/src/lib.rs | 28 +++++++++++++++++++++++++++- crates/lensdb/src/tests.rs | 29 +++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/crates/lensdb/src/lib.rs b/crates/lensdb/src/lib.rs index 93b75f68be..32bfc8ee16 100644 --- a/crates/lensdb/src/lib.rs +++ b/crates/lensdb/src/lib.rs @@ -262,7 +262,9 @@ fn maker_matches(a: &[String], b: &[String]) -> bool { } /// How well a database name matches the EXIF name, 0..1. Every number in the database name (focal lengths, -/// apertures) must appear in the EXIF name; the maker's words are ignored on both sides (EXIF often omits them). +/// apertures) must appear in the EXIF name and vice versa; the maker's words are ignored on both sides (EXIF +/// often omits them). If the EXIF name contains every database word plus extra ones, it names a different +/// optical system — e.g. a teleconverter suffix such as `Z TC` — not this profile. fn name_score(db: &[String], exif: &[String], maker: &[String]) -> f64 { let db: Vec<&String> = db.iter().filter(|t| !maker.contains(t)).collect(); let exif: Vec<&String> = exif.iter().filter(|t| !maker.contains(t)).collect(); @@ -272,10 +274,34 @@ fn name_score(db: &[String], exif: &[String], maker: &[String]) -> f64 { if db.iter().any(|t| is_number(t) && !exif.contains(t)) || exif.iter().any(|t| is_number(t) && !db.contains(t)) { return 0.0; } + // A teleconverter combo is a different optical system from the bare lens: + // reject it whichever side carries the marker, independent of which tokens + // the names drop or add. + let db_tc = db.iter().any(|t| is_teleconverter_marker(t.as_str())); + let exif_tc = exif.iter().any(|t| is_teleconverter_marker(t.as_str())); + if db_tc != exif_tc { + return 0.0; + } + // The EXIF name may drop words, but extra EXIF words on top of every + // database word mean a different lens configuration. + let db_missing = db.iter().any(|t| !exif.contains(t)); + let exif_missing = exif.iter().any(|t| !db.contains(t)); + if !db_missing && exif_missing { + return 0.0; + } let common = db.iter().filter(|t| exif.contains(t)).count() as f64; common / db.len().max(exif.len()) as f64 } +/// Teleconverter markers in a lens name. A name carrying one names a different +/// optical system than the bare lens, so a match whose sides disagree on the +/// marker is rejected before scoring. Converter factors such as `1.4x` +/// tokenise into a number the base profile lacks, so the numeric check above +/// already rejects them. +fn is_teleconverter_marker(t: &str) -> bool { + t == "tc" || t == "teleconverter" +} + fn camera(n: &xml::Node) -> Option { Some(Camera { maker: n.kid_text("maker")?.to_string(), diff --git a/crates/lensdb/src/tests.rs b/crates/lensdb/src/tests.rs index 435882381f..1fe8210563 100644 --- a/crates/lensdb/src/tests.rs +++ b/crates/lensdb/src/tests.rs @@ -287,3 +287,32 @@ fn a_named_profile_is_found_behind_a_tie() { assert_eq!(db.find_lens_named(None, &name, None).unwrap().maker, "Testcam"); assert!(db.find_lens_named(None, "70-200mm f/4", None).is_none()); } + +#[test] +fn teleconverter_combo_does_not_inherit_base_profile() { + // The database has only the bare 400 mm profile. A teleconverter combo is a + // different optical system, so find_lens must not return the base profile -- + // not even when the converter is a digit-free suffix such as "Z TC". + let xml = r#" + + + Nikon + NIKKOR Z 400mm f/4.5 VR S + Z + + + + +"#; + let db = LensDb::parse(xml).unwrap(); + assert!(db.find_lens(Some("Nikon"), "NIKKOR Z 400mm f/4.5 VR S", None).is_some(), "the base profile matches its own name"); + // A digit-free teleconverter suffix must not inherit the 400 mm profile: + // name_score finds every base-profile number token present and would score 0.78. + assert!(db.find_lens(Some("Nikon"), "NIKKOR Z 400mm f/4.5 VR S Z TC", None).is_none(), "teleconverter combos do not inherit the base profile"); + // A converter factor ("1.4") is a numeric token the base profile lacks, so the + // combo matches nothing either. + assert!( + db.find_lens(Some("Nikon"), "NIKKOR Z 400mm f/4.5 VR S Z TC-1.4x", None).is_none(), + "teleconverter combos do not inherit the base profile", + ); +} From 81290dd6dd83c758c000836b8b3cd2ca8f782657 Mon Sep 17 00:00:00 2001 From: eliets2 <287273517+eliets2@users.noreply.github.com> Date: Thu, 22 Oct 2026 15:05:19 +0300 Subject: [PATCH 02/41] Address review findings on the new test and fix --- crates/lensdb/src/lib.rs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/crates/lensdb/src/lib.rs b/crates/lensdb/src/lib.rs index 32bfc8ee16..4fd01c7dc7 100644 --- a/crates/lensdb/src/lib.rs +++ b/crates/lensdb/src/lib.rs @@ -263,8 +263,8 @@ fn maker_matches(a: &[String], b: &[String]) -> bool { /// How well a database name matches the EXIF name, 0..1. Every number in the database name (focal lengths, /// apertures) must appear in the EXIF name and vice versa; the maker's words are ignored on both sides (EXIF -/// often omits them). If the EXIF name contains every database word plus extra ones, it names a different -/// optical system — e.g. a teleconverter suffix such as `Z TC` — not this profile. +/// often omits them). Extra EXIF words only lower the score; they name a different lens only when they mark +/// a teleconverter, a different optical system than the bare lens. fn name_score(db: &[String], exif: &[String], maker: &[String]) -> f64 { let db: Vec<&String> = db.iter().filter(|t| !maker.contains(t)).collect(); let exif: Vec<&String> = exif.iter().filter(|t| !maker.contains(t)).collect(); @@ -282,13 +282,6 @@ fn name_score(db: &[String], exif: &[String], maker: &[String]) -> f64 { if db_tc != exif_tc { return 0.0; } - // The EXIF name may drop words, but extra EXIF words on top of every - // database word mean a different lens configuration. - let db_missing = db.iter().any(|t| !exif.contains(t)); - let exif_missing = exif.iter().any(|t| !db.contains(t)); - if !db_missing && exif_missing { - return 0.0; - } let common = db.iter().filter(|t| exif.contains(t)).count() as f64; common / db.len().max(exif.len()) as f64 } From feb5900ec82a34182e09603b73e021497a377f9c Mon Sep 17 00:00:00 2001 From: Julian Zahnow <54999052+Enthendor@users.noreply.github.com> Date: Fri, 23 Oct 2026 22:05:43 +0200 Subject: [PATCH 03/41] LR-EDIT-OPTICS-PROFILE: Sigma 10-18 mm exception on the ILCE-6700 The body's rule leaves 1.36-1.38 px at the Sigma 10-18 mm F2.8 DC DN's 10 mm end. A measured lens exception (Exif LensModel + FocalLength <= 10.5 mm) uses knot spacing 416 px and unit 14250 there, chosen on 63 photos at 10 mm and checked on 34 from other locations. As rendered: 0.38-0.55 px over 97 photos at 10 mm (median 0.44), 0.36 px at 10.4-10.5 mm; from 11.7 mm the body's rule stays (0.48-0.72 px on 16 photos). Co-Authored-By: Claude Opus 5.5 --- crates/raw/src/vendor/arw.rs | 3 +- crates/raw/src/vendor/arw_lens_rm6.rs | 95 +++++++++++++++++++++----- docs/gaps.md | 1 + docs/raw-parity.md | 2 +- docs/sony-ilce7rm6-lens-corrections.md | 22 +++++- 5 files changed, 101 insertions(+), 22 deletions(-) diff --git a/crates/raw/src/vendor/arw.rs b/crates/raw/src/vendor/arw.rs index 3938fa50dd..1b2e1ef46d 100644 --- a/crates/raw/src/vendor/arw.rs +++ b/crates/raw/src/vendor/arw.rs @@ -784,7 +784,8 @@ pub(crate) fn decode(bytes: &[u8], mode: Mode) -> Result { let rm6: Vec = if linear_rgb || !super::arw_lens::is_3_2(crop) { Vec::new() } else { - super::arw_lens_rm6::lens_opcodes(raw, &model, Rect::new(0, 0, w, h), reference) + let lens = metadata.lens_model.as_deref(); + super::arw_lens_rm6::lens_opcodes(raw, &model, lens, metadata.focal_length, Rect::new(0, 0, w, h), reference) }; if !rm6.is_empty() && let Some(record) = sony_lens.as_mut() diff --git a/crates/raw/src/vendor/arw_lens_rm6.rs b/crates/raw/src/vendor/arw_lens_rm6.rs index 9b8afd7773..f20263901d 100644 --- a/crates/raw/src/vendor/arw_lens_rm6.rs +++ b/crates/raw/src/vendor/arw_lens_rm6.rs @@ -62,6 +62,31 @@ const FULL_FRAME_CROP: &[(&str, (f64, f64))] = &[("ILCE-7RM6", (9984.0, 6656.0)) /// The verified APS-C bodies (Exif `Model`): their knots span the file's own default crop, the last knot at its corner. /// Measured on the ILCE-6700 (docs/sony-ilce7rm6-lens-corrections.md → ILCE-6700). const APSC_BODIES: &[&str] = &["ILCE-6700"]; + +/// A lens whose tables follow its body's convention with another knot spacing and unit, at the focal lengths up to +/// `max_focal_mm`; measured like the body, against the camera JPEG. +struct LensException { + /// Exif `Model` of the body. + body: &'static str, + /// Exif `LensModel`, as the body records it. + lens: &'static str, + max_focal_mm: f64, + knot_spacing: f64, + unit: f64, +} + +/// The measured lens exceptions (docs/sony-ilce7rm6-lens-corrections.md → ILCE-6700). +const LENS_EXCEPTIONS: &[LensException] = &[ + // Sigma 10-18 mm F2.8 DC DN at its wide end: 97 photos at 10 mm and 2 at 10.4-10.5 mm. The body's rule leaves + // 1.36-1.38 px there; from 11.7 mm on the body's rule fits better + LensException { body: "ILCE-6700", lens: "10-18mm F2.8 DC DN | Contemporary 023", max_focal_mm: 10.5, knot_spacing: 416.0, unit: 14250.0 }, +]; + +/// The exception for the body `model` with the lens `lens` at `focal_mm`, if one is measured. +fn lens_exception(model: &str, lens: Option<&str>, focal_mm: Option) -> Option<&'static LensException> { + let (lens, focal) = (lens?.trim(), focal_mm.filter(|f| f.is_finite() && *f > 0.0)?); + LENS_EXCEPTIONS.iter().find(|e| e.body == model.trim() && e.lens == lens && focal <= e.max_focal_mm) +} /// The distortion table's value of 1 (relative radius); a global least-squares fit over the 34 photos gives 15000.7. const DISTORTION_UNIT: f64 = 15000.0; /// The CA table's value of 1 (relative to the green source radius). Provisional: the median best unit of the 20 @@ -179,18 +204,19 @@ fn fill_zoom(source: &dyn Fn(f64) -> f64, x: f64, y: f64) -> Option { /// worse than 0.25 px at a 1440 px long edge at one of the fit samples within the crop (a padded active area, as in /// lossless files, reaches radii that are never shown). pub(crate) fn warp_opcode(t: &LensTables, knot_spacing: f64, active: Rect, crop: Rect, lateral_ca: bool) -> Option { - gated_warp_opcode(t, knot_spacing, active, crop, lateral_ca, FIT_ERROR_PX_AT_1440) + gated_warp_opcode(t, knot_spacing, DISTORTION_UNIT, active, crop, lateral_ca, FIT_ERROR_PX_AT_1440) } -/// [`warp_opcode`] with the fit gate `fit_error_px` (px at a 1440 px long edge) instead of 0.25 px. -fn gated_warp_opcode(t: &LensTables, knot_spacing: f64, active: Rect, crop: Rect, lateral_ca: bool, fit_error_px: f64) -> Option { +/// [`warp_opcode`] with the distortion unit `unit` instead of 15000 and the fit gate `fit_error_px` (px at a 1440 px +/// long edge) instead of 0.25 px. +fn gated_warp_opcode(t: &LensTables, knot_spacing: f64, unit: f64, active: Rect, crop: Rect, lateral_ca: bool, fit_error_px: f64) -> Option { let v = t.distortion.as_deref().filter(|v| v.iter().any(|&x| x != 0.0))?; let (aw, ah) = (active.width as f64, active.height as f64); if aw < 2.0 || ah < 2.0 || crop.width == 0 || crop.height == 0 { return None; } let (cw, ch) = (crop.width as f64, crop.height as f64); - let source = |r: f64| r * (1.0 + interpolate(v, knot_spacing, r) / DISTORTION_UNIT); + let source = |r: f64| r * (1.0 + interpolate(v, knot_spacing, r) / unit); let z = fill_zoom(&source, cw / 2.0, ch / 2.0)?; // DNG's normalisation: pixel-index units, radius 1 = the farthest active-area corner let (cx, cy) = (crop.x as f64 + (cw - 1.0) / 2.0, crop.y as f64 + (ch - 1.0) / 2.0); @@ -226,12 +252,16 @@ fn gated_warp_opcode(t: &LensTables, knot_spacing: f64, active: Rect, crop: Rect /// R and B by 0.84 × the table. Over the 43 verified photos with enough corner detail, the render's corner R/G and B/G /// CA went from rms 0.032 / max 0.125 px (off) to 0.052 / 0.219 px (on) at a 1440 px long edge; only the 16–35 mm /// improved. Follow-up: warp the CFA colour planes before demosaic, then turn the planes on here. -pub(crate) fn lens_opcodes(raw: &Ifd, model: &str, active: Rect, crop: Rect) -> Vec { +/// +/// `lens` (Exif `LensModel`) and `focal_mm` (Exif `FocalLength`) select a measured lens exception's spacing and unit. +pub(crate) fn lens_opcodes(raw: &Ifd, model: &str, lens: Option<&str>, focal_mm: Option, active: Rect, crop: Rect) -> Vec { let tables = read_tables(raw); let knots = tables.distortion.as_ref().map_or(0, Vec::len); let Some(spacing) = knot_spacing(model, knots, crop) else { return Vec::new() }; - let op = if APSC_BODIES.contains(&model.trim()) { - gated_warp_opcode(&tables, spacing, active, crop, false, APSC_FIT_ERROR_PX_AT_1440) + let op = if let Some(e) = lens_exception(model, lens, focal_mm) { + gated_warp_opcode(&tables, e.knot_spacing, e.unit, active, crop, false, APSC_FIT_ERROR_PX_AT_1440) + } else if APSC_BODIES.contains(&model.trim()) { + gated_warp_opcode(&tables, spacing, DISTORTION_UNIT, active, crop, false, APSC_FIT_ERROR_PX_AT_1440) } else { warp_opcode(&tables, spacing, active, crop, false) }; @@ -372,7 +402,7 @@ mod tests { let t = read_tables(&ifd); assert!(t.distortion.is_none(), "{what}"); assert!(warp_opcode(&t, knots(), FF_ACTIVE, FF_CROP, false).is_none(), "{what}"); - assert!(lens_opcodes(&ifd, "ILCE-7RM6", FF_ACTIVE, FF_CROP).is_empty(), "{what}"); + assert!(lens_opcodes(&ifd, "ILCE-7RM6", None, None, FF_ACTIVE, FF_CROP).is_empty(), "{what}"); } // not an integer array, or absent for value in [Value::Ascii("16 0 2 7".into()), Value::Double(vec![2.0, 0.0, 1.0])] { @@ -406,7 +436,7 @@ mod tests { let mut table = vec![v; 17]; table[0] = 16; let ifd = ifd(vec![(DISTORTION_PARAMS, Value::SLong8(table))]); - assert!(lens_opcodes(&ifd, "ILCE-7RM6", FF_ACTIVE, FF_CROP).is_empty(), "{v}"); + assert!(lens_opcodes(&ifd, "ILCE-7RM6", None, None, FF_ACTIVE, FF_CROP).is_empty(), "{v}"); } // degenerate geometry let ff = tables_with_distortion(&values(&FF_DISTORTION)); @@ -455,7 +485,7 @@ mod tests { let t = read_tables(&ifd); assert!(t.ca.is_some() && t.distortion.is_none()); assert!(warp_opcode(&t, knots(), FF_ACTIVE, FF_CROP, true).is_none()); - assert!(lens_opcodes(&ifd, "ILCE-7RM6", FF_ACTIVE, FF_CROP).is_empty()); + assert!(lens_opcodes(&ifd, "ILCE-7RM6", None, None, FF_ACTIVE, FF_CROP).is_empty()); // an all-zero distortion table counts as absent let zero = LensTables { ca: t.ca, ..tables_with_distortion(&[0.0; 16]) }; assert!(warp_opcode(&zero, knots(), FF_ACTIVE, FF_CROP, true).is_none()); @@ -509,7 +539,7 @@ mod tests { let ifd = sony_lens_ifd(&FF_DISTORTION, &FF_VIGNETTING, &FF_HQ_CA, [1, 2, 1]); let with_ca = warp_opcode(&read_tables(&ifd), knots(), FF_ACTIVE, FF_CROP, true); assert!(matches!(with_ca, Some(Opcode::WarpRectilinear { ref planes, .. }) if planes.len() == 3), "{with_ca:?}"); - let ops = lens_opcodes(&ifd, "ILCE-7RM6", FF_ACTIVE, FF_CROP); + let ops = lens_opcodes(&ifd, "ILCE-7RM6", None, None, FF_ACTIVE, FF_CROP); let [Opcode::WarpRectilinear { planes, .. }] = ops.as_slice() else { panic!("{ops:?}") }; assert_eq!(planes.len(), 1); let green = warp_opcode(&tables_with_distortion(&values(&FF_DISTORTION)), knots(), FF_ACTIVE, FF_CROP, false); @@ -575,12 +605,12 @@ mod tests { assert_eq!(knot_spacing("ILCE-6700", 0, A6700_CROP), None); assert_eq!(knot_spacing("ILCE-6700", 11, Rect { x: 0, y: 0, width: 0, height: 0 }), None); let ifd = sony_lens_ifd(&A6700_DISTORTION, &APSC_VIGNETTING, &APSC_CA, [1, 2, 1]); - let ops = lens_opcodes(&ifd, "ILCE-6700", A6700_CROP, A6700_CROP); - let gated = gated_warp_opcode(&read_tables(&ifd), s, A6700_CROP, A6700_CROP, false, APSC_FIT_ERROR_PX_AT_1440); + let ops = lens_opcodes(&ifd, "ILCE-6700", None, None, A6700_CROP, A6700_CROP); + let gated = gated_warp_opcode(&read_tables(&ifd), s, DISTORTION_UNIT, A6700_CROP, A6700_CROP, false, APSC_FIT_ERROR_PX_AT_1440); assert_eq!(ops, gated.into_iter().collect::>()); assert_eq!(ops.len(), 1); // other APS-C bodies stay unverified - assert!(lens_opcodes(&ifd, "ILCE-6600", A6700_CROP, A6700_CROP).is_empty()); + assert!(lens_opcodes(&ifd, "ILCE-6600", None, None, A6700_CROP, A6700_CROP).is_empty()); } /// The APS-C fit gate: a table the polynomial fits within 0.44 px is applied on the ILCE-6700, while the @@ -591,17 +621,46 @@ mod tests { let t = read_tables(&ifd); let s = knot_spacing("ILCE-6700", 11, A6700_DECODED_CROP).unwrap(); assert_eq!(warp_opcode(&t, s, A6700_ACTIVE, A6700_DECODED_CROP, false), None); - let ops = lens_opcodes(&ifd, "ILCE-6700", A6700_ACTIVE, A6700_DECODED_CROP); + let ops = lens_opcodes(&ifd, "ILCE-6700", None, None, A6700_ACTIVE, A6700_DECODED_CROP); assert!(matches!(ops.as_slice(), [Opcode::WarpRectilinear { planes, .. }] if planes.len() == 1), "{ops:?}"); } + const SIGMA_10_18: &str = "10-18mm F2.8 DC DN | Contemporary 023"; + + /// The Sigma 10-18 mm exception: its spacing and unit at 10-10.5 mm, the body's rule from 11.7 mm (and without a + /// lens or focal length, on another body or another lens). + #[test] + fn lens_exception_applies_only_to_its_lens_body_and_focal_range() { + let ifd = sony_lens_ifd(&A6700_DISTORTION, &APSC_VIGNETTING, &APSC_CA, [1, 2, 1]); + let t = read_tables(&ifd); + let geometry = (A6700_ACTIVE, A6700_DECODED_CROP); + let exception = gated_warp_opcode(&t, 416.0, 14250.0, geometry.0, geometry.1, false, APSC_FIT_ERROR_PX_AT_1440); + let body = lens_opcodes(&ifd, "ILCE-6700", None, None, geometry.0, geometry.1); + assert!(exception.is_some() && body.len() == 1); + assert_ne!(body.first(), exception.as_ref()); + for focal in [10.0, 10.5] { + let ops = lens_opcodes(&ifd, "ILCE-6700", Some(SIGMA_10_18), Some(focal), geometry.0, geometry.1); + assert_eq!(ops.first(), exception.as_ref(), "{focal} mm"); + } + for (lens, focal) in [(Some(SIGMA_10_18), Some(11.7)), (Some(SIGMA_10_18), None), (None, Some(10.0)), (Some("E 10-20mm F4 PZ G"), Some(10.0))] + { + let ops = lens_opcodes(&ifd, "ILCE-6700", lens, focal, geometry.0, geometry.1); + assert_eq!(ops, body, "{lens:?} {focal:?}"); + } + // hostile focal lengths fall back to the body's rule + for focal in [f64::NAN, f64::INFINITY, -10.0, 0.0] { + assert_eq!(lens_opcodes(&ifd, "ILCE-6700", Some(SIGMA_10_18), Some(focal), geometry.0, geometry.1), body); + } + assert_eq!(lens_exception("ILCE-6600", Some(SIGMA_10_18), Some(10.0)).map(|e| e.unit), None); + } + #[test] fn unknown_model_gets_no_opcodes() { let ifd = sony_lens_ifd(&FF_DISTORTION, &FF_VIGNETTING, &FF_CA, [0, 2, 1]); - assert!(lens_opcodes(&ifd, "ILCE-7M4", FF_ACTIVE, FF_CROP).is_empty()); - assert!(lens_opcodes(&ifd, "", FF_ACTIVE, FF_CROP).is_empty()); + assert!(lens_opcodes(&ifd, "ILCE-7M4", None, None, FF_ACTIVE, FF_CROP).is_empty()); + assert!(lens_opcodes(&ifd, "", None, None, FF_ACTIVE, FF_CROP).is_empty()); // the camera's in-camera flag (0 = off here) doesn't matter: the table is applied - let ops = lens_opcodes(&ifd, " ILCE-7RM6 ", FF_ACTIVE, FF_CROP); + let ops = lens_opcodes(&ifd, " ILCE-7RM6 ", None, None, FF_ACTIVE, FF_CROP); assert_eq!(ops, warp_opcode(&read_tables(&ifd), knots(), FF_ACTIVE, FF_CROP, false).into_iter().collect::>()); assert_eq!(ops.len(), 1); } diff --git a/docs/gaps.md b/docs/gaps.md index 7389795720..bb5be27d0a 100644 --- a/docs/gaps.md +++ b/docs/gaps.md @@ -79,6 +79,7 @@ Beta-blocking gaps (B) total **~230–430 h**; with the stability and platform w | Date | Change | Summary | |---|---|---| +| 2026-10-23 | patch | Gap 8: the Sigma 10–18 mm on the ILCE-6700 gets a measured lens exception at 10–10.5 mm (0.55 px worst over 99 photos, was about 1.4 px) | | 2026-10-23 | minor | Gap 8 narrows: Sony ILCE-6700 (APS-C) in-file distortion through the ILCE-7RM6 conversion, knots spanning its own crop (30 photos, 3 lenses; 0.73 px worst except 1.38 px at 10 mm); the gap stays open (no lens database), hours unchanged | | 2026-10-21 | minor | Gap 28 shrinks: F8 shows / hides the right panel (`view.rightPanel`); rating `[` `]`, flag cycling and F1 help were already bound, so the entry lists only filter-bar keys, Tab / ⇧Tab and F5; 2–4 h (was 4–8) | | 2026-10-20 | minor | #2362: import destination albums use the shared hierarchy/search picker instead of a flat name list; existing import workflows retained; ranked gaps/readiness counts unchanged | diff --git a/docs/raw-parity.md b/docs/raw-parity.md index f93f98e251..59c38a3234 100644 --- a/docs/raw-parity.md +++ b/docs/raw-parity.md @@ -243,7 +243,7 @@ essentials user (the default look is what they keep). | Item | Adobe | LightCraft | |---|---|---| | Profile database | 3,635 profile files, 56 makers, auto-selected | **0** (Adobe LCPs never used; no database of our own) | -| In-file corrections | ✅ | DNG opcodes (WarpRectilinear, FixVignetteRadial, GainMap…) applied; Panasonic / Leica RW2 distortion (79 photos, 13 bodies, 11 lenses); Sony tag 0x7037 distortion for the ILCE-7RM4A (2 lenses), full-frame Bayer 3:2 ILCE-7CR files with correction Auto or forced Auto (3 lenses; see sony-lens-corrections.md for residuals and limits) the ILCE-7RM6 (3 lenses, 54 photos) and the APS-C ILCE-6700 (3 lenses, 30 photos; 1.38 px at a 10 mm wide end, 0.73 px elsewhere; `sony-ilce7rm6-lens-corrections.md`); Nikon NikonNEFInfo distortion (tag `0xc7d5`, about the sensor-shifted optical centre) for the Z 6II and Z f: F-mount lenses on the FTZ within 0.2 px of the camera JPEG, Z lenses within 0.5–1.5 px except the 24-70's wide end (7 px median; `docs/nikon-lens-corrections.md`) | +| In-file corrections | ✅ | DNG opcodes (WarpRectilinear, FixVignetteRadial, GainMap…) applied; Panasonic / Leica RW2 distortion (79 photos, 13 bodies, 11 lenses); Sony tag 0x7037 distortion for the ILCE-7RM4A (2 lenses), full-frame Bayer 3:2 ILCE-7CR files with correction Auto or forced Auto (3 lenses; see sony-lens-corrections.md for residuals and limits) the ILCE-7RM6 (3 lenses, 54 photos) and the APS-C ILCE-6700 (3 lenses, 145 photos; 0.73 px worst, with a measured Sigma 10–18 mm exception at 10–10.5 mm; `sony-ilce7rm6-lens-corrections.md`); Nikon NikonNEFInfo distortion (tag `0xc7d5`, about the sensor-shifted optical centre) for the Z 6II and Z f: F-mount lenses on the FTZ within 0.2 px of the camera JPEG, Z lenses within 0.5–1.5 px except the 24-70's wide end (7 px median; `docs/nikon-lens-corrections.md`) | | Vignetting / lateral CA from maker notes | ✅ | ⬜ | | Manual distortion, vignetting, CA, defringe | ✅ | ✅ | diff --git a/docs/sony-ilce7rm6-lens-corrections.md b/docs/sony-ilce7rm6-lens-corrections.md index 4e46637b1e..5dff832881 100644 --- a/docs/sony-ilce7rm6-lens-corrections.md +++ b/docs/sony-ilce7rm6-lens-corrections.md @@ -146,6 +146,23 @@ full-frame 0.25 px gate. Measured against the camera JPEG, the fitted polynomial 0.22–0.73 px against 0.23–0.68 px on the 27 photos, 1.35–1.38 px at 10 mm), so APS-C bodies use a 0.5 px gate (`APSC_FIT_ERROR_PX_AT_1440`). +**Lens exception: Sigma 10–18 mm F2.8 DC DN at 10–10.5 mm** (`LENS_EXCEPTIONS`, matched on Exif `LensModel` +`10-18mm F2.8 DC DN | Contemporary 023` and `FocalLength` ≤ 10.5 mm). Its wide end keeps 1.36–1.38 px under the +body's rule. On 115 further private photos of this lens (97 at 10 mm, 2 at 10.4–10.5 mm, 16 at 11.7–12.5 mm), a grid +over spacing 372–426 px and unit 14000–16500 was measured on the exact table. The photos at 10 mm were split by +shooting location: 63 to choose, 34 to check. Spacing and unit trade off along a ridge: 420 px / 14000 was best on the +63 (0.445 px worst) but put 2 of the 34 above 0.75 px, so the pick is **416 px / 14250**, within 0.51 px on both halves. +As rendered (`lightcraft-cli render`, Enable Lens Corrections on): + +| Sigma 10–18 mm | p95 at 1440 px | +|---|---| +| 10 mm, 97 photos (one night photo has too little detail to measure) | 0.38–0.55 px, median 0.44 (body's rule: about 1.4 px) | +| 10.4–10.5 mm, 2 photos | 0.36 px | +| 11.7–12.5 mm, 16 photos (body's rule, the exception does not apply) | 0.48–0.72 px, median 0.57 | + +At 11.7 mm and longer an exception of this kind fits worse than the body's rule (412 px / 14500 on the grid: 0.73–1.19 px against 0.48–0.69 px), so it stops at +10.5 mm, the longest measured focal length where it helps; 10.6–11.6 mm is unmeasured and takes the body's rule. + ## Two conventions A second Sony decoder, `crates/raw/src/vendor/arw_lens.rs` @@ -327,8 +344,9 @@ the resampled source by the source, framing and output size, so tone, colour and - **ILCE-7RM6 and ILCE-6700 only.** Other Sony bodies record the same tags; their knot spacing (defined here by the full-frame crop, or an APS-C body's own crop), unit and zoom rule are unverified, so they get no correction from this conversion (the ILCE-7RM4A's distortion has its own: [Two conventions](#two-conventions)). -- **ILCE-6700 at strong barrel distortion:** 1.36–1.38 px at the Sigma 10–18 mm's 10 mm end (above); its vignetting - and lateral CA tables are not measured. +- **ILCE-6700 at strong barrel distortion:** the body's rule leaves 1.36–1.38 px at the Sigma 10–18 mm's 10 mm end; + that lens has a measured exception (above), other wide lenses with similarly strong tables are unmeasured. Its + vignetting and lateral CA tables are not measured. - **APS-C distortion is unverified in camera on the ILCE-7RM6:** no APS-C photo with distortion correction on was available; the APS-C knot spacing is verified on CA only, and the APS-C zoom follows the full-frame rule. - **Aspect-ratio crops** (in-camera 4:3, 16:9, 1:1) were not measured; the correction uses the crop the file records. From d1b272e49654a63f49642846beffecc6ecdde20e Mon Sep 17 00:00:00 2001 From: Julian Zahnow <54999052+Enthendor@users.noreply.github.com> Date: Sat, 24 Oct 2026 15:38:20 +0200 Subject: [PATCH 04/41] docs(raw): name the Sigma choice and check sets (review: CodeRabbit on #2733) Co-Authored-By: Claude Opus 5.5 --- docs/sony-ilce7rm6-lens-corrections.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/sony-ilce7rm6-lens-corrections.md b/docs/sony-ilce7rm6-lens-corrections.md index 5dff832881..ca173b5a8c 100644 --- a/docs/sony-ilce7rm6-lens-corrections.md +++ b/docs/sony-ilce7rm6-lens-corrections.md @@ -150,8 +150,9 @@ full-frame 0.25 px gate. Measured against the camera JPEG, the fitted polynomial `10-18mm F2.8 DC DN | Contemporary 023` and `FocalLength` ≤ 10.5 mm). Its wide end keeps 1.36–1.38 px under the body's rule. On 115 further private photos of this lens (97 at 10 mm, 2 at 10.4–10.5 mm, 16 at 11.7–12.5 mm), a grid over spacing 372–426 px and unit 14000–16500 was measured on the exact table. The photos at 10 mm were split by -shooting location: 63 to choose, 34 to check. Spacing and unit trade off along a ridge: 420 px / 14000 was best on the -63 (0.445 px worst) but put 2 of the 34 above 0.75 px, so the pick is **416 px / 14250**, within 0.51 px on both halves. +shooting location: 63 to choose the values, 34 to check them. A larger spacing with a smaller unit fits about as well +(a ridge in the grid): 420 px / 14000 was best on the 63 choice photos (0.445 px worst) but put 2 of the 34 check photos +above 0.75 px, so the pick is **416 px / 14250**, within 0.51 px on both sets. As rendered (`lightcraft-cli render`, Enable Lens Corrections on): | Sigma 10–18 mm | p95 at 1440 px | From cc59c765ee0d9720f9e544473ddcb50cd46e8b6a Mon Sep 17 00:00:00 2001 From: Andrew Frahn Date: Wed, 21 Oct 2026 16:25:20 +1100 Subject: [PATCH 05/41] #2361: lens corrections crop inside the corrected photo Lens profiles, embedded camera warps, manual Distortion and lateral CA always shrink the crop about its centre until it holds no blank past the source's edge, as Lightroom does; perspective still needs Constrain Crop. The check covers every colour plane when the planes differ, so CA can't leave a coloured edge. Sources: own design (cherry picked from commit 7416984c5d5daa8bbfb64abf1c52749e4838c912) Co-Authored-By: Claude Opus 5.5 --- crates/pipeline/src/geometry.rs | 33 +++++++++++++++++++++------ crates/pipeline/src/tests_geometry.rs | 20 ++++++++++++++++ docs/whats-new.md | 7 ++++++ 3 files changed, 53 insertions(+), 7 deletions(-) diff --git a/crates/pipeline/src/geometry.rs b/crates/pipeline/src/geometry.rs index 3f2766750c..dcfebe3d0e 100644 --- a/crates/pipeline/src/geometry.rs +++ b/crates/pipeline/src/geometry.rs @@ -77,15 +77,32 @@ impl Frame { warp: (!warp.is_identity()).then_some(warp), view: None, }; - if apply_crop && s.geometry.constrain_crop { - f.constrain_to_image(); + if apply_crop { + f.constrain_to_image(s.geometry.constrain_crop); } f } - /// "Constrain Crop": shrink the crop about its centre until it contains no area outside the warped source. - fn constrain_to_image(&mut self) { - let Some(wp) = self.warp.as_ref().filter(|w| w.moves_pixels()) else { return }; + /// Shrink the crop about its centre until it contains no area outside the warped source. Lens + /// corrections (profile, embedded camera warp, manual distortion, lateral CA) always do this, as + /// a corrected lens never shows the blank past the photo's edge (issue #2361); perspective only + /// with "Constrain Crop" (`with_persp`), so a keystone fix can keep its corners. + fn constrain_to_image(&mut self, with_persp: bool) { + let Some(full) = self.warp.as_ref().filter(|w| w.moves_pixels()) else { return }; + let optics; + let wp = if with_persp || full.persp == Homography::IDENTITY { + full + } else { + let mut o = full.clone(); + o.persp = Homography::IDENTITY; + o.persp_inv = Homography::IDENTITY; + optics = o; + &optics + }; + if !wp.moves_pixels() { + return; + } + let planes: &[usize] = if wp.per_channel() { &[0, 1, 2] } else { &[1] }; let a = self.crop.output_to_source(self.ow, self.oh, 1.0, 1.0); let (w, h) = (self.ow, self.oh); let fits = |t: f64| { @@ -93,8 +110,10 @@ impl Frame { let u = i as f64 / 48.0; [(u, 0.0), (u, 1.0), (0.0, u), (1.0, u)].iter().all(|&(x, y)| { let p = Point::new(0.5 + t * (x - 0.5), 0.5 + t * (y - 0.5)); - let s = wp.to_source(a.apply(p), 1); - s.x >= -1e-6 * w && s.y >= -1e-6 * h && s.x <= w * (1.0 + 1e-6) && s.y <= h * (1.0 + 1e-6) + planes.iter().all(|&ch| { + let s = wp.to_source(a.apply(p), ch); + s.x >= -1e-6 * w && s.y >= -1e-6 * h && s.x <= w * (1.0 + 1e-6) && s.y <= h * (1.0 + 1e-6) + }) }) }) }; diff --git a/crates/pipeline/src/tests_geometry.rs b/crates/pipeline/src/tests_geometry.rs index ac244cb0dc..accc5c4776 100644 --- a/crates/pipeline/src/tests_geometry.rs +++ b/crates/pipeline/src/tests_geometry.rs @@ -260,6 +260,26 @@ fn constrain_crop_removes_blank_areas() { assert!(blank_fraction(&c) < 0.002, "constrained: {}", blank_fraction(&c)); } +/// Issue #2361: lens corrections never show the blank past the photo's edge, with or without +/// Constrain Crop, in every colour plane; perspective alone still needs Constrain Crop. +#[test] +fn lens_corrections_leave_no_blank_corners() { + let src = Rgb32f::from_fn(300, 200, |x, y| [0.05 + 0.002 * x as f32, 0.1 + 0.002 * y as f32, 0.3]); + for (distortion, ca) in [(-80.0, 0.0), (80.0, 0.0), (-40.0, 100.0), (0.0, -100.0)] { + let mut s = DevelopSettings::default(); + s.optics.distortion = distortion; + s.optics.ca_red = ca; + s.optics.ca_blue = -ca; + let r = render(&src, &SourceInfo::default(), &s, &RenderRequest::fit(300, 300)).image; + assert!(blank_fraction(&r) < 0.002, "distortion {distortion}, CA {ca}: {}", blank_fraction(&r)); + } + let mut s = DevelopSettings::default(); + s.optics.distortion = -60.0; + s.geometry.vertical = -60.0; + let r = render(&src, &SourceInfo::default(), &s, &RenderRequest::fit(300, 300)).image; + assert!(blank_fraction(&r) > 0.03, "the keystone keeps its corners: {}", blank_fraction(&r)); +} + #[test] fn transforms_preview_matches_export() { let src = lightcraft_scenes::demo_library()[4].render(960, 640); diff --git a/docs/whats-new.md b/docs/whats-new.md index c6c2592003..0d1b3be290 100644 --- a/docs/whats-new.md +++ b/docs/whats-new.md @@ -1,5 +1,12 @@ # What's new in LightCraft +## 2026-10-26 + +### Lens corrections without grey corners +- Lens profiles, the camera's own distortion correction, manual Distortion and Chromatic Aberration now crop just + inside the corrected photo, as in Lightroom, so no grey corners or edge marks show. Perspective corrections still + need Constrain Crop to do the same. + ## 2026-10-24 ### Relative-date filters and smart albums follow the clock From c9e459d670a4af3faf9e1d476a9c56a1ba837dab Mon Sep 17 00:00:00 2001 From: Andrew Frahn Date: Mon, 26 Oct 2026 11:39:08 +1100 Subject: [PATCH 06/41] #2361: keep the crop inside the photo after the automatic lateral CA estimate frame_for adds the estimated lateral CA after Frame::with_lens has constrained the crop, so re-run the constraint then (review feedback). Co-Authored-By: Claude Opus 5.5 --- crates/pipeline/src/geometry.rs | 2 +- crates/pipeline/src/lib.rs | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/pipeline/src/geometry.rs b/crates/pipeline/src/geometry.rs index dcfebe3d0e..fc235c52db 100644 --- a/crates/pipeline/src/geometry.rs +++ b/crates/pipeline/src/geometry.rs @@ -87,7 +87,7 @@ impl Frame { /// corrections (profile, embedded camera warp, manual distortion, lateral CA) always do this, as /// a corrected lens never shows the blank past the photo's edge (issue #2361); perspective only /// with "Constrain Crop" (`with_persp`), so a keystone fix can keep its corners. - fn constrain_to_image(&mut self, with_persp: bool) { + pub(crate) fn constrain_to_image(&mut self, with_persp: bool) { let Some(full) = self.warp.as_ref().filter(|w| w.moves_pixels()) else { return }; let optics; let wp = if with_persp || full.persp == Homography::IDENTITY { diff --git a/crates/pipeline/src/lib.rs b/crates/pipeline/src/lib.rs index 8f2702760d..5da8d86911 100644 --- a/crates/pipeline/src/lib.rs +++ b/crates/pipeline/src/lib.rs @@ -236,6 +236,10 @@ pub fn frame_for(src: &Rgb32f, info: &SourceInfo, s: &DevelopSettings, apply_cro let mut frame = geometry::Frame::with_lens(src.width, src.height, s, apply_crop, info.lens.as_ref()); if s.optics.remove_ca && s.section_enabled("optics") { frame.add_lateral_ca(optics::estimate_lateral_ca(src)); + if apply_crop { + // The estimated CA moves the colour planes too: keep the crop inside every one of them. + frame.constrain_to_image(s.geometry.constrain_crop); + } } frame } From 7e92c28b23c759c3f76fed7e677845ba3fb7551f Mon Sep 17 00:00:00 2001 From: NetterSilver <133535268+Silvertree2010@users.noreply.github.com> Date: Sat, 31 Oct 2026 08:05:02 +0000 Subject: [PATCH 07/41] Reject shutter fractions with a non-positive numerator or denominator Found while testing crates/catalog/src/model.rs:160 (parse_shutter_seconds) Co-Authored-By: Claude Haiku 5.5 Co-Authored-By: Claude Sonnet 5.5 --- crates/catalog/src/model.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/crates/catalog/src/model.rs b/crates/catalog/src/model.rs index eebc9b3e45..ed1c190c59 100644 --- a/crates/catalog/src/model.rs +++ b/crates/catalog/src/model.rs @@ -157,7 +157,10 @@ impl CopyrightStatus { pub fn parse_shutter_seconds(s: &str) -> Option { let s = s.trim().trim_end_matches(['s', '"']).trim(); match s.split_once('/') { - Some((n, d)) => Some(n.trim().parse::().ok()? / d.trim().parse::().ok()?), + Some((n, d)) => { + let (n, d) = (n.trim().parse::().ok()?, d.trim().parse::().ok()?); + if n > 0.0 && d > 0.0 { Some(n / d) } else { None } + } None => s.parse().ok(), } .filter(|v: &f64| v.is_finite() && *v > 0.0) @@ -716,3 +719,16 @@ mod edited_tests { } } } + +#[cfg(test)] +mod shutter_tests { + use super::parse_shutter_seconds; + + #[test] + fn a_fraction_needs_a_positive_numerator_and_denominator() { + for s in ["-1/-250", "1/-250", "-1/250", "0/250"] { + assert_eq!(parse_shutter_seconds(s), None, "{s}"); + } + assert_eq!(parse_shutter_seconds("1/250"), Some(0.004)); + } +} From af4d1f54a72c265e392f983c936a1c3f7b61e7b0 Mon Sep 17 00:00:00 2001 From: NetterSilver <133535268+Silvertree2010@users.noreply.github.com> Date: Sat, 31 Oct 2026 08:45:28 +0000 Subject: [PATCH 08/41] Keep unequal margins when merging full settings with linkMargins on Found while testing crates/slideshow/src/settings.rs:233 and :267 (merged) Co-Authored-By: Claude Haiku 5.5 Co-Authored-By: Claude Sonnet 5.5 --- crates/slideshow/src/settings.rs | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/crates/slideshow/src/settings.rs b/crates/slideshow/src/settings.rs index fd3b327ef1..c17c2bba6c 100644 --- a/crates/slideshow/src/settings.rs +++ b/crates/slideshow/src/settings.rs @@ -218,22 +218,35 @@ impl SlideSettings { /// These settings with the keys `p` names changed (the others kept), validated and clamped. /// A wrong type, an unknown key or a non-finite number is an error, and nothing changes. - /// With `linkMargins` on (already, or set in `p`), a margin given sets all four; `margins` + /// With `linkMargins` on (already, or set in `p`), a margin given sets all four (unless all four are given); `margins` /// sets all four in any case. pub fn merged(&self, p: &Value) -> Result { let Some(obj) = p.as_object() else { return Err("parameters must be an object".into()) }; let mut s = self.clone(); let mut margin: Option = None; + let mut margin_keys = 0; for (k, v) in obj { match k.as_str() { "margins" => { let m = number(k, v)?; (s.margin_left, s.margin_right, s.margin_top, s.margin_bottom) = (m, m, m, m); } - "marginLeft" => s.margin_left = *margin.insert(number(k, v)?), - "marginRight" => s.margin_right = *margin.insert(number(k, v)?), - "marginTop" => s.margin_top = *margin.insert(number(k, v)?), - "marginBottom" => s.margin_bottom = *margin.insert(number(k, v)?), + "marginLeft" => { + s.margin_left = *margin.insert(number(k, v)?); + margin_keys += 1; + } + "marginRight" => { + s.margin_right = *margin.insert(number(k, v)?); + margin_keys += 1; + } + "marginTop" => { + s.margin_top = *margin.insert(number(k, v)?); + margin_keys += 1; + } + "marginBottom" => { + s.margin_bottom = *margin.insert(number(k, v)?); + margin_keys += 1; + } "linkMargins" => s.link_margins = boolean(k, v)?, "showGuides" => s.show_guides = boolean(k, v)?, "aspect" => { @@ -264,7 +277,9 @@ impl SlideSettings { other => return Err(format!("unknown setting `{other}` ({KEYS})")), } } + // all four given: an explicit full state (e.g. `to_json`), kept as is if s.link_margins + && margin_keys < 4 && let Some(m) = margin { (s.margin_left, s.margin_right, s.margin_top, s.margin_bottom) = (m, m, m, m); @@ -319,6 +334,13 @@ pub fn hex(c: [u8; 3]) -> String { mod tests { use super::*; + #[test] + fn merge_restores_unequal_linked_margins() { + let d = SlideSettings::default(); + let st = SlideSettings { link_margins: true, margin_left: 0.1, margin_right: 0.0, margin_top: 0.3, margin_bottom: 0.0, ..d.clone() }; + assert_eq!(d.merged(&st.to_json()).unwrap(), st); + } + #[test] fn merge_validates_links_margins_and_round_trips() { let d = SlideSettings::default(); From 9d4f33a77cb912b606276050c3de2be142f7ce0e Mon Sep 17 00:00:00 2001 From: NetterSilver <133535268+Silvertree2010@users.noreply.github.com> Date: Sat, 31 Oct 2026 09:25:18 +0000 Subject: [PATCH 09/41] Match library search date: token case-insensitively Found while testing crates/catalog/src/query.rs:178 (token_matches, the "date" branch at :215) Co-Authored-By: Claude Haiku 5.5 Co-Authored-By: Claude Sonnet 5.5 --- crates/catalog/src/query.rs | 2 +- crates/catalog/src/tests.rs | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/crates/catalog/src/query.rs b/crates/catalog/src/query.rs index 7b5ad5ecd0..efa62ea6d8 100644 --- a/crates/catalog/src/query.rs +++ b/crates/catalog/src/query.rs @@ -226,7 +226,7 @@ fn token_matches(p: &Photo, tok: &str) -> bool { "person" | "who" => has_person(p, val), "type" | "kind" => format!("{:?}", p.kind).eq_ignore_ascii_case(val), "edited" => (val == "true" || val == "yes") == p.is_edited(), - "date" => p.captured.as_deref().is_some_and(|c| c.starts_with(val)), + "date" => p.captured.as_deref().is_some_and(|c| c.get(..val.len()).is_some_and(|h| h.eq_ignore_ascii_case(val))), "copy" | "virtual" => (val == "true" || val == "yes") == p.copy_of.is_some(), "name" | "file" => p.file_name.to_lowercase().contains(val), // Not a known field: the colon is part of a plain word ("10:30", "Re:"), its value unquoted diff --git a/crates/catalog/src/tests.rs b/crates/catalog/src/tests.rs index 0b31ca9750..6813d0a917 100644 --- a/crates/catalog/src/tests.rs +++ b/crates/catalog/src/tests.rs @@ -12,6 +12,17 @@ fn photo(c: &mut Catalog, name: &str, date: &str) -> PhotoId { id } +#[test] +fn date_token_matches_time_part_case_insensitively() { + let mut c = Catalog::new(); + let a = photo(&mut c, "a.jpg", "2026-05-01T10:00:00"); + let q = |c: &Catalog, text: &str| c.query(&Filter { text: text.into(), ..Default::default() }, &Sort::default()); + assert_eq!(q(&c, "date:2026-05-01T10"), vec![a]); + assert_eq!(q(&c, "date:2026-05-01t10"), vec![a]); + assert_eq!(q(&c, "date:2026-05"), vec![a]); + assert!(q(&c, "date:2026-05-01T11").is_empty()); +} + #[test] fn apply_and_inverse_roundtrip() { let mut c = Catalog::new(); From 4cb62dcfaa2e23b6e82eb0a4f24938a6e417911b Mon Sep 17 00:00:00 2001 From: NetterSilver <133535268+Silvertree2010@users.noreply.github.com> Date: Sat, 31 Oct 2026 13:00:19 +0000 Subject: [PATCH 10/41] Reject overflowing LIGHTCRAFT_GPU_LIMITS values instead of panicking Found while testing crates/gpu/src/ctx.rs:768 (parse_limits) Co-Authored-By: Claude Haiku 5.5 Co-Authored-By: Claude Sonnet 5.5 --- crates/gpu/src/ctx.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/gpu/src/ctx.rs b/crates/gpu/src/ctx.rs index d3e56f7491..1cd7a14c96 100644 --- a/crates/gpu/src/ctx.rs +++ b/crates/gpu/src/ctx.rs @@ -764,8 +764,8 @@ fn parse_limits(v: &str) -> Option<(u64, u64)> { } n => { let mb: u64 = n.trim_end_matches("mib").trim_end_matches("mb").trim().parse().ok()?; - let b = mb.max(1) << 20; - Some((b, 2 * b)) + let b = mb.max(1).checked_mul(1 << 20)?; + Some((b, b.checked_mul(2)?)) } } } @@ -906,6 +906,8 @@ mod tests { assert_eq!(super::parse_limits("512MiB"), Some((512 << 20, 1024 << 20))); assert_eq!(super::parse_limits(""), None); assert_eq!(super::parse_limits("lots"), None); + assert_eq!(super::parse_limits("9223372036854775807"), None); + assert_eq!(super::parse_limits("17592186044416"), None); } /// Issue #2936: the kernels are built on several threads; every entry point of every module has one. From fc99d212f6216d4126846c26753ecb9b65c5bef6 Mon Sep 17 00:00:00 2001 From: Chad Elliott Date: Sun, 11 Oct 2026 12:42:29 -0500 Subject: [PATCH 11/41] test(gpu): #1050 opt-in software adapter for the equivalence tests `Gpu::new` refuses software adapters (llvmpipe / lavapipe, WARP): the CPU pipeline is faster. CI runners have nothing else, so the CPU <-> GPU equivalence tests have always skipped there. `LIGHTCRAFT_GPU_ALLOW_SOFTWARE=1` admits them. The app never sets it and the default is unchanged. On lavapipe all 134 compared renders stay within max 1 LSB, mean <= 0.0003 LSB, the same as Metal on an M4 Pro. The two big-source window tests used a 24 MP (288 MB) source. That is over lavapipe's 128 MiB storage binding (the WebGPU default), so geometry ran on the CPU and nothing was uploaded: one test failed and the other passed without checking anything. They now use 3200 x 3200 (117 MiB): above RETAIN_SOURCE_BYTES, so the source is still shared, and uploaded on every adapter. Co-Authored-By: Claude Opus 5.5 --- crates/gpu/src/ctx.rs | 33 ++++++++++++++++++++++++++++-- crates/gpu/tests/it/equivalence.rs | 30 +++++++++++++++++---------- docs/gpu-pipeline.md | 13 ++++++++++++ 3 files changed, 63 insertions(+), 13 deletions(-) diff --git a/crates/gpu/src/ctx.rs b/crates/gpu/src/ctx.rs index d3e56f7491..73d7dc3663 100644 --- a/crates/gpu/src/ctx.rs +++ b/crates/gpu/src/ctx.rs @@ -386,7 +386,8 @@ fn module_source(m: &Module, consts: &str) -> String { } impl Gpu { - /// Create a device on the best available adapter (no software fallback), or why there is none. + /// Create a device on the best available adapter (no software adapter unless + /// `LIGHTCRAFT_GPU_ALLOW_SOFTWARE`), or why there is none. pub fn new(backends: wgpu::Backends) -> Result { let mut desc = wgpu::InstanceDescriptor::new_without_display_handle(); // only these drivers are loaded (`crate::backend`: never Vulkan on Windows unless asked) @@ -401,10 +402,13 @@ impl Gpu { ) .map_err(|e| format!("no GPU adapter among {backends:?} ({e})"))?; let info = adapter.get_info(); - if info.device_type == wgpu::DeviceType::Cpu { + if refuse_adapter(info.device_type, software_allowed()) { log::info!("gpu: only a software adapter ({}), using the CPU pipeline", info.name); return Err(format!("software adapter ({}) skipped: the CPU pipeline is faster", info.name)); } + if info.device_type == wgpu::DeviceType::Cpu { + log::info!("gpu: LIGHTCRAFT_GPU_ALLOW_SOFTWARE: using the software adapter {}", info.name); + } let mut limits = adapter.limits(); if limits.max_storage_buffers_per_shader_stage < 10 { log::info!("gpu: {} has too few storage buffers per stage", info.name); @@ -747,6 +751,20 @@ impl Gpu { /// normally reset a hung GPU much sooner). const READBACK_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(60); +/// Whether to turn down an adapter of `device_type`: a software rasterizer (llvmpipe / lavapipe, +/// WARP) is slower than the CPU pipeline, so it is refused unless `allow_software`. +fn refuse_adapter(device_type: wgpu::DeviceType, allow_software: bool) -> bool { + device_type == wgpu::DeviceType::Cpu && !allow_software +} + +/// `LIGHTCRAFT_GPU_ALLOW_SOFTWARE=1`: accept a software adapter. For tests on machines without a +/// GPU (CI runners: Mesa lavapipe on Linux, WARP on Windows), so the CPU ↔ GPU equivalence tests +/// run there instead of skipping; the app never sets it (software rendering is slower than the CPU +/// pipeline). +fn software_allowed() -> bool { + std::env::var("LIGHTCRAFT_GPU_ALLOW_SOFTWARE").is_ok_and(|v| matches!(v.trim().to_ascii_lowercase().as_str(), "1" | "true" | "yes" | "on")) +} + /// `LIGHTCRAFT_GPU_LIMITS`: lower the device limits, e.g. to reproduce a smaller adapter. /// `webgpu` / `downlevel` = 128 MiB storage bindings and 256 MiB buffers (the WebGPU defaults), /// `` = n MiB storage bindings and 2n MiB buffers. Returns (binding bytes, buffer bytes). @@ -1151,6 +1169,17 @@ mod tests { println!("CHILD: survived"); } + #[test] + fn software_adapters_need_the_opt_in() { + use wgpu::DeviceType::{Cpu, DiscreteGpu, IntegratedGpu, Other, VirtualGpu}; + assert!(super::refuse_adapter(Cpu, false), "llvmpipe / WARP are refused by default"); + assert!(!super::refuse_adapter(Cpu, true), "LIGHTCRAFT_GPU_ALLOW_SOFTWARE accepts them"); + for t in [DiscreteGpu, IntegratedGpu, VirtualGpu, Other] { + assert!(!super::refuse_adapter(t, false), "{t:?}"); + assert!(!super::refuse_adapter(t, true), "{t:?}"); + } + } + #[test] fn dispatches_stay_within_the_workgroup_limit() { // 1-D kernels over a 100 MP image and 2-D ones over 16k × 16k stay under 65535 per axis diff --git a/crates/gpu/tests/it/equivalence.rs b/crates/gpu/tests/it/equivalence.rs index 7432ebb7c8..b043152fc1 100644 --- a/crates/gpu/tests/it/equivalence.rs +++ b/crates/gpu/tests/it/equivalence.rs @@ -2,7 +2,8 @@ //! `lightcraft_gpu::render`, compared in 8-bit sRGB. //! //! Bounds (documented in `docs/gpu-pipeline.md`): mean |Δ| < 0.5 LSB and max |Δ| ≤ 3 LSB per -//! channel for every case. Skips (passes with a note) when no GPU adapter exists, e.g. on CI. +//! channel for every case. Skips (passes with a note) when no GPU adapter exists; CI runs them on +//! software adapters with `LIGHTCRAFT_GPU_ALLOW_SOFTWARE=1` (lavapipe, WARP) and on Metal. use std::sync::Arc; @@ -889,13 +890,20 @@ fn windows_match() { check("window: vignette corner", &src, &info, &s, &corner); } -/// Issue #323: a window of a 24 MP photo is cut from a source of 288 MB on the device. Keeping that -/// upload with the view's stages counted it against the stage budget on every tick of a drag and -/// got the stages cleared, and the upload and resampling redone: the window's stages are its own -/// pixels, not the photo's. +/// Issue #323: a window of a big photo is cut from the whole source on the device (288 MB for 24 MP). +/// Keeping that upload with the view's stages counted it against the stage budget on every tick of +/// a drag and got the stages cleared, and the upload and resampling redone: the window's stages are +/// its own pixels, not the photo's. // (these two share the process's one big source: a test lock keeps them from replacing each other's) static BIG_SOURCE_TESTS: std::sync::Mutex<()> = std::sync::Mutex::new(()); +/// The big photo of these tests: 10.24 MP, a 117 MiB source. That is over what a view keeps with its +/// stages (96 MiB, so it is shared) and within a 128 MiB storage binding (the WebGPU default, and +/// the limit of Mesa's lavapipe in CI), so the source goes to the device on every adapter. A source +/// over the device's limit is resampled on the CPU instead and never uploaded, which would leave +/// these tests nothing to check. +const BIG: usize = 3200; + #[test] fn a_window_does_not_keep_the_whole_source_on_the_device() { let _lock = BIG_SOURCE_TESTS.lock().unwrap_or_else(|e| e.into_inner()); @@ -903,11 +911,11 @@ fn a_window_does_not_keep_the_whole_source_on_the_device() { return; } use lightcraft_pipeline::PixelWindow; - let src = scene(1, 6000, 4000); + let src = scene(1, BIG, BIG); let info = SourceInfo { raw: true, ..Default::default() }; let stages = StageCache::default(); let s = DevelopSettings::default(); - let req = RenderRequest { window: Some(PixelWindow { x: 2000, y: 1500, w: 640, h: 480 }), ..RenderRequest::fit(6000, 4000) }; + let req = RenderRequest { window: Some(PixelWindow { x: 2000, y: 1500, w: 640, h: 480 }), ..RenderRequest::fit(BIG, BIG) }; let _ = lightcraft_gpu::render(&src, &info, &s, &req, Some(&stages)).expect("gpu render"); let held = lightcraft_gpu::stage_bytes(&stages); assert!(held < 100 << 20, "the view's GPU stages hold {} MiB for a 640×480 window", held >> 20); @@ -919,7 +927,7 @@ fn a_window_does_not_keep_the_whole_source_on_the_device() { assert!(lightcraft_gpu::stage_bytes(&stages) < 100 << 20); } -/// …but the 288 MB is uploaded once for every window of every view of the photo, not once per +/// …but the source is uploaded once for every window of every view of the photo, not once per /// window: panning at 1:1, and the Before and After windows, share one device copy of it, which /// goes when the app idles (`trim_pool(0)`). #[test] @@ -929,17 +937,17 @@ fn windows_of_a_big_photo_share_one_uploaded_source() { return; } use lightcraft_pipeline::PixelWindow; - let src = scene(1, 6000, 4000); + let src = scene(1, BIG, BIG); let info = SourceInfo { raw: true, ..Default::default() }; let s = DevelopSettings::default(); let (after, before) = (StageCache::default(), StageCache::default()); - let at = |x: usize| RenderRequest { window: Some(PixelWindow { x, y: 1500, w: 640, h: 480 }), ..RenderRequest::fit(6000, 4000) }; + let at = |x: usize| RenderRequest { window: Some(PixelWindow { x, y: 1500, w: 640, h: 480 }), ..RenderRequest::fit(BIG, BIG) }; let start = lightcraft_gpu::source_uploads(); for (cache, x) in [(&after, 1000), (&after, 1256), (&after, 1512), (&before, 1512), (&before, 1768)] { lightcraft_gpu::render(&src, &info, &s, &at(x), Some(cache)).expect("gpu render"); } assert_eq!(lightcraft_gpu::source_uploads() - start, 1, "one upload for five windows of two views"); - assert!(lightcraft_gpu::shared_source_bytes() >= 280_000_000, "{}", lightcraft_gpu::shared_source_bytes()); + assert!(lightcraft_gpu::shared_source_bytes() >= BIG * BIG * 12, "{}", lightcraft_gpu::shared_source_bytes()); assert!(lightcraft_gpu::stage_bytes(&after) < 100 << 20, "and it is not in the views' stages"); lightcraft_gpu::trim_pool(0); assert_eq!(lightcraft_gpu::shared_source_bytes(), 0, "an idle app gives it back"); diff --git a/docs/gpu-pipeline.md b/docs/gpu-pipeline.md index 8dceb96ca9..de246f4325 100644 --- a/docs/gpu-pipeline.md +++ b/docs/gpu-pipeline.md @@ -49,6 +49,9 @@ Overrides (read once at launch): - `LIGHTCRAFT_GPU=0`: GPU rendering off for the process (the window is unaffected). - Both `LIGHTCRAFT_GPU=0` and `LIGHTCRAFT_GPU_BACKEND=off` also keep AI Denoise, the face models and the AI mask model (SAM 3 on Metal) on the CPU. +- `LIGHTCRAFT_GPU_ALLOW_SOFTWARE=1`: accept a software adapter (llvmpipe / lavapipe, WARP), which is + otherwise refused because the CPU pipeline is faster. For tests on machines without a GPU (CI); + the app never sets it. **DX12 shader compiler (issue #471).** Every instance (window and compute) compiles DX12 shaders with FXC (`d3dcompiler_47.dll`, part of Windows; `lightcraft_gpu::backend::backend_options`). wgpu's @@ -272,6 +275,16 @@ bit-identical, and one (the point colour range overlay) has max 2 LSB on 0.0002% mean 0.0003 LSB. That is the same picture as on Metal, inside the bounds (`cargo test -p lightcraft-gpu --release --test it equivalence:: -- --nocapture`). +**In CI** (`.github/workflows/ci.yml`, issue #1050) they run on every platform: on Metal on the macOS +runners, and on software adapters on Linux (Mesa lavapipe) and Windows (WARP, DX12 with FXC), which +`LIGHTCRAFT_GPU_ALLOW_SOFTWARE=1` admits (tests only: the app never sets it). The step fails if they +skip. Measured on lavapipe (CI and locally) and WARP: all 134 compared renders within **max 1 LSB, +mean ≤ 0.0003 LSB**, as on the M4 Pro; on the macOS runner's (paravirtual) Metal device one case reaches +2 LSB (point colour range overlay, 0.0002% of pixels over 1), the rest max 1. The suite takes about +50 s on lavapipe, 30 s on the macOS runner and 2–7.5 min on WARP. lavapipe's +storage bindings stop at 128 MiB (the WebGPU default), so the two big-source tests use a 117 MiB +source: above what a view keeps with its stages (96 MiB) and small enough to be uploaded there. + Remaining differences come from f32 vs f64 coordinate math, fast-math transcendental functions on Metal and summation order in the box filters — all far below one 8-bit step. From 21a7d64d467d0dfd39e0344b02f07458201f3508 Mon Sep 17 00:00:00 2001 From: Chad Elliott Date: Fri, 30 Oct 2026 01:01:58 -0500 Subject: [PATCH 12/41] docs(gpu): #1050 run the GPU tests locally on a software adapter docs/gpu-pipeline.md says how to run lightcraft-gpu's tests on a machine without a GPU: LIGHTCRAFT_GPU_ALLOW_SOFTWARE=1 admits Mesa's lavapipe on Linux and WARP on Windows (Metal on macOS needs nothing), and LIGHTCRAFT_SKIP_LOG shows whether anything still skipped for want of an adapter. The comments on the variable and in equivalence.rs no longer say CI runs them: the platform CI legs of #1148 are not landing. Co-Authored-By: Claude Opus 5.5 --- crates/gpu/src/ctx.rs | 5 ++-- crates/gpu/tests/it/equivalence.rs | 6 ++--- docs/gpu-pipeline.md | 37 +++++++++++++++++++++--------- 3 files changed, 31 insertions(+), 17 deletions(-) diff --git a/crates/gpu/src/ctx.rs b/crates/gpu/src/ctx.rs index 73d7dc3663..9897faf5fc 100644 --- a/crates/gpu/src/ctx.rs +++ b/crates/gpu/src/ctx.rs @@ -758,9 +758,8 @@ fn refuse_adapter(device_type: wgpu::DeviceType, allow_software: bool) -> bool { } /// `LIGHTCRAFT_GPU_ALLOW_SOFTWARE=1`: accept a software adapter. For tests on machines without a -/// GPU (CI runners: Mesa lavapipe on Linux, WARP on Windows), so the CPU ↔ GPU equivalence tests -/// run there instead of skipping; the app never sets it (software rendering is slower than the CPU -/// pipeline). +/// GPU (Mesa lavapipe on Linux, WARP on Windows), so the CPU ↔ GPU equivalence tests run there +/// instead of skipping; the app never sets it (software rendering is slower than the CPU pipeline). fn software_allowed() -> bool { std::env::var("LIGHTCRAFT_GPU_ALLOW_SOFTWARE").is_ok_and(|v| matches!(v.trim().to_ascii_lowercase().as_str(), "1" | "true" | "yes" | "on")) } diff --git a/crates/gpu/tests/it/equivalence.rs b/crates/gpu/tests/it/equivalence.rs index b043152fc1..6a1a8464c4 100644 --- a/crates/gpu/tests/it/equivalence.rs +++ b/crates/gpu/tests/it/equivalence.rs @@ -2,8 +2,8 @@ //! `lightcraft_gpu::render`, compared in 8-bit sRGB. //! //! Bounds (documented in `docs/gpu-pipeline.md`): mean |Δ| < 0.5 LSB and max |Δ| ≤ 3 LSB per -//! channel for every case. Skips (passes with a note) when no GPU adapter exists; CI runs them on -//! software adapters with `LIGHTCRAFT_GPU_ALLOW_SOFTWARE=1` (lavapipe, WARP) and on Metal. +//! channel for every case. Skips (passes with a note) when no GPU adapter exists; +//! `LIGHTCRAFT_GPU_ALLOW_SOFTWARE=1` runs them on a software adapter (lavapipe, WARP) instead. use std::sync::Arc; @@ -899,7 +899,7 @@ static BIG_SOURCE_TESTS: std::sync::Mutex<()> = std::sync::Mutex::new(()); /// The big photo of these tests: 10.24 MP, a 117 MiB source. That is over what a view keeps with its /// stages (96 MiB, so it is shared) and within a 128 MiB storage binding (the WebGPU default, and -/// the limit of Mesa's lavapipe in CI), so the source goes to the device on every adapter. A source +/// the limit of Mesa's lavapipe), so the source goes to the device on every adapter. A source /// over the device's limit is resampled on the CPU instead and never uploaded, which would leave /// these tests nothing to check. const BIG: usize = 3200; diff --git a/docs/gpu-pipeline.md b/docs/gpu-pipeline.md index de246f4325..736c208714 100644 --- a/docs/gpu-pipeline.md +++ b/docs/gpu-pipeline.md @@ -50,8 +50,8 @@ Overrides (read once at launch): - Both `LIGHTCRAFT_GPU=0` and `LIGHTCRAFT_GPU_BACKEND=off` also keep AI Denoise, the face models and the AI mask model (SAM 3 on Metal) on the CPU. - `LIGHTCRAFT_GPU_ALLOW_SOFTWARE=1`: accept a software adapter (llvmpipe / lavapipe, WARP), which is - otherwise refused because the CPU pipeline is faster. For tests on machines without a GPU (CI); - the app never sets it. + otherwise refused because the CPU pipeline is faster. For running the GPU tests on a machine + without a GPU (below); the app never sets it. **DX12 shader compiler (issue #471).** Every instance (window and compute) compiles DX12 shaders with FXC (`d3dcompiler_47.dll`, part of Windows; `lightcraft_gpu::backend::backend_options`). wgpu's @@ -275,15 +275,30 @@ bit-identical, and one (the point colour range overlay) has max 2 LSB on 0.0002% mean 0.0003 LSB. That is the same picture as on Metal, inside the bounds (`cargo test -p lightcraft-gpu --release --test it equivalence:: -- --nocapture`). -**In CI** (`.github/workflows/ci.yml`, issue #1050) they run on every platform: on Metal on the macOS -runners, and on software adapters on Linux (Mesa lavapipe) and Windows (WARP, DX12 with FXC), which -`LIGHTCRAFT_GPU_ALLOW_SOFTWARE=1` admits (tests only: the app never sets it). The step fails if they -skip. Measured on lavapipe (CI and locally) and WARP: all 134 compared renders within **max 1 LSB, -mean ≤ 0.0003 LSB**, as on the M4 Pro; on the macOS runner's (paravirtual) Metal device one case reaches -2 LSB (point colour range overlay, 0.0002% of pixels over 1), the rest max 1. The suite takes about -50 s on lavapipe, 30 s on the macOS runner and 2–7.5 min on WARP. lavapipe's -storage bindings stop at 128 MiB (the WebGPU default), so the two big-source tests use a 117 MiB -source: above what a view keeps with its stages (96 MiB) and small enough to be uploaded there. +**Running them without a GPU (issue #1050).** `Gpu::new` turns down software adapters, so on a +machine without a hardware GPU (a VM, a container) every GPU test skips. +`LIGHTCRAFT_GPU_ALLOW_SOFTWARE=1` lets them through for one run (tests only: the app never sets it): + +```sh +rm -f /tmp/gpu-skips.jsonl # the log is appended to; an absolute path, as tests run in crates/gpu +LIGHTCRAFT_GPU_ALLOW_SOFTWARE=1 LIGHTCRAFT_SKIP_LOG=/tmp/gpu-skips.jsonl cargo test -p lightcraft-gpu --tests +grep '"reason":"no GPU adapter' /tmp/gpu-skips.jsonl # no output: nothing skipped for want of an adapter +``` + +- **Linux:** Mesa's lavapipe (Vulkan; `mesa-vulkan-drivers` on Debian and Ubuntu). Its storage + bindings stop at 128 MiB (the WebGPU default), so the two big-source tests use a 117 MiB source: + above what a view keeps with its stages (96 MiB) and small enough to be uploaded there. +- **Windows:** WARP, the DX12 software rasterizer that ships with Windows (shaders through FXC, as + above). +- **macOS:** Metal is a hardware adapter, so the tests run without the variable. + +A machine with a hardware GPU picks it over the software adapter, variable or not. Each test that +skips prints `skipped (gpu): …` and appends a line to the `LIGHTCRAFT_SKIP_LOG` file; with a software +adapter the only one left should be the device-loss test (`no GPU device, or one that can't be lost on +purpose here`). Measured 2026-10-11 on lavapipe and WARP, and again 2026-10-30 on lavapipe (Mesa's +llvmpipe on LLVM 20, 143 compared renders), every compared render stayed within **max 1 LSB, mean ≤ +0.0003 LSB**, as on the M4 Pro. The equivalence binary takes about 20 s on lavapipe and several +minutes on WARP. Remaining differences come from f32 vs f64 coordinate math, fast-math transcendental functions on Metal and summation order in the box filters — all far below one 8-bit step. From 15bacc76602ef7e8ffbe3a6f7227e942ebfe43c6 Mon Sep 17 00:00:00 2001 From: Chad Elliott Date: Fri, 30 Oct 2026 12:45:13 -0500 Subject: [PATCH 13/41] docs(gpu): #1050 the skip-log check catches every GPU skip and logs to a private directory The check grepped for "no GPU adapter" only, so the ctx unit tests' "no GPU device" skips (and nn's "no GPU runner here") went unseen. It now lists every "need":"gpu" line except the expected device-loss one. On the 2026-10-30 lavapipe logs it shows all 24 GPU skips without the opt-in (the old grep showed 21) and nothing with it. The log goes in a new mktemp -d directory instead of a fixed /tmp name another local user could plant a symlink at. Co-Authored-By: Claude Opus 5.5 --- docs/gpu-pipeline.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/gpu-pipeline.md b/docs/gpu-pipeline.md index 736c208714..cd7fd03e33 100644 --- a/docs/gpu-pipeline.md +++ b/docs/gpu-pipeline.md @@ -280,9 +280,9 @@ machine without a hardware GPU (a VM, a container) every GPU test skips. `LIGHTCRAFT_GPU_ALLOW_SOFTWARE=1` lets them through for one run (tests only: the app never sets it): ```sh -rm -f /tmp/gpu-skips.jsonl # the log is appended to; an absolute path, as tests run in crates/gpu -LIGHTCRAFT_GPU_ALLOW_SOFTWARE=1 LIGHTCRAFT_SKIP_LOG=/tmp/gpu-skips.jsonl cargo test -p lightcraft-gpu --tests -grep '"reason":"no GPU adapter' /tmp/gpu-skips.jsonl # no output: nothing skipped for want of an adapter +log="$(mktemp -d)/gpu-skips.jsonl" # a new private directory; an absolute path, as tests run in crates/gpu +LIGHTCRAFT_GPU_ALLOW_SOFTWARE=1 LIGHTCRAFT_SKIP_LOG="$log" cargo test -p lightcraft-gpu --tests +grep '"need":"gpu"' "$log" | grep -v 'lost on purpose' # no output: no GPU test skipped but the device-loss one ``` - **Linux:** Mesa's lavapipe (Vulkan; `mesa-vulkan-drivers` on Debian and Ubuntu). Its storage From 50879d4d2682aa856c29ce5f770163867d19bea9 Mon Sep 17 00:00:00 2001 From: NetterSilver <133535268+Silvertree2010@users.noreply.github.com> Date: Sun, 1 Nov 2026 03:50:13 +0000 Subject: [PATCH 14/41] Fix Histogram::percentile returning black when the target truncates to 0 Found while testing crates/raster/src/histogram.rs:171 (Histogram::percentile) Co-Authored-By: Claude Haiku 5.5 Co-Authored-By: Claude Sonnet 5.5 --- crates/raster/src/histogram.rs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/crates/raster/src/histogram.rs b/crates/raster/src/histogram.rs index 75667bd1c7..b7a2b0d78e 100644 --- a/crates/raster/src/histogram.rs +++ b/crates/raster/src/histogram.rs @@ -168,7 +168,10 @@ impl Histogram { /// Luma value (0..1) below which `q` of the pixels fall. pub fn percentile(&self, q: f32) -> f32 { - let target = (q.clamp(0.0, 1.0) * self.total as f32) as u32; + if self.total == 0 { + return 0.0; + } + let target = ((q.clamp(0.0, 1.0) * self.total as f32) as u32).max(1); let mut acc = 0; for (i, &c) in self.luma.iter().enumerate() { acc += c; @@ -199,6 +202,23 @@ mod tests { assert_eq!(h.above_sdr(), 0.0); } + #[test] + fn percentile_zero_skips_empty_bins() { + let img = Rgba8::from_fn(4, 4, |_, _| [200, 200, 200, 255]); + let h = Histogram::of_srgb8(&img); + // every pixel is in one bin, so every percentile is that bin's luma, never black + assert!(h.percentile(1.0) > 0.0); + assert_eq!(h.percentile(0.0), h.percentile(1.0)); + assert_eq!(h.percentile(0.01), h.percentile(1.0)); + } + + #[test] + fn percentile_of_empty_histogram_is_zero() { + let h = Histogram::of_hdr(&[], 4.0); + assert_eq!(h.percentile(0.0), 0.0); + assert_eq!(h.percentile(0.5), 0.0); + } + #[test] fn hdr_bins_split_sdr_and_stops() { let px = [[0.0, 0.0, 0.0], [1.0, 1.0, 1.0], [4.0, 4.0, 4.0], [16.0, 16.0, 16.0], [f32::NAN, -1.0, f32::INFINITY]]; From fe3b1813b11c8be0d928407267de89eec4d2e671 Mon Sep 17 00:00:00 2001 From: Chad Elliott Date: Sat, 31 Oct 2026 23:25:02 -0500 Subject: [PATCH 15/41] docs(gpu): #1050 the skip check also expects the device-memory test, which a software adapter can't run out of #3419 added a test that holds device memory until an allocation fails; on lavapipe the allocations never fail, so it skips with the opt-in too. Co-Authored-By: Claude Opus 5.5 --- docs/gpu-pipeline.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/gpu-pipeline.md b/docs/gpu-pipeline.md index cd7fd03e33..a35218c46d 100644 --- a/docs/gpu-pipeline.md +++ b/docs/gpu-pipeline.md @@ -282,7 +282,7 @@ machine without a hardware GPU (a VM, a container) every GPU test skips. ```sh log="$(mktemp -d)/gpu-skips.jsonl" # a new private directory; an absolute path, as tests run in crates/gpu LIGHTCRAFT_GPU_ALLOW_SOFTWARE=1 LIGHTCRAFT_SKIP_LOG="$log" cargo test -p lightcraft-gpu --tests -grep '"need":"gpu"' "$log" | grep -v 'lost on purpose' # no output: no GPU test skipped but the device-loss one +grep '"need":"gpu"' "$log" | grep -v -e 'lost on purpose' -e 'memory never ran out' # no output: only the two below skipped ``` - **Linux:** Mesa's lavapipe (Vulkan; `mesa-vulkan-drivers` on Debian and Ubuntu). Its storage @@ -294,8 +294,9 @@ grep '"need":"gpu"' "$log" | grep -v 'lost on purpose' # no output: no GPU tes A machine with a hardware GPU picks it over the software adapter, variable or not. Each test that skips prints `skipped (gpu): …` and appends a line to the `LIGHTCRAFT_SKIP_LOG` file; with a software -adapter the only one left should be the device-loss test (`no GPU device, or one that can't be lost on -purpose here`). Measured 2026-10-11 on lavapipe and WARP, and again 2026-10-30 on lavapipe (Mesa's +adapter the only ones left should be the device-loss test (`no GPU device, or one that can't be lost on +purpose here`) and the device-memory test (`no GPU device, or its memory never ran out`: on lavapipe its +allocations never fail, seen 2026-10-31). Measured 2026-10-11 on lavapipe and WARP, and again 2026-10-30 on lavapipe (Mesa's llvmpipe on LLVM 20, 143 compared renders), every compared render stayed within **max 1 LSB, mean ≤ 0.0003 LSB**, as on the M4 Pro. The equivalence binary takes about 20 s on lavapipe and several minutes on WARP. From a20887e09736438b290e66f118b5b33213dc6204 Mon Sep 17 00:00:00 2001 From: Julian Zahnow <54999052+Enthendor@users.noreply.github.com> Date: Sun, 1 Nov 2026 11:54:10 +0100 Subject: [PATCH 16/41] LR-EDIT-OPTICS-PROFILE: record the LensModel strings seen for the Sigma 10-18 mm exception Co-Authored-By: Claude Opus 5.5 --- crates/raw/src/vendor/arw_lens_rm6.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/raw/src/vendor/arw_lens_rm6.rs b/crates/raw/src/vendor/arw_lens_rm6.rs index 579dcf67ab..5a215ef7a2 100644 --- a/crates/raw/src/vendor/arw_lens_rm6.rs +++ b/crates/raw/src/vendor/arw_lens_rm6.rs @@ -78,7 +78,8 @@ struct LensException { /// The measured lens exceptions (docs/sony-ilce7rm6-lens-corrections.md → ILCE-6700). const LENS_EXCEPTIONS: &[LensException] = &[ // Sigma 10-18 mm F2.8 DC DN at its wide end: 97 photos at 10 mm and 2 at 10.4-10.5 mm. The body's rule leaves - // 1.36-1.38 px there; from 11.7 mm on the body's rule fits better + // 1.36-1.38 px there; from 11.7 mm on the body's rule fits better. `lens` is the only LensModel in 336 files of + // this lens (native E-mount, no adapter); the 116 measured copies carry body firmware "ILCE-6700 v2.00" LensException { body: "ILCE-6700", lens: "10-18mm F2.8 DC DN | Contemporary 023", max_focal_mm: 10.5, knot_spacing: 416.0, unit: 14250.0 }, ]; From 5a09d075306291a1522d5e8bb0710774f3733594 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Sun, 1 Nov 2026 13:57:58 -0500 Subject: [PATCH 17/41] Release 0.17.0 Co-Authored-By: Claude Opus 5.5 --- Cargo.lock | 66 +++++++++++++++++++++++++++--------------------------- Cargo.toml | 2 +- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8063ed5a40..cf7b45714f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3536,7 +3536,7 @@ dependencies = [ [[package]] name = "lightcraft" -version = "0.16.0" +version = "0.17.0" dependencies = [ "chrono", "craft-update", @@ -3563,7 +3563,7 @@ dependencies = [ [[package]] name = "lightcraft-catalog" -version = "0.16.0" +version = "0.17.0" dependencies = [ "chrono", "crc32fast", @@ -3584,7 +3584,7 @@ dependencies = [ [[package]] name = "lightcraft-cli" -version = "0.16.0" +version = "0.17.0" dependencies = [ "dhat", "lightcraft-codecs", @@ -3601,7 +3601,7 @@ dependencies = [ [[package]] name = "lightcraft-codecs" -version = "0.16.0" +version = "0.17.0" dependencies = [ "avif-serialize", "bytemuck", @@ -3632,7 +3632,7 @@ dependencies = [ [[package]] name = "lightcraft-color" -version = "0.16.0" +version = "0.17.0" dependencies = [ "lightcraft-geom", "proptest", @@ -3641,7 +3641,7 @@ dependencies = [ [[package]] name = "lightcraft-denoise" -version = "0.16.0" +version = "0.17.0" dependencies = [ "faer-core", "lightcraft-denoise-core", @@ -3658,7 +3658,7 @@ dependencies = [ [[package]] name = "lightcraft-denoise-core" -version = "0.16.0" +version = "0.17.0" dependencies = [ "dhat", "lightcraft-raster", @@ -3674,7 +3674,7 @@ dependencies = [ [[package]] name = "lightcraft-develop" -version = "0.16.0" +version = "0.17.0" dependencies = [ "lightcraft-color", "lightcraft-geom", @@ -3686,7 +3686,7 @@ dependencies = [ [[package]] name = "lightcraft-engine" -version = "0.16.0" +version = "0.17.0" dependencies = [ "ab_glyph", "chrono", @@ -3730,7 +3730,7 @@ dependencies = [ [[package]] name = "lightcraft-faces" -version = "0.16.0" +version = "0.17.0" dependencies = [ "lightcraft-testkit", "matrixmultiply", @@ -3745,7 +3745,7 @@ dependencies = [ [[package]] name = "lightcraft-fetch" -version = "0.16.0" +version = "0.17.0" dependencies = [ "log", "rustls", @@ -3756,7 +3756,7 @@ dependencies = [ [[package]] name = "lightcraft-geocode" -version = "0.16.0" +version = "0.17.0" dependencies = [ "miniz_oxide 0.9.1", "serde", @@ -3764,7 +3764,7 @@ dependencies = [ [[package]] name = "lightcraft-geom" -version = "0.16.0" +version = "0.17.0" dependencies = [ "proptest", "serde", @@ -3772,7 +3772,7 @@ dependencies = [ [[package]] name = "lightcraft-gpu" -version = "0.16.0" +version = "0.17.0" dependencies = [ "bytemuck", "lightcraft-color", @@ -3792,7 +3792,7 @@ dependencies = [ [[package]] name = "lightcraft-heif" -version = "0.16.0" +version = "0.17.0" dependencies = [ "heic-rs", "rayon", @@ -3800,14 +3800,14 @@ dependencies = [ [[package]] name = "lightcraft-inpaint" -version = "0.16.0" +version = "0.17.0" dependencies = [ "rayon", ] [[package]] name = "lightcraft-lensdb" -version = "0.16.0" +version = "0.17.0" dependencies = [ "lightcraft-develop", "lightcraft-geom", @@ -3816,7 +3816,7 @@ dependencies = [ [[package]] name = "lightcraft-mcp" -version = "0.16.0" +version = "0.17.0" dependencies = [ "lightcraft-codecs", "lightcraft-engine", @@ -3827,7 +3827,7 @@ dependencies = [ [[package]] name = "lightcraft-merge" -version = "0.16.0" +version = "0.17.0" dependencies = [ "lightcraft-codecs", "lightcraft-color", @@ -3843,7 +3843,7 @@ dependencies = [ [[package]] name = "lightcraft-meta" -version = "0.16.0" +version = "0.17.0" dependencies = [ "chrono", "lightcraft-geom", @@ -3857,7 +3857,7 @@ dependencies = [ [[package]] name = "lightcraft-pipeline" -version = "0.16.0" +version = "0.17.0" dependencies = [ "dhat", "image", @@ -3876,7 +3876,7 @@ dependencies = [ [[package]] name = "lightcraft-preview" -version = "0.16.0" +version = "0.17.0" dependencies = [ "jpeg-encoder", "lightcraft-raster", @@ -3888,7 +3888,7 @@ dependencies = [ [[package]] name = "lightcraft-raster" -version = "0.16.0" +version = "0.17.0" dependencies = [ "libc", "lightcraft-color", @@ -3900,7 +3900,7 @@ dependencies = [ [[package]] name = "lightcraft-raw" -version = "0.16.0" +version = "0.17.0" dependencies = [ "dhat", "jpeg-encoder", @@ -3924,7 +3924,7 @@ dependencies = [ [[package]] name = "lightcraft-scenes" -version = "0.16.0" +version = "0.17.0" dependencies = [ "image", "lightcraft-color", @@ -3935,7 +3935,7 @@ dependencies = [ [[package]] name = "lightcraft-segment" -version = "0.16.0" +version = "0.17.0" dependencies = [ "candle-core", "candle-nn", @@ -3949,7 +3949,7 @@ dependencies = [ [[package]] name = "lightcraft-slideshow" -version = "0.16.0" +version = "0.17.0" dependencies = [ "lightcraft-raster", "serde", @@ -3958,15 +3958,15 @@ dependencies = [ [[package]] name = "lightcraft-sysmem" -version = "0.16.0" +version = "0.17.0" [[package]] name = "lightcraft-testkit" -version = "0.16.0" +version = "0.17.0" [[package]] name = "lightcraft-tiff" -version = "0.16.0" +version = "0.17.0" dependencies = [ "proptest", "serde", @@ -3975,7 +3975,7 @@ dependencies = [ [[package]] name = "lightcraft-ui-egui" -version = "0.16.0" +version = "0.17.0" dependencies = [ "craft-ui", "craft-update", @@ -4006,7 +4006,7 @@ dependencies = [ [[package]] name = "lightcraft-web" -version = "0.16.0" +version = "0.17.0" dependencies = [ "crc32fast", "eframe", @@ -7823,7 +7823,7 @@ checksum = "e450f9b2ed1dff33c94c12589a87338689467b9c4f5d8a5710bd09a847d2c8a7" [[package]] name = "xtask" -version = "0.16.0" +version = "0.17.0" dependencies = [ "brotli", "flate2", diff --git a/Cargo.toml b/Cargo.toml index 0d2a65d715..31ae79d1a6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ resolver = "3" members = ["crates/*", "apps/*", "xtask"] [workspace.package] -version = "0.16.0" +version = "0.17.0" edition = "2024" license = "MIT OR Apache-2.0" rust-version = "1.95" From 3e3955bb3031791900c8da41c8ead73d0e1a4175 Mon Sep 17 00:00:00 2001 From: Fridtjof Michels Date: Sun, 1 Nov 2026 21:12:47 +0100 Subject: [PATCH 18/41] =?UTF-8?q?LR-VIEW-SURVEY:=20=E2=8C=98/Ctrl-click=20?= =?UTF-8?q?on=20a=20survey=20tile=20takes=20the=20photo=20out=20of=20the?= =?UTF-8?q?=20survey?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As in Lightroom Classic, a ⌘/Ctrl-click on a tile in Survey deselects that photo (library.select, mode toggle), as the hover × does; a plain click still only makes it active, and the last photo stays so the survey never empties. Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/panels/compare.rs | 7 +++++- crates/ui-egui/src/tests/compare.rs | 34 ++++++++++++++++++++++++++++ docs/parity-checklist.md | 2 +- 3 files changed, 41 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/panels/compare.rs b/crates/ui-egui/src/panels/compare.rs index dad49923fa..b7034f3a6d 100644 --- a/crates/ui-egui/src/panels/compare.rs +++ b/crates/ui-egui/src/panels/compare.rs @@ -569,7 +569,12 @@ pub fn show_survey(app: &mut LightcraftApp, ui: &mut egui::Ui) { if app.session.selection.active == Some(*id) { app.image_rect = Some(img); } - if resp.clicked() { + // ⌘/Ctrl-click removes the photo from the survey (deselects it), as the × does + if resp.clicked() && ui.input(|i| i.modifiers.command) { + if photos.len() > 1 { + let _ = app.run("library.select", json!({"ids": [id.0], "mode": "toggle"})); + } + } else if resp.clicked() { app.session.selection.active = Some(*id); } if resp.double_clicked() { diff --git a/crates/ui-egui/src/tests/compare.rs b/crates/ui-egui/src/tests/compare.rs index b0ccb0b149..e4d8389749 100644 --- a/crates/ui-egui/src/tests/compare.rs +++ b/crates/ui-egui/src/tests/compare.rs @@ -359,3 +359,37 @@ fn survey_rings_the_active_tile_in_the_theme_colour() { .count(); assert_eq!(white, 0, "no white 2 pt frame"); } + +/// Survey with three photos selected and the second active; returns the three ids. +fn survey_of_three(h: &mut Headless) -> [u64; 3] { + let vis: Vec = h.app.session.visible_cloned().iter().map(|p| p.0).collect(); + let ids = [vis[0], vis[1], vis[2]]; + h.request("engine.execute", json!({"command": "library.select", "params": {"ids": ids, "active": ids[1]}}), T); + let r = h.request("engine.execute", json!({"command": "view.survey"}), T); + assert_eq!(r["ok"], true, "{r}"); + h.settle(SETTLE); + ids +} + +/// Move the pointer to `pos` and press and release the primary button there, with `modifiers`. +fn click_with(h: &mut Headless, pos: egui::Pos2, modifiers: egui::Modifiers) { + h.app.synthetic.push(egui::Event::PointerMoved(pos)); + h.settle(SETTLE); + h.app.synthetic.push(egui::Event::PointerButton { pos, button: egui::PointerButton::Primary, pressed: true, modifiers }); + h.app.synthetic.push(egui::Event::PointerButton { pos, button: egui::PointerButton::Primary, pressed: false, modifiers }); + h.settle(SETTLE); +} + +/// ⌘/Ctrl-click on a survey tile takes it out of the survey, as in Lightroom Classic; a plain +/// click only makes it active. +#[test] +fn survey_command_click_takes_the_photo_out() { + let mut h = demo(); + let [a, b, c] = survey_of_three(&mut h); + let img = h.app.image_rect.expect("the active tile is laid out"); + click_with(&mut h, img.center(), egui::Modifiers::NONE); + assert_eq!(h.app.session.selection.ids.len(), 3, "a plain click keeps the photo"); + click_with(&mut h, img.center(), egui::Modifiers::COMMAND); + let sel: Vec = h.app.session.selection.ids.iter().map(|p| p.0).collect(); + assert_eq!(sel, vec![a, c], "the ⌘/Ctrl-clicked photo left the survey (was {b})"); +} diff --git a/docs/parity-checklist.md b/docs/parity-checklist.md index 5e851e721d..46aabad737 100644 --- a/docs/parity-checklist.md +++ b/docs/parity-checklist.md @@ -134,7 +134,7 @@ differences and missing bindings are in [ui-parity.md](ui-parity.md#shortcuts). | LR-VIEW-NAVIGATOR | Navigator mini map | P1 | ✅ | `cmd:view.navigator`, `crates/ui-egui/src/panels/detail.rs` | shown while zoomed (bottom right); click/drag pans | | LR-VIEW-BEFOREAFTER | Before / after | P0 | ✅ | `cmd:view.showOriginal`, `cmd:view.beforeAfter`, `cmd:view.beforeAfterSplit`, `cmd:view.beforeAfterTopBottom`, `cmd:view.beforeAfterSplitTopBottom`, `cmd:beforeAfter.setBefore`, `cmd:beforeAfter.copyAfterToBefore`, `cmd:beforeAfter.copyBeforeToAfter`, `cmd:beforeAfter.swap`, `cmd:beforeAfter.resetBefore` | all four layouts; before = the import state (defaults + import preset) or a chosen history step / version / the current settings; copy and swap (View → Before/After Settings, History row menu). The chosen before lasts for the session; in side by side and top / bottom, clicks with the white-balance selector, colour samplers and targeted adjustment work in the Before view too (`crates/ui-egui/src/tests/before_after.rs`). Zoomed in, the side by side and stacked views each stay in their pane, with their labels under it. Click zoom animates both panes together, including cached window tiles; input follows the displayed image and render requests use the final size (#1821) | | LR-VIEW-COMPARE | Compare two photos | P1 | ✅ | `cmd:view.compare`, `cmd:compare.swap`, `cmd:compare.makeSelect`, `cmd:compare.set`, `crates/ui-egui/src/panels/compare.rs`, `crates/ui-egui/src/tests/compare.rs` | select / candidate, synced zoom + pan, arrows move the candidate; a filmstrip click puts the photo into the active side (a photo on the other side swaps), so the active photo is always one of the two shown; a ⌘/Ctrl- or Shift-click on the filmstrip changes the selection as in the grid while the two photos shown stay selected and the active photo is unchanged (#187); the active pane is framed in the active photo's two-tone selection ring (theme tokens, 3 pt), as in the grids; 1:1 to 8:1 sharp on both sides (zoom windows, see LR-VIEW-ZOOM); no zoom-link toggle; each pane says “Rendering…” (widget `compare:rendering:`) or “This photo can't be opened” (`compare:renderFailed:`) as the loupe does | -| LR-VIEW-SURVEY | Survey view [Classic] | P2 | ✅ | `cmd:view.survey`, `crates/ui-egui/src/panels/compare.rs` | selection tiled (≤ 48), keys, the bottom bar and the Info panel's stars and colour labels act on the active photo (ringed as in the grid), each tile's caption shows its colour label, hover × removes | +| LR-VIEW-SURVEY | Survey view [Classic] | P2 | ✅ | `cmd:view.survey`, `crates/ui-egui/src/panels/compare.rs` | selection tiled (≤ 48), keys, the bottom bar and the Info panel's stars and colour labels act on the active photo (ringed as in the grid), each tile's caption shows its colour label, hover × or ⌘/Ctrl-click removes a photo | | LR-VIEW-INFOOVERLAY | Info overlay on the photo | P1 | ✅ | `cmd:view.infoOverlay`, `cmd:view.viewOptions`, `crates/ui-egui/src/panels/detail.rs` (`info_overlay`) | off / Info 1 (by default file name, capture date, size) / Info 2 (file name, exposure, camera + lens), each three lines chosen in View Options; ⌘I cycles (I in full screen; elsewhere I stays the Info panel); the star rating and flag show under the lines when the photo has them, and in the full-screen preview on macOS the overlay starts below the window controls (issue #2460) | | LR-VIEW-SLIDESHOW | Slideshow | P2 | ✅ | `cmd:view.slideshow` | View ▸ Slideshow (⌥⌘↩): the photos in view full screen from the selected one, played with the library's playback settings (see LRC-SS-PLAYBACK: fades, random order, repeat, previews prepared ahead; `interval` / any setting overrides one run); Space pauses, ←/→ step (a cut), Esc ends; playback controls on pointer movement | | LR-VIEW-SECONDWINDOW | Second display window [Classic] | P2 | ✅ | `cmd:view.secondWindow`, `crates/ui-egui/src/panels/second.rs` | Window ▸ Second Window (⌘F11): the active photo fitted in its own native window with its own render (a floating panel where there are no native windows); loupe view only (no grid / compare / survey there) | From 3609fe846654f7b54b1c3263754fc36b1d175ca5 Mon Sep 17 00:00:00 2001 From: Fridtjof Michels Date: Sun, 1 Nov 2026 22:13:54 +0100 Subject: [PATCH 19/41] =?UTF-8?q?LR-VIEW-SURVEY:=20the=20survey=20?= =?UTF-8?q?=E2=8C=98/Ctrl-click=20test=20covers=20a=20non-active=20tile=20?= =?UTF-8?q?and=20the=20last=20photo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Review follow-up (#3563): a plain click on another tile makes it active, a ⌘/Ctrl-click on a selected tile that is not active removes only that one, and ⌘/Ctrl-click on the last photo leaves it in the survey and active. Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/tests/compare.rs | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/crates/ui-egui/src/tests/compare.rs b/crates/ui-egui/src/tests/compare.rs index e4d8389749..26b069f50a 100644 --- a/crates/ui-egui/src/tests/compare.rs +++ b/crates/ui-egui/src/tests/compare.rs @@ -380,16 +380,27 @@ fn click_with(h: &mut Headless, pos: egui::Pos2, modifiers: egui::Modifiers) { h.settle(SETTLE); } -/// ⌘/Ctrl-click on a survey tile takes it out of the survey, as in Lightroom Classic; a plain -/// click only makes it active. +/// Click the centre of photo `id`'s survey tile with `modifiers`. +fn click_tile(h: &mut Headless, id: u64, modifiers: egui::Modifiers) { + let name = format!("cull:{id}"); + let pos = h.app.widgets.iter().find(|(w, _)| *w == name).map(|(_, r)| r.center()).expect("the tile is laid out"); + click_with(h, pos, modifiers); +} + +/// ⌘/Ctrl-click on a survey tile takes that photo out of the survey, as in Lightroom Classic, +/// whether or not it is the active one; a plain click only makes it active, and the last photo stays. #[test] fn survey_command_click_takes_the_photo_out() { let mut h = demo(); let [a, b, c] = survey_of_three(&mut h); - let img = h.app.image_rect.expect("the active tile is laid out"); - click_with(&mut h, img.center(), egui::Modifiers::NONE); - assert_eq!(h.app.session.selection.ids.len(), 3, "a plain click keeps the photo"); - click_with(&mut h, img.center(), egui::Modifiers::COMMAND); - let sel: Vec = h.app.session.selection.ids.iter().map(|p| p.0).collect(); - assert_eq!(sel, vec![a, c], "the ⌘/Ctrl-clicked photo left the survey (was {b})"); + let sel = |h: &Headless| h.app.session.selection.ids.iter().map(|p| p.0).collect::>(); + let active = |h: &Headless| h.app.session.selection.active.map(|p| p.0); + click_tile(&mut h, a, egui::Modifiers::NONE); + assert_eq!((sel(&h), active(&h)), (vec![a, b, c], Some(a)), "a plain click keeps the photo and makes it active"); + click_tile(&mut h, c, egui::Modifiers::COMMAND); + assert_eq!((sel(&h), active(&h)), (vec![a, b], Some(a)), "the ⌘/Ctrl-clicked photo (not the active one) left"); + click_tile(&mut h, b, egui::Modifiers::COMMAND); + assert_eq!(sel(&h), vec![a]); + click_tile(&mut h, a, egui::Modifiers::COMMAND); + assert_eq!((sel(&h), active(&h)), (vec![a], Some(a)), "the last photo stays in the survey"); } From da558f5b8fba9a46d97ae74846716b98e1a73825 Mon Sep 17 00:00:00 2001 From: Fridtjof Michels Date: Sun, 1 Nov 2026 22:34:35 +0100 Subject: [PATCH 20/41] =?UTF-8?q?LR-VIEW-SURVEY:=20test=20that=20=E2=8C=98?= =?UTF-8?q?/Ctrl-click=20on=20the=20active=20survey=20photo=20activates=20?= =?UTF-8?q?the=20last=20one=20left?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Review follow-up (#3563). Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/tests/compare.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/crates/ui-egui/src/tests/compare.rs b/crates/ui-egui/src/tests/compare.rs index 26b069f50a..f570df33a8 100644 --- a/crates/ui-egui/src/tests/compare.rs +++ b/crates/ui-egui/src/tests/compare.rs @@ -404,3 +404,15 @@ fn survey_command_click_takes_the_photo_out() { click_tile(&mut h, a, egui::Modifiers::COMMAND); assert_eq!((sel(&h), active(&h)), (vec![a], Some(a)), "the last photo stays in the survey"); } + +/// ⌘/Ctrl-click on the active survey photo while others remain: it leaves, and the last +/// remaining photo becomes active, so the keys still act on a photo on screen. +#[test] +fn survey_command_click_on_the_active_photo_activates_the_last_one() { + let mut h = demo(); + let [a, b, c] = survey_of_three(&mut h); + click_tile(&mut h, a, egui::Modifiers::NONE); + click_tile(&mut h, a, egui::Modifiers::COMMAND); + let sel: Vec = h.app.session.selection.ids.iter().map(|p| p.0).collect(); + assert_eq!((sel, h.app.session.selection.active.map(|p| p.0)), (vec![b, c], Some(c))); +} From 7a7be84e41fced71d1b75c036cb4dbca8b11f2a3 Mon Sep 17 00:00:00 2001 From: NetterSilver <133535268+Silvertree2010@users.noreply.github.com> Date: Mon, 2 Nov 2026 03:10:14 +0000 Subject: [PATCH 21/41] test: pin three linked margin keys boundary and wrap merged doc comment Co-Authored-By: Claude Sonnet 5.5 --- crates/slideshow/src/settings.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/crates/slideshow/src/settings.rs b/crates/slideshow/src/settings.rs index c17c2bba6c..488819e77c 100644 --- a/crates/slideshow/src/settings.rs +++ b/crates/slideshow/src/settings.rs @@ -218,8 +218,8 @@ impl SlideSettings { /// These settings with the keys `p` names changed (the others kept), validated and clamped. /// A wrong type, an unknown key or a non-finite number is an error, and nothing changes. - /// With `linkMargins` on (already, or set in `p`), a margin given sets all four (unless all four are given); `margins` - /// sets all four in any case. + /// With `linkMargins` on (already, or set in `p`), a margin given sets all four (unless all four are given); + /// `margins` sets all four in any case. pub fn merged(&self, p: &Value) -> Result { let Some(obj) = p.as_object() else { return Err("parameters must be an object".into()) }; let mut s = self.clone(); @@ -341,6 +341,14 @@ mod tests { assert_eq!(d.merged(&st.to_json()).unwrap(), st); } + #[test] + fn merge_copies_last_of_three_linked_margins() { + let d = SlideSettings::default(); + // keys are visited in key order (bottom, left, top): the last one, `marginTop`, wins + let s = d.merged(&json!({"marginLeft": 0.1, "marginTop": 0.3, "marginBottom": 0.2})).unwrap(); + assert_eq!((s.margin_left, s.margin_right, s.margin_top, s.margin_bottom), (0.3, 0.3, 0.3, 0.3)); + } + #[test] fn merge_validates_links_margins_and_round_trips() { let d = SlideSettings::default(); From 01fa8545e8552304d37fadc89da39cdf35202f60 Mon Sep 17 00:00:00 2001 From: Rahul Date: Mon, 2 Nov 2026 15:00:11 +0530 Subject: [PATCH 22/41] #3601: the Square Grid's badge band sits on the photo itself paint_cell_badges sized the badge band from the cell's whole image area, so on a portrait photo it stuck out past the photo on both sides and crossed the selection frame (which paint_cell_thumbnail draws around the photo's fitted rect). The band is now built from the rect the photo actually occupies - fitted rect, or the placeholder's - and a photo shorter than the band keeps its own top edge. Co-authored-by: rahul05ranjan <11793455+rahul05ranjan@users.noreply.github.com> --- crates/ui-egui/src/panels/grid.rs | 44 +++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/crates/ui-egui/src/panels/grid.rs b/crates/ui-egui/src/panels/grid.rs index 29579a01fb..21abd6e904 100644 --- a/crates/ui-egui/src/panels/grid.rs +++ b/crates/ui-egui/src/panels/grid.rs @@ -806,10 +806,10 @@ fn cell(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId, r: Rect, square } else { r }; - paint_cell_thumbnail(app, p, &t, id, img_rect, ThumbFlags { square, state, onscreen, ppp }); + let photo_rect = paint_cell_thumbnail(app, p, &t, id, img_rect, ThumbFlags { square, state, onscreen, ppp }); // labels and badges paint_cell_caption(app, p, &t, &photo, r, square); - paint_cell_badges(app, p, &t, &photo, img_rect, BadgeFlags { square, selected, hovered: resp.hovered() }); + paint_cell_badges(app, p, &t, &photo, photo_rect, BadgeFlags { square, selected, hovered: resp.hovered() }); if let Some(name) = &photo.copy_name { paint_copy_tag(p, &t, name, img_rect, square); } @@ -838,7 +838,7 @@ pub(crate) fn cell_description(app: &LightcraftApp, photo: &lightcraft_catalog:: spoken } -fn paint_cell_thumbnail(app: &mut LightcraftApp, p: &egui::Painter, t: &Tokens, id: PhotoId, img_rect: Rect, flags: ThumbFlags) { +fn paint_cell_thumbnail(app: &mut LightcraftApp, p: &egui::Painter, t: &Tokens, id: PhotoId, img_rect: Rect, flags: ThumbFlags) -> Rect { let ThumbFlags { square, state, onscreen, ppp } = flags; let size = thumb_px(img_rect.width().max(img_rect.height()), ppp); request_thumb(app, id, size, if onscreen { 10 } else { 5 }); @@ -848,6 +848,7 @@ fn paint_cell_thumbnail(app: &mut LightcraftApp, p: &egui::Painter, t: &Tokens, let fit = super::detail::fit_texture_rect(img_rect, [tw, th]); p.image(tex.tex.id(), fit, Rect::from_min_max(pos2(0.0, 0.0), pos2(1.0, 1.0)), Color32::WHITE); selection_ring(p, t, fit, state); + fit } else { let ph = img_rect.shrink(if square { 20.0 } else { 0.0 }); p.rect_filled(ph, 0.0, t.skeleton); @@ -857,6 +858,7 @@ fn paint_cell_thumbnail(app: &mut LightcraftApp, p: &egui::Painter, t: &Tokens, // unreadable / missing file p.text(ph.center(), Align2::CENTER_CENTER, "!", t.semibold(18.0), t.text); } + ph } } @@ -890,14 +892,22 @@ fn paint_cell_caption(app: &LightcraftApp, p: &egui::Painter, t: &Tokens, photo: } } -fn paint_cell_badges(app: &LightcraftApp, p: &egui::Painter, t: &Tokens, photo: &lightcraft_catalog::Photo, img_rect: Rect, flags: BadgeFlags) { +/// The 24-pixel band the badges sit in, on the photo itself: a portrait's fitted rect is +/// narrower than the cell's image area and a landscape's is shorter, so a band sized from +/// the image area sticks out past the photo and crosses its selection frame (#3601). A photo +/// shorter than the band keeps its own top edge. +fn photo_badge_bar(photo_rect: Rect) -> Rect { + Rect::from_min_max(pos2(photo_rect.left(), (photo_rect.bottom() - 24.0).max(photo_rect.top())), photo_rect.right_bottom()) +} + +fn paint_cell_badges(app: &LightcraftApp, p: &egui::Painter, t: &Tokens, photo: &lightcraft_catalog::Photo, photo_rect: Rect, flags: BadgeFlags) { let BadgeFlags { square, selected, hovered } = flags; let show_badges = match app.ui.settings.grid_badges { crate::state::GridBadges::Auto => hovered || selected || photo.rating > 0 || photo.flag != Flag::None || photo.label.is_some(), crate::state::GridBadges::Always => true, crate::state::GridBadges::Never => false, }; - let badge_bar = Rect::from_min_max(pos2(img_rect.left(), img_rect.bottom() - 24.0), img_rect.right_bottom()); + let badge_bar = photo_badge_bar(photo_rect); if !square && photo.label.is_some() { // Justified photos fill the whole cell, so the label shows as a translucent tinted footer // over the photo's bottom edge (opaque, it would hide 24 px of every labelled photo). @@ -1662,4 +1672,28 @@ mod tests { assert_eq!(resolve_group(GroupBy::None, 220.0), GroupBy::None); assert_eq!(resolve_group(GroupBy::Year, 400.0), GroupBy::Year); } + + /// The badge band sits on the photo itself — a portrait's fitted rect is narrower than the + /// cell's image area, a landscape's is shorter — so it never sticks out past the photo or + /// crosses its selection frame (#3601). + #[test] + fn the_badge_band_stays_on_the_photo() { + let cell = Rect::from_min_size(pos2(10.0, 24.0), vec2(180.0, 180.0)); + // A photo that fills the image area: the band is the usual 24 px footer + let full = photo_badge_bar(cell); + assert!((full.height() - 24.0).abs() < 0.01, "{full:?}"); + assert!((full.bottom() - cell.bottom()).abs() < 0.01); + assert!((full.left() - cell.left()).abs() < 0.01 && (full.right() - cell.right()).abs() < 0.01); + // A portrait photo fitted inside it: the band is no wider than the photo + let portrait = Rect::from_min_size(pos2(cell.left() + 55.0, cell.top()), vec2(70.0, 180.0)); + let bar = photo_badge_bar(portrait); + assert!(bar.left() >= portrait.left() && bar.right() <= portrait.right(), "{bar:?}"); + assert!((bar.height() - 24.0).abs() < 0.01); + // A landscape photo shorter than the band: its own top edge, never a negative rect + let wide = Rect::from_min_size(pos2(cell.left(), cell.top() + 80.0), vec2(180.0, 20.0)); + let bar = photo_badge_bar(wide); + assert!((bar.top() - wide.top()).abs() < 0.01, "{bar:?}"); + assert!(bar.bottom() <= wide.bottom() + 0.01); + } } + From 32d569ad5d19a6b55cf8d5c077127faa0f44a83b Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Mon, 2 Nov 2026 19:26:25 -0500 Subject: [PATCH 23/41] Release 0.18.0 Co-Authored-By: Claude Opus 5.5 --- Cargo.lock | 66 +++++++++++++++++++++++++++--------------------------- Cargo.toml | 2 +- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cf7b45714f..4115a749a0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3536,7 +3536,7 @@ dependencies = [ [[package]] name = "lightcraft" -version = "0.17.0" +version = "0.18.0" dependencies = [ "chrono", "craft-update", @@ -3563,7 +3563,7 @@ dependencies = [ [[package]] name = "lightcraft-catalog" -version = "0.17.0" +version = "0.18.0" dependencies = [ "chrono", "crc32fast", @@ -3584,7 +3584,7 @@ dependencies = [ [[package]] name = "lightcraft-cli" -version = "0.17.0" +version = "0.18.0" dependencies = [ "dhat", "lightcraft-codecs", @@ -3601,7 +3601,7 @@ dependencies = [ [[package]] name = "lightcraft-codecs" -version = "0.17.0" +version = "0.18.0" dependencies = [ "avif-serialize", "bytemuck", @@ -3632,7 +3632,7 @@ dependencies = [ [[package]] name = "lightcraft-color" -version = "0.17.0" +version = "0.18.0" dependencies = [ "lightcraft-geom", "proptest", @@ -3641,7 +3641,7 @@ dependencies = [ [[package]] name = "lightcraft-denoise" -version = "0.17.0" +version = "0.18.0" dependencies = [ "faer-core", "lightcraft-denoise-core", @@ -3658,7 +3658,7 @@ dependencies = [ [[package]] name = "lightcraft-denoise-core" -version = "0.17.0" +version = "0.18.0" dependencies = [ "dhat", "lightcraft-raster", @@ -3674,7 +3674,7 @@ dependencies = [ [[package]] name = "lightcraft-develop" -version = "0.17.0" +version = "0.18.0" dependencies = [ "lightcraft-color", "lightcraft-geom", @@ -3686,7 +3686,7 @@ dependencies = [ [[package]] name = "lightcraft-engine" -version = "0.17.0" +version = "0.18.0" dependencies = [ "ab_glyph", "chrono", @@ -3730,7 +3730,7 @@ dependencies = [ [[package]] name = "lightcraft-faces" -version = "0.17.0" +version = "0.18.0" dependencies = [ "lightcraft-testkit", "matrixmultiply", @@ -3745,7 +3745,7 @@ dependencies = [ [[package]] name = "lightcraft-fetch" -version = "0.17.0" +version = "0.18.0" dependencies = [ "log", "rustls", @@ -3756,7 +3756,7 @@ dependencies = [ [[package]] name = "lightcraft-geocode" -version = "0.17.0" +version = "0.18.0" dependencies = [ "miniz_oxide 0.9.1", "serde", @@ -3764,7 +3764,7 @@ dependencies = [ [[package]] name = "lightcraft-geom" -version = "0.17.0" +version = "0.18.0" dependencies = [ "proptest", "serde", @@ -3772,7 +3772,7 @@ dependencies = [ [[package]] name = "lightcraft-gpu" -version = "0.17.0" +version = "0.18.0" dependencies = [ "bytemuck", "lightcraft-color", @@ -3792,7 +3792,7 @@ dependencies = [ [[package]] name = "lightcraft-heif" -version = "0.17.0" +version = "0.18.0" dependencies = [ "heic-rs", "rayon", @@ -3800,14 +3800,14 @@ dependencies = [ [[package]] name = "lightcraft-inpaint" -version = "0.17.0" +version = "0.18.0" dependencies = [ "rayon", ] [[package]] name = "lightcraft-lensdb" -version = "0.17.0" +version = "0.18.0" dependencies = [ "lightcraft-develop", "lightcraft-geom", @@ -3816,7 +3816,7 @@ dependencies = [ [[package]] name = "lightcraft-mcp" -version = "0.17.0" +version = "0.18.0" dependencies = [ "lightcraft-codecs", "lightcraft-engine", @@ -3827,7 +3827,7 @@ dependencies = [ [[package]] name = "lightcraft-merge" -version = "0.17.0" +version = "0.18.0" dependencies = [ "lightcraft-codecs", "lightcraft-color", @@ -3843,7 +3843,7 @@ dependencies = [ [[package]] name = "lightcraft-meta" -version = "0.17.0" +version = "0.18.0" dependencies = [ "chrono", "lightcraft-geom", @@ -3857,7 +3857,7 @@ dependencies = [ [[package]] name = "lightcraft-pipeline" -version = "0.17.0" +version = "0.18.0" dependencies = [ "dhat", "image", @@ -3876,7 +3876,7 @@ dependencies = [ [[package]] name = "lightcraft-preview" -version = "0.17.0" +version = "0.18.0" dependencies = [ "jpeg-encoder", "lightcraft-raster", @@ -3888,7 +3888,7 @@ dependencies = [ [[package]] name = "lightcraft-raster" -version = "0.17.0" +version = "0.18.0" dependencies = [ "libc", "lightcraft-color", @@ -3900,7 +3900,7 @@ dependencies = [ [[package]] name = "lightcraft-raw" -version = "0.17.0" +version = "0.18.0" dependencies = [ "dhat", "jpeg-encoder", @@ -3924,7 +3924,7 @@ dependencies = [ [[package]] name = "lightcraft-scenes" -version = "0.17.0" +version = "0.18.0" dependencies = [ "image", "lightcraft-color", @@ -3935,7 +3935,7 @@ dependencies = [ [[package]] name = "lightcraft-segment" -version = "0.17.0" +version = "0.18.0" dependencies = [ "candle-core", "candle-nn", @@ -3949,7 +3949,7 @@ dependencies = [ [[package]] name = "lightcraft-slideshow" -version = "0.17.0" +version = "0.18.0" dependencies = [ "lightcraft-raster", "serde", @@ -3958,15 +3958,15 @@ dependencies = [ [[package]] name = "lightcraft-sysmem" -version = "0.17.0" +version = "0.18.0" [[package]] name = "lightcraft-testkit" -version = "0.17.0" +version = "0.18.0" [[package]] name = "lightcraft-tiff" -version = "0.17.0" +version = "0.18.0" dependencies = [ "proptest", "serde", @@ -3975,7 +3975,7 @@ dependencies = [ [[package]] name = "lightcraft-ui-egui" -version = "0.17.0" +version = "0.18.0" dependencies = [ "craft-ui", "craft-update", @@ -4006,7 +4006,7 @@ dependencies = [ [[package]] name = "lightcraft-web" -version = "0.17.0" +version = "0.18.0" dependencies = [ "crc32fast", "eframe", @@ -7823,7 +7823,7 @@ checksum = "e450f9b2ed1dff33c94c12589a87338689467b9c4f5d8a5710bd09a847d2c8a7" [[package]] name = "xtask" -version = "0.17.0" +version = "0.18.0" dependencies = [ "brotli", "flate2", diff --git a/Cargo.toml b/Cargo.toml index 31ae79d1a6..eb363f491e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ resolver = "3" members = ["crates/*", "apps/*", "xtask"] [workspace.package] -version = "0.17.0" +version = "0.18.0" edition = "2024" license = "MIT OR Apache-2.0" rust-version = "1.95" From 06c1b9ae0775464ce83ef0a9588be770337600f1 Mon Sep 17 00:00:00 2001 From: Robert Date: Mon, 2 Nov 2026 18:41:34 -0700 Subject: [PATCH 24/41] Use crw craftlib (#3503) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * CRW-LIB: decode Canon CRW through the shared craft-crw crate LightCraft decodes Canon CRW (the CIFF raws of the EOS D30, D60, 10D, 300D and the PowerShot G1/G6) through craft-libs' `craft-crw`, the clean-room decoder derived and verified on the `clean-room-crw-format-decode` branch and moved there with its frozen tables and derivation record. `crates/raw/src/vendor/crw.rs` is now the adapter: it maps the crate's header and samples onto `RawImage` (CFA, levels, active area, orientation, as-shot white balance, the make/model/time records a CRW keeps instead of Exif) and converts the capture time through chrono. The dependency is a local path (`../craft-libs/crates/crw`) until the craft-libs branch merges; then it becomes a git revision. Everything LightCraft-side from that branch comes along unchanged: `probe_bytes` fills metadata gaps from the decoder's records so CRW imports name their camera; the EOS D60 bundled camera profile and its chart-measured dual-illuminant matrices (`chart_table.rs`, `spectral::Camera` carries its illuminant pair) give the D60 a Kelvin white-balance scale; CRW joins the JPEG-fitted starting look, the catalog's raw formats and `lightcraft-cli calibrate`; `RENDER_CACHE_VERSION` 71; the CC0 CRW corpus entries for `cargo xtask corpus`; coverage, parity, gaps, raw-parity, target-app-parity and ROADMAP updates. The G5 stays preview-only (the crate refuses it with the reason) and the robustness test keeps its CRW sample. What does not come along: the decoder, its tables and `crw_oracle.rs` (now craft-crw's digest-pinned sample test) and the derivation record, which lives in craft-libs `crates/crw/clean-room/`. `clean-room/crw/` here keeps only the EOS D60 chart-calibration document and its capture list, with a README pointing at the record. Gates: fmt, clippy -D warnings (raw all targets; engine, catalog, cli), lightcraft-raw tests (475 + 134, the corpus files decoding through the adapter), catalog tests, engine lib tests (1,300 pass; the two failures, `tests_import::recursive_discovery_…` and `originals::tests::write_targets_pin_absent_paths_…`, are in files unchanged from main), `cargo xtask parity`, `assets`, `layers`, `coverage.py --check`. Co-Authored-By: Claude Fable 5.1 * no message * no message * Update documentation after moving code to craft-libs * Review coment fixes * CRW: pin craft-crw f3b62ec, a truncated entropy stream is Corrupt craft-libs #472 makes craft_crw::decode refuse a stream that ends more than Limits::max_stream_end_fill (64 samples, one block) before the frame does, instead of filling the rest with predictor values and returning success. The adapter already maps craft_crw::Error::Corrupt to RawError::Corrupt; a regression test proves a truncated CRW now fails at this boundary (it decoded as a flat frame on the old pin) while its header still reads. Only craft-crw moves; craft-ui/docpath/update/window stay on c5a1cbf. Co-Authored-By: Claude Opus 5.5 * Code review comment fix * Add some tests --------- Co-authored-by: Robert Woldberg <314159+rwoldberg@users.noreply.github.com> Co-authored-by: Claude Fable 5.1 --- Cargo.lock | 10 + Cargo.toml | 2 + README.md | 2 +- ROADMAP.md | 11 +- apps/lightcraft-cli/src/main.rs | 7 +- assets/ATTRIBUTION.md | 2 + assets/camera-profiles/Canon_EOS_D60.json | 1 + clean-room/crw/10-chart-calibration.md | 97 ++++++++ clean-room/crw/README.md | 18 ++ clean-room/crw/logs/chart-captures.tsv | 39 ++++ crates/catalog/src/model.rs | 4 +- crates/engine/src/camera_preview/colour.rs | 1 + crates/engine/src/camera_profiles.rs | 6 +- crates/engine/src/files/probe.rs | 7 + crates/engine/src/files/tests.rs | 35 +++ crates/engine/src/lightroom_catalog.rs | 2 +- crates/engine/src/media/source.rs | 2 +- crates/raw/Cargo.toml | 2 + crates/raw/src/chart_table.rs | 21 ++ crates/raw/src/lib.rs | 5 +- crates/raw/src/preview/tests.rs | 4 +- crates/raw/src/spectral.rs | 69 ++++-- crates/raw/src/spectral_table.rs | 52 +++++ crates/raw/src/tests.rs | 7 +- crates/raw/src/vendor.rs | 1 + crates/raw/src/vendor/crw.rs | 255 +++++++++++++++++++++ crates/raw/tests/it/corpus.rs | 9 +- crates/raw/tests/it/crw_corpus.rs | 71 ++++++ crates/raw/tests/it/main.rs | 1 + crates/raw/tests/it/vendor_robust.rs | 44 +++- docs/camera-preview-colour.md | 6 +- docs/gaps.md | 10 +- docs/parity-checklist.md | 12 +- docs/raw-parity.md | 42 ++-- docs/raw/coverage.py | 13 +- docs/raw/coverage.tsv | 42 ++-- docs/raw/evidence.tsv | 7 + docs/target-app-parity.md | 8 +- tools/spectral_camera_table.py | 1 + xtask/src/raw_samples.rs | 57 +++++ 40 files changed, 893 insertions(+), 92 deletions(-) create mode 100644 assets/camera-profiles/Canon_EOS_D60.json create mode 100644 clean-room/crw/10-chart-calibration.md create mode 100644 clean-room/crw/README.md create mode 100644 clean-room/crw/logs/chart-captures.tsv create mode 100644 crates/raw/src/chart_table.rs create mode 100644 crates/raw/src/vendor/crw.rs create mode 100644 crates/raw/tests/it/crw_corpus.rs diff --git a/Cargo.lock b/Cargo.lock index 4115a749a0..037865f87f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1181,6 +1181,14 @@ dependencies = [ "libc", ] +[[package]] +name = "craft-crw" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=f3b62ec61f45534392376492fc5ad33047375205#f3b62ec61f45534392376492fc5ad33047375205" +dependencies = [ + "thiserror 2.0.21", +] + [[package]] name = "craft-docpath" version = "0.1.0" @@ -3902,6 +3910,8 @@ dependencies = [ name = "lightcraft-raw" version = "0.18.0" dependencies = [ + "chrono", + "craft-crw", "dhat", "jpeg-encoder", "jxl-oxide", diff --git a/Cargo.toml b/Cargo.toml index eb363f491e..4cfd43f3a3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,6 +12,8 @@ repository = "https://github.com/storytold/lightcraft" [workspace.dependencies] craft-ui = { git = "https://github.com/storytold/craft-libs", rev = "c5a1cbfb5f9049f9270955caffb5bee5997aebf7", features = ["serde"] } craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "c5a1cbfb5f9049f9270955caffb5bee5997aebf7" } +# Canon CRW decoder shared with the other Craft apps +craft-crw = { git = "https://github.com/storytold/craft-libs", rev = "f3b62ec61f45534392376492fc5ad33047375205" } # craft-update: app-specific pretend versions apply to startup and manual checks. craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "c5a1cbfb5f9049f9270955caffb5bee5997aebf7", features = ["egui"] } craft-window = { git = "https://github.com/storytold/craft-libs", rev = "c5a1cbfb5f9049f9270955caffb5bee5997aebf7", features = ["egui"] } diff --git a/README.md b/README.md index e6ac8db59a..1b64265b3a 100644 --- a/README.md +++ b/README.md @@ -349,7 +349,7 @@ LightCraft is young and moving fast: **alpha**. **Where we honestly stand** (det casual use.** It's great for JPEG/DNG and most Sony / Panasonic / Fujifilm / Nikon / older-Canon raws on one machine; see [docs/raw-parity.md](docs/raw-parity.md) for your camera. - **The biggest gaps:** - - **camera colour calibration:** Sony, Nikon, Panasonic, Fujifilm and Canon CR3 raws have guarded estimates from their camera JPEGs, with built-in ILCA-99M2, ILCE-7CR, ILCE-7M4, ILCE-7RM5, X-H2S, X-T4, Nikon Z 6II, Z 8 and D5300 profiles; measured calibration is missing, and other raws or rejected fits retain a neutral matrix; + - **camera colour calibration:** Sony, Nikon, Panasonic, Fujifilm and Canon CR3 and CRW raws have guarded estimates from their camera JPEGs, with built-in Canon EOS D60, ILCA-99M2, ILCE-7CR, ILCE-7M4, ILCE-7RM5, X-H2S, X-T4, Nikon Z 6II, Z 8 and D5300 profiles; measured calibration covers one model so far (chart-measured matrices for the Canon EOS D60), and other raws or rejected fits retain a neutral matrix; - **compressed Olympus raws and unsupported CR3 variants:** these use embedded JPEG previews when present. Fujifilm lossless/lossy compressed RAF now decodes sensor data; [verification and existing-library reload instructions](docs/raf-compression.md); - **AI quality and model setup:** Subject and Sky selection are classical heuristics; Object/Describe use an optional SAM 3 model. AI Denoise supports Bayer RAW with separately installed weights, while X-Trans and diff --git a/ROADMAP.md b/ROADMAP.md index 0571abfb99..471496ecd1 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -2,7 +2,7 @@ **Stage: alpha** · next: beta, ~14 points and ~340–600 h away -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-24 · **Change:** minor (gap 9: CI runs the tests on Linux x64 since #2667; macOS, Windows and the GPU equivalence tests still don't; the lens profile database priority links its tracking issue #329; Print: Japanese photo and postcard paper sizes — L判, 2L判, KG判, はがき, 往復はがき, 六切, 四切, 名刺; Minolta MRW decoded, 6 bodies verified; RAW: 83% of Adobe's models decode, 38% verified after the camera-coverage sweep #1327; German catalog 91% → 97%: interface strings and What's New lines translated) · **Target:** Adobe Lightroom Classic 15.5 / Lightroom 9.6 +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-24 · **Change:** minor (Canon CRW decoded clean-room, 6 bodies verified, 557 models verified; gap 9: CI runs the tests on Linux x64 since #2667; macOS, Windows and the GPU equivalence tests still don't; the lens profile database priority links its tracking issue #329; Print: Japanese photo and postcard paper sizes — L判, 2L判, KG判, はがき, 往復はがき, 六切, 四切, 名刺; Minolta MRW decoded, 6 bodies verified; RAW: 85% of Adobe's models decode, 39% verified after the camera-coverage sweep #1327; German catalog 91% → 97%: interface strings and What's New lines translated) · **Target:** Adobe Lightroom Classic 15.5 / Lightroom 9.6 One-page summary of how close LightCraft is to Adobe Lightroom. Agents: read this, then pick work from [docs/gaps.md](docs/gaps.md). The full assessment, method and evidence are in @@ -45,7 +45,7 @@ Hours are calibrated on this repo's PR history; see | Dimension | Ready | Breadth | Remaining | Doc | |---|---:|---:|---:|---| | Features | ~61% | ~77% (checklist 81.1%) | 600–1,100 h | [target-app-parity](docs/target-app-parity.md#features) | -| ↳ RAW cameras, colour, lens profiles | ~60% | 83% of 1,446 Adobe models decode, 38% verified | 255–480 h | [raw-parity](docs/raw-parity.md) | +| ↳ RAW cameras, colour, lens profiles | ~60% | 85% of 1,446 Adobe models decode, 39% verified | 255–480 h | [raw-parity](docs/raw-parity.md) | | UI/UX fidelity | ~70% | ~85% | 32–54 h | [ui-parity](docs/ui-parity.md) | | File formats (non-raw) | ~70% | ~85% | 30–55 h | [file-format-parity](docs/file-format-parity.md) | | Hardware | ~40% | ~50% | 40–80 h | [hardware-parity](docs/hardware-parity.md) | @@ -119,6 +119,12 @@ Ranked toward beta; detail in [docs/roadmap.md](docs/roadmap.md), gaps in [docs/ 六切 (203 × 254), 四切 (254 × 305) and 名刺 (55 × 91) — at their exact metric sizes. The Print dialog and `print.set` take their customary names, and names are matched case-, space- and punctuation-insensitively (`L判`, `l`, `L-size` are one paper). +- 2026-10-13: Canon CRW (the 2000–2004 CIFF bodies) decodes from sensor data: compression + derived clean-room against a black-box reference and frozen (`craft-libs crates/crw/clean-room/02-crw-format.md`); + EOS D30/D60/10D/300D and PowerShot G1/G6 verified pixel-exact on 28 of 29 corpus files (18 of + them the maintainer's D60 shots); as-shot white balance, black level, rotation and capture time + from the CIFF records; the PowerShot G5's anomalous coding stays preview-only. With the + camera-coverage sweep and MRW merged, 557 models verified; Canon bucket 95% → 98%. - 2026-10-14: Camera-coverage sweep verifies 30 more models on 40 CC0 files, with file and sensor hashes pinned (`docs/raw/coverage.py`: 515 → 545 verified). Eleven candidates excluded after rechecking identity, provenance and camera-image agreement. Phone and drone DNG tone differences remain tracked in #1277. @@ -194,6 +200,7 @@ Ranked toward beta; detail in [docs/roadmap.md](docs/roadmap.md), gaps in [docs/ | 2026-10-24 | patch | Alpha rationale: tests run in CI on Linux x64 (#2667) and FreeBSD nightly, not on macOS or Windows; ranked item 8 now reads "Tests in CI on macOS and Windows, and the GPU tests in CI"; percentages and hours unchanged | | 2026-10-22 | minor | Print: Japanese photo and postcard paper sizes (L判, 2L判, KG判, はがき, 往復はがき, 六切, 四切, 名刺) in the page setup, Print dialog and PDF output; headline numbers unchanged | | 2026-10-19 | minor | Indonesian interface (`id`): every plain and formats message, plus 69 command labels, locale, menu command and tests; What's New left in English; Localization ~55% → ~64% (mean of the 12 key languages), 8 of 12 present | +| 2026-10-13 | minor | Canon CRW decoded (clean-room): 6 bodies verified pixel-exact, G5 preview; 551 models verified after merging the coverage sweep | | 2026-10-12 | minor | Italian interface (`it`, #1192): 2,201 of 2,398 messages, locale, menu command and tests; headline numbers unchanged | | 2026-10-13 | minor | Sony ILCA-99M2 camera colour profile in the log; numbers unchanged | | 2026-10-14 | minor | Localization ~52% → ~55% (mean of the 12 key languages): de, es, fr, ja and uk catalogs filled | diff --git a/apps/lightcraft-cli/src/main.rs b/apps/lightcraft-cli/src/main.rs index dcb5280f61..01d6f23b39 100644 --- a/apps/lightcraft-cli/src/main.rs +++ b/apps/lightcraft-cli/src/main.rs @@ -106,7 +106,7 @@ USAGE: lightcraft-cli controls [--json] list every develop control id with its range lightcraft-cli calibrate [--max N] [--out DIR] FOLDERS/FILES… Fit a colour profile per camera model from raw files and their embedded camera JPEGs - (Sony ARW, Nikon NEF, Fujifilm RAF): up to N files spread over the folders (default 300; 0 = all), pooled per + (Sony ARW, Nikon NEF, Fujifilm RAF, Canon CRW): up to N files spread over the folders (default 300; 0 = all), pooled per model, written as .json to DIR (default: the profiles folder LightCraft reads, /camera-profiles, or $LIGHTCRAFT_CAMERA_PROFILES). Raws of a profiled model then take their colour from the profile and only their tone from their own JPEG. @@ -197,8 +197,9 @@ fn main() -> ExitCode { /// Raw files below `path` (or `path` itself), skipping hidden and NAS metadata folders. fn raw_files(path: &Path, out: &mut Vec, depth: usize) { - let is_raw = - |p: &Path| p.extension().and_then(|e| e.to_str()).is_some_and(|e| ["arw", "nef", "nrw", "raf"].iter().any(|x| e.eq_ignore_ascii_case(x))); + let is_raw = |p: &Path| { + p.extension().and_then(|e| e.to_str()).is_some_and(|e| ["arw", "nef", "nrw", "raf", "crw"].iter().any(|x| e.eq_ignore_ascii_case(x))) + }; if path.is_file() { if is_raw(path) { out.push(path.to_path_buf()); diff --git a/assets/ATTRIBUTION.md b/assets/ATTRIBUTION.md index d95e95b415..f0c7d15ca7 100644 --- a/assets/ATTRIBUTION.md +++ b/assets/ATTRIBUTION.md @@ -19,11 +19,13 @@ covers a whole directory), or if a licence file referenced in the Licence column | `assets/camera-profiles/ILCA-99M2.json` | Sony ILCA-99M2 camera colour profile (matrix + hue/saturation/value table), built into LightCraft | LightCraft contributors; source photographs supplied by @PiMinusMax | original work: fitted by `lightcraft-cli calibrate` to 144 usable ILCA-99M2 ARWs (of 150, seven shooting days, Standard creative style) and their in-camera JPEGs; aggregate colour statistics only, no image content; no Adobe or third-party profile data | MIT OR Apache-2.0 | 2026-10-11 | none | | `assets/camera-profiles/ILCE-7CR.json` | Sony ILCE-7CR camera colour profile (matrix + hue/saturation/value table), built into LightCraft | LightCraft contributors; source photographs supplied by @AlexChambers | original work: fitted by `lightcraft-cli calibrate` to 125 usable ILCE-7CR ARWs (of 131, September 2025 to September 2026, Standard creative style) and their in-camera JPEGs; aggregate colour statistics only, no image content; no Adobe or third-party profile data | MIT OR Apache-2.0 | 2026-10-09 | none | | `assets/camera-profiles/X-H2S.json`, `assets/camera-profiles/X-T4.json` | Fujifilm camera colour profiles (matrix + hue/saturation/value table), built into LightCraft | LightCraft contributors; source photographs supplied by Sebastian Pfluegelmeier | original work: fitted by `lightcraft-cli calibrate` to 201 X-H2S and 545 X-T4 RAFs and their in-camera JPEGs; aggregate colour statistics only, no image content; no Adobe or third-party profile data | MIT OR Apache-2.0 | 2026-10-08 | none | +| `assets/camera-profiles/Canon_EOS_D60.json` | Canon EOS D60 camera colour profile (matrix + hue/saturation/value table), built into LightCraft | LightCraft contributors; source photographs supplied by Robert Woldberg | original work: fitted by `lightcraft-cli calibrate` to 1,424 usable EOS D60 CRWs (of 1,520, 2005 to 2014, Auto white balance) and their in-camera JPEGs; aggregate colour statistics only, no image content; no Adobe or third-party profile data | MIT OR Apache-2.0 | 2026-10-13 | none | | `assets/camera-profiles/NIKON_Z_6_2.json` | Nikon Z 6II camera colour profile (matrix + hue/saturation/value table), built into LightCraft | Michael Anderson (@endthestart) | original work: fitted by `lightcraft-cli calibrate` to 296 usable Z 6II NEFs of my own (of 299, 2024 to 2026, Standard and Auto picture controls; NIKKOR Z 20mm f/1.8 S, Z 24-70mm f/4 S and AF-S 70-200mm f/2.8G on the FTZ) and their in-camera JPEGs; aggregate colour statistics only, no image content; no Adobe or third-party profile data | MIT OR Apache-2.0 | 2026-10-13 | none | | `assets/camera-profiles/NIKON_Z_8.json` | Nikon Z 8 camera colour profile (matrix + hue/saturation/value table), built into LightCraft | Michael Anderson (@endthestart) | original work: fitted by `lightcraft-cli calibrate` to 261 usable Z 8 NEFs of my own (of 278, 2023 and 2026, nearly all Standard picture control, lossless 14-bit; NIKKOR Z 24-120mm f/4 S and AF-S 70-200mm f/2.8G on the FTZ) and their in-camera JPEGs; aggregate colour statistics only, no image content; no Adobe or third-party profile data | MIT OR Apache-2.0 | 2026-10-13 | none | | `assets/camera-profiles/NIKON_D5300.json` | Nikon D5300 camera colour profile (matrix + hue/saturation/value table), built into LightCraft | Michael Anderson (@endthestart) | original work: fitted by `lightcraft-cli calibrate` to 264 usable D5300 NEFs of my own (of 273, 2014 to 2017, mostly Standard picture control, lossy 12-bit, mostly the AF-S DX 35mm f/1.8G) and their in-camera JPEGs; aggregate colour statistics only, no image content; no Adobe or third-party profile data | MIT OR Apache-2.0 | 2026-10-13 | none | | `assets/camera-profiles/ILCE-7RM5.json` | Sony ILCE-7RM5 camera colour profile (matrix + hue/saturation/value table), built into LightCraft | Yule (Brian) Wang (@peaperfish) | original work: fitted by `lightcraft-cli calibrate` to 220 usable ILCE-7RM5 ARWs of my own (of 241, 2025 to 2026, Standard creative style; Sigma 24-70mm F2.8 DG DN II Art and Sony FE 200-600mm F5.6-6.3 G OSS) and their in-camera JPEGs; aggregate colour statistics only, no image content; no Adobe or third-party profile data | MIT OR Apache-2.0 | 2026-10-26 | none | | `crates/raw/src/spectral_table.rs` | Camera colour matrices (DNG ColorMatrix1/2 and ForwardMatrix1/2 for Standard Illuminant A and D65) for 52 camera models, and the model alias list | Derived by LightCraft contributors from rawtoaces-data (Academy Software Foundation): camera spectral sensitivities measured by Weta Digital (44 cameras), scitech (7) and Jonathon Irons at the National Physical Laboratory (Nikon D5100); training reflectances; CIE 1931 colour-matching functions (CIE, CC-BY-4.0, as shipped in rawtoaces-data) | https://github.com/AcademySoftwareFoundation/rawtoaces-data, tag v1.1.0, commit 5cfa53707b053594b2d0d48e8019fb56e6582d6c | Apache-2.0 (`LICENSE-APACHE`); the colour-matching functions CC-BY-4.0 | 2026-10-08 | generated by `tools/spectral_camera_table.py`: a 3×3 matrix per illuminant fitted to the spectral data (no measurement copied verbatim); aliases copied from `data/aliases.json`; no Adobe or third-party camera matrix | +| `crates/raw/src/chart_table.rs` | Chart-measured camera colour matrices (DNG ColorMatrix1/2 and ForwardMatrix1/2 for Standard Illuminant A and D50) for the Canon EOS D60 | LightCraft contributors; ColorChecker photographs taken by Robert Woldberg on the maintainer's EOS D60 | original work: fitted to our own CRWs of a ColorChecker Classic (post-November-2014 formulation) under a ~2,900 K tungsten bulb (11 frames) and direct sun (~4,850 K, 20 frames); reference colours: X-Rite's published L*a*b* (D50) for the chart, as packaged by [colour-science](https://github.com/colour-science/colour) (BSD-3-Clause), used for fitting only and not shipped; method in `clean-room/crw/10-chart-calibration.md` | MIT OR Apache-2.0 | 2026-10-25 | kept by hand: a 3×3 matrix per illuminant fitted on chromaticity with neutral held at D50; no Adobe or third-party camera matrix, no number from a GPL raw decoder | | `assets/camera-tone/sony-dro-off.json` | Sony global tone curve with the Dynamic Range Optimizer off (32 knots), built into LightCraft for ARWs shot with DRO on | LightCraft contributors; source photographs by raw.pixls.us contributors | original work: tone curve quantile-matched over the pooled pixel pairs of 12 CC0 raw.pixls.us ARWs (DRO off, Standard creative style; ILCE-3500, -5000, -6600, -7CR, -7M3 ×3, -7S, -9M2, ILCA-77M2, SLT-A57, NEX-F3) and their embedded camera JPEGs; the file lists each source URL and SHA-256 and how the curve was derived (see also `docs/camera-preview-colour.md`); aggregate tone statistics only, no image content; no Adobe or third-party profile data | MIT OR Apache-2.0 (sources CC0) | 2026-10-09 | none | | `crates/scenes/` (generated images) | Procedural demo photographs | LightCraft contributors | original work (generated at runtime, no source imagery) | MIT OR Apache-2.0 | 2026-09-30 | n/a | | `crates/ui-egui/src/icons.rs` | UI icons drawn as vector paths in code | LightCraft contributors | original work | MIT OR Apache-2.0 | 2026-09-30 | n/a | diff --git a/assets/camera-profiles/Canon_EOS_D60.json b/assets/camera-profiles/Canon_EOS_D60.json new file mode 100644 index 0000000000..c5d0b08cf2 --- /dev/null +++ b/assets/camera-profiles/Canon_EOS_D60.json @@ -0,0 +1 @@ +{"version":1,"model":"Canon EOS D60","files":1424,"samples":5140322,"matrix":[[1.13012,-0.360203,0.234919],[-0.0483286,1.21254,-0.166746],[-0.0238897,-0.834382,1.86577]],"hue_sat":{"hue_divisions":72,"sat_divisions":5,"val_divisions":5,"data":[[0.0,1.0,1.0],[8.29241,1.23189,1.0],[6.24278,1.25426,1.0],[5.85238,1.20774,1.0],[3.78008,1.10233,1.0],[0.0,1.0,1.0],[7.49695,1.19919,1.0],[4.58151,1.21364,1.0],[3.60262,1.15474,1.0],[2.74306,1.07068,1.0],[0.0,1.0,1.0],[6.97455,1.16634,1.0],[3.67004,1.18558,1.0],[1.9923,1.12524,1.0],[0.245554,0.982395,1.0],[0.0,1.0,1.0],[6.42589,1.13738,1.0],[2.66266,1.14834,1.0],[0.226251,1.09372,1.0],[-2.23194,0.930707,1.0],[0.0,1.0,1.0],[6.09352,1.1248,1.0],[1.65699,1.12876,1.0],[-1.52059,1.07635,1.0],[-3.87766,0.926268,1.0],[0.0,1.0,1.0],[6.2146,1.10729,1.0],[1.13044,1.11602,1.0],[-2.4179,1.08135,1.0],[-4.69366,0.96409,1.0],[0.0,1.0,1.0],[6.73255,1.09443,1.0],[1.15502,1.09451,1.0],[-2.95449,1.05376,1.0],[-5.86916,0.954201,1.0],[0.0,1.0,1.0],[7.0143,1.0883,1.0],[1.25698,1.07945,1.0],[-3.3853,1.03275,1.0],[-6.46471,0.9465,1.0],[0.0,1.0,1.0],[7.44031,1.08414,1.0],[1.9515,1.06401,1.0],[-3.08108,1.00026,1.0],[-6.03475,0.917114,1.0],[0.0,1.0,1.0],[8.29527,1.07925,1.0],[2.86018,1.03974,1.0],[-2.25228,0.96454,1.0],[-4.98936,0.860481,1.0],[0.0,1.0,1.0],[9.14683,1.08392,1.0],[3.8335,1.01361,1.0],[-1.06889,0.935075,1.0],[-4.04616,0.821455,1.0],[0.0,1.0,1.0],[9.19479,1.10285,1.0],[4.68727,1.00463,1.0],[0.536387,0.911486,1.0],[-2.795,0.795914,1.0],[0.0,1.0,1.0],[8.67599,1.12913,1.0],[5.14131,1.01389,1.0],[1.77075,0.910094,1.0],[-0.965505,0.813756,1.0],[0.0,1.0,1.0],[7.95628,1.12916,1.0],[5.32373,1.0083,1.0],[2.91716,0.905281,1.0],[1.05035,0.834887,1.0],[0.0,1.0,1.0],[6.83544,1.13214,1.0],[4.95639,1.00769,1.0],[3.81032,0.903303,1.0],[2.8937,0.82685,1.0],[0.0,1.0,1.0],[5.89142,1.1369,1.0],[4.55603,1.00893,1.0],[4.04927,0.902735,1.0],[3.59749,0.8313,1.0],[0.0,1.0,1.0],[5.07797,1.14498,1.0],[4.14717,1.01358,1.0],[3.95316,0.909713,1.0],[4.03064,0.834461,1.0],[0.0,1.0,1.0],[3.93584,1.15444,1.0],[3.29081,1.02539,1.0],[3.28057,0.922408,1.0],[3.7798,0.840035,1.0],[0.0,1.0,1.0],[2.45431,1.17195,1.0],[2.1184,1.04565,1.0],[2.31804,0.94015,1.0],[2.84532,0.862496,1.0],[0.0,1.0,1.0],[0.914128,1.1919,1.0],[0.658994,1.06124,1.0],[1.06903,0.95232,1.0],[1.60007,0.890999,1.0],[0.0,1.0,1.0],[-0.709287,1.20875,1.0],[-0.970683,1.0793,1.0],[-0.571268,0.969075,1.0],[-0.0688885,0.893104,1.0],[0.0,1.0,1.0],[-2.56506,1.23369,1.0],[-2.97984,1.10163,1.0],[-2.79742,0.983848,1.0],[-2.01335,0.892256,1.0],[0.0,1.0,1.0],[-4.47609,1.26079,1.0],[-4.91221,1.12068,1.0],[-4.5471,1.00002,1.0],[-2.72325,0.931381,1.0],[0.0,1.0,1.0],[-6.07811,1.27839,1.0],[-6.49836,1.12664,1.0],[-5.47092,0.99826,1.0],[-1.83561,0.972328,1.0],[0.0,1.0,1.0],[-8.37879,1.29932,1.0],[-8.93662,1.13395,1.0],[-7.32093,1.02059,1.0],[-0.98037,0.994534,1.0],[0.0,1.0,1.0],[-10.2729,1.25707,1.0],[-11.0599,1.09129,1.0],[-9.32287,1.00616,1.0],[-1.21689,0.994275,1.0],[0.0,1.0,1.0],[-11.9931,1.22624,1.0],[-12.4979,1.05021,1.0],[-10.2083,0.969313,1.0],[-1.172,0.991243,1.0],[0.0,1.0,1.0],[-13.5442,1.18901,1.0],[-13.5809,1.00396,1.0],[-10.7308,0.93446,1.0],[-1.1717,0.98724,1.0],[0.0,1.0,1.0],[-14.1202,1.16045,1.0],[-14.1451,0.982771,1.0],[-10.5188,0.911345,1.0],[-1.10721,0.983353,1.0],[0.0,1.0,1.0],[-14.5581,1.16209,1.0],[-13.8126,0.986909,1.0],[-8.30721,0.90898,1.0],[-0.995621,0.97911,1.0],[0.0,1.0,1.0],[-14.4013,1.1613,1.0],[-13.2596,0.979666,1.0],[-8.95671,0.890826,1.0],[-2.10024,0.967003,1.0],[0.0,1.0,1.0],[-15.1417,1.16939,1.0],[-13.2246,0.977241,1.0],[-9.7885,0.871629,1.0],[-2.78003,0.957243,1.0],[0.0,1.0,1.0],[-16.0188,1.15745,1.0],[-14.0864,0.974714,1.0],[-10.4183,0.871201,1.0],[-2.37086,0.964302,1.0],[0.0,1.0,1.0],[-16.2546,1.14581,1.0],[-13.912,0.987045,1.0],[-8.19204,0.901434,1.0],[-1.1791,0.982516,1.0],[0.0,1.0,1.0],[-16.3253,1.14274,1.0],[-13.1974,0.996884,1.0],[-7.37707,0.909881,1.0],[-0.796766,0.988333,1.0],[0.0,1.0,1.0],[-17.4833,1.13741,1.0],[-13.1058,0.977386,1.0],[-5.85941,0.919339,1.0],[-0.352557,0.99447,1.0],[0.0,1.0,1.0],[-17.5235,1.10838,1.0],[-13.7099,0.974525,1.0],[-5.10075,0.930882,1.0],[-0.176921,0.995738,1.0],[0.0,1.0,1.0],[-17.5967,1.05115,1.0],[-13.6048,0.938325,1.0],[-5.27843,0.910606,1.0],[-0.167657,0.994507,1.0],[0.0,1.0,1.0],[-17.4696,0.996524,1.0],[-13.115,0.908347,1.0],[-4.95967,0.899867,1.0],[-0.174963,0.992617,1.0],[0.0,1.0,1.0],[-16.5982,0.955417,1.0],[-11.0254,0.879437,1.0],[-3.31212,0.863198,1.0],[-0.175046,0.977174,1.0],[0.0,1.0,1.0],[-15.5952,0.929258,1.0],[-8.31794,0.86823,1.0],[-0.528212,0.846517,1.0],[0.380461,0.923401,1.0],[0.0,1.0,1.0],[-14.4398,0.910204,1.0],[-8.05514,0.876305,1.0],[-0.57323,0.868118,1.0],[0.470409,0.948896,1.0],[0.0,1.0,1.0],[-13.0585,0.905534,1.0],[-7.90773,0.889057,1.0],[-0.976436,0.905932,1.0],[0.542039,0.983099,1.0],[0.0,1.0,1.0],[-11.876,0.908437,1.0],[-7.06937,0.903432,1.0],[-0.539651,0.916127,1.0],[0.779286,0.983595,1.0],[0.0,1.0,1.0],[-10.0702,0.929172,1.0],[-5.39408,0.937425,1.0],[-0.2061,0.920171,1.0],[1.17455,0.972633,1.0],[0.0,1.0,1.0],[-8.19665,0.965734,1.0],[-3.79008,0.995854,1.0],[0.735503,0.977993,1.0],[2.47582,0.981799,1.0],[0.0,1.0,1.0],[-6.81135,0.995992,1.0],[-2.14588,1.04353,1.0],[2.66441,1.05104,1.0],[3.71856,1.02802,1.0],[0.0,1.0,1.0],[-6.09325,1.01737,1.0],[-1.16553,1.07761,1.0],[3.22399,1.09269,1.0],[3.60392,1.06285,1.0],[0.0,1.0,1.0],[-5.67983,1.00236,1.0],[-1.59948,1.08043,1.0],[1.772,1.1166,1.0],[1.50147,1.05603,1.0],[0.0,1.0,1.0],[-4.93455,0.948406,1.0],[-2.02886,1.03546,1.0],[0.440492,1.10114,1.0],[0.44623,1.03065,1.0],[0.0,1.0,1.0],[-4.05699,0.914275,1.0],[-1.90483,0.982593,1.0],[-0.604556,1.0474,1.0],[-0.0390689,1.00817,1.0],[0.0,1.0,1.0],[-3.08093,0.903908,1.0],[-1.98686,1.00641,1.0],[-1.94429,1.08972,1.0],[-0.352449,1.01615,1.0],[0.0,1.0,1.0],[-2.73077,0.91307,1.0],[-2.44839,1.03758,1.0],[-2.63185,1.10403,1.0],[-0.49201,1.01805,1.0],[0.0,1.0,1.0],[-2.38881,0.934744,1.0],[-2.57865,1.0511,1.0],[-3.04775,1.10985,1.0],[-0.586879,1.01897,1.0],[0.0,1.0,1.0],[-1.27415,0.944475,1.0],[-1.86686,1.05548,1.0],[-2.23726,1.08935,1.0],[-0.228978,1.00814,1.0],[0.0,1.0,1.0],[-0.101355,0.961184,1.0],[-0.934238,1.06758,1.0],[-1.13534,1.06534,1.0],[-0.0561888,1.00339,1.0],[0.0,1.0,1.0],[0.598274,0.984285,1.0],[-1.06223,1.07669,1.0],[-0.945264,1.05627,1.0],[0.00985705,1.00242,1.0],[0.0,1.0,1.0],[2.04951,0.986024,1.0],[-0.267861,1.07427,1.0],[-0.73815,1.05684,1.0],[0.00245078,1.00274,1.0],[0.0,1.0,1.0],[2.08883,1.01304,1.0],[0.151963,1.08506,1.0],[-0.241507,1.05953,1.0],[0.00193501,1.00292,1.0],[0.0,1.0,1.0],[1.83224,1.04552,1.0],[0.122697,1.08099,1.0],[-0.443897,1.03705,1.0],[0.00525946,1.00164,1.0],[0.0,1.0,1.0],[2.955,1.06865,1.0],[2.40293,1.10632,1.0],[1.21487,1.03978,1.0],[0.116631,1.00179,1.0],[0.0,1.0,1.0],[4.34913,1.07975,1.0],[3.83869,1.11183,1.0],[2.71629,1.04953,1.0],[0.273693,1.00284,1.0],[0.0,1.0,1.0],[4.74482,1.08215,1.0],[4.72065,1.10431,1.0],[3.77532,1.04093,1.0],[0.493566,1.00304,1.0],[0.0,1.0,1.0],[5.25777,1.07169,1.0],[5.32614,1.09942,1.0],[5.06916,1.04884,1.0],[0.993296,1.00533,1.0],[0.0,1.0,1.0],[5.88163,1.07401,1.0],[6.07869,1.10391,1.0],[5.83284,1.05936,1.0],[1.42654,1.0069,1.0],[0.0,1.0,1.0],[6.90312,1.08396,1.0],[6.94645,1.10811,1.0],[6.19738,1.06095,1.0],[1.82831,1.00748,1.0],[0.0,1.0,1.0],[7.44771,1.07582,1.0],[6.65837,1.09613,1.0],[6.27648,1.05517,1.0],[2.12399,1.0076,1.0],[0.0,1.0,1.0],[7.31406,1.06821,1.0],[6.34729,1.08126,1.0],[6.19796,1.04675,1.0],[2.07171,1.00504,1.0],[0.0,1.0,1.0],[8.19827,1.08887,1.0],[6.47189,1.0915,1.0],[6.167,1.04997,1.0],[1.80019,1.00482,1.0],[0.0,1.0,1.0],[9.41006,1.12278,1.0],[8.03371,1.13711,1.0],[7.38094,1.09474,1.0],[2.10397,1.01352,1.0],[0.0,1.0,1.0],[9.65947,1.16005,1.0],[8.6464,1.18328,1.0],[8.37811,1.14689,1.0],[2.88382,1.03414,1.0],[0.0,1.0,1.0],[9.04497,1.20326,1.0],[7.86209,1.22425,1.0],[8.18499,1.19391,1.0],[4.23855,1.08138,1.0],[0.0,1.0,1.0],[6.45737,1.22953,1.0],[5.83506,1.24649,1.0],[6.04989,1.19909,1.0],[5.62245,1.14814,1.0],[0.0,1.0,1.0],[5.52039,1.20235,1.0],[3.96584,1.21201,1.0],[3.63405,1.1421,1.0],[3.12661,1.07917,1.0],[0.0,1.0,1.0],[4.86834,1.16794,1.0],[2.70659,1.19194,1.0],[1.48174,1.10776,1.0],[-0.12763,0.979172,1.0],[0.0,1.0,1.0],[4.31491,1.1454,1.0],[1.70696,1.16806,1.0],[-0.477717,1.10476,1.0],[-2.56979,0.966709,1.0],[0.0,1.0,1.0],[3.83196,1.12956,1.0],[0.728633,1.14769,1.0],[-1.93909,1.1025,1.0],[-4.26165,0.977716,1.0],[0.0,1.0,1.0],[3.82294,1.11173,1.0],[0.155235,1.12776,1.0],[-2.84614,1.09368,1.0],[-5.03384,1.00496,1.0],[0.0,1.0,1.0],[4.33193,1.09533,1.0],[0.0691161,1.10426,1.0],[-3.42321,1.06232,1.0],[-6.33353,0.975445,1.0],[0.0,1.0,1.0],[4.90996,1.08498,1.0],[0.292905,1.08392,1.0],[-3.73154,1.03591,1.0],[-6.76969,0.956434,1.0],[0.0,1.0,1.0],[5.22443,1.07254,1.0],[0.918505,1.06375,1.0],[-3.25514,1.01021,1.0],[-6.27866,0.936284,1.0],[0.0,1.0,1.0],[5.71992,1.05618,1.0],[1.63799,1.04045,1.0],[-2.16294,0.981528,1.0],[-4.85659,0.891864,1.0],[0.0,1.0,1.0],[6.24525,1.05283,1.0],[2.15152,1.01757,1.0],[-1.23229,0.950332,1.0],[-4.04973,0.837257,1.0],[0.0,1.0,1.0],[6.48731,1.06455,1.0],[2.95282,1.00357,1.0],[-0.13344,0.918371,1.0],[-3.26727,0.795304,1.0],[0.0,1.0,1.0],[6.43304,1.08659,1.0],[3.60322,1.00417,1.0],[1.1116,0.908953,1.0],[-1.17154,0.803847,1.0],[0.0,1.0,1.0],[6.08314,1.08502,1.0],[3.98195,0.996781,1.0],[2.13832,0.903213,1.0],[0.601765,0.815392,1.0],[0.0,1.0,1.0],[5.38634,1.08306,1.0],[3.96838,0.99318,1.0],[3.08024,0.902371,1.0],[2.33057,0.816005,1.0],[0.0,1.0,1.0],[4.70801,1.08804,1.0],[3.6389,0.992919,1.0],[3.14261,0.902246,1.0],[2.80019,0.823245,1.0],[0.0,1.0,1.0],[3.9373,1.09765,1.0],[3.15718,0.9982,1.0],[2.90997,0.906114,1.0],[2.98089,0.826701,1.0],[0.0,1.0,1.0],[2.93423,1.10659,1.0],[2.43397,1.00625,1.0],[2.3901,0.914244,1.0],[2.81925,0.833616,1.0],[0.0,1.0,1.0],[1.75735,1.11926,1.0],[1.4578,1.0158,1.0],[1.62288,0.922963,1.0],[2.14895,0.847463,1.0],[0.0,1.0,1.0],[0.467054,1.13504,1.0],[0.269281,1.02753,1.0],[0.580391,0.936603,1.0],[1.10631,0.873195,1.0],[0.0,1.0,1.0],[-0.931699,1.15249,1.0],[-1.16467,1.04976,1.0],[-0.864673,0.957196,1.0],[-0.288895,0.875365,1.0],[0.0,1.0,1.0],[-2.62064,1.18076,1.0],[-2.93156,1.08253,1.0],[-2.60906,0.974414,1.0],[-1.91468,0.861015,1.0],[0.0,1.0,1.0],[-4.33073,1.2089,1.0],[-4.69807,1.10591,1.0],[-4.24579,0.967835,1.0],[-3.39933,0.845043,1.0],[0.0,1.0,1.0],[-6.04384,1.23424,1.0],[-6.39864,1.11931,1.0],[-5.6838,0.948674,1.0],[-4.78474,0.83504,1.0],[0.0,1.0,1.0],[-8.10562,1.2573,1.0],[-8.63972,1.12984,1.0],[-8.00675,0.959973,1.0],[-5.52745,0.869055,1.0],[0.0,1.0,1.0],[-10.0076,1.2248,1.0],[-10.654,1.09686,1.0],[-10.1383,0.961011,1.0],[-5.74516,0.90956,1.0],[0.0,1.0,1.0],[-11.3225,1.18168,1.0],[-11.8645,1.05002,1.0],[-11.0067,0.921538,1.0],[-5.53332,0.907742,1.0],[0.0,1.0,1.0],[-12.3989,1.15066,1.0],[-12.6428,1.00856,1.0],[-11.5574,0.889656,1.0],[-4.47558,0.915526,1.0],[0.0,1.0,1.0],[-13.0847,1.13038,1.0],[-13.0968,0.980698,1.0],[-11.5589,0.845667,1.0],[-6.06387,0.865438,1.0],[0.0,1.0,1.0],[-13.2421,1.12309,1.0],[-12.6262,0.959127,1.0],[-10.2846,0.813384,1.0],[-7.36689,0.82578,1.0],[0.0,1.0,1.0],[-12.7795,1.11392,1.0],[-11.566,0.934485,1.0],[-10.4237,0.792341,1.0],[-9.31722,0.804662,1.0],[0.0,1.0,1.0],[-12.6769,1.10245,1.0],[-10.7995,0.914334,1.0],[-11.4312,0.776062,1.0],[-11.6932,0.779856,1.0],[0.0,1.0,1.0],[-12.8136,1.09092,1.0],[-10.714,0.913308,1.0],[-11.8132,0.780711,1.0],[-11.3633,0.79714,1.0],[0.0,1.0,1.0],[-12.9893,1.09121,1.0],[-11.3863,0.942534,1.0],[-10.8763,0.810494,1.0],[-6.38202,0.877641,1.0],[0.0,1.0,1.0],[-12.9058,1.09063,1.0],[-10.6735,0.956993,1.0],[-9.53278,0.832118,1.0],[-2.99673,0.934202,1.0],[0.0,1.0,1.0],[-13.1017,1.0857,1.0],[-9.73913,0.958602,1.0],[-7.38057,0.856439,1.0],[-1.46525,0.955774,1.0],[0.0,1.0,1.0],[-13.4686,1.06833,1.0],[-10.4883,0.951945,1.0],[-7.18973,0.852331,1.0],[-1.33411,0.939021,1.0],[0.0,1.0,1.0],[-13.5707,1.01915,1.0],[-10.3816,0.919458,1.0],[-6.11786,0.821507,1.0],[-1.47186,0.898169,1.0],[0.0,1.0,1.0],[-13.7086,0.974874,1.0],[-9.45884,0.897761,1.0],[-3.68031,0.820758,1.0],[-0.858757,0.879703,1.0],[0.0,1.0,1.0],[-13.1972,0.944081,1.0],[-7.74305,0.885551,1.0],[-1.5697,0.837698,1.0],[0.165719,0.871773,1.0],[0.0,1.0,1.0],[-11.8739,0.929549,1.0],[-4.3559,0.882459,1.0],[1.06891,0.844377,1.0],[1.67435,0.846731,1.0],[0.0,1.0,1.0],[-10.6799,0.924428,1.0],[-4.06136,0.906987,1.0],[1.52214,0.86951,1.0],[2.40795,0.868667,1.0],[0.0,1.0,1.0],[-9.5752,0.931471,1.0],[-4.20953,0.935923,1.0],[2.29417,0.909633,1.0],[4.29582,0.903491,1.0],[0.0,1.0,1.0],[-8.7303,0.938297,1.0],[-3.73491,0.954183,1.0],[2.87868,0.934722,1.0],[5.31219,0.92055,1.0],[0.0,1.0,1.0],[-7.52354,0.951013,1.0],[-2.979,0.977569,1.0],[3.17883,0.9614,1.0],[6.27338,0.941609,1.0],[0.0,1.0,1.0],[-5.61763,0.983581,1.0],[-1.54163,1.02516,1.0],[3.60014,1.01671,1.0],[7.19602,0.984591,1.0],[0.0,1.0,1.0],[-4.22545,1.01662,1.0],[0.140206,1.06957,1.0],[4.17481,1.06953,1.0],[6.1315,1.04731,1.0],[0.0,1.0,1.0],[-3.78345,1.03385,1.0],[1.05038,1.0995,1.0],[4.1045,1.10205,1.0],[5.21719,1.09109,1.0],[0.0,1.0,1.0],[-3.80075,1.02051,1.0],[0.352142,1.11178,1.0],[2.74513,1.13811,1.0],[3.42962,1.13077,1.0],[0.0,1.0,1.0],[-3.47037,0.970882,1.0],[-0.599396,1.09168,1.0],[1.13462,1.16315,1.0],[1.31077,1.15075,1.0],[0.0,1.0,1.0],[-2.70432,0.954215,1.0],[-1.59434,1.03591,1.0],[-1.19418,1.11839,1.0],[-1.10938,1.09685,1.0],[0.0,1.0,1.0],[-2.14495,0.960338,1.0],[-1.94064,1.05783,1.0],[-2.53886,1.14425,1.0],[-2.2552,1.1214,1.0],[0.0,1.0,1.0],[-2.25488,0.963303,1.0],[-2.55399,1.09327,1.0],[-3.56191,1.1645,1.0],[-3.51432,1.1431,1.0],[0.0,1.0,1.0],[-2.49663,0.984053,1.0],[-2.98283,1.11472,1.0],[-4.15624,1.17788,1.0],[-3.96794,1.14962,1.0],[0.0,1.0,1.0],[-1.63829,0.988561,1.0],[-2.32553,1.11066,1.0],[-3.29053,1.16474,1.0],[-2.03215,1.10047,1.0],[0.0,1.0,1.0],[-0.591005,0.997344,1.0],[-1.73238,1.11203,1.0],[-2.54204,1.14303,1.0],[-0.840567,1.05701,1.0],[0.0,1.0,1.0],[0.106161,1.00732,1.0],[-1.64833,1.11011,1.0],[-2.63137,1.12835,1.0],[0.000417006,1.03827,1.0],[0.0,1.0,1.0],[1.18957,1.01322,1.0],[-0.709562,1.11028,1.0],[-1.54299,1.13823,1.0],[0.341615,1.04609,1.0],[0.0,1.0,1.0],[1.26161,1.0302,1.0],[-0.130317,1.11515,1.0],[-0.760396,1.14654,1.0],[-0.377267,1.05055,1.0],[0.0,1.0,1.0],[1.34901,1.0613,1.0],[0.856557,1.11955,1.0],[1.15235,1.12433,1.0],[0.632698,1.03424,1.0],[0.0,1.0,1.0],[1.80693,1.09089,1.0],[2.41036,1.14014,1.0],[3.95601,1.11942,1.0],[1.61517,1.03991,1.0],[0.0,1.0,1.0],[2.8421,1.08909,1.0],[3.73284,1.13423,1.0],[6.61016,1.11057,1.0],[3.69954,1.04818,1.0],[0.0,1.0,1.0],[3.31884,1.08192,1.0],[4.40875,1.12051,1.0],[8.17687,1.08499,1.0],[6.46302,1.04773,1.0],[0.0,1.0,1.0],[4.07688,1.07618,1.0],[5.35406,1.11161,1.0],[9.80713,1.07613,1.0],[8.93626,1.04866,1.0],[0.0,1.0,1.0],[4.81023,1.08203,1.0],[6.14305,1.11396,1.0],[10.4516,1.07015,1.0],[10.3146,1.04211,1.0],[0.0,1.0,1.0],[5.60871,1.09277,1.0],[6.62807,1.11447,1.0],[10.8092,1.05775,1.0],[11.1733,1.03124,1.0],[0.0,1.0,1.0],[5.91878,1.09833,1.0],[6.90828,1.11233,1.0],[11.1597,1.04582,1.0],[11.7704,1.01867,1.0],[0.0,1.0,1.0],[6.18104,1.09833,1.0],[7.08648,1.11,1.0],[11.1675,1.03715,1.0],[11.8516,1.00733,1.0],[0.0,1.0,1.0],[7.00814,1.10579,1.0],[7.29881,1.11849,1.0],[10.523,1.04893,1.0],[11.0842,1.00497,1.0],[0.0,1.0,1.0],[7.8262,1.12744,1.0],[7.96552,1.14585,1.0],[10.0515,1.09656,1.0],[10.6741,1.0343,1.0],[0.0,1.0,1.0],[8.07519,1.159,1.0],[8.29985,1.17598,1.0],[9.87129,1.14577,1.0],[10.3288,1.09887,1.0],[0.0,1.0,1.0],[7.37598,1.19494,1.0],[7.56967,1.21752,1.0],[8.94372,1.19239,1.0],[9.06854,1.16421,1.0],[0.0,1.0,1.0],[3.68338,1.08531,1.0],[4.38971,1.12863,1.0],[4.73027,1.11585,1.0],[4.54314,1.09538,1.0],[0.0,1.0,1.0],[2.94821,1.06131,1.0],[2.97489,1.1026,1.0],[3.03927,1.08071,1.0],[2.63529,1.04305,1.0],[0.0,1.0,1.0],[2.57351,1.03554,1.0],[1.89741,1.07813,1.0],[1.2687,1.03162,1.0],[0.226707,0.961594,1.0],[0.0,1.0,1.0],[2.36462,1.02063,1.0],[1.33289,1.06092,1.0],[-0.269328,1.02454,1.0],[-1.87251,0.951141,1.0],[0.0,1.0,1.0],[2.14722,1.01376,1.0],[0.916703,1.05471,1.0],[-1.16994,1.03138,1.0],[-3.47602,0.955454,1.0],[0.0,1.0,1.0],[2.1531,1.00339,1.0],[0.599137,1.04111,1.0],[-1.42547,1.02755,1.0],[-3.53331,0.964634,1.0],[0.0,1.0,1.0],[2.56896,0.981761,1.0],[0.379733,1.02159,1.0],[-1.87368,1.00098,1.0],[-3.73593,0.940611,1.0],[0.0,1.0,1.0],[3.34281,0.956887,1.0],[0.562745,0.990625,1.0],[-2.00992,0.972546,1.0],[-4.03612,0.916146,1.0],[0.0,1.0,1.0],[3.70201,0.932035,1.0],[1.03031,0.958944,1.0],[-1.43057,0.936191,1.0],[-3.48989,0.878391,1.0],[0.0,1.0,1.0],[4.01699,0.909684,1.0],[1.47515,0.932379,1.0],[-0.684378,0.900747,1.0],[-2.17011,0.831407,1.0],[0.0,1.0,1.0],[4.20769,0.903911,1.0],[1.58117,0.914789,1.0],[-0.204523,0.875306,1.0],[-1.74439,0.781114,1.0],[0.0,1.0,1.0],[4.26209,0.91174,1.0],[1.95006,0.901154,1.0],[0.146487,0.838802,1.0],[-1.50293,0.73827,1.0],[0.0,1.0,1.0],[4.14572,0.928888,1.0],[2.17201,0.892381,1.0],[0.720994,0.815512,1.0],[-0.557276,0.737431,1.0],[0.0,1.0,1.0],[3.83083,0.930908,1.0],[2.22797,0.883923,1.0],[1.1286,0.809516,1.0],[0.313424,0.742822,1.0],[0.0,1.0,1.0],[3.22442,0.931112,1.0],[2.17251,0.884451,1.0],[1.58433,0.81271,1.0],[1.11012,0.743416,1.0],[0.0,1.0,1.0],[2.65218,0.937936,1.0],[1.85422,0.890641,1.0],[1.5073,0.823901,1.0],[1.23189,0.757209,1.0],[0.0,1.0,1.0],[2.1485,0.950147,1.0],[1.47256,0.898305,1.0],[1.10932,0.834142,1.0],[0.929015,0.771719,1.0],[0.0,1.0,1.0],[1.46417,0.966505,1.0],[0.892508,0.907199,1.0],[0.677007,0.84201,1.0],[0.782876,0.784345,1.0],[0.0,1.0,1.0],[0.671556,0.975774,1.0],[0.255539,0.912658,1.0],[0.306344,0.849958,1.0],[0.581909,0.791799,1.0],[0.0,1.0,1.0],[-0.232216,0.988441,1.0],[-0.603134,0.921144,1.0],[-0.460117,0.862507,1.0],[-0.107263,0.814403,1.0],[0.0,1.0,1.0],[-1.34957,1.00596,1.0],[-1.76213,0.939168,1.0],[-1.61403,0.87008,1.0],[-1.17209,0.80566,1.0],[0.0,1.0,1.0],[-2.72758,1.02624,1.0],[-3.03897,0.956089,1.0],[-2.57537,0.849434,1.0],[-2.04494,0.774777,1.0],[0.0,1.0,1.0],[-3.99996,1.04342,1.0],[-4.18515,0.958758,1.0],[-3.31966,0.816493,1.0],[-3.00571,0.765035,1.0],[0.0,1.0,1.0],[-5.35434,1.06437,1.0],[-5.34074,0.958166,1.0],[-4.18959,0.805923,1.0],[-4.129,0.769208,1.0],[0.0,1.0,1.0],[-6.98613,1.08028,1.0],[-6.77624,0.961994,1.0],[-5.50517,0.815479,1.0],[-5.09191,0.787004,1.0],[0.0,1.0,1.0],[-8.27537,1.04965,1.0],[-8.09453,0.944809,1.0],[-6.8017,0.806179,1.0],[-5.18158,0.814935,1.0],[0.0,1.0,1.0],[-9.04833,1.00809,1.0],[-8.7844,0.909025,1.0],[-6.93936,0.791674,1.0],[-4.03433,0.845474,1.0],[0.0,1.0,1.0],[-9.43181,0.98407,1.0],[-9.09251,0.890722,1.0],[-7.0911,0.804798,1.0],[-2.45967,0.906586,1.0],[0.0,1.0,1.0],[-9.45648,0.962051,1.0],[-8.89996,0.870864,1.0],[-7.59422,0.790714,1.0],[-3.89725,0.874013,1.0],[0.0,1.0,1.0],[-9.1551,0.952512,1.0],[-7.99781,0.856023,1.0],[-6.56106,0.777842,1.0],[-4.52665,0.84456,1.0],[0.0,1.0,1.0],[-8.63291,0.939113,1.0],[-6.66401,0.83436,1.0],[-6.12567,0.759722,1.0],[-5.8122,0.805741,1.0],[0.0,1.0,1.0],[-8.07018,0.924489,1.0],[-5.72503,0.825439,1.0],[-6.55667,0.755673,1.0],[-7.60626,0.766193,1.0],[0.0,1.0,1.0],[-7.71402,0.914648,1.0],[-5.55096,0.827839,1.0],[-6.1182,0.767114,1.0],[-6.56151,0.798221,1.0],[0.0,1.0,1.0],[-7.73036,0.918568,1.0],[-6.34513,0.845252,1.0],[-5.84789,0.791564,1.0],[-3.21326,0.898598,1.0],[0.0,1.0,1.0],[-7.60352,0.921108,1.0],[-5.75152,0.857972,1.0],[-4.2223,0.808735,1.0],[-0.777749,0.951292,1.0],[0.0,1.0,1.0],[-7.59302,0.921877,1.0],[-5.07845,0.866725,1.0],[-1.91403,0.825463,1.0],[0.313248,0.951153,1.0],[0.0,1.0,1.0],[-7.95059,0.913408,1.0],[-5.31852,0.857203,1.0],[-2.09618,0.808571,1.0],[-0.36965,0.939769,1.0],[0.0,1.0,1.0],[-8.04501,0.884124,1.0],[-4.00064,0.815801,1.0],[-0.552985,0.758992,1.0],[-0.290257,0.849646,1.0],[0.0,1.0,1.0],[-8.31768,0.866341,1.0],[-3.33357,0.813293,1.0],[0.157563,0.769212,1.0],[0.343628,0.817142,1.0],[0.0,1.0,1.0],[-8.30951,0.858061,1.0],[-3.22756,0.836749,1.0],[0.621114,0.809609,1.0],[0.978062,0.84691,1.0],[0.0,1.0,1.0],[-7.63892,0.855642,1.0],[-1.78416,0.856328,1.0],[1.71414,0.839884,1.0],[2.00564,0.852348,1.0],[0.0,1.0,1.0],[-6.98256,0.855364,1.0],[-1.90937,0.87686,1.0],[2.08805,0.862082,1.0],[2.68608,0.867942,1.0],[0.0,1.0,1.0],[-6.22476,0.86076,1.0],[-1.76697,0.892517,1.0],[2.75581,0.869282,1.0],[3.64017,0.861139,1.0],[0.0,1.0,1.0],[-5.58461,0.866272,1.0],[-1.16949,0.911281,1.0],[3.51652,0.901504,1.0],[4.73018,0.89384,1.0],[0.0,1.0,1.0],[-4.63899,0.874735,1.0],[-0.898044,0.924947,1.0],[3.92745,0.924477,1.0],[5.54917,0.914903,1.0],[0.0,1.0,1.0],[-3.15305,0.905493,1.0],[-0.412746,0.967576,1.0],[3.28203,0.983881,1.0],[6.10256,0.959483,1.0],[0.0,1.0,1.0],[-2.32765,0.933308,1.0],[0.518624,1.01081,1.0],[3.19822,1.03526,1.0],[4.94074,1.02466,1.0],[0.0,1.0,1.0],[-1.8871,0.94285,1.0],[1.33377,1.04564,1.0],[3.12132,1.06374,1.0],[3.97632,1.05853,1.0],[0.0,1.0,1.0],[-1.8999,0.93121,1.0],[0.969048,1.05804,1.0],[2.46869,1.0949,1.0],[2.79413,1.08503,1.0],[0.0,1.0,1.0],[-1.97726,0.894039,1.0],[0.0822964,1.02906,1.0],[1.23635,1.12734,1.0],[1.19178,1.11584,1.0],[0.0,1.0,1.0],[-1.32251,0.907478,1.0],[-0.732392,0.976431,1.0],[-0.769014,1.0757,1.0],[-0.833215,1.0751,1.0],[0.0,1.0,1.0],[-1.40729,0.925752,1.0],[-1.21162,1.00368,1.0],[-1.73984,1.09073,1.0],[-1.89858,1.09279,1.0],[0.0,1.0,1.0],[-1.81031,0.926354,1.0],[-1.71811,1.04366,1.0],[-2.54731,1.12158,1.0],[-2.84006,1.12445,1.0],[0.0,1.0,1.0],[-1.82418,0.940786,1.0],[-2.10252,1.0643,1.0],[-3.06982,1.13859,1.0],[-2.85592,1.12341,1.0],[0.0,1.0,1.0],[-1.11867,0.946146,1.0],[-1.631,1.0569,1.0],[-2.12014,1.12189,1.0],[-1.0948,1.08358,1.0],[0.0,1.0,1.0],[-0.160143,0.949616,1.0],[-1.1426,1.04576,1.0],[-1.82633,1.09789,1.0],[-0.888133,1.0567,1.0],[0.0,1.0,1.0],[0.276782,0.953904,1.0],[-0.878393,1.03139,1.0],[-1.52091,1.07285,1.0],[0.0984381,1.02982,1.0],[0.0,1.0,1.0],[0.600961,0.962362,1.0],[-0.465934,1.02903,1.0],[-1.45788,1.08222,1.0],[-0.654393,1.03748,1.0],[0.0,1.0,1.0],[0.501916,0.97851,1.0],[-0.560871,1.03624,1.0],[-1.53518,1.09508,1.0],[-1.14336,1.04042,1.0],[0.0,1.0,1.0],[0.284415,1.00531,1.0],[-0.279351,1.04784,1.0],[-0.0110145,1.08033,1.0],[0.0939488,1.03245,1.0],[0.0,1.0,1.0],[0.121363,1.02361,1.0],[0.19487,1.0638,1.0],[2.03154,1.08677,1.0],[1.16244,1.04173,1.0],[0.0,1.0,1.0],[0.478025,1.01306,1.0],[1.20917,1.05049,1.0],[3.97838,1.06899,1.0],[2.70163,1.0445,1.0],[0.0,1.0,1.0],[0.660392,1.00367,1.0],[1.64103,1.03741,1.0],[5.53692,1.05185,1.0],[5.13526,1.04052,1.0],[0.0,1.0,1.0],[1.20646,0.99897,1.0],[2.73304,1.03354,1.0],[6.67188,1.04331,1.0],[6.79749,1.0354,1.0],[0.0,1.0,1.0],[1.7191,1.00525,1.0],[3.8326,1.0395,1.0],[7.61762,1.03572,1.0],[7.7932,1.02698,1.0],[0.0,1.0,1.0],[2.40321,1.01122,1.0],[4.16662,1.0354,1.0],[7.94702,1.02485,1.0],[8.40517,1.0166,1.0],[0.0,1.0,1.0],[2.70014,1.01829,1.0],[4.68291,1.03542,1.0],[8.21642,1.01253,1.0],[8.89084,1.00328,1.0],[0.0,1.0,1.0],[2.79955,1.0167,1.0],[4.95658,1.03421,1.0],[8.31755,1.00221,1.0],[8.94719,0.992123,1.0],[0.0,1.0,1.0],[3.60667,1.02372,1.0],[5.13614,1.04037,1.0],[7.91937,0.999985,1.0],[8.71567,0.984859,1.0],[0.0,1.0,1.0],[4.30411,1.03045,1.0],[5.29894,1.0538,1.0],[7.10184,1.02433,1.0],[8.33043,0.991609,1.0],[0.0,1.0,1.0],[4.39741,1.04119,1.0],[5.5808,1.06804,1.0],[7.20042,1.05636,1.0],[8.38559,1.03146,1.0],[0.0,1.0,1.0],[4.06608,1.06103,1.0],[5.5966,1.10289,1.0],[7.05727,1.1009,1.0],[7.5007,1.09021,1.0],[0.0,1.0,1.0],[1.80714,0.862232,1.0],[2.57435,0.96193,1.0],[2.69156,0.993122,1.0],[2.35223,0.985233,1.0],[0.0,1.0,1.0],[1.66212,0.841201,1.0],[2.13529,0.939288,1.0],[2.14828,0.968632,1.0],[1.92574,0.942215,1.0],[0.0,1.0,1.0],[1.73126,0.829669,1.0],[1.61753,0.886622,1.0],[1.64417,0.899945,1.0],[1.92043,0.873032,1.0],[0.0,1.0,1.0],[1.84088,0.822886,1.0],[1.78624,0.866582,1.0],[1.58812,0.902691,1.0],[1.72774,0.874351,1.0],[0.0,1.0,1.0],[2.04344,0.818351,1.0],[2.08533,0.85138,1.0],[2.25818,0.856605,1.0],[0.768175,0.865097,1.0],[0.0,1.0,1.0],[2.19654,0.804209,1.0],[2.03698,0.840288,1.0],[2.44899,0.839691,1.0],[1.61015,0.838124,1.0],[0.0,1.0,1.0],[2.67957,0.772528,1.0],[1.99182,0.820889,1.0],[1.53375,0.851328,1.0],[0.782918,0.852971,1.0],[0.0,1.0,1.0],[3.39254,0.72266,1.0],[2.26683,0.776186,1.0],[1.65109,0.811055,1.0],[1.27951,0.811585,1.0],[0.0,1.0,1.0],[3.79197,0.69998,1.0],[2.48564,0.75141,1.0],[1.26637,0.790085,1.0],[0.9583,0.776468,1.0],[0.0,1.0,1.0],[3.75679,0.707483,1.0],[2.39234,0.749819,1.0],[1.26065,0.777822,1.0],[1.23194,0.743045,1.0],[0.0,1.0,1.0],[3.68285,0.721718,1.0],[1.99529,0.763244,1.0],[1.28744,0.759051,1.0],[1.41618,0.697818,1.0],[0.0,1.0,1.0],[3.55451,0.734759,1.0],[1.93232,0.74931,1.0],[1.21702,0.70825,1.0],[0.993047,0.662823,1.0],[0.0,1.0,1.0],[3.21034,0.749757,1.0],[1.6257,0.732309,1.0],[0.955119,0.685328,1.0],[0.454537,0.660033,1.0],[0.0,1.0,1.0],[2.49107,0.756638,1.0],[1.22866,0.732036,1.0],[0.687176,0.687395,1.0],[0.32915,0.666885,1.0],[0.0,1.0,1.0],[1.75801,0.760552,1.0],[0.927357,0.736289,1.0],[0.468821,0.686011,1.0],[0.365004,0.663181,1.0],[0.0,1.0,1.0],[1.01564,0.767492,1.0],[0.524494,0.745355,1.0],[0.246019,0.695487,1.0],[0.0703193,0.667101,1.0],[0.0,1.0,1.0],[0.490832,0.779727,1.0],[0.115268,0.755236,1.0],[-0.20347,0.71657,1.0],[-0.486117,0.686975,1.0],[0.0,1.0,1.0],[-0.0574273,0.792251,1.0],[-0.416134,0.767277,1.0],[-0.647007,0.73117,1.0],[-0.770428,0.700426,1.0],[0.0,1.0,1.0],[-0.757924,0.80457,1.0],[-0.908808,0.777163,1.0],[-0.940719,0.737997,1.0],[-0.979114,0.706816,1.0],[0.0,1.0,1.0],[-1.60192,0.81767,1.0],[-1.58307,0.78978,1.0],[-1.41954,0.758826,1.0],[-1.2767,0.733849,1.0],[0.0,1.0,1.0],[-2.18358,0.829051,1.0],[-2.4119,0.800002,1.0],[-2.18405,0.768265,1.0],[-1.71947,0.734251,1.0],[0.0,1.0,1.0],[-3.24689,0.84405,1.0],[-3.17718,0.806693,1.0],[-2.51133,0.748202,1.0],[-2.14749,0.712745,1.0],[0.0,1.0,1.0],[-4.11575,0.853054,1.0],[-3.5877,0.79966,1.0],[-2.7728,0.734278,1.0],[-2.57275,0.711773,1.0],[0.0,1.0,1.0],[-4.94706,0.861959,1.0],[-4.15591,0.798372,1.0],[-3.18771,0.74273,1.0],[-2.96267,0.750222,1.0],[0.0,1.0,1.0],[-5.64839,0.865694,1.0],[-4.71823,0.797056,1.0],[-3.65506,0.758248,1.0],[-2.48082,0.83958,1.0],[0.0,1.0,1.0],[-6.82874,0.843687,1.0],[-5.52966,0.782379,1.0],[-3.96698,0.747026,1.0],[-1.75201,0.867586,1.0],[0.0,1.0,1.0],[-7.52278,0.806458,1.0],[-6.40324,0.765556,1.0],[-3.86767,0.771171,1.0],[-0.90734,0.928701,1.0],[0.0,1.0,1.0],[-7.36489,0.780066,1.0],[-6.4182,0.748836,1.0],[-3.42398,0.813074,1.0],[-0.199601,0.985392,1.0],[0.0,1.0,1.0],[-7.06767,0.769338,1.0],[-6.11923,0.736279,1.0],[-2.80801,0.789549,1.0],[-0.173737,0.981272,1.0],[0.0,1.0,1.0],[-6.98719,0.761335,1.0],[-5.60103,0.72847,1.0],[-2.32286,0.763431,1.0],[-0.206355,0.972705,1.0],[0.0,1.0,1.0],[-7.19227,0.753611,1.0],[-5.11719,0.725632,1.0],[-2.22272,0.739503,1.0],[-0.394778,0.950964,1.0],[0.0,1.0,1.0],[-6.78646,0.751239,1.0],[-4.81011,0.730982,1.0],[-2.25718,0.749349,1.0],[-0.564096,0.931121,1.0],[0.0,1.0,1.0],[-6.14383,0.743367,1.0],[-4.74665,0.733849,1.0],[-2.10399,0.761636,1.0],[-0.20149,0.940535,1.0],[0.0,1.0,1.0],[-6.01653,0.73872,1.0],[-5.00084,0.736255,1.0],[-1.85464,0.824293,1.0],[-0.0843571,0.987363,1.0],[0.0,1.0,1.0],[-6.06608,0.741158,1.0],[-4.75158,0.734706,1.0],[-0.418244,0.816448,1.0],[0.0738295,0.989608,1.0],[0.0,1.0,1.0],[-6.1513,0.745672,1.0],[-3.24496,0.716605,1.0],[1.29638,0.744335,1.0],[0.263942,0.980017,1.0],[0.0,1.0,1.0],[-5.44565,0.731198,1.0],[-0.495605,0.681438,1.0],[1.99363,0.683864,1.0],[0.288026,0.954665,1.0],[0.0,1.0,1.0],[-4.20029,0.703329,1.0],[0.747765,0.678139,1.0],[1.68012,0.683816,1.0],[0.691829,0.85211,1.0],[0.0,1.0,1.0],[-5.59689,0.701871,1.0],[-0.30376,0.700292,1.0],[1.02081,0.71003,1.0],[0.57095,0.83763,1.0],[0.0,1.0,1.0],[-7.00129,0.695238,1.0],[-2.80194,0.723937,1.0],[0.26524,0.753078,1.0],[0.290073,0.905559,1.0],[0.0,1.0,1.0],[-6.76136,0.694525,1.0],[-2.51014,0.743115,1.0],[0.669437,0.788888,1.0],[0.509218,0.905682,1.0],[0.0,1.0,1.0],[-5.76779,0.696908,1.0],[-1.74829,0.747574,1.0],[0.64116,0.772713,1.0],[0.705368,0.846673,1.0],[0.0,1.0,1.0],[-5.23204,0.696789,1.0],[-1.38688,0.751786,1.0],[1.04421,0.780137,1.0],[1.29981,0.816658,1.0],[0.0,1.0,1.0],[-4.80973,0.701173,1.0],[-1.49155,0.765564,1.0],[1.48641,0.825689,1.0],[1.8829,0.856319,1.0],[0.0,1.0,1.0],[-3.98407,0.711682,1.0],[-1.55931,0.772302,1.0],[1.48491,0.840475,1.0],[2.16826,0.863431,1.0],[0.0,1.0,1.0],[-2.96718,0.729664,1.0],[-1.45556,0.785341,1.0],[0.658648,0.856963,1.0],[1.93779,0.887031,1.0],[0.0,1.0,1.0],[-2.41039,0.739762,1.0],[-0.895293,0.822435,1.0],[0.524603,0.90053,1.0],[1.74269,0.941794,1.0],[0.0,1.0,1.0],[-2.04427,0.746417,1.0],[-0.347337,0.8665,1.0],[0.82932,0.938689,1.0],[1.65256,0.970226,1.0],[0.0,1.0,1.0],[-1.42486,0.757715,1.0],[-0.000267224,0.869143,1.0],[1.31949,0.982208,1.0],[1.55689,0.996697,1.0],[0.0,1.0,1.0],[-0.848812,0.734082,1.0],[0.0114361,0.804928,1.0],[0.395743,0.977226,1.0],[0.206862,1.0105,1.0],[0.0,1.0,1.0],[-0.0803961,0.736191,1.0],[-0.127857,0.812698,1.0],[-0.476354,0.950943,1.0],[-0.570623,0.991673,1.0],[0.0,1.0,1.0],[-0.556175,0.764348,1.0],[-0.429436,0.867389,1.0],[-0.628538,0.969159,1.0],[-0.51369,0.99939,1.0],[0.0,1.0,1.0],[-0.688107,0.797483,1.0],[-0.666583,0.932097,1.0],[-1.0186,1.00479,1.0],[-0.822168,1.01685,1.0],[0.0,1.0,1.0],[-0.289872,0.809868,1.0],[-0.812629,0.938043,1.0],[-1.45898,1.03583,1.0],[-0.795228,1.02689,1.0],[0.0,1.0,1.0],[0.133498,0.814392,1.0],[-0.69441,0.921026,1.0],[-1.77182,1.0374,1.0],[-0.82135,1.01854,1.0],[0.0,1.0,1.0],[0.844359,0.810612,1.0],[-0.33815,0.899531,1.0],[-1.57377,0.998981,1.0],[-0.548347,1.00352,1.0],[0.0,1.0,1.0],[1.04141,0.820516,1.0],[-0.185627,0.89876,1.0],[-1.04561,0.998034,1.0],[-0.309933,1.00361,1.0],[0.0,1.0,1.0],[0.35477,0.839484,1.0],[-0.86123,0.910014,1.0],[-1.75893,1.00497,1.0],[-0.433708,1.004,1.0],[0.0,1.0,1.0],[0.0667524,0.854932,1.0],[-1.03097,0.913445,1.0],[-0.78467,1.00204,1.0],[-0.0517986,1.00241,1.0],[0.0,1.0,1.0],[0.306667,0.883005,1.0],[-0.578596,0.925849,1.0],[-0.588702,1.00264,1.0],[-0.0686681,1.00274,1.0],[0.0,1.0,1.0],[-0.873341,0.893873,1.0],[-1.25905,0.933786,1.0],[0.200431,1.00432,1.0],[0.146782,1.00325,1.0],[0.0,1.0,1.0],[-0.919506,0.88949,1.0],[-1.0804,0.926157,1.0],[0.651799,0.990702,1.0],[0.233688,1.00193,1.0],[0.0,1.0,1.0],[-0.858609,0.878817,1.0],[-0.768885,0.920294,1.0],[2.10662,0.995863,1.0],[1.42343,1.00568,1.0],[0.0,1.0,1.0],[-1.03588,0.867559,1.0],[-0.0930043,0.921591,1.0],[2.87823,0.991301,1.0],[2.47573,1.00262,1.0],[0.0,1.0,1.0],[-0.531328,0.869942,1.0],[0.819605,0.926484,1.0],[3.2611,0.992084,1.0],[3.02627,1.00026,1.0],[0.0,1.0,1.0],[0.206652,0.873395,1.0],[1.18531,0.927259,1.0],[3.77087,0.988596,1.0],[3.92548,0.996875,1.0],[0.0,1.0,1.0],[0.80955,0.867401,1.0],[1.55215,0.934242,1.0],[3.98773,0.981408,1.0],[4.51641,0.988098,1.0],[0.0,1.0,1.0],[1.01735,0.856204,1.0],[2.01152,0.92966,1.0],[4.08073,0.968357,1.0],[4.46964,0.974428,1.0],[0.0,1.0,1.0],[1.71918,0.859677,1.0],[2.24653,0.928946,1.0],[3.7394,0.958318,1.0],[4.40235,0.966491,1.0],[0.0,1.0,1.0],[1.99937,0.861921,1.0],[2.94313,0.954898,1.0],[3.44516,0.961366,1.0],[3.95849,0.960993,1.0],[0.0,1.0,1.0],[1.43869,0.84255,1.0],[3.05803,0.956206,1.0],[3.76042,0.97624,1.0],[3.41303,0.967518,1.0],[0.0,1.0,1.0],[1.48723,0.844662,1.0],[2.64368,0.926592,1.0],[3.26043,0.958098,1.0],[2.76276,0.967112,1.0],[0.0,1.0,1.0],[0.0855342,0.700066,1.0],[-1.9237,0.708879,1.0],[-2.78949,0.718593,1.0],[-2.34799,0.790328,1.0],[0.0,1.0,1.0],[1.05637,0.680044,1.0],[0.82885,0.686378,1.0],[0.844709,0.71335,1.0],[2.41146,0.753575,1.0],[0.0,1.0,1.0],[1.95218,0.664727,1.0],[2.4404,0.687557,1.0],[5.31906,0.758155,1.0],[6.49187,0.789878,1.0],[0.0,1.0,1.0],[3.03417,0.634878,1.0],[3.89064,0.641277,1.0],[6.88372,0.750011,1.0],[7.766,0.784769,1.0],[0.0,1.0,1.0],[3.66006,0.6177,1.0],[5.65008,0.60974,1.0],[11.9503,0.585009,1.0],[12.933,0.633394,1.0],[0.0,1.0,1.0],[3.76755,0.61906,1.0],[6.18175,0.614775,1.0],[11.8745,0.582563,1.0],[13.9328,0.578158,1.0],[0.0,1.0,1.0],[4.19052,0.610445,1.0],[5.39299,0.620521,1.0],[8.41895,0.635778,1.0],[9.78372,0.659453,1.0],[0.0,1.0,1.0],[4.80778,0.583936,1.0],[5.18478,0.602629,1.0],[7.88045,0.627236,1.0],[9.8036,0.645707,1.0],[0.0,1.0,1.0],[4.83847,0.572987,1.0],[4.8768,0.589749,1.0],[6.32586,0.611775,1.0],[8.69008,0.609703,1.0],[0.0,1.0,1.0],[4.34984,0.596177,1.0],[4.07081,0.60799,1.0],[5.14482,0.622675,1.0],[7.80759,0.60006,1.0],[0.0,1.0,1.0],[4.02009,0.618601,1.0],[3.07622,0.647895,1.0],[4.2903,0.634044,1.0],[6.77634,0.598976,1.0],[0.0,1.0,1.0],[3.7232,0.629488,1.0],[2.61576,0.644909,1.0],[3.12738,0.622353,1.0],[4.00518,0.607437,1.0],[0.0,1.0,1.0],[2.80417,0.648748,1.0],[1.58566,0.650354,1.0],[1.78385,0.633291,1.0],[1.58031,0.629079,1.0],[0.0,1.0,1.0],[1.51484,0.66637,1.0],[0.584125,0.662797,1.0],[0.680099,0.642402,1.0],[0.429029,0.646365,1.0],[0.0,1.0,1.0],[0.332074,0.666594,1.0],[-0.00972684,0.665929,1.0],[-0.0428133,0.643195,1.0],[0.0283791,0.645326,1.0],[0.0,1.0,1.0],[-0.761362,0.665741,1.0],[-0.530909,0.673999,1.0],[-0.326823,0.646967,1.0],[-0.403237,0.641567,1.0],[0.0,1.0,1.0],[-1.15064,0.681169,1.0],[-0.974953,0.685852,1.0],[-1.01162,0.667857,1.0],[-1.18996,0.659085,1.0],[0.0,1.0,1.0],[-1.93238,0.705908,1.0],[-1.34358,0.701093,1.0],[-1.44249,0.682112,1.0],[-1.55416,0.678645,1.0],[0.0,1.0,1.0],[-2.7408,0.725915,1.0],[-1.85278,0.706956,1.0],[-1.76106,0.686999,1.0],[-1.93208,0.691768,1.0],[0.0,1.0,1.0],[-3.45851,0.746801,1.0],[-2.31604,0.726976,1.0],[-1.94127,0.711508,1.0],[-1.52566,0.760718,1.0],[0.0,1.0,1.0],[-2.83512,0.754194,1.0],[-2.28629,0.735078,1.0],[-2.08969,0.717271,1.0],[-1.5865,0.754468,1.0],[0.0,1.0,1.0],[-3.61196,0.775247,1.0],[-2.42242,0.745545,1.0],[-1.78826,0.732347,1.0],[-1.49177,0.768371,1.0],[0.0,1.0,1.0],[-3.72532,0.781387,1.0],[-1.86171,0.751674,1.0],[-1.34387,0.744707,1.0],[-1.1189,0.806285,1.0],[0.0,1.0,1.0],[-4.26267,0.793536,1.0],[-1.99383,0.771457,1.0],[-0.890465,0.794552,1.0],[-0.292623,0.936899,1.0],[0.0,1.0,1.0],[-4.21751,0.806125,1.0],[-2.02534,0.789889,1.0],[-0.581378,0.850651,1.0],[-0.0253143,0.984482,1.0],[0.0,1.0,1.0],[-5.08533,0.812077,1.0],[-1.6133,0.820185,1.0],[-0.259989,0.910701,1.0],[-0.0586713,0.989555,1.0],[0.0,1.0,1.0],[-5.07063,0.779668,1.0],[-1.63652,0.835421,1.0],[-0.0567593,0.95639,1.0],[-0.0142179,0.997651,1.0],[0.0,1.0,1.0],[-4.77975,0.739459,1.0],[-2.19599,0.820505,1.0],[-0.208329,0.968352,1.0],[-0.00224836,0.999526,1.0],[0.0,1.0,1.0],[-4.45449,0.737173,1.0],[-1.44549,0.802374,1.0],[0.0161031,0.953461,1.0],[0.00316718,0.999053,1.0],[0.0,1.0,1.0],[-3.89432,0.719224,1.0],[-0.601417,0.772428,1.0],[0.220387,0.931693,1.0],[0.00538454,0.998363,1.0],[0.0,1.0,1.0],[-4.77552,0.710353,1.0],[-1.46004,0.791953,1.0],[0.00282181,0.940541,1.0],[0.000668639,0.998309,1.0],[0.0,1.0,1.0],[-4.34901,0.711378,1.0],[-1.32515,0.797679,1.0],[0.0227745,0.950445,1.0],[0.00183562,0.998598,1.0],[0.0,1.0,1.0],[-5.32497,0.702745,1.0],[-2.23197,0.811713,1.0],[-0.106095,0.962117,1.0],[0.000774817,0.998715,1.0],[0.0,1.0,1.0],[-5.04468,0.691325,1.0],[-2.17082,0.824815,1.0],[-0.0538191,0.980496,1.0],[0.00180051,0.999645,1.0],[0.0,1.0,1.0],[-4.63088,0.679205,1.0],[-1.77209,0.796756,1.0],[0.192721,0.948099,1.0],[0.0122462,0.997987,1.0],[0.0,1.0,1.0],[-4.6158,0.675196,1.0],[0.306872,0.706387,1.0],[1.1143,0.85192,1.0],[0.0428345,0.994454,1.0],[0.0,1.0,1.0],[-3.34765,0.652181,1.0],[1.49239,0.644148,1.0],[1.7052,0.745098,1.0],[0.0750734,0.98784,1.0],[0.0,1.0,1.0],[-2.32353,0.629431,1.0],[1.49431,0.634761,1.0],[1.7081,0.682639,1.0],[0.162418,0.965372,1.0],[0.0,1.0,1.0],[-4.97365,0.624568,1.0],[0.203427,0.659424,1.0],[0.935012,0.729539,1.0],[0.0809343,0.975177,1.0],[0.0,1.0,1.0],[-6.58448,0.605647,1.0],[-2.85875,0.669595,1.0],[-0.0947285,0.815362,1.0],[0.014458,0.98534,1.0],[0.0,1.0,1.0],[-6.64917,0.59994,1.0],[-3.2762,0.655727,1.0],[-0.302513,0.847914,1.0],[0.0151315,0.990293,1.0],[0.0,1.0,1.0],[-5.77614,0.599647,1.0],[-1.84747,0.660109,1.0],[-0.0325114,0.732173,1.0],[0.0552754,0.928256,1.0],[0.0,1.0,1.0],[-5.31798,0.599723,1.0],[-1.50551,0.673713,1.0],[0.142132,0.732059,1.0],[0.127878,0.892765,1.0],[0.0,1.0,1.0],[-4.66564,0.59949,1.0],[-2.17359,0.659343,1.0],[-1.6744,0.719999,1.0],[-1.9808,0.849478,1.0],[0.0,1.0,1.0],[-4.10527,0.591371,1.0],[-2.93901,0.634836,1.0],[-3.54904,0.699533,1.0],[-4.82776,0.752715,1.0],[0.0,1.0,1.0],[-3.45506,0.585623,1.0],[-3.19151,0.600036,1.0],[-3.88164,0.65431,1.0],[-4.2901,0.759322,1.0],[0.0,1.0,1.0],[-3.26092,0.587924,1.0],[-3.97341,0.61119,1.0],[-5.02722,0.631102,1.0],[-4.64551,0.706705,1.0],[0.0,1.0,1.0],[-3.28463,0.585785,1.0],[-5.4167,0.605524,1.0],[-6.11549,0.618712,1.0],[-5.03231,0.683674,1.0],[0.0,1.0,1.0],[-1.2888,0.599668,1.0],[-2.93207,0.630276,1.0],[-3.90318,0.703056,1.0],[-1.95753,0.852358,1.0],[0.0,1.0,1.0],[0.584038,0.591575,1.0],[0.119869,0.635598,1.0],[-1.10532,0.805416,1.0],[-0.837605,0.930957,1.0],[0.0,1.0,1.0],[1.41123,0.612198,1.0],[0.525198,0.697601,1.0],[-0.084616,0.855263,1.0],[0.281798,0.959624,1.0],[0.0,1.0,1.0],[0.90464,0.64252,1.0],[0.204828,0.749899,1.0],[0.132037,0.89252,1.0],[0.95185,0.964429,1.0],[0.0,1.0,1.0],[1.5538,0.669261,1.0],[0.0878431,0.814625,1.0],[-0.54754,0.936992,1.0],[-0.0352334,0.982044,1.0],[0.0,1.0,1.0],[1.81385,0.68885,1.0],[0.626367,0.781457,1.0],[-0.231532,0.955163,1.0],[-0.0360823,0.998455,1.0],[0.0,1.0,1.0],[1.43438,0.719251,1.0],[0.701568,0.802556,1.0],[0.0235685,0.97262,1.0],[-0.00891454,0.999663,1.0],[0.0,1.0,1.0],[1.80045,0.732676,1.0],[0.903036,0.855378,1.0],[-0.206474,0.975566,1.0],[-0.0264155,0.997856,1.0],[0.0,1.0,1.0],[2.06827,0.75276,1.0],[1.79507,0.872885,1.0],[-0.0970723,0.981708,1.0],[-0.0387983,0.998746,1.0],[0.0,1.0,1.0],[0.625386,0.80525,1.0],[-0.212439,0.918002,1.0],[-0.206799,0.995518,1.0],[-0.0169261,0.999958,1.0],[0.0,1.0,1.0],[0.225662,0.796163,1.0],[-0.242337,0.914862,1.0],[-0.0619648,0.996788,1.0],[-0.00307031,0.999985,1.0],[0.0,1.0,1.0],[1.45977,0.858321,1.0],[0.783917,0.950581,1.0],[0.0389577,0.997767,1.0],[-0.00036868,0.999989,1.0],[0.0,1.0,1.0],[-0.00585478,0.849167,1.0],[-0.000863034,0.907505,1.0],[-0.136772,0.983267,1.0],[-0.00745626,0.9995,1.0],[0.0,1.0,1.0],[-0.823514,0.838048,1.0],[-0.73422,0.880373,1.0],[-0.53514,0.956036,1.0],[-0.0607511,0.996663,1.0],[0.0,1.0,1.0],[-0.209549,0.819245,1.0],[-0.768871,0.877592,1.0],[-0.525896,0.962725,1.0],[-0.0652702,0.997194,1.0],[0.0,1.0,1.0],[-1.65692,0.796907,1.0],[-3.78341,0.78821,1.0],[-2.9151,0.877646,1.0],[-0.381098,0.986643,1.0],[0.0,1.0,1.0],[-1.3262,0.784397,1.0],[-4.37347,0.773366,1.0],[-3.20877,0.87257,1.0],[-0.275568,0.988733,1.0],[0.0,1.0,1.0],[-0.321925,0.816727,1.0],[-2.08024,0.844289,1.0],[-1.06573,0.928401,1.0],[-0.0586658,0.993194,1.0],[0.0,1.0,1.0],[-0.0661225,0.800429,1.0],[-1.7824,0.859799,1.0],[-0.690445,0.941361,1.0],[-0.00968662,0.993002,1.0],[0.0,1.0,1.0],[-0.0252066,0.772944,1.0],[-2.45319,0.823328,1.0],[-1.82779,0.912295,1.0],[-0.277157,0.984417,1.0],[0.0,1.0,1.0],[-1.65043,0.727703,1.0],[-4.769,0.737336,1.0],[-3.77497,0.85187,1.0],[-0.758286,0.971868,1.0],[0.0,1.0,1.0],[-3.82536,0.671065,1.0],[-6.80853,0.671393,1.0],[-4.66756,0.804813,1.0],[-0.962573,0.95621,1.0],[0.0,1.0,1.0],[-2.82235,0.663717,1.0],[-5.84894,0.654476,1.0],[-4.11993,0.781383,1.0],[-0.814404,0.957541,1.0],[0.0,1.0,1.0],[-1.37721,0.681457,1.0],[-3.57748,0.708946,1.0],[-2.7702,0.786335,1.0],[-1.02829,0.919022,1.0]],"srgb_value":true}} diff --git a/clean-room/crw/10-chart-calibration.md b/clean-room/crw/10-chart-calibration.md new file mode 100644 index 0000000000..8816a427dd --- /dev/null +++ b/clean-room/crw/10-chart-calibration.md @@ -0,0 +1,97 @@ +# EOS D60 colour matrices from a ColorChecker (2026-10-25) + +The Canon EOS D60 has no published spectral sensitivities, so it is not in `spectral_table.rs`. +These are its DNG-style matrices (`ColorMatrix1/2`, `ForwardMatrix1/2`), fitted to our own +photographs of a ColorChecker Classic under two lights. They are in +`crates/raw/src/chart_table.rs`. Measurements come from the maintainer's own captures (names, +sizes and SHA-256 in `logs/chart-captures.tsv`; no image content recorded) and the chart's +published reference colours (craft-libs `crates/crw/clean-room/sources.md`). Scripts and measurements are local-only, in +`plan/crw/chart/`. + +## Captures + +| Set | Frames used | Light | Notes | +|---|---:|---|---| +| `SunlightColorCard/` | 20 of 22 | Direct afternoon sun, ISO 100 | Calibrite ColorChecker Classic (50th-anniversary edition, post-2014 formulation) leaning on a wall, filling most of the frame. Auto and Daylight white balance, a shutter bracket. Two frames dropped: a white-patch sample ≥ 3900 (clip ≈ 4000 at ISO 100, craft-libs `crates/crw/clean-room/04-color.md` §2). | +| `TungstonColorChart/` 2696–2706 | 11 | One household tungsten bulb, ISO 100 | Chart flat on a wall, a shutter bracket. Brightest white patch 2657 of ~4000. | +| `TungstonColorChart/` 2688–2691 | not used | Same bulb, 8 minutes earlier | Steady within the set, but its neutral reads ~3,040 K against ~2,900 K for the later set: the light changed (window light or bulb warm-up). The later, warmer and better-exposed set is used. | + +All 37 frames decode sample-exact against the black-box reference (`craft-crw`'s digest-pinned sample test, formerly `crw_oracle.rs` here). + +An earlier set on a ColorChecker-layout clone (Pixel Perfect "24 Standard Color Calibration +Chart", 2026-10-15) was not used. The maker publishes no reference values, and its grey patches +are not neutral: against an 18 % grey board they read R/G 0.88–0.94 in shade and B/G up to +1.29 under warm LED light, the darker patches drifting most. That is the sign of greys printed +from coloured inks. + +## Measurement + +- Patches are located on the embedded JPEG (four corner patch centres, bilinear grid), tracked + per frame by phase correlation, and checked visually on drawn boxes. The tungsten-set chart + was upside down in the first four frames; patch order is mapped accordingly. +- Each patch is measured in a central box of about 40 % of its width in the linear raw (black + from the far masked border per CFA site; R, mean of both G, B per 2×2 site). Uniformity + across the box (3×3 sub-blocks): ≤ 4 % in sun, ≤ 7 % under the bulb (light falloff across + the closer chart). +- Frames are normalised by the four middle neutrals (patches 20–23), averaged, and white + balanced on those neutrals. White balance (R, B multipliers, G = 1): sun 2.362, 1.298; bulb + 1.353, 2.213. The neutrals agree on it to ±2 %. + +## Fit + +- The reference is X-Rite's published L\*a\*b\* (D50) for charts made after November 2014. +- The model is a 3×3 matrix from white-balanced camera RGB to XYZ (D50), with neutral (1, 1, 1) + held exactly at the engine's D50 white (`lightcraft_color::D50`): the third column is D50 + minus the first two. That is a DNG `ForwardMatrix`. +- **Chromaticity only.** Each prediction is scaled to the patch's reference luminance before + the CIEDE2000 residual. In the sun the chart warped as it heated: the grey row's brightness + slope swung from +4 % to −7 % across the 70 s of shooting, in time order, and the per-patch + brightness needed was not smooth across the chart. A fit including lightness would have + absorbed that into the matrix. Chromaticity still determines the whole 3×3 up to scale, + which the white constraint fixes. The cost is that luminance of saturated blues and purples + rests on the model, not the measurement. +- `ColorMatrix` per light = diag(1 / multipliers) · ForwardMatrix⁻¹ · Bradford(light → D50), + scaled so the light's white maps to camera values with maximum 1. By construction it maps + the filed illuminant's white to the measured camera neutral. + +| Light | CIEDE2000 on the 24 patches | Leaving each patch out | Worst | +|---|---|---|---| +| Sun (filed as D50) | mean 1.70, median 1.46 | mean 1.97 | white 4.5 | +| Bulb (filed as A) | mean 2.42, median 1.79 | mean 2.74 | bluish green 6.7 | + +- One matrix does not serve both lights: the sun's matrix on the bulb's chart gives mean 3.6 + (cyan 9.0), the bulb's on the sun's 3.4 (red 7.7). Hence the dual-illuminant entry. +- The neutral row reads a\* within ±0.4 for the middle greys; white and the darkest patches + are off by up to 2 (white patch sheen, flare). + +## Which illuminants + +The two lights' colour temperatures come from the camera's own white-balance presets +(ColorBalance slots, craft-libs `crates/crw/clean-room/04-color.md` §3) at the temperatures Canon's manuals give them (Daylight +5200 K, Tungsten 3200 K, Fluorescent 4000 K), interpolated in mired on ln(R/B): sun ~4,850 K, +bulb ~2,900 K. They are filed under the nearest DNG illuminants the engine knows, **D50 +(5003 K) and Standard Illuminant A (2856 K)**, so `Camera` now carries its own illuminant +pair (spectral rows: A and D65). + +## Checks in the app + +- `spectral::tests::the_chart_measured_eos_d60_reads_its_presets_in_kelvin`: the camera's + presets, which the fit never saw, read through the matrices as Tungsten 3,264 K, Daylight + 5,603 K, Cloudy 6,613 K, Flash 7,085 K, near the locus. Canon's nominal values are 3200, 5200, + 6000 and 6000 K. Order and spacing hold; the daylight presets read 8–15 % high, as Sony's + dial does against its spectral matrices (#730). +- Real files through the headless app (As Shot): WBModes Fluorescent 4,103 K, tint +26 (green + compensation); LED-lit room, Auto 3,761 K; open shade, Auto 6,596 K; sunlit chart, Auto + 4,762 K. +- `files::tests::crw_probes_name_their_camera_from_the_ciff_records`: CRW imports now take make, + model and capture time from the decoder's CIFF records (no Exif in a CRW; the catalog had an + empty camera, so a D60 stayed on the relative white-balance scale). + +## Limits + +- One body, one bulb, one afternoon. The chart is 24 patches; a 3×3 matrix cannot follow the + sensor's departures from the CIE observer (the bulb fit's worst patches are 5–7 ΔE). +- The lights are filed under standard illuminants they only approximate (~50 K for the bulb, + ~150 K for the sun). +- The D60's look is still the per-file JPEG fit and the pooled profile; these matrices give the + white-balance scale and the fallback colour only. diff --git a/clean-room/crw/README.md b/clean-room/crw/README.md new file mode 100644 index 0000000000..6e4bba7263 --- /dev/null +++ b/clean-room/crw/README.md @@ -0,0 +1,18 @@ +# Canon CRW: where the record is + +The Canon CRW (CIFF) decoder and its clean-room record (the frozen format, the verification +summary, the colour, geometry and metadata notes, the private-corpus summary and the source log) +live in craft-libs: +[`crates/crw/clean-room/`](https://github.com/storytold/craft-libs/tree/main/crates/crw/clean-room). +The derivation trail and the frozen table-generation materials stay in LightCraft PR #3021. +LightCraft uses the crate `craft-crw` through the adapter `crates/raw/src/vendor/crw.rs`. + +What stays here is LightCraft's own colour work on these cameras: + +- [`10-chart-calibration.md`](10-chart-calibration.md): the EOS D60 colour matrices fitted to + ColorChecker captures, implemented in `crates/raw/src/chart_table.rs`. +- [`logs/chart-captures.tsv`](logs/chart-captures.tsv): names, sizes and SHA-256 of the chart + frames (no image content). + +The capture statistics those documents cite (`04-color.md`, `05-private-corpus.md`, `sources.md`) +are in the craft-libs record. diff --git a/clean-room/crw/logs/chart-captures.tsv b/clean-room/crw/logs/chart-captures.tsv new file mode 100644 index 0000000000..c803099014 --- /dev/null +++ b/clean-room/crw/logs/chart-captures.tsv @@ -0,0 +1,39 @@ +# EOS D60 ColorChecker Classic captures (maintainer, local only; never committed). Names, sizes, SHA-256; no image content. Generated 2026-10-25. +file bytes sha256 +SunlightColorCard/CRW_2666.CRW 7791628 371d8e18c12801c72754dd7b277163a866afc422c8edf6ad1ea822009e4170f8 +SunlightColorCard/CRW_2667.CRW 6638578 188d625c31ab44475a6cf54a5dae00fd861e26aafc90f4b5d18a1905c0a3cef5 +SunlightColorCard/CRW_2668.CRW 6832770 1189b8dc79642c57a8c9496b5629e36a1741c545d2b0b864d6e6e20d901510c1 +SunlightColorCard/CRW_2669.CRW 7079102 baf1686b27a9e0a04bf87c0b6cf55168f398d85247f8115a0af69b5e9ea1884c +SunlightColorCard/CRW_2670.CRW 7225298 067ba3f4d3026b8009cfe4babb5e4c3b28f988d95c48024a75c6715de32afccf +SunlightColorCard/CRW_2671.CRW 7504700 cf81cbb96389624318e890b5506221d49f5fba8e2d45447d87e0f3ff3e9bdc72 +SunlightColorCard/CRW_2672.CRW 7830852 7a59446bfb1f00d6eabd0115b8e5451c34f5d3d48f483cb27608ce9508e43ee5 +SunlightColorCard/CRW_2673.CRW 8053180 feeb8f818325d6ddb4e88b5eabe4a74f4cb5e1da9f70135ae3f85938c86695dc +SunlightColorCard/CRW_2674.CRW 8312060 45e7402c888582adadb607599eae80644d657d61c9607b426c411ee306e42daf +SunlightColorCard/CRW_2675.CRW 8565950 be28d2fa049aa4158ae9e3ec49dd28eb56fcd0ffa7af060235b8bda0d89dfd0a +SunlightColorCard/CRW_2676.CRW 7795508 76f7418a82e45e1034b3adacacf4bc756cb65a0d683e5bb3631992784e654f93 +SunlightColorCard/CRW_2677.CRW 7747450 a5e7bc618e6b80ea70f9bad6a1bf41ee63eadbc51df28b82d0864a73434f7964 +SunlightColorCard/CRW_2678.CRW 6815054 28824f0f64b087488d8dc5a66a8bdf717e83a4d4e1660676d07991bf32dffb96 +SunlightColorCard/CRW_2679.CRW 7050606 b5c915fa89542265deb4fa16da3ca7ffda01b1d961903836b0059d024316673a +SunlightColorCard/CRW_2680.CRW 7231410 a5780dfe99a2df2a3ed9de1888e91baa614b2e009a2b6e0a84d442b6bf1af9fd +SunlightColorCard/CRW_2681.CRW 7438088 eb4475919c2770f816d47787656ab7ecb5396f30d2c03628c3ab167ebbc47c65 +SunlightColorCard/CRW_2682.CRW 7584262 a6fe417b90ce41b03552963dee6b21e4f02b59a5c51148edc04af7224e8c59e9 +SunlightColorCard/CRW_2683.CRW 7811474 5402ad40e2689d78ade083d8855ecced5caea9368b9d77ecc4a61a16dc55aa36 +SunlightColorCard/CRW_2684.CRW 8043372 bbef5da457c0b6d6c45c74a99f3e318e6c80a7d3a0ad5c7cb7e13d24205f64fa +SunlightColorCard/CRW_2685.CRW 8242344 8d68d592a5c8933f0f35630114fe7017be808b007867beaf1a8d6d2bd1441f70 +SunlightColorCard/CRW_2686.CRW 8462380 79f7db32b18a834d5408500185c65d316387d1440aa61e26a11be85883fcc382 +SunlightColorCard/CRW_2687.CRW 7690732 0333d8d18390e77128f186239e6de71c0432ab6ee9669a71c210255e4d915d19 +TungstonColorChart/CRW_2688.CRW 6269390 d9c4334edfe3636a8a7e69f29c1d1e89f820b7b704697684d7996faee41f5d43 +TungstonColorChart/CRW_2689.CRW 6001348 1e8b47645d76a71fd9fb4111c4dce805d6dcd41ac82e6b4ce52debbf71565455 +TungstonColorChart/CRW_2690.CRW 6114056 f63fe49a9ed13af33ddb8d8ed8d75de4e304a3bc2c1f1d4275ba7edbc4f459f3 +TungstonColorChart/CRW_2691.CRW 6299730 ad8a2844c00965fb6a12e8fc85a6e8bfbdf1924e6d1a68b55472701cb8ffa115 +TungstonColorChart/CRW_2696.CRW 6169684 105ee515c94da78dedc1f8d777982c4a1e62781b160428524fbe922f62b3ef5c +TungstonColorChart/CRW_2697.CRW 5565982 327eebf702185127feb8a5f4bfac5d7ebad5532f7417b302997b19b97d7ff4a8 +TungstonColorChart/CRW_2698.CRW 5709092 f0fca20f8dcd51046e53bebf9fb9f624677ee674ad739622cdb2578977669705 +TungstonColorChart/CRW_2699.CRW 5873492 57724a1ff507cf4e78c80a34cd4e0b77eac397322228d32e5215fc3869853dd1 +TungstonColorChart/CRW_2700.CRW 5988146 6c97ae2c72114034e2fbe6aed0ef97f475696e43b56ed62273eccbfbba4cbaa0 +TungstonColorChart/CRW_2701.CRW 6202756 c4032e46b753a718d8748e269a9da5d124891d07912542368ea867529143aa62 +TungstonColorChart/CRW_2702.CRW 6409582 89b65c1c07e0685841046db85923b0bf80e747fed141ddf0335ba12dc75f3f3c +TungstonColorChart/CRW_2703.CRW 6407270 50179d0a330c967a74d76bc8342eea1052689c5c544aa1a913769b241ac6f736 +TungstonColorChart/CRW_2704.CRW 6483154 6bac4d8229a8d0fff1445d212ca63e53911dc7bda988743215009257b87787fa +TungstonColorChart/CRW_2705.CRW 7170488 629f94131e7f598964d2635e3039a20c441563201c4f3cbf177d83ad6b061f78 +TungstonColorChart/CRW_2706.CRW 6383026 67657e7a21f6fd8580012fccd2210afccf285e747bc4d39b8ea775811528ce83 diff --git a/crates/catalog/src/model.rs b/crates/catalog/src/model.rs index ed1c190c59..5bd0371848 100644 --- a/crates/catalog/src/model.rs +++ b/crates/catalog/src/model.rs @@ -332,7 +332,9 @@ pub struct Analysis { /// file's white balance is edited relative to its as-shot look or in Kelvin depends on the camera: /// [`relative_wb_camera`]. pub fn relative_wb_format(format: &str) -> bool { - ["ARW", "NEF", "NRW", "RW2", "RWL", "RAW", "RAF", "CR3", "CR2", "PEF", "SRW", "ORF", "ERF", "MRW"].iter().any(|f| format.eq_ignore_ascii_case(f)) + ["ARW", "NEF", "NRW", "RW2", "RWL", "RAW", "RAF", "CR3", "CR2", "PEF", "SRW", "ORF", "ERF", "MRW", "CRW"] + .iter() + .any(|f| format.eq_ignore_ascii_case(f)) } /// Whether a raw of `format` shot on `camera` (Exif make and model, as [`Meta::camera`] keeps them) is developed diff --git a/crates/engine/src/camera_preview/colour.rs b/crates/engine/src/camera_preview/colour.rs index 6befe7ce1a..742b37c48b 100644 --- a/crates/engine/src/camera_preview/colour.rs +++ b/crates/engine/src/camera_preview/colour.rs @@ -27,6 +27,7 @@ pub(crate) fn file_local_look(format: RawFormat) -> bool { | RawFormat::Pef | RawFormat::Srw | RawFormat::Orf + | RawFormat::Crw | RawFormat::Mrw | RawFormat::Erf ) diff --git a/crates/engine/src/camera_profiles.rs b/crates/engine/src/camera_profiles.rs index 9e6d2094ee..5f2c92f175 100644 --- a/crates/engine/src/camera_profiles.rs +++ b/crates/engine/src/camera_profiles.rs @@ -1,6 +1,6 @@ //! Camera colour profiles of our own, pooled from many photos of one camera model. //! -//! A raw file without colour matrices (Sony ARW, Nikon NEF, Fujifilm RAF) gets its look fitted to its own embedded camera +//! A raw file without colour matrices (Sony ARW, Nikon NEF, Fujifilm RAF, Canon CRW) gets its look fitted to its own embedded camera //! JPEG (`camera_preview`), but one photo shows too little of some colours: a lime shirt covering a //! few dozen proxy pixels next to a hillside of foliage at the same hue. `lightcraft-cli calibrate` //! pools the colour pairs of many photos per model and fits one matrix and hue/saturation/value @@ -25,6 +25,7 @@ const MAX_FILE: u64 = 4 << 20; /// Profiles built into LightCraft (`assets/camera-profiles/`, see `assets/ATTRIBUTION.md`): /// `(model, JSON)`. pub const BUNDLED: &[(&str, &str)] = &[ + ("Canon EOS D60", include_str!("../../../assets/camera-profiles/Canon_EOS_D60.json")), ("ILCA-99M2", include_str!("../../../assets/camera-profiles/ILCA-99M2.json")), ("ILCE-7CR", include_str!("../../../assets/camera-profiles/ILCE-7CR.json")), ("ILCE-7M4", include_str!("../../../assets/camera-profiles/ILCE-7M4.json")), @@ -295,6 +296,9 @@ mod tests { assert_eq!(bundled(model), Some(p)); } assert!(bundled("No Such Camera").is_none()); + // a model name with spaces is stored under its safe file name + assert!(bundled("Canon EOS D60").is_some_and(|p| p.files > 1000)); + assert_eq!(file_name("Canon EOS D60"), "Canon_EOS_D60.json"); } #[test] diff --git a/crates/engine/src/files/probe.rs b/crates/engine/src/files/probe.rs index 12913bc6f3..41a0854f71 100644 --- a/crates/engine/src/files/probe.rs +++ b/crates/engine/src/files/probe.rs @@ -149,6 +149,13 @@ pub fn probe_bytes(name: &str, bytes: &[u8]) -> Result { } Err(Err(e)) => return Err(e), }; + // what the Exif reader can't see, the decoder may have read from the raw's own records (a CRW keeps make, + // model and capture time in CIFF records, no Exif): it fills the gaps, so the catalog knows the camera + let (meta, captured) = { + let mut m = m.clone(); + m.fill_missing(&raw.metadata); + meta_of(&m) + }; let (w, h) = raw.developed_size(); let (mut w, mut h) = (w.max(1) as u32, h.max(1) as u32); if raw.orientation.swaps_axes() { diff --git a/crates/engine/src/files/tests.rs b/crates/engine/src/files/tests.rs index 1b1b380dec..33ad692d4c 100644 --- a/crates/engine/src/files/tests.rs +++ b/crates/engine/src/files/tests.rs @@ -44,6 +44,30 @@ fn psd_probe_reads_embedded_capture_time_gps_and_title() { use super::*; use lightcraft_codecs::{ChromaSubsampling, EncodeImage, EncodeMeta, Samples, encode_jpeg}; +#[test] +fn crw_probes_name_their_camera_from_the_ciff_records() { + // no Exif in a CRW: the camera and capture time come from the decoder's records, and the catalog's camera + // string decides the white-balance scale (the D60 has chart-measured matrices, the 10D none) + let dir = std::env::var_os("LIGHTCRAFT_CORPUS") + .map(std::path::PathBuf::from) + .unwrap_or_else(|| std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../../corpus")) + .join("raw"); + for (name, camera, kelvin) in [("crw-canon-eos-d60.crw", "Canon Canon EOS D60", true), ("crw-canon-eos-10d-a.crw", "Canon Canon EOS 10D", false)] + { + let Ok(bytes) = std::fs::read(dir.join(name)) else { + lightcraft_testkit::skip!(Corpus, "{name} absent"); + continue; + }; + assert!(lightcraft_meta::extract(&bytes).model.is_none(), "{name}: no Exif to read"); + let info = probe_bytes(name, &bytes).unwrap(); + assert_eq!(info.meta.camera, camera, "{name}"); + assert!(info.captured.is_some(), "{name}"); + assert_eq!(lightcraft_catalog::relative_wb_camera(&info.format, &info.meta.camera), !kelvin, "{name}"); + let (t, _) = info.as_shot_wb.unwrap(); + assert_eq!(t != 6500.0, kelvin, "{name}: {t}"); + } +} + /// Which white-balance scale a raw gets (issue #730): a file with matrices of its own is absolute from them; a /// fitted-look file is absolute through its camera's measured matrices, which only read the as-shot /// multipliers as Kelvin; any other raw stays relative (6500 / 0 = as shot). The catalog's decision from the @@ -110,6 +134,17 @@ fn white_balance_scale_follows_the_files_matrices_then_the_cameras() { assert!(other.relative && other.scale_white.is_none()); let unknown = WbScaleOf::new(RawFormat::Nef, &ColorData::default(), mul, &lightcraft_meta::Metadata::default()); assert!(unknown.relative && unknown.as_shot(d65) == (6500.0, 0.0)); + // CRW: no matrices in the file. The EOS D60 has chart-measured matrices: Kelvin through them, its multipliers + // for the sun its D50 matrix was measured under reading as D50; another body stays relative, so its + // JPEG-fitted look applies + let d60 = WbScaleOf::new(RawFormat::Crw, &ColorData::default(), Some([2.362, 1.0, 1.298]), &meta("Canon", "Canon EOS D60")); + assert!(!d60.own_matrix && !d60.relative && d60.legacy_relative && d60.scale_white.is_some()); + let ((t, tint), (t50, tint50)) = (d60.as_shot(d65), xy_to_temp_tint(lightcraft_color::D50)); + assert!((t - t50).abs() < 50.0 && (tint - tint50).abs() < 2.0, "{t} {tint} vs D50 {t50} {tint50}"); + assert!(!lightcraft_catalog::relative_wb_camera("CRW", "Canon Canon EOS D60")); + let crw = WbScaleOf::new(RawFormat::Crw, &ColorData::default(), mul, &meta("Canon", "Canon EOS 10D")); + assert!(crw.relative && !crw.legacy_relative && crw.scale_white.is_none()); + assert!(lightcraft_catalog::relative_wb_camera("CRW", "Canon Canon EOS 10D")); // a file with matrices of its own (DNG): absolute from them, no matter whose camera let own = ColorData { illuminant: [21, 0], color_matrix: [Some(lightcraft_color::Mat3::IDENTITY), None], ..Default::default() }; let dng = WbScaleOf::new(RawFormat::Dng, &own, mul, &meta("SONY", "ILCE-7M3")); diff --git a/crates/engine/src/lightroom_catalog.rs b/crates/engine/src/lightroom_catalog.rs index c7bf8611b8..add37f904a 100644 --- a/crates/engine/src/lightroom_catalog.rs +++ b/crates/engine/src/lightroom_catalog.rs @@ -1139,7 +1139,7 @@ pub(crate) fn apply_prepared(s: &mut crate::Session, mut data: CatalogImport, co number(&src.image, "fileHeight").max(0) as u32, &now, ); - if ["RAW", "DNG", "ARW", "CR2", "CR3", "NEF", "NRW", "RAF", "ORF", "RW2", "PEF"].contains(&p.format.to_uppercase().as_str()) { + if ["RAW", "DNG", "ARW", "CR2", "CR3", "CRW", "NEF", "NRW", "RAF", "ORF", "RW2", "PEF"].contains(&p.format.to_uppercase().as_str()) { p.kind = lightcraft_catalog::MediaKind::Raw; } p diff --git a/crates/engine/src/media/source.rs b/crates/engine/src/media/source.rs index 3373e12b5c..08ba806170 100644 --- a/crates/engine/src/media/source.rs +++ b/crates/engine/src/media/source.rs @@ -1,7 +1,7 @@ use super::{Arc, Deserialize, DevelopSettings, MediaKind, Photo, Rgb32f, Rgba8, Serialize, SourceInfo}; /// Bump when the pipeline's output changes, to invalidate cached thumbnails. -pub const RENDER_CACHE_VERSION: u64 = 72; +pub const RENDER_CACHE_VERSION: u64 = 73; /// Thumbnails render at one of these long edges (so window/cell size changes reuse the cache). pub const THUMB_SIZES: [usize; 4] = [128, 256, 384, 512]; diff --git a/crates/raw/Cargo.toml b/crates/raw/Cargo.toml index 3cb2003b26..50ecfc3719 100644 --- a/crates/raw/Cargo.toml +++ b/crates/raw/Cargo.toml @@ -15,6 +15,8 @@ lightcraft-raster = { workspace = true } lightcraft-color = { workspace = true } lightcraft-geom = { workspace = true } serde = { workspace = true } +chrono = { workspace = true } +craft-crw = { workspace = true } thiserror = { workspace = true } rayon = { workspace = true } miniz_oxide = { workspace = true } diff --git a/crates/raw/src/chart_table.rs b/crates/raw/src/chart_table.rs new file mode 100644 index 0000000000..bb87ec73e2 --- /dev/null +++ b/crates/raw/src/chart_table.rs @@ -0,0 +1,21 @@ +// Camera colour matrices fitted to our own photographs of a ColorChecker Classic (post-November-2014 formulation), +// for cameras with no published spectral sensitivities. Kept by hand: each row's capture, fit and checks are in +// clean-room/crw/10-chart-calibration.md (scripts local-only). Reference colours: X-Rite's published L*a*b* (D50) for +// the chart, as packaged by colour-science (BSD-3-Clause). No number comes from Adobe or from a GPL raw decoder. +use super::Camera; +use lightcraft_color::Mat3; + +#[rustfmt::skip] +pub(super) const CAMERAS: &[Camera] = &[ + // Canon EOS D60 (CRW), the maintainer's body, ISO 100. Matrix 1: one ~2,900 K tungsten bulb, 11 frames, filed as + // Standard Illuminant A; matrix 2: direct afternoon sun, ~4,850 K, 20 frames, filed as D50 (both temperatures from + // the camera's own white-balance presets). Fitted on chromaticity with neutral held at D50 (the sunlit chart was + // unevenly lit): CIEDE2000 mean 2.42 / 1.70 on the 24 patches, 2.74 / 1.97 leaving each patch out. + Camera { + make: "Canon", + model: "EOS D60", + illuminant: [17, 23], + color_matrix: [Mat3([[0.950961, -0.345297, 0.112165], [-0.545579, 1.400621, 0.558365], [-0.123107, 0.222004, 1.026236]]), Mat3([[0.609694, -0.127035, -0.045387], [-0.461201, 1.16644, 0.337283], [-0.115992, 0.229363, 0.791647]])], + forward_matrix: [Mat3([[0.763921, 0.183562, 0.016813], [0.268545, 0.944022, -0.212567], [0.100742, -0.431647, 1.15601]]), Mat3([[0.757277, 0.190573, 0.016446], [0.291782, 1.009128, -0.300909], [0.026419, -0.264451, 1.063137]])], + }, +]; diff --git a/crates/raw/src/lib.rs b/crates/raw/src/lib.rs index 17152e80f9..b0398cd076 100644 --- a/crates/raw/src/lib.rs +++ b/crates/raw/src/lib.rs @@ -15,7 +15,8 @@ //! //! Formats: DNG (uncompressed, lossless JPEG, lossy JPEG (Smart Previews), Deflate incl. floating point, JPEG XL (DNG 1.7, //! `jxl` feature, on by default), tiled/stripped, CFA and LinearRaw), -//! Canon CR2 / CR3 (lossless CRX Bayer and version 0x100/0x200 C-RAW), Nikon NEF/NRW (uncompressed, Huffman lossless / lossy compressed), Sony ARW (uncompressed, ARW2, lossless), Fujifilm RAF (uncompressed Bayer +//! Canon CR2 / CR3 (lossless CRX Bayer and version 0x100/0x200 C-RAW) / CRW (the CIFF bodies of 2000–2004; clean-room-derived +//! compression, `vendor::crw`; the PowerShot G5's anomalous coding is refused), Nikon NEF/NRW (uncompressed, Huffman lossless / lossy compressed), Sony ARW (uncompressed, ARW2, lossless), Fujifilm RAF (uncompressed Bayer //! and X-Trans, lossless and lossy compressed), Panasonic RW2 / Leica RWL / Panasonic RAW (every raw format: compressed 4 and 6, the prefix-coded strips of 8, //! packed 2/5/7, the 16-bit words of the oldest bodies), Pentax PEF (uncompressed, Huffman), Olympus ORF (uncompressed: 16-bit words, 12-bit XZ-2 words, 12-bit 16-byte blocks of the E-300/E-330/E-500). //! [`embedded_preview`] covers these containers' JPEG previews. Variants we can't decode yet (compressed ORF, CR3 unverified marker families / C-RAW configurations) return [`RawError::Unsupported`]; each vendor module documents its sources @@ -140,6 +141,7 @@ impl RawFormat { RawFormat::Dng | RawFormat::Cr2 | RawFormat::Cr3 + | RawFormat::Crw | RawFormat::Nef | RawFormat::Nrw | RawFormat::Arw @@ -413,6 +415,7 @@ fn decode_with(bytes: &[u8], mode: Mode) -> Result { RawFormat::Dng => dng::decode(bytes, mode).map(lift_clipped), RawFormat::Cr2 => vendor::cr2::decode(bytes, mode), RawFormat::Cr3 => vendor::cr3::decode(bytes, mode), + RawFormat::Crw => vendor::crw::decode(bytes, mode), RawFormat::Nef | RawFormat::Nrw => vendor::nef::decode(bytes, mode), RawFormat::Arw => vendor::arw::decode(bytes, mode), RawFormat::Raf => vendor::raf::decode(bytes, mode), diff --git a/crates/raw/src/preview/tests.rs b/crates/raw/src/preview/tests.rs index 7eb9b8dc16..aa2dc0da74 100644 --- a/crates/raw/src/preview/tests.rs +++ b/crates/raw/src/preview/tests.rs @@ -485,8 +485,8 @@ fn scanned_containers_give_the_largest_colour_jpeg() { f.extend_from_slice(part); f.extend_from_slice(&[0u8; 7]); } - // MRW decodes; its preview is still found by the scan - assert!(crate::probe(&f).is_some_and(|p| !p.is_supported() || p == crate::RawFormat::Mrw), "{head:?}"); + // CRW and MRW decode; their previews are still found by the scan, the others stay preview-only containers + assert!(crate::probe(&f).is_some_and(|p| !p.is_supported() || p == crate::RawFormat::Crw || p == crate::RawFormat::Mrw), "{head:?}"); assert_eq!(embedded_preview(&f).as_deref(), Some(&big[..]), "{head:?}"); for n in (0..f.len()).step_by(11) { let _ = embedded_preview(&f[..n]); diff --git a/crates/raw/src/spectral.rs b/crates/raw/src/spectral.rs index 3a3e74262a..6c4e7c46ce 100644 --- a/crates/raw/src/spectral.rs +++ b/crates/raw/src/spectral.rs @@ -1,28 +1,34 @@ -//! Camera colour matrices from measured spectral sensitivities, for raws that carry no colour matrix. +//! Measured camera colour matrices, for raws that carry no colour matrix. //! -//! [`find`] looks a camera up by its Exif make and model in a table generated by -//! `tools/spectral_camera_table.py` from rawtoaces-data (Academy Software Foundation, Apache-2.0): per model, DNG -//! `ColorMatrix1/2` and `ForwardMatrix1/2` for Standard Illuminant A and D65, fitted to the camera's measured spectral -//! sensitivities. [`Camera::fill`] writes them into a file's [`ColorData`], and [`crate::color`]'s DNG model does the -//! rest. Other names of a covered camera (Rebel T3i for EOS 600D) come from rawtoaces-data's alias list, and other -//! bodies built on a covered camera's sensor from [`SAME_SENSOR`]. No number +//! [`find`] looks a camera up by its Exif make and model in two tables, per model DNG `ColorMatrix1/2` and +//! `ForwardMatrix1/2` for two calibration illuminants: +//! - generated by `tools/spectral_camera_table.py` from rawtoaces-data (Academy Software Foundation, Apache-2.0), +//! fitted to the camera's measured spectral sensitivities, for Standard Illuminant A and D65. Other names of a +//! covered camera (Rebel T3i for EOS 600D) come from rawtoaces-data's alias list, and other bodies built on a +//! covered camera's sensor from [`SAME_SENSOR`]; +//! - `chart_table.rs`: fitted to our own photographs of a ColorChecker Classic under two lights, for cameras with no +//! published sensitivities (`clean-room/crw/10-chart-calibration.md`). +//! +//! [`Camera::fill`] writes them into a file's [`ColorData`], and [`crate::color`]'s DNG model does the rest. No number //! comes from Adobe or from a GPL raw decoder. Which colour a raw starts from is the engine's choice //! (`docs/camera-preview-colour.md`). use crate::ColorData; use lightcraft_color::{Mat3, Xy}; +#[path = "chart_table.rs"] +mod chart; #[path = "spectral_table.rs"] mod table; -/// DNG `CalibrationIlluminant` codes of the two matrices: Standard Illuminant A, D65. -const ILLUMINANTS: [u16; 2] = [17, 21]; - /// One camera's colour matrices. #[derive(Clone, Copy, Debug, PartialEq)] pub struct Camera { pub make: &'static str, pub model: &'static str, - /// XYZ → camera under Standard Illuminant A and D65 (`ColorMatrix1/2`). + /// DNG `CalibrationIlluminant` codes of the two matrices: Standard Illuminant A (17) and D65 (21) for the spectral + /// table, A and D50 (23) for a chart-measured camera. + pub illuminant: [u16; 2], + /// XYZ → camera under the two illuminants (`ColorMatrix1/2`). pub color_matrix: [Mat3; 2], /// White-balanced camera → XYZ D50 (`ForwardMatrix1/2`). pub forward_matrix: [Mat3; 2], @@ -34,7 +40,7 @@ impl Camera { if crate::color::has_matrix(color) { return false; } - color.illuminant = ILLUMINANTS; + color.illuminant = self.illuminant; color.color_matrix = self.color_matrix.map(Some); color.forward_matrix = self.forward_matrix.map(Some); true @@ -88,7 +94,7 @@ pub fn find(make: Option<&str>, model: &str) -> Option<&'static Camera> { }; match table::ALIASES.iter().chain(SAME_SENSOR).find(|(m, alias, _)| same(m, alias)) { Some((m, _, target)) => table::CAMERAS.iter().find(|c| brand(c.make) == brand(m) && c.model == *target), - None => table::CAMERAS.iter().find(|c| same(c.make, c.model)), + None => cameras().find(|c| same(c.make, c.model)), } } @@ -120,9 +126,9 @@ pub fn as_shot_white_through(camera: &Camera, color: &ColorData, wb_multipliers: Some(crate::color::as_shot_white_of(&c, wb_multipliers)) } -/// Every camera in the table. -pub fn cameras() -> &'static [Camera] { - table::CAMERAS +/// Every camera in the tables: the spectral one, then the chart-measured one. +pub fn cameras() -> impl Iterator { + table::CAMERAS.iter().chain(chart::CAMERAS) } #[cfg(test)] @@ -240,7 +246,7 @@ mod tests { #[test] fn every_row_is_a_usable_dng_profile() { - assert_eq!(cameras().len(), 52); + assert_eq!(cameras().count(), 53); for c in cameras() { assert_eq!(find(Some(c.make), c.model), Some(c), "{} {}", c.make, c.model); for m in c.color_matrix.iter().chain(&c.forward_matrix) { @@ -253,7 +259,36 @@ mod tests { let d50 = lightcraft_color::D50.to_xyz(); assert!((0..3).all(|i| (w[i] - d50[i]).abs() < 1e-4), "{} {w:?}", c.model); } + assert!(c.illuminant.iter().all(|&i| crate::color::illuminant_temperature(i).is_some()), "{}", c.model); } + assert!(table::CAMERAS.iter().all(|c| c.illuminant == [17, 21])); + } + + #[test] + fn the_chart_measured_eos_d60_reads_its_presets_in_kelvin() { + // Exif "Canon" / "Canon EOS D60" (CRW), and the catalog's joined string; not the Nikon D60 + let c = find(Some("Canon"), "Canon EOS D60").unwrap(); + assert_eq!((c.model, c.illuminant), ("EOS D60", [17, 23])); + assert_eq!(find_camera("Canon Canon EOS D60"), Some(c)); + assert_eq!(find(Some("NIKON CORPORATION"), "NIKON D60"), None); + // the camera's own white-balance presets (ColorBalance multipliers of a D60 file), which the fit never saw, + // land near the temperatures Canon names for them, on the locus + let kelvin = |r: f32, b: f32| { + let xy = as_shot_white_through(c, &ColorData::default(), Some([r, 1.0, b])).unwrap(); + lightcraft_color::cct::xy_to_temp_tint(xy) + }; + let (tungsten, tint) = kelvin(1.568, 1.918); + assert!((2900.0..3500.0).contains(&tungsten) && tint.abs() < 15.0, "Tungsten {tungsten} {tint}"); + let (daylight, tint) = kelvin(2.541, 1.219); + assert!((4800.0..5800.0).contains(&daylight) && tint.abs() < 15.0, "Daylight {daylight} {tint}"); + let (cloudy, _) = kelvin(2.799, 1.131); + let (flash, _) = kelvin(2.911, 1.103); + eprintln!("EOS D60 presets: Tungsten {tungsten:.0} K, Daylight {daylight:.0} K, Cloudy {cloudy:.0} K, Flash {flash:.0} K"); + assert!(cloudy > daylight + 300.0 && flash > daylight + 300.0, "{daylight} {cloudy} {flash}"); + // the two calibration lights read as the illuminants they were filed under + let (bulb, _) = kelvin(1.353, 2.213); + let (sun, _) = kelvin(2.362, 1.298); + assert!((bulb - 2856.0).abs() < 30.0 && (sun - 5003.0).abs() < 50.0, "{bulb} {sun}"); } #[test] diff --git a/crates/raw/src/spectral_table.rs b/crates/raw/src/spectral_table.rs index e8703e471f..f4ce3f8829 100644 --- a/crates/raw/src/spectral_table.rs +++ b/crates/raw/src/spectral_table.rs @@ -9,312 +9,364 @@ pub(super) const CAMERAS: &[Camera] = &[ Camera { make: "ARRI", model: "D21", + illuminant: [17, 21], color_matrix: [Mat3([[0.933065, -0.03997, 0.042177], [-0.321253, 0.916394, 0.250116], [-0.047929, 0.258088, 0.770888]]), Mat3([[0.841118, 0.11685, -0.05716], [-0.416513, 1.06087, 0.169491], [-0.121062, 0.361236, 0.692345]])], forward_matrix: [Mat3([[0.913988, -0.102353, 0.152661], [0.315506, 0.849769, -0.165276], [-0.134707, -0.698389, 1.6582]]), Mat3([[1.01361, -0.108757, 0.059444], [0.405694, 0.811177, -0.216871], [-0.027612, -0.326433, 1.17915]])], }, Camera { make: "Arashi Vision", model: "Insta360 X5", + illuminant: [17, 21], color_matrix: [Mat3([[1.0899, -0.436896, 0.023525], [-0.482767, 1.39879, 0.369626], [-0.056659, 0.169421, 0.72407]]), Mat3([[0.700283, -0.158934, -0.077847], [-0.543955, 1.30291, 0.196622], [-0.148964, 0.25165, 0.516509]])], forward_matrix: [Mat3([[0.710808, 0.160362, 0.093126], [0.231838, 0.891164, -0.123002], [0.020454, -0.498248, 1.3029]]), Mat3([[0.706099, 0.209581, 0.048616], [0.287186, 0.8971, -0.184286], [0.044158, -0.279999, 1.06095]])], }, Camera { make: "Canon", model: "Digital Rebel XTi", + illuminant: [17, 21], color_matrix: [Mat3([[0.984721, -0.317618, -0.03823], [-0.536205, 1.41139, 0.499196], [-0.019493, 0.0898, 0.993219]]), Mat3([[0.654378, -0.152128, -0.077165], [-0.504141, 1.17532, 0.279049], [-0.071499, 0.132862, 0.672873]])], forward_matrix: [Mat3([[0.735947, 0.130604, 0.097745], [0.271991, 0.870186, -0.142177], [-0.013289, -0.229681, 1.06808]]), Mat3([[0.693623, 0.247958, 0.022715], [0.295094, 0.978904, -0.273998], [0.00951, -0.117049, 0.932644]])], }, Camera { make: "Canon", model: "EOS-1D X Mark II", + illuminant: [17, 21], color_matrix: [Mat3([[0.841821, -0.109388, -0.029826], [-0.469467, 1.34341, 0.484215], [-0.074495, 0.204633, 0.843881]]), Mat3([[0.559829, 0.012974, -0.076841], [-0.474068, 1.17573, 0.252424], [-0.137973, 0.263217, 0.557436]])], forward_matrix: [Mat3([[0.867342, -0.069209, 0.166163], [0.282942, 0.879178, -0.162119], [0.042308, -0.560464, 1.34326]]), Mat3([[0.866644, -0.0379, 0.135551], [0.340507, 0.913959, -0.254466], [0.035971, -0.324047, 1.11318]])], }, Camera { make: "Canon", model: "EOS-1Ds Mark III", + illuminant: [17, 21], color_matrix: [Mat3([[0.933464, -0.245919, -0.026807], [-0.571496, 1.49286, 0.379177], [-0.048229, 0.100118, 0.927528]]), Mat3([[0.623037, -0.073582, -0.085177], [-0.54689, 1.28786, 0.213006], [-0.105037, 0.156191, 0.659429]])], forward_matrix: [Mat3([[0.785005, 0.07525, 0.10404], [0.285685, 0.799015, -0.084701], [0.044611, -0.231741, 1.01223]]), Mat3([[0.764142, 0.106772, 0.093381], [0.318478, 0.835999, -0.154477], [0.03106, -0.128764, 0.922809]])], }, Camera { make: "Canon", model: "EOS-1Ds Mark II", + illuminant: [17, 21], color_matrix: [Mat3([[0.945891, -0.245875, -0.023592], [-0.58518, 1.49586, 0.412994], [-0.049647, 0.124624, 1.04996]]), Mat3([[0.633076, -0.080316, -0.073882], [-0.552992, 1.27833, 0.227086], [-0.10768, 0.180208, 0.730732]])], forward_matrix: [Mat3([[0.78531, 0.073316, 0.10567], [0.29637, 0.804671, -0.101041], [0.021036, -0.254656, 1.05872]]), Mat3([[0.780605, 0.119757, 0.063934], [0.332784, 0.851961, -0.184745], [0.021321, -0.137163, 0.940946]])], }, Camera { make: "Canon", model: "EOS 100D", + illuminant: [17, 21], color_matrix: [Mat3([[0.823379, -0.153284, -0.011827], [-0.451822, 1.34611, 0.422153], [-0.063154, 0.17914, 0.866791]]), Mat3([[0.537713, -0.001778, -0.071702], [-0.479729, 1.20511, 0.230384], [-0.135862, 0.245077, 0.608091]])], forward_matrix: [Mat3([[0.839709, -0.013024, 0.137611], [0.260264, 0.869968, -0.130232], [0.040567, -0.473274, 1.25781]]), Mat3([[0.852444, -0.005311, 0.117164], [0.33135, 0.880249, -0.211599], [0.038232, -0.260159, 1.04703]])], }, Camera { make: "Canon", model: "EOS 200D", + illuminant: [17, 21], color_matrix: [Mat3([[0.882798, -0.11491, -0.016841], [-0.443662, 1.31235, 0.491834], [-0.062151, 0.206192, 0.798346]]), Mat3([[0.570466, 0.029473, -0.079371], [-0.461712, 1.15876, 0.257222], [-0.118587, 0.24972, 0.538517]])], forward_matrix: [Mat3([[0.867592, -0.074026, 0.17073], [0.27684, 0.904905, -0.181745], [0.007997, -0.615366, 1.43247]]), Mat3([[0.884048, -0.067045, 0.147293], [0.347584, 0.917256, -0.26484], [0.021454, -0.322825, 1.12647]])], }, Camera { make: "Canon", model: "EOS 200D II", + illuminant: [17, 21], color_matrix: [Mat3([[0.820814, -0.08112, -0.025232], [-0.449049, 1.31524, 0.500348], [-0.063522, 0.20839, 0.807016]]), Mat3([[0.534782, 0.039491, -0.075304], [-0.461016, 1.15287, 0.26203], [-0.117011, 0.248633, 0.539767]])], forward_matrix: [Mat3([[0.879874, -0.096427, 0.180849], [0.283378, 0.900453, -0.183831], [0.006798, -0.61219, 1.4305]]), Mat3([[0.897644, -0.089573, 0.156225], [0.354938, 0.914467, -0.269405], [0.020307, -0.323555, 1.12835]])], }, Camera { make: "Canon", model: "EOS 5DS", + illuminant: [17, 21], color_matrix: [Mat3([[0.784071, -0.14278, -0.018109], [-0.493528, 1.36672, 0.49299], [-0.067845, 0.178082, 0.792129]]), Mat3([[0.501948, -0.005161, -0.069927], [-0.500698, 1.19504, 0.25793], [-0.125608, 0.228657, 0.525639]])], forward_matrix: [Mat3([[0.838414, -0.019978, 0.145859], [0.285256, 0.874752, -0.160008], [0.038705, -0.507361, 1.29376]]), Mat3([[0.840997, -0.003166, 0.126464], [0.342942, 0.904091, -0.247033], [0.034419, -0.289165, 1.07985]])], }, Camera { make: "Canon", model: "EOS 5D", + illuminant: [17, 21], color_matrix: [Mat3([[0.961758, -0.26807, -0.006664], [-0.565407, 1.47679, 0.405541], [-0.067833, 0.12912, 0.951998]]), Mat3([[0.616895, -0.064661, -0.085183], [-0.554321, 1.28625, 0.22097], [-0.137616, 0.197613, 0.656267]])], forward_matrix: [Mat3([[0.79062, 0.078103, 0.095573], [0.287453, 0.812941, -0.100394], [0.068474, -0.279714, 1.03635]]), Mat3([[0.77434, 0.091394, 0.098562], [0.324069, 0.841224, -0.165293], [0.044245, -0.169979, 0.950838]])], }, Camera { make: "Canon", model: "EOS 5D Mark III", + illuminant: [17, 21], color_matrix: [Mat3([[0.798227, -0.156522, -0.024001], [-0.479014, 1.37953, 0.412187], [-0.067815, 0.178094, 0.795854]]), Mat3([[0.536462, -0.020759, -0.074508], [-0.493492, 1.22724, 0.222071], [-0.136505, 0.242956, 0.547031]])], forward_matrix: [Mat3([[0.829015, -0.007278, 0.142558], [0.266702, 0.857593, -0.124295], [0.048011, -0.488746, 1.26584]]), Mat3([[0.818929, 0.023372, 0.121994], [0.319742, 0.879191, -0.198933], [0.040465, -0.281513, 1.06615]])], }, Camera { make: "Canon", model: "EOS 5D Mark II", + illuminant: [17, 21], color_matrix: [Mat3([[0.765281, -0.126067, -0.028016], [-0.539891, 1.44802, 0.407637], [-0.058008, 0.128461, 0.861097]]), Mat3([[0.508976, -0.002163, -0.072663], [-0.524812, 1.25489, 0.224018], [-0.11344, 0.183978, 0.599963]])], forward_matrix: [Mat3([[0.84396, -0.009524, 0.12986], [0.296711, 0.799464, -0.096175], [0.052873, -0.321603, 1.09383]]), Mat3([[0.8407, 0.001511, 0.122085], [0.343565, 0.82753, -0.171095], [0.035331, -0.182192, 0.971966]])], }, Camera { make: "Canon", model: "EOS 5D Mark IV", + illuminant: [17, 21], color_matrix: [Mat3([[0.763394, -0.085035, -0.016567], [-0.442907, 1.31347, 0.486351], [-0.080725, 0.247335, 0.884784]]), Mat3([[0.49672, 0.034424, -0.068025], [-0.461551, 1.16055, 0.255439], [-0.154521, 0.307914, 0.579555]])], forward_matrix: [Mat3([[0.880649, -0.094084, 0.177732], [0.27666, 0.906137, -0.182797], [0.024429, -0.659213, 1.45989]]), Mat3([[0.898336, -0.087734, 0.153694], [0.347611, 0.924078, -0.271689], [0.035769, -0.378779, 1.16812]])], }, Camera { make: "Canon", model: "EOS 600D", + illuminant: [17, 21], color_matrix: [Mat3([[0.800214, -0.150575, -0.010842], [-0.462694, 1.36091, 0.41413], [-0.054076, 0.17327, 0.853835]]), Mat3([[0.528239, -0.007001, -0.067784], [-0.485979, 1.21691, 0.225002], [-0.13144, 0.244539, 0.592949]])], forward_matrix: [Mat3([[0.836952, -0.011114, 0.138458], [0.267123, 0.859868, -0.12699], [0.017395, -0.463764, 1.27147]]), Mat3([[0.849461, 0.005947, 0.108888], [0.332065, 0.875561, -0.207627], [0.033552, -0.262503, 1.05405]])], }, Camera { make: "Canon", model: "EOS M", + illuminant: [17, 21], color_matrix: [Mat3([[0.858133, -0.188655, -0.015316], [-0.477476, 1.37657, 0.415737], [-0.066593, 0.173487, 0.870331]]), Mat3([[0.559337, -0.024286, -0.076489], [-0.498439, 1.22646, 0.227107], [-0.13663, 0.237788, 0.612213]])], forward_matrix: [Mat3([[0.818185, 0.015661, 0.130449], [0.263684, 0.85776, -0.121444], [0.046738, -0.442459, 1.22083]]), Mat3([[0.820106, 0.031315, 0.112875], [0.32549, 0.874009, -0.199499], [0.03847, -0.243276, 1.02991]])], }, Camera { make: "Canon", model: "EOS R10", + illuminant: [17, 21], color_matrix: [Mat3([[0.900395, -0.120204, -0.023257], [-0.450784, 1.32079, 0.490112], [-0.060508, 0.207987, 0.757971]]), Mat3([[0.586274, 0.022629, -0.081629], [-0.465757, 1.16444, 0.255537], [-0.114546, 0.247787, 0.505639]])], forward_matrix: [Mat3([[0.860416, -0.07424, 0.178119], [0.279245, 0.90614, -0.185385], [-0.005252, -0.64772, 1.47808]]), Mat3([[0.874599, -0.057155, 0.146852], [0.346428, 0.920831, -0.267259], [0.018292, -0.341711, 1.14852]])], }, Camera { make: "Canon", model: "EOS R5", + illuminant: [17, 21], color_matrix: [Mat3([[0.906792, -0.181028, -0.039982], [-0.497007, 1.37995, 0.46653], [-0.056558, 0.135904, 0.790883]]), Mat3([[0.599617, -0.03146, -0.086837], [-0.500836, 1.20715, 0.246929], [-0.122485, 0.204473, 0.529195]])], forward_matrix: [Mat3([[0.825544, 0.000874, 0.137878], [0.27921, 0.851443, -0.130653], [0.053855, -0.393303, 1.16455]]), Mat3([[0.80269, 0.040879, 0.120727], [0.321664, 0.899552, -0.221215], [0.039913, -0.245426, 1.03062]])], }, Camera { make: "Canon", model: "EOS R5m2", + illuminant: [17, 21], color_matrix: [Mat3([[0.925997, -0.201878, -0.03247], [-0.514263, 1.39694, 0.472057], [-0.067213, 0.159605, 0.932813]]), Mat3([[0.603973, -0.037874, -0.08705], [-0.520173, 1.22523, 0.247204], [-0.147012, 0.240988, 0.619754]])], forward_matrix: [Mat3([[0.816853, 0.016859, 0.130583], [0.284699, 0.847793, -0.132492], [0.049678, -0.384186, 1.15961]]), Mat3([[0.796684, 0.049994, 0.117618], [0.326624, 0.8894, -0.216024], [0.040655, -0.243309, 1.02776]])], }, Camera { make: "Canon", model: "EOS R6", + illuminant: [17, 21], color_matrix: [Mat3([[0.887235, -0.176902, -0.018642], [-0.462429, 1.33965, 0.473061], [-0.070097, 0.19962, 0.862666]]), Mat3([[0.571385, -0.014759, -0.079163], [-0.485367, 1.18708, 0.251862], [-0.145333, 0.265796, 0.580543]])], forward_matrix: [Mat3([[0.830203, -0.011614, 0.145706], [0.268315, 0.891706, -0.16002], [0.03391, -0.533608, 1.3248]]), Mat3([[0.829826, 0.011021, 0.123449], [0.329107, 0.920067, -0.249174], [0.037653, -0.307101, 1.09455]])], }, Camera { make: "Canon", model: "EOS R6m2", + illuminant: [17, 21], color_matrix: [Mat3([[0.904651, -0.185945, -0.032292], [-0.490303, 1.37329, 0.46456], [-0.076482, 0.19622, 0.939437]]), Mat3([[0.595351, -0.032062, -0.086354], [-0.499687, 1.20659, 0.246445], [-0.151602, 0.266204, 0.633694]])], forward_matrix: [Mat3([[0.822515, -0.0028, 0.14458], [0.275534, 0.86495, -0.140483], [0.04532, -0.468236, 1.24802]]), Mat3([[0.80207, 0.038555, 0.123671], [0.322259, 0.905003, -0.227262], [0.03728, -0.271382, 1.05921]])], }, Camera { make: "Canon", model: "EOS RP", + illuminant: [17, 21], color_matrix: [Mat3([[0.843269, -0.158656, -0.026198], [-0.497933, 1.37758, 0.476056], [-0.070882, 0.179269, 0.839769]]), Mat3([[0.548578, -0.014251, -0.077893], [-0.504763, 1.20691, 0.250579], [-0.139008, 0.243991, 0.560854]])], forward_matrix: [Mat3([[0.836529, -0.017241, 0.145008], [0.285362, 0.860694, -0.146057], [0.049163, -0.481077, 1.25702]]), Mat3([[0.825922, 0.011858, 0.126516], [0.334357, 0.898585, -0.232942], [0.038621, -0.283664, 1.07015]])], }, Camera { make: "Canon", model: "EOS R", + illuminant: [17, 21], color_matrix: [Mat3([[0.732886, -0.080769, -0.010303], [-0.454757, 1.32829, 0.481287], [-0.083062, 0.251827, 0.895746]]), Mat3([[0.473635, 0.038459, -0.063761], [-0.474141, 1.17757, 0.250797], [-0.157456, 0.313293, 0.589901]])], forward_matrix: [Mat3([[0.884185, -0.093978, 0.174089], [0.284166, 0.893986, -0.178152], [0.023242, -0.654769, 1.45663]]), Mat3([[0.908841, -0.095987, 0.151442], [0.356864, 0.902145, -0.259009], [0.034581, -0.371735, 1.16226]])], }, Camera { make: "Canon", model: "PowerShot S90", + illuminant: [17, 21], color_matrix: [Mat3([[1.37542, -0.592063, 0.037432], [-0.219062, 1.12456, 0.326212], [-0.021707, 0.09788, 0.58587]]), Mat3([[0.90732, -0.244506, -0.087152], [-0.314903, 1.06475, 0.215416], [-0.11223, 0.179775, 0.439924]])], forward_matrix: [Mat3([[0.67794, 0.203129, 0.083227], [0.105177, 1.01192, -0.1171], [0.055684, -0.464622, 1.23404]]), Mat3([[0.655349, 0.321862, -0.012915], [0.180096, 1.10102, -0.281111], [0.064028, -0.26917, 1.03025]])], }, Camera { make: "Fujifilm", model: "GFX 100", + illuminant: [17, 21], color_matrix: [Mat3([[1.37208, -0.633889, 0.081365], [-0.430548, 1.32101, 0.427017], [-0.039908, 0.114944, 0.782345]]), Mat3([[0.834968, -0.233255, -0.07589], [-0.475844, 1.18948, 0.241344], [-0.126239, 0.194812, 0.541708]])], forward_matrix: [Mat3([[0.673446, 0.25104, 0.039809], [0.200798, 0.950696, -0.151494], [0.031013, -0.340478, 1.13457]]), Mat3([[0.679917, 0.304542, -0.020163], [0.261808, 1.00662, -0.268426], [0.044444, -0.214012, 0.994673]])], }, Camera { make: "Fujifilm", model: "X-T3", + illuminant: [17, 21], color_matrix: [Mat3([[1.29933, -0.598524, 0.075033], [-0.403354, 1.28265, 0.450876], [-0.037817, 0.112326, 0.810909]]), Mat3([[0.785701, -0.221043, -0.071522], [-0.456611, 1.15627, 0.255052], [-0.124341, 0.191243, 0.562458]])], forward_matrix: [Mat3([[0.671025, 0.255703, 0.037568], [0.190434, 0.97306, -0.163493], [0.03182, -0.334086, 1.12737]]), Mat3([[0.676828, 0.316449, -0.028982], [0.256753, 1.03712, -0.293871], [0.04319, -0.207191, 0.989106]])], }, Camera { make: "Fujifilm", model: "X-T4", + illuminant: [17, 21], color_matrix: [Mat3([[1.27406, -0.587718, 0.074639], [-0.371617, 1.24808, 0.450058], [-0.038746, 0.113215, 0.780014]]), Mat3([[0.771728, -0.215706, -0.070731], [-0.439625, 1.14183, 0.253491], [-0.125229, 0.192512, 0.542394]])], forward_matrix: [Mat3([[0.668116, 0.258486, 0.037694], [0.175163, 0.992049, -0.167213], [0.040145, -0.355105, 1.14006]]), Mat3([[0.675162, 0.317733, -0.028599], [0.248581, 1.05006, -0.298641], [0.04702, -0.219918, 0.998002]])], }, Camera { make: "Hasselblad", model: "L1D-20c", + illuminant: [17, 21], color_matrix: [Mat3([[0.697908, -0.225515, 0.018865], [-0.403519, 1.29608, 0.413637], [-0.048508, 0.167167, 0.74727]]), Mat3([[0.466971, -0.076456, -0.040872], [-0.471572, 1.21777, 0.21163], [-0.133006, 0.246905, 0.516655]])], forward_matrix: [Mat3([[0.754419, 0.110524, 0.099352], [0.21061, 0.943846, -0.154456], [0.016488, -0.523808, 1.33242]]), Mat3([[0.780313, 0.168783, 0.0152], [0.295267, 0.942833, -0.2381], [0.041, -0.301041, 1.08515]])], }, Camera { make: "Hasselblad", model: "L2D-20c", + illuminant: [17, 21], color_matrix: [Mat3([[0.787283, -0.249155, 0.044752], [-0.415734, 1.29586, 0.451949], [-0.060535, 0.144901, 0.709626]]), Mat3([[0.506449, -0.071884, -0.038243], [-0.435817, 1.14056, 0.251334], [-0.129637, 0.209508, 0.474062]])], forward_matrix: [Mat3([[0.776836, 0.120396, 0.067064], [0.218196, 0.951802, -0.169998], [0.071832, -0.4598, 1.21307]]), Mat3([[0.807201, 0.167509, -0.010414], [0.291699, 1.01528, -0.306978], [0.062694, -0.296911, 1.05932]])], }, Camera { make: "Nikon", model: "D200", + illuminant: [17, 21], color_matrix: [Mat3([[1.37569, -0.560621, 0.01677], [-0.606594, 1.52996, 0.38327], [-0.024329, 0.069398, 0.99135]]), Mat3([[0.898945, -0.249527, -0.086342], [-0.568281, 1.29839, 0.222009], [-0.098369, 0.139456, 0.687094]])], forward_matrix: [Mat3([[0.708545, 0.18748, 0.068271], [0.274935, 0.818921, -0.093855], [0.012224, -0.169279, 0.98216]]), Mat3([[0.685079, 0.274473, 0.004744], [0.294469, 0.898619, -0.193087], [0.026107, -0.10149, 0.900488]])], }, Camera { make: "Nikon", model: "D3300", + illuminant: [17, 21], color_matrix: [Mat3([[1.01047, -0.365965, 0.032301], [-0.473579, 1.3513, 0.474736], [-0.075188, 0.164522, 1.02012]]), Mat3([[0.644589, -0.136221, -0.056505], [-0.47509, 1.16499, 0.26318], [-0.15352, 0.237111, 0.681108]])], forward_matrix: [Mat3([[0.738138, 0.162349, 0.063809], [0.234836, 0.925124, -0.15996], [0.059989, -0.351996, 1.11711]]), Mat3([[0.742449, 0.23561, -0.013763], [0.290358, 1.00587, -0.29623], [0.04507, -0.217376, 0.99741]])], }, Camera { make: "Nikon", model: "D5100", + illuminant: [17, 21], color_matrix: [Mat3([[1.34772, -0.48474, 0.012024], [-0.466856, 1.29899, 0.44042], [-0.076248, 0.161652, 0.981853]]), Mat3([[0.929942, -0.213704, -0.081538], [-0.481178, 1.17186, 0.262186], [-0.14942, 0.233631, 0.699016]])], forward_matrix: [Mat3([[0.732398, 0.159354, 0.072543], [0.240376, 0.912366, -0.152741], [0.06111, -0.349037, 1.11303]]), Mat3([[0.727572, 0.254229, -0.017505], [0.287762, 1.00467, -0.292432], [0.040205, -0.206009, 0.990908]])], }, Camera { make: "Nikon", model: "D5300", + illuminant: [17, 21], color_matrix: [Mat3([[0.943297, -0.302977, 0.012055], [-0.489398, 1.36679, 0.480036], [-0.079912, 0.172098, 1.02217]]), Mat3([[0.613661, -0.114638, -0.052652], [-0.475392, 1.16153, 0.266621], [-0.147109, 0.232899, 0.680179]])], forward_matrix: [Mat3([[0.75961, 0.127618, 0.077067], [0.24786, 0.911605, -0.159465], [0.062139, -0.362458, 1.12542]]), Mat3([[0.765013, 0.208344, -0.009061], [0.301196, 0.998195, -0.299391], [0.042143, -0.217084, 1.00005]])], }, Camera { make: "Nikon", model: "D7000", + illuminant: [17, 21], color_matrix: [Mat3([[1.0579, -0.370378, 0.024968], [-0.50908, 1.38998, 0.475636], [-0.075079, 0.158561, 1.00866]]), Mat3([[0.675661, -0.143226, -0.053077], [-0.488456, 1.16985, 0.270384], [-0.137868, 0.21334, 0.681191]])], forward_matrix: [Mat3([[0.744976, 0.150244, 0.069076], [0.251735, 0.900835, -0.15257], [0.058406, -0.336086, 1.10278]]), Mat3([[0.755556, 0.237153, -0.028413], [0.304411, 0.998446, -0.302857], [0.039148, -0.192875, 0.978832]])], }, Camera { make: "Nikon", model: "D700", + illuminant: [17, 21], color_matrix: [Mat3([[1.25876, -0.491229, 0.017162], [-0.619342, 1.54791, 0.372191], [-0.050936, 0.098145, 1.01122]]), Mat3([[0.835285, -0.217528, -0.074624], [-0.583051, 1.32613, 0.209425], [-0.121368, 0.168895, 0.708639]])], forward_matrix: [Mat3([[0.722062, 0.17127, 0.070964], [0.279306, 0.809472, -0.088779], [0.042476, -0.200528, 0.983157]]), Mat3([[0.707886, 0.252255, 0.004155], [0.304416, 0.875438, -0.179854], [0.032977, -0.118624, 0.910752]])], }, Camera { make: "Nikon", model: "D70", + illuminant: [17, 21], color_matrix: [Mat3([[0.95752, -0.326533, -0.000865], [-0.654123, 1.5628, 0.437699], [-0.01723, 0.05324, 0.899754]]), Mat3([[0.621434, -0.137207, -0.067353], [-0.59081, 1.28888, 0.250406], [-0.066923, 0.098053, 0.633702]])], forward_matrix: [Mat3([[0.74958, 0.134109, 0.080606], [0.313007, 0.787492, -0.100498], [0.005453, -0.15183, 0.971482]]), Mat3([[0.722318, 0.215673, 0.026305], [0.326263, 0.879351, -0.205614], [0.017282, -0.077471, 0.885294]])], }, Camera { make: "Nikon", model: "D800E", + illuminant: [17, 21], color_matrix: [Mat3([[0.981723, -0.320813, 0.025417], [-0.500428, 1.37669, 0.486261], [-0.07946, 0.169419, 1.04548]]), Mat3([[0.629114, -0.117451, -0.046422], [-0.483155, 1.16337, 0.27171], [-0.147278, 0.230496, 0.696276]])], forward_matrix: [Mat3([[0.760723, 0.133423, 0.07015], [0.25382, 0.906695, -0.160515], [0.059962, -0.34837, 1.11351]]), Mat3([[0.780492, 0.212338, -0.028534], [0.311949, 0.998057, -0.310006], [0.041771, -0.208304, 0.991637]])], }, Camera { make: "Nikon", model: "D810", + illuminant: [17, 21], color_matrix: [Mat3([[0.983274, -0.318832, 0.030267], [-0.51358, 1.39278, 0.481653], [-0.076666, 0.176366, 1.07197]]), Mat3([[0.625688, -0.110113, -0.045912], [-0.497828, 1.18171, 0.267671], [-0.149244, 0.239807, 0.71615]])], forward_matrix: [Mat3([[0.763991, 0.129679, 0.070625], [0.262526, 0.897486, -0.160012], [0.045849, -0.35404, 1.13329]]), Mat3([[0.791151, 0.196615, -0.023471], [0.322368, 0.977225, -0.299593], [0.038389, -0.209045, 0.995761]])], }, Camera { make: "Nikon", model: "D850", + illuminant: [17, 21], color_matrix: [Mat3([[1.17359, -0.461087, -0.011934], [-0.607581, 1.52285, 0.4063], [-0.096127, 0.196063, 1.00005]]), Mat3([[0.773836, -0.196466, -0.097677], [-0.609077, 1.35526, 0.205388], [-0.190117, 0.290252, 0.676129]])], forward_matrix: [Mat3([[0.713588, 0.158895, 0.091813], [0.273041, 0.838318, -0.111359], [0.055293, -0.367196, 1.13701]]), Mat3([[0.669707, 0.227388, 0.0672], [0.291703, 0.871502, -0.163205], [0.042827, -0.229884, 1.01216]])], }, Camera { make: "Nikon", model: "Z f", + illuminant: [17, 21], color_matrix: [Mat3([[1.16951, -0.415422, 0.033906], [-0.516721, 1.41065, 0.441119], [-0.080466, 0.180954, 1.07672]]), Mat3([[0.749962, -0.151755, -0.063228], [-0.504317, 1.20913, 0.248149], [-0.162888, 0.256933, 0.729432]])], forward_matrix: [Mat3([[0.744024, 0.151119, 0.069153], [0.253649, 0.888649, -0.142297], [0.049891, -0.351314, 1.12653]]), Mat3([[0.756117, 0.216534, -0.008355], [0.304737, 0.961046, -0.265784], [0.041615, -0.212408, 0.995897]])], }, Camera { make: "Panasonic", model: "DC-GX9", + illuminant: [17, 21], color_matrix: [Mat3([[0.820911, -0.254983, 0.035979], [-0.372553, 1.25333, 0.438192], [-0.054294, 0.146795, 0.747319]]), Mat3([[0.534195, -0.07728, -0.038219], [-0.400358, 1.10647, 0.251688], [-0.12982, 0.216241, 0.50214]])], forward_matrix: [Mat3([[0.772645, 0.116685, 0.074966], [0.196365, 0.972505, -0.16887], [0.06062, -0.463162, 1.22765]]), Mat3([[0.805529, 0.178696, -0.01993], [0.275218, 1.04725, -0.322465], [0.060973, -0.29745, 1.06158]])], }, Camera { make: "Sony", model: "DSC-RX100M4", + illuminant: [17, 21], color_matrix: [Mat3([[0.783848, -0.284096, 0.031033], [-0.411895, 1.30629, 0.410807], [-0.047532, 0.165091, 0.725564]]), Mat3([[0.507376, -0.094837, -0.042497], [-0.488786, 1.23246, 0.213166], [-0.137082, 0.247475, 0.503834]])], forward_matrix: [Mat3([[0.733625, 0.143965, 0.086705], [0.210364, 0.945779, -0.156144], [0.012886, -0.528963, 1.34118]]), Mat3([[0.767183, 0.193058, 0.004054], [0.296288, 0.94455, -0.240838], [0.043397, -0.304922, 1.08663]])], }, Camera { make: "Sony", model: "ILCE-6400", + illuminant: [17, 21], color_matrix: [Mat3([[0.686447, -0.204525, 0.026311], [-0.43013, 1.31387, 0.445779], [-0.061279, 0.132669, 0.791917]]), Mat3([[0.44557, -0.064452, -0.027734], [-0.437513, 1.13079, 0.261784], [-0.122323, 0.190304, 0.552427]])], forward_matrix: [Mat3([[0.782555, 0.106676, 0.075064], [0.224677, 0.924591, -0.149268], [0.078407, -0.377222, 1.12392]]), Mat3([[0.821757, 0.17479, -0.032251], [0.30346, 1.00862, -0.31208], [0.052261, -0.224433, 0.997277]])], }, Camera { make: "Sony", model: "ILCE-7CM2", + illuminant: [17, 21], color_matrix: [Mat3([[0.758033, -0.221503, 0.036455], [-0.492549, 1.36195, 0.503357], [-0.065665, 0.148645, 0.906293]]), Mat3([[0.482991, -0.070139, -0.027429], [-0.478804, 1.14702, 0.282926], [-0.119226, 0.194381, 0.616628]])], forward_matrix: [Mat3([[0.788283, 0.10759, 0.068422], [0.261923, 0.909809, -0.171732], [0.053026, -0.362705, 1.13478]]), Mat3([[0.83437, 0.173346, -0.043421], [0.336938, 0.996333, -0.333271], [0.037073, -0.203664, 0.991696]])], }, Camera { make: "Sony", model: "ILCE-7M3", + illuminant: [17, 21], color_matrix: [Mat3([[0.759047, -0.22787, 0.042531], [-0.502563, 1.37732, 0.491076], [-0.066877, 0.150947, 0.900094]]), Mat3([[0.482867, -0.070899, -0.024574], [-0.489531, 1.16667, 0.274244], [-0.123988, 0.201218, 0.610148]])], forward_matrix: [Mat3([[0.787201, 0.113043, 0.064052], [0.265374, 0.902211, -0.167585], [0.052744, -0.364541, 1.1369]]), Mat3([[0.840001, 0.174345, -0.05005], [0.340881, 0.981246, -0.322127], [0.039232, -0.209817, 0.995689]])], }, Camera { make: "Sony", model: "ILCE-7M4", + illuminant: [17, 21], color_matrix: [Mat3([[0.763892, -0.227658, 0.033049], [-0.512687, 1.38412, 0.503225], [-0.063774, 0.141899, 0.91715]]), Mat3([[0.485445, -0.074907, -0.026973], [-0.491937, 1.15934, 0.283071], [-0.115422, 0.185993, 0.622862]])], forward_matrix: [Mat3([[0.784064, 0.112194, 0.068037], [0.2698, 0.896428, -0.166229], [0.050008, -0.338826, 1.11392]]), Mat3([[0.830062, 0.181159, -0.046925], [0.341401, 0.985843, -0.327244], [0.034749, -0.188826, 0.979182]])], }, Camera { make: "Sony", model: "ILCE-7RM2", + illuminant: [17, 21], color_matrix: [Mat3([[0.775308, -0.25358, 0.026979], [-0.524545, 1.40154, 0.490876], [-0.060608, 0.132591, 0.920838]]), Mat3([[0.492753, -0.089554, -0.036484], [-0.505928, 1.18284, 0.273705], [-0.116121, 0.182519, 0.626106]])], forward_matrix: [Mat3([[0.76369, 0.133034, 0.067571], [0.267238, 0.888036, -0.155274], [0.048003, -0.313698, 1.0908]]), Mat3([[0.787687, 0.201628, -0.025019], [0.326839, 0.971594, -0.298433], [0.034173, -0.177854, 0.968786]])], }, Camera { make: "Sony", model: "ILCE-7RM3", + illuminant: [17, 21], color_matrix: [Mat3([[0.742519, -0.22996, 0.032883], [-0.500197, 1.37662, 0.485744], [-0.063378, 0.142467, 0.898759]]), Mat3([[0.473388, -0.075142, -0.031025], [-0.487453, 1.16732, 0.271829], [-0.119917, 0.192619, 0.610537]])], forward_matrix: [Mat3([[0.776802, 0.119664, 0.06783], [0.260471, 0.900308, -0.160779], [0.051869, -0.347156, 1.12039]]), Mat3([[0.813753, 0.181916, -0.031373], [0.32902, 0.979656, -0.308676], [0.037764, -0.198487, 0.985828]])], }, Camera { make: "Sony", model: "ILCE-7RM4", + illuminant: [17, 21], color_matrix: [Mat3([[0.732028, -0.220808, 0.020118], [-0.501296, 1.37502, 0.49365], [-0.061615, 0.13838, 0.885461]]), Mat3([[0.472151, -0.07908, -0.031322], [-0.483014, 1.15528, 0.279019], [-0.111192, 0.18072, 0.604588]])], forward_matrix: [Mat3([[0.775623, 0.114594, 0.074079], [0.260863, 0.901608, -0.162471], [0.050735, -0.342927, 1.1173]]), Mat3([[0.806038, 0.193021, -0.034763], [0.32686, 0.992356, -0.319216], [0.033831, -0.189102, 0.980375]])], }, Camera { make: "Sony", model: "ILCE-7SM2", + illuminant: [17, 21], color_matrix: [Mat3([[0.615775, -0.137144, 0.06099], [-0.408209, 1.28402, 0.462018], [-0.084205, 0.196387, 0.85663]]), Mat3([[0.395982, -0.016098, -0.005517], [-0.420931, 1.11058, 0.265879], [-0.162165, 0.267589, 0.576945]])], forward_matrix: [Mat3([[0.854583, 0.041834, 0.067878], [0.234125, 0.948414, -0.182539], [0.097857, -0.530195, 1.25744]]), Mat3([[0.948357, 0.092307, -0.076369], [0.33668, 1.02973, -0.366408], [0.073834, -0.330955, 1.08223]])], }, Camera { make: "Sony", model: "ILCE-7SM3", + illuminant: [17, 21], color_matrix: [Mat3([[0.749715, -0.228299, 0.030188], [-0.512062, 1.38442, 0.500457], [-0.072776, 0.169469, 0.933545]]), Mat3([[0.476058, -0.07383, -0.031403], [-0.495874, 1.16904, 0.277606], [-0.134473, 0.222664, 0.625349]])], forward_matrix: [Mat3([[0.779691, 0.113899, 0.070706], [0.268632, 0.905927, -0.174559], [0.04639, -0.390929, 1.16964]]), Mat3([[0.816745, 0.179015, -0.031464], [0.334824, 0.988848, -0.323672], [0.037938, -0.229363, 1.01653]])], }, Camera { make: "Sony", model: "ILCE-9", + illuminant: [17, 21], color_matrix: [Mat3([[0.747492, -0.216385, 0.049086], [-0.499768, 1.37142, 0.499037], [-0.071324, 0.164705, 0.951496]]), Mat3([[0.473639, -0.063703, -0.016557], [-0.488372, 1.1591, 0.280181], [-0.129154, 0.213406, 0.651]])], forward_matrix: [Mat3([[0.796409, 0.106147, 0.061739], [0.26822, 0.906732, -0.174952], [0.050574, -0.378333, 1.15286]]), Mat3([[0.868551, 0.167059, -0.071314], [0.354491, 0.985971, -0.340462], [0.037779, -0.211149, 0.998474]])], }, diff --git a/crates/raw/src/tests.rs b/crates/raw/src/tests.rs index 865099cc92..e58991ccc8 100644 --- a/crates/raw/src/tests.rs +++ b/crates/raw/src/tests.rs @@ -258,9 +258,12 @@ fn private_containers_are_recognised_by_their_magic() { assert_eq!(probe(b"II\x1a\0\0\0HEAPCCDR\0\0"), Some(RawFormat::Crw)); assert_eq!(probe(b"\0MRM\0\x01\0\0"), Some(RawFormat::Mrw)); assert_eq!(probe(b"FOVb\x02\0\x02\0"), Some(RawFormat::X3f)); - for f in [RawFormat::Crw, RawFormat::X3f] { - assert!(!f.is_supported()); + for f in [RawFormat::Crw, RawFormat::Mrw] { + assert!(f.is_supported()); } + assert!(!RawFormat::X3f.is_supported()); + // a CRW signature with no heap behind it is corrupt, not a panic + assert!(matches!(decode(b"II\x1a\0\0\0HEAPCCDR\0\0"), Err(RawError::Corrupt(_)))); assert!(matches!(decode(b"FOVb\x02\0\x02\0"), Err(RawError::Unsupported(w)) if w.contains("X3f"))); // too short for the CIFF signature assert_eq!(probe(b"II\x1a\0\0\0HEAP"), None); diff --git a/crates/raw/src/vendor.rs b/crates/raw/src/vendor.rs index 1610f20ee5..a44262a2c4 100644 --- a/crates/raw/src/vendor.rs +++ b/crates/raw/src/vendor.rs @@ -9,6 +9,7 @@ mod arw_lens; pub(crate) mod arw_lens_rm6; pub mod cr2; pub mod cr3; +pub mod crw; pub mod crx; pub(crate) mod crx_wavelet; pub mod erf; diff --git a/crates/raw/src/vendor/crw.rs b/crates/raw/src/vendor/crw.rs new file mode 100644 index 0000000000..d48e1f229b --- /dev/null +++ b/crates/raw/src/vendor/crw.rs @@ -0,0 +1,255 @@ +//! Canon CRW (CIFF heap) raw decoding through the shared `craft-crw` crate (craft-libs, +//! `crates/crw`): the bodies before the CR2 era (EOS D30/D60/10D/300D, PowerShot G-series). +//! +//! The decoder, its frozen code tables and its clean-room record live in +//! craft-libs (`crates/crw/clean-room/`: the frozen format `02-crw-format.md`, the verification +//! `03-verification.md`, 28 of 29 corpus files and 1,516 EOS D60 files sample-exact against a +//! black-box reference). This module maps its output onto [`RawImage`]: CFA phase, black and white +//! levels, active area, orientation, as-shot white balance and the make, model and capture-time +//! records (a CRW carries no Exif block, so this is where the catalog learns the camera). +//! +//! Known gaps (documented in the freeze): the PowerShot G5's entropy coding diverges from the +//! model and is refused (its embedded JPEG is shown instead); PowerShot bodies without CC0 samples +//! (G2/G3/Pro1/S-series) decode through the same model unverified. Colour matrices for these +//! bodies are LightCraft's own (`chart_table`, the EOS D60); the file carries none. + +use crate::{BlackLevel, Cfa, ColorData, Metadata, Mode, OpcodeLists, Orientation, RawData, RawError, RawFormat, RawImage, Rect, Result}; +use lightcraft_meta::DateTime; + +fn map_err(e: craft_crw::Error) -> RawError { + match e { + craft_crw::Error::NotCrw => RawError::NotRaw, + craft_crw::Error::Corrupt(why) => RawError::Corrupt(format!("CRW: {why}")), + craft_crw::Error::Unsupported(why) => RawError::Unsupported(format!("CRW: {why}")), + craft_crw::Error::LimitExceeded(what) => RawError::Limit(what), + } +} + +pub(crate) fn decode(bytes: &[u8], mode: Mode) -> Result { + // the crate's own cap (2²³ samples; the largest CRW frame is 7.4 million): its decode holds + // about three `u16` buffers of the declared size, so the raw crate's general `MAX_SAMPLES` + // (2³⁰) would let a malformed file ask for gigabytes. No sample may be filled after the + // entropy stream ends (the crate allows one 64-sample block by default): every corpus file + // ends exactly on its frame, so a shorter stream is a truncated file and is `Corrupt`. + let mut limits = craft_crw::Limits::default(); + limits.max_stream_end_fill = 0; + let full = mode == Mode::Full; + let (h, samples, black, white) = if full { + let img = craft_crw::decode(bytes, &limits).map_err(map_err)?; + let black = BlackLevel { repeat_rows: 2, repeat_cols: 2, values: img.black.values.to_vec(), delta_h: vec![], delta_v: vec![] }; + (img.header, img.samples, black, img.white) + } else { + let h = craft_crw::header(bytes, &limits).map_err(map_err)?; + let white = ((1u32 << h.bits.clamp(1, 16)) - 1) as f32; + (h, Vec::new(), BlackLevel::uniform(0.0), white) + }; + let active = Rect::new(h.active_area.x, h.active_area.y, h.active_area.width, h.active_area.height); + let orientation = Orientation::from_exif(h.exif_orientation as _); + let metadata = Metadata { + make: h.make, + model: h.model, + capture_time: h.capture_unix.and_then(datetime_from_unix), + width: Some(active.width as u32), + height: Some(active.height as u32), + orientation: Some(orientation), + ..Metadata::default() + }; + let img = RawImage { + format: RawFormat::Crw, + width: h.width, + height: h.height, + cpp: 1, + data: RawData::U16(samples), + cfa: Some(Cfa::bayer_static(h.cfa.name())), + bits: h.bits, + black, + white: vec![white], + active_area: active, + crop: Rect::new(0, 0, active.width, active.height), + orientation, + color: ColorData::default(), + wb_multipliers: h.wb_multipliers, + linearized: false, + pixel_aspect: 1.0, + opcodes: OpcodeLists::default(), + metadata, + lens_metadata: Default::default(), + }; + img.validate_for(mode)?; + Ok(img) +} + +/// Civil date-time from the TimeStamp record's Unix seconds (the camera's local clock, no UTC +/// offset; inverse of [`DateTime::unix_seconds`]). Before 1970 or after 2200 is a garbage clock, +/// not a capture time. +fn datetime_from_unix(t: i64) -> Option { + use chrono::{Datelike, Timelike}; + let c = chrono::DateTime::from_timestamp(t, 0)?.naive_utc(); + let dt = DateTime { + year: u16::try_from(c.year()).ok()?, + month: u8::try_from(c.month()).ok()?, + day: u8::try_from(c.day()).ok()?, + hour: u8::try_from(c.hour()).ok()?, + minute: u8::try_from(c.minute()).ok()?, + second: u8::try_from(c.second()).ok()?, + millis: 0, + offset_minutes: None, + }; + ((1970..=2200).contains(&dt.year)).then_some(dt) +} + +#[cfg(test)] +mod tests { + use super::*; + + const W: usize = 48; + const H: usize = 20; + + /// A CIFF file with the records the decoder reads and a pseudo-random payload: enough for the + /// header path; the entropy data decodes or is refused, never panics. + fn synthetic_crw(model: &str) -> Vec { + synthetic_crw_sized(model, W, H) + } + + fn synthetic_crw_sized(model: &str, w: usize, h: usize) -> Vec { + let payload: Vec = (0..514 + 256).map(|i| (i * 41 % 253) as u8).collect(); + synthetic_crw_with_payload(model, w, h, payload) + } + + fn synthetic_crw_with_payload(model: &str, w: usize, h: usize, payload: Vec) -> Vec { + let le16 = |v: u16| v.to_le_bytes(); + let le32 = |v: u32| v.to_le_bytes(); + let heap = |records: &[(u16, Vec)]| -> Vec { + let mut b = Vec::new(); + let mut entries = Vec::new(); + for (tc, v) in records { + entries.push((*tc, v.len() as u32, b.len() as u32)); + b.extend_from_slice(v); + if b.len() % 2 == 1 { + b.push(0); + } + } + let tbl = b.len() as u32; + b.extend_from_slice(&le16(entries.len() as u16)); + for (tc, l, off) in entries { + b.extend_from_slice(&le16(tc)); + b.extend_from_slice(&le32(l)); + b.extend_from_slice(&le32(off)); + } + b.extend_from_slice(&le32(tbl)); + b + }; + let sensor: Vec = [34u16, w as u16, h as u16, 0, 0, 2, 2, w as u16 - 3, h as u16 - 3].iter().flat_map(|&v| le16(v)).collect(); + let dtable: Vec = [0u32, 0, 514, 0].iter().flat_map(|&v| le32(v)).collect(); + let image_info: Vec = [w as u32, h as u32, 0, 270, 12, 12, 0].iter().flat_map(|&v| le32(v)).collect(); + let mut color_balance: Vec = vec![66]; + color_balance.extend([2000u16, 800, 800, 960]); + color_balance.extend((0..7).flat_map(|_| [1500u16, 900, 900, 1500])); + let color_balance: Vec = color_balance.iter().flat_map(|&v| le16(v)).collect(); + let mut make_model = b"Canon\0".to_vec(); + make_model.extend_from_slice(model.as_bytes()); + make_model.push(0); + let props = heap(&[ + (0x1031, sensor), + (0x1835, dtable), + (0x080a, make_model), + (0x1810, image_info), + (0x180e, [1083410638u32, 0, 0].iter().flat_map(|&v| le32(v)).collect()), + (0x10a9, color_balance), + ]); + let root = heap(&[(0x2005, payload), (0x300a, props)]); + let mut f = b"II".to_vec(); + f.extend_from_slice(&le32(26)); + f.extend_from_slice(b"HEAPCCDR"); + f.extend_from_slice(&le32(0x0001_0002)); + f.extend_from_slice(&[0; 8]); + f.extend_from_slice(&root); + f + } + + #[test] + fn header_mode_maps_the_records_onto_raw_image() { + let f = synthetic_crw("Canon EOS D60"); + let img = decode(&f, Mode::Header).expect("header decodes"); + assert_eq!((img.format, img.width, img.height, img.bits, img.cpp), (RawFormat::Crw, W, H, 10, 1)); + assert_eq!(img.data.len(), 0); + assert_eq!(img.active_area, Rect::new(2, 2, W - 4, H - 4)); + assert_eq!(img.crop, Rect::new(0, 0, W - 4, H - 4)); + assert_eq!(img.cfa.as_ref().map(|c| c.name()).as_deref(), Some("RGGB")); + assert_eq!(img.orientation, Orientation::from_exif(8)); + assert_eq!(img.metadata.make.as_deref(), Some("Canon")); + assert_eq!(img.metadata.model.as_deref(), Some("Canon EOS D60")); + assert_eq!(img.metadata.orientation, Some(Orientation::from_exif(8))); + assert_eq!(img.metadata.capture_time.map(|t| t.unix_seconds()), Some(1083410638)); + let wb = img.wb_multipliers.expect("ColorBalance slot 0"); + assert!((wb[0] - 2.5).abs() < 1e-3 && wb[1] == 1.0 && (wb[2] - 1.2).abs() < 1e-3, "{wb:?}"); + assert_eq!(img.white, vec![1023.0]); + assert_eq!(img.black, BlackLevel::uniform(0.0)); + // the entropy data is pseudo-random: decodes or errors, never panics + let _ = decode(&f, Mode::Full); + let g1 = decode(&synthetic_crw("Canon PowerShot G1"), Mode::Header).expect("header decodes"); + assert_eq!(g1.cfa.as_ref().map(|c| c.name()).as_deref(), Some("GBRG")); + } + + #[test] + fn errors_map_onto_raw_error() { + assert!(matches!(decode(b"II*\0\x08\0\0\0", Mode::Full), Err(RawError::NotRaw))); + assert!(matches!(decode(b"II HEAPCCDR ", Mode::Full), Err(RawError::Corrupt(w)) if w.starts_with("CRW: "))); + let Err(RawError::Unsupported(why)) = decode(&synthetic_crw("Canon PowerShot G5"), Mode::Header) else { panic!("expected Unsupported") }; + assert!(why.contains("PowerShot G5"), "{why}"); + assert_eq!(map_err(craft_crw::Error::LimitExceeded("image too large")), RawError::Limit("image too large")); + } + + /// A file declaring more samples than any CRW camera has is refused before anything is + /// allocated: 4096 × 4096 (16.8 million) passed when the adapter raised the crate's cap of 2²³ + /// to the raw crate's 2³⁰. + #[test] + fn an_oversized_crw_is_refused_by_the_crates_own_limit() { + let f = synthetic_crw_sized("Canon EOS D60", 4096, 4096); + for mode in [Mode::Header, Mode::Full] { + assert_eq!(decode(&f, mode).err(), Some(RawError::Limit("image too large")), "{mode:?}"); + } + // the largest real frame (the 10D's 3152 × 2068) is within it + assert!(decode(&synthetic_crw_sized("Canon EOS D60", 3152, 2068), Mode::Header).is_ok()); + } + + /// A stream cut short is `Corrupt`, not a smeared image: the crate once filled every sample + /// after the entropy stream ended with its predictor value and returned success, so a CRW + /// truncated just past its header rendered and exported as a flat frame. + #[test] + fn a_truncated_entropy_stream_is_corrupt() { + // the 514-byte header and two bytes of entropy: almost all of the 960-sample frame unread + let f = synthetic_crw_with_payload("Canon EOS D60", W, H, vec![0; 516]); + let Err(RawError::Corrupt(why)) = decode(&f, Mode::Full) else { panic!("a truncated stream must be refused") }; + assert!(why.starts_with("CRW: ") && why.contains("before the frame does"), "{why}"); + // the header alone still reads, so the library can list the file and show its preview + assert!(decode(&f, Mode::Header).is_ok()); + } + + /// A stream that ends a few samples short is `Corrupt` too: the crate's default limit fills up + /// to one 64-sample block silently, and no real CRW fills any. + #[test] + fn a_stream_a_few_samples_short_is_corrupt() { + // an all-zero entropy stream of 842 bytes decodes the 960-sample frame exactly + let payload = |len: usize| vec![0u8; 514 + len]; + let whole = synthetic_crw_with_payload("Canon EOS D60", W, H, payload(842)); + assert!(decode(&whole, Mode::Full).is_ok()); + // six bytes fewer leave 10 samples unread, within the crate's default of 64 + let short = synthetic_crw_with_payload("Canon EOS D60", W, H, payload(836)); + let filled = craft_crw::decode(&short, &craft_crw::Limits::default()).map(|i| i.stream_end_fill); + assert_eq!(filled, Ok(10)); + let Err(RawError::Corrupt(why)) = decode(&short, Mode::Full) else { panic!("a stream 10 samples short must be refused") }; + assert!(why.contains("10 samples before the frame does"), "{why}"); + } + + #[test] + fn unix_datetime_inverse_matches_unix_seconds() { + for t in [0i64, 1, 86399, 86400, 951867295, 1083410638, 1600000000, 4102444799] { + let dt = datetime_from_unix(t).expect("in range"); + assert_eq!(dt.unix_seconds(), t, "{t}"); + } + // Before 1970 or after 2200 is a garbage clock, not a capture time. + assert!(datetime_from_unix(-1).is_none()); + assert!(datetime_from_unix(i64::MAX).is_none()); + } +} diff --git a/crates/raw/tests/it/corpus.rs b/crates/raw/tests/it/corpus.rs index 85792c79a7..eb8feb7da3 100644 --- a/crates/raw/tests/it/corpus.rs +++ b/crates/raw/tests/it/corpus.rs @@ -17,10 +17,11 @@ fn corpus_root() -> PathBuf { /// Variants known not to decode yet (see the crate docs): matched against the lower-case file name. const KNOWN_UNSUPPORTED: &[&str] = &[ - "cr3-", // Unverified CRX coding variants; exact supported cases live in cr3_corpus.rs. - "orf-olympus-em", // Olympus compressed ORF - "-he.nef", // Nikon High Efficiency (HE / HE★) NEF, issue #193 - "sraw", // Canon sRAW / mRAW + "cr3-", // Unverified CRX coding variants; exact supported cases live in cr3_corpus.rs. + "orf-olympus-em", // Olympus compressed ORF + "-he.nef", // Nikon High Efficiency (HE / HE★) NEF, issue #193 + "sraw", // Canon sRAW / mRAW + "crw-canon-powershot-g5.crw", // Canon PowerShot G5 CRW: entropy coding anomaly (craft-libs crates/crw/clean-room/02-crw-format.md §4) ]; #[test] diff --git a/crates/raw/tests/it/crw_corpus.rs b/crates/raw/tests/it/crw_corpus.rs new file mode 100644 index 0000000000..9de297a71e --- /dev/null +++ b/crates/raw/tests/it/crw_corpus.rs @@ -0,0 +1,71 @@ +//! Canon CRW through the shared craft-crw decoder, on the CC0 corpus files (URLs and SHA-256 in +//! `xtask/src/raw_samples.rs`; downloaded into the gitignored corpus/raw by `cargo xtask corpus --download`). +//! +//! The FNV-1a hashes over the decoded u16 samples (row-major, little-endian, masked borders +//! included) were computed from LightCraft's earlier in-tree clean-room CRW decoder (commit +//! dd02f12f, branch `clean-room-crw-format-decode`) before it moved to craft-libs: the shared +//! decoder reproduces it bit for bit on all ten files, six bodies. Black and white levels are not +//! pinned: craft-crw changed both on purpose (border padding no longer lowers the black level; the +//! white level follows these bodies' low-ISO clip near 4000), so they are only checked for sanity. + +use lightcraft_raw::{RawData, RawError, decode}; +use std::path::{Path, PathBuf}; + +fn corpus() -> PathBuf { + std::env::var_os("LIGHTCRAFT_CORPUS").map(PathBuf::from).unwrap_or_else(|| Path::new(env!("CARGO_MANIFEST_DIR")).join("../../corpus")) +} + +fn fnv1a(samples: &[u16]) -> u64 { + samples.iter().flat_map(|v| v.to_le_bytes()).fold(0xcbf2_9ce4_8422_2325u64, |h, byte| (h ^ u64::from(byte)).wrapping_mul(0x100_0000_01b3)) +} + +/// (file, sensor width × height, FNV-1a of the samples from the earlier in-tree decoder) +const CASES: &[(&str, (usize, usize), u64)] = &[ + ("crw-canon-eos-10d-a.crw", (3152, 2068), 0xb8a6_7781_fa37_b1df), + ("crw-canon-eos-10d-b.crw", (3152, 2068), 0xeeea_3c68_2fb5_62ae), + ("crw-canon-eos-10d-c.crw", (3152, 2068), 0x060d_d320_55aa_d79e), + ("crw-canon-eos-300d-a.crw", (3152, 2068), 0xa9a0_5cc0_ca19_01bd), + ("crw-canon-eos-300d-b.crw", (3152, 2068), 0xf0c3_98e8_be78_58cc), + ("crw-canon-eos-d30.crw", (2224, 1456), 0x1394_ca5c_1cb8_816d), + ("crw-canon-eos-d60.crw", (3152, 2068), 0x63e2_4897_3fe4_1cef), + ("crw-canon-eos-digital-rebel.crw", (3152, 2068), 0x0db1_b751_a769_aa32), + ("crw-canon-powershot-g1.crw", (2144, 1560), 0x29e5_4008_46b7_a54b), + ("crw-canon-powershot-g6.crw", (3160, 2344), 0xa7fa_be95_3036_5b64), +]; + +#[test] +fn crw_samples_match_the_earlier_in_tree_decoder() { + let mut seen = 0; + for &(name, sensor, hash) in CASES { + let path = corpus().join("raw").join(name); + let Ok(bytes) = std::fs::read(&path) else { continue }; + let raw = decode(&bytes).unwrap_or_else(|e| panic!("{name}: {e}")); + raw.validate().unwrap(); + assert_eq!((raw.width, raw.height, raw.cpp), (sensor.0, sensor.1, 1), "{name}: sensor size"); + let RawData::U16(samples) = &raw.data else { panic!("{name}: integer sensor data expected") }; + assert_eq!(fnv1a(samples), hash, "{name}: sensor samples differ from the earlier decoder"); + assert!(raw.white_at(0) > raw.black.mean() && raw.black.mean() > 0.0, "{name}: invalid black/white levels"); + seen += 1; + } + if seen == 0 { + lightcraft_testkit::skip!(Corpus, "no CRW files in {}", corpus().join("raw").display()); + } +} + +/// A real CRW damaged two ways is an error, never a panic or a silently smeared frame. +#[test] +fn a_damaged_real_crw_is_an_error() { + let path = corpus().join("raw").join("crw-canon-eos-d60.crw"); + let Ok(bytes) = std::fs::read(&path) else { + lightcraft_testkit::skip!(Corpus, "{} absent", path.display()); + return; + }; + // cut in half: the CIFF heap's record table sits at the end, so the file no longer parses + let cut = &bytes[..bytes.len() / 2]; + assert!(matches!(decode(cut), Err(RawError::Corrupt(_) | RawError::NotRaw)), "{:?}", decode(cut).err()); + // the length kept but a run of the sensor data overwritten with an invalid code + let mut garbled = bytes.clone(); + let mid = garbled.len() / 2; + garbled[mid..mid + 4096].fill(0xff); + assert!(matches!(decode(&garbled), Err(RawError::Corrupt(_))), "{:?}", decode(&garbled).err()); +} diff --git a/crates/raw/tests/it/main.rs b/crates/raw/tests/it/main.rs index 8834ed0f0c..88840b2cae 100644 --- a/crates/raw/tests/it/main.rs +++ b/crates/raw/tests/it/main.rs @@ -7,6 +7,7 @@ mod corpus; mod coverage_sweep_corpus; mod cr3_corpus; mod cr3_variants; +mod crw_corpus; mod crx_properties; mod dng; mod lossy_dng; diff --git a/crates/raw/tests/it/vendor_robust.rs b/crates/raw/tests/it/vendor_robust.rs index cb79c87da9..446c1fb60a 100644 --- a/crates/raw/tests/it/vendor_robust.rs +++ b/crates/raw/tests/it/vendor_robust.rs @@ -1,4 +1,4 @@ -//! Malformed vendor raw files (NEF, ARW, PEF, ORF, RW2 of every raw format, CR2, RAF) must decode to an error, never panic. +//! Malformed vendor raw files (NEF, ARW, PEF, ORF, RW2 of every raw format, CR2, RAF, CRW) must decode to an error, never panic. use lightcraft_tiff::tags as t; use lightcraft_tiff::{ByteOrder, IfdBuilder, ImageData, TiffWriter, Value}; @@ -226,8 +226,48 @@ fn raf() -> Vec { raf_file(W, H, 16, strip, Some(layout), b"\xff\xd8\xff\xd9") } +/// A Canon CRW: CIFF header, a raw-data payload of pseudo-random bytes, and a nested properties +/// heap with the records the decoder reads. +fn crw() -> Vec { + let le16 = |v: u16| v.to_le_bytes(); + let le32 = |v: u32| v.to_le_bytes(); + let heap = |records: &[(u16, Vec)]| -> Vec { + let mut b = Vec::new(); + let mut entries = Vec::new(); + for (tc, v) in records { + entries.push((*tc, v.len() as u32, b.len() as u32)); + b.extend_from_slice(v); + if b.len() % 2 == 1 { + b.push(0); + } + } + let tbl = b.len() as u32; + b.extend_from_slice(&le16(entries.len() as u16)); + for (tc, l, off) in entries { + b.extend_from_slice(&le16(tc)); + b.extend_from_slice(&le32(l)); + b.extend_from_slice(&le32(off)); + } + b.extend_from_slice(&le32(tbl)); + b + }; + let sensor: Vec = [34u16, W as u16, H as u16, 0, 0, 2, 2, W as u16 - 3, H as u16 - 3].iter().flat_map(|&v| le16(v)).collect(); + let dtable: Vec = [0u32, 0, 514, 0].iter().flat_map(|&v| le32(v)).collect(); + let props = heap(&[(0x1031, sensor), (0x1835, dtable), (0x080a, b"Canon\0Canon EOS D60\0".to_vec())]); + let payload: Vec = (0..514 + 256).map(|i| (i * 41 % 253) as u8).collect(); + let root = heap(&[(0x2005, payload), (0x300a, props)]); + let mut f = b"II".to_vec(); + f.extend_from_slice(&le32(26)); + f.extend_from_slice(b"HEAPCCDR"); + f.extend_from_slice(&le32(0x0001_0002)); + f.extend_from_slice(&[0; 8]); + f.extend_from_slice(&root); + f +} + fn samples() -> Vec> { vec![ + crw(), cfa_tiff("NIKON CORPORATION", 1, 12, ByteOrder::Big), cfa_tiff("NIKON CORPORATION", 34713, 14, ByteOrder::Big), cfa_tiff("SONY", 32767, 12, ByteOrder::Little), @@ -283,7 +323,7 @@ proptest! { #![proptest_config(ProptestConfig { cases: 2000, .. ProptestConfig::default() })] #[test] - fn mutated_vendor_files_never_panic(kind in 0usize..18, flips in proptest::collection::vec((any::(), any::()), 1..16), cut in any::()) { + fn mutated_vendor_files_never_panic(kind in 0usize..19, flips in proptest::collection::vec((any::(), any::()), 1..16), cut in any::()) { let mut data = samples().swap_remove(kind); let n = data.len(); for (i, v) in flips { diff --git a/docs/camera-preview-colour.md b/docs/camera-preview-colour.md index be50d23f87..41f9af0c1f 100644 --- a/docs/camera-preview-colour.md +++ b/docs/camera-preview-colour.md @@ -1,6 +1,6 @@ -# Sony ARW, Nikon NEF, Panasonic RW2, Fujifilm RAF, Canon CR3/CR2, Pentax PEF, Samsung SRW, Olympus ORF, Epson ERF and Minolta MRW starting look +# Sony ARW, Nikon NEF, Panasonic RW2, Fujifilm RAF, Canon CR3/CR2/CRW, Pentax PEF, Samsung SRW, Olympus ORF, Epson ERF and Minolta MRW starting look -ARW, NEF, RW2, RAF, CR3, CR2, PEF, SRW, ORF, ERF and MRW decoding supply sensor data and camera white-balance multipliers, but currently no measured camera colour matrix. Treating camera RGB as linear sRGB produces a dark, muted default rendering. The loader now estimates a file-local starting look from that file's embedded camera JPEG, only when a usable camera matrix is absent. All output pixels still come from the RAW sensor data; there is no JPEG replacement or uniform saturation boost. +ARW, NEF, RW2, RAF, CR3, CR2, CRW, PEF, SRW, ORF, ERF and MRW decoding supply sensor data and camera white-balance multipliers (CRW only on the D60/10D/300D; on the other CRW bodies the fitted matrix absorbs the white balance), but currently no measured camera colour matrix — with one exception: the Canon EOS D60, whose matrices we measured on a ColorChecker (`crates/raw/src/chart_table.rs`). They give a D60 CRW its colour when its JPEG look cannot be fitted, and its white balance in Kelvin (below); an accepted fit still wins. Treating camera RGB as linear sRGB produces a dark, muted default rendering. The loader now estimates a file-local starting look from that file's embedded camera JPEG, only when a usable camera matrix is absent. All output pixels still come from the RAW sensor data; there is no JPEG replacement or uniform saturation boost. ## Colour and tone are separate @@ -48,7 +48,7 @@ Previously `SourceRef::load()` discarded the decoder's `SourceInfo`, and render Vendor RGB WB multipliers alone do **not** identify an absolute illuminant without camera calibration. The generic model inferred approximately 6829 K / −127 tint for one Sony sample; changing only temperature retained that spurious tint and caused a pink cast. Uncalibrated ARWs, NEFs, RW2s and RAFs keep the file's vendor WB at decode and expose **relative** WB controls around the as-shot look. 6500/0 is the internal neutral reference of that relative scale, not a claim about the capture's measured Kelvin temperature. Presets, picker/auto and manual controls use this reference consistently. Switching from As Shot to Custom first resolves both controls; changing one cannot inherit stale catalog tint. Reset restores the current as-shot reference. Old As Shot numbers in a catalog do not mark an otherwise unchanged photo as edited; Custom WB remains an edit. -**Kelvin through the camera's measured matrices (issue #730).** A raw of a camera in `lightcraft_raw::spectral` (52 bodies: ILCE-7M3, ILCE-7M4, ILCE-7RM3, D850, EOS 5D Mark III…) edits white balance in Kelvin like a DNG, whichever look it got: the matrices read its as-shot multipliers as a temperature and tint (`spectral::as_shot_white_through`, the DNG `AsShotNeutral` reading with the model's `ColorMatrix1/2`) and the Temp slider runs 2000–50000 K with As Shot at that reading. The matrices do nothing else: the colour look stays the file's JPEG fit (or the profile, or the spectral fallback), and the picture is adapted from the as-shot white to the chosen one with Bradford, as every fitted look is — not re-developed in camera space as a DNG is. That keeps one adaptation model per camera whether or not a photo's fit was accepted, and it is what makes the upgrade exact: white balance written on the relative scale before this (no `scale` in the settings' `wb`, `WbScale::Legacy`) renders as the composition of the two Bradford adaptations, which is again one Bradford adaptation (`lightcraft_pipeline::local::legacy_white`), so existing edits are pixel-identical; they are converted to Custom Kelvin values the first time they are edited (`normalize_wb`). The decision is one function on both sides — `lightcraft_catalog::relative_wb_camera(format, camera)` from the catalog's camera string and `files::WbScaleOf` from the file — and a test keeps them in step. A photo imported before this keeps the relative scale's 6500 / 0 as its recorded as-shot white until its file is next decoded for display or reloaded (`Op::SetAsShotWb`, bookkeeping); only the readout waits, not the look. Raws of cameras without measured matrices stay relative, unless their own white-balance presets give the scale (next). +**Kelvin through the camera's measured matrices (issue #730).** A raw of a camera in `lightcraft_raw::spectral` (52 bodies with spectral matrices: ILCE-7M3, ILCE-7M4, ILCE-7RM3, D850, EOS 5D Mark III…, and the Canon EOS D60, whose matrices we measured on a ColorChecker under tungsten and sun, `chart_table.rs`, `clean-room/crw/10-chart-calibration.md`) edits white balance in Kelvin like a DNG, whichever look it got: the matrices read its as-shot multipliers as a temperature and tint (`spectral::as_shot_white_through`, the DNG `AsShotNeutral` reading with the model's `ColorMatrix1/2`) and the Temp slider runs 2000–50000 K with As Shot at that reading. The matrices do nothing else: the colour look stays the file's JPEG fit (or the profile, or the spectral fallback), and the picture is adapted from the as-shot white to the chosen one with Bradford, as every fitted look is — not re-developed in camera space as a DNG is. That keeps one adaptation model per camera whether or not a photo's fit was accepted, and it is what makes the upgrade exact: white balance written on the relative scale before this (no `scale` in the settings' `wb`, `WbScale::Legacy`) renders as the composition of the two Bradford adaptations, which is again one Bradford adaptation (`lightcraft_pipeline::local::legacy_white`), so existing edits are pixel-identical; they are converted to Custom Kelvin values the first time they are edited (`normalize_wb`). The decision is one function on both sides — `lightcraft_catalog::relative_wb_camera(format, camera)` from the catalog's camera string and `files::WbScaleOf` from the file — and a test keeps them in step. A photo imported before this keeps the relative scale's 6500 / 0 as its recorded as-shot white until its file is next decoded for display or reloaded (`Op::SetAsShotWb`, bookkeeping); only the readout waits, not the look. Raws of cameras without measured matrices stay relative, unless their own white-balance presets give the scale (next). **Kelvin through the camera's white-balance presets.** Sony ARWs store, in the encrypted `SR2SubIFD`, the multipliers of every white-balance preset, five of them at a stated temperature (2500, 3200, 4500, 6000 and 8500 K). For a camera without measured matrices whose files carry them (`lightcraft_raw::kelvin_presets`: Sony ILCA-99M2, ILCA-77M2, SLT-A33, DSC-RX10, ILCE-3500, ILCE-7S) they take the matrices' place in everything above: the as-shot multipliers are placed on the curve through the five presets (mired linear along it, in log red/green and blue/green), an offset from the curve is the tint, and the decision, the Bradford adaptation, the pixel-identical upgrade and `Op::SetAsShotWb` are the same. The scale is Sony's own: files shot on the Kelvin setting read back what the dial said (ILCA-77M2 3400 K → 3396 K and 5200 K → 5193 K, SLT-A33 4700 K → 4708 K, the public ILCE-3500 sample's 5600 K → 5594 K; with the colour filter one step towards magenta, the SLT-A33's 3400 K reads 3473 K / +11), and the Shade preset reads 7493 K on the public ILCE-7S sample. Off the curve, two constants come from the 14 Sony bodies that have both measured matrices and presets: the tint is the offset scaled by the locus's own spacing (the matrices give 0.90–1.04 of it), and the isotherms lean against the curve's normal (`ISOTHERM_TILT` 0.74, measured 0.59–0.84). On 150 ILCE-7SM2 photos read both ways, the presets' temperature tracks the matrices' to ±4 mired around Sony's 8 % higher scale, and the tint to −9 ± 4. A listed camera whose file has no presets keeps the Kelvin scale with As Shot at D65, as a covered camera without multipliers does. Bodies with measured matrices keep reading through them. diff --git a/docs/gaps.md b/docs/gaps.md index 0e650528d1..3ff39b54f5 100644 --- a/docs/gaps.md +++ b/docs/gaps.md @@ -1,6 +1,6 @@ # Gaps: where LightCraft falls short of Lightroom -> **Last reviewed:** 2026-10-11 · **Last updated:** 2026-10-29 · **Change:** minor (LR-LIB-VIRTUALCOPY: default number exhaustion is validated before copy creation; gap 8: lens profile work is tracked in #329; gap 30: the Info panel shows the selected photos' shared metadata and marks mixed fields; gap 28: ⌘⌥⇧C / ⌘⌥⇧V copy and paste metadata; gap 13: before a Lightroom catalog import the app asks merge or new library, #2672; gap 28: F8 shows / hides the right panel; import review album hierarchy, #2362; gap 20: Minolta MRW decodes; gap 10: 551 models verified; gap 15: Print Page Options — page numbers, page info, crop marks; gap 28: `\` shows / hides the Filter Bar in the grids; gap 21: Indonesian interface shipped, every message but What's New; gap 27: the Windows x64 installer verified on Windows 11; the Settings → Apps uninstall confirmation remains; gap 28: ⌘L Enable Filters switches the filter off and on; gap 15: Japanese photo and postcard paper sizes in the Print page setup and PDF; typed GPS input now rejects malformed coordinates before metadata changes; LR-MAP-TRACKLOG decodes GPX character references in coordinates, elevations and timestamps; malformed references error; CDATA stays literal; ranked gaps unchanged; gap 8: lens profile work is tracked in #329; gap 30: the Info panel shows the selected photos' shared metadata and marks mixed fields; gap 28: ⌘⌥⇧C / ⌘⌥⇧V copy and paste metadata; gap 13: before a Lightroom catalog import the app asks merge or new library, #2672; gap 28: F8 shows / hides the right panel; import review album hierarchy, #2362; gap 20: Minolta MRW decodes; gap 10: 551 models verified; gap 15: Print Page Options — page numbers, page info, crop marks; gap 28: `\` shows / hides the Filter Bar in the grids; gap 21: Indonesian interface shipped, every message but What's New; gap 27: the Windows x64 installer verified on Windows 11; the Settings → Apps uninstall confirmation remains; gap 28: ⌘L Enable Filters switches the filter off and on; gap 15: Japanese photo and postcard paper sizes in the Print page setup and PDF; import: checked rename-sequence exhaustion; import review: remembered thumbnail size and density-aware previews (#2237, part of #2056); pre-import loupe/keyboard culling remains open; no ranked gap closes; gap 8: lens profile work is tracked in #329; gap 30: the Info panel shows the selected photos' shared metadata and marks mixed fields; gap 28: ⌘⌥⇧C / ⌘⌥⇧V copy and paste metadata; gap 13: before a Lightroom catalog import the app asks merge or new library, #2672; gap 28: F8 shows / hides the right panel; import review album hierarchy, #2362; gap 20: Minolta MRW decodes; gap 10: 551 models verified; gap 15: Print Page Options — page numbers, page info, crop marks; gap 28: `\` shows / hides the Filter Bar in the grids; gap 21: Indonesian interface shipped, every message but What's New; gap 27: the Windows x64 installer verified on Windows 11; the Settings → Apps uninstall confirmation remains; gap 28: ⌘L Enable Filters switches the filter off and on; gap 15: Japanese photo and postcard paper sizes in the Print page setup and PDF; gap 9: CI runs the tests on Linux x64 since #2667; macOS, Windows and the GPU equivalence tests still don't; gap 8: lens profile work is tracked in #329; gap 30: the Info panel shows the selected photos' shared metadata and marks mixed fields; gap 28: ⌘⌥⇧C / ⌘⌥⇧V copy and paste metadata; gap 13: before a Lightroom catalog import the app asks merge or new library, #2672; gap 28: F8 shows / hides the right panel; import review album hierarchy, #2362; gap 20: Minolta MRW decodes; gap 10: 551 models verified; gap 15: Print Page Options — page numbers, page info, crop marks; gap 28: `\` shows / hides the Filter Bar in the grids; gap 21: Indonesian interface shipped, every message but What's New; gap 27: the Windows x64 installer verified on Windows 11; the Settings → Apps uninstall confirmation remains; gap 28: ⌘L Enable Filters switches the filter off and on; gap 15: Japanese photo and postcard paper sizes in the Print page setup and PDF; gap 8: Sony ILCE-7RM6 in-file distortion conversion extends to the APS-C ILCE-6700; LR-META-EXIF-FULL rejects extra EXIF clock components and preserves date fallbacks; gap 8: lens profile work is tracked in #329; gap 30: the Info panel shows the selected photos' shared metadata and marks mixed fields; gap 28: ⌘⌥⇧C / ⌘⌥⇧V copy and paste metadata; gap 13: before a Lightroom catalog import the app asks merge or new library, #2672; gap 28: F8 shows / hides the right panel; import review album hierarchy, #2362; gap 20: Minolta MRW decodes; gap 10: 551 models verified; gap 15: Print Page Options — page numbers, page info, crop marks; gap 28: `\` shows / hides the Filter Bar in the grids; gap 21: Indonesian interface shipped, every message but What's New; gap 27: the Windows x64 installer verified on Windows 11; the Settings → Apps uninstall confirmation remains; gap 28: ⌘L Enable Filters switches the filter off and on; gap 15: Japanese photo and postcard paper sizes in the Print page setup and PDF; JPEG ICC APP2 sequence validation; gap 8: lens profile work is tracked in #329; gap 30: the Info panel shows the selected photos' shared metadata and marks mixed fields; gap 28: ⌘⌥⇧C / ⌘⌥⇧V copy and paste metadata; gap 13: before a Lightroom catalog import the app asks merge or new library, #2672; gap 28: F8 shows / hides the right panel; import review album hierarchy, #2362; gap 20: Minolta MRW decodes; gap 10: 551 models verified; gap 15: Print Page Options — page numbers, page info, crop marks; gap 28: `\` shows / hides the Filter Bar in the grids; gap 21: Indonesian interface shipped, every message but What's New; gap 27: the Windows x64 installer verified on Windows 11; the Settings → Apps uninstall confirmation remains; gap 28: ⌘L Enable Filters switches the filter off and on; gap 15: Japanese photo and postcard paper sizes in the Print page setup and PDF; gap 8: lens profile work is tracked in #329; gap 30: the Info panel shows the selected photos' shared metadata and marks mixed fields; gap 28: ⌘⌥⇧C / ⌘⌥⇧V copy and paste metadata; gap 13: before a Lightroom catalog import the app asks merge or new library, #2672; gap 28: F8 shows / hides the right panel; import review album hierarchy, #2362; gap 20: Minolta MRW decodes; gap 10: 551 models verified; gap 15: Print Page Options — page numbers, page info, crop marks; gap 28: `\` shows / hides the Filter Bar in the grids; gap 21: Indonesian interface shipped, every message but What's New; gap 27: the Windows x64 installer verified on Windows 11; the Settings → Apps uninstall confirmation remains; gap 28: ⌘L Enable Filters switches the filter off and on; gap 15: Japanese photo and postcard paper sizes in the Print page setup and PDF; gap 24: extreme brush segments skip the intermediate dabs; **Last reviewed:** 2026-10-11 · **Last updated:** 2026-10-20 · **Change:** minor (gap 15: Print Page Options — page numbers, page info, crop marks) +> **Last reviewed:** 2026-10-11 · **Last updated:** 2026-10-29 · **Change:** minor (gap 1: the Canon EOS D60 is the first chart-calibrated model, its matrices from our own ColorChecker shots give its white balance a Kelvin scale; gap 20: Canon CRW decodes; LR-LIB-VIRTUALCOPY: default number exhaustion is validated before copy creation; gap 8: lens profile work is tracked in #329; gap 30: the Info panel shows the selected photos' shared metadata and marks mixed fields; gap 28: ⌘⌥⇧C / ⌘⌥⇧V copy and paste metadata; gap 13: before a Lightroom catalog import the app asks merge or new library, #2672; gap 28: F8 shows / hides the right panel; import review album hierarchy, #2362; gap 20: Minolta MRW decodes; gap 10: 557 models verified with CRW and MRW; gap 15: Print Page Options — page numbers, page info, crop marks; gap 28: `\` shows / hides the Filter Bar in the grids; gap 21: Indonesian interface shipped, every message but What's New; gap 27: the Windows x64 installer verified on Windows 11; the Settings → Apps uninstall confirmation remains; gap 28: ⌘L Enable Filters switches the filter off and on; gap 15: Japanese photo and postcard paper sizes in the Print page setup and PDF; typed GPS input now rejects malformed coordinates before metadata changes; LR-MAP-TRACKLOG decodes GPX character references in coordinates, elevations and timestamps; malformed references error; CDATA stays literal; ranked gaps unchanged; gap 8: lens profile work is tracked in #329; gap 30: the Info panel shows the selected photos' shared metadata and marks mixed fields; gap 28: ⌘⌥⇧C / ⌘⌥⇧V copy and paste metadata; gap 13: before a Lightroom catalog import the app asks merge or new library, #2672; gap 28: F8 shows / hides the right panel; import review album hierarchy, #2362; gap 20: Minolta MRW decodes; gap 10: 557 models verified with CRW and MRW; gap 15: Print Page Options — page numbers, page info, crop marks; gap 28: `\` shows / hides the Filter Bar in the grids; gap 21: Indonesian interface shipped, every message but What's New; gap 27: the Windows x64 installer verified on Windows 11; the Settings → Apps uninstall confirmation remains; gap 28: ⌘L Enable Filters switches the filter off and on; gap 15: Japanese photo and postcard paper sizes in the Print page setup and PDF; import: checked rename-sequence exhaustion; import review: remembered thumbnail size and density-aware previews (#2237, part of #2056); pre-import loupe/keyboard culling remains open; no ranked gap closes; gap 8: lens profile work is tracked in #329; gap 30: the Info panel shows the selected photos' shared metadata and marks mixed fields; gap 28: ⌘⌥⇧C / ⌘⌥⇧V copy and paste metadata; gap 13: before a Lightroom catalog import the app asks merge or new library, #2672; gap 28: F8 shows / hides the right panel; import review album hierarchy, #2362; gap 20: Minolta MRW decodes; gap 10: 557 models verified with CRW and MRW; gap 15: Print Page Options — page numbers, page info, crop marks; gap 28: `\` shows / hides the Filter Bar in the grids; gap 21: Indonesian interface shipped, every message but What's New; gap 27: the Windows x64 installer verified on Windows 11; the Settings → Apps uninstall confirmation remains; gap 28: ⌘L Enable Filters switches the filter off and on; gap 15: Japanese photo and postcard paper sizes in the Print page setup and PDF; gap 9: CI runs the tests on Linux x64 since #2667; macOS, Windows and the GPU equivalence tests still don't; gap 8: lens profile work is tracked in #329; gap 30: the Info panel shows the selected photos' shared metadata and marks mixed fields; gap 28: ⌘⌥⇧C / ⌘⌥⇧V copy and paste metadata; gap 13: before a Lightroom catalog import the app asks merge or new library, #2672; gap 28: F8 shows / hides the right panel; import review album hierarchy, #2362; gap 20: Minolta MRW decodes; gap 10: 557 models verified with CRW and MRW; gap 15: Print Page Options — page numbers, page info, crop marks; gap 28: `\` shows / hides the Filter Bar in the grids; gap 21: Indonesian interface shipped, every message but What's New; gap 27: the Windows x64 installer verified on Windows 11; the Settings → Apps uninstall confirmation remains; gap 28: ⌘L Enable Filters switches the filter off and on; gap 15: Japanese photo and postcard paper sizes in the Print page setup and PDF; gap 8: Sony ILCE-7RM6 in-file distortion conversion extends to the APS-C ILCE-6700; LR-META-EXIF-FULL rejects extra EXIF clock components and preserves date fallbacks; gap 8: lens profile work is tracked in #329; gap 30: the Info panel shows the selected photos' shared metadata and marks mixed fields; gap 28: ⌘⌥⇧C / ⌘⌥⇧V copy and paste metadata; gap 13: before a Lightroom catalog import the app asks merge or new library, #2672; gap 28: F8 shows / hides the right panel; import review album hierarchy, #2362; gap 20: Minolta MRW decodes; gap 10: 557 models verified with CRW and MRW; gap 15: Print Page Options — page numbers, page info, crop marks; gap 28: `\` shows / hides the Filter Bar in the grids; gap 21: Indonesian interface shipped, every message but What's New; gap 27: the Windows x64 installer verified on Windows 11; the Settings → Apps uninstall confirmation remains; gap 28: ⌘L Enable Filters switches the filter off and on; gap 15: Japanese photo and postcard paper sizes in the Print page setup and PDF; JPEG ICC APP2 sequence validation; gap 8: lens profile work is tracked in #329; gap 30: the Info panel shows the selected photos' shared metadata and marks mixed fields; gap 28: ⌘⌥⇧C / ⌘⌥⇧V copy and paste metadata; gap 13: before a Lightroom catalog import the app asks merge or new library, #2672; gap 28: F8 shows / hides the right panel; import review album hierarchy, #2362; gap 20: Minolta MRW decodes; gap 10: 557 models verified with CRW and MRW; gap 15: Print Page Options — page numbers, page info, crop marks; gap 28: `\` shows / hides the Filter Bar in the grids; gap 21: Indonesian interface shipped, every message but What's New; gap 27: the Windows x64 installer verified on Windows 11; the Settings → Apps uninstall confirmation remains; gap 28: ⌘L Enable Filters switches the filter off and on; gap 15: Japanese photo and postcard paper sizes in the Print page setup and PDF; gap 8: lens profile work is tracked in #329; gap 30: the Info panel shows the selected photos' shared metadata and marks mixed fields; gap 28: ⌘⌥⇧C / ⌘⌥⇧V copy and paste metadata; gap 13: before a Lightroom catalog import the app asks merge or new library, #2672; gap 28: F8 shows / hides the right panel; import review album hierarchy, #2362; gap 20: Minolta MRW decodes; gap 10: 557 models verified with CRW and MRW; gap 15: Print Page Options — page numbers, page info, crop marks; gap 28: `\` shows / hides the Filter Bar in the grids; gap 21: Indonesian interface shipped, every message but What's New; gap 27: the Windows x64 installer verified on Windows 11; the Settings → Apps uninstall confirmation remains; gap 28: ⌘L Enable Filters switches the filter off and on; gap 15: Japanese photo and postcard paper sizes in the Print page setup and PDF; gap 24: extreme brush segments skip the intermediate dabs; **Last reviewed:** 2026-10-11 · **Last updated:** 2026-10-20 · **Change:** minor (gap 15: Print Page Options — page numbers, page info, crop marks) Every known shortfall, one entry each, ranked by user impact (how many Lightroom users hit it, and how hard it blocks them), then by effort. **Agents pick work from the top** (the first entry nobody is @@ -15,7 +15,7 @@ Hours are Opus 5.5 agent wall-clock hours (see [target-app-parity.md](target-app | # | Gap | Evidence | User impact | Hours | Doc | |---:|---|---|---|---:|---| -| 1 B | **Camera colour is estimated, not measured** (LR-PROF-CAMERACOLOR). Raws start from a per-file fit to the camera JPEG, 9 bundled profiles or 52 spectral matrices (plus same-sensor bodies, e.g. the X-T30 through the X-T3); others use a neutral matrix (a black-and-white camera JPEG gives its tone curve only, #577; dark JPEG tones also guide the toe, #1307) | ΔE vs camera JPEG 2.9–10 after fitting (raw-parity.md); 0 chart-calibrated models vs 1,500 Adobe Standard profiles | every raw shooter sees colour that is close but not Lightroom's; some get neutral-matrix colour | 50–90 | [raw-parity](raw-parity.md#colour) | +| 1 B | **Camera colour is estimated, not measured** (LR-PROF-CAMERACOLOR). Raws start from a per-file fit to the camera JPEG, 10 bundled profiles, 52 spectral matrices (plus same-sensor bodies, e.g. the X-T30 through the X-T3) or chart-measured matrices (the EOS D60); others use a neutral matrix (a black-and-white camera JPEG gives its tone curve only, #577; dark JPEG tones also guide the toe, #1307) | ΔE vs camera JPEG 2.9–10 after fitting (raw-parity.md); 1 chart-calibrated model (EOS D60: its Kelvin scale and fallback colour, the look stays the JPEG fit) vs 1,500 Adobe Standard profiles | every raw shooter sees colour that is close but not Lightroom's; some get neutral-matrix colour | 50–90 | [raw-parity](raw-parity.md#colour) | | 2 B | **CR3 variants no public file uses** (LR-IMP-FORMATS): `crx.rs` refuses vertical-tile C-RAW, partial-subband and other plane coding, multi-tile 0x200 and adaptive low-frequency gains, and those files fall back to the preview. All 110 CC0 CR3s on raw.pixls.us (31 folders) decode from sensor data, so none of these variants has a public sample; 26 CR3 bodies are verified (M50 / R100 / R8 exact, R5 Mark II pinned, 22 more pinned on one CC0 file each and checked against the camera JPEG, [cr3.md](cr3.md#further-bodies-one-cc0-file-each)). HEIF stills are `.HIF` files, not CR3; no CR3 sRAW / mRAW sample exists | measured: Canon's share whose camera fully works 73% → 94% (raw-parity.md); 18 of 22 popular Canon bodies write CR3, all 18 now verified | +0.3 points of photographers; the variants surface only as user files that open as a preview | 10–25 | [raw-parity](raw-parity.md#remaining-work-ranked-by-photographers-unlocked-per-hour) | | 3 B | **Render fidelity unmeasured** (LR-BEHAV-RENDER-FIDELITY): tone, highlights, texture / clarity / dehaze, NR and sharpening are tuned by eye | no side-by-side suite; a retune needs a new process version (only V1 exists) | edits imported from Lightroom look different; the look "isn't Lightroom's" | 30–60 | [raw-parity](raw-parity.md), [process-versions](process-versions.md) | | 4 | ~~Original-pixel detail at 100%~~ (LR-VIEW-ZOOM): closed 2026-10-12, see Closed recently | checklist row ✅ | — | 0 | [ui-parity](ui-parity.md) | @@ -24,7 +24,7 @@ Hours are Opus 5.5 agent wall-clock hours (see [target-app-parity.md](target-app | 7 | **Nikon High Efficiency NEF** (HE / HE★ on Z 8, Z 9, Z 6III, Z f, Z50II, Z5II when set to HE) | named and preview only (#193); needs a pure-Rust JPEG XS decoder | +1.1 points (only shots taken in HE; lossless works on the same bodies); low gain per hour (~0.04), so not a beta blocker | 20–40 | [raw-parity](raw-parity.md) | | 8 B | **No lens profile database** (LR-EDIT-OPTICS-PROFILE): only DNG opcodes, RW2 in-file distortion, Sony ILCE-7RM4A, full-frame ILCE-7CR distortion (Auto only) and ILCE-7RM6 and ILCE-6700 distortion (`docs/sony-ilce7rm6-lens-corrections.md`) and Nikon Z 6II / Z 8 / Z f distortion (`docs/nikon-lens-corrections.md`); tracked in #329 | Adobe ships 3,635 lens profiles; we never use them | distortion / vignetting correction is a default step for many | 40–80 + calibration shots | [raw-parity](raw-parity.md#lens-profiles) | | 9 B | **Tests don't run in CI on macOS or Windows, and no CI job runs the GPU equivalence tests**: the CI gate (`ci.yml`, #2667) runs `cargo xtask ci`, which includes `cargo test`, on Linux x64 for every push to `main` and every pull request; FreeBSD runs `cargo test` nightly, on pushes to `release` and on PRs that change its workflow or `packaging/freebsd/`; the macOS and Windows jobs build packages | `.github/workflows/` (ci, freebsd, packaging-lint, release, sonarcloud, windows-arm64); the gate's runner has Mesa software Vulkan drivers installed, but `Gpu::new` refuses software adapters (`crates/gpu/src/ctx.rs`), so the CPU ↔ GPU equivalence tests skip; the linux-riscv64 release job added in 0.6.0 (#844) runs only `lightcraft-cli --version` under QEMU; #1148 (open, not merged; #2667 names it superseded) has the macOS and Windows test legs and a `LIGHTCRAFT_GPU_ALLOW_SOFTWARE` opt-in that runs the GPU tests on lavapipe, Metal and WARP | a regression that only shows on macOS or Windows, or only on a GPU, reaches users; `cargo xtask ci` runs only on Linux in CI | 6–12 | [target-app-parity](target-app-parity.md#by-dimension) | -| 10 B | **Per-model verification thin, plus cheap per-body decode fixes**: 551 of 1,446 Adobe models verified (38%), ~85% of photographers on a verified body; Nikon 5 bodies verified, Canon 34, Leica 14 (the Q3 by a recorded check of 38 private DNGs). Cheap fixes: Z 6II packed 14-bit NEF (#769, PR #671), Sony A100 regression (#702); F828 SRF now discovered and imported as preview-only, sensor decoding still missing, DSLR-A200…A390 / A850 12-bit ARW (#535) | measured: [raw/coverage.tsv](raw/coverage.tsv) | per-body bugs (levels, crops, WB) surface only from users | 25–45 | [raw-parity](raw-parity.md#by-maker-measured) | +| 10 B | **Per-model verification thin, plus cheap per-body decode fixes**: 557 of 1,446 Adobe models verified (39%), ~86% of photographers on a verified body; Nikon 5 bodies verified, Canon 34, Leica 14 (the Q3 by a recorded check of 38 private DNGs). Cheap fixes: Z 6II packed 14-bit NEF (#769, PR #671), Sony A100 regression (#702); F828 SRF now discovered and imported as preview-only, sensor decoding still missing, DSLR-A200…A390 / A850 12-bit ARW (#535) | measured: [raw/coverage.tsv](raw/coverage.tsv) | per-body bugs (levels, crops, WB) surface only from users | 25–45 | [raw-parity](raw-parity.md#by-maker-measured) | | 11 | **Enhance: Raw Details, Super Resolution; AI denoise without shippable weights or X-Trans** | ENH rows 0%; denoise Bayer only, RawNIND weights GPL and opt-in | Fujifilm users get no AI denoise; nobody gets it out of the box | 30–60 + model decision | [raw-parity](raw-parity.md#demosaic-levels-crops-and-lens-metadata) | | 12 | **Content-aware / generative remove, detect distractions, reflections removal** | REM rows 75%; patch synthesis missing | cleanup work goes back to Photoshop | 25–45 (+ generative model) | [target-app-parity](target-app-parity.md#ai) | | 13 | **Lightroom catalog migration is one-way and approximate**: unsupported Adobe profiles / AI settings archived, history kept as data; main-file pages read on demand up to 16 GiB, with dense-table and WAL bounds retained (#798); offline record counts and destination are now shown in a lasting import result; catalog VIDEO records match the Videos filter, with older classification repaired on reimport; before an import the app asks whether the catalog merges into the open library or goes into a new library (opt-out in Settings, #2672) | lightroom-catalog-import.md | switching users lose some looks | 8–12 | [file-format-parity](file-format-parity.md) | @@ -34,7 +34,7 @@ Hours are Opus 5.5 agent wall-clock hours (see [target-app-parity.md](target-app | 17 | **Tethered capture** | ⬜ | studio photographers | 25–45 + cameras | [hardware-parity](hardware-parity.md) | | 18 | **Video**: playback, trim, global edits, export | VID rows 0% | users who mix stills and clips | 25–45 | [target-app-parity](target-app-parity.md#features) | | 19 | **Plug-in ecosystem**: no Lightroom SDK equivalent (export / publish plug-ins, metadata plug-ins) | ⬜ | pro workflows built on plug-ins (LR/Enfuse, Jeffrey's exporters, Negative Lab Pro) | 40–80 + owner decision | [target-app-parity](target-app-parity.md#by-dimension) | -| 20 | **Long-tail raw formats**: compressed SRW, ARQ pixel shift, IIQ, Hasselblad compression, X3F, CRW, ERF, KDC, DCR, MEF, GPR, old FinePix (MRW decodes since 2026-10-18) | raw-parity.md | small user share each | 40–80 | [raw-parity](raw-parity.md) | +| 20 | **Long-tail raw formats**: compressed SRW, ARQ pixel shift, IIQ, Hasselblad compression, X3F, KDC, DCR, GPR, old FinePix (MRW decodes since 2026-10-18; ERF and MEF since 2026-10-12; CRW since 2026-10-13, the PowerShot G5 anomaly and pre-CIFF compacts remain preview) | raw-parity.md | small user share each | 35–75 | [raw-parity](raw-parity.md) | | 21 | **Localization**: 10 of 16 shipped languages partial (de, es, fr, ja, uk now 97–99% of catalog messages and id every message but What's New, awaiting native review; pt-BR, ru, zh-hans, zh-hant 74–92%), lower-layer errors English; Hindi, Arabic, Korean, Vietnamese absent; no RTL or complex shaping; exports add Thai glyphs only (#2052), with horizontal mark positioning still incomplete and Arabic fallback deferred until joining and bidi exist | measured from catalogs | non-English users see mixed English | 40–70 (shipped to full); 135–239 (four new) | [localization-parity](localization-parity.md) | | 23 | **Accessibility**: AccessKit tree audited by a test; canvas handles, spots and mask pins by keyboard; left: brush and red-eye by keyboard, a session with a real screen reader | LR-BEHAV-ACCESS 🟡 | blind and low-vision users | 2–4 | [ui-parity](ui-parity.md) | | 22 | **Pen pressure on macOS / Linux tablets** (brush size and flow follow pressure where winit reports a pen force), OS monitor profiles on Windows (Linux reads colord's, macOS the screen's), follow-window colour on Linux / Windows | hardware-parity.md | brush users with tablets; multi-monitor setups | 11–22 | [hardware-parity](hardware-parity.md) | @@ -98,6 +98,7 @@ Beta-blocking gaps (B) total **~230–430 h**; with the stability and platform w | 2026-10-25 | patch | LR-META-EXIF-FULL rejects extra clock components rather than projecting a plausible prefix; valid DateTimeDigitized, IFD0 DateTime and XMP fallbacks remain available, raw tag values stay visible, and the status / feature counts do not change | | 2026-10-25 | patch | JPEG ICC APP2 chunks are validated as a complete, uniquely numbered sequence before colour conversion; ranked gaps and readiness counts unchanged | | 2026-10-29 | minor | Gap 5: Object / Describe masks are enlarged along the photo's edges, so a raised Exposure no longer outlines the subject (#3272); the gap (heuristic Subject / Sky / People, no model mirror) and its hours are unchanged | +| 2026-10-13 | minor | Gap 20: Canon CRW decoded (clean-room derivation; EOS and G1/G6 verified pixel-exact; G5 preview) — removed from the long-tail list; hours 40–80 → 35–75 after merging main (MRW) | | 2026-10-24 | minor | Gap 28: ⌘⌥⇧C / ⌘⌥⇧V (Ctrl+Alt+Shift+C / V on Windows and Linux) copy and paste metadata; no key leaves the entry; hours unchanged | | 2026-10-24 | minor | Gap 30 shrinks: the Info panel's Show Metadata For (Target Photo / Selected Photos, `view.infoSelectedPhotos`) shows the selected photos' shared values and marks fields that differ as Mixed; the All Metadata dialog remains; 1–3 h (was 4–8) | | 2026-10-24 | patch | Typed GPS input now validates the complete coordinate expression, rejecting unknown text, wrong-axis or conflicting hemispheres, and invalid DMS minutes/seconds before changing metadata; ranked gaps, estimates and readiness counts unchanged | @@ -176,3 +177,4 @@ Beta-blocking gaps (B) total **~230–430 h**; with the stability and platform w | 2026-10-14 | minor | Gap 10: 515 of 1,446 models verified (36%), ~84% of photographers on a verified body (integration batch 36) | | 2026-10-24 | patch | LR-META-XMP: sidecar keywords are written as names in `dc:subject` and paths in `lr:hierarchicalSubject`, so other DAMs can search them; ranked gaps and estimates unchanged | | 2026-10-20 | minor | Opt-in Windows DirectComposition preference added; VRR hardware verification pending; parity counts unchanged | +| 2026-10-25 | minor | Gap 1: first chart-calibrated model, the Canon EOS D60 (ColorChecker Classic under tungsten and sun, `crates/raw/src/chart_table.rs`); the gap stays open, hours unchanged | diff --git a/docs/parity-checklist.md b/docs/parity-checklist.md index 46aabad737..600df0a08f 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-30 · **Change:** minor (LR-BEHAV-ACCESS: the Flatpak may talk to the accessibility bus; LR-LIB-ALBUM: album commands leave out photos the library no longer has and record nothing when they add nothing; LR-BEHAV-DRAGDROP: a right-click on a text field while photos are carried from the grid opens no Cut / Copy / Paste menu; LR-BEHAV-DRAGDROP: a right-click while photos are carried from the grid opens no context menu; LR-LIB-VIRTUALCOPY: default numbering is preflighted across the requested batch and explicit names bypass suffix allocation; LR-BEHAV-DRAGDROP: only the primary button drags photos out of the grid and drops them; KEYC-RATING: deleting a keyword while Enable Filters has the filter put aside no longer leaves an empty one there; LR-BEHAV-DRAGDROP: a drop's destination is named with its parent when another folder or album has the same name; LR-VIEW-FILMSTRIP: photos drag from the filmstrip to the same sidebar targets as from the grid; LRC-LIB-LIBFOLDERS: a deep row's count follows its name in a narrow panel; LR-FILT-FLAG / LRC-LIB-FILTERBAR: the flag toggles combine, Picked + Unflagged, #2588; LR-VIEW-PHOTOGRID, LR-VIEW-FILMSTRIP, LR-VIEW-COMPARE, LR-VIEW-SURVEY, LRC-LIB-REFVIEW, LRC-LIB-PEOPLE: the active photo's selection ring shows on light themes and in Compare, Survey and the face tiles, and needs a loaded thumbnail; LR-FILT-SEARCH-META: `>=` / `<=` in fielded search tokens; MENU-FILE-CLOSE, KEY-CLOSEWINDOW: the notes say Close Window quits the app, after the same check as Quit; MENU-EDIT-SELECTNONE, MENU-EDIT-PASTESELECTED: Edit lists Select Only Active Photo after Deselect All and Paste Settings from Previous after Paste Selected Settings…; on macOS no doubled separators are left where Settings… moved to the app menu; LR-BEHAV-TITLEBAR: a double-click follows the system setting, and a panel over the bar keeps the window still; KEYC-METADATA, LRC-LIB-KEYWORDS: ⌥0 / ⌥⇧0 go to the next / previous keyword set; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; KEYC-METADATA: ⌘K / Ctrl+K Add Keywords; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; LR-META-LOCATION: Info GPS text is fully validated before metadata changes; LR-MAP-TRACKLOG decodes GPX character references in point fields; malformed references error; CDATA stays literal; LR-BEHAV-ACCESS: the Thumbnail size control is a slider to screen readers; LR-BEHAV-ACCESS: the Detail photo is named with its file name; LR-VIEW-PHOTOGRID: the grid's empty-view message names its shortcut as this platform writes it and as it is bound; LR-BEHAV-ACCESS: the grid's date headers are named as they read; LR-BEHAV-ACCESS: the sidebar's disclosure triangles name their row; KEYC-METADATA, LRC-LIB-KEYWORDS: ⌘⌥⇧K Set Keyword Shortcut and ⇧K; KEYC-METADATA: ⌘⇧K / Ctrl+Shift+K Edit Keywords; LR-FILT-SEARCH-META: `>=` / `<=` in fielded search tokens; MENU-FILE-CLOSE, KEY-CLOSEWINDOW: the notes say Close Window quits the app, after the same check as Quit; MENU-EDIT-SELECTNONE, MENU-EDIT-PASTESELECTED: Edit lists Select Only Active Photo after Deselect All and Paste Settings from Previous after Paste Selected Settings…; on macOS no doubled separators are left where Settings… moved to the app menu; LR-BEHAV-TITLEBAR: a double-click follows the system setting, and a panel over the bar keeps the window still; KEYC-METADATA, LRC-LIB-KEYWORDS: ⌥0 / ⌥⇧0 go to the next / previous keyword set; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; KEYC-METADATA: ⌘K / Ctrl+K Add Keywords; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; LRC-LIB-FOLDERS: Local's built-in places (Pictures, Desktop, Downloads, Home) offer no Rename Folder… or Move Folder To…, and `folder.rename` / `folder.move` refuse the home folder and its Pictures, Desktop and Downloads; LRC-LIB-CATALOG-SWITCH: a library's catalog.snap or folder given at launch opens that library; LR-IMP-ADD-DIALOG / LR-IMP-MOVE: checked rename-sequence exhaustion; LR-IMP-ADD-DIALOG: an import asks the disk about the probes a scan left, and for each photo's sidecar, up to 16 files at a time; LRC-LIB-LIBFOLDERS: Don't ask again in the Move Photos question is kept only when the move started; a refused move leaves the question on; LR-IMP-ADD-DIALOG: remembered import thumbnail size, density-aware bounded previews and one job per candidate/size bucket (#2237, part of #2056); import loupe remains open; counts unchanged; LR-FILT-SEARCH-META: `>=` / `<=` in fielded search tokens; MENU-FILE-CLOSE, KEY-CLOSEWINDOW: the notes say Close Window quits the app, after the same check as Quit; MENU-EDIT-SELECTNONE, MENU-EDIT-PASTESELECTED: Edit lists Select Only Active Photo after Deselect All and Paste Settings from Previous after Paste Selected Settings…; on macOS no doubled separators are left where Settings… moved to the app menu; LR-BEHAV-TITLEBAR: a double-click follows the system setting, and a panel over the bar keeps the window still; KEYC-METADATA, LRC-LIB-KEYWORDS: ⌥0 / ⌥⇧0 go to the next / previous keyword set; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; KEYC-METADATA: ⌘K / Ctrl+K Add Keywords; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; LR-MERGE-HDR / LR-MERGE-PANO / LR-MERGE-HDRPANO: the dialog makes a new preview each time it opens, also after a failed one, #2708; LR-FILT-SEARCH-META: `>=` / `<=` in fielded search tokens; MENU-FILE-CLOSE, KEY-CLOSEWINDOW: the notes say Close Window quits the app, after the same check as Quit; MENU-EDIT-SELECTNONE, MENU-EDIT-PASTESELECTED: Edit lists Select Only Active Photo after Deselect All and Paste Settings from Previous after Paste Selected Settings…; on macOS no doubled separators are left where Settings… moved to the app menu; LR-BEHAV-TITLEBAR: a double-click follows the system setting, and a panel over the bar keeps the window still; KEYC-METADATA, LRC-LIB-KEYWORDS: ⌥0 / ⌥⇧0 go to the next / previous keyword set; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; KEYC-METADATA: ⌘K / Ctrl+K Add Keywords; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; LRC-LIB-MISSING: `library.missing` from the control channel checks the files on a worker thread instead of the UI thread; LR-FILT-SEARCH-META: `>=` / `<=` in fielded search tokens; MENU-FILE-CLOSE, KEY-CLOSEWINDOW: the notes say Close Window quits the app, after the same check as Quit; MENU-EDIT-SELECTNONE, MENU-EDIT-PASTESELECTED: Edit lists Select Only Active Photo after Deselect All and Paste Settings from Previous after Paste Selected Settings…; on macOS no doubled separators are left where Settings… moved to the app menu; LR-BEHAV-TITLEBAR: a double-click follows the system setting, and a panel over the bar keeps the window still; KEYC-METADATA, LRC-LIB-KEYWORDS: ⌥0 / ⌥⇧0 go to the next / previous keyword set; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; KEYC-METADATA: ⌘K / Ctrl+K Add Keywords; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; LR-CROP-AUTO: Auto straighten reads the vertical vanishing point and the horizon; LR-META-EXIF-FULL: reject extra EXIF clock components so invalid capture-time candidates fall through to valid metadata; LR-FILT-SEARCH-META: `>=` / `<=` in fielded search tokens; MENU-FILE-CLOSE, KEY-CLOSEWINDOW: the notes say Close Window quits the app, after the same check as Quit; MENU-EDIT-SELECTNONE, MENU-EDIT-PASTESELECTED: Edit lists Select Only Active Photo after Deselect All and Paste Settings from Previous after Paste Selected Settings…; on macOS no doubled separators are left where Settings… moved to the app menu; LR-BEHAV-TITLEBAR: a double-click follows the system setting, and a panel over the bar keeps the window still; KEYC-METADATA, LRC-LIB-KEYWORDS: ⌥0 / ⌥⇧0 go to the next / previous keyword set; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; KEYC-METADATA: ⌘K / Ctrl+K Add Keywords; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; LR-META-XMP / LRC-MAP-TRACKLOG: malformed ISO times are not projected or matched; LR-IMP-FORMATS: JPEG ICC APP2 chunk validation; LR-BEHAV-TITLEBAR: a dialog leaves the title bar undimmed, as a macOS sheet does; LR-BEHAV-ACCESS: the bars are toolbars and the panels landmarks for screen readers; LR-BEHAV-ACCESS: every dialog and prompt is exposed as a dialog (a modal one, an alert dialog for the prompts); LR-BEHAV-ACCESS: icon-only buttons are named by their label, with the shortcut as the description; MENU-HELP-HELP: on macOS the Help menu is registered with the application only once the menu bar is installed (muda ignores the call before), so AppKit knows which menu is Help; LR-BEHAV-ACCESS: a slider's value field is named ` value`, with how to use it as its description; MENU-BAR: every shortcut the app shows on macOS lists its modifiers ⌃⌥⇧⌘, as the menu bar does; MENU-BAR: on macOS two menu rows that run the same command each get their own native row and label (File ▸ Export… and File ▸ Export with Preset ▸ Custom…; File ▸ New Album… and Photo ▸ Add to Album ▸ New Album…); LR-BEHAV-DIALOGS: a one-line prompt that is refused stays open and says why, and a New Folder on Disk says it was made; LR-FILT-SEARCH-META: `>=` / `<=` in fielded search tokens; MENU-FILE-CLOSE, KEY-CLOSEWINDOW: the notes say Close Window quits the app, after the same check as Quit; MENU-EDIT-SELECTNONE, MENU-EDIT-PASTESELECTED: Edit lists Select Only Active Photo after Deselect All and Paste Settings from Previous after Paste Selected Settings…; on macOS no doubled separators are left where Settings… moved to the app menu; LR-BEHAV-TITLEBAR: a double-click follows the system setting, and a panel over the bar keeps the window still; KEYC-METADATA, LRC-LIB-KEYWORDS: ⌥0 / ⌥⇧0 go to the next / previous keyword set; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; KEYC-METADATA: ⌘K / Ctrl+K Add Keywords; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; LR-VIEW-HISTOGRAM: the shadow and highlight clipping buttons take their tile and chevron from the theme, so the chevron reads in every theme; LR-FILT-SEARCH-META: `>=` / `<=` in fielded search tokens; MENU-FILE-CLOSE, KEY-CLOSEWINDOW: the notes say Close Window quits the app, after the same check as Quit; MENU-EDIT-SELECTNONE, MENU-EDIT-PASTESELECTED: Edit lists Select Only Active Photo after Deselect All and Paste Settings from Previous after Paste Selected Settings…; on macOS no doubled separators are left where Settings… moved to the app menu; LR-BEHAV-TITLEBAR: a double-click follows the system setting, and a panel over the bar keeps the window still; KEYC-METADATA, LRC-LIB-KEYWORDS: ⌥0 / ⌥⇧0 go to the next / previous keyword set; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; KEYC-METADATA: ⌘K / Ctrl+K Add Keywords; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; LR-FILT-SEARCH-META: `>=` / `<=` in fielded search tokens; MENU-FILE-CLOSE, KEY-CLOSEWINDOW: the notes say Close Window quits the app, after the same check as Quit; MENU-EDIT-SELECTNONE, MENU-EDIT-PASTESELECTED: Edit lists Select Only Active Photo after Deselect All and Paste Settings from Previous after Paste Selected Settings…; on macOS no doubled separators are left where Settings… moved to the app menu; LR-BEHAV-TITLEBAR: a double-click follows the system setting, and a panel over the bar keeps the window still; KEYC-METADATA, LRC-LIB-KEYWORDS: ⌥0 / ⌥⇧0 go to the next / previous keyword set; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; KEYC-METADATA: ⌘K / Ctrl+K Add Keywords; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; LR-MASK-BRUSH: extreme brush segments skip the intermediate dabs; LR-MASK-BRUSH: with the mask overlay hidden, the stroke being painted no longer tints the photo) · **Target:** Adobe Lightroom Classic 15.5 / Lightroom 9.6 +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (LR-IMP-FORMATS: the Canon CRW decoder is the shared craft-libs crate `craft-crw`; LR-PROF-CAMERACOLOR: chart-measured matrices for the Canon EOS D60, its white balance in Kelvin; CRW imports name their camera; LR-BEHAV-ACCESS: the Flatpak may talk to the accessibility bus; LR-LIB-ALBUM: album commands leave out photos the library no longer has and record nothing when they add nothing; LR-BEHAV-DRAGDROP: a right-click on a text field while photos are carried from the grid opens no Cut / Copy / Paste menu; LR-BEHAV-DRAGDROP: a right-click while photos are carried from the grid opens no context menu; LR-LIB-VIRTUALCOPY: default numbering is preflighted across the requested batch and explicit names bypass suffix allocation; LR-BEHAV-DRAGDROP: only the primary button drags photos out of the grid and drops them; KEYC-RATING: deleting a keyword while Enable Filters has the filter put aside no longer leaves an empty one there; LR-BEHAV-DRAGDROP: a drop's destination is named with its parent when another folder or album has the same name; LR-VIEW-FILMSTRIP: photos drag from the filmstrip to the same sidebar targets as from the grid; LRC-LIB-LIBFOLDERS: a deep row's count follows its name in a narrow panel; LR-FILT-FLAG / LRC-LIB-FILTERBAR: the flag toggles combine, Picked + Unflagged, #2588; LR-VIEW-PHOTOGRID, LR-VIEW-FILMSTRIP, LR-VIEW-COMPARE, LR-VIEW-SURVEY, LRC-LIB-REFVIEW, LRC-LIB-PEOPLE: the active photo's selection ring shows on light themes and in Compare, Survey and the face tiles, and needs a loaded thumbnail; LR-FILT-SEARCH-META: `>=` / `<=` in fielded search tokens; MENU-FILE-CLOSE, KEY-CLOSEWINDOW: the notes say Close Window quits the app, after the same check as Quit; MENU-EDIT-SELECTNONE, MENU-EDIT-PASTESELECTED: Edit lists Select Only Active Photo after Deselect All and Paste Settings from Previous after Paste Selected Settings…; on macOS no doubled separators are left where Settings… moved to the app menu; LR-BEHAV-TITLEBAR: a double-click follows the system setting, and a panel over the bar keeps the window still; KEYC-METADATA, LRC-LIB-KEYWORDS: ⌥0 / ⌥⇧0 go to the next / previous keyword set; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; KEYC-METADATA: ⌘K / Ctrl+K Add Keywords; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; LR-META-LOCATION: Info GPS text is fully validated before metadata changes; LR-MAP-TRACKLOG decodes GPX character references in point fields; malformed references error; CDATA stays literal; LR-BEHAV-ACCESS: the Thumbnail size control is a slider to screen readers; LR-BEHAV-ACCESS: the Detail photo is named with its file name; LR-VIEW-PHOTOGRID: the grid's empty-view message names its shortcut as this platform writes it and as it is bound; LR-BEHAV-ACCESS: the grid's date headers are named as they read; LR-BEHAV-ACCESS: the sidebar's disclosure triangles name their row; KEYC-METADATA, LRC-LIB-KEYWORDS: ⌘⌥⇧K Set Keyword Shortcut and ⇧K; KEYC-METADATA: ⌘⇧K / Ctrl+Shift+K Edit Keywords; LR-FILT-SEARCH-META: `>=` / `<=` in fielded search tokens; MENU-FILE-CLOSE, KEY-CLOSEWINDOW: the notes say Close Window quits the app, after the same check as Quit; MENU-EDIT-SELECTNONE, MENU-EDIT-PASTESELECTED: Edit lists Select Only Active Photo after Deselect All and Paste Settings from Previous after Paste Selected Settings…; on macOS no doubled separators are left where Settings… moved to the app menu; LR-BEHAV-TITLEBAR: a double-click follows the system setting, and a panel over the bar keeps the window still; KEYC-METADATA, LRC-LIB-KEYWORDS: ⌥0 / ⌥⇧0 go to the next / previous keyword set; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; KEYC-METADATA: ⌘K / Ctrl+K Add Keywords; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; LRC-LIB-FOLDERS: Local's built-in places (Pictures, Desktop, Downloads, Home) offer no Rename Folder… or Move Folder To…, and `folder.rename` / `folder.move` refuse the home folder and its Pictures, Desktop and Downloads; LRC-LIB-CATALOG-SWITCH: a library's catalog.snap or folder given at launch opens that library; LR-IMP-ADD-DIALOG / LR-IMP-MOVE: checked rename-sequence exhaustion; LR-IMP-ADD-DIALOG: an import asks the disk about the probes a scan left, and for each photo's sidecar, up to 16 files at a time; LRC-LIB-LIBFOLDERS: Don't ask again in the Move Photos question is kept only when the move started; a refused move leaves the question on; LR-IMP-ADD-DIALOG: remembered import thumbnail size, density-aware bounded previews and one job per candidate/size bucket (#2237, part of #2056); import loupe remains open; counts unchanged; LR-FILT-SEARCH-META: `>=` / `<=` in fielded search tokens; MENU-FILE-CLOSE, KEY-CLOSEWINDOW: the notes say Close Window quits the app, after the same check as Quit; MENU-EDIT-SELECTNONE, MENU-EDIT-PASTESELECTED: Edit lists Select Only Active Photo after Deselect All and Paste Settings from Previous after Paste Selected Settings…; on macOS no doubled separators are left where Settings… moved to the app menu; LR-BEHAV-TITLEBAR: a double-click follows the system setting, and a panel over the bar keeps the window still; KEYC-METADATA, LRC-LIB-KEYWORDS: ⌥0 / ⌥⇧0 go to the next / previous keyword set; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; KEYC-METADATA: ⌘K / Ctrl+K Add Keywords; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; LR-MERGE-HDR / LR-MERGE-PANO / LR-MERGE-HDRPANO: the dialog makes a new preview each time it opens, also after a failed one, #2708; LR-FILT-SEARCH-META: `>=` / `<=` in fielded search tokens; MENU-FILE-CLOSE, KEY-CLOSEWINDOW: the notes say Close Window quits the app, after the same check as Quit; MENU-EDIT-SELECTNONE, MENU-EDIT-PASTESELECTED: Edit lists Select Only Active Photo after Deselect All and Paste Settings from Previous after Paste Selected Settings…; on macOS no doubled separators are left where Settings… moved to the app menu; LR-BEHAV-TITLEBAR: a double-click follows the system setting, and a panel over the bar keeps the window still; KEYC-METADATA, LRC-LIB-KEYWORDS: ⌥0 / ⌥⇧0 go to the next / previous keyword set; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; KEYC-METADATA: ⌘K / Ctrl+K Add Keywords; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; LRC-LIB-MISSING: `library.missing` from the control channel checks the files on a worker thread instead of the UI thread; LR-FILT-SEARCH-META: `>=` / `<=` in fielded search tokens; MENU-FILE-CLOSE, KEY-CLOSEWINDOW: the notes say Close Window quits the app, after the same check as Quit; MENU-EDIT-SELECTNONE, MENU-EDIT-PASTESELECTED: Edit lists Select Only Active Photo after Deselect All and Paste Settings from Previous after Paste Selected Settings…; on macOS no doubled separators are left where Settings… moved to the app menu; LR-BEHAV-TITLEBAR: a double-click follows the system setting, and a panel over the bar keeps the window still; KEYC-METADATA, LRC-LIB-KEYWORDS: ⌥0 / ⌥⇧0 go to the next / previous keyword set; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; KEYC-METADATA: ⌘K / Ctrl+K Add Keywords; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; LR-CROP-AUTO: Auto straighten reads the vertical vanishing point and the horizon; LR-META-EXIF-FULL: reject extra EXIF clock components so invalid capture-time candidates fall through to valid metadata; LR-FILT-SEARCH-META: `>=` / `<=` in fielded search tokens; MENU-FILE-CLOSE, KEY-CLOSEWINDOW: the notes say Close Window quits the app, after the same check as Quit; MENU-EDIT-SELECTNONE, MENU-EDIT-PASTESELECTED: Edit lists Select Only Active Photo after Deselect All and Paste Settings from Previous after Paste Selected Settings…; on macOS no doubled separators are left where Settings… moved to the app menu; LR-BEHAV-TITLEBAR: a double-click follows the system setting, and a panel over the bar keeps the window still; KEYC-METADATA, LRC-LIB-KEYWORDS: ⌥0 / ⌥⇧0 go to the next / previous keyword set; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; KEYC-METADATA: ⌘K / Ctrl+K Add Keywords; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; LR-META-XMP / LRC-MAP-TRACKLOG: malformed ISO times are not projected or matched; LR-IMP-FORMATS: JPEG ICC APP2 chunk validation; LR-BEHAV-TITLEBAR: a dialog leaves the title bar undimmed, as a macOS sheet does; LR-BEHAV-ACCESS: the bars are toolbars and the panels landmarks for screen readers; LR-BEHAV-ACCESS: every dialog and prompt is exposed as a dialog (a modal one, an alert dialog for the prompts); LR-BEHAV-ACCESS: icon-only buttons are named by their label, with the shortcut as the description; MENU-HELP-HELP: on macOS the Help menu is registered with the application only once the menu bar is installed (muda ignores the call before), so AppKit knows which menu is Help; LR-BEHAV-ACCESS: a slider's value field is named ` value`, with how to use it as its description; MENU-BAR: every shortcut the app shows on macOS lists its modifiers ⌃⌥⇧⌘, as the menu bar does; MENU-BAR: on macOS two menu rows that run the same command each get their own native row and label (File ▸ Export… and File ▸ Export with Preset ▸ Custom…; File ▸ New Album… and Photo ▸ Add to Album ▸ New Album…); LR-BEHAV-DIALOGS: a one-line prompt that is refused stays open and says why, and a New Folder on Disk says it was made; LR-FILT-SEARCH-META: `>=` / `<=` in fielded search tokens; MENU-FILE-CLOSE, KEY-CLOSEWINDOW: the notes say Close Window quits the app, after the same check as Quit; MENU-EDIT-SELECTNONE, MENU-EDIT-PASTESELECTED: Edit lists Select Only Active Photo after Deselect All and Paste Settings from Previous after Paste Selected Settings…; on macOS no doubled separators are left where Settings… moved to the app menu; LR-BEHAV-TITLEBAR: a double-click follows the system setting, and a panel over the bar keeps the window still; KEYC-METADATA, LRC-LIB-KEYWORDS: ⌥0 / ⌥⇧0 go to the next / previous keyword set; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; KEYC-METADATA: ⌘K / Ctrl+K Add Keywords; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; LR-VIEW-HISTOGRAM: the shadow and highlight clipping buttons take their tile and chevron from the theme, so the chevron reads in every theme; LR-FILT-SEARCH-META: `>=` / `<=` in fielded search tokens; MENU-FILE-CLOSE, KEY-CLOSEWINDOW: the notes say Close Window quits the app, after the same check as Quit; MENU-EDIT-SELECTNONE, MENU-EDIT-PASTESELECTED: Edit lists Select Only Active Photo after Deselect All and Paste Settings from Previous after Paste Selected Settings…; on macOS no doubled separators are left where Settings… moved to the app menu; LR-BEHAV-TITLEBAR: a double-click follows the system setting, and a panel over the bar keeps the window still; KEYC-METADATA, LRC-LIB-KEYWORDS: ⌥0 / ⌥⇧0 go to the next / previous keyword set; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; KEYC-METADATA: ⌘K / Ctrl+K Add Keywords; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; LR-FILT-SEARCH-META: `>=` / `<=` in fielded search tokens; MENU-FILE-CLOSE, KEY-CLOSEWINDOW: the notes say Close Window quits the app, after the same check as Quit; MENU-EDIT-SELECTNONE, MENU-EDIT-PASTESELECTED: Edit lists Select Only Active Photo after Deselect All and Paste Settings from Previous after Paste Selected Settings…; on macOS no doubled separators are left where Settings… moved to the app menu; LR-BEHAV-TITLEBAR: a double-click follows the system setting, and a panel over the bar keeps the window still; KEYC-METADATA, LRC-LIB-KEYWORDS: ⌥0 / ⌥⇧0 go to the next / previous keyword set; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; KEYC-METADATA: ⌘K / Ctrl+K Add Keywords; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; LR-MASK-BRUSH: extreme brush segments skip the intermediate dabs; LR-MASK-BRUSH: with the mask overlay hidden, the stroke being painted no longer tints the photo) · **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 @@ -80,8 +80,8 @@ differences and missing bindings are in [ui-parity.md](ui-parity.md#shortcuts). | LR-IMP-PROFILES | Import profiles & presets | P1 | ✅ | `cmd:file.importPresets`, `cmd:preset.import`, `cmd:profile.import`, `crates/engine/src/preset_import.rs`, `crates/engine/src/preset_luminar.rs` | presets: .lcpreset, XMP, classic .lrtemplate (local adjustment templates become mask effects, LR-MASK-EFFECTS), photos carrying edits ("DNG presets"), Luminar looks (.lmp, .mplumpack collections; sliders with a counterpart), .zip bundles, folders (folder → group), drag & drop (an `.xmp` dropped together with its photo is that photo's sidecar and is not imported as a preset, issue #936); masks carried over; unmapped settings reported (fields that only describe the preset or photo, e.g. `Cluster`, `SortName`, `SupportsAmount2`, the as-shot white, empty Point Color slots, are not); profiles: .cube 3D LUTs (one toast reports both halves; a LUT that fails is named with its reason); a preset that names a profile (`crs:Look`) applies the imported profile of that name, imported before or after it, and Lightroom's basic profiles map to ours (`crates/engine/src/profile_refs.rs`, issue #1001); Adobe profile formats deliberately unsupported (so `.xmp` creative profiles' colour tables aren't read) | | LR-IMP-LOCAL | Work on files in place | P0 | ✅ | `cmd:library.browse`, `cmd:photo.addToLibrary`, `cmd:library.import` (mode add), `cmd:local.addRoot`, `cmd:local.hide`, `cmd:local.restoreHidden`, `crates/engine/src/cmd/browse.rs`, `crates/ui-egui/src/panels/left.rs` (`local_section`), `crates/ui-egui/src/panels/grid.rs` (`folder_header`) | Local: browse Pictures / Desktop / Downloads / Home or any folder without adding it (breadcrumb, Include subfolders, Add N to My Photos); browsed photos stay out of All Photos, albums and counts (album commands skip them and the album menus say to Add to My Photos first, issue #684); folders picked with Browse Folder… (or Keep in Local / Add to Local on a folder row) stay listed across restarts, and browsing a folder inside a listed one highlights it inside that tree (opened down to it, siblings reachable) instead of adding a root; edits go to XMP sidecars; importing promotes them; right-click a top-level location → Remove from Local hides the shortcut only (nothing on disk or in the catalog changes), saved with the UI state, and “Show N hidden locations” (or Browse Folder… on it) brings it back, each on its own from the row's list when several are hidden, or all at once with Restore All (issue #2114); a folder is one location however its path is spelled (`/` or `\`, trailing separator, `.`/`..`, drive-letter case; `folder_key` in `crates/catalog/src/query.rs`); browsed photos nobody changed are forgotten once their folder has not been browsed for 30 days (Settings → Performance → Local folders, 0 = never; checked when the library opens, or `cmd:library.forgetLocal` with `dryRun`; files and sidecars stay, browsing again brings them back; see `crates/catalog/src/local.rs` for what counts as a change); browsing a folder again forgets at once the untouched records of its files that another app deleted or moved, so they no longer fail to load on every visit (issue #1392; changed ones stay, shown as missing); browsing a folder keeps the active photo when the folder shows it, else makes the folder's first photo active as it arrives, the same rule as albums and the other sources (`Session::keep_active_in_view`; issue #1447: before, a library photo stayed active, so Photo Grid marked nothing and Detail, the histogram and the info showed a photo the folder doesn't hold) | | LR-IMP-SIDECAR-SPLIT | Separate XMP sidecar variants | P2 | ⬜ | `cmd:library.xmpPreferences` | sidecar naming option exists (stem/full), no split sidecars | -| LR-IMP-FORMATS | Supported formats | P0 | 🟡 | `crates/codecs/src/lib.rs`, `crates/raw/src/lib.rs`, `crates/raw/src/jxl.rs` | JPEG (ICC APP2 sequences require unique complete chunks with consistent totals; malformed profiles use the existing unsupported-profile sRGB fallback; a Samsung panorama whose scan data runs into its SEF trailer with no end-of-image marker reads as the image before the trailer, while a JPEG cut short is still refused, issue #3350, `crates/codecs/src/jpeg.rs`), PNG, TIFF (1- to 64-bit integer, 16- to 64-bit float, incl. bilevel and CCITT fax), WebP, JXL, PSD, GIF, BMP (lossy wide-gamut JXL decodes to the right colours: jxl-oxide desaturated XYB rendered to P3/Rec. 2020, worked around in `crates/codecs/src/jxl.rs`); DNG (incl. lossy / Smart Preview DNG and DNG 1.7 JPEG XL tiles/strips: lossless ones decode bit-exactly on synthetic CFA and LinearRaw files, lossy ones are restored to the declared primaries and transfer curve (linear, sRGB, BT.709 or a power; PQ / HLG stay preview-only) without clipping or gamut mapping, checked on one real file with 108 lossy tiles and on 2 Lightroom Classic 15.1 lossy LinearRaw DNGs (ILCE-7CM2) whose tiles declare Rec. 2100 primaries with the sRGB curve, which were preview-only before, and any tile that fails to decode makes the file preview-only; DNG 1.7 row/column-interleaved rasters (`RowInterleaveFactor` / `ColumnInterleaveFactor`) are undone before the mosaic is read, so a file from Adobe's converter with a 2×2 interleave no longer decodes as four scaled-down copies in the wrong colours; a dimension the factor does not divide decodes with short trailing fields; verified on 4 real ILCE-6400 JPEG XL DNGs rendering bit-identical to their non-interleaved twins, factors above 2 rest on the plain reading of the tag; a single-chunk JPEG XL preview IFD is offered as the embedded preview; a DNG whose samples pile up at one value well below its stated `WhiteLevel`, as a camera app's 12-bit Bayer DNG that states 4095 and clips at 3567, has those samples raised to the white level on decode, so highlight reconstruction sees the clipped areas instead of white balance tinting them magenta, issue #548, `crates/raw/src/saturation.rs`), CR2 (colour-filter layout from the file's `CR2CFAPattern` tag, issue #85), ARW (pre-2017 bodies: white balance and black level from the encrypted `SR2SubIFD`, issue #148, its `WB_RGGBLevels` being the white balance the camera applied, issue #535; the DSLR-A900's packed 12-bit strip, two pixels per three bytes, read only when the strip is exactly 1.5 bytes per pixel, with its camera-JPEG window centred, checked on one CC0 file (A850 unmeasured); downsized Sony lossless YCbCr 4:2:0 / 4:2:2 tiles decoded to linear RGB, verified on private ILCE-7M4 3:2 & 4:3 examples including 16-bit full-resolution export; Sony DSC-R1 .SR2 decodes, its big-endian 16-bit words read in the order that fits the sample range, checked on the CC0 3221 sample; its crop and white balance live in the SR2SubIFD and are not read yet; ARW6 Compressed / Compressed (HQ) of the ILCE-7RM6 (`crates/raw/src/vendor/arw6.rs`, `crates/raw/src/llvc.rs`; 12-bit codes exact against a black-box oracle on 8 CC0 files, FF over the full frame, APS-C in the interior (LibRaw's own edge rows differ); output through our own companding curve, measured from CC0 lossless / ARW6 pairs; geometry checked against the camera JPEG, `docs/arw6-compression.md`; the ILCE-7M5 writes the same codec, unverified)), NEF (uncompressed, lossless and lossy compressed 12/14-bit, `crates/raw/src/vendor/nefc.rs`), RAF (uncompressed, lossless/lossy compressed Bayer and X-Trans; `crates/raw/src/vendor/rafc.rs`, full sensor verification on 13 bodies, `docs/raf-compression.md`), RW2 / Leica RWL / Panasonic RAW in every raw format (compressed 4 and 6, the prefix-coded strips of format 8 from the GH6 on, packed 2/5/7, the 16-bit words of the 2005–2007 bodies; black levels, in-camera aspect crops and mapped-out defect pixels; 178 CC0 files from 118 bodies checked, `crates/raw/src/vendor/rw2.rs`), PEF, ORF (uncompressed; colour-filter layout from the file's Exif `CFAPattern`; 12.8 bit/px 16-byte blocks of ten 12-bit samples + a zero pad byte, E-300 / E-330 / E-500 verified on CC0 files, E-M5 Mark II / PEN-F high-res files decode smooth but CFA and black unverified), Kodak DCS520C TIFF (a two-component 12-bit lossless JPEG strip, the two components the even and odd columns; the file's `GrayResponseCurve` table linearises the companded samples to 12 bits, black measured per CFA position, white balance from the `KodakIFD`; `RawFormat::KodakDcs`, `crates/raw/src/vendor/kodak.rs`, checked on the one CC0 sample against its IFD0 thumbnail), Hasselblad 3FR and FFF (a TIFF without a DNG version tag that describes its CFA IFD, levels, crop and white balance with DNG's tags; `RawFormat::CfaTiff`, read by `dng::decode_as`, RGGB when the file states no `CFAPattern`, checked against the camera preview on the CC0 H4D-40 FFF and CFV 3FR; an FFF has no colour matrix of its own and takes the camera's from the original 3FR header it embeds in tag `0xC51B`; neither carries a JPEG, so their uncompressed 8-bit RGB preview (1217 × 913 in the H4D-40 FFF, 218 × 218 in the CFV 3FR) is the embedded preview, handed on as a baseline TIFF, `crates/raw/src/vendor/hasselblad.rs`): uncompressed (X1D, X1D II, X2D, CFV 100C) and Hasselblad's lossless JPEG with scan selection value 8 (every FFF; H3D, H4D and CFV-50c 3FR), `ljpeg::decode_hasselblad`, its rule measured on 14 CC0 files with the ljpeg-explorer tool, Minolta / Konica Minolta MRW (the `\0MRM` block container: `PRD` sensor size, 12-bit packed or 16-bit-word storage and the RGGB / GBRG cell, `WBG` gains in cell order, the `TTW` TIFF for Exif and orientation, black 0 and white from the saturation plateau; `crates/raw/src/vendor/mrw.rs`, DiMAGE 7, 7Hi, A1, A2, A200 and Dynax / Maxxum 7D checked on CC0 files against their previews), Samsung SRW without compression (NX5, NX10, NX11 and the NX20-generation bodies NX20, NX200, NX210, NX1000 and NX1100 as 12-bit packed samples in either bit order, EX1 and WB2000 as 16-bit words; layout, camera-JPEG framing, levels and white balance from the maker note, `crates/raw/src/vendor/srw.rs`; median ΔE vs the camera JPEG 2.2–7.6 on 11 of the 12 files from 10 bodies checked, 10.7 (5.7 registered) on the backlit WB2000 sample). 12-bit NEF black level: maker note `0x003d` is in 14-bit units (D750, D780, D850, D7500, Z 50 checked). Lossy type 2 NEF curves of version `0x44 0x40` (D780, D6, Z 5, Z 6, Z 7, Z 7_2) span a quarter of the sample range, read from the table's own point spacing. Import probes (`probe_info`) of compressed NEFs decode only the first 128 rows, the ones the masked-trailing-column test reads in both the probe and the full decode (the D5100 and D7000 write 8 masked columns at 0 with no maker-note tag for them, compressed and uncompressed alike), instead of the whole Huffman stream: ~3 ms instead of the full decode time per file (386 ms on a 24 MP D750 file), issue #708. CR3 lossless CRX Bayer and version 0x100/0x200 C-RAW decodes to sensor pixels with timed white balance, black/white levels and file crop (EOS R6 Mark III `ColorData` version 66: as-shot white balance and black level from the file, white level from the data, `docs/cr3.md`) (the shot's aspect ratio from the maker note's `AspectInfo`); full sensor samples match the reference on M50/R100/R8/RP, incl. RP 1.6× crop mode (`crates/raw/tests/it/cr3_corpus.rs`, `docs/cr3.md`). EOS R5 Mark II C-RAW and RAW decode too (the QP map's first-symbol literal and 23-zero escape, odd-height Bayer planes): 4 CC0 files pinned, every QP map of 33,665 private C-RAW files decodes exactly, and full-frame images match the camera JPEG. Unsupported coding variants retain metadata and use the embedded JPEG when available; HEVC preview decoding remains unsupported. Missing: CR3 unverified CRX variants, compressed ORF, compressed Samsung SRW (NX1, NX30, NX300, NX500, NX2000, NX3000, NX3300, NX mini: preview only with the reason), Nikon High Efficiency NEF (HE / HE★ from the Z 8, Z 9, Z 6III and Z f: compression 34713 with a JPEG XS codestream and no `0x0096` table; no public specification, so preview only with the reason "Nikon High Efficiency NEF", issue #193; Lossless compressed NEFs from the same bodies decode), NEF "lossy after split" (preview only: imported with `preview_only` = the decoder's reason, rendered as a rendered JPEG, flagged by a grid badge and loupe/Edit/Info notices, `previewOnly` in `catalog.query`; Reload clears it once the file decodes, and the notices carry a Reload from Disk button; each flag is stamped with the app version that set it, and a library opened in another version rechecks its preview-only raws in the background, so a raw a newer release decodes is cleared without a manual Reload, issue #662, `library.recheckPreviewOnly`), TIFF-based raws whose raw data sits in a private block (Phase One / Leaf IIQ, Canon EOS-1D / 1Ds and the Kodak DCS Pro / DCS760C TIFFs (compression 65000): IFD0 is only a reduced RGB image next to a much larger declared picture) are recognised from that structure and import as `preview_only` with the reason, instead of opening as a thumbnail-sized ordinary image (`thumbnail_shell` in `crates/raw/src/lib.rs`), Recognised raws LightCraft cannot decode open as `preview_only` with any usable embedded JPEG, also Canon CRW and Sigma X3F (containers recognised by magic, preview found by a structural JPEG scan), Kodak KDC (IFD0 without `ImageWidth`), Leaf MOS and Epson ERF (scan; ones with no JPEG still fail with "without an embedded preview", AVIF decode (HEIC decodes only behind the non-default `heif` feature, which the release packages enable: `crates/heif`, heic-rs for the container and HEVC (bit-exact against libde265 on iPhone tiles) plus our own colour conversion, matching libheif within 1 code value on iPhone-style grids (VUI full range, Display P3 ICC, nclx, 10-bit, irot/imir/clap, gain map/depth ignored); 4:2:0/monochrome only, 4:2:2/4:4:4 Canon/Sony HIF refused; same policy as PhotoCraft), palette (indexed-colour) TIFF (refused by the `tiff` crate); folder discovery and file pickers include Sony SR2 and SRF, with the same extension list used by CLI/MCP: DSC-R1 SR2 decodes from sensor data; DSC-F828 SRF stays preview-only; transparency is flattened onto white, in linear light, where the working image is built (`to_working` in `crates/codecs/src/lib.rs`): renders, previews, exports and contact sheets no longer turn transparent areas black, issue #1212; median ΔE vs the camera JPEG 2.2–7.6 on 11 of the 12 files from 10 bodies checked, 10.7 (5.7 registered) on the backlit WB2000 sample). 12-bit NEF black level: maker note `0x003d` is in 14-bit units (D750, D780, D850, D7500, Z 50 checked). Lossy type 2 NEF curves of version `0x44 0x40` (D780, D6, Z 5, Z 6, Z 7, Z 7_2) span a quarter of the sample range, read from the table's own point spacing. Import probes (`probe_info`) of compressed NEFs decode only the first 128 rows, the ones the masked-trailing-column test reads in both the probe and the full decode (the D5100 and D7000 write 8 masked columns at 0 with no maker-note tag for them, compressed and uncompressed alike), instead of the whole Huffman stream: ~3 ms instead of the full decode time per file (386 ms on a 24 MP D750 file), issue #708. CR3 lossless CRX Bayer and version 0x100/0x200 C-RAW decodes to sensor pixels with timed white balance, black/white levels and file crop (the shot's aspect ratio from the maker note's `AspectInfo`); the Hasselblad Lunar, a Sony NEX-7 under Make HASSELBLAD, decodes as an ARW: a HASSELBLAD file with Sony's raw coding (compression 32767 or tag `0x7010`) goes to the ARW reader, and the body for its `Tag2010` layout comes from the maker note's `SonyModelID`, checked on the CC0 4051 file, issue #1275; an uncompressed MOS, whose IFD0 is the 16-bit mosaic with no Make tag, is recognised by Leaf's data block `0x8606` instead of opening as a greyscale image of its mosaic, issue #1275), and any decode failure of a recognised raw, not only an unsupported variant Nikon 12-bit small RAW (D810 / D4S): packed Y0/Y1/Cb/Cr rows decode to linear RGB; header probes retain geometry without decoding pixels, and truncated strips are refused. Chroma gains are approximate. | -| LR-IMP-CAMERA-COVERAGE | Camera coverage, verified per model | P0 | 🟡 | `crates/raw/tests/it/corpus.rs`, `crates/raw/tests/it/coverage_sweep_corpus.rs`, `docs/raw/evidence.tsv`, `docs/raw/coverage-sweep.tsv`, `xtask/src/main.rs` | a supported container is not the same as every camera that writes it decoding correctly: ~55 CC0 corpus files plus 6 exact-sensor CR3 cases and 4 pinned EOS R5 Mark II files (plus ~60 NEFs checked by hand and 178 Panasonic / Leica RW2, RWL and RAW files from 118 bodies, checked against each file's own JPEG) against the >1,000 models Lightroom lists; per-model differences still surface (e.g. the CR2 colour-filter layout differed by model until it was read from the file's own tag, issue #85, checked on 35 CR2 bodies; CR2 black levels were read from border columns light already reaches, left of `SensorInfo`'s border, so CR2s rendered dark with crushed shadows (EOS 6D: 2591 instead of 2047), now measured from the masked columns only, checked on 8 corpus bodies; pre-2017 Sony ARWs opened green until their scrambled white balance / black level were read, issue #148, checked on 16 ARWs from 15 Sony bodies; their white balance now comes from the encrypted `SR2SubIFD`'s `WB_RGGBLevels`, the gains the camera applied, which 14 bodies (DSLR-A450 … A700, NEX-3/5/C3, SLT-A33/A35/A55, ILCE-6001, UMC-R10C) had no other source for and which the maker-note estimate read before missed by up to 100 % on preset shots, issue #535, checked against ExifTool on 100 decoded ARWs from 87 Sony bodies; the encrypted SR2 black level is now read from its directory entry (the DSLR-A450/A500/A550/A700 read 354–975 instead of 512), checked on 126 ARWs from 97 Sony bodies, and downsized lossless M/S ARWs use their measured black level 1024 instead of 512, checked on 12 files from 4 bodies, issue #535, and on a fifth, the ILCE-7CM2 (issue #697: 0.5.0 rendered its lossless M file with that 512 pedestal, the darkest half of a dusk scene +11 L* and blue, the lamplight white; its darkest 0.1 % per channel sits at 1017/1020/1024, and with 1024 the render is within +3 L* of the camera JPEG; the body's compressed and uncompressed "M-size" files are Bayer at 4736×3132 with black 512, two public ones in the corpus); pre-2017 Sony bodies shot in the camera's 16:9 mode (ILCE-7SM2, DSLR-A580) now get the 16:9 crop of their camera JPEG instead of the whole 3:2 frame with padding columns, issue #535; Canon PowerShot and EOS M CR2s whose `ColorData` is stored as bytes opened green until the bytes were read as 16-bit words, 25 files from 25 bodies checked; private Z 8 crop verified; the Nikon D4, which records no CropArea, gets its image area and white level measured on 148 NEFs against the camera JPEG (optical-black stripes and magenta clipped highlights gone); the D7100, whose data holds picture beyond the camera's frame, develops at Lightroom's frame (the camera JPEG's size) in full frame and 1.3x crop, so Lightroom crops line up (#1248).; CR2 white levels came from masked rows holding samples at 16383, so on the EOS 50D, 60D, 450D (Rebel XSi), 500D (Rebel T1i), 550D (Rebel T2i), 1200D (Rebel T5) and 100D (Rebel SL1) clipped highlights sat at 81–98% of the range and were not treated as clipped, now taken from the active area only, issue #1272). Compressed RAF sensor arrays verified on 13 Fujifilm bodies (`docs/raf-compression.md`). ILCE-7RM6 ARW6 12-bit codes verified on 8 CC0 files (FF and APS-C, both compression modes). Sony ILCE-7CR (61 MP): lossless compressed L and M and compressed ARW2 samples of one scene in the corpus (black level, default crop, as-shot gains, lossless vs compressed mosaic agreement, fitted camera look), and all nine public codings (also uncompressed, small and APS-C crop) decode and fit. Grow the CC0 corpus per model and test each sample decodes with plausible colour. Nikon CropArea and untagged-preview colour-space regression tests; the Nikon D4, which records no CropArea, gets its image area and white level measured on 148 NEFs against the camera JPEG (optical-black stripes and magenta clipped highlights gone). Pentax PEFs without area tags (KP, KF, K-3 Mark III, K-70, K-1, K-1 Mark II, K-S1, K-S2, 645Z) no longer keep their masked border: black, empty and saturated lines are trimmed against the maker-note BlackPoint, issue #1271, measured on 38 CC0 PEFs from 30 bodies.; Canon PowerShot and EOS M CR2s whose `ColorData` is stored as bytes opened green until the bytes were read as 16-bit words, 25 files from 25 bodies checked). Compressed RAF sensor arrays verified on 13 Fujifilm bodies (`docs/raf-compression.md`). ILCE-7RM6 ARW6 12-bit codes verified on 8 CC0 files (FF and APS-C, both compression modes). Sony ILCE-7CR (61 MP): lossless compressed L and M and compressed ARW2 samples of one scene in the corpus (black level, default crop, as-shot gains, lossless vs compressed mosaic agreement, fitted camera look), and all nine public codings (also uncompressed, small and APS-C crop) decode and fit. Grow the CC0 corpus per model and test each sample decodes with plausible colour. Nikon CropArea and untagged-preview colour-space regression tests; the Nikon D4, which records no CropArea, gets its image area and white level measured on 148 NEFs against the camera JPEG (optical-black stripes and magenta clipped highlights gone). The Canon PowerShot G9, which writes no `ColorData`, takes its as-shot white balance from the WBInfo row (`0x0029`) of the preset ShotInfo names, issue #1273, checked on 1 CC0 file against neutral areas of the camera JPEG (within 0.1 %).; the Nikon D4, which records no CropArea, gets its image area and white level measured on 148 NEFs against the camera JPEG (optical-black stripes and magenta clipped highlights gone). The Olympus E-10 (no ImageProcessing directory) takes its as-shot gains and its black level (`0x1012` in `0x102c` ValidBits units: 128 at 12 bits) from the main maker note, issue #1273: its render against the camera thumbnail goes from ΔE76 18.5 with a rejected fit to 11.5 with the fit accepted (measured by AlexChambers).; the Nikon D4, which records no CropArea, gets its image area and white level measured on 148 NEFs against the camera JPEG (optical-black stripes and magenta clipped highlights gone), and the Nikon D90 likewise on 10 of 550 NEFs (42 filler columns on the right that developed as a pink band; green clips below red and blue).; the Nikon D4, which records no CropArea, gets its image area and white level measured on 148 NEFs against the camera JPEG (optical-black stripes and magenta clipped highlights gone). Public raw.pixls.us coverage sweep (#1327): 30 more models verified on 40 CC0 files, with SHA-256 and FNV-1a sensor hashes pinned (`crates/raw/tests/it/coverage_sweep_corpus.rs`, `docs/raw/coverage-sweep.tsv`; `docs/raw/coverage.py`: 515 → 545 verified rows). Render/reference luminance correlation is 0.6801 to 0.9998; eleven candidates excluded for identity, provenance or missing/mismatched reference images. Nikon D6 / Z 6 / Z 7 uncompressed and Z 8 HE variants remain preview-only. Own-matrix DNG tone differs from the camera JPEG (#1277); sensor verification is not colour calibration. | +| LR-IMP-FORMATS | Supported formats | P0 | 🟡 | `crates/codecs/src/lib.rs`, `crates/raw/src/lib.rs`, `crates/raw/src/jxl.rs` | JPEG (ICC APP2 sequences require unique complete chunks with consistent totals; malformed profiles use the existing unsupported-profile sRGB fallback; a Samsung panorama whose scan data runs into its SEF trailer with no end-of-image marker reads as the image before the trailer, while a JPEG cut short is still refused, issue #3350, `crates/codecs/src/jpeg.rs`), PNG, TIFF (1- to 64-bit integer, 16- to 64-bit float, incl. bilevel and CCITT fax), WebP, JXL, PSD, GIF, BMP (lossy wide-gamut JXL decodes to the right colours: jxl-oxide desaturated XYB rendered to P3/Rec. 2020, worked around in `crates/codecs/src/jxl.rs`); DNG (incl. lossy / Smart Preview DNG and DNG 1.7 JPEG XL tiles/strips: lossless ones decode bit-exactly on synthetic CFA and LinearRaw files, lossy ones are restored to the declared primaries and transfer curve (linear, sRGB, BT.709 or a power; PQ / HLG stay preview-only) without clipping or gamut mapping, checked on one real file with 108 lossy tiles and on 2 Lightroom Classic 15.1 lossy LinearRaw DNGs (ILCE-7CM2) whose tiles declare Rec. 2100 primaries with the sRGB curve, which were preview-only before, and any tile that fails to decode makes the file preview-only; DNG 1.7 row/column-interleaved rasters (`RowInterleaveFactor` / `ColumnInterleaveFactor`) are undone before the mosaic is read, so a file from Adobe's converter with a 2×2 interleave no longer decodes as four scaled-down copies in the wrong colours; a dimension the factor does not divide decodes with short trailing fields; verified on 4 real ILCE-6400 JPEG XL DNGs rendering bit-identical to their non-interleaved twins, factors above 2 rest on the plain reading of the tag; a single-chunk JPEG XL preview IFD is offered as the embedded preview; a DNG whose samples pile up at one value well below its stated `WhiteLevel`, as a camera app's 12-bit Bayer DNG that states 4095 and clips at 3567, has those samples raised to the white level on decode, so highlight reconstruction sees the clipped areas instead of white balance tinting them magenta, issue #548, `crates/raw/src/saturation.rs`), CR2 (colour-filter layout from the file's `CR2CFAPattern` tag, issue #85), CRW (CIFF, the 2000–2004 Canon bodies: clean-room-derived decode frozen in `craft-libs crates/crw/clean-room/02-crw-format.md`, `crates/raw/src/vendor/crw.rs`; EOS D30/D60/10D/300D, PowerShot G1 (10-bit GBRG) and G6 pixel-exact against a black-box reference on 28 of 29 corpus files incl. 18 private D60s; as-shot white balance from the ColorBalance record's ShotInfo-selected slot; black level from the darkest flat masked-border strip; rotation from ImageInfo; starting look fitted from the file's own embedded JPEG like CR2/CR3 (`camera_preview::file_local_look`), accepted on all 10 decodable public corpus files (holdout RMS 0.009–0.047), with the fitted matrix absorbing the white balance on the bodies without a ColorBalance record (D30, PowerShots); the PowerShot G5's anomalous entropy coding and the pre-CIFF compacts stay preview-only, and G2/G3/G4/Pro1/S-series decode unverified for lack of redistributable samples), ARW (pre-2017 bodies: white balance and black level from the encrypted `SR2SubIFD`, issue #148, its `WB_RGGBLevels` being the white balance the camera applied, issue #535; the DSLR-A900's packed 12-bit strip, two pixels per three bytes, read only when the strip is exactly 1.5 bytes per pixel, with its camera-JPEG window centred, checked on one CC0 file (A850 unmeasured); downsized Sony lossless YCbCr 4:2:0 / 4:2:2 tiles decoded to linear RGB, verified on private ILCE-7M4 3:2 & 4:3 examples including 16-bit full-resolution export; Sony DSC-R1 .SR2 decodes, its big-endian 16-bit words read in the order that fits the sample range, checked on the CC0 3221 sample; its crop and white balance live in the SR2SubIFD and are not read yet; ARW6 Compressed / Compressed (HQ) of the ILCE-7RM6 (`crates/raw/src/vendor/arw6.rs`, `crates/raw/src/llvc.rs`; 12-bit codes exact against a black-box oracle on 8 CC0 files, FF over the full frame, APS-C in the interior (LibRaw's own edge rows differ); output through our own companding curve, measured from CC0 lossless / ARW6 pairs; geometry checked against the camera JPEG, `docs/arw6-compression.md`; the ILCE-7M5 writes the same codec, unverified)), NEF (uncompressed, lossless and lossy compressed 12/14-bit, `crates/raw/src/vendor/nefc.rs`), RAF (uncompressed, lossless/lossy compressed Bayer and X-Trans; `crates/raw/src/vendor/rafc.rs`, full sensor verification on 13 bodies, `docs/raf-compression.md`), RW2 / Leica RWL / Panasonic RAW in every raw format (compressed 4 and 6, the prefix-coded strips of format 8 from the GH6 on, packed 2/5/7, the 16-bit words of the 2005–2007 bodies; black levels, in-camera aspect crops and mapped-out defect pixels; 178 CC0 files from 118 bodies checked, `crates/raw/src/vendor/rw2.rs`), PEF, ORF (uncompressed; colour-filter layout from the file's Exif `CFAPattern`; 12.8 bit/px 16-byte blocks of ten 12-bit samples + a zero pad byte, E-300 / E-330 / E-500 verified on CC0 files, E-M5 Mark II / PEN-F high-res files decode smooth but CFA and black unverified), Kodak DCS520C TIFF (a two-component 12-bit lossless JPEG strip, the two components the even and odd columns; the file's `GrayResponseCurve` table linearises the companded samples to 12 bits, black measured per CFA position, white balance from the `KodakIFD`; `RawFormat::KodakDcs`, `crates/raw/src/vendor/kodak.rs`, checked on the one CC0 sample against its IFD0 thumbnail), Hasselblad 3FR and FFF (a TIFF without a DNG version tag that describes its CFA IFD, levels, crop and white balance with DNG's tags; `RawFormat::CfaTiff`, read by `dng::decode_as`, RGGB when the file states no `CFAPattern`, checked against the camera preview on the CC0 H4D-40 FFF and CFV 3FR; an FFF has no colour matrix of its own and takes the camera's from the original 3FR header it embeds in tag `0xC51B`; neither carries a JPEG, so their uncompressed 8-bit RGB preview (1217 × 913 in the H4D-40 FFF, 218 × 218 in the CFV 3FR) is the embedded preview, handed on as a baseline TIFF, `crates/raw/src/vendor/hasselblad.rs`): uncompressed (X1D, X1D II, X2D, CFV 100C) and Hasselblad's lossless JPEG with scan selection value 8 (every FFF; H3D, H4D and CFV-50c 3FR), `ljpeg::decode_hasselblad`, its rule measured on 14 CC0 files with the ljpeg-explorer tool, Minolta / Konica Minolta MRW (the `\0MRM` block container: `PRD` sensor size, 12-bit packed or 16-bit-word storage and the RGGB / GBRG cell, `WBG` gains in cell order, the `TTW` TIFF for Exif and orientation, black 0 and white from the saturation plateau; `crates/raw/src/vendor/mrw.rs`, DiMAGE 7, 7Hi, A1, A2, A200 and Dynax / Maxxum 7D checked on CC0 files against their previews), Samsung SRW without compression (NX5, NX10, NX11 and the NX20-generation bodies NX20, NX200, NX210, NX1000 and NX1100 as 12-bit packed samples in either bit order, EX1 and WB2000 as 16-bit words; layout, camera-JPEG framing, levels and white balance from the maker note, `crates/raw/src/vendor/srw.rs`; median ΔE vs the camera JPEG 2.2–7.6 on 11 of the 12 files from 10 bodies checked, 10.7 (5.7 registered) on the backlit WB2000 sample). 12-bit NEF black level: maker note `0x003d` is in 14-bit units (D750, D780, D850, D7500, Z 50 checked). Lossy type 2 NEF curves of version `0x44 0x40` (D780, D6, Z 5, Z 6, Z 7, Z 7_2) span a quarter of the sample range, read from the table's own point spacing. Import probes (`probe_info`) of compressed NEFs decode only the first 128 rows, the ones the masked-trailing-column test reads in both the probe and the full decode (the D5100 and D7000 write 8 masked columns at 0 with no maker-note tag for them, compressed and uncompressed alike), instead of the whole Huffman stream: ~3 ms instead of the full decode time per file (386 ms on a 24 MP D750 file), issue #708. CR3 lossless CRX Bayer and version 0x100/0x200 C-RAW decodes to sensor pixels with timed white balance, black/white levels and file crop (EOS R6 Mark III `ColorData` version 66: as-shot white balance and black level from the file, white level from the data, `docs/cr3.md`) (the shot's aspect ratio from the maker note's `AspectInfo`); full sensor samples match the reference on M50/R100/R8/RP, incl. RP 1.6× crop mode (`crates/raw/tests/it/cr3_corpus.rs`, `docs/cr3.md`). EOS R5 Mark II C-RAW and RAW decode too (the QP map's first-symbol literal and 23-zero escape, odd-height Bayer planes): 4 CC0 files pinned, every QP map of 33,665 private C-RAW files decodes exactly, and full-frame images match the camera JPEG. Unsupported coding variants retain metadata and use the embedded JPEG when available; HEVC preview decoding remains unsupported. Missing: CR3 unverified CRX variants, compressed ORF, compressed Samsung SRW (NX1, NX30, NX300, NX500, NX2000, NX3000, NX3300, NX mini: preview only with the reason), Nikon High Efficiency NEF (HE / HE★ from the Z 8, Z 9, Z 6III and Z f: compression 34713 with a JPEG XS codestream and no `0x0096` table; no public specification, so preview only with the reason "Nikon High Efficiency NEF", issue #193; Lossless compressed NEFs from the same bodies decode), NEF "lossy after split" (preview only: imported with `preview_only` = the decoder's reason, rendered as a rendered JPEG, flagged by a grid badge and loupe/Edit/Info notices, `previewOnly` in `catalog.query`; Reload clears it once the file decodes, and the notices carry a Reload from Disk button; each flag is stamped with the app version that set it, and a library opened in another version rechecks its preview-only raws in the background, so a raw a newer release decodes is cleared without a manual Reload, issue #662, `library.recheckPreviewOnly`), TIFF-based raws whose raw data sits in a private block (Phase One / Leaf IIQ, Canon EOS-1D / 1Ds and the Kodak DCS Pro / DCS760C TIFFs (compression 65000): IFD0 is only a reduced RGB image next to a much larger declared picture) are recognised from that structure and import as `preview_only` with the reason, instead of opening as a thumbnail-sized ordinary image (`thumbnail_shell` in `crates/raw/src/lib.rs`), Recognised raws LightCraft cannot decode open as `preview_only` with any usable embedded JPEG, also Sigma X3F (container recognised by magic, preview found by a structural JPEG scan), the Canon CRWs the decoder refuses (PowerShot G5, pre-CIFF compacts), Kodak KDC (IFD0 without `ImageWidth`), Leaf MOS and Epson ERF (scan; ones with no JPEG still fail with "without an embedded preview", AVIF decode (HEIC decodes only behind the non-default `heif` feature, which the release packages enable: `crates/heif`, heic-rs for the container and HEVC (bit-exact against libde265 on iPhone tiles) plus our own colour conversion, matching libheif within 1 code value on iPhone-style grids (VUI full range, Display P3 ICC, nclx, 10-bit, irot/imir/clap, gain map/depth ignored); 4:2:0/monochrome only, 4:2:2/4:4:4 Canon/Sony HIF refused; same policy as PhotoCraft), palette (indexed-colour) TIFF (refused by the `tiff` crate); folder discovery and file pickers include Sony SR2 and SRF, with the same extension list used by CLI/MCP: DSC-R1 SR2 decodes from sensor data; DSC-F828 SRF stays preview-only; transparency is flattened onto white, in linear light, where the working image is built (`to_working` in `crates/codecs/src/lib.rs`): renders, previews, exports and contact sheets no longer turn transparent areas black, issue #1212; median ΔE vs the camera JPEG 2.2–7.6 on 11 of the 12 files from 10 bodies checked, 10.7 (5.7 registered) on the backlit WB2000 sample). 12-bit NEF black level: maker note `0x003d` is in 14-bit units (D750, D780, D850, D7500, Z 50 checked). Lossy type 2 NEF curves of version `0x44 0x40` (D780, D6, Z 5, Z 6, Z 7, Z 7_2) span a quarter of the sample range, read from the table's own point spacing. Import probes (`probe_info`) of compressed NEFs decode only the first 128 rows, the ones the masked-trailing-column test reads in both the probe and the full decode (the D5100 and D7000 write 8 masked columns at 0 with no maker-note tag for them, compressed and uncompressed alike), instead of the whole Huffman stream: ~3 ms instead of the full decode time per file (386 ms on a 24 MP D750 file), issue #708. CR3 lossless CRX Bayer and version 0x100/0x200 C-RAW decodes to sensor pixels with timed white balance, black/white levels and file crop (the shot's aspect ratio from the maker note's `AspectInfo`); the Hasselblad Lunar, a Sony NEX-7 under Make HASSELBLAD, decodes as an ARW: a HASSELBLAD file with Sony's raw coding (compression 32767 or tag `0x7010`) goes to the ARW reader, and the body for its `Tag2010` layout comes from the maker note's `SonyModelID`, checked on the CC0 4051 file, issue #1275; an uncompressed MOS, whose IFD0 is the 16-bit mosaic with no Make tag, is recognised by Leaf's data block `0x8606` instead of opening as a greyscale image of its mosaic, issue #1275), and any decode failure of a recognised raw, not only an unsupported variant Nikon 12-bit small RAW (D810 / D4S): packed Y0/Y1/Cb/Cr rows decode to linear RGB; header probes retain geometry without decoding pixels, and truncated strips are refused. Chroma gains are approximate. | +| LR-IMP-CAMERA-COVERAGE | Camera coverage, verified per model | P0 | 🟡 | `crates/raw/tests/it/corpus.rs`, `crates/raw/tests/it/coverage_sweep_corpus.rs`, `docs/raw/evidence.tsv`, `docs/raw/coverage-sweep.tsv`, `xtask/src/main.rs` | a supported container is not the same as every camera that writes it decoding correctly: ~55 CC0 corpus files plus 6 exact-sensor CR3 cases and 4 pinned EOS R5 Mark II files (plus ~60 NEFs checked by hand and 178 Panasonic / Leica RW2, RWL and RAW files from 118 bodies, checked against each file's own JPEG) against the >1,000 models Lightroom lists; per-model differences still surface (e.g. the CR2 colour-filter layout differed by model until it was read from the file's own tag, issue #85, checked on 35 CR2 bodies; CR2 black levels were read from border columns light already reaches, left of `SensorInfo`'s border, so CR2s rendered dark with crushed shadows (EOS 6D: 2591 instead of 2047), now measured from the masked columns only, checked on 8 corpus bodies; pre-2017 Sony ARWs opened green until their scrambled white balance / black level were read, issue #148, checked on 16 ARWs from 15 Sony bodies; their white balance now comes from the encrypted `SR2SubIFD`'s `WB_RGGBLevels`, the gains the camera applied, which 14 bodies (DSLR-A450 … A700, NEX-3/5/C3, SLT-A33/A35/A55, ILCE-6001, UMC-R10C) had no other source for and which the maker-note estimate read before missed by up to 100 % on preset shots, issue #535, checked against ExifTool on 100 decoded ARWs from 87 Sony bodies; the encrypted SR2 black level is now read from its directory entry (the DSLR-A450/A500/A550/A700 read 354–975 instead of 512), checked on 126 ARWs from 97 Sony bodies, and downsized lossless M/S ARWs use their measured black level 1024 instead of 512, checked on 12 files from 4 bodies, issue #535, and on a fifth, the ILCE-7CM2 (issue #697: 0.5.0 rendered its lossless M file with that 512 pedestal, the darkest half of a dusk scene +11 L* and blue, the lamplight white; its darkest 0.1 % per channel sits at 1017/1020/1024, and with 1024 the render is within +3 L* of the camera JPEG; the body's compressed and uncompressed "M-size" files are Bayer at 4736×3132 with black 512, two public ones in the corpus); pre-2017 Sony bodies shot in the camera's 16:9 mode (ILCE-7SM2, DSLR-A580) now get the 16:9 crop of their camera JPEG instead of the whole 3:2 frame with padding columns, issue #535; Canon PowerShot and EOS M CR2s whose `ColorData` is stored as bytes opened green until the bytes were read as 16-bit words, 25 files from 25 bodies checked; private Z 8 crop verified; the Nikon D4, which records no CropArea, gets its image area and white level measured on 148 NEFs against the camera JPEG (optical-black stripes and magenta clipped highlights gone); the D7100, whose data holds picture beyond the camera's frame, develops at Lightroom's frame (the camera JPEG's size) in full frame and 1.3x crop, so Lightroom crops line up (#1248).; CR2 white levels came from masked rows holding samples at 16383, so on the EOS 50D, 60D, 450D (Rebel XSi), 500D (Rebel T1i), 550D (Rebel T2i), 1200D (Rebel T5) and 100D (Rebel SL1) clipped highlights sat at 81–98% of the range and were not treated as clipped, now taken from the active area only, issue #1272). Canon CRW verified pixel-exact on 6 bodies (D30, D60, 10D, 300D, G1, G6; 10 CC0 files in the corpus, `crates/raw/tests/it/corpus.rs`, plus 18 maintainer D60 files via the digest-pinned sample test of craft-crw in craft-libs (crates/crw/tests/samples.rs there); `craft-libs crates/crw/clean-room/03-verification.md`). Compressed RAF sensor arrays verified on 13 Fujifilm bodies (`docs/raf-compression.md`). ILCE-7RM6 ARW6 12-bit codes verified on 8 CC0 files (FF and APS-C, both compression modes). Sony ILCE-7CR (61 MP): lossless compressed L and M and compressed ARW2 samples of one scene in the corpus (black level, default crop, as-shot gains, lossless vs compressed mosaic agreement, fitted camera look), and all nine public codings (also uncompressed, small and APS-C crop) decode and fit. Grow the CC0 corpus per model and test each sample decodes with plausible colour. Nikon CropArea and untagged-preview colour-space regression tests; the Nikon D4, which records no CropArea, gets its image area and white level measured on 148 NEFs against the camera JPEG (optical-black stripes and magenta clipped highlights gone). Pentax PEFs without area tags (KP, KF, K-3 Mark III, K-70, K-1, K-1 Mark II, K-S1, K-S2, 645Z) no longer keep their masked border: black, empty and saturated lines are trimmed against the maker-note BlackPoint, issue #1271, measured on 38 CC0 PEFs from 30 bodies.; Canon PowerShot and EOS M CR2s whose `ColorData` is stored as bytes opened green until the bytes were read as 16-bit words, 25 files from 25 bodies checked). Compressed RAF sensor arrays verified on 13 Fujifilm bodies (`docs/raf-compression.md`). ILCE-7RM6 ARW6 12-bit codes verified on 8 CC0 files (FF and APS-C, both compression modes). Sony ILCE-7CR (61 MP): lossless compressed L and M and compressed ARW2 samples of one scene in the corpus (black level, default crop, as-shot gains, lossless vs compressed mosaic agreement, fitted camera look), and all nine public codings (also uncompressed, small and APS-C crop) decode and fit. Grow the CC0 corpus per model and test each sample decodes with plausible colour. Nikon CropArea and untagged-preview colour-space regression tests; the Nikon D4, which records no CropArea, gets its image area and white level measured on 148 NEFs against the camera JPEG (optical-black stripes and magenta clipped highlights gone). The Canon PowerShot G9, which writes no `ColorData`, takes its as-shot white balance from the WBInfo row (`0x0029`) of the preset ShotInfo names, issue #1273, checked on 1 CC0 file against neutral areas of the camera JPEG (within 0.1 %).; the Nikon D4, which records no CropArea, gets its image area and white level measured on 148 NEFs against the camera JPEG (optical-black stripes and magenta clipped highlights gone). The Olympus E-10 (no ImageProcessing directory) takes its as-shot gains and its black level (`0x1012` in `0x102c` ValidBits units: 128 at 12 bits) from the main maker note, issue #1273: its render against the camera thumbnail goes from ΔE76 18.5 with a rejected fit to 11.5 with the fit accepted (measured by AlexChambers).; the Nikon D4, which records no CropArea, gets its image area and white level measured on 148 NEFs against the camera JPEG (optical-black stripes and magenta clipped highlights gone), and the Nikon D90 likewise on 10 of 550 NEFs (42 filler columns on the right that developed as a pink band; green clips below red and blue).; the Nikon D4, which records no CropArea, gets its image area and white level measured on 148 NEFs against the camera JPEG (optical-black stripes and magenta clipped highlights gone). Public raw.pixls.us coverage sweep (#1327): 30 more models verified on 40 CC0 files, with SHA-256 and FNV-1a sensor hashes pinned (`crates/raw/tests/it/coverage_sweep_corpus.rs`, `docs/raw/coverage-sweep.tsv`; `docs/raw/coverage.py`: 515 → 545 verified rows). Render/reference luminance correlation is 0.6801 to 0.9998; eleven candidates excluded for identity, provenance or missing/mismatched reference images. Nikon D6 / Z 6 / Z 7 uncompressed and Z 8 HE variants remain preview-only. Own-matrix DNG tone differs from the camera JPEG (#1277); sensor verification is not colour calibration. | | LR-IMP-PREVIEW-READ | Preview reads the header, not the raw | P0 | ✅ | `crates/raw/src/preview.rs` (`bounded_preview`, `embedded_preview_from_range`, `embedded_preview_covering`), `crates/engine/src/files.rs` (`preview_window`), `docs/raw-preview-reads.md`, `crates/engine/src/files.rs` (`preview_window`, `planned_preview`), `crates/raw/src/sparse.rs` (`preview_plan`), `crates/raw/src/dng.rs` (`decode_reduced`) | a grid thumbnail and a loupe preview of an unedited raw show the camera's embedded JPEG, which sits near the start of the file (a 24 MP Fuji RAF keeps its 5.6 MB JPEG in a 56 MB file), so the preview loader reads the header and that JPEG instead of the whole file: 56.5 MB → 5.9 MB and ~10 s → 0.96 s measured on one real RAF over a GVFS/SMB Wi-Fi share (byte-identical preview pixels; `LIGHTCRAFT_PROFILE=1` reports the bytes); the RAF pointer is read from its fixed header fields, a CR3's boxes and a TIFF raw whose preview tag sits past the prefix are read through `lightcraft_raw::sparse::preview_plan`, which names the ranges `embedded_preview` reads and nothing else; a cached render as stand-in, an edited photo and a raw without an embedded JPEG still render; the formats it cannot describe (CRW/MRW/X3F are found by scanning, NEF/ORF/PEF probe from samples) keep the whole-file path, and a lying pointer, a short read or a file that changes underneath us falls back to it rather than losing the preview. An unedited raw's **grid thumbnail is that camera JPEG itself**, so no sensor decode is scheduled behind it (`Session::embedded_thumb_is_final`, `grid::skips_the_real_render`): drawing a 512 px thumbnail used to decode the whole raw — 45 s a photo at 1.2 MB/s, 8.3 GB for a 149-raw folder — and the queue it built delayed the render the user was waiting for. Stand-ins and grid thumbnails decode the smallest embedded JPEG that covers the requested size and is a copy of the largest (aspect ratio within 1 %, same component count), not always the largest, on the whole-file and the plan route alike: an A7R VI's 1616 × 1080 JPEG (0.3 MB) instead of its 9984 × 6656 one (5.6 MB), and mid-sized NEF / RW2 JPEGs; a DNG that keeps reduced-resolution copies of its LinearRaw image (Lightroom HDR/panorama merges) develops a thumbnail or preview from the smallest copy that covers it (512 px of a 23836 × 7078 pano: 38 s → 1.1 s) | | LR-IMP-CULL-AT-IMPORT | Culling analysis at import | P2 | 🟡 | `cmd:photo.analyze` | run Assisted Culling on the imported photos (they're selected after an import); not automatic | | LR-IMP-MOVE | Move on import [Classic] | P1 | ✅ | `cmd:library.import` (`mode` move), `crates/engine/src/import_move.rs`, `crates/engine/src/tests/import_move.rs`, `crates/ui-egui/src/dialogs/import.rs` | Transfer ▸ Move with Copy's destination, folders (day / month / one folder / custom template), rename template and example destination; XMP sidecars (both namings) move along; each source is removed only after its destination is written (hard link on the same volume, else copied, synced and compared byte for byte) and its catalog record is saved; failed, duplicate, unchecked files keep their sources, taken names get -1, -2…, never overwritten; if the rename sequence runs out, later files are reported as failed and earlier completed moves remain catalogued; files already in the destination/library are added in place; sources that can't be removed (read-only card) are kept and reported (`kept`). Undo removes the photos from the library but leaves the moved files at the destination. No Copy as DNG while moving | @@ -236,7 +236,7 @@ differences and missing bindings are in [ui-parity.md](ui-parity.md#shortcuts). | LR-PROF-ADOBE | Standard raw looks (own equivalents) | P0 | ✅ | `crates/engine/src/presets.rs` (`PROFILES`), `crates/pipeline/src/profiles.rs` | six own looks: Color, Neutral, Vivid, Landscape, Portrait, Monochrome | | LR-PROF-ADAPTIVE | Adaptive profiles | P2 | ⬜ | | | | LR-PROF-CAMERA | Camera-matching looks | P2 | ⬜ | | | -| LR-PROF-CAMERACOLOR | Camera colour calibration (own) | P0 | 🟡 | `crates/raw/src/color.rs`, `crates/raw/src/profile.rs`, `crates/raw/src/gaintable.rs`, `crates/engine/src/camera_preview.rs` | DNG files use the colour matrices and the camera-profile look they carry (`ProfileHueSatMap`, `ProfileLookTable`, `ProfileToneCurve`, read from the file at run time per DNG spec ch. 6 — Lightroom-converted DNGs rendered flat and muted without them, issue #138). A DNG whose profile defines no tone curve (absent or identity `ProfileToneCurve`, with or without a `LookTable`, as Adobe Standard in Lightroom-written DNGs) gets its tone fitted to its embedded preview when that is at least 10% of the raw's long edge and 384 px (Lightroom's 1024 px previews qualify): two Lightroom Classic 15.1 lossy ILCE-7CM2 DNGs went from about 0.8 EV darker and flat to within 3% of Lightroom's mean linear RGB. A DNG's `ProfileGainTableMap` / `ProfileGainTableMap2` (Apple ProRAW's local tone map; both versions, DNG 1.7 precedence, the file's byte order with a big-endian fallback) is read and written back by DNG export and not rendered by default, as Lightroom Classic renders ProRAW without it (measured on one CC0 iPhone 12 Pro ProRAW); the Profile option "Camera local tone mapping" (`profile.camera_local_tone`, per photo, off by default, `crates/pipeline/src/local_tone.rs`) renders it as the camera does, per output pixel in the scene-linear stage (CPU, also under the GPU path); Sony ARW, Nikon NEF, Panasonic RW2, Fujifilm RAF, Canon CR3 and CR2, Pentax PEF, Samsung SRW and Olympus ORF get a guarded file-local fit to their own embedded JPEG — chromaticity matrix + hue/saturation/value table + tone and chroma curves, relative WB — or, with a bundled or local per-model profile pooled from many photos (`lightcraft-cli calibrate`, ARW, NEF and RAF so far, `crates/engine/src/camera_profiles.rs`), the profile's colour and only their own tone/chroma curves (on 29 held-out ILCE-7M4 photos mean ΔE vs the camera JPEG 3.54 → 3.10; bundled ILCE-7CR from 125 photos: 26 held-out 4.07 → 3.29, and every one of the 131 photos accepted, 8 of which fell back to neutral without it; bundled ILCA-99M2 from 144 photos: 30 held-out 5.11 → 4.87, 25 of them closer); the tone fit also uses dark JPEG samples excluded from colour training, so deep shadows follow the camera toe (#1307); near-black frames with too few colour pairs can take a guarded tone-only fallback on their existing source colour (#1587); Sony ARWs shot with DRO on (maker note `0xb025`, on by default) keep that colour but their tone curve is lowered to Sony's curve without DRO, whose lifted shadows are in the camera JPEG only (issue #244: 8 ILCE-7CR photos +6.4 → +0.8 L* from Lightroom's default, median ΔE 7.5 → 3.3); 52 models without a profile whose JPEG fit fails (or that have no usable JPEG) start from DNG-style matrices fitted to their measured spectral sensitivities instead of the neutral fallback (`crates/raw/src/spectral.rs`, rawtoaces-data v1.1.0, Apache-2.0, aliases included; not yet measured against the camera JPEG); ARW: on 10 public raw.pixls.us samples from 8 bodies 7 fits were accepted, mean ΔE vs the camera JPEG 17–26 → 3–10; NEF: 13 of 13 decodable samples (D750, D780, D850, D7500, Z 50 and local D7500 shots) accepted, ΔE 13–46 → 3–8 (issue #150); RW2 / RWL: 140 of 174 public samples accepted, from 93 of the 114 bodies with a preview, median ΔE 5.0 with matching lightness (13 of the 14 corpus files with a preview: ΔE 9.6–27 → 2.8–8.9; most rejections are compacts and kit zooms whose camera JPEG is distortion-corrected); a fit that fails the gates on all pixels is retried away from edges, where a lens-corrected camera JPEG still lines up (issue #232: the six distortion-corrected public ILCE-7RM2 samples ΔE 16.6–16.9 → 3.7–3.8, the corpus GX80 19.1 → 7.9); RAF: bundled X-H2S/X-T4 profiles from 201/545 photos; on 150 withheld files mean ΔE improves slightly over per-file fitting (X-H2S 1.70 → 1.62, X-T4 2.43 → 2.34); 23 of 24 references from 13 bodies accepted, including the dark X-H2S samples (8.74 → 2.25); ORF: the 3 decodable corpus files (E-1, E-400, XZ-2) accepted (`docs/camera-preview-colour.md`); a raw whose camera JPEG is black and white (a monochrome picture style) takes only the JPEG's tone curve, on the camera profile's, spectral or neutral colour (issue #577); this is not measured camera calibration; other raws and rejected fits use a neutral fallback (camera RGB ≈ linear sRGB, `matrix_is_fallback`) with as-shot white balance, so colours are muted and not accurate. Needs our own per-camera calibration: matrices the files carry themselves (e.g. Olympus `ColorMatrix`), fitting each camera to its own embedded JPEG, then chart shots. Adobe matrices / DCPs are never used. Biggest image-quality gap today; ILCE-7RM6: per-file fit now runs on previews above 64 MP, a pooled profile (46 photos) was tried and not bundled (withheld ΔE 5.71 → 6.40, 11 of 15 regressed), kept with smart previews (see docs/camera-preview-colour.md); the fit pairs the sensor moved into the file's lens-warp geometry when that lines up better with a lens-corrected camera JPEG (29 CC0 raws: alignment +0.13, mean ΔE 3.73 → 3.61); bundled NIKON Z 6_2 profile (296 photos; 59 held-back photos mean ΔE 2.73 → 2.54) NIKON Z 8 profile (261 photos; 55 held back 2.55 → 2.33) and NIKON D5300 profile (264 photos; 53 held back 2.86 → 2.66) | +| LR-PROF-CAMERACOLOR | Camera colour calibration (own) | P0 | 🟡 | `crates/raw/src/color.rs`, `crates/raw/src/profile.rs`, `crates/raw/src/gaintable.rs`, `crates/engine/src/camera_preview.rs` | DNG files use the colour matrices and the camera-profile look they carry (`ProfileHueSatMap`, `ProfileLookTable`, `ProfileToneCurve`, read from the file at run time per DNG spec ch. 6 — Lightroom-converted DNGs rendered flat and muted without them, issue #138). A DNG whose profile defines no tone curve (absent or identity `ProfileToneCurve`, with or without a `LookTable`, as Adobe Standard in Lightroom-written DNGs) gets its tone fitted to its embedded preview when that is at least 10% of the raw's long edge and 384 px (Lightroom's 1024 px previews qualify): two Lightroom Classic 15.1 lossy ILCE-7CM2 DNGs went from about 0.8 EV darker and flat to within 3% of Lightroom's mean linear RGB. A DNG's `ProfileGainTableMap` / `ProfileGainTableMap2` (Apple ProRAW's local tone map; both versions, DNG 1.7 precedence, the file's byte order with a big-endian fallback) is read and written back by DNG export and not rendered by default, as Lightroom Classic renders ProRAW without it (measured on one CC0 iPhone 12 Pro ProRAW); the Profile option "Camera local tone mapping" (`profile.camera_local_tone`, per photo, off by default, `crates/pipeline/src/local_tone.rs`) renders it as the camera does, per output pixel in the scene-linear stage (CPU, also under the GPU path); Sony ARW, Nikon NEF, Panasonic RW2, Fujifilm RAF, Canon CR3 and CR2, Pentax PEF, Samsung SRW and Olympus ORF get a guarded file-local fit to their own embedded JPEG — chromaticity matrix + hue/saturation/value table + tone and chroma curves, relative WB — or, with a bundled or local per-model profile pooled from many photos (`lightcraft-cli calibrate`, ARW, NEF and RAF so far, `crates/engine/src/camera_profiles.rs`), the profile's colour and only their own tone/chroma curves (on 29 held-out ILCE-7M4 photos mean ΔE vs the camera JPEG 3.54 → 3.10; bundled ILCE-7CR from 125 photos: 26 held-out 4.07 → 3.29, and every one of the 131 photos accepted, 8 of which fell back to neutral without it; bundled ILCA-99M2 from 144 photos: 30 held-out 5.11 → 4.87, 25 of them closer); the tone fit also uses dark JPEG samples excluded from colour training, so deep shadows follow the camera toe (#1307); near-black frames with too few colour pairs can take a guarded tone-only fallback on their existing source colour (#1587); Sony ARWs shot with DRO on (maker note `0xb025`, on by default) keep that colour but their tone curve is lowered to Sony's curve without DRO, whose lifted shadows are in the camera JPEG only (issue #244: 8 ILCE-7CR photos +6.4 → +0.8 L* from Lightroom's default, median ΔE 7.5 → 3.3); 52 models without a profile whose JPEG fit fails (or that have no usable JPEG) start from DNG-style matrices fitted to their measured spectral sensitivities instead of the neutral fallback (`crates/raw/src/spectral.rs`, rawtoaces-data v1.1.0, Apache-2.0, aliases included; not yet measured against the camera JPEG); the Canon EOS D60 (CRW) has DNG-style matrices of our own, fitted to ColorChecker Classic shots under a tungsten bulb and direct sun (`crates/raw/src/chart_table.rs`, `clean-room/crw/10-chart-calibration.md`; CIEDE2000 on the chart mean 2.4 / 1.7, 2.7 / 2.0 leaving each patch out), which give its white balance a Kelvin scale (the camera's own presets read Tungsten 3,264 K, Daylight 5,603 K, Cloudy 6,612 K) while its look stays the JPEG fit; ARW: on 10 public raw.pixls.us samples from 8 bodies 7 fits were accepted, mean ΔE vs the camera JPEG 17–26 → 3–10; NEF: 13 of 13 decodable samples (D750, D780, D850, D7500, Z 50 and local D7500 shots) accepted, ΔE 13–46 → 3–8 (issue #150); RW2 / RWL: 140 of 174 public samples accepted, from 93 of the 114 bodies with a preview, median ΔE 5.0 with matching lightness (13 of the 14 corpus files with a preview: ΔE 9.6–27 → 2.8–8.9; most rejections are compacts and kit zooms whose camera JPEG is distortion-corrected); a fit that fails the gates on all pixels is retried away from edges, where a lens-corrected camera JPEG still lines up (issue #232: the six distortion-corrected public ILCE-7RM2 samples ΔE 16.6–16.9 → 3.7–3.8, the corpus GX80 19.1 → 7.9); RAF: bundled X-H2S/X-T4 profiles from 201/545 photos; on 150 withheld files mean ΔE improves slightly over per-file fitting (X-H2S 1.70 → 1.62, X-T4 2.43 → 2.34); 23 of 24 references from 13 bodies accepted, including the dark X-H2S samples (8.74 → 2.25); ORF: the 3 decodable corpus files (E-1, E-400, XZ-2) accepted (`docs/camera-preview-colour.md`); a raw whose camera JPEG is black and white (a monochrome picture style) takes only the JPEG's tone curve, on the camera profile's, spectral or neutral colour (issue #577); this is not measured camera calibration; other raws and rejected fits use a neutral fallback (camera RGB ≈ linear sRGB, `matrix_is_fallback`) with as-shot white balance, so colours are muted and not accurate. Needs our own per-camera calibration: matrices the files carry themselves (e.g. Olympus `ColorMatrix`), fitting each camera to its own embedded JPEG, then chart shots. Adobe matrices / DCPs are never used. Biggest image-quality gap today; ILCE-7RM6: per-file fit now runs on previews above 64 MP, a pooled profile (46 photos) was tried and not bundled (withheld ΔE 5.71 → 6.40, 11 of 15 regressed), kept with smart previews (see docs/camera-preview-colour.md); the fit pairs the sensor moved into the file's lens-warp geometry when that lines up better with a lens-corrected camera JPEG (29 CC0 raws: alignment +0.13, mean ΔE 3.73 → 3.61); bundled NIKON Z 6_2 profile (296 photos; 59 held-back photos mean ΔE 2.73 → 2.54) NIKON Z 8 profile (261 photos; 55 held back 2.55 → 2.33) and NIKON D5300 profile (264 photos; 53 held back 2.86 → 2.66) | | LR-PROF-CREATIVE | Creative profiles (own) | P2 | ✅ | `cmd:develop.profile`, `crates/pipeline/src/profiles.rs` | 16 own looks in Film / Cinematic / Muted / B&W (tone + point-curve fades, colour grading, mixer / B&W mix); scale with `ctl:profile.amount`; sliders untouched | | LR-PROF-LEGACY | Legacy profiles | P2 | ⬜ | | | | LR-PROF-NONRAW | Profiles for non-raw files | P0 | ✅ | `cmd:develop.profile` | same looks apply to JPEG/TIFF | @@ -815,6 +815,9 @@ Latin stays upright. Advanced Japanese composition remains open. Regression cove | 2026-10-27 | patch | MENU-BAR: every shortcut the app shows (a menu row, a button's tooltip, a hint, the empty-album line, the Keyboard Shortcuts dialog) lists its modifiers on macOS in the menu bar's order, ⌃⌥⇧⌘ (`⇧⌘I`, not `⌘⇧I`); the empty-album line follows the keymap; status counts unchanged | | 2026-10-25 | patch | LR-BEHAV-TITLEBAR: the top bar's title-bar gestures come from craft-window's `title_bar`: a double-click follows the system setting, and a press on a button, the search field or a panel floating over the bar never moves the window; status counts unchanged | | 2026-10-25 | patch | LR-IMP-FORMATS: JPEG ICC APP2 chunk sequences are validated before colour conversion; valid reordered chunks remain supported and malformed profiles use the existing sRGB fallback; status unchanged (🟡) | +| 2026-10-13 | minor | LR-IMP-FORMATS / LR-IMP-CAMERA-COVERAGE: Canon CRW decodes (clean-room; 6 bodies pixel-exact, G5 preview-only) | +| 2026-10-25 | patch | LR-BEHAV-TITLEBAR: the top bar's title-bar gestures come from craft-window's `title_bar`: a double-click follows the system setting, and a press on a button, the search field or a panel floating over the bar never moves the window; status counts unchanged | +| 2026-10-26 | minor | LR-IMP-FORMATS: the Canon CRW decoder moved to craft-libs as `craft-crw` (path dependency until that branch merges); `crates/raw/src/vendor/crw.rs` is the adapter, the clean-room record lives in craft-libs (crates/crw/clean-room there) | | 2026-10-24 | minor | KEYC-METADATA, LRC-LIB-KEYWORDS: ⌥0 / ⌥⇧0 (`keyword.nextSet`, `keyword.previousSet`) go to the next / previous keyword set; status counts unchanged (KEYC-METADATA stays 🟡) | | 2026-10-24 | minor | KEYC-METADATA: ⌘K / Ctrl+K (`panel.addKeywords`, Add Keywords) shows the Keywords panel, opens Keywording and puts the cursor in the Add keyword box; status counts unchanged (KEYC-METADATA stays 🟡) | | 2026-10-24 | patch | LR-META-LOCATION: Info GPS text validates the complete decimal/DMS expression, axis markers and component ranges before metadata changes; readiness and feature counts unchanged | @@ -941,6 +944,7 @@ Latin stays upright. Advanced Japanese composition remains open. Regression cove | 2026-10-12 | minor | LR-IMP-FORMATS and LR-IMP-CAMERA-COVERAGE: 22 more CR3 bodies verified on one CC0 file each (all 110 CC0 CR3s decode); EOS R6 Mark III `ColorData` 66 white balance; status unchanged (🟡: CRX variants without public samples remain refused) | | 2026-10-11 | minor | Model setup folder action, opener error and retry (LR-MASK-OBJECTS). | | 2026-10-13 | minor | LR-PROF-CAMERACOLOR: the camera look follows the lens warp of lens-corrected camera JPEGs; status unchanged (🟡) | +| 2026-10-25 | minor | LR-PROF-CAMERACOLOR: chart-measured matrices for the Canon EOS D60 (first chart-calibrated model), white balance in Kelvin for its CRWs; CRW imports take make, model and capture time from the CIFF records (the catalog had no camera for them); status unchanged (🟡) | | 2026-10-13 | minor | LR-PROF-CAMERACOLOR: bundled Nikon Z 6II camera profile; status unchanged (🟡) | | 2026-10-13 | minor | LR-PROF-CAMERACOLOR: bundled Nikon Z 8 camera profile; status unchanged (🟡) | | 2026-10-13 | minor | LR-PROF-CAMERACOLOR: bundled Nikon D5300 camera profile; status unchanged (🟡) | diff --git a/docs/raw-parity.md b/docs/raw-parity.md index 0c849b63ce..32c401669a 100644 --- a/docs/raw-parity.md +++ b/docs/raw-parity.md @@ -1,6 +1,6 @@ # RAW parity: cameras, formats, demosaic, colour and lens profiles -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-23 · **Change:** minor (Sony ILCE-6700 in-file distortion; Minolta MRW decoded, 6 bodies verified; lossy JPEG XL DNG tiles with a non-linear declared transfer curve decode; Canon ColorData Kelvin; X-Trans CMOS 4 bodies take the X-T3's spectral matrices; AHD no longer turns flat noise into a maze pattern) · **Target:** Adobe Lightroom Classic 15.5 / Lightroom 9.6 (Camera Raw 18.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-26 · **Change:** minor (Canon CRW decoder shared via craft-libs `craft-crw`; Canon EOS D60: chart-measured colour matrices, white balance in Kelvin; Canon CRW merged with MRW: 557 verified; CRW variant rows split by verification status; Sony ILCE-6700 in-file distortion; Minolta MRW decoded, 6 bodies verified; lossy JPEG XL DNG tiles with a non-linear declared transfer curve decode; Canon ColorData Kelvin; X-Trans CMOS 4 bodies take the X-T3's spectral matrices; AHD no longer turns flat noise into a maze pattern) · **Target:** Adobe Lightroom Classic 15.5 / Lightroom 9.6 (Camera Raw 18.7) Raw processing is the deepest single dimension of Lightroom parity: a photographer whose camera does not decode, or decodes with the wrong colour, cannot switch. This document measures it model by @@ -15,14 +15,14 @@ ranked in [gaps.md](gaps.md). Details per format: [cr3.md](cr3.md), | Measure | Value | Kind | |---|---:|---| | Adobe-listed camera models | **1,446** | measured: [raw/adobe-cameras.tsv](raw/adobe-cameras.tsv) | -| Decoded from sensor data and **verified** on a real file | **551** (38%) | measured: [raw/evidence.tsv](raw/evidence.tsv) | -| Decoder path should handle it, **unverified** | **656** (45%) | measured from the format rules (631 of them DNG, mostly phones) | -| **Preview-only** (embedded JPEG) | **201** (14%) | measured | -| **Unsupported** (not imported, refused or decodes wrongly) | **38** (3%) | measured | +| Decoded from sensor data and **verified** on a real file | **557** (39%) | measured: [raw/evidence.tsv](raw/evidence.tsv) | +| Decoder path should handle it, **unverified** | **665** (46%) | measured from the format rules (631 of them DNG, mostly phones) | +| **Preview-only** (embedded JPEG) | **187** (13%) | measured | +| **Unsupported** (not imported, refused or decodes wrongly) | **37** (3%) | measured | | Models added since 2017 (Camera Raw 10+): verified / unverified / preview / unsupported | 182 / 542 / 22 / 8 of 754 | measured | | **Share of photographers whose camera fully works** (decodes from sensor data), use-weighted | **~94%** | estimated: measured classes × written usage weights × per-format confidence | -| …of which on a body we have verified | **~85%** | estimated, same weights | -| Camera colour: Adobe profiles vs ours | 1,500 Adobe Standard profiles, 481 models with Camera Matching profiles vs **9 bundled profiles** + per-file fits + 52 spectral matrices (plus same-sensor aliases) | measured (bundle listing, Adobe list, `assets/camera-profiles`) | +| …of which on a body we have verified | **~86%** | estimated, same weights | +| Camera colour: Adobe profiles vs ours | 1,500 Adobe Standard profiles, 481 models with Camera Matching profiles vs **9 bundled profiles** + per-file fits + 52 spectral matrices (plus same-sensor aliases) + chart-measured matrices (1 model, the EOS D60) | measured (bundle listing, Adobe list, `assets/camera-profiles`) | | Lens profiles: Adobe vs ours | **3,635 vs 0** (in-file corrections only) | measured | | **RAW readiness** (decoding 60%, colour 25%, lens 15%) | **~60%** (range 54–64%) | estimated, see [Scores](#scores) | @@ -86,7 +86,7 @@ unsupported to preview-only in the counts; sensor-decoding readiness is unchange | Maker | Adobe models | verified | unverified | preview | unsupported | Main reason for preview / unsupported | |---|---:|---:|---:|---:|---:|---| | Sony | 149 | 94 | 43 | 10 | 2 | DSLR-A200…A390 and A850 12-bit compressed ARW (preview, #535); A100 remains classified unsupported in the recorded evidence; DSC-F828 SRF imports as preview-only; DSC-V3 preview not verified | -| Canon | 134 | 95 | 16 | 21 | 2 | CRW (2000–2004 bodies) preview; EOS-1D / 1Ds TIFF raws not imported | +| Canon | 134 | 101 | 25 | 6 | 2 | PowerShot G5 CRW anomaly and pre-CIFF compacts preview; EOS-1D / 1Ds TIFF raws not imported | | Samsung | 128 | 10 | 109 | 9 | 0 | compressed SRW (NX1, NX30, NX300, NX500, NX2000, NX3000, NX3300, NX mini, Galaxy NX) | | Apple | 113 | 4 | 109 | 0 | 0 | — (DNG / ProRAW) | | Panasonic | 104 | 93 | 11 | 0 | 0 | — | @@ -103,13 +103,13 @@ unsupported to preview-only in the counts; sensor-decoding readiness is unchange | DJI | 21 | 4 | 17 | 0 | 0 | DNG | | OM Digital Solutions | 7 | 0 | 0 | 7 | 0 | **compressed ORF** | | Kodak, Konica Minolta, Epson, Sigma, GoPro, Contax, others | 56 | 12 | 16 | 13 | 15 | DCR, GPR not imported; KDC, X3F preview (Epson ERF and Minolta MRW decode) | -| **All** | **1,446** | **551 (38%)** | **656 (45%)** | **201 (14%)** | **38 (3%)** | | +| **All** | **1,446** | **557 (39%)** | **665 (46%)** | **187 (13%)** | **37 (3%)** | | ## By use (estimated) | Bucket | Weight | Camera fully works | On a verified body | Why | |---|---:|---:|---:|---| -| Canon | 33% | 95% | 93% | 18 of the 22 popular bodies write CR3; 26 CR3 bodies verified (raw.pixls.us has a CC0 file for each), the rest at 0.6 | +| Canon | 33% | 98% | 94% | 18 of the 22 popular bodies write CR3; 26 CR3 bodies verified (raw.pixls.us has a CC0 file for each), the rest at 0.6; CRW decoded | | Sony | 27% | 98% | 92% | bulk-checked | | Nikon | 16% | 98% | 89% | decoders cover every NEF coding but HE; 77 bodies verified | | Fujifilm | 10% | 94% | 92% | | @@ -120,9 +120,9 @@ unsupported to preview-only in the counts; sensor-decoding readiness is unchange | Leica | 1% | 99% | 72% | the Q3 verified, 13 more bodies pinned on CC0 files | | DJI | 1% | 96% | 19% | | | Medium format and others | 0.5% | 29% | 8% | IIQ, 3FR, X3F | -| **Weighted** | 100% | **94%** | **85%** | | +| **Weighted** | 100% | **94%** | **86%** | | -About 19 in 20 raw photographers' cameras decode, and about 5 in 6 use a body we have actually +About 19 in 20 raw photographers' cameras decode, and about 6 in 7 use a body we have actually checked (the per-model CC0 sweeps of October 2026); compressed ORF (OM / Olympus) is the largest gap left. ## Variant matrix (depth per format) @@ -141,7 +141,9 @@ checked (the per-model CC0 sweeps of October 2026); compressed ORF (OM / Olympus | CR3 | sRAW / mRAW | ⬜ | 4-plane Bayer only | | CR3 | HEIF / HDR PQ | ⬜ | HEVC tracks recognised, not decoded | | CR3 | dual-pixel raw | ⬜ | never substituted | -| CRW | all | ⬜ | preview | +| CRW | CIFF: EOS D30/D60/10D/300D, PowerShot G1/G6 | ✅ | clean-room derivation frozen in `craft-libs crates/crw/clean-room/02-crw-format.md`; 28 of 29 files pixel-exact vs a black-box reference (8 CC0 EOS, G1, G6, 18 private D60); as-shot WB from ColorBalance; EOS D60 colour matrices measured on a ColorChecker (Kelvin white balance) | +| CRW | CIFF: PowerShot G2/G3/G4, Pro1, S-series | 🟡 | same decoder and tables; no sample file checked | +| CRW | CIFF: PowerShot G5 | ⬜ | refused (entropy anomaly, `craft-libs crates/crw/clean-room/02-crw-format.md`); preview | | NEF | uncompressed, lossless, lossy type 1 / 2, lossy after split | ✅ | D5100, D7000, D7500, Z f corpus; ~60 NEFs by hand; #633; D4, D90, D5000, D600 and D610 image area measured against the camera JPEG (white level too for the D4, D90 and D5000) | | NEF | packed 14-bit stored under a compressed tag (Z 6II uncompressed) | ⬜ | #769; fix in PR #671 (not merged) | | NEF | High Efficiency / HE★ (JPEG XS) | ⬜ | named, preview (#193); needs a JPEG XS decoder | @@ -214,11 +216,11 @@ sample files. A pointer for contributors, not legal advice. | Item | Adobe | LightCraft | |---|---|---| -| Default profile per model | Adobe Standard for every model (1,500 profile names in the bundle) | the DNG's own matrices; else a pooled profile (**9 bundled**: ILCA-99M2, ILCE-7CR, ILCE-7M4, ILCE-7RM5, X-H2S, X-T4, Nikon Z 6II, Z 8 and D5300); else a guarded per-file fit to the camera's embedded JPEG; else spectral matrices (**52 models**, rawtoaces-data, and the bodies sharing their sensors: 6 Fujifilm bodies take the X-T3's (X-T30, X-T30 II, X-Pro3, X100V, X-E4, X-M5) and 2 take the X-T4's (X-S10, X-S20)); else a neutral matrix | +| Default profile per model | Adobe Standard for every model (1,500 profile names in the bundle) | the DNG's own matrices; else a pooled profile (**10 bundled**: EOS D60, ILCA-99M2, ILCE-7CR, ILCE-7M4, ILCE-7RM5, X-H2S, X-T4, Nikon Z 6II, Z 8 and D5300); else a guarded per-file fit to the camera's embedded JPEG; else spectral matrices (**52 models**, rawtoaces-data, and the bodies sharing their sensors: 6 Fujifilm bodies take the X-T3's (X-T30, X-T30 II, X-Pro3, X100V, X-E4, X-M5) and 2 take the X-T4's (X-S10, X-S20)) or chart-measured ones (**1 model**, the EOS D60); else a neutral matrix | | Camera Matching looks | 481 models (plus phone-maker looks) | none (the per-file JPEG fit imitates the camera's own look) | | Creative profiles | Adobe Color, Portrait, Landscape, Vivid, Monochrome… | our own looks (Color, Neutral, Vivid, Landscape, Portrait, Monochrome) | | DCP / dual-illuminant model | ✅ | dual-illuminant DNG colour (ColorMatrix / ForwardMatrix 1-2, CameraCalibration, AnalogBalance), HueSatMap, LookTable, ProfileToneCurve; external `.dcp` never loaded (clean-room) | -| White balance in Kelvin | ✅ for every model | absolute Kelvin where the camera has colour matrices (its own, or one of the 52 spectral rows), also for files whose look is a per-file fit (#730), or where the camera's white-balance presets in the file give the scale (6 Sony bodies and the Canon PowerShot G1 X Mark III, `kelvin_presets`), or the neutral pair a Fujifilm X-Trans III RAF stores (6 bodies, #730); other raws keep the relative scale (#296) | +| White balance in Kelvin | ✅ for every model | absolute Kelvin where the camera has colour matrices (its own, one of the 52 spectral rows or the chart-measured EOS D60), also for files whose look is a per-file fit (#730), or where the camera's white-balance presets in the file give the scale (6 Sony bodies and the Canon PowerShot G1 X Mark III, `kelvin_presets`), or the neutral pair a Fujifilm X-Trans III RAF stores (6 bodies, #730); other raws keep the relative scale (#296) | **How far the default rendering is from Adobe's** (CIE ΔE; measured where stated): @@ -280,9 +282,8 @@ works, from [raw/usage-weights.tsv](raw/usage-weights.tsv). | 5 | Sony DSLR-A200…A390 / A850 12-bit compressed ARW | +0.4 | 3–6 | ~0.08 | samples on raw.pixls.us | | 6 | Pre-X FinePix RAF | +0.6 | 4–8 | ~0.08 | samples | | 7 | Sony A100 regression (#702) and DSC-F828 sensor decoding (preview-only) | +0.1 | 1–2 | ~0.07 | samples on raw.pixls.us | -| 8 | Canon CRW (2000–2004 bodies) | +1.2 by the uniform tail weight, far less by real use | 6–12 | ≤ 0.1 | samples | -| 9 | Nikon HE / HE★ NEF (Z 8, Z 9, Z 6III, Z f, Z50II, Z5II set to HE) | +1.1 | 20–40 | ~0.04 | a pure-Rust JPEG XS decoder | -| 10 | Compressed SRW, Hasselblad 3FR, IIQ, X3F, KDC, DCR, GPR (ERF, MEF, MRW done) | +0.6 together | 45–85 | ~0.01 | samples; low use | +| 8 | Nikon HE / HE★ NEF (Z 8, Z 9, Z 6III, Z f, Z50II, Z5II set to HE) | +1.1 | 20–40 | ~0.04 | a pure-Rust JPEG XS decoder | +| 9 | Compressed SRW, Hasselblad 3FR, IIQ, X3F, KDC, DCR, GPR (ERF, MEF, MRW done) | +0.6 together | 45–85 | ~0.01 | samples; low use | Beyond decoding: @@ -299,6 +300,8 @@ Beyond decoding: |---|---|---| | 2026-10-26 | patch | Bundled camera profile count 5 → 9 (Nikon Z 6II, Z 8 and D5300, ILCE-7RM5); counts only | | 2026-10-23 | minor | Lens profiles: Sony ILCE-6700 (APS-C) in-file distortion through the ILCE-7RM6 conversion, knots spanning its own crop; lens score unchanged (~10%: one more body) | +| 2026-10-25 | patch | CRW variant rows split by verification status (EOS and G1/G6 verified; G2/G3/G4/Pro1/S-series unverified; G5 preview); the CIFF heap walk is bounded by a per-file record budget, so a block of sub-heap records pointing back at their parent no longer hangs decode | +| 2026-10-13 | minor | Canon CRW decoded (clean-room derivation, craft-libs `crates/crw/clean-room/`): EOS D30/D60/10D/300D, PowerShot G1/G6 verified pixel-exact (28 of 29 corpus files); G5 preview (entropy anomaly); as-shot WB from ColorBalance 0x10a9; 243 verified, 950 unverified, 217 preview; Canon bucket 76% (21% verified) | | 2026-10-18 | patch | X-T30, X-T30 II, X-Pro3, X100V, X-S10 and X-E4 take the X-T3's spectral matrices (same 26.1 MP X-Trans CMOS 4 sensor): an X-T30 raw with a black-and-white (Acros) camera JPEG no longer opens in the muted neutral fallback | | 2026-10-16 | minor | Kelvin white balance from Canon CR2 `ColorData` presets (PowerShot G1 X Mark III) | | 2026-10-15 | minor | DNGs with a look table and no tone curve (Lightroom-written, Adobe Standard) fit their tone to the embedded preview, also Lightroom's 1024 px one: two lossy ILCE-7CM2 DNGs no longer render 0.8 EV dark and flat | @@ -330,6 +333,9 @@ Beyond decoding: | 2026-10-14 | minor | 97 Canon CR2, Pentax and Ricoh models verified (one CC0 raw.pixls.us file each, pinned, checked against the camera JPEG; `canon_pentax_corpus.rs`): 334 verified, 844 unverified, 232 preview; 50% of photographers on a verified body; use-weighted 85% unchanged | | 2026-10-14 | minor | Integration batch 36: CC0 per-model verification for 117 Nikon/Fujifilm, 97 Canon CR2/Pentax/Ricoh, 21 Sony/Leica and 23 Olympus/Samsung bodies, 22 more CR3 bodies and 30 more models; Epson ERF and Mamiya MEF decode; measured Nikon image areas (#1053, #1770): 515 verified, 675 unverified, 218 preview, 38 unsupported (re-measured with `coverage.py`) | | 2026-10-15 | minor | By-maker and by-use tables re-measured with `coverage.py` after batches 36–39 (545 verified, 651 unverified, 212 preview, 38 unsupported; ~94% of photographers' cameras fully work, ~85% on a verified body); rows the per-model PRs had updated are current again | +| 2026-10-15 | minor | Canon CRW merged with batches 36–39 and re-measured with `coverage.py`: 551 verified, 660 unverified, 197 preview, 38 unsupported; Canon 98% (94% on verified bodies); use-weighted 94% and 86% | +| 2026-10-25 | minor | Canon EOS D60: dual-illuminant matrices fitted to our own ColorChecker Classic shots (tungsten, sun; `crates/raw/src/chart_table.rs`), the first chart-calibrated model: its CRWs edit white balance in Kelvin; counts unchanged | | 2026-10-18 | minor | Minolta MRW decoded (`vendor/mrw.rs`): DiMAGE 7, 7Hi, A1, A2, A200 and Dynax / Maxxum 7D verified; 551 verified, 656 unverified, 201 preview (re-measured with `coverage.py`) | | 2026-10-23 | minor | AHD blends its horizontal and vertical candidates where their homogeneity is close, so flat noise no longer becomes a maze pattern; Bayer demosaic row notes the pre-white-balance demosaic (#1328); scores unchanged | | 2026-10-30 | patch | RAF camera look fitted on the vignetting-corrected sensor (`LOOK_VERSION` 13): renders were up to 0.3 EV too bright in midtones and 0.6 EV in shadows; X-S10 mean ΔE00 vs the camera JPEG 2.71 → 2.55 on 60 photos | +| 2026-10-26 | minor | Canon CRW decoding moved to the shared craft-libs crate `craft-crw` (local path dependency until that branch merges); `vendor/crw.rs` is now the adapter onto `RawImage`, and the clean-room derivation record lives in craft-libs `crates/crw/clean-room/`; counts unchanged | diff --git a/docs/raw/coverage.py b/docs/raw/coverage.py index 3db93ce812..24f6ddd34e 100644 --- a/docs/raw/coverage.py +++ b/docs/raw/coverage.py @@ -32,6 +32,10 @@ HERE = os.path.dirname(os.path.abspath(__file__)) ORF_DECODED = re.compile(r"^(E-1|E-10|E-20|EVOLT E-300|EVOLT E-330|EVOLT E-400|EVOLT E-500|E-300|E-330|E-500|Camedia C-\S.*|Stylus XZ-2 iHS)$") # Samsung SRW bodies with compressed raw data (crates/raw/src/vendor/srw.rs refuses 32770 / 32772 / 32773). SRW_COMPRESSED = re.compile(r"(^|\W)(NX1|NX30|NX300|NX300M|NX500|NX2000|NX3000|NX3300|NX mini|EK-GN\d+|EK-KN\d+)(\W|$)") + +# CIFF-container CRW bodies (crates/raw/src/vendor/crw.rs): every CRW EOS and the CIFF PowerShots +# (the G and S series and the Pro 1). +CRW_DECODED = re.compile(r"^EOS |^PowerShot (G[1-6]$|Pro ?1$|S[34567]0$|S45$)") # Fujifilm bodies before the X series whose RAF has no raw IFD (crates/raw/src/vendor/raf.rs). RAF_OLD = re.compile(r"^(FinePix (E|F|S\d|S\d{3,4}|IS)|IS Pro|S5Pro|S3Pro|S2Pro)", re.I) @@ -89,9 +93,16 @@ def classify(maker, camera, ext_field): return "unverified", "MEF", "MEF decoder (uncompressed 12-bit)" if e == "ERF": return "unverified", "ERF", "ERF decoder (12-bit 16-byte blocks)" + if e == "CRW": + # CIFF-era bodies decode (craft-libs crates/crw/clean-room/02-crw-format.md): EOS D30/D60/10D/300D and + # the CIFF PowerShots; the pre-CIFF compacts (PowerShot 600, A5, A50, Pro70) and the + # unprobed Pro90 IS stay preview. The G5 is preview by evidence (entropy anomaly). + if CRW_DECODED.search(camera): + return "unverified", "CRW", "CRW decoder (CIFF; selector 0-2 tables)" + return "preview", "CRW", "pre-CIFF CRW is not decoded" if e == "MRW": return "unverified", "MRW", "MRW decoder (12-bit packed, 16-bit words)" - if e in ("CRW", "3FR", "FFF", "IIQ", "MOS", "KDC", "X3F", "RAW", "ORI"): + if e in ("3FR", "FFF", "IIQ", "MOS", "KDC", "X3F", "RAW", "ORI"): return "preview", e, f"{e} is opened from its embedded JPEG only" return "unsupported", e, f"{e or 'unknown'} is not imported" diff --git a/docs/raw/coverage.tsv b/docs/raw/coverage.tsv index c062ea95e2..cad79853a0 100644 --- a/docs/raw/coverage.tsv +++ b/docs/raw/coverage.tsv @@ -135,7 +135,7 @@ Canon EOS 6D CR2 2012 verified corpus: crates/raw/tests/it/corpus.rs (xtask RAW_ Canon EOS 6D Mark II CR2 2015 verified corpus: crates/raw/tests/it/body_corpus.rs (pinned sensor hash, camera-JPEG check) Canon EOS 7D CR2 2008 verified corpus: crates/raw/tests/it/corpus.rs (xtask RAW_SAMPLES) Canon EOS 7D Mark II CR2 2013 verified corpus: crates/raw/tests/it/body_corpus.rs (pinned sensor hash, camera-JPEG check) -Canon EOS 10D CRW 2003 preview CRW is opened from its embedded JPEG only +Canon EOS 10D CRW 2003 verified corpus: crates/raw/tests/it/corpus.rs (xtask RAW_SAMPLES; 3 files) Canon EOS 20D CR2 2003 verified corpus: crates/raw/tests/it/body_corpus.rs (pinned sensor hash, camera-JPEG check) Canon EOS 20Da CR2 2005 unverified CR2 lossless JPEG decoder Canon EOS 30D CR2 2005 verified corpus: crates/raw/tests/it/body_corpus.rs (pinned sensor hash, camera-JPEG check) @@ -149,9 +149,9 @@ Canon EOS 80D CR2 2015 verified corpus: crates/raw/tests/it/corpus.rs (xtask RAW Canon EOS 90D CR3 2018 verified corpus: crates/raw/tests/it/cr3_corpus.rs (pinned sensor hash, camera-JPEG check, docs/cr3.md) Canon EOS 200D (EOS Kiss X9, EOS Rebel SL2) CR2 2015 verified corpus: crates/raw/tests/it/body_corpus.rs (pinned sensor hash, camera-JPEG check) Canon EOS 250D (EOS Rebel SL3, EOS 200D II, EOS Kiss X10) CR3 2018 verified corpus: crates/raw/tests/it/cr3_corpus.rs (pinned sensor hash, camera-JPEG check, docs/cr3.md) -Canon EOS D30 CRW 2003 preview CRW is opened from its embedded JPEG only -Canon EOS D60 CRW 2003 preview CRW is opened from its embedded JPEG only -Canon EOS 300D (EOS Digital Rebel, EOS Kiss Digital) CRW 2003 preview CRW is opened from its embedded JPEG only +Canon EOS D30 CRW 2003 verified corpus: crates/raw/tests/it/corpus.rs (xtask RAW_SAMPLES) +Canon EOS D60 CRW 2003 verified corpus: crates/raw/tests/it/corpus.rs; 18 maintainer files exact (craft-libs crates/crw/clean-room/03-verification.md) +Canon EOS 300D (EOS Digital Rebel, EOS Kiss Digital) CRW 2003 verified corpus: crates/raw/tests/it/corpus.rs (xtask RAW_SAMPLES; 3 files) Canon EOS 100D (EOS Digital Rebel SL1, EOS Kiss X7) CR2 2012 verified corpus: crates/raw/tests/it/body_corpus.rs (pinned sensor hash, camera-JPEG check) Canon EOS 500D (EOS Digital Rebel T1i, EOS Kiss X3 Digital) CR2 2008 verified corpus: crates/raw/tests/it/body_corpus.rs (pinned sensor hash, camera-JPEG check) Canon EOS 550D (EOS Digital Rebel T2i, EOS Kiss X4 Digital) CR2 2010 verified corpus: crates/raw/tests/it/corpus.rs (xtask RAW_SAMPLES) @@ -202,20 +202,20 @@ Canon EOS R8 CR3 2022 verified corpus: crates/raw/tests/it/cr3_corpus.rs (exact Canon EOS R50 CR3 2022 verified corpus: crates/raw/tests/it/cr3_corpus.rs (pinned sensor hash, camera-JPEG check, docs/cr3.md) Canon EOS R50 V CR3 2024 verified corpus: crates/raw/tests/it/cr3_corpus.rs (pinned sensor hash, camera-JPEG check, docs/cr3.md) Canon EOS R100 CR3 2022 verified corpus: crates/raw/tests/it/cr3_corpus.rs (exact sensor hashes, docs/cr3.md) -Canon PowerShot 600 CRW 2003 preview CRW is opened from its embedded JPEG only -Canon PowerShot A5 CRW 2003 preview CRW is opened from its embedded JPEG only -Canon PowerShot A50 CRW 2003 preview CRW is opened from its embedded JPEG only -Canon PowerShot G1 CRW 2003 preview CRW is opened from its embedded JPEG only +Canon PowerShot 600 CRW 2003 preview pre-CIFF CRW is not decoded +Canon PowerShot A5 CRW 2003 preview pre-CIFF CRW is not decoded +Canon PowerShot A50 CRW 2003 preview pre-CIFF CRW is not decoded +Canon PowerShot G1 CRW 2003 verified corpus: crates/raw/tests/it/corpus.rs (xtask RAW_SAMPLES) Canon PowerShot G1 X CR2 2012 verified corpus: crates/raw/tests/it/body_corpus.rs (pinned sensor hash, camera-JPEG check) Canon PowerShot G1 X Mark II CR2 2013 verified corpus: crates/raw/tests/it/body_corpus.rs (pinned sensor hash, camera-JPEG check) Canon PowerShot G1 X Mark III CR2 2017 verified corpus: crates/raw/tests/it/body_corpus.rs (pinned sensor hash, camera-JPEG check) -Canon PowerShot G2 CRW 2003 preview CRW is opened from its embedded JPEG only -Canon PowerShot G3 CRW 2003 preview CRW is opened from its embedded JPEG only +Canon PowerShot G2 CRW 2003 unverified CRW decoder (CIFF; selector 0-2 tables) +Canon PowerShot G3 CRW 2003 unverified CRW decoder (CIFF; selector 0-2 tables) Canon PowerShot G3 X CR2 2015 verified corpus: crates/raw/tests/it/body_corpus.rs (pinned sensor hash, camera-JPEG check) -Canon PowerShot G5 CRW 2003 preview CRW is opened from its embedded JPEG only +Canon PowerShot G5 CRW 2003 preview CRW entropy anomaly (craft-libs crates/crw/clean-room/02-crw-format.md section 4); embedded JPEG Canon PowerShot G5 X CR2 2015 verified corpus: crates/raw/tests/it/body_corpus.rs (pinned sensor hash, camera-JPEG check) Canon PowerShot G5 X Mark II CR3 2018 verified corpus: crates/raw/tests/it/cr3_corpus.rs (pinned sensor hash, camera-JPEG check, docs/cr3.md) -Canon PowerShot G6 CRW 2003 preview CRW is opened from its embedded JPEG only +Canon PowerShot G6 CRW 2003 verified corpus: crates/raw/tests/it/corpus.rs (xtask RAW_SAMPLES) Canon PowerShot G7 X CR2 2013 verified corpus: crates/raw/tests/it/body_corpus.rs (pinned sensor hash, camera-JPEG check) Canon PowerShot G7 X Mark II CR2 2015 verified corpus: crates/raw/tests/it/body_corpus.rs (pinned sensor hash, camera-JPEG check) Canon PowerShot G7 X Mark III CR3 2018 verified corpus: crates/raw/tests/it/cr3_corpus.rs (pinned sensor hash, camera-JPEG check, docs/cr3.md) @@ -227,17 +227,17 @@ Canon PowerShot G11 CR2 2008 verified corpus: crates/raw/tests/it/body_corpus.rs Canon PowerShot G12 CR2 2010 verified corpus: crates/raw/tests/it/body_corpus.rs (pinned sensor hash, camera-JPEG check) Canon PowerShot G15 CR2 2012 verified corpus: crates/raw/tests/it/body_corpus.rs (pinned sensor hash, camera-JPEG check) Canon PowerShot G16 CR2 2013 verified corpus: crates/raw/tests/it/body_corpus.rs (pinned sensor hash, camera-JPEG check) -Canon PowerShot Pro 1 CRW 2003 preview CRW is opened from its embedded JPEG only -Canon PowerShot Pro70 CRW 2003 preview CRW is opened from its embedded JPEG only -Canon PowerShot Pro90 IS CRW 2003 preview CRW is opened from its embedded JPEG only -Canon PowerShot S30 CRW 2003 preview CRW is opened from its embedded JPEG only -Canon PowerShot S40 CRW 2003 preview CRW is opened from its embedded JPEG only -Canon PowerShot S45 CRW 2003 preview CRW is opened from its embedded JPEG only -Canon PowerShot S50 CRW 2003 preview CRW is opened from its embedded JPEG only -Canon PowerShot S60 CRW 2003 preview CRW is opened from its embedded JPEG only +Canon PowerShot Pro 1 CRW 2003 unverified CRW decoder (CIFF; selector 0-2 tables) +Canon PowerShot Pro70 CRW 2003 preview pre-CIFF CRW is not decoded +Canon PowerShot Pro90 IS CRW 2003 preview pre-CIFF CRW is not decoded +Canon PowerShot S30 CRW 2003 unverified CRW decoder (CIFF; selector 0-2 tables) +Canon PowerShot S40 CRW 2003 unverified CRW decoder (CIFF; selector 0-2 tables) +Canon PowerShot S45 CRW 2003 unverified CRW decoder (CIFF; selector 0-2 tables) +Canon PowerShot S50 CRW 2003 unverified CRW decoder (CIFF; selector 0-2 tables) +Canon PowerShot S60 CRW 2003 unverified CRW decoder (CIFF; selector 0-2 tables) Canon PowerShot S90 CR2 2008 unverified CR2 lossless JPEG decoder Canon PowerShot S95 CR2 2010 verified corpus: crates/raw/tests/it/body_corpus.rs (pinned sensor hash, camera-JPEG check) -Canon PowerShot S70 CRW 2003 preview CRW is opened from its embedded JPEG only +Canon PowerShot S70 CRW 2003 unverified CRW decoder (CIFF; selector 0-2 tables) Canon PowerShot S100 CR2 2010 verified corpus: crates/raw/tests/it/body_corpus.rs (pinned sensor hash, camera-JPEG check) Canon PowerShot S100V CR2 2010 verified corpus: crates/raw/tests/it/body_corpus.rs (pinned sensor hash, camera-JPEG check) Canon PowerShot S110 CR2 2012 verified corpus: crates/raw/tests/it/body_corpus.rs (pinned sensor hash, camera-JPEG check) diff --git a/docs/raw/evidence.tsv b/docs/raw/evidence.tsv index 6212558585..1e6e7399af 100644 --- a/docs/raw/evidence.tsv +++ b/docs/raw/evidence.tsv @@ -569,3 +569,10 @@ Konica Minolta DiMAGE A200 verified corpus: crates/raw/tests/it/corpus.rs (xtask Konica Minolta Maxxum 7D Dynax 7D verified corpus: crates/raw/tests/it/corpus.rs (xtask RAW_SAMPLES) Konica Minolta DiMAGE 7 verified raw.pixls.us check: CC0 sample decoded and its WB / CFA matched to the embedded preview (vendor/mrw.rs) Konica Minolta DiMAGE A2 verified raw.pixls.us check: CC0 sample decoded and its WB / CFA matched to the embedded preview (vendor/mrw.rs) +Canon EOS D30 verified corpus: crates/raw/tests/it/corpus.rs (xtask RAW_SAMPLES) +Canon EOS D60 verified corpus: crates/raw/tests/it/corpus.rs; 18 maintainer files exact (craft-libs crates/crw/clean-room/03-verification.md) +Canon EOS 10D verified corpus: crates/raw/tests/it/corpus.rs (xtask RAW_SAMPLES; 3 files) +Canon EOS 300D (EOS Digital Rebel, EOS Kiss Digital) verified corpus: crates/raw/tests/it/corpus.rs (xtask RAW_SAMPLES; 3 files) +Canon PowerShot G1 verified corpus: crates/raw/tests/it/corpus.rs (xtask RAW_SAMPLES) +Canon PowerShot G6 verified corpus: crates/raw/tests/it/corpus.rs (xtask RAW_SAMPLES) +Canon PowerShot G5 preview CRW entropy anomaly (craft-libs crates/crw/clean-room/02-crw-format.md section 4); embedded JPEG diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 757ed90555..c54e4884ad 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1,6 +1,6 @@ # Target-app parity: LightCraft vs Adobe Lightroom -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-24 · **Change:** minor (gap 9: CI runs the tests on Linux x64 since #2667; macOS, Windows and the GPU equivalence tests still don't; Minolta MRW decoded, 6 bodies verified; RAW: 83% of Adobe's models decode, 38% verified after the camera-coverage sweep #1327; Platforms: the Windows x64 installer verified on Windows 11) · **Target:** Adobe Lightroom Classic 15.5 (August 2026) and Lightroom 9.6 (desktop) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-26 · **Change:** minor (Canon CRW decoder shared via craft-libs `craft-crw`; Canon CRW decoded clean-room, 6 bodies verified; gap 9: CI runs the tests on Linux x64 since #2667; macOS, Windows and the GPU equivalence tests still don't; Minolta MRW decoded, 6 bodies verified; RAW: 85% of Adobe's models decode, 39% verified after the camera-coverage sweep #1327; Platforms: the Windows x64 installer verified on Windows 11) · **Target:** Adobe Lightroom Classic 15.5 (August 2026) and Lightroom 9.6 (desktop) The authoritative assessment of how close LightCraft is to Lightroom. The row-by-row checklist is [parity-checklist.md](parity-checklist.md); the ranked work list is [gaps.md](gaps.md); deep areas @@ -47,7 +47,7 @@ phase #85, duplicate Local entries #22, black GPU exports on an Intel iGPU #78). | Dimension | Breadth | Ready for real work | Remaining | Doc | |---|---:|---:|---:|---| | Features (weighted areas below) | ~77% (checklist 81.1%, measured) | ~61% | 600–1,100 h | [Features](#features) | -| ↳ RAW cameras, colour and lens profiles (part of features) | 83% of Adobe's 1,446 models decode (38% verified), measured | ~56% | 255–480 h | [raw-parity.md](raw-parity.md) | +| ↳ RAW cameras, colour and lens profiles (part of features) | 85% of Adobe's 1,446 models decode (39% verified), measured | ~56% | 255–480 h | [raw-parity.md](raw-parity.md) | | UI/UX fidelity | ~85% | ~70% | 32–54 h | [ui-parity.md](ui-parity.md) | | File formats (non-raw: images, sidecars, presets, catalogs) | ~85% | ~70% | 30–55 h | [file-format-parity.md](file-format-parity.md) | | Hardware | ~50% | ~40% | 40–80 h (+ tethering and printing, counted under Classic modules) | [hardware-parity.md](hardware-parity.md) | @@ -68,7 +68,7 @@ from the checklist sections and the deep-dive documents. |---|---:|---:|---:|---:|---| | Import and library (import, folders, albums, smart albums, keywords, metadata, search, faces) | 15% | 90% | 80% | 25–45 h | checklist A–E 83–92%; robust journal; 85k-photo libraries | | RAW decoding and camera coverage | 15% | 81% | 77% | 120–220 h | [raw-parity.md](raw-parity.md), measured model by model: 85% of photographers' cameras decode (use-weighted), × 0.9 for per-body bugs; CR3 variants, compressed ORF, HE NEF | -| Colour, camera profiles, render fidelity | 10% | 65% | 35% | 80–150 h | 9 bundled profiles vs Adobe's 1,500; per-file fits median ΔE ~5 vs the camera JPEG, ~10% far off; no fidelity suite ([raw-parity.md](raw-parity.md#colour)) | +| Colour, camera profiles, render fidelity | 10% | 65% | 35% | 80–150 h | 10 bundled profiles vs Adobe's 1,500; per-file fits median ΔE ~5 vs the camera JPEG, ~10% far off; no fidelity suite ([raw-parity.md](raw-parity.md#colour)) | | Global develop adjustments (light, colour, curves, grading, effects, detail) | 15% | 93% | 70% | 30–60 h | checklist F 91.7%; character tuned by eye | | Optics, lens profiles, crop and geometry | 6% | 80% | 50% | 40–80 h | no lens database; crop / Upright complete | | Masking | 8% | 67% | 45% | 60–110 h | checklist K 67.4%; AI masks heuristic or SAM 3 without mirror | @@ -301,6 +301,7 @@ P2 items 12–25 h; look tuning, performance, packaging, hardening 25–45 h. | Date | Change | Summary | |---|---|---| | 2026-10-24 | patch | Stability, the stability discount, the Beta-needs list and the estimate history: tests run in CI on Linux x64 since #2667 (FreeBSD nightly), not on macOS or Windows (gap 9); percentages and hours unchanged | +| 2026-10-13 | minor | Canon CRW decoded (clean-room, craft-libs `crates/crw/clean-room/`): 551 models verified with the coverage sweep (557 with MRW after merging main), Canon preview rows 21 → 6; RAW decoding unchanged | | 2026-10-19 | patch | Stability note: tests run in CI on Linux x64 (every PR) as well as FreeBSD; macOS and Windows remain (gap 9) | | 2026-10-19 | minor | Localization ~55% → ~64% (mean of the 12 key languages): Indonesian (`id`) catalog, every message but What's New; full target 61.2% → 61.5% (still ~61%) | | 2026-10-19 | patch | Platforms: the Windows installer is no longer listed as unverified (the 0.9.1 x64 MSI is tested on Windows 11; a confirmation after uninstalling from Settings → Apps, #892, remains); #790 noted as fixed in 0.9.1; percentages and hours unchanged | @@ -320,3 +321,4 @@ P2 items 12–25 h; look tuning, performance, packaging, hardening 25–45 h. | 2026-10-10 | minor | Stage re-checked against the core-workflow alpha gate: passes, stays alpha | | 2026-10-10 | major | Created as progress docs: full re-measure (checklist recount, installed Lightroom 9.6 bundle listing, code counts, catalogs, CI), feature areas with weights, dimensions, AI, stage, calibration; merged ROADMAP's *Where we stand* and *Parity estimate* | | 2026-10-14 | minor | RAW: 82% of Adobe's models decode, 36% verified (integration batch 36) | +| 2026-10-26 | minor | Canon CRW decoder moved to craft-libs as `craft-crw` (shared with the other Craft apps); LightCraft keeps the adapter, the EOS D60 colour work and its records; numbers unchanged | diff --git a/tools/spectral_camera_table.py b/tools/spectral_camera_table.py index d936983b47..f77d25ecae 100644 --- a/tools/spectral_camera_table.py +++ b/tools/spectral_camera_table.py @@ -129,6 +129,7 @@ def main(root, out): print(f"{f}: training dE76 A {e1:.3f}, D65 {e2:.3f}", file=sys.stderr) rows.append( f' Camera {{\n make: "{rust_lit(header["manufacturer"])}",\n model: "{rust_lit(header["model"])}",\n' + " illuminant: [17, 21],\n" f" color_matrix: [{mat(cm1)}, {mat(cm2)}],\n forward_matrix: [{mat(fm1)}, {mat(fm2)}],\n }}," ) aliases = json.load(open(os.path.join(root, "data/aliases.json")))["data"]["camera"]["model"] diff --git a/xtask/src/raw_samples.rs b/xtask/src/raw_samples.rs index c9cbe7e42b..ae386352d6 100644 --- a/xtask/src/raw_samples.rs +++ b/xtask/src/raw_samples.rs @@ -926,6 +926,63 @@ pub(crate) const RAW_SAMPLES: &[(&str, &str, &str)] = &[ "https://raw.pixls.us/getfile.php/4204/nice/Leica%20-%20D-Lux%207%20-%204:3.RWL", "4f6db6492da83f7f2a5012591e370557249d1ed44d4c948784016605b799327c", ), + // Canon CRW (CIFF): the clean-room decode's verification corpus (craft-libs crates/crw/clean-room/03-verification.md); + // the PowerShot G5 is the documented anomaly the decoder refuses (embedded JPEG preview) + ( + "crw-canon-eos-d30.crw", + "https://raw.pixls.us/getfile.php/1307/nice/Canon%20-%20EOS%20D30%20-%20RAW%20(3:2).CRW", + "4ee482f2b6f9f1a8d370703ea04e9f2abaa49356973a7f56b229af93a78e8a2e", + ), + ( + "crw-canon-eos-d60.crw", + "https://raw.pixls.us/getfile.php/2010/nice/Canon%20-%20EOS%20D60%20-%20RAW%20(3:2).CRW", + "2b98659ecff170af1dfe44f89b493139e75e995b2979686f6ff0847cfb56b97f", + ), + ( + "crw-canon-eos-10d-a.crw", + "https://raw.pixls.us/getfile.php/2027/nice/Canon%20-%20EOS%2010D%20-%20RAW%20(3:2).CRW", + "b0730eb3a67cc2281a32e0b2ee104199246928d954a68b7e5b72366514c73d02", + ), + ( + "crw-canon-eos-10d-b.crw", + "https://raw.pixls.us/getfile.php/3164/nice/Canon%20-%20EOS%2010D%20-%20RAW%20(3:2).crw", + "e879c94afdc64dabc88b01ce2d02628aa225259303ec71dd61f7fb0322bfea2d", + ), + ( + "crw-canon-eos-10d-c.crw", + "https://raw.pixls.us/getfile.php/3165/nice/Canon%20-%20EOS%2010D%20-%20RAW%20(3:2).crw", + "58144118854657df5cd2185df40fecf6b665fc6754fef0416c2f222b68b025c6", + ), + ( + "crw-canon-eos-300d-a.crw", + "https://raw.pixls.us/getfile.php/1983/nice/Canon%20-%20EOS%20300D%20-%20RAW%20(3:2).crw", + "47da16e1668af5500eea63cf42cf2992d9cb3d32180b8d786f17f1e2a57f39f4", + ), + ( + "crw-canon-eos-300d-b.crw", + "https://raw.pixls.us/getfile.php/3162/nice/Canon%20-%20EOS%20300D%20-%20RAW%20(3:2).CRW", + "9e7f62239fe728046af28d0d4a8a722d35d40146a79794a5bda1775306af4383", + ), + ( + "crw-canon-eos-digital-rebel.crw", + "https://raw.pixls.us/getfile.php/1308/nice/Canon%20-%20EOS%20Digital%20Rebel%20-%20RAW%20(3:2).CRW", + "d6a3131bfac390fde01b96882ec378211f04570c3252708b58f0d05b33a9fdfc", + ), + ( + "crw-canon-powershot-g1.crw", + "https://raw.pixls.us/getfile.php/2073/nice/Canon%20-%20PowerShot%20G1%20-%20RAW%20(4:3).crw", + "f39be5acf14057ce04527fd8d0574e57ec8ed5fed082d7bfaff763075a44ee8a", + ), + ( + "crw-canon-powershot-g5.crw", + "https://raw.pixls.us/getfile.php/1746/nice/Canon%20-%20PowerShot%20G5%20-%20RAW%20(4:3).CRW", + "bb084223d714871b99de4f549eaf00513e30a7080feeead700252c2008060196", + ), + ( + "crw-canon-powershot-g6.crw", + "https://raw.pixls.us/getfile.php/4226/nice/Canon%20-%20PowerShot%20G6%20-%20RAW%20(4:3).CRW", + "244378e1f5660b6cc6cefc93a75ed4928d0b28aa6304ff327b61c748538f4fef", + ), ( "mrw-minolta-dimage7hi-words16.mrw", "https://raw.pixls.us/data/Minolta/DiMAGE%207Hi/RAW_MINOLTA_DIMAGE_7HI.MRW", From ac1799db38661e07a855653f86feb3e66081102e Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Mon, 2 Nov 2026 22:50:58 -0500 Subject: [PATCH 25/41] web: ?bench runs on demo photos in an unsaved library, never the stored one (#3646) A navigation link with ?bench opened the first photo of the library in browser storage and committed Exposure edits to it, finishing at 0 instead of the photo's own value. ?bench now implies ?store=memory and loads the generated demo photos, so the benchmark cannot edit stored photos. --- apps/lightcraft-web/src/bench.rs | 3 +++ apps/lightcraft-web/src/lib.rs | 3 ++- apps/lightcraft-web/src/web.rs | 11 +++++++++-- docs/web.md | 3 ++- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/apps/lightcraft-web/src/bench.rs b/apps/lightcraft-web/src/bench.rs index 484c0041f6..4864834c75 100644 --- a/apps/lightcraft-web/src/bench.rs +++ b/apps/lightcraft-web/src/bench.rs @@ -2,6 +2,9 @@ //! control exactly like a slider drag (begin interaction → N `develop.set` → end) and time each //! step from the command to the moment the new loupe texture is ready. Results go to the log //! (the browser console on the web) as one `lightcraft-bench {…json…}` line. +//! +//! The web host runs it only on the generated demo photos in an unsaved library (`?bench` implies `?store=memory`): it +//! commits edits to the photo it opens, which must never be one in the user's stored library. use lightcraft_ui_egui::LightcraftApp; use lightcraft_ui_egui::render::Slot; diff --git a/apps/lightcraft-web/src/lib.rs b/apps/lightcraft-web/src/lib.rs index 5d3c011589..6a6b83b728 100644 --- a/apps/lightcraft-web/src/lib.rs +++ b/apps/lightcraft-web/src/lib.rs @@ -11,7 +11,8 @@ //! - export downloads the file through the browser. //! //! `?bench` in the URL runs a scripted first-paint / slider-latency measurement and logs it to the -//! console (see [`bench`]); `?store=idb` forces the IndexedDB backend, `?store=memory` disables +//! console (see [`bench`]) on the generated demo photos in an unsaved library (it implies `?store=memory`, so it never edits +//! the library in browser storage); `?store=idb` forces the IndexedDB backend, `?store=memory` disables //! persistence and `?workers=0` renders on the main thread. #![forbid(unsafe_code)] #![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)] diff --git a/apps/lightcraft-web/src/web.rs b/apps/lightcraft-web/src/web.rs index bd5215e4d4..da71c592a8 100644 --- a/apps/lightcraft-web/src/web.rs +++ b/apps/lightcraft-web/src/web.rs @@ -90,9 +90,12 @@ impl Options { }) .collect(); let get = |k: &str| params.iter().find(|(n, _)| n == k).map(|(_, v)| v.clone()); + let bench = get("bench").is_some(); Options { - bench: get("bench").is_some(), - store: get("store").filter(|s| s == "idb" || s == "memory").unwrap_or_else(|| "opfs".into()), + bench, + // the benchmark edits the first photo it finds: a link with `?bench` must never reach + // the library in browser storage, so it always runs on the demo photos in an unsaved library + store: if bench { "memory".into() } else { get("store").filter(|s| s == "idb" || s == "memory").unwrap_or_else(|| "opfs".into()) }, workers: get("workers").and_then(|v| v.parse().ok()), reset: get("reset").is_some(), } @@ -496,6 +499,10 @@ impl WebApp { }); } } + // `?bench` never has storage (see `Options::from_url`): it measures the generated demo photos + if opts.bench && backend.is_none() && session.catalog.len() == 0 { + lightcraft_engine::demo::load(&mut session); + } if backend.is_some() { notice( "LightCraft in the browser is experimental. Your library is kept in this browser's storage: keep your original photos \ diff --git a/docs/web.md b/docs/web.md index 76b84cd7c0..d8065dd766 100644 --- a/docs/web.md +++ b/docs/web.md @@ -188,7 +188,8 @@ are the same in every version, so serve them with `Cache-Control: no-cache` (not ## Measuring -Open `http://127.0.0.1:8080/?bench` to run a scripted measurement: +Open `http://127.0.0.1:8080/?bench` to run a scripted measurement. It always runs on the generated demo photos in an unsaved library +(`?bench` implies `?store=memory`), so it never edits the library kept in browser storage: 1. Wait for the grid thumbnails. 2. Open the first photo in Detail. From b873084d05b6e724f917d38da6ca1f2b4c6eb679 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Tue, 3 Nov 2026 08:36:03 -0500 Subject: [PATCH 26/41] #3601: the Preview pill sits on the photo too, above its badge band Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/panels/grid.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/ui-egui/src/panels/grid.rs b/crates/ui-egui/src/panels/grid.rs index 21abd6e904..5c4b423fec 100644 --- a/crates/ui-egui/src/panels/grid.rs +++ b/crates/ui-egui/src/panels/grid.rs @@ -814,7 +814,7 @@ fn cell(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId, r: Rect, square paint_copy_tag(p, &t, name, img_rect, square); } if let Some(why) = &photo.preview_only { - paint_preview_pill(ui, p, &t, id, why, img_rect); + paint_preview_pill(ui, p, &t, id, why, photo_rect); } if photo.flag == Flag::Reject { p.rect_filled(img_rect, 0.0, Color32::from_black_alpha(110)); @@ -954,11 +954,11 @@ fn paint_copy_tag(p: &egui::Painter, t: &Tokens, name: &str, img_rect: Rect, squ p.galley(pos2(br.left() + 22.0, br.center().y - g.size().y / 2.0), g, Color32::WHITE); } -fn paint_preview_pill(ui: &egui::Ui, p: &egui::Painter, t: &Tokens, id: PhotoId, why: &str, img_rect: Rect) { - // a raw shown from its embedded JPEG: a small amber "Preview" pill at the image's bottom +fn paint_preview_pill(ui: &egui::Ui, p: &egui::Painter, t: &Tokens, id: PhotoId, why: &str, photo_rect: Rect) { + // a raw shown from its embedded JPEG: a small amber "Preview" pill at the photo's bottom // left, above the badge bar (always shown: it changes what editing does) let g = p.layout_no_wrap(crate::i18n::tr("Preview").into(), t.semibold(9.5), Color32::WHITE); - let at = pos2(img_rect.left() + 6.0, img_rect.bottom() - 30.0 - 16.0); + let at = pos2(photo_rect.left() + 6.0, photo_rect.bottom() - 30.0 - 16.0); let br = Rect::from_min_size(at, vec2(g.size().x + 24.0, 16.0)); p.rect_filled(br, 8.0, Color32::from_black_alpha(170)); paint(p, Rect::from_center_size(pos2(br.left() + 9.0, br.center().y), vec2(12.0, 12.0)), Icon::Info, t.caution); From d346fba2d367c2bc7eba019a32dd96ad6aba87df Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Tue, 3 Nov 2026 08:36:22 -0500 Subject: [PATCH 27/41] #3601: rustfmt (drop the trailing blank line) Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/panels/grid.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/crates/ui-egui/src/panels/grid.rs b/crates/ui-egui/src/panels/grid.rs index 5c4b423fec..3b1f23db7a 100644 --- a/crates/ui-egui/src/panels/grid.rs +++ b/crates/ui-egui/src/panels/grid.rs @@ -1696,4 +1696,3 @@ mod tests { assert!(bar.bottom() <= wide.bottom() + 0.01); } } - From 4d2fa1269b34024fbf34b665a7182a4e4b1085ab Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 3 Nov 2026 11:51:22 -0500 Subject: [PATCH 28/41] lightcraft-cli: calibrate walks folders with the engine's bounded walk (#3643) * lightcraft-cli: calibrate walks folders with the engine's bounded walk * lightcraft-cli: calibrate keeps only regular raw files --- apps/lightcraft-cli/src/main.rs | 61 +++++++++++++++++++++------ crates/engine/src/walk.rs | 73 +++++++++++++++++++++++++++++++-- 2 files changed, 118 insertions(+), 16 deletions(-) diff --git a/apps/lightcraft-cli/src/main.rs b/apps/lightcraft-cli/src/main.rs index 01d6f23b39..7ace1a8981 100644 --- a/apps/lightcraft-cli/src/main.rs +++ b/apps/lightcraft-cli/src/main.rs @@ -196,7 +196,12 @@ fn main() -> ExitCode { } /// Raw files below `path` (or `path` itself), skipping hidden and NAS metadata folders. -fn raw_files(path: &Path, out: &mut Vec, depth: usize) { +/// +/// Folders go through the engine's bounded walk ([`lightcraft_engine::walk::files_in`]): it enters +/// a folder reached through a link once at most and stops at a depth and an entry budget. A +/// folder of links pointing back at their parents made the old recursive walk re-read the same +/// folders exponentially often before its depth limit cut it off (CWE-400). +fn raw_files(path: &Path, out: &mut Vec) { let is_raw = |p: &Path| { p.extension().and_then(|e| e.to_str()).is_some_and(|e| ["arw", "nef", "nrw", "raf", "crw"].iter().any(|x| e.eq_ignore_ascii_case(x))) }; @@ -206,17 +211,20 @@ fn raw_files(path: &Path, out: &mut Vec, depth: usize) { } return; } - let Ok(entries) = std::fs::read_dir(path) else { return }; - if depth > 32 { - return; - } - for entry in entries.flatten() { - let name = entry.file_name(); - if name.to_string_lossy().starts_with(['.', '@']) { - continue; - } - raw_files(&entry.path(), out, depth + 1); + // (hidden entries are left out by the walk; `@eaDir` and other NAS metadata folders and files + // here, folders before they are listed so their entries do not use up the walk's budget) + let nas_metadata = |p: &Path| p.file_name().is_some_and(|n| n.to_string_lossy().starts_with('@')); + let walked = lightcraft_engine::walk::files_in_entering( + path, + None, + lightcraft_engine::walk::Limits::default(), + |p| is_raw(p) && !nas_metadata(p) && p.is_file(), + |p| !nas_metadata(p), + ); + if walked.truncated { + eprintln!("calibrate: {} has more folders or entries than a walk looks at; the rest is left out", path.display()); } + out.extend(walked.files); } fn calibrate(args: &[String]) -> Result<(), String> { @@ -238,7 +246,7 @@ fn calibrate(args: &[String]) -> Result<(), String> { } let mut files = Vec::new(); for input in &inputs { - raw_files(Path::new(input), &mut files, 0); + raw_files(Path::new(input), &mut files); } files.sort(); files.dedup(); @@ -1070,6 +1078,35 @@ fn denoise_serve(_: &[String]) -> Result<(), String> { Err("denoise-serve: this build has no denoise support (build with the `denoise` feature)".into()) } +#[cfg(all(test, unix))] +mod raw_files_tests { + use super::raw_files; + + /// Links back to their own folders are entered once, not once per path that reaches them: a + /// handful of such links made the old walk list the same folders exponentially often. + #[test] + fn folder_links_back_up_are_walked_once() { + let dir = std::env::temp_dir().join(format!("lightcraft-cli-raw-files-{}", std::process::id())); + let _ = std::fs::remove_dir_all(&dir); + let a = dir.join("a"); + std::fs::create_dir_all(a.join("@eaDir")).unwrap(); + std::fs::write(a.join("one.NEF"), b"").unwrap(); + std::fs::write(a.join("@eaDir").join("thumb.nef"), b"").unwrap(); + std::fs::write(a.join("notes.txt"), b"").unwrap(); + for i in 0..8 { + std::os::unix::fs::symlink(&dir, a.join(format!("up{i}"))).unwrap(); + } + // a named pipe with a raw extension: not a file, so never opened (a read would block) + assert!(std::process::Command::new("mkfifo").arg(a.join("pipe.nef")).status().unwrap().success()); + let started = std::time::Instant::now(); + let mut files = Vec::new(); + raw_files(&dir, &mut files); + assert!(started.elapsed() < std::time::Duration::from_secs(10), "walk took {:?}", started.elapsed()); + assert_eq!(files, vec![a.join("one.NEF")]); + let _ = std::fs::remove_dir_all(&dir); + } +} + #[cfg(test)] mod import_target_tests { use super::{import_and_select, import_targets, json}; diff --git a/crates/engine/src/walk.rs b/crates/engine/src/walk.rs index 98290130ea..db024f7098 100644 --- a/crates/engine/src/walk.rs +++ b/crates/engine/src/walk.rs @@ -95,17 +95,37 @@ pub type NoteFolder<'a> = &'a mut dyn FnMut(&Path, Vec<(std::ffi::OsString, Entr /// are left out, the folder `skip` (e.g. the library's own) is never entered, and the walk stops /// at `limits` (see [`Walked::truncated`]). Unreadable folders are skipped. pub fn files_in(root: &Path, skip: Option<&Path>, limits: Limits, keep: impl FnMut(&Path) -> bool) -> Walked { - walk(root, skip, limits, keep, None) + walk(root, skip, limits, keep, |_| true, None) +} + +/// [`files_in`], entering a folder below `root` only when `enter` accepts it: a folder it turns +/// down is neither listed nor counted against `limits` (e.g. a NAS's `@eaDir` thumbnail folders, +/// which can hold more entries than the photos beside them). +pub fn files_in_entering( + root: &Path, + skip: Option<&Path>, + limits: Limits, + keep: impl FnMut(&Path) -> bool, + enter: impl FnMut(&Path) -> bool, +) -> Walked { + walk(root, skip, limits, keep, enter, None) } /// [`files_in`], handing the listing of every folder it reads to `note`: who walks a folder to /// find its files has, with that, the answer to "is this name there" for everything in it, and /// need not ask the disk again (a round trip for each name on a network share). pub fn files_in_noting(root: &Path, skip: Option<&Path>, limits: Limits, keep: impl FnMut(&Path) -> bool, note: NoteFolder) -> Walked { - walk(root, skip, limits, keep, Some(note)) + walk(root, skip, limits, keep, |_| true, Some(note)) } -fn walk(root: &Path, skip: Option<&Path>, limits: Limits, mut keep: impl FnMut(&Path) -> bool, mut note: Option) -> Walked { +fn walk( + root: &Path, + skip: Option<&Path>, + limits: Limits, + mut keep: impl FnMut(&Path) -> bool, + mut enter: impl FnMut(&Path) -> bool, + mut note: Option, +) -> Walked { let mut out = Walked::default(); // canonical folders reached through a link, so a link loop is walked at most once let mut linked: HashSet = HashSet::new(); @@ -171,6 +191,11 @@ fn walk(root: &Path, skip: Option<&Path>, limits: Limits, mut keep: impl FnMut(& // a link (or a Windows junction): a folder is entered once, a file is a file match std::fs::metadata(&p) { Ok(m) if m.is_dir() => { + // (asked before the folder is marked as entered, so a folder turned down + // here can still be entered through another link to it) + if !enter(&p) { + continue; + } let Ok(c) = std::fs::canonicalize(&p) else { continue }; if !linked.insert(c) { continue; @@ -179,8 +204,13 @@ fn walk(root: &Path, skip: Option<&Path>, limits: Limits, mut keep: impl FnMut(& } _ => false, } + } else if ft.is_dir() { + if !enter(&p) { + continue; + } + true } else { - ft.is_dir() + false }; children.push((p, dir)); } @@ -343,6 +373,41 @@ mod tests { let _ = std::fs::remove_dir_all(&d); } + /// A folder `enter` turns down is not listed: its entries neither come back nor use up the + /// entry budget, so a sibling folder after it is still walked. + #[test] + fn folders_turned_down_are_not_listed_or_counted() { + let d = tmp("enter"); + std::fs::create_dir_all(d.join("@eaDir")).unwrap(); + std::fs::create_dir_all(d.join("z")).unwrap(); + for i in 0..20 { + std::fs::write(d.join("@eaDir").join(format!("{i:02}.jpg")), b"x").unwrap(); + } + std::fs::write(d.join("z/keep.jpg"), b"x").unwrap(); + let not_at = |p: &Path| !p.file_name().is_some_and(|n| n.to_string_lossy().starts_with('@')); + let w = files_in_entering(&d, None, Limits { max_depth: 8, max_entries: 5 }, |_| true, not_at); + assert_eq!((w.files, w.entries, w.truncated), (vec![d.join("z/keep.jpg")], 3, false)); + let _ = std::fs::remove_dir_all(&d); + } + + /// A link `enter` turns down does not use up its folder's one visit through a link: another + /// link to the same folder is still entered. + #[cfg(unix)] + #[test] + fn folder_turned_down_through_one_link_is_entered_through_another() { + let d = tmp("enter-link"); + std::fs::create_dir_all(d.join("real")).unwrap(); + std::fs::write(d.join("real/p.jpg"), b"x").unwrap(); + let root = d.join("root"); + std::fs::create_dir_all(&root).unwrap(); + std::os::unix::fs::symlink(d.join("real"), root.join("@meta")).unwrap(); + std::os::unix::fs::symlink(d.join("real"), root.join("photos")).unwrap(); + let not_at = |p: &Path| !p.file_name().is_some_and(|n| n.to_string_lossy().starts_with('@')); + let w = files_in_entering(&root, None, Limits::default(), |_| true, not_at); + assert_eq!(w.files, vec![root.join("photos/p.jpg")]); + let _ = std::fs::remove_dir_all(&d); + } + /// A link back up the tree (a loop) is followed at most once: the walk ends. #[cfg(unix)] #[test] From a93172c2f7c6b570669281c6b106208463cf46f2 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 3 Nov 2026 17:47:46 -0500 Subject: [PATCH 29/41] security(engine): Find Missing Photos hashes only regular files, no further than their size (#3704) --- crates/engine/src/cmd/missing.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/engine/src/cmd/missing.rs b/crates/engine/src/cmd/missing.rs index e5a17ab5db..17454cac26 100644 --- a/crates/engine/src/cmd/missing.rs +++ b/crates/engine/src/cmd/missing.rs @@ -163,7 +163,11 @@ fn stored_hash(p: &Photo) -> Option<&str> { /// The content hash of the file at `path` (as import computes it), if it can be read. Read in /// pieces: the file is whatever is on the disk, of any size. fn file_hash(path: &str) -> Option { - hash_reader(std::fs::File::open(path).ok()?) + use std::io::Read; + // the opened file must be regular (a FIFO or device would never end), and no more than its size at open is read + let file = std::fs::File::open(path).ok()?; + let meta = file.metadata().ok().filter(|m| m.is_file())?; + hash_reader(file.take(meta.len())) } /// The content hash of what `r` gives, read in pieces (the hash import computes of the whole). @@ -230,6 +234,9 @@ mod tests { std::fs::write(&f, b"pixels").unwrap(); assert_eq!(file_hash(f.to_str().unwrap()), Some(lightcraft_preview::hash_bytes(b"pixels").to_string())); assert_eq!(file_hash(dir.0.join("nope").to_str().unwrap()), None); + assert_eq!(file_hash(dir.0.to_str().unwrap()), None, "a folder has no content hash"); + #[cfg(unix)] + assert_eq!(file_hash("/dev/zero"), None, "a device never ends"); } } From a5803fe49fbf180c8918aa1b69a55c877b480d8f Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 3 Nov 2026 17:48:05 -0500 Subject: [PATCH 30/41] security(engine, faces): index repeated membership scans in photo move, keywords, import planning, sync and rename (#3709) --- crates/engine/src/cmd/browse.rs | 3 ++- crates/engine/src/cmd/library/specs.rs | 20 +++++++++------ crates/engine/src/import/commit.rs | 7 +++--- crates/engine/src/import/job.rs | 11 ++++++--- crates/engine/src/rename/plan.rs | 20 ++++++++++++--- crates/engine/src/rename/tests.rs | 34 ++++++++++++++++++++++++++ crates/engine/src/sync.rs | 6 +++-- crates/faces/src/matching.rs | 8 ++++-- 8 files changed, 86 insertions(+), 23 deletions(-) diff --git a/crates/engine/src/cmd/browse.rs b/crates/engine/src/cmd/browse.rs index 49f75181ca..9a235306c6 100644 --- a/crates/engine/src/cmd/browse.rs +++ b/crates/engine/src/cmd/browse.rs @@ -433,6 +433,7 @@ fn move_to_folder(s: &mut Session, p: &Value) -> Result { } let mut plans: Vec = Vec::new(); let mut taken: std::collections::HashSet = std::collections::HashSet::new(); + let mut moving: std::collections::HashSet<&str> = std::collections::HashSet::new(); let mut clashes: Vec = Vec::new(); for id in ids { let ph = s.catalog.photo(id).ok_or_else(|| bad(C, format!("no photo {}", id.0)))?; @@ -442,7 +443,7 @@ fn move_to_folder(s: &mut Session, p: &Value) -> Result { let lightcraft_catalog::Source::File { path } = &ph.source else { return Err(bad(C, format!("{} has no file on disk", ph.file_name))); }; - if plans.iter().any(|pl| pl.from_path.as_deref() == Some(path.as_str())) { + if !moving.insert(path.as_str()) { continue; // a virtual copy of a photo already moving } let src = Path::new(path); diff --git a/crates/engine/src/cmd/library/specs.rs b/crates/engine/src/cmd/library/specs.rs index a2a842106a..b99e97c054 100644 --- a/crates/engine/src/cmd/library/specs.rs +++ b/crates/engine/src/cmd/library/specs.rs @@ -757,25 +757,29 @@ pub fn specs() -> Vec { } } // keywords are stored cleaned (`a | b ` is `a|b`), each once whatever its case - use lightcraft_catalog::keywords::{clean, same}; - let add = |m: &mut lightcraft_catalog::Meta, k: &str| { + use lightcraft_catalog::keywords::clean; + // (a set of the lower-cased keywords keeps this linear however many are supplied) + let mut seen: std::collections::HashSet = m.keywords.iter().map(|x| x.to_lowercase()).collect(); + let add = |m: &mut lightcraft_catalog::Meta, seen: &mut std::collections::HashSet, k: &str| { let k = clean(k); - if !k.is_empty() && !m.keywords.iter().any(|x| same(x, &k)) { + if !k.is_empty() && seen.insert(k.to_lowercase()) { m.keywords.push(k); } }; if let Some(k) = strs("keywords") { m.keywords.clear(); + seen.clear(); for k in k { - add(&mut m, &k); + add(&mut m, &mut seen, &k); } } for k in strs("addKeywords").unwrap_or_default() { - add(&mut m, &k); + add(&mut m, &mut seen, &k); } - for k in strs("removeKeywords").unwrap_or_default() { - let k = clean(&k); - m.keywords.retain(|x| !same(&clean(x), &k)); + let removed: std::collections::HashSet = + strs("removeKeywords").unwrap_or_default().iter().map(|k| clean(k).to_lowercase()).collect(); + if !removed.is_empty() { + m.keywords.retain(|x| !removed.contains(&clean(x).to_lowercase())); } ops.push(Op::SetMeta { id, meta: Box::new(m) }); } diff --git a/crates/engine/src/import/commit.rs b/crates/engine/src/import/commit.rs index a731488a00..df7cfe418a 100644 --- a/crates/engine/src/import/commit.rs +++ b/crates/engine/src/import/commit.rs @@ -9,6 +9,10 @@ use super::{HashMap, Op, Path, PathBuf, Photo, PhotoId, ProbeInfo, Session, Sour pub(super) struct Plan { pub(super) slots: Vec, pub(super) transfers: Vec, + /// The content hashes and name families of [`Plan::transfers`], so each new file is checked against them in + /// constant time rather than by scanning the pending transfers. + pub(super) pending_hashes: std::collections::HashSet, + pub(super) pending_families: std::collections::HashSet<(String, String)>, } pub(super) enum Slot { @@ -26,9 +30,6 @@ pub(super) struct Transfer { pub(super) how: How, /// Copy as DNG. pub(super) dng: bool, - /// The folder (lowercase) and [`name_family`]: transfers of one family can take each other's - /// names, so they never run at the same time. - pub(super) family: (String, String), } pub(super) enum How { diff --git a/crates/engine/src/import/job.rs b/crates/engine/src/import/job.rs index 3269edb02a..8846738fe9 100644 --- a/crates/engine/src/import/job.rs +++ b/crates/engine/src/import/job.rs @@ -329,7 +329,7 @@ impl ImportJob { // a copy of a file whose transfer is still pending: a duplicate only if that one succeeds if !opts.local && let Some(h) = &info.content_hash - && plan.transfers.iter().any(|t| t.info.content_hash.as_ref() == Some(h)) + && plan.pending_hashes.contains(h) { self.run_plan(&mut plan, &mut out, cancel); if cancel.load(Relaxed) { @@ -403,7 +403,7 @@ impl ImportJob { // into the same folder ends up with: that one goes first let as_named = name.as_deref().unwrap_or(if own.is_empty() { "photo" } else { own.as_str() }); let family = (dir.to_string_lossy().to_lowercase(), name_family(as_named)); - if plan.transfers.iter().any(|t| t.family == family) { + if plan.pending_families.contains(&family) { self.run_plan(&mut plan, &mut out, cancel); if cancel.load(Relaxed) { break; @@ -421,7 +421,10 @@ impl ImportJob { // Copy as DNG: the copied raw becomes a DNG (the copy is ours to replace) let dng = opts.convert_dng && mode == ImportMode::Copy && raw && !info.format.eq_ignore_ascii_case("DNG"); plan.slots.push(Slot::Transfer); - plan.transfers.push(Transfer { path, info, sidecar, dir, how, dng, family }); + // (transfers of one folder and name family can take each other's names, so they never run together) + plan.pending_families.insert(family); + plan.pending_hashes.extend(info.content_hash.clone()); + plan.transfers.push(Transfer { path, info, sidecar, dir, how, dng }); continue; } (ImportMode::Move, _) => { @@ -444,6 +447,8 @@ impl ImportJob { /// Run the transfers `plan` collected (on several threads) and append its items to `out` in /// file order. Transfers not started because `cancel` was set leave no item. fn run_plan(&mut self, plan: &mut Plan, out: &mut Prepared, cancel: &std::sync::atomic::AtomicBool) { + plan.pending_hashes.clear(); + plan.pending_families.clear(); let mut done = run_transfers(std::mem::take(&mut plan.transfers), self.file_bytes.as_ref(), cancel, &self.done).into_iter(); for slot in std::mem::take(&mut plan.slots) { let item = match slot { diff --git a/crates/engine/src/rename/plan.rs b/crates/engine/src/rename/plan.rs index 4c9620bf13..924fc9a95e 100644 --- a/crates/engine/src/rename/plan.rs +++ b/crates/engine/src/rename/plan.rs @@ -27,7 +27,7 @@ pub fn plan_rename_photos(photos: &[std::sync::Arc], template: &str, star /// Plan renaming `photos`: `exists` says whether something answers to a path, `same_file` whether /// two spellings name one file (see [`MoveFs`]). -fn plan_rename_core( +pub(super) fn plan_rename_core( photos: &[std::sync::Arc], template: &str, start: usize, @@ -35,6 +35,9 @@ fn plan_rename_core( same_file: &dyn Fn(&Path, &Path) -> bool, ) -> Vec { let mut taken: HashSet = HashSet::new(); // lower-case target paths/names claimed in this batch + // Per first-choice target: how many leading suffixes are all claimed in this batch (`taken` only grows), so the + // next photo with the same first choice starts after them instead of rebuilding each one. + let mut claimed_prefix: std::collections::HashMap = std::collections::HashMap::new(); let mut out = Vec::new(); for (i, p) in photos.iter().enumerate() { let seq = start.saturating_add(i); @@ -53,7 +56,9 @@ fn plan_rename_core( let (to, to_path) = match &p.source { Source::File { path } => { let dir = Path::new(path).parent().map(Path::to_path_buf).unwrap_or_default(); - let mut k = 0; + let base = folded_path(&dir.join(&want).to_string_lossy()); + let mut k = claimed_prefix.get(&base).copied().unwrap_or(0); + let mut all_taken = true; loop { let name = candidate(k); let tp = dir.join(&name).to_string_lossy().to_string(); @@ -64,18 +69,25 @@ fn plan_rename_core( let same = from == to || (key == folded_path(path) && exists(to) && same_file(from, to)); // free: not claimed in this batch and not on disk (unless it is this very file). // A file this batch moves away still counts as taken: simple and safe. - if !taken.contains(&key) && (same || !exists(to)) { + let claimed = taken.contains(&key); + if !claimed && (same || !exists(to)) { taken.insert(key); + if all_taken { + claimed_prefix.insert(base, k + 1); + } break (name, Some(tp)); } + all_taken &= claimed; k += 1; } } Source::Demo { .. } => { - let mut k = 0; + let base = format!("demo:{}", want.to_lowercase()); + let mut k = claimed_prefix.get(&base).copied().unwrap_or(0); loop { let name = candidate(k); if taken.insert(format!("demo:{}", name.to_lowercase())) { + claimed_prefix.insert(base, k + 1); // (every candidate before it was claimed: nothing but `taken` rejects a demo name) break (name, None); } k += 1; diff --git a/crates/engine/src/rename/tests.rs b/crates/engine/src/rename/tests.rs index d8ef8de10d..fcad01d274 100644 --- a/crates/engine/src/rename/tests.rs +++ b/crates/engine/src/rename/tests.rs @@ -588,3 +588,37 @@ fn number_folder_and_metadata_tokens() { // a bare {seq} is padded to the caller's width assert_eq!(expand_tokens("{seq}|{seq:2}", &p, 7, 3), "007|07"); } + +/// Many photos wanting one name take its suffixes in order without each starting over at the bare name. +#[test] +fn photos_sharing_a_target_name_do_not_rescan_the_suffixes_already_claimed() { + let photos: Vec> = (0..300) + .map(|i| { + std::sync::Arc::new(Photo::new( + PhotoId(i + 1), + Source::File { path: format!("/lib/src{i}.jpg") }, + &format!("src{i}.jpg"), + "JPEG", + 0, + 0, + "2024-01-01T00:00:00Z", + )) + }) + .collect(); + let checks = std::cell::Cell::new(0usize); + let plans = plan::plan_rename_core( + &photos, + "same", + 1, + &|_| { + checks.set(checks.get() + 1); + false + }, + &|_, _| false, + ); + let mut names: Vec<&str> = plans.iter().map(|p| p.to.as_str()).collect(); + names.sort_unstable(); + names.dedup(); + assert_eq!(names.len(), 300); + assert!(checks.get() <= 3 * 300, "{} disk checks", checks.get()); +} diff --git a/crates/engine/src/sync.rs b/crates/engine/src/sync.rs index 3e69a074e9..9bbbcbec18 100644 --- a/crates/engine/src/sync.rs +++ b/crates/engine/src/sync.rs @@ -334,8 +334,9 @@ fn match_moved( ) -> HashMap { // distinct missing files (a photo's virtual copies share its file), with what is known of them let mut files: Vec<(&str, Option<&Photo>)> = Vec::new(); + let mut seen_paths: std::collections::HashSet<&str> = std::collections::HashSet::new(); for m in missing { - if !files.iter().any(|(p, _)| *p == m.path) { + if seen_paths.insert(m.path.as_str()) { files.push((m.path.as_str(), labels.photo(PhotoId(m.id)).map(|p| &**p))); } } @@ -363,7 +364,8 @@ fn match_moved( } } let mut found: HashMap<(u64, u32, u32), Vec<&str>> = HashMap::new(); - for c in candidates.iter().filter(usable).filter(|c| !moved.values().any(|to| *to == c.path)) { + let taken: std::collections::HashSet<&str> = moved.values().map(String::as_str).collect(); + for c in candidates.iter().filter(usable).filter(|c| !taken.contains(c.path.as_str())) { if let Some(k) = key(c.file_size, c.width, c.height) { found.entry(k).or_default().push(c.path.as_str()); } diff --git a/crates/faces/src/matching.rs b/crates/faces/src/matching.rs index d4f1e5484d..f052cb4443 100644 --- a/crates/faces/src/matching.rs +++ b/crates/faces/src/matching.rs @@ -54,12 +54,16 @@ fn dot(a: &[f32], b: &[f32]) -> f32 { /// best first. Names are compared case-insensitively and shown as first seen. pub fn rank(query: &[f32], gallery: &[(&str, &[f32])]) -> Vec { let mut people: Vec<(String, String, Vec)> = Vec::new(); // (key, shown name, similarities) + let mut at: std::collections::HashMap = std::collections::HashMap::new(); // key -> index in `people` for (name, emb) in gallery { let Some(c) = cosine(query, emb) else { continue }; let key = name.to_lowercase(); - match people.iter_mut().find(|p| p.0 == key) { + match at.get(&key).and_then(|&i| people.get_mut(i)) { Some(p) => p.2.push(c), - None => people.push((key, (*name).to_string(), vec![c])), + None => { + at.insert(key.clone(), people.len()); + people.push((key, (*name).to_string(), vec![c])); + } } } let mut out: Vec = people From b2c1d7064a85bea3dbc57aae23f509252b08b2b1 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 3 Nov 2026 17:48:25 -0500 Subject: [PATCH 31/41] security(geocode): bound dataset reads, per-line fields, and the inflate error text (#3718) --- crates/geocode/src/lib.rs | 31 +++++++++++++++++++++++++++++-- crates/geocode/src/unzip.rs | 2 +- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/crates/geocode/src/lib.rs b/crates/geocode/src/lib.rs index de0bea5c90..9346e13089 100644 --- a/crates/geocode/src/lib.rs +++ b/crates/geocode/src/lib.rs @@ -102,6 +102,24 @@ pub struct GeoNames { countries: HashMap, } +/// Most bytes of one dump file read into memory (the extracted `cities*.txt` is far below this). +const MAX_FILE_BYTES: u64 = 256 << 20; + +/// A regular file's text, at most [`MAX_FILE_BYTES`] of it (the opened file is checked, never its pathname). +fn read_text(path: &Path) -> std::io::Result { + use std::io::Read; + let file = std::fs::File::open(path)?; + if !file.metadata()?.is_file() { + return Err(std::io::Error::new(std::io::ErrorKind::InvalidInput, "not a regular file")); + } + let mut bytes = Vec::new(); + file.take(MAX_FILE_BYTES + 1).read_to_end(&mut bytes)?; + if bytes.len() as u64 > MAX_FILE_BYTES { + return Err(std::io::Error::new(std::io::ErrorKind::InvalidData, "file too large")); + } + Ok(String::from_utf8_lossy(&bytes).into_owned()) +} + fn cell(p: LatLon) -> (i32, i32) { // valid positions only: |lat| ≤ 90, |lon| ≤ 180, so the casts are in range // longitude 180 is the same meridian as -180: key it as column -180, the wrap `reverse` probes @@ -121,7 +139,8 @@ impl GeoNames { if g.cities.len() >= MAX_PLACES { break; } - let f: Vec<&str> = line.split('\t').collect(); + // only the first 11 columns are used: a line of tabs must not build a field for each + let f: Vec<&str> = line.split('\t').take(11).collect(); // columns: 1 name, 4 latitude, 5 longitude, 8 country code, 10 admin1 code let (Some(name), Some(lat), Some(lon), Some(cc)) = (f.get(1), f.get(4), f.get(5), f.get(8)) else { continue }; let (Ok(lat), Ok(lon)) = (lat.trim().parse::(), lon.trim().parse::()) else { continue }; @@ -152,7 +171,7 @@ impl GeoNames { /// Load from a folder holding [`GEONAMES_FILES`] (the last two are optional: without them /// states stay blank and countries are ISO codes). pub fn load(dir: &Path) -> Result { - let read = |n: &str| std::fs::read(dir.join(n)).map(|b| String::from_utf8_lossy(&b).into_owned()); + let read = |n: &str| read_text(&dir.join(n)); let cities = read(GEONAMES_FILES[0]).map_err(|e| GeocodeError::Missing(format!("the place names aren't downloaded ({e})")))?; let g = GeoNames::parse(&cities, read(GEONAMES_FILES[1]).ok().as_deref(), read(GEONAMES_FILES[2]).ok().as_deref()); if g.is_empty() { @@ -262,6 +281,14 @@ mod tests { } } + #[test] + fn a_line_of_tabs_and_a_non_regular_file_are_handled() { + assert!(GeoNames::parse(&"\t".repeat(100_000), None, None).is_empty()); + assert!(read_text(&std::env::temp_dir()).is_err()); + #[cfg(unix)] + assert!(read_text(Path::new("/dev/zero")).is_err()); + } + #[test] fn high_latitude_cities_two_cells_away() { let city = |lat: f64, lon: f64| GeoNames::parse(&format!("1\tX\tX\t\t{lat}\t{lon}\tP\tP\tNO\t\t\n"), None, None); diff --git a/crates/geocode/src/unzip.rs b/crates/geocode/src/unzip.rs index d422297a7f..49d86bafde 100644 --- a/crates/geocode/src/unzip.rs +++ b/crates/geocode/src/unzip.rs @@ -62,7 +62,7 @@ pub fn extract(zip: &[u8], name: &str, max: usize) -> Result, GeocodeErr 0 if data.len() <= max => Ok(data.to_vec()), 0 => Err(GeocodeError::Invalid(format!("{name} is larger than {max} bytes"))), 8 => { - let decoded = miniz_oxide::inflate::decompress_to_vec_with_limit(data, max).map_err(|e| bad(&format!("deflate: {e:?}")))?; + let decoded = miniz_oxide::inflate::decompress_to_vec_with_limit(data, max).map_err(|e| bad(&format!("deflate: {:?}", e.status)))?; if decoded.len() != usize_ { return Err(bad("uncompressed size")); } From 5c96a70058ea67ace1d27a89d54bd5b9996f6e30 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 3 Nov 2026 17:48:44 -0500 Subject: [PATCH 32/41] security(logging): a log message cannot begin a record of its own (#3720) --- apps/lightcraft/src/logging.rs | 14 +++++++++++++- apps/lightcraft/src/logging/tests.rs | 8 ++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/apps/lightcraft/src/logging.rs b/apps/lightcraft/src/logging.rs index dd174972de..70d06a8c48 100644 --- a/apps/lightcraft/src/logging.rs +++ b/apps/lightcraft/src/logging.rs @@ -167,7 +167,19 @@ pub fn rotate(dir: &Path) -> std::io::Result<(PathBuf, File)> { /// One formatted log line: ` [] : \n`. pub fn format_line(ts: &str, level: log::Level, thread: &str, target: &str, message: &str) -> String { let message = message.strip_suffix('\n').unwrap_or(message); - format!("{ts} {level:<5} [{thread}] {target}: {message}\n") + // A message can carry text from files and peers (a file name, a rejected value): it must not be able to start a + // record of its own. Later lines of a multi-line message (a panic report) are indented, so none begins like a + // record; other control characters (a bare CR, an escape sequence) are shown escaped. + let mut safe = String::with_capacity(message.len()); + for c in message.chars() { + match c { + '\n' => safe.push_str("\n "), + '\t' => safe.push(c), + c if c.is_control() => safe.extend(c.escape_default()), + c => safe.push(c), + } + } + format!("{ts} {level:<5} [{thread}] {target}: {safe}\n") } /// Where formatted lines go besides standard error: kept in memory until a file is attached, diff --git a/apps/lightcraft/src/logging/tests.rs b/apps/lightcraft/src/logging/tests.rs index b801c7d75d..c96707d824 100644 --- a/apps/lightcraft/src/logging/tests.rs +++ b/apps/lightcraft/src/logging/tests.rs @@ -167,7 +167,11 @@ fn a_line_carries_time_level_thread_target_and_message() { "2026-10-08T07:59:17.728Z INFO [main] lightcraft: library /photos: 12 photos\n" ); // A multi-line message keeps its lines; the record still ends in one newline. - assert!(format_line("t", log::Level::Error, "w", "x", "a\nb\n").ends_with("x: a\nb\n")); + // later lines are indented and control characters escaped, so a message cannot forge a record + assert!(format_line("t", log::Level::Error, "w", "x", "a\nb\n").ends_with("x: a\n b\n")); + let forged = format_line("t", log::Level::Info, "w", "x", "name\r\n2026-01-01T00:00:00Z ERROR [main] x: fake\u{1b}[2J"); + assert!(forged.lines().skip(1).all(|l| l.starts_with(' ')), "{forged:?}"); + assert!(!forged.contains('\r') && !forged.contains('\u{1b}'), "{forged:?}"); } #[test] @@ -357,7 +361,7 @@ fn a_panic_report_goes_to_the_file_and_never_deadlocks() { logger.record_panic("main", "while the sink is held"); } let text = read(&path); - assert!(text.contains(" ERROR [render] lightcraft: panicked at crates/x/src/lib.rs:3:5:\nboom\n"), "{text}"); + assert!(text.contains(" ERROR [render] lightcraft: panicked at crates/x/src/lib.rs:3:5:\n boom\n"), "{text}"); assert!(!text.contains("while the sink is held"), "{text}"); let _ = std::fs::remove_dir_all(&dir); } From 03e03f382ed740b753111f125fe32c83d554a36b Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 3 Nov 2026 17:49:04 -0500 Subject: [PATCH 33/41] security(tests): test fixture directories are created exclusively, never reused from a predictable name (#3721) --- crates/engine/src/denoise/gpu_tests.rs | 3 ++- crates/gpu/src/backend.rs | 8 ++++++++ xtask/src/ci_report.rs | 3 ++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/crates/engine/src/denoise/gpu_tests.rs b/crates/engine/src/denoise/gpu_tests.rs index bb80cecdad..bff11cc20c 100644 --- a/crates/engine/src/denoise/gpu_tests.rs +++ b/crates/engine/src/denoise/gpu_tests.rs @@ -5,7 +5,8 @@ use lightcraft_denoise::manifest::{Domain, Gain}; fn folder(name: &str) -> PathBuf { let dir = std::env::temp_dir().join(format!("lc-engine-gpu-{}-{name}", std::process::id())); let _ = std::fs::remove_dir_all(&dir); - std::fs::create_dir_all(&dir).unwrap(); + // exclusive: a directory planted at this predictable name fails the test instead of receiving its files + std::fs::create_dir(&dir).unwrap(); dir } diff --git a/crates/gpu/src/backend.rs b/crates/gpu/src/backend.rs index d970003e73..8d8456a265 100644 --- a/crates/gpu/src/backend.rs +++ b/crates/gpu/src/backend.rs @@ -427,6 +427,8 @@ mod tests { let dir = std::env::temp_dir().join(format!("lc-gpu-marker-{}", std::process::id())); let m = dir.join("gpu-init.marker"); let _ = std::fs::remove_dir_all(&dir); + // exclusive: a directory planted at this predictable name fails the test instead of receiving the marker + std::fs::create_dir(&dir).unwrap(); // a local scope counter: other tests create real devices through the process-wide one let active = Mutex::new(0); let seen = with_marker_on(Some(m.clone()), &active, "device creation", || m.exists()); @@ -447,6 +449,8 @@ mod tests { let dir = std::env::temp_dir().join(format!("lc-gpu-global-{}", std::process::id())); let m = dir.join("gpu-init.marker"); let _ = std::fs::remove_dir_all(&dir); + // exclusive: a directory planted at this predictable name fails the test instead of receiving the marker + std::fs::create_dir(&dir).unwrap(); set_init_marker(Some(m.clone())); let seen = with_init_marker(Backends::DX12, || m.exists()); set_init_marker(None); @@ -501,6 +505,8 @@ mod tests { let dir = std::env::temp_dir().join(format!("lc-gpu-scopes-{}", std::process::id())); let m = dir.join("gpu-init.marker"); let _ = std::fs::remove_dir_all(&dir); + // exclusive: a directory planted at this predictable name fails the test instead of receiving the marker + std::fs::create_dir(&dir).unwrap(); let active = Mutex::new(0); arm(&m, &active, "device creation"); assert!(read_init_marker(&m).unwrap().contains("device creation")); @@ -524,6 +530,8 @@ mod tests { let dir = std::env::temp_dir().join(format!("lc-gpu-panic-{}", std::process::id())); let m = dir.join("gpu-init.marker"); let _ = std::fs::remove_dir_all(&dir); + // exclusive: a directory planted at this predictable name fails the test instead of receiving the marker + std::fs::create_dir(&dir).unwrap(); let active = Mutex::new(0); let r = std::panic::catch_unwind(|| with_marker_on(Some(m.clone()), &active, "kernel compilation", || panic!("compile"))); assert!(r.is_err()); diff --git a/xtask/src/ci_report.rs b/xtask/src/ci_report.rs index 8be686ef11..ec5da20f3b 100644 --- a/xtask/src/ci_report.rs +++ b/xtask/src/ci_report.rs @@ -505,7 +505,8 @@ mod tests { fn tmp(name: &str) -> PathBuf { let d = std::env::temp_dir().join(format!("xtask-ci-report-{name}-{}", std::process::id())); let _ = std::fs::remove_dir_all(&d); - std::fs::create_dir_all(&d).unwrap(); + // exclusive: a directory planted at this predictable name fails the test instead of receiving its files + std::fs::create_dir(&d).unwrap(); d } From b0c4aa8cc8acac043af6d767b3bfec30d0ab0c0a Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 3 Nov 2026 22:32:53 -0500 Subject: [PATCH 34/41] security(raw): linear sparse planning, distinct-byte allocation bound, opcode list budget, ORF strip length (#3679) * security(raw): linear sparse planning, distinct-byte allocation bound, opcode list budget, ORF strip length * address review: zero opcode cost for no-op ops, compact the sparse plan buffer --- crates/raw/src/opcodes.rs | 37 +++++++++++++++++++ crates/raw/src/opcodes/tests.rs | 27 ++++++++++++++ crates/raw/src/sparse.rs | 65 ++++++++++++++++++++++++++------- crates/raw/src/tiffraw.rs | 40 +++++++++++++++++++- crates/raw/src/vendor/orf.rs | 5 +++ 5 files changed, 158 insertions(+), 16 deletions(-) diff --git a/crates/raw/src/opcodes.rs b/crates/raw/src/opcodes.rs index 4d3e463b0e..2f5d51fae0 100644 --- a/crates/raw/src/opcodes.rs +++ b/crates/raw/src/opcodes.rs @@ -566,8 +566,45 @@ const MAX_BAD_PIXELS: usize = 1 << 22; /// Apply a list to an interleaved `w × h × cpp` buffer. `cfa` (when the data is a mosaic) is used by the /// bad-pixel opcodes. `scale` is the value of 1.0 in the buffer: 65535 for list 1 (raw 16-bit values), 1 for /// lists 2 and 3 (normalised values). +/// Whole-image passes one opcode list may cost, all its ops together (a real DNG's list is a +/// handful of gain maps and tables). Ops past it, in list order, are left out: a list repeating a +/// full-image polynomial thousands of times was billions of evaluations on an ordinary raw. +const MAX_LIST_PASSES: usize = 32; + +/// Sample visits `op` costs on a `w × h × cpp` buffer (coefficient evaluations for a polynomial). +fn op_cost(op: &Opcode, w: usize, h: usize, cpp: usize) -> usize { + let visits = |a: &Area| { + let rows = (a.bottom as usize).min(h).saturating_sub(a.top as usize).div_ceil(a.row_pitch.max(1) as usize); + let cols = (a.right as usize).min(w).saturating_sub(a.left as usize).div_ceil(a.col_pitch.max(1) as usize); + let planes = (a.plane as usize).saturating_add(a.planes.max(1) as usize).min(cpp).saturating_sub(a.plane as usize); + rows.saturating_mul(cols).saturating_mul(planes) + }; + match op { + Opcode::MapPolynomial { area, coefficients } => visits(area).saturating_mul(coefficients.len().max(1)), + Opcode::MapTable { area, .. } + | Opcode::GainMap { area, .. } + | Opcode::DeltaPerRow { area, .. } + | Opcode::DeltaPerColumn { area, .. } + | Opcode::ScalePerRow { area, .. } + | Opcode::ScalePerColumn { area, .. } => visits(area), + // `apply_list` does nothing for these, so they spend none of the budget + Opcode::Unknown { .. } + | Opcode::TrimBounds { .. } + | Opcode::WarpFisheye { .. } + | Opcode::WarpRectilinear { .. } + | Opcode::WarpRectilinear2 { .. } => 0, + _ => w.saturating_mul(h).saturating_mul(cpp), + } +} + pub fn apply_list(list: &[Opcode], buf: &mut [f32], w: usize, h: usize, cpp: usize, cfa: Option<&Cfa>, scale: f32) { + let mut budget = w.saturating_mul(h).saturating_mul(cpp).max(1).saturating_mul(MAX_LIST_PASSES); for op in list { + let cost = op_cost(op, w, h, cpp); + if cost > budget { + continue; + } + budget -= cost; match op { Opcode::MapTable { area, table } => { let n = table.len(); diff --git a/crates/raw/src/opcodes/tests.rs b/crates/raw/src/opcodes/tests.rs index d1be999e98..48840ff23a 100644 --- a/crates/raw/src/opcodes/tests.rs +++ b/crates/raw/src/opcodes/tests.rs @@ -456,3 +456,30 @@ fn cropped_lens_corrections_correct_the_crop_like_the_whole() { assert!(warps[0].cropped(w, h, crate::Rect::new(30, 0, 70, 50)).is_none()); assert!(warps[0].cropped(w, h, crate::Rect::new(usize::MAX, 0, 70, 50)).is_none()); } + +/// Ten thousand full-image polynomials (a few hundred KB of opcode data): the list is held to +/// `MAX_LIST_PASSES` passes of work, the first ones applied and the rest left out. +#[test] +fn a_list_repeating_full_image_work_stops_at_its_budget() { + let (w, h) = (64usize, 48usize); + let a = Area { top: 0, left: 0, bottom: h as u32, right: w as u32, plane: 0, planes: 1, row_pitch: 1, col_pitch: 1 }; + // v + 0.001 each, two coefficients: each costs two passes + let list = vec![Opcode::MapPolynomial { area: a, coefficients: vec![0.001, 1.0] }; 10_000]; + let mut buf = vec![0.0f32; w * h]; + apply_list(&list, &mut buf, w, h, 1, None, 1.0); + let applied = (buf[0] / 0.001).round() as usize; + assert_eq!(applied, MAX_LIST_PASSES / 2, "{}", buf[0]); + assert!(buf.iter().all(|v| *v == buf[0])); +} + +/// Opcodes `apply_list` does nothing for spend none of the budget: a later real one still runs. +#[test] +fn ops_that_apply_nothing_cost_no_budget() { + let (w, h) = (8usize, 8usize); + let a = Area { top: 0, left: 0, bottom: h as u32, right: w as u32, plane: 0, planes: 1, row_pitch: 1, col_pitch: 1 }; + let mut list = vec![Opcode::Unknown { id: 9999, flags: 0, params: Vec::new() }; 4 * MAX_LIST_PASSES]; + list.push(Opcode::MapPolynomial { area: a, coefficients: vec![0.5, 1.0] }); + let mut buf = vec![0.0f32; w * h]; + apply_list(&list, &mut buf, w, h, 1, None, 1.0); + assert_eq!(buf[0], 0.5); +} diff --git a/crates/raw/src/sparse.rs b/crates/raw/src/sparse.rs index 8a404a25ea..893ba79b20 100644 --- a/crates/raw/src/sparse.rs +++ b/crates/raw/src/sparse.rs @@ -121,7 +121,8 @@ impl Ranges { /// The parts of `[start, end)` not covered. pub fn gaps(&self, start: u64, end: u64) -> Ranges { - let mut out = Ranges::new(); + // the gaps come in order, apart from each other: pushed, not merged in one by one + let mut out = Vec::new(); let mut at = start; for &(a, b) in &self.0 { if b <= at { @@ -131,24 +132,20 @@ impl Ranges { break; } if a > at { - out.insert(at, a); + out.push((at, a)); } at = at.max(b); } if at < end { - out.insert(at, end); + out.push((at, end)); } - out + Ranges(out) } /// These ranges without the ones in `other`. pub fn minus(&self, other: &Ranges) -> Ranges { let mut out = Ranges::new(); - for &(a, b) in &self.0 { - for &(x, y) in other.gaps(a, b).spans() { - out.insert(x, y); - } - } + out.extend(self.0.iter().flat_map(|&(a, b)| other.gaps(a, b).0)); out } } @@ -201,12 +198,17 @@ fn plan(bytes: &[u8], loaded: &Ranges, preview: bool) -> HeaderPlan { struct Want<'a> { len: u64, loaded: &'a Ranges, - need: Ranges, + /// What is missing, as found; merged once into the plan (merging each find into the ranges so + /// far was a copy of them per find: quadratic over a file of many out-of-line values). + need: Vec<(u64, u64)>, + /// `need` is merged when it reaches this long, so repeated finds of one gap stay bounded by + /// the distinct gaps (merging when it doubles keeps the cost linear). + compact_at: usize, } impl<'a> Want<'a> { fn new(bytes: &[u8], loaded: &'a Ranges) -> Self { - Self { len: bytes.len() as u64, loaded, need: Ranges::new() } + Self { len: bytes.len() as u64, loaded, need: Vec::new(), compact_at: 64 } } /// Whether `[start, end)` (clipped to the file) is loaded; asks for what isn't. @@ -215,15 +217,21 @@ impl<'a> Want<'a> { if self.loaded.contains(start, end) { return true; } - for &(a, b) in self.loaded.gaps(start, end).spans() { - self.need.insert(a, b); + self.need.extend(self.loaded.gaps(start, end).0); + if self.need.len() >= self.compact_at { + let mut merged = Ranges::new(); + merged.extend(std::mem::take(&mut self.need)); + self.need = merged.spans().to_vec(); + self.compact_at = (self.need.len() * 2).max(64); } false } /// `Need` when something is missing. fn into_plan(self) -> Option { - (!self.need.is_empty()).then_some(HeaderPlan::Need(self.need)) + let mut need = Ranges::new(); + need.extend(self.need); + (!need.is_empty()).then_some(HeaderPlan::Need(need)) } } @@ -559,6 +567,35 @@ mod tests { assert_eq!(r.total(), 20); } + #[test] + fn a_plan_of_many_missing_values_is_gathered_in_one_merge() { + // 200 000 loaded spans with a byte missing between each: every gap wanted once + let mut loaded = Ranges::new(); + loaded.extend((0..20_000u64).map(|i| (i * 4, i * 4 + 3))); + let bytes = vec![0u8; 80_000]; + let mut w = Want::new(&bytes, &loaded); + for i in 0..20_000u64 { + assert!(!w.want(i * 4 + 2, i * 4 + 4)); + } + let Some(HeaderPlan::Need(need)) = w.into_plan() else { panic!("a plan") }; + assert_eq!(need.spans().len(), 20_000); + assert_eq!(need.total(), 20_000); + assert_eq!(loaded.gaps(0, 12).spans(), &[(3, 4), (7, 8), (11, 12)]); + } + + #[test] + fn repeated_wants_of_one_gap_keep_the_buffer_bounded() { + let loaded = Ranges::new(); + let bytes = vec![0u8; 1000]; + let mut w = Want::new(&bytes, &loaded); + for _ in 0..100_000 { + assert!(!w.want(10, 20)); + assert!(w.need.len() <= 64); + } + let Some(HeaderPlan::Need(need)) = w.into_plan() else { panic!("a plan") }; + assert_eq!(need.spans(), &[(10, 20)]); + } + #[test] fn hostile_input_never_panics_and_ends() { let mut loaded = Ranges::new(); diff --git a/crates/raw/src/tiffraw.rs b/crates/raw/src/tiffraw.rs index 75186d2d3b..deb64ea595 100644 --- a/crates/raw/src/tiffraw.rs +++ b/crates/raw/src/tiffraw.rs @@ -63,8 +63,20 @@ pub fn check_image(data: &[u8], info: &ImageInfo) -> Result { return Err(RawError::Limit("image data chunks far larger than the image")); } // Plausibility bound before allocating: no supported coding stores more than ~2000 samples per byte - // (Deflate of constant data is the extreme), so tiny files cannot trigger huge allocations. - let available: u64 = chunks.iter().map(|c| chunk_bytes(data, c).map_or(0, |s| s.len() as u64)).sum(); + // (Deflate of constant data is the extreme), so tiny files cannot trigger huge allocations. The + // bytes are counted once however many chunks point at them: a grid of tiles sharing one small + // payload holds that payload's samples, not the grid's. + let mut spans: Vec<(u64, u64)> = + chunks.iter().filter_map(|c| Some((c.offset, c.offset.checked_add(chunk_bytes(data, c)?.len() as u64)?))).collect(); + spans.sort_unstable(); + let (mut available, mut end) = (0u64, 0u64); + for (a, b) in spans { + let a = a.max(end); + if b > a { + available = available.saturating_add(b - a); + end = b; + } + } if available.saturating_mul(2048) < total as u64 { return Err(RawError::Corrupt(format!("{available} bytes of image data cannot hold {total} samples"))); } @@ -429,6 +441,30 @@ mod lossy_tests { use super::*; use lightcraft_tiff::image::Layout; + /// 65 536 tiles all pointing at the same 256 bytes: the image's samples can't come from them, + /// and nothing of its size is allocated to find that out. + #[test] + fn tiles_sharing_one_payload_count_its_bytes_once() { + let file = vec![0u8; 8 + 256]; + let info = ImageInfo { + width: 4096, + height: 4096, + bits_per_sample: vec![8], + samples_per_pixel: 1, + compression: comp::NONE, + photometric: 34892, + planar: 1, + predictor: 1, + sample_format: 1, + new_subfile_type: 0, + layout: Layout::Tiles { tile_width: 16, tile_height: 16 }, + offsets: vec![8; 65_536], + byte_counts: vec![256; 65_536], + }; + let err = check_image(&file, &info).unwrap_err().to_string(); + assert!(err.contains("cannot hold"), "{err}"); + } + /// A lossy-DNG-style image: two 16×8 tiles, each a baseline JPEG, the right one cut short /// by the image edge. #[test] diff --git a/crates/raw/src/vendor/orf.rs b/crates/raw/src/vendor/orf.rs index 172f83013b..ee1d1f48d2 100644 --- a/crates/raw/src/vendor/orf.rs +++ b/crates/raw/src/vendor/orf.rs @@ -230,6 +230,11 @@ pub(crate) fn decode(bytes: &[u8], mode: Mode) -> Result { (RawData::U16(d), 12) } else if total * 8 >= (n as u64) * 12 && total * 8 < (n as u64) * 13 && chunks.len() == 1 { let src = chunk_bytes(bytes, &chunks[0]).ok_or_else(|| RawError::Corrupt("ORF strip outside file".into()))?; + // the strip as it is in the file (clipped at its end), not as its tag states it: one too short + // for the samples is a truncated file, refused before they are allocated + if (src.len() as u64).saturating_mul(8) < (n as u64).saturating_mul(12) { + return Err(RawError::Corrupt("ORF strip shorter than its samples".into())); + } // the depth is fixed here, so a header-only probe needs the samples only when the file doesn't state its // colour-filter layout let d = if mode == Mode::Full || stated.is_none() { From 9eb7b25e317b6e66beb6b9c8f862da73f3de0aae Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 3 Nov 2026 22:50:49 -0500 Subject: [PATCH 35/41] security(engine): sidecar copies, backups and version checks read regular files only (#3677) * security(engine): sidecar copies, backups and version checks read regular files only * address review: open the sidecar source and check the handle is the regular file that was checked --- crates/engine/src/rename/fs.rs | 60 +++++++++++++++++++++++- crates/engine/src/sidecar.rs | 5 ++ crates/engine/src/tests/move_to_share.rs | 13 +++++ 3 files changed, 77 insertions(+), 1 deletion(-) diff --git a/crates/engine/src/rename/fs.rs b/crates/engine/src/rename/fs.rs index 71de1a7843..30b6a3e30c 100644 --- a/crates/engine/src/rename/fs.rs +++ b/crates/engine/src/rename/fs.rs @@ -46,6 +46,9 @@ pub(crate) trait MoveFs { fn packet_version(&self, path: &Path) -> std::io::Result { use std::io::Read; let mut file = std::fs::File::open(path)?; + if !file.metadata()?.is_file() { + return Err(std::io::Error::other(format!("{} is not a regular file", path.display()))); + } let mut hash = lightcraft_preview::Hasher128::new(); let mut len = 0u64; let mut buffer = [0u8; 16 * 1024]; @@ -141,8 +144,14 @@ impl MoveFs for RealFs { .map(|k| b.with_file_name(format!(".{name}.lc-partial-{}-{k}", std::process::id()))) .find(|p| !self.exists(p)) .ok_or_else(|| std::io::Error::other(format!("no free temporary name beside {}", b.display())))?; + // a sidecar found beside the photo by its name is copied only when it is a plain file: a + // link there would have its target's contents copied into a new, readable file + let checked = std::fs::symlink_metadata(a)?; + if !checked.is_file() { + return Err(std::io::Error::other(format!("{} is not a regular file", a.display()))); + } let copied = (|| { - let mut from = std::fs::File::open(a)?; + let mut from = open_regular(a, &checked)?; let mut f = std::fs::OpenOptions::new().write(true).create_new(true).open(&partial)?; std::io::copy(&mut from, &mut f)?; f.sync_all() @@ -163,6 +172,33 @@ impl MoveFs for RealFs { } } +/// Opens `a` for reading and checks the open handle is the regular file `checked` (the +/// `symlink_metadata` of `a` taken before): the path check alone can be outrun by a swap for a +/// link, whose target the open would follow. +fn open_regular(a: &Path, checked: &std::fs::Metadata) -> std::io::Result { + let mut options = std::fs::OpenOptions::new(); + options.read(true); + // FILE_FLAG_OPEN_REPARSE_POINT: a symbolic link is opened itself, and then refused below + #[cfg(windows)] + std::os::windows::fs::OpenOptionsExt::custom_flags(&mut options, 0x0020_0000); + let file = options.open(a)?; + let opened = file.metadata()?; + #[cfg(unix)] + let same = { + use std::os::unix::fs::MetadataExt; + (opened.dev(), opened.ino()) == (checked.dev(), checked.ino()) + }; + #[cfg(not(unix))] + let same = { + let _ = checked; + true + }; + if !opened.is_file() || !same { + return Err(std::io::Error::other(format!("{} is not a regular file", a.display()))); + } + Ok(file) +} + /// Move `a` to `b` on another volume: copy (never replacing), compare the copy with the original /// byte for byte, and only then remove the original. A copy that doesn't match is removed. fn move_across_volumes(fs: &RealFs, a: &Path, b: &Path) -> std::io::Result<()> { @@ -240,3 +276,25 @@ pub(super) fn move_one(fs: &dyn MoveFs, a: &Path, b: &Path) -> std::io::Result<( Err(e2) => std::io::Error::other(format!("{e}; it could not be given its old name back either ({e2}): it is now {}", tmp.display())), }) } + +#[cfg(all(test, unix))] +mod open_regular_tests { + use super::open_regular; + + #[test] + fn a_link_swapped_in_after_the_check_is_not_followed() { + let dir = std::env::temp_dir().join(format!("lightcraft-open-regular-{}", std::process::id())); + std::fs::create_dir_all(&dir).unwrap(); + let (file, other, link) = (dir.join("a.xmp"), dir.join("secret"), dir.join("link.xmp")); + std::fs::write(&file, b"x").unwrap(); + std::fs::write(&other, b"secret").unwrap(); + let checked = std::fs::symlink_metadata(&file).unwrap(); + assert!(open_regular(&file, &checked).is_ok()); + // the name now holds a link to another file: the handle is not the one checked + std::fs::remove_file(&file).unwrap(); + std::os::unix::fs::symlink(&other, &link).unwrap(); + std::fs::rename(&link, &file).unwrap(); + assert!(open_regular(&file, &checked).is_err(), "the link's target must not be opened"); + std::fs::remove_dir_all(&dir).unwrap(); + } +} diff --git a/crates/engine/src/sidecar.rs b/crates/engine/src/sidecar.rs index 9f3e518a49..252dd911a6 100644 --- a/crates/engine/src/sidecar.rs +++ b/crates/engine/src/sidecar.rs @@ -455,6 +455,11 @@ fn write_atomic(path: &Path, data: &[u8]) -> std::io::Result<()> { /// Copy `path` to a new `.bak-` (`-1`, `-2`… if taken; never overwriting). fn backup(path: &Path, stamp: &str) -> std::io::Result { use std::io::Write; + // only a plain file is copied aside: a link under the sidecar's name would have its target's + // contents copied into a new, readable file + if !std::fs::symlink_metadata(path)?.is_file() { + return Err(std::io::Error::other(format!("{} is not a regular file", path.display()))); + } let bytes = std::fs::read(path)?; let stamp: String = stamp.chars().filter(char::is_ascii_alphanumeric).collect(); let name = path.file_name().map(|n| n.to_string_lossy().to_string()).unwrap_or_default(); diff --git a/crates/engine/src/tests/move_to_share.rs b/crates/engine/src/tests/move_to_share.rs index ed824b29d8..e7602818e4 100644 --- a/crates/engine/src/tests/move_to_share.rs +++ b/crates/engine/src/tests/move_to_share.rs @@ -254,6 +254,19 @@ fn other_device(here: &std::path::Path) -> Option { } } +#[cfg(unix)] +#[test] +fn a_link_is_not_copied_as_its_target() { + use crate::rename::MoveFs; + let dir = Scratch::new("copy-link"); + std::fs::create_dir_all(dir.0.join("local")).unwrap(); + std::fs::create_dir_all(dir.0.join("share")).unwrap(); + std::fs::write(dir.0.join("local/private.txt"), b"secret").unwrap(); + std::os::unix::fs::symlink(dir.0.join("local/private.txt"), dir.0.join("local/photo.xmp")).unwrap(); + assert!(crate::rename::RealFs.copy_no_replace(&dir.0.join("local/photo.xmp"), &dir.0.join("share/photo.xmp")).is_err()); + assert!(!dir.0.join("share/photo.xmp").exists()); +} + #[test] fn the_copy_across_volumes_is_whole_or_absent_and_never_replaces() { use crate::rename::MoveFs; From 00b020cf2fa1d71c1b5e2f35ec805be0ad8e8404 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 3 Nov 2026 22:51:11 -0500 Subject: [PATCH 36/41] catalog: bound keyword list path expansion and index synonym merges (#3641) * catalog: bound keyword list path expansion and index synonym merges * address review: hold keyword list writer to the path budget the reader enforces * address review: charge the emitted parent path in the keyword list writer --- crates/catalog/src/keywords.rs | 82 ++++++++++++++++++++-------- crates/catalog/src/keywords/tests.rs | 55 +++++++++++++++++++ 2 files changed, 115 insertions(+), 22 deletions(-) diff --git a/crates/catalog/src/keywords.rs b/crates/catalog/src/keywords.rs index d36ab11cd6..5fb095767b 100644 --- a/crates/catalog/src/keywords.rs +++ b/crates/catalog/src/keywords.rs @@ -87,6 +87,12 @@ pub fn from_file(flat: &[String], hierarchical: &[String]) -> Vec { /// The deepest a keyword list file may nest keywords: a file is input, so its nesting is bounded. pub const MAX_LEVELS: usize = 64; +/// The most bytes of full keyword paths a keyword list file may spell out. Every line names its +/// keyword by its whole path (`parent|child`), so a file of one long keyword with many short ones +/// inside it would otherwise grow into far more memory than its own size (CWE-400). Lightroom +/// Classic's own lists of tens of thousands of keywords come to a few MiB. +pub const MAX_LIST_PATH_BYTES: usize = 64 << 20; // 64 MiB + /// A keyword list as written by [`Catalog::keyword_list_text`]: the file's text, the keywords in /// it (paths), and what the format can't hold and so is left out (a keyword, with those inside it, /// as its path; a synonym as `path {synonym}`). @@ -114,6 +120,8 @@ pub fn parse_keyword_list(text: &str) -> Result> { let mut synonyms: std::collections::HashMap> = std::collections::HashMap::new(); // the keyword at each level above the line: its path and where it is in `out` let mut above: Vec<(String, usize)> = Vec::new(); + // bytes of full paths spelled out so far, checked against `MAX_LIST_PATH_BYTES` before each + let mut path_bytes = 0usize; for (i, line) in text.split('\n').enumerate() { let n = i + 1; if line.trim().is_empty() { @@ -162,6 +170,11 @@ pub fn parse_keyword_list(text: &str) -> Result> { return Err(bad(n, "“|” separates a keyword's levels: a name can't hold one")); } above.truncate(depth); + let parent_len = above.last().map_or(0, |(parent, _)| parent.len().saturating_add(1)); + path_bytes = path_bytes.saturating_add(parent_len.saturating_add(name.len())); + if path_bytes > MAX_LIST_PATH_BYTES { + return Err(bad(n, &format!("the keywords' full paths come to more than {} MiB", MAX_LIST_PATH_BYTES >> 20))); + } let path = match above.last() { Some((parent, _)) => format!("{parent}{SEP}{name}"), None => name.to_string(), @@ -189,6 +202,14 @@ pub fn closest<'a>(k: &str, from: &'a [String]) -> Option<&'a String> { from.iter().filter(|f| is_under(k, f)).max_by_key(|f| f.split(SEP).count()) } +/// Add each of `more` to `synonyms` that isn't there in any case, in order. One lowered set of +/// what is there, not a search of the growing list per synonym: an imported list can give a +/// keyword many synonyms, and the search was quadratic in them (CWE-407). +fn merge_synonyms(synonyms: &mut Vec, more: impl IntoIterator) { + let mut seen: std::collections::HashSet = synonyms.iter().map(|s| s.to_lowercase()).collect(); + synonyms.extend(more.into_iter().filter(|s| seen.insert(s.to_lowercase()))); +} + /// Keep the first of case-insensitively equal keywords. fn dedupe(v: &mut Vec) { let mut seen = std::collections::HashSet::new(); @@ -402,11 +423,7 @@ impl Catalog { Some(there) => { there.info.new_keywords_inside |= l.info.new_keywords_inside; there.info.keyword_shortcut |= l.info.keyword_shortcut; - for s in l.info.synonyms { - if !there.info.synonyms.iter().any(|x| same(x, &s)) { - there.info.synonyms.push(s); - } - } + merge_synonyms(&mut there.info.synonyms, l.info.synonyms); } None => { list.insert(path.to_lowercase(), ListedKeyword { path, info: l.info }); @@ -467,8 +484,11 @@ impl Catalog { let defaults = KeywordInfo::default(); let info = |path: &str| self.keyword_info(path).unwrap_or(&defaults); let mut out = ExportKeywords::default(); - let push = |v: &mut Vec, s: &str| { - if !s.is_empty() && !v.iter().any(|x| same(x, s)) { + // what each list holds, lowered: a search of the list per name was quadratic in a keyword's + // synonyms, which an imported list sets (CWE-407) + let (mut flat_seen, mut paths_seen) = (std::collections::HashSet::new(), std::collections::HashSet::new()); + let push = |v: &mut Vec, seen: &mut std::collections::HashSet, s: &str| { + if !s.is_empty() && seen.insert(s.to_lowercase()) { v.push(s.to_string()); } }; @@ -481,11 +501,11 @@ impl Catalog { let levels: Vec<&str> = path.split(SEP).collect(); let mut names = |at: usize, i: &KeywordInfo| { if let Some(name) = levels.get(at) { - push(&mut out.flat, name); + push(&mut out.flat, &mut flat_seen, name); } if i.export_synonyms { for s in &i.synonyms { - push(&mut out.flat, s.trim()); + push(&mut out.flat, &mut flat_seen, s.trim()); } } }; @@ -499,7 +519,7 @@ impl Catalog { } } } - push(&mut out.hierarchical, &path); + push(&mut out.hierarchical, &mut paths_seen, &path); } out } @@ -509,6 +529,13 @@ impl Catalog { /// keyword, a keyword left out of export in square brackets; by name. What the format can't hold /// is left out and named, so the file always reads back. pub fn keyword_list_text(&self) -> KeywordListFile { + self.keyword_list_text_within(MAX_LIST_PATH_BYTES) + } + + /// [`keyword_list_text`](Self::keyword_list_text) with the full paths written held to + /// `max_path_bytes` as [`parse_keyword_list`] holds them: a keyword past it is named + /// unwritable, with its subtree, so the file reads back. + fn keyword_list_text_within(&self, max_path_bytes: usize) -> KeywordListFile { // a name the list would read as something else, or not at all fn unwritable(name: &str) -> bool { name.trim().is_empty() @@ -519,14 +546,27 @@ impl Catalog { || (name.starts_with('[') && name.ends_with(']')) || (name.starts_with('{') && name.ends_with('}')) } - fn write(c: &Catalog, nodes: &[KeywordNode], depth: usize, file: &mut KeywordListFile) { + fn write( + c: &Catalog, + nodes: &[KeywordNode], + depth: usize, + file: &mut KeywordListFile, + path_bytes: &mut usize, + max_path_bytes: usize, + parent_len: usize, + ) { let tabs = "\t".repeat(depth); for n in nodes { // the keywords inside go with it: under its parent they'd be other keywords - if depth >= MAX_LEVELS || unwritable(&n.name) { + // (a line's full path is what the reader counts against its path budget) + // the path the reader rebuilds from the lines written: the parent as emitted, a + // separator, the name (a child's `n.path` can spell its parent in another case) + let emitted = if depth == 0 { n.name.len() } else { parent_len + SEP.len_utf8() + n.name.len() }; + if depth >= MAX_LEVELS || unwritable(&n.name) || path_bytes.saturating_add(emitted) > max_path_bytes { file.unwritable.push(n.path.clone()); continue; } + *path_bytes += emitted; let info = c.keyword_info(&n.path).cloned().unwrap_or_default(); if info.include_on_export { file.text.push_str(&format!("{tabs}{}\n", n.name)); @@ -536,19 +576,21 @@ impl Catalog { file.written.push(n.path.clone()); // the reader trims synonyms and takes one per spelling: an empty one, or another's // in a different case, is no loss; a line break or a “|” is - let mut synonyms: Vec<&str> = Vec::new(); + // (one lowered set, not a search of those written so far per synonym: quadratic + // in a keyword's synonyms, which an imported list sets — CWE-407) + let mut synonyms: std::collections::HashSet = std::collections::HashSet::new(); for s in info.synonyms.iter().map(|s| s.trim()) { - if s.is_empty() || synonyms.iter().any(|x| same(x, s)) { + if s.is_empty() || synonyms.contains(&s.to_lowercase()) { continue; } if s.chars().any(char::is_control) || s.contains(SEP) { file.unwritable.push(format!("{} {{{s}}}", n.path)); } else { - synonyms.push(s); + synonyms.insert(s.to_lowercase()); file.text.push_str(&format!("{tabs}\t{{{s}}}\n")); } } - write(c, &n.children, depth + 1, file); + write(c, &n.children, depth + 1, file, path_bytes, max_path_bytes, emitted); } } let mut file = KeywordListFile::default(); @@ -568,7 +610,7 @@ impl Catalog { } } } - write(self, &self.keyword_tree(), 0, &mut file); + write(self, &self.keyword_tree(), 0, &mut file, &mut 0, max_path_bytes, 0); file.unwritable.extend(over_deep); file } @@ -632,11 +674,7 @@ impl Catalog { // one the library has: the list's synonyms join its own (listed only if it gains some) let mut info_now = list.get(&key).map(|l| l.info.clone()).unwrap_or_default(); let before = info_now.synonyms.len(); - for s in &info.synonyms { - if !info_now.synonyms.iter().any(|x| same(x, s)) { - info_now.synonyms.push(s.clone()); - } - } + merge_synonyms(&mut info_now.synonyms, info.synonyms.iter().cloned()); if info_now.synonyms.len() > before { let path = list.get(&key).map_or(path, |l| l.path.clone()); list.insert(key, ListedKeyword { path, info: info_now }); diff --git a/crates/catalog/src/keywords/tests.rs b/crates/catalog/src/keywords/tests.rs index 6f50bd482e..6b9e505c0f 100644 --- a/crates/catalog/src/keywords/tests.rs +++ b/crates/catalog/src/keywords/tests.rs @@ -556,6 +556,17 @@ fn the_keyword_list_is_written_as_tab_indented_text() { assert_eq!(c.keyword_list_text().text, "beach\nEvents\n\tWeddings\n[Places]\n\tLisbon\n\t\t{Lisboa}\n"); } +/// The path budget the reader enforces holds for the writer too: a keyword past it, and its +/// subtree, is named unwritable instead of making a file `keyword.import` rejects. +#[test] +fn the_keyword_list_written_stays_within_the_path_budget() { + let (c, _) = lib(&[&["Places|Lisbon", "beach"], &["Events|Weddings"]]); + let file = c.keyword_list_text_within(17); + assert_eq!(file.text, "beach\nEvents\nPlaces\n"); + assert_eq!(file.unwritable, ["Events|Weddings", "Places|Lisbon"]); + assert_eq!(c.keyword_list_text().unwritable, Vec::::new()); +} + /// Reading a list gives each keyword's path and attributes: what was written comes back, and a /// file from elsewhere (Windows line ends, a byte-order mark, blank lines) reads too. #[test] @@ -765,3 +776,47 @@ fn keyword_tree_caps_a_keyword_at_the_list_depth() { let deepest = tree_paths(&c.keyword_tree()).iter().map(|(p, _)| p.split(SEP).count()).max().unwrap_or(0); assert_eq!(deepest, MAX_LEVELS); } + +/// A keyword list file spells each keyword's whole path, so one long keyword with many short ones +/// inside it expands into far more than its own size: past `MAX_LIST_PATH_BYTES` it is refused +/// with the line where that happened, instead of growing without bound (CWE-400). +#[test] +fn a_list_whose_paths_expand_past_the_budget_is_refused() { + let parent = "p".repeat(1 << 20); + let children = MAX_LIST_PATH_BYTES / parent.len() + 2; + let mut text = format!("{parent}\n"); + for i in 0..children { + text.push_str(&format!("\tc{i}\n")); + } + let err = parse_keyword_list(&text).unwrap_err().to_string(); + assert!(err.contains("full paths come to more than"), "{err}"); + // a list within the budget still reads + let ok = parse_keyword_list(&format!("{parent}\n\tchild\n")).unwrap(); + assert_eq!(ok.len(), 2); + assert_eq!(ok[1].0, format!("{parent}|child")); +} + +/// Many synonyms joining a keyword the library has, its export and its keyword list file each keep +/// every spelling once, in order, without a search of the growing list per synonym (CWE-407). +#[test] +fn many_synonyms_are_gathered_once_each_in_order() { + const N: usize = 40_000; + let mut c = Catalog::new(); + c.apply(Op::SetKeyword { path: "travel".into(), info: Some(with_synonyms(&["Trip"])) }).unwrap(); + let mut incoming: Vec = (0..N).map(|i| format!("syn{i}")).collect(); + incoming.push("TRIP".into()); + incoming.push("SYN7".into()); + let started = std::time::Instant::now(); + let (op, added, updated) = c.import_keywords_ops(&[("travel".into(), KeywordInfo { synonyms: incoming, ..KeywordInfo::default() })]); + c.apply(op).unwrap(); + assert_eq!((added, updated), (0, 1)); + let synonyms = c.keyword_info("travel").unwrap().synonyms.clone(); + assert_eq!(synonyms.len(), N + 1); + assert_eq!(synonyms[0], "Trip"); + assert_eq!(synonyms[8], "syn7"); + let exported = c.export_keywords(&["travel".into()]); + assert_eq!(exported.flat.len(), N + 2); + let file = c.keyword_list_text(); + assert_eq!(file.text.lines().count(), N + 2); + assert!(started.elapsed() < std::time::Duration::from_secs(20), "took {:?}", started.elapsed()); +} From ab39f7dbbcf719340590603a171beae8817ede95 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 3 Nov 2026 22:58:42 -0500 Subject: [PATCH 37/41] web: a restore plans its writes first, each storage key once and within the file's bytes; workers are capped (#3669) --- apps/lightcraft-web/src/backup.rs | 36 ++++++++++++++++++++++++++++++ apps/lightcraft-web/src/safety.rs | 5 ++--- apps/lightcraft-web/src/web.rs | 2 +- apps/lightcraft-web/src/workers.rs | 19 +++++++++++++++- 4 files changed, 57 insertions(+), 5 deletions(-) diff --git a/apps/lightcraft-web/src/backup.rs b/apps/lightcraft-web/src/backup.rs index 281a32296d..6a4dd205e5 100644 --- a/apps/lightcraft-web/src/backup.rs +++ b/apps/lightcraft-web/src/backup.rs @@ -233,6 +233,25 @@ pub fn parse_central(cd: &[u8]) -> Result, String> { Ok(out) } +/// What a restore writes, each storage key once, checked against the whole directory before any +/// payload is read: a backup names a file once, so a directory naming the same destination again +/// is damaged or altered, and its entries' bytes can't add up to more than the file holds (a +/// directory can point many entries at one stored range and have each read, checked and written). +pub fn restore_plan<'a>(entries: &'a [ZipEntry], dir: &str, file_len: u64) -> Result, String> { + let mut seen = std::collections::HashSet::new(); + let mut plan = Vec::new(); + let mut bytes = 0u64; + for e in entries { + let Some(key) = restore_key(&e.name, dir) else { continue }; + if !seen.insert(key.clone()) { + return Err(format!("{}: listed twice (damaged or altered backup)", e.name)); + } + bytes = bytes.checked_add(e.size).filter(|&b| b <= file_len).ok_or_else(|| format!("{}: entries larger than the backup itself", e.name))?; + plan.push((key, e)); + } + Ok(plan) +} + /// Offset of an entry's data from its local header's first 30 bytes. pub fn data_offset(entry: &ZipEntry, local: &[u8]) -> Result { if rd32(local, 0) != Some(LOCAL_SIG) { @@ -342,6 +361,23 @@ mod tests { assert!(!valid_library_dir("library-../x") && !valid_library_dir("originals") && !valid_library_dir("library-")); } + #[test] + fn restore_plan_refuses_repeated_and_oversized_entries() { + let entry = |name: &str, size: u64| ZipEntry { name: name.into(), crc: 0, size, header: 0, method: 0 }; + let ok = [entry("README.txt", 10), entry("library/catalog.log", 10), entry("originals/abc123/a.jpg", 100)]; + let plan = restore_plan(&ok, "d", 200).unwrap(); + assert_eq!(plan.iter().map(|(k, _)| k.as_str()).collect::>(), ["d/catalog.log", "originals/abc123"]); + // one stored range named 3 times would be read, checked and written 3 times + let twice = [entry("originals/abc123/a.jpg", 100), entry("originals/abc123/b.jpg", 100)]; + assert!(restore_plan(&twice, "d", 1000).unwrap_err().contains("twice")); + let twice = [entry("library/catalog.log", 10), entry("library/catalog.log", 10)]; + assert!(restore_plan(&twice, "d", 1000).is_err()); + // entries claiming more bytes than the file has + let big = [entry("library/catalog.log", 150), entry("originals/abc123/a.jpg", 100)]; + assert!(restore_plan(&big, "d", 200).is_err()); + assert!(restore_plan(&[entry("library/catalog.log", u64::MAX), entry("library/presets.json", 1)], "d", u64::MAX).is_err()); + } + #[test] fn size_limits_are_errors_not_panics() { let mut w = ZipWriter { offset: MAX_BYTES - 10, ..Default::default() }; diff --git a/apps/lightcraft-web/src/safety.rs b/apps/lightcraft-web/src/safety.rs index 137b525039..8bffc818d0 100644 --- a/apps/lightcraft-web/src/safety.rs +++ b/apps/lightcraft-web/src/safety.rs @@ -13,7 +13,7 @@ use wasm_bindgen_futures::JsFuture; use crate::backend::Backend; use crate::backup::{ - ACTIVE_LIBRARY, README, ZipWriter, data_offset, find_central, original_entry, parse_central, restore_key, restored_dir_name, tail_len, + ACTIVE_LIBRARY, README, ZipWriter, data_offset, find_central, original_entry, parse_central, restore_plan, restored_dir_name, tail_len, valid_hash, verify, verify_original, }; use crate::files::{Files, LIBRARY_FILES}; @@ -214,8 +214,7 @@ pub async fn restore(file: web_sys::File, backend: Backend) -> Result>); @@ -244,7 +253,12 @@ impl Workers { return w; } let mut slots = WorkerSlots::default(); - for attempt in 0..n { + let mut failed = 0; + for attempt in 0..n.min(MAX_WORKERS) { + if failed >= MAX_FAILED_STARTS { + log::warn!("render workers: {failed} failed to start in a row; not trying the rest"); + break; + } // The callbacks name their worker by its place in `workers`; a failed attempt takes none. let i = slots.peek(); let opts = web_sys::WorkerOptions::new(); @@ -254,6 +268,7 @@ impl Workers { Ok(x) => x, Err(e) => { log::warn!("render worker {attempt}: {e:?}"); + failed += 1; continue; } }; @@ -274,10 +289,12 @@ impl Workers { worker.set_onmessage(None); worker.set_onerror(None); worker.terminate(); + failed += 1; continue; } w.0.borrow_mut().workers.push(W { worker, ready: false, dead: false, busy: None }); slots.commit(); + failed = 0; } w } From 7b80ffc32b957425eb5cb2682112c5154d3244b0 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 3 Nov 2026 22:59:11 -0500 Subject: [PATCH 38/41] engine: font paths the build embeds stay inside the asset checkout and print as one cargo line (#3670) --- crates/engine/build.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/crates/engine/build.rs b/crates/engine/build.rs index 7f5aa77776..f2573f0197 100644 --- a/crates/engine/build.rs +++ b/crates/engine/build.rs @@ -65,6 +65,7 @@ fn craft_fonts(dir: &Path, required: bool) -> Result { let manifest = dir.join("fonts/manifest.txt"); println!("cargo::rerun-if-changed={}", manifest.display()); let text = std::fs::read_to_string(&manifest).map_err(|e| format!("{}: {e}", manifest.display()))?; + let root = dir.canonicalize().map_err(|e| format!("{}: {e}", dir.display()))?; let wasm = std::env::var("CARGO_CFG_TARGET_ARCH").is_ok_and(|a| a == "wasm32"); let mut out = String::new(); let mut has_japanese_ui = false; @@ -82,7 +83,17 @@ fn craft_fonts(dir: &Path, required: bool) -> Result { continue; } let path = dir.join(file).canonicalize().map_err(|e| format!("{file}: {e}"))?; - println!("cargo::rerun-if-changed={}", path.display()); + // a font is a file of the checkout: a manifest entry or a link reaching outside it would + // embed some other file of the build machine + if !path.starts_with(&root) || !path.is_file() { + return Err(format!("{file}: not a file inside {}", root.display())); + } + let shown = path.display().to_string(); + // one cargo instruction per line: a line break in the path would print a second one + if shown.contains(['\n', '\r']) { + return Err(format!("{file}: the path contains a line break")); + } + println!("cargo::rerun-if-changed={shown}"); let scripts: Vec = scripts.split(',').map(|s| format!("{:?}", s.trim())).collect(); let _ = writeln!( out, From f618fc06a7551156d7c249eda5ab4dae20c99e26 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 3 Nov 2026 22:59:41 -0500 Subject: [PATCH 39/41] security: staging and probe files are created new, never written through an existing entry (#3673) --- crates/denoise-core/src/product.rs | 21 ++++++++++++++++++++- crates/engine/src/camera_profiles.rs | 6 +++--- crates/engine/src/cmd/lut_profiles.rs | 4 +++- crates/engine/src/faces_index.rs | 12 ++++++------ crates/engine/src/slideshow_export.rs | 5 ++++- crates/engine/src/smart.rs | 10 +++++++++- crates/engine/src/smart/tests.rs | 15 +++++++++++++++ crates/preview/src/disk.rs | 6 +++++- 8 files changed, 65 insertions(+), 14 deletions(-) diff --git a/crates/denoise-core/src/product.rs b/crates/denoise-core/src/product.rs index c33b1d4c2a..09cf24245a 100644 --- a/crates/denoise-core/src/product.rs +++ b/crates/denoise-core/src/product.rs @@ -160,7 +160,10 @@ pub fn write(path: &Path, img: &Rgb32f, key: &str) -> Result<(), ProductError> { if let Some(dir) = path.parent() { std::fs::create_dir_all(dir)?; } - let mut f = std::io::BufWriter::new(std::fs::File::create(&tmp)?); + // a new temp file: an entry already under the name (a link planted in the cache folder + // would be written through) is removed, never opened + let _ = std::fs::remove_file(&tmp); + let mut f = std::io::BufWriter::new(std::fs::OpenOptions::new().write(true).create_new(true).open(&tmp)?); f.write_all(MAGIC)?; f.write_all(&[VERSION, 0, 0, 0])?; f.write_all(&(header.len() as u32).to_le_bytes())?; @@ -459,6 +462,22 @@ mod tests { std::env::temp_dir().join(format!("lc-denoise-{name}-{}.lcdn", std::process::id())) } + #[cfg(unix)] + #[test] + fn a_link_planted_under_the_temp_name_is_not_written_through() { + let p = temp("planted"); + let victim = temp("victim"); + std::fs::write(&victim, b"keep").unwrap(); + let _ = std::fs::remove_file(p.with_extension("tmp")); + std::os::unix::fs::symlink(&victim, p.with_extension("tmp")).unwrap(); + write(&p, &picture(16, 4), "k").unwrap(); + assert_eq!(std::fs::read(&victim).unwrap(), b"keep"); + assert!(read_header_at(&p).is_ok()); + for f in [p, victim] { + let _ = std::fs::remove_file(f); + } + } + fn picture(w: usize, h: usize) -> Rgb32f { Rgb32f { width: w, diff --git a/crates/engine/src/camera_profiles.rs b/crates/engine/src/camera_profiles.rs index 5f2c92f175..3c63773c1e 100644 --- a/crates/engine/src/camera_profiles.rs +++ b/crates/engine/src/camera_profiles.rs @@ -116,9 +116,9 @@ pub fn save(profile: &CameraProfile, dir: &Path) -> Result { std::fs::create_dir_all(dir).map_err(|e| format!("{}: {e}", dir.display()))?; let path = dir.join(file_name(&profile.model)); let json = serde_json::to_vec_pretty(profile).map_err(|e| e.to_string())?; - let tmp = path.with_extension("json.tmp"); - std::fs::write(&tmp, json).map_err(|e| format!("{}: {e}", tmp.display()))?; - std::fs::rename(&tmp, &path).map_err(|e| format!("{}: {e}", path.display()))?; + // a fresh temp file renamed over the profile: never a fixed `.tmp` name, which a planted link + // would have written through + lightcraft_catalog::safe_file::write_atomic(&path, &json).map_err(|e| format!("{}: {e}", path.display()))?; Ok(path) } diff --git a/crates/engine/src/cmd/lut_profiles.rs b/crates/engine/src/cmd/lut_profiles.rs index b7a0d49928..56a0169a10 100644 --- a/crates/engine/src/cmd/lut_profiles.rs +++ b/crates/engine/src/cmd/lut_profiles.rs @@ -120,7 +120,9 @@ fn import(s: &mut Session, p: &Value) -> Result { let file = match &dir { Some(d) => { let f = d.join(format!("{}.cube", id.trim_start_matches("lut:"))); - std::fs::write(&f, &text).map_err(|e| bad(C, format!("{}: {e}", f.display())))?; + // a new file renamed into place: an entry already under the name (a link planted + // in the Profiles folder) is replaced, never written through + lightcraft_catalog::safe_file::write_atomic(&f, text.as_bytes()).map_err(|e| bad(C, format!("{}: {e}", f.display())))?; f.to_string_lossy().to_string() } // no library on disk: the registered LUT is all this session needs (a copy would only diff --git a/crates/engine/src/faces_index.rs b/crates/engine/src/faces_index.rs index 17bffbc193..5b23c58af4 100644 --- a/crates/engine/src/faces_index.rs +++ b/crates/engine/src/faces_index.rs @@ -214,9 +214,9 @@ impl Index { for (k, e) in &self.entries { buf.extend(self.record(k, e)); } - let part = path.with_extension("part"); - std::fs::write(&part, &buf)?; - std::fs::rename(&part, &path)?; + // a fresh temp file (never a `.part` entry left in the library, which could be a link + // to a file outside it) renamed over the cache + lightcraft_catalog::safe_file::write_atomic_nosync(&path, &buf)?; self.file_matches = true; self.rewrite = false; } @@ -367,9 +367,9 @@ impl Scanned { } else { let mut buf = self.header(); buf.extend(self.set.iter().flat_map(|id| id.to_le_bytes())); - let part = path.with_extension("part"); - std::fs::write(&part, &buf)?; - std::fs::rename(&part, &path)?; + // a fresh temp file (never a `.part` entry left in the library, which could be a link + // to a file outside it) renamed over the cache + lightcraft_catalog::safe_file::write_atomic_nosync(&path, &buf)?; self.file_matches = true; self.rewrite = false; } diff --git a/crates/engine/src/slideshow_export.rs b/crates/engine/src/slideshow_export.rs index e91c1ed346..94a7bc7dd6 100644 --- a/crates/engine/src/slideshow_export.rs +++ b/crates/engine/src/slideshow_export.rs @@ -389,7 +389,10 @@ impl PartFile { let mut name = target.file_name().ok_or_else(|| format!("{}: not a file name", target.display()))?.to_os_string(); name.push(".part"); let part = target.with_file_name(name); - let f = std::fs::File::create(&part).map_err(|e| format!("{}: {e}", part.display()))?; + // an entry already under the staging name (a leftover, or a link planted to point the + // encoder's bytes at another file) is removed, never opened and written through + let _ = std::fs::remove_file(&part); + let f = std::fs::OpenOptions::new().write(true).create_new(true).open(&part).map_err(|e| format!("{}: {e}", part.display()))?; Ok((PartFile { part, target: target.to_path_buf(), done: false }, f)) } diff --git a/crates/engine/src/smart.rs b/crates/engine/src/smart.rs index b936830f83..156f33d42a 100644 --- a/crates/engine/src/smart.rs +++ b/crates/engine/src/smart.rs @@ -268,7 +268,15 @@ pub fn check_writable(dir: &Path) -> Result<(), String> { std::fs::create_dir(dir).map_err(|e| format!("can't create {}: {e}", dir.display()))?; } let probe = dir.join(format!(".lightcraft-write-test-{}", std::process::id())); - std::fs::write(&probe, b"x").map_err(|e| format!("{} is not writable (is the drive full or read-only?): {e}", dir.display()))?; + // the probe is a new entry of ours: an existing one (a link planted under the name would be + // written through) is removed first, never opened + let _ = std::fs::remove_file(&probe); + std::fs::OpenOptions::new() + .write(true) + .create_new(true) + .open(&probe) + .and_then(|mut f| std::io::Write::write_all(&mut f, b"x")) + .map_err(|e| format!("{} is not writable (is the drive full or read-only?): {e}", dir.display()))?; let _ = std::fs::remove_file(&probe); Ok(()) } diff --git a/crates/engine/src/smart/tests.rs b/crates/engine/src/smart/tests.rs index e4bbd548cd..b1eeefc221 100644 --- a/crates/engine/src/smart/tests.rs +++ b/crates/engine/src/smart/tests.rs @@ -18,6 +18,21 @@ fn writable_check_does_not_create_missing_parents() { let _ = std::fs::remove_dir_all(&base); } +#[cfg(unix)] +#[test] +fn writable_probe_never_writes_through_a_planted_link() { + let base = temp("probe-link"); + std::fs::create_dir_all(&base).unwrap(); + let victim = base.join("victim"); + std::fs::write(&victim, b"keep").unwrap(); + let probe = base.join(format!(".lightcraft-write-test-{}", std::process::id())); + std::os::unix::fs::symlink(&victim, &probe).unwrap(); + assert!(check_writable(&base).is_ok()); + assert_eq!(std::fs::read(&victim).unwrap(), b"keep"); + assert!(!probe.exists()); + let _ = std::fs::remove_dir_all(&base); +} + #[test] fn migrate_moves_leaves_or_discards() { let base = temp("migrate"); diff --git a/crates/preview/src/disk.rs b/crates/preview/src/disk.rs index 7510ffa383..ca82870483 100644 --- a/crates/preview/src/disk.rs +++ b/crates/preview/src/disk.rs @@ -191,7 +191,11 @@ impl DiskCache { let used = total.get_or_insert_with(|| self.scan().iter().map(|f| f.1).sum()); let old_len = std::fs::metadata(&p).map_or(0, |m| m.len()); let tmp = p.with_extension(format!("tmp{:?}", std::thread::current().id()).replace(['(', ')'], "")); - if std::fs::write(&tmp, &bytes).is_err() || std::fs::rename(&tmp, &p).is_err() { + // a new temp file: an entry already under the name (a link planted in the cache would be + // written through) is removed, never opened + let _ = std::fs::remove_file(&tmp); + let written = std::fs::OpenOptions::new().write(true).create_new(true).open(&tmp).and_then(|mut f| std::io::Write::write_all(&mut f, &bytes)); + if written.is_err() || std::fs::rename(&tmp, &p).is_err() { let _ = std::fs::remove_file(&tmp); return; } From 1c5cbce83520d36cf77003f8bc1f70e718689645 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 3 Nov 2026 23:00:31 -0500 Subject: [PATCH 40/41] security(engine): the library folder is protected from folder.move however its path is spelled (#3676) --- crates/engine/src/cmd/browse.rs | 8 +++++++- crates/engine/src/tests/folders.rs | 15 +++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/crates/engine/src/cmd/browse.rs b/crates/engine/src/cmd/browse.rs index 9a235306c6..0eb126c40f 100644 --- a/crates/engine/src/cmd/browse.rs +++ b/crates/engine/src/cmd/browse.rs @@ -522,7 +522,13 @@ pub(crate) fn move_folder(s: &mut Session, from: &str, to: &str) -> std::result: if !src.is_dir() { return Err(format!("{from} is not a folder")); } - if s.library.as_ref().is_some_and(|l| l.dir.starts_with(src) || src.starts_with(&l.dir)) { + // compared as the folders are on disk (a differently spelled or linked path to the library + // names the same folder), with the spelling as a fallback where that can't be told + let same_folder = |l: &Path| { + let (lib, chosen) = (l.canonicalize().unwrap_or_else(|_| l.to_path_buf()), src.canonicalize().unwrap_or_else(|_| src.to_path_buf())); + lib.starts_with(&chosen) || chosen.starts_with(&lib) || l.starts_with(src) || src.starts_with(l) + }; + if s.library.as_ref().is_some_and(|l| same_folder(&l.dir)) { return Err("the library's own folders can't be moved here".into()); } // Repairs retain their exact old paths, including those on surviving history entries. diff --git a/crates/engine/src/tests/folders.rs b/crates/engine/src/tests/folders.rs index 34017fc977..6877572768 100644 --- a/crates/engine/src/tests/folders.rs +++ b/crates/engine/src/tests/folders.rs @@ -701,3 +701,18 @@ fn a_destination_without_write_permission_reports_an_error_and_keeps_everything( } std::fs::set_permissions(dir.0.join("ro"), std::fs::Permissions::from_mode(0o755)).unwrap(); } + +#[cfg(unix)] +#[test] +fn the_library_folder_is_protected_however_its_path_is_spelled() { + let dir = Scratch::new("library-link"); + let lib = dir.0.join("library"); + let mut s = Session::new(); + s.open_library(&lib, true).unwrap(); + // a link to the library's folder names the same folder on disk + std::os::unix::fs::symlink(&lib, dir.0.join("alias")).unwrap(); + std::fs::create_dir_all(dir.0.join("elsewhere")).unwrap(); + let err = s.execute("folder.move", &json!({"path": dir.path("alias"), "into": dir.path("elsewhere")})).unwrap_err().to_string(); + assert!(err.contains("library's own folders"), "{err}"); + assert!(lib.is_dir() && !dir.0.join("elsewhere/alias").exists()); +} From 4d42507bbcc180df831435c8ef2c29740b5216aa Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 3 Nov 2026 23:00:51 -0500 Subject: [PATCH 41/41] security(raster, segment): resample tall narrow images columns first (#3678) --- crates/raster/src/resample.rs | 30 +++++++++++++++++++++++++-- crates/segment/src/mask.rs | 38 +++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 2 deletions(-) diff --git a/crates/raster/src/resample.rs b/crates/raster/src/resample.rs index afe0c10d76..4664dfa4b3 100644 --- a/crates/raster/src/resample.rs +++ b/crates/raster/src/resample.rs @@ -115,12 +115,22 @@ impl Pixel for [f32; 4] { } } -/// Resize to `w × h` (separable; horizontal pass then vertical pass). +/// Resize to `w × h` (separable; horizontal pass then vertical pass, or the other way round when +/// that intermediate would be far larger: widening a tall, narrow strip kept every source row at +/// the new width, gigabytes from a small source). pub fn resize(img: &Image, w: usize, h: usize, filter: Filter) -> Image { let (w, h) = (w.max(1), h.max(1)); if img.width == w && img.height == h { return img.clone(); } + if w.saturating_mul(img.height) > img.width.saturating_mul(h).saturating_mul(4) { + return horizontal(&vertical(img, h, filter), w, filter); + } + vertical(&horizontal(img, w, filter), h, filter) +} + +/// Each row resampled to `w` wide. +fn horizontal(img: &Image, w: usize, filter: Filter) -> Image { let wx = weights(img.width, w, filter); let mut tmp = Image::::new(w, img.height); par_rows(&mut tmp.data, w, |y, row| { @@ -134,12 +144,18 @@ pub fn resize(img: &Image, w: usize, h: usize, filter: Filter) -> I *o = acc; } }); + tmp +} + +/// Each column resampled to `h` tall. +fn vertical(img: &Image, h: usize, filter: Filter) -> Image { + let w = img.width; let wy = weights(img.height, h, filter); let mut out = Image::::new(w, h); par_rows(&mut out.data, w, |y, row| { let (lo, ws) = &wy[y]; for (k, wt) in ws.iter().enumerate() { - let src = tmp.row(lo + k); + let src = img.row(lo + k); for (o, s) in row.iter_mut().zip(src) { *o = o.madd(*s, *wt); } @@ -178,6 +194,16 @@ pub fn half(img: &Image) -> Image { mod tests { use super::*; + #[test] + fn widening_a_tall_strip_resamples_its_columns_first() { + // 1 × 400 000 to 4000 × 8: horizontal-first kept 400 000 rows of 4000 (25 GB of RGBA f32) + let mut strip = Image::<[f32; 4]>::new(1, 400_000); + strip.data.iter_mut().for_each(|p| *p = [0.25, 0.5, 0.75, 1.0]); + let out = resize(&strip, 4000, 8, Filter::Mitchell); + assert_eq!((out.width, out.height), (4000, 8)); + assert!(out.data.iter().all(|p| (p[1] - 0.5).abs() < 1e-3), "a flat strip stays flat"); + } + #[test] fn constant_image_stays_constant() { let img = Image::::filled(37, 21, 0.42); diff --git a/crates/segment/src/mask.rs b/crates/segment/src/mask.rs index af349a2625..d884659aab 100644 --- a/crates/segment/src/mask.rs +++ b/crates/segment/src/mask.rs @@ -34,6 +34,31 @@ pub fn preprocess(rgb: &[u8], w: usize, h: usize, side: usize) -> Result w.saturating_mul(4) { + let mut t = vec![0u8; n]; + for y in 0..h { + for x in 0..w { + if let (Some(d), Some(s)) = (t.get_mut((x * h + y) * 3..(x * h + y) * 3 + 3), rgb.get((y * w + x) * 3..(y * w + x) * 3 + 3)) { + d.copy_from_slice(s); + } + } + } + let o = preprocess(&t, h, w, side)?; + let mut out = vec![0f32; o.len()]; + for c in 0..3 { + for oy in 0..side { + for ox in 0..side { + if let (Some(d), Some(v)) = (out.get_mut((c * side + oy) * side + ox), o.get((c * side + ox) * side + oy)) { + *d = *v; + } + } + } + } + return Ok(out); + } let (wx, wy) = (weights(w, side), weights(h, side)); // horizontal pass: h rows × side columns × 3 let mut tmp = vec![0f32; h * side * 3]; @@ -117,6 +142,19 @@ mod tests { #[test] fn short_buffers_are_errors() { assert!(preprocess(&[0; 5], 2, 2, 4).is_err()); + // a strip 1 pixel wide and 200 000 tall: resampled transposed, so the intermediate is + // side × 1 rather than 200 000 × side; it equals the resample of its transposed twin + let h = 200_000usize; + let strip: Vec = (0..h * 3).map(|i| (i / 3 % 251) as u8).collect(); + let a = preprocess(&strip, 1, h, 8).unwrap(); + let b = preprocess(&strip, h, 1, 8).unwrap(); + for c in 0..3 { + for y in 0..8 { + for x in 0..8 { + assert_eq!(a[(c * 8 + y) * 8 + x], b[(c * 8 + x) * 8 + y]); + } + } + } assert!(preprocess(&[], 0, 0, 4).is_err()); }