Apply the lens vignetting gain in linear light.
Lensfun's vignetting coefficients describe linear transmission, so multiplying them into the sRGB-encoded proxy brightened the corners far more than the lens had lost and over-exposed the edges. The gain now runs after the decode, in both the grade and the eyedropper. Existing records that stored the old auto-enabled flag are cleared once, on the server catalogue at boot and in the browser cache on its next IndexedDB upgrade, and the Optics panel says when the correction is off.
This commit is contained in:
@@ -431,6 +431,36 @@ function lensProfile(input: unknown): LensProfile | undefined {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* One-off cleanup for records saved while applying a lens profile enabled all
|
||||
* three corrections. The vignetting gain over-exposed the edges on the tone
|
||||
* mapped proxy, so it is opt-in now; this clears the flag old edits stored,
|
||||
* including snapshots and history, and returns null when nothing needed doing.
|
||||
*/
|
||||
export function withoutLensVignetting(photo: PhotoRecord): PhotoRecord | null {
|
||||
let changed = false;
|
||||
const strip = (edits: Edits): Edits => {
|
||||
const lens = edits.lens;
|
||||
if (!lens || lens.corrections.vignetting !== true) return edits;
|
||||
changed = true;
|
||||
return {
|
||||
...edits,
|
||||
lens: { ...lens, corrections: { ...lens.corrections, vignetting: false } },
|
||||
};
|
||||
};
|
||||
const edits = strip(photo.edits);
|
||||
const snapshots = photo.snapshots?.map((snapshot) => ({
|
||||
...snapshot,
|
||||
edits: strip(snapshot.edits),
|
||||
}));
|
||||
const history = photo.history?.map((entry) => ({ ...entry, edits: strip(entry.edits) }));
|
||||
if (!changed) return null;
|
||||
const next: PhotoRecord = { ...photo, edits };
|
||||
if (snapshots) next.snapshots = snapshots;
|
||||
if (history) next.history = history;
|
||||
return next;
|
||||
}
|
||||
|
||||
/**
|
||||
* Keeps a stored camera profile usable: a profile with a missing or non-finite
|
||||
* matrix would black out the photo, so it is dropped instead.
|
||||
|
||||
Reference in New Issue
Block a user