Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
dome.h
Go to the documentation of this file.
1/*
2 This file is part of Ansel,
3 Copyright (C) 2026 Aurélien PIERRE.
4
5 Ansel is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 Ansel is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with darktable. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#pragma once
20
21// Biharmonic luminance dome solve (CPU + OpenCL).
22// Public API of this highlights harmonic-transposition module (a compiled TU). Include
23// this header to call into the module; internals are static in the .c. See common.h.
24
25#include "common/opencl.h"
27#include <stdint.h>
28
29void _biharmonic_dome(float *const restrict field, const uint8_t *const restrict hole, const int region_w,
30 const int region_h, const int forced_downsample, const dt_dev_pixelpipe_t *pipe);
31
32#if defined(HAVE_OPENCL) && DT_HL_SPARSE_SOLVE
33// Biharmonic dome (smooth hill continuing the rim brightness into a fully-clipped area,
34// smooth in value AND slope) as a GPU unit: coarse-grid reduction on device, tiny
35// coarse-metadata download for the symbolic analysis and matrix assembly (<= a few hundred
36// KB of COARSE cells, never full-res planes), GPU sparse Cholesky solve, bilinear upsample
37// into the full-res holes on device.
38// field/hole are full-res device buffers (float / uchar); ds (downsample factor) forced by
39// the caller like the CPU _biharmonic_dome's force_ds.
40// Mirrors _biharmonic_dome on the CPU: any change here must be mirrored there and
41// re-validated with the HL_DOMECL_TEST self-test (_selfdome_stage_cl_selftest).
42//
43// MATHS BRIDGE -- article "Biharmonic inpainting" / E_bihar: solves Delta^2 u = 0 on the (coarse)
44// hole with u|dOmega = u_valid Dirichlet data, so the rim curvature is extended into a smooth dome
45// (value AND slope continued). Restricting the SPD biharmonic operator to the hole unknowns gives
46// the linear system A u = b factored below by the GPU sparse Cholesky (SPD system, annotated in
47// common/solvers/sparse_cholesky.h); the bilinear upsample restores the low-frequency dome to full res.
48cl_int _biharmonic_dome_cl(const int devid, void *gd_void, cl_mem field, cl_mem hole, const int region_w,
49 const int region_h, const int downsample, const dt_dev_pixelpipe_t *pipe);
50#endif
void _biharmonic_dome(float *const restrict field, const uint8_t *const restrict hole, const int region_w, const int region_h, const int forced_downsample, const dt_dev_pixelpipe_t *pipe)
Definition dome.c:33