Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
nlmeans_core.h
Go to the documentation of this file.
1/*
2 This file is part of darktable,
3 Copyright (C) 2020 Ralf Brown.
4 Copyright (C) 2022 Martin Bařinka.
5 Copyright (C) 2025 Aurélien PIERRE.
6 Copyright (C) 2026 Guillaume Stutin.
7
8 darktable is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
13 darktable is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with darktable. If not, see <http://www.gnu.org/licenses/>.
20*/
21#ifndef DT_PIXEL_NLMEANS_CORE_H
22#define DT_PIXEL_NLMEANS_CORE_H
23
24#include "iop/iop_api.h"
25#include "pixel/format.h"
26
28{
29 float scattering; // scattering factor for patches (default 0 = densest possible)
30 float scale; // image scaling, affects scattering
31 float luma; // blend amount, L channel in Lab (set to 1.00 for RGB)
32 float chroma; // blend amount, a/b channels (set to 1.00 for RBG)
33 float center_weight; // weighting of central pixel in patch (<0 for no special handling; used by denoise[non-local])
34 float sharpness; // relative weight of central pixel (preserves detail), ignored if center_weight >= 0
35 int patch_radius; // radius of patches which are compared, 1..4
36 int search_radius; // radius around a pixel in which to compare patches (default = 7)
37 int decimate; // set to 1 to search only half the patches in the neighborhood (default = 0)
38 const float* const norm; // array of four per-channel weight factors
39 const struct dt_dev_pixelpipe_t *pipe; // whose killswitch abandons the run; NULL never abandons
40 int kernel_init; // CL: initialization (runs once)
41 int kernel_dist; // CL: compute channel-normed squared pixel differences (runs for each patch)
42 int kernel_horiz; // CL: horizontal sum (runs for each patch)
43 int kernel_vert; // CL: vertical sum (runs for each patch)
44 int kernel_accu; // CL: add to output pixel (runs for each patch)
45};
47
48// Returns 0, or 1 when the scratch allocation failed or the pipe abandoned the run (outbuf is then garbage).
49int nlmeans_denoise(const float *const inbuf, float *const outbuf,
50 const dt_iop_roi_t *const roi_in, const dt_iop_roi_t *const roi_out,
51 const dt_nlmeans_param_t *const params);
52
53void nlmeans_denoise_sse2(const float *const inbuf, float *const outbuf,
54 const dt_iop_roi_t *const roi_in, const dt_iop_roi_t *const roi_out,
55 const dt_nlmeans_param_t *const params);
56
57#ifdef HAVE_OPENCL
58int nlmeans_denoise_cl(const dt_nlmeans_param_t *const params, const int devid,
59 cl_mem dev_in, cl_mem dev_out, const dt_iop_roi_t *const roi_in);
60int nlmeans_denoiseprofile_cl(const dt_nlmeans_param_t *const params, const int devid,
61 cl_mem dev_in, cl_mem dev_out, const dt_iop_roi_t *const roi_in);
62#endif /* HAVE_OPENCL */
63
64#endif // DT_PIXEL_NLMEANS_CORE_H
65
66// clang-format off
67// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
68// vim: shiftwidth=2 expandtab tabstop=2 cindent
69// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
70// clang-format on
static const dt_iop_drawlayer_params_t * params
Definition layers.h:80
int nlmeans_denoise(const float *const inbuf, float *const outbuf, const dt_iop_roi_t *const roi_in, const dt_iop_roi_t *const roi_out, const dt_nlmeans_param_t *const params)
void nlmeans_denoise_sse2(const float *const inbuf, float *const outbuf, const dt_iop_roi_t *const roi_in, const dt_iop_roi_t *const roi_out, const dt_nlmeans_param_t *const params)
int nlmeans_denoise_cl(const dt_nlmeans_param_t *const params, const int devid, cl_mem dev_in, cl_mem dev_out, const dt_iop_roi_t *const roi_in)
int nlmeans_denoiseprofile_cl(const dt_nlmeans_param_t *const params, const int devid, cl_mem dev_in, cl_mem dev_out, const dt_iop_roi_t *const roi_in)
Region of interest passed through the pixelpipe.
Definition format.h:49
const float *const norm
const struct dt_dev_pixelpipe_t * pipe