Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
83faa8c
Upstream intake: #3758 honor JPEG XL EXIF TIFF header offsets
emmertex Nov 8, 2026
fdfc7f3
Upstream intake: #3756 JPEG XL import reads the Exif and xml boxes
emmertex Nov 8, 2026
801894b
Upstream intake: #3906 a Custom white balance is shifted from the as-…
emmertex Nov 8, 2026
61813f0
Upstream intake: ledger rows for #3906 and #3143
emmertex Nov 8, 2026
f647ffc
Upstream intake: #3882 copy and bulk-delete presets
emmertex Nov 8, 2026
c08fc40
Upstream intake: #3881 guard preset folder delete with a count
emmertex Nov 8, 2026
1379c32
Upstream intake: #3812 bound the file-availability cache
emmertex Nov 8, 2026
25ca11c
Upstream intake: #3904 Add next and previous unrated photo jump keys
emmertex Nov 8, 2026
808ec36
Upstream intake: #3808 Apply Auto settings to every selected photo
emmertex Nov 8, 2026
908107f
Upstream intake: ledger rows for #3881 #3882 #3812
emmertex Nov 8, 2026
f317db7
Upstream intake: #3828 Write camera make and lens make to EXIF on export
emmertex Nov 8, 2026
0d92873
Upstream intake: #3821 Add flash, exposure bias and serial rules to s…
emmertex Nov 8, 2026
095d351
Upstream intake: ledger rows for the ported PRs
emmertex Nov 8, 2026
852f40e
Upstream intake: #3933 reject malformed MCP import paths before parti…
emmertex Nov 8, 2026
0c9e63f
Upstream intake: #2676 prefer a known calibration crop on exact lens …
emmertex Nov 8, 2026
fabe79b
Upstream intake: #3798 cover noisy 8/16-bit ZIP TIFF exports with the…
emmertex Nov 8, 2026
ba2a5e8
Upstream intake: ledger rows for #3758 #3756 #3933 #2676 #3798
emmertex Nov 8, 2026
82f1e69
Upstream intake: #3882 rustfmt
emmertex Nov 8, 2026
91e1e8e
Upstream intake: #2676 format
emmertex Nov 8, 2026
b7b21e4
Upstream intake: format the ported code
emmertex Nov 8, 2026
ea7b2f1
Upstream intake: #3756 brand wording
emmertex Nov 8, 2026
6f16f80
Merge branch 'worktree-agent-ae0f8e6cf89fc2d08' into upstream-pr-revi…
emmertex Nov 8, 2026
8e0299c
Merge branch 'worktree-agent-aae2786c1aa69a706' into upstream-pr-revi…
emmertex Nov 8, 2026
eeddc27
Merge branch 'worktree-agent-aaef8f79061254f22' into upstream-pr-revi…
emmertex Nov 8, 2026
48a4aeb
Upstream intake round 2 port pass: run log row
emmertex Nov 8, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions crates/actions/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ pub fn is_navigation(id: &str) -> bool {
| "library.selectNone"
| "library.next"
| "library.previous"
| "library.nextUnrated"
| "library.prevUnrated"
| "library.first"
| "library.last"
| "library.source"
Expand Down
9 changes: 9 additions & 0 deletions crates/catalog/src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,20 @@ pub struct Meta {
/// two bodies of one model apart for their own camera profiles ([`Meta::camera_model`] says the model).
#[serde(skip_serializing_if = "String::is_empty")]
pub camera_serial: String,
/// The lens maker (Exif `LensMake`), written back on export. Left out of the catalog JSON when empty.
#[serde(skip_serializing_if = "String::is_empty")]
pub lens_make: String,
pub lens: String,
pub focal_mm: Option<f32>,
pub aperture: Option<f32>,
pub shutter: String,
pub iso: Option<u32>,
/// Whether the flash fired (Exif `Flash`); `None` when the file does not say.
#[serde(skip_serializing_if = "Option::is_none")]
pub flash: Option<bool>,
/// Exposure compensation in EV (Exif `ExposureBiasValue`).
#[serde(skip_serializing_if = "Option::is_none")]
pub exposure_bias: Option<f32>,
/// The lens's focal range (mm, shortest and longest), from the file's LensSpecification: the loupe's shot info
/// adds it to a lens name that doesn't say it (OneSlips PERF-CULL-7 a5f6da85e). Left out of the catalog JSON when
/// unknown, so older catalogs read unchanged.
Expand Down
23 changes: 22 additions & 1 deletion crates/catalog/src/rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ pub const FIELDS: &[(&str, &str, Kind)] = &[
("aperture", "Aperture", Kind::Number),
("shutterSpeed", "Shutter Speed", Kind::Number),
("iso", "ISO Speed", Kind::Number),
("flash", "Flash", Kind::Bool),
("exposureBias", "Exposure Bias", Kind::Number),
("cameraSerial", "Camera Serial Number", Kind::Text),
// Location
("location", "Location", Kind::Text),
("sublocation", "Sublocation", Kind::Text),
Expand Down Expand Up @@ -149,7 +152,7 @@ pub const FIELD_GROUPS: &[(&str, &[&str])] = &[
("Date", &["captureDate", "importDate", "editDate"]),
("Keywords & People", &["keywords", "keywordCount", "person", "personCount", "faceCount"]),
("Description", &["title", "caption", "altText", "creator", "copyright", "usageTerms", "copyrightStatus"]),
("Camera Info", &["camera", "lens", "focalLength", "aperture", "shutterSpeed", "iso"]),
("Camera Info", &["camera", "lens", "focalLength", "aperture", "shutterSpeed", "iso", "flash", "exposureBias", "cameraSerial"]),
("Location", &["location", "sublocation", "city", "state", "country", "countryCode", "hasGps"]),
("Size", &["longEdge", "shortEdge", "width", "height", "aspect", "megapixels"]),
("Develop", &["edited", "cropped", "treatment"]),
Expand Down Expand Up @@ -1103,6 +1106,9 @@ impl Rule {
"editDate" => date_op(op, p.edited.as_deref(), value),
"shutterSpeed" => num_op(op, crate::parse_shutter_seconds(&m.shutter), &shutter_value(value)),
"iso" => num_op(op, m.iso.map(|v| v as f64), value),
"flash" => yes(m.flash.unwrap_or(false)),
"exposureBias" => num_op32(op, m.exposure_bias, value),
"cameraSerial" => text(&m.camera_serial),
"aperture" => num_op32(op, m.aperture, value),
"focalLength" => num_op32(op, m.focal_mm, value),
"longEdge" | "shortEdge" => {
Expand Down Expand Up @@ -1387,6 +1393,21 @@ mod tests {
yes(json!({"rules": [{"field": "filePath", "op": "isEmpty"}]}));
yes(json!({"rules": [{"field": "camera", "op": "contains", "value": "x2"}, {"field": "title", "op": "isEmpty"}]}));
yes(json!({"rules": [{"field": "iso", "op": "between", "value": [800, 3200]}, {"field": "aperture", "op": "lte", "value": "f/4"}]}));
// flash, exposure bias and camera serial (ported from upstream #3821): unrecorded is "no flash", no bias, empty
no(json!({"rules": [{"field": "flash", "op": "is", "value": true}]}));
no(json!({"rules": [{"field": "exposureBias", "op": "lt", "value": 0}]}));
no(json!({"rules": [{"field": "cameraSerial", "op": "contains", "value": "x2"}]}));
let mut fl = photo(2);
fl.meta.flash = Some(true);
fl.meta.exposure_bias = Some(-0.67);
fl.meta.camera_serial = "SN-X2".into();
let flm = |v: serde_json::Value| rs(v).matches(&fl, &cat);
assert!(flm(json!({"rules": [{"field": "flash", "op": "is", "value": true}]})));
assert!(!flm(json!({"rules": [{"field": "flash", "op": "is", "value": false}]})));
assert!(flm(json!({"rules": [{"field": "exposureBias", "op": "lt", "value": 0}]})));
assert!(flm(json!({"rules": [{"field": "exposureBias", "op": "between", "value": [-1.0, -0.3]}]})));
assert!(flm(json!({"rules": [{"field": "cameraSerial", "op": "contains", "value": "x2"}]})));
assert_eq!(field_group("exposureBias"), Some("Camera Info"));
yes(json!({"rules": [{"field": "megapixels", "op": "gte", "value": 24}]}));
yes(
json!({"rules": [{"field": "captureDate", "op": "is", "value": "2026-08"}, {"field": "captureDate", "op": "before", "value": "2026-09-01"}]}),
Expand Down
3 changes: 2 additions & 1 deletion crates/codecs/src/jxl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ pub(crate) fn decode(bytes: &[u8], opts: &DecodeOptions) -> Result<Decoded> {
meta.icc = icc;
}
if let Ok(AuxBoxData::Data(ex)) = img.aux_boxes().first_exif() {
meta.exif = Some(ex.payload().to_vec());
// The box declares where the TIFF header starts inside its payload; skip any prefix before it.
meta.exif = usize::try_from(ex.tiff_header_offset()).ok().and_then(|offset| ex.payload().get(offset..)).map(<[u8]>::to_vec);
}
if let AuxBoxData::Data(x) = img.aux_boxes().first_xml() {
meta.xmp = Some(String::from_utf8_lossy(x).trim_end_matches('\0').to_string());
Expand Down
26 changes: 26 additions & 0 deletions crates/codecs/tests/it/jxl_streaming.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,29 @@ fn progressive_truncation_matches_builder() {
}
}
}

#[test]
fn exif_payload_starts_at_declared_tiff_header() {
let pixels = Rgba8::from_fn(8, 8, |x, y| [(x * 20) as u8, (y * 20) as u8, 80, 255]);
let encoded = encode_jxl(&EncodeImage::rgba8(&pixels), &JxlOptions { lossless: true, ..Default::default() }, &EncodeMeta::default()).unwrap();
let raw = codestream(&encoded);
let exif = minimal_exif(1);
for offset in [0u32, 6, 64] {
let mut exif_box = offset.to_be_bytes().to_vec();
exif_box.resize(4 + offset as usize, 0xab);
exif_box.extend_from_slice(&exif);
let mut bytes = b"\0\0\0\x0cJXL \x0d\x0a\x87\x0a".to_vec();
box_bytes(&mut bytes, b"ftyp", b"jxl \0\0\0\0jxl ");
box_bytes(&mut bytes, b"jxlc", &raw);
box_bytes(&mut bytes, b"Exif", &exif_box);
let decoded = decode(&bytes, DecodeOptions::default()).unwrap();
assert_eq!(decoded.exif.as_deref(), Some(exif.as_slice()), "offset {offset}");
}
// an offset past the payload must not panic and yields no Exif
let mut bytes = b"\0\0\0\x0cJXL \x0d\x0a\x87\x0a".to_vec();
box_bytes(&mut bytes, b"ftyp", b"jxl \0\0\0\0jxl ");
box_bytes(&mut bytes, b"jxlc", &raw);
box_bytes(&mut bytes, b"Exif", &[0xff, 0xff, 0xff, 0xff, 1, 2]);
let decoded = decode(&bytes, DecodeOptions::default()).unwrap();
assert!(decoded.exif.is_none());
}
1 change: 1 addition & 0 deletions crates/codecs/tests/it/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ mod heif;
#[cfg(all(feature = "jxl", not(target_arch = "wasm32")))]
mod jxl_streaming;
mod roundtrip;
mod tiff_zip;
83 changes: 83 additions & 0 deletions crates/codecs/tests/it/tiff_zip.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
//! Noisy 8/16-bit ZIP TIFFs stay within their uncompressed size (issue #2882), using the Deflate backend the
//! application dependency graph selects (no test-only backend is forced), so a dependency switching it shows up.

use lcc_codecs::*;

/// A deterministic value in -0.5..0.5 per position and channel.
fn hash(x: u32, y: u32, c: u32) -> f64 {
let mut z = (x as u64) << 32 ^ (y as u64) << 2 ^ c as u64 ^ 0x2882;
z = (z ^ (z >> 33)).wrapping_mul(0xff51_afd7_ed55_8ccd);
z = (z ^ (z >> 33)).wrapping_mul(0xc4ce_b9fe_1a85_ec53);
(z ^ (z >> 33)) as f64 / u64::MAX as f64 - 0.5
}

/// 16-bit RGB: smooth gradients plus noise of `noise` codes peak to peak (a clean to a high-ISO photo's low bits).
fn noisy16(w: u32, h: u32, noise: f64) -> Vec<u16> {
let mut v = Vec::with_capacity((w * h * 3) as usize);
for y in 0..h {
for x in 0..w {
let (u, t) = (x as f64 / w as f64, y as f64 / h as f64);
let base = [0.10 + 0.5 * u, 0.15 + 0.4 * t, 0.3 + 0.3 * u * t];
for c in 0..3 {
v.push((base[c as usize] * 65535.0 + noise * hash(x, y, c)).clamp(0.0, 65535.0) as u16);
}
}
}
v
}

/// Both depths must actually use Deflate and decode at the original dimensions.
fn checked_zip_size(img: &EncodeImage<'_>) -> usize {
let bytes = encode_tiff(img, TiffCompression::Deflate, &EncodeMeta::default()).unwrap();
let mut decoder = tiff::decoder::Decoder::new(std::io::Cursor::new(&bytes)).unwrap();
let compression = decoder.get_tag_u32(tiff::tags::Tag::Compression).unwrap();
assert!(matches!(compression, 8 | 32946), "Compression tag {compression} is not Deflate");
let decoded = decode(&bytes, DecodeOptions::default()).unwrap();
assert_eq!((decoded.image.width, decoded.image.height), (img.width as usize, img.height as usize));
bytes.len()
}

/// The shipped backend keeps noisy 16-bit ZIP exports smaller than uncompressed TIFFs.
#[test]
fn sixteen_bit_zip_tiff_is_never_larger_than_uncompressed() {
let (w, h) = (512, 384);
for noise in [0.0, 200.0, 1300.0, 4000.0, 13000.0] {
let px = noisy16(w, h, noise);
let img = EncodeImage::new(w, h, 3, Samples::U16(&px));
let none = encode_tiff(&img, TiffCompression::None, &EncodeMeta::default()).unwrap().len();
let zip = checked_zip_size(&img);
eprintln!("noise {noise} codes: none {none} B, ZIP {zip} B ({:+.1} %)", 100.0 * (zip as f64 / none as f64 - 1.0));
assert!(zip <= none, "noise {noise}: 16-bit ZIP {zip} B is larger than uncompressed {none} B");
}
}

/// The same size guarantee holds for 8-bit ZIP exports across several noise levels.
#[test]
fn eight_bit_zip_tiff_is_never_larger_than_uncompressed() {
let (w, h) = (512, 384);
for noise in [0.0, 4.0, 20.0, 60.0] {
let px: Vec<u8> = noisy16(w, h, noise * 257.0).iter().map(|v| (v >> 8) as u8).collect();
let img = EncodeImage::new(w, h, 3, Samples::U8(&px));
let none = encode_tiff(&img, TiffCompression::None, &EncodeMeta::default()).unwrap().len();
let zip = checked_zip_size(&img);
eprintln!("8-bit noise {noise}: none {none} B, ZIP {zip} B ({:+.1} %)", 100.0 * (zip as f64 / none as f64 - 1.0));
assert!(zip <= none, "8-bit noise {noise}: ZIP {zip} B is larger than uncompressed {none} B");
}
}

/// What ZIP costs at 24 MP, 16 bit (ignored by default):
/// `cargo test --release -p lcc-codecs --test it tiff_zip::bench -- --ignored --nocapture`
#[test]
#[ignore]
fn bench_24mp_16_bit_zip() {
let (w, h) = (6000, 4000);
for noise in [200.0, 1300.0, 4000.0] {
let px = noisy16(w, h, noise);
let img = EncodeImage::new(w, h, 3, Samples::U16(&px));
for c in [TiffCompression::None, TiffCompression::Deflate, TiffCompression::Lzw] {
let t = std::time::Instant::now();
let n = encode_tiff(&img, c, &EncodeMeta::default()).unwrap().len();
println!("noise {noise:>6} {c:?}: {:>7.1} MB in {:>6.0} ms", n as f64 / 1e6, t.elapsed().as_secs_f64() * 1e3);
}
}
}
Loading
Loading