Show camera profiles in every view and remember proof and DCP settings.

A profile chosen for a raw only changed Develop and exports, so the grid,
Compare and preset previews could disagree with the file. They now grade
camera-native samples, while the proof profile persists with a rendering
intent and DCP matrices can be reused per camera body.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
2026-11-28 04:04:44 +00:00
parent 0c113e7a91
commit 637629385a
16 changed files with 720 additions and 39 deletions
+38
View File
@@ -141,7 +141,45 @@ export async function get16BitSource(photo: PhotoRecord): Promise<Preview16 | nu
return parsed;
}
const cameraThumbCache = new Map<string, Preview16 | null>();
/**
* Camera-native grid thumbnail for a raw, or null when the server has none.
*
* The grid otherwise renders the sRGB JPEG, whose body matrix is already baked
* in, so a loaded DCP profile would only show in Develop. This is the sidecar
* resized to the JPEG thumbnail's dimensions, small enough to fetch per tile;
* null (a normal state for older imports) falls back to the JPEG.
*/
export async function getCameraThumb(photo: PhotoRecord): Promise<Preview16 | null> {
if (!photo.raw) return null;
const key = `${photo.id}|${photo.previewVersion ?? 0}`;
const hit = cameraThumbCache.get(key);
if (hit !== undefined) return hit;
try {
const res = await fetch(`/api/photos/${encodeURIComponent(photo.id)}/thumb16`, {
credentials: 'same-origin',
});
if (!res.ok) {
cameraThumbCache.set(key, null);
return null;
}
const parsed = await parsePreview16(await res.arrayBuffer());
cameraThumbCache.set(key, parsed);
while (cameraThumbCache.size > 12) {
const first = cameraThumbCache.keys().next();
if (first.done) break;
cameraThumbCache.delete(first.value);
}
return parsed;
} catch {
// A dropped connection is retried on the next tile, not cached as missing.
return null;
}
}
export function clearBitmapCache() {
cameraThumbCache.clear();
for (const bmp of cache.values()) bmp.close();
cache.clear();
for (const bmp of denoisedCache.values()) bmp.close();