Commit Graph
25 Commits
Author SHA1 Message Date
Dylan M. Taylor 6aff3fb525 WIP: lensdb on craft-xml (not built) 2026-11-12 01:05:36 +00:00
Dylan M. Taylor f786b87533 security(meta): linear entity decoding, indexed keyword de-duplication, bounded XMP path building (#3672)
* security(meta): linear entity decoding, indexed keyword de-duplication, bounded XMP path building

* address review: decode zero-padded numeric references in the three entity decoders
2026-11-11 04:26:21 -05:00
FredApps be6a90064f Merge remote-tracking branch 'origin/main' into pr-2676
# Conflicts:
#	crates/lensdb/src/lib.rs
2026-11-04 13:14:40 +01:00
FredApps ecbb77442c Merge remote-tracking branch 'origin/main' into pr-3697
# Conflicts:
#	crates/lensdb/src/tests.rs
2026-11-04 12:25:18 +01:00
FredApps f1ecfb724c Merge remote-tracking branch 'origin/main' into pr-2676 2026-11-04 12:23:28 +01:00
FredApps 1c1eec5179 security(lensdb): refuse a non-regular *.xml before opening it (opening a FIFO blocks)
The pathname is checked before File::open as well as the opened file after it: File::open on a FIFO blocks until a writer appears, so the post-open check alone never ran for one. Adds a unix regression test that hung before the fix.
2026-11-04 11:58:39 +01:00
FredApps c8887dabca Merge remote-tracking branch 'origin/main' into pr-3660
# Conflicts:
#	crates/lensdb/src/tests.rs
2026-11-04 11:55:19 +01:00
Dylan M. Taylor f7e43a4a45 address review: charge name allocations and only kept calibrations to the copy budget 2026-11-03 23:58:25 +00:00
Dylan M. Taylor 6fee4fbacd security(lensdb): bound the names calibrations copy, read database files through the opened regular file 2026-11-03 17:46:15 +00:00
r3d42-gitandCodex d72f3840bc LR-EDIT-OPTICS-PROFILE: prefer known crop in fixed-lens score ties
Use the same exact-score known-crop preference as best_lens in the built-in fixed-lens fallback. Preserve higher-score priority and cover both profile orders through the public lookup API.

Validated with 33 lensdb and 5 engine lens-profile tests, plus full cargo xtask ci (8/8, Rust 1.95.0, Apple M5 Max Metal and WASM). The new tie regression fails against the previously published selector. No workflows or lockfile changes.

Co-authored-by: Codex <noreply@openai.com>
2026-11-02 10:21:22 +01:00
r3d42-gitandCodex d55b2a56df LR-EDIT-OPTICS-PROFILE: prefer usable calibration on equal matches
Prefer a known calibration crop only on exact lens-score ties, preserving higher-score selection. Keep hostile numeric model fixtures active with valid calibration crop.

Co-authored-by: Codex <noreply@openai.com>
2026-11-01 19:42:08 +01:00
r3d42-gitandCodex dd7c2bfe14 LR-EDIT-OPTICS-PROFILE: synchronize unknown-crop fix with main
Merge upstream main at 496524ced5 without rewriting published history. Preserve current upstream fixes and retain only the independent feature change in the resulting PR diff.

Co-authored-by: Codex <noreply@openai.com>
2026-11-01 18:56:04 +01:00
aiongg 97e9c15a36 Merge PR #3013: LR-EDIT-OPTICS-PROFILE: lens profiles for compact cameras with a built-in lens 2026-10-31 02:09:32 +00:00
aiongg 020622aadf Merge PR #2776: Reject signed numeric character references in XML entity decoding
crates/meta/src/xmp.rs: kept main's 'mod tests;' (tests moved to xmp/tests.rs); PR's new test ported there.
2026-10-31 02:06:49 +00:00
Max MittelstädtandGPT-6-Luna b25808686d Reject mismatched XML closing tags
Found while testing crates/lensdb/src/xml.rs:77

Co-Authored-By: GPT-6-Luna <noreply@openai.com>
2026-10-30 06:10:13 +00:00
Andrew FrahnandClaude Opus 5.5 0b91a1de87 LR-EDIT-OPTICS-PROFILE: fixed-lens lookup only by name-free lookups; no-make models and infinite focals
find_lens_named no longer falls back to the camera's mount (it must stay an
exact-name match); a model without an EXIF make still finds the camera when
it starts with the maker's word; infinite focal lengths parsed from EXIF are
ignored and a non-finite widened range matches nothing. Review feedback.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 11:43:53 +11:00
KaanandClaude Opus 5.5 5051d7b3b3 LR-EDIT-OPTICS-PROFILE: match built-in-lens compacts by camera mount and focal range
lensfun names a compact camera's built-in lens after the camera and gives it
the camera's own mount, while EXIF reports only a focal / aperture range
("6.0-72.0 mm f/2.7-3.5"), so no profile was found. When the name lookup finds
nothing, take the camera's mount (only when it has at most four profiles, i.e.
not an interchangeable mount) and pick the profile whose calibrated focal
lengths lie inside the EXIF range. Camera lookups also drop the maker's word
from model names ("Canon PowerShot S5 IS" matches "PowerShot S5 IS").

Adds a hostile-number test: infinite, NaN, huge or negative database values
give finite corrections or none, and odd names find nothing without panicking.

Sources: own design (lensfun XML format documentation).

(cherry picked from commit 24ebc3bea9)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 11:19:32 +11:00
NetterSilverandClaude Haiku 5.5 e0519d4300 Reject signed numeric character references in XML entity decoding
Found while testing crates/meta/src/xmp.rs:184 (entity); the same pattern is in crates/lensdb/src/xml.rs:45 and crates/engine/src/preset_luminar.rs:90

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-24 06:02:56 +00:00
r3d42-git 2e46e9df52 LR-EDIT-OPTICS-PROFILE: preserve unknown crop factors
Keep missing and invalid camera/calibration crops optional. Only absent calibration overrides inherit the parent scale; decline corrections with unknown calibration scale and preserve EXIF fallback for unknown camera crops.

Add synthetic parser, conversion and engine regressions and document the contract. The crop-only patch is unchanged from a4064b33. Full cargo xtask ci passes all eight gates on current upstream main plus the separate #2544 prerequisite.
2026-10-23 11:07:41 +02:00
eliets2 81290dd6dd Address review findings on the new test and fix 2026-10-22 15:05:19 +03:00
eliets2 0145be70ea 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.
2026-10-22 13:24:46 +03:00
nerdislbandClaude Opus 5.5 cb61588e7d LR-EDIT-OPTICS-PROFILE: find the profile named by a lens specification behind a tie
Another maker's lens with the same specification ("Otherco 18-55mm f/3.5-5.6")
scores as high as the profile aliased "18-55mm f/3.5-5.6"; when it came first,
find_lens kept it and the exact-name check then refused it, so the alias was
never used. LensDb::find_lens_named ranks only the profiles named exactly so,
with the same maker and mount preferences (review on #2217).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 18:42:50 +02:00
nerdislbandClaude Opus 5.5 067f4fdf1e LR-EDIT-OPTICS-PROFILE: look up Nikon DSLR lenses by their lens specification
Nikon DSLRs write no Exif LensModel, only the lens specification (maker note
0x0084, read into Metadata::lens_spec), so the lensfun-format lens database never
corrected their raws. A raw without a lens model is now looked up by a name built
from its specification ("24-70mm f/2.8", lightcraft_lensdb::spec_name), and a
profile is used only when one of its names is exactly that
(Profile::names_exactly): the specification fits every maker's lens with that
range, so a partial match or a maker-named entry is never taken. lensfun's own
database has no such names; a user aliases the one lens they own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 18:42:50 +02:00
DennisandClaude Opus 5.5 4ddbb5a398 LR-EDIT-OPTICS-PROFILE: in-camera crop modes get the frame's crop factor, not the body's
A lensfun profile is scaled by the crop factor of the recorded frame. `lookup` took the body's from the
database whenever the camera was in it, so a full-frame body shooting a crop of its sensor (APS-C /
Super 35 mode, or switched there by an APS-C lens) had the profile applied as if the crop were the full
frame: the crop's corners got the full frame's corner distortion and vignetting. On a Sony ILCE-1M2 in
APS-C mode with the FE 100-400mm F4.5-5.6 GM OSS at 400 mm, the warp's r³ coefficient was the full
frame's 0.0215 instead of 0.0096.

The 35 mm equivalent focal length shows the crop: when it implies a crop factor more than 10 % above the
body's, that wins (`frame_crop_factor`); within 10 % the difference is the tag's whole-millimetre
rounding and the body's value stands. Without the body in the database the 35 mm equivalent is used, as
before.

Tests: `in_camera_crop_mode_uses_the_frames_crop_factor` (fails on main: in its profile the APS-C frame's
vignetting gain is 0.40 instead of 0.18) covers APS-C mode, full frame, a 35 mm equivalent rounded by a
millimetre, no body in the database and a hostile focal length. Checked on 19 private ILCE-1M2 ARWs
(FE 100-400mm GM, Sigma 24-70mm F2.8 DG DN | Art, full frame and APS-C, firmware 2.01-4.00): every
APS-C coefficient is the full-frame one scaled by 1/1.5².

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 22:50:54 +02:00
Andrew FrahnandClaude Opus 5.5 00ea386f7f lensdb: lens distortion (poly3/poly5/PTLens), TCA (linear/poly3) and vignetting (pa) profiles, lensfun-format loader
Profiles are interpolated in focal length (vignetting also in aperture and
focus distance), scaled by crop factor, and converted by least squares to the
DNG WarpRectilinear / FixVignetteRadial polynomials the pipeline already
applies. The lensfun database (CC-BY-SA) is only read from a directory the
user supplies; nothing is bundled.

Sources: lensfun's published database format and lens calibration
documentation (no lensfun code read), PanoTools wiki (a, b, c distortion
model), DNG specification 1.6 (WarpRectilinear, FixVignetteRadial);
interpolation and fitting: own design.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-11 19:30:18 +11:00