Offer SCUNet and NLM alongside the guided denoise

The AI denoise panel now picks between three bases: the existing guided
filter, non-local means and a learned SCUNet model run through
onnxruntime-node on overlapping tiles. The base is part of the render key, so
each model keeps its own cached render and switching back is instant, and jobs
report stage and tile progress instead of a bare spinner.

onnxruntime-node is pinned to 1.23.0, the last release that ships both macOS
architectures, and every Docker and desktop install skips its CUDA download
because only the CPU binaries in the package are used. The SCUNet weights and
ONNX Runtime are added to the third-party notices, the deb copyright file and
the README's denoise, API and redistribution sections.
This commit is contained in:
2026-12-01 04:03:53 +00:00
parent b34d34dacb
commit f7942d0bd0
26 changed files with 945 additions and 161 deletions
+12 -2
View File
@@ -2475,10 +2475,14 @@ route('POST', '/api/photos/:id/denoise', async ({ req, res, params }) => {
if (!ownedBy(photoOwner(params.id), user)) return error(res, 404, 'Not found');
// Denoise the proxy the editor actually shows, not the raw: the result has to
// line up pixel for pixel with the canvas and with the client's export path.
// The Amount slider is the client's: the render is always full strength.
// The Amount slider is the client's: the render is always full strength. The
// base denoiser (guided / nlm / scunet) is chosen here and folded into the
// cache key, so each model renders to its own asset.
const source = findPreview(params.id) ?? findOriginal(params.id);
if (!source) return error(res, 404, 'Nothing to denoise');
const job = startDenoise({ photoId: params.id, sourcePath: source });
const body = await readJson(req).catch(() => ({}));
const base = body?.base === 'nlm' || body?.base === 'scunet' ? body.base : 'guided';
const job = startDenoise({ photoId: params.id, sourcePath: source, base });
return json(res, 202, { jobId: job.id, state: job.state });
});
@@ -2496,6 +2500,12 @@ route('GET', '/api/denoise/jobs/:id', async ({ req, res, params }) => {
error: job.error ?? null,
url: job.url ?? null,
stats: job.stats ?? null,
// Where a long run is, so the panel can name the stage instead of showing a
// spinner with no truth in it.
progress: job.progress ?? null,
// Without this the panel cannot tell a reused render from a fresh one and
// reports "Denoise ready" for both.
cached: Boolean(job.cached),
});
});