Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
selftests.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#ifndef DT_IOP_HIGHLIGHTS_SELFTESTS_H
20#define DT_IOP_HIGHLIGHTS_SELFTESTS_H
21
22// CPU/GPU parity self-tests of the harmonic OpenCL port (each vs a CPU replica).
23// Public API of this highlights harmonic-transposition module (a compiled TU). Include
24// this header to call into the module; internals are static in the .c. See common.h.
25
26
27#ifdef HAVE_OPENCL
28// Self-test (enable with HL_SPCL_TEST=1): factor + solve the 13-point biharmonic system on a
29// disc hole with both the CPU and the GPU sparse Cholesky solver, print the maximum
30// CPU-vs-GPU relative difference. Runs once per process.
31void _sp_chol_cl_selftest(const int devid, void *gd_void, const dt_dev_pixelpipe_t *pipe);
32#endif
33
34#ifdef HAVE_OPENCL
35// Self-test (enable with HL_BLURCL_TEST=1): blur a synthetic 4-channel plane with the CPU and
36// the GPU recursive gaussians, print the maximum CPU-vs-GPU absolute difference. Runs once per
37// process.
38void _region_blur_cl_selftest(const int devid, const dt_dev_pixelpipe_t *pipe);
39#endif
40
41#ifdef HAVE_OPENCL
42// self-test (HL_FILLCL_TEST=1): fill a synthetic plane with the CPU and GPU coarse-to-fine
43// Jacobi, print max abs difference over the filled cells. Run once per process.
44void _cf_harmonic_fill_cl_selftest(const int devid, void *gd_void, const dt_dev_pixelpipe_t *pipe);
45#endif
46
47#ifdef HAVE_OPENCL
48// Self-test (enable with HL_CFCL_TEST=1): compares the GPU joint coefficient-field stage
49// (_cf_joint_stage_cl) against an inline CPU replica of the exact production loops (pack,
50// blur, fit, fills, eval) on a synthetic correlated region with a green-clipped disc.
51// Prints the maximum CPU-vs-GPU absolute difference of est over the evaluated targets.
52void _cf_joint_stage_cl_selftest(const int devid, void *gd_void, const dt_dev_pixelpipe_t *pipe);
53#endif
54
55#ifdef HAVE_OPENCL
56// Self-test (enable with HL_CFCL_TEST=1, part 2): the COMPLETE coefficient-field stage
57// (_cf_stage_cl: joint + pair + deep cascade) against an inline CPU replica, on a
58// green-clipped disc with an inner red-clipped core (the occluded topology: strict targets,
59// multi-clip pair targets and the depth-split blend all exercised). Prints the maximum
60// CPU-vs-GPU absolute difference of est and of the fit-quality plane bsc.
61void _cf_stage_cl_selftest(const int devid, void *gd_void, const dt_dev_pixelpipe_t *pipe);
62#endif
63
64#ifdef HAVE_OPENCL
65// Self-test (enable with HL_HFCL_TEST=1): the high-frequency detail-band stage (_hf_stage_cl)
66// GPU vs an inline CPU replica, on the two-disc topology with textured content and a synthetic
67// fit-quality plane. Prints the maximum CPU-vs-GPU absolute difference.
68void _hf_stage_cl_selftest(const int devid, void *gd_void, const dt_dev_pixelpipe_t *pipe);
69#endif
70
71#ifdef HAVE_OPENCL
72// Self-test (enable with HL_DOMECL_TEST=1): clip floors + hue-coupled self-dome stage
73// (_selfdome_stage_cl) GPU vs the CPU production functions, on the two-disc topology with a
74// synthetic depth plane. Prints the maximum CPU-vs-GPU absolute difference. If a region dump
75// from HL_REG_DUMP exists in /tmp, replays that real region through both dome paths first.
76void _selfdome_stage_cl_selftest(const int devid, void *gd_void, const dt_dev_pixelpipe_t *pipe);
77#endif
78
79#ifdef HAVE_OPENCL
80// Self-test (enable with HL_CORECL_TEST=1): all-clip joint core (_joint_core_stage_cl) GPU vs
81// the CPU production path on a synthetic all-clip disc + partial-clip annulus; prints the
82// maximum CPU-vs-GPU absolute difference. Runs once per process.
83void _joint_core_stage_cl_selftest(const int devid, void *gd_void, const dt_dev_pixelpipe_t *pipe);
84#endif
85
86#ifdef HAVE_OPENCL
87// self-test (HL_ANISOCL_TEST=1): divergence-form aniso chroma GPU vs the CPU production path
88// on an all-clip disc with a textured surround, once per process
89void _aniso_stage_cl_selftest(const int devid, void *gd_void, const dt_dev_pixelpipe_t *pipe);
90
91// HL_CGRADCL_TEST: gradient-extending chroma stage, GPU vs the CPU _chromaticity_gradient
92void _chromaticity_gradient_stage_cl_selftest(const int devid, void *gd_void, const dt_dev_pixelpipe_t *pipe);
93#endif
94
95#ifdef HAVE_OPENCL
96// Self-test (enable with HL_REGCL_TEST=1): the full GPU region orchestrator
97// (_region_guided_filter_cl) vs the production CPU _region_guided_filter on one synthetic
98// staggered-clip blob; prints the mean and maximum CPU-vs-GPU absolute difference. Runs once
99// per process.
100void _region_guided_filter_cl_selftest(const int devid, void *gd_void, const dt_dev_pixelpipe_t *pipe);
101#endif
102
103#ifdef HAVE_OPENCL
104// Self-test (enable with HL_KNEECL_TEST=1): GPU knee estimate + apply
105// (_hl_knee_estimate_cl / _hl_knee_apply_cfa_cl) vs the CPU production path on a synthetic
106// Bayer (RGGB) mosaic with a soft saturation rolloff; prints the maximum CPU-vs-GPU
107// difference. Runs once per process.
108void _knee_cl_selftest(const int devid, void *gd_void, const dt_dev_pixelpipe_t *pipe);
109#endif
110#endif // DT_IOP_HIGHLIGHTS_SELFTESTS_H
void _hf_stage_cl_selftest(const int devid, void *gd_void, const dt_dev_pixelpipe_t *pipe)
Definition selftests.c:920
void _region_guided_filter_cl_selftest(const int devid, void *gd_void, const dt_dev_pixelpipe_t *pipe)
Definition selftests.c:1940
void _knee_cl_selftest(const int devid, void *gd_void, const dt_dev_pixelpipe_t *pipe)
Definition selftests.c:2046
void _joint_core_stage_cl_selftest(const int devid, void *gd_void, const dt_dev_pixelpipe_t *pipe)
Definition selftests.c:1400
void _selfdome_stage_cl_selftest(const int devid, void *gd_void, const dt_dev_pixelpipe_t *pipe)
Definition selftests.c:1168
void _aniso_stage_cl_selftest(const int devid, void *gd_void, const dt_dev_pixelpipe_t *pipe)
Definition selftests.c:1598
void _cf_harmonic_fill_cl_selftest(const int devid, void *gd_void, const dt_dev_pixelpipe_t *pipe)
Definition selftests.c:195
void _cf_stage_cl_selftest(const int devid, void *gd_void, const dt_dev_pixelpipe_t *pipe)
Definition selftests.c:564
void _region_blur_cl_selftest(const int devid, const dt_dev_pixelpipe_t *pipe)
Definition selftests.c:145
void _chromaticity_gradient_stage_cl_selftest(const int devid, void *gd_void, const dt_dev_pixelpipe_t *pipe)
Definition selftests.c:1786
void _cf_joint_stage_cl_selftest(const int devid, void *gd_void, const dt_dev_pixelpipe_t *pipe)
Definition selftests.c:302
void _sp_chol_cl_selftest(const int devid, void *gd_void, const dt_dev_pixelpipe_t *pipe)
Definition selftests.c:41