Replace the Lensfun WebAssembly runtime with our own lens engine.
The wrapper's wasm, its 5 MB data blob and the runtime chunk were fragile to serve (CSP, MIME, cache) and pulled an LGPL runtime into the bundle just for calibration data. The Lensfun XML is now converted at build time into public/lens-db/profiles.json, and search, matching and the correction maths live in src/lib/lensDb.ts and src/lib/lensEngine.ts. Maps are pinned against output captured from the previous implementation, so results are unchanged. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
@@ -2,7 +2,7 @@ import { useEffect, useRef, useState } from 'react';
|
||||
import { get16BitSource, getBitmap } from '../lib/images';
|
||||
import type { Preview16 } from '../lib/preview16';
|
||||
import { rotatedBounds, Renderer } from '../gl/renderer';
|
||||
import { buildLensCorrection, type LensCorrection } from '../lib/lensfun';
|
||||
import { buildLensCorrection, type LensCorrection } from '../lib/lensEngine';
|
||||
import type { PhotoRecord } from '../types';
|
||||
|
||||
interface Props {
|
||||
|
||||
@@ -19,7 +19,7 @@ import {
|
||||
correctLensPoint,
|
||||
uncorrectLensPoint,
|
||||
type LensCorrection,
|
||||
} from '../lib/lensfun';
|
||||
} from '../lib/lensEngine';
|
||||
import {
|
||||
frameToSource,
|
||||
rotatedBounds,
|
||||
|
||||
@@ -37,7 +37,7 @@ import {
|
||||
type SavedCameraProfile,
|
||||
} from '../lib/dcpLibrary';
|
||||
import { usePresetThumbs } from './PresetThumbs';
|
||||
import { availableFor, findLensForMeta, searchLens, type LensSearchResult } from '../lib/lensfun';
|
||||
import { availableFor, findLensForMeta, searchLens, type LensSearchResult } from '../lib/lensDb';
|
||||
import {
|
||||
getCameraLensDefault,
|
||||
removeCameraLensDefault,
|
||||
@@ -1905,8 +1905,9 @@ export function OpticsPanel({
|
||||
};
|
||||
}, [profile]);
|
||||
|
||||
const applyProfile = (result: Pick<LensSearchResult, 'maker' | 'model' | 'crop'>) => {
|
||||
const applyProfile = (result: Pick<LensSearchResult, 'id' | 'maker' | 'model' | 'crop'>) => {
|
||||
const next: LensProfile = {
|
||||
id: result.id,
|
||||
maker: result.maker,
|
||||
model: result.model,
|
||||
crop: result.crop,
|
||||
|
||||
Reference in New Issue
Block a user