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
7 darktable is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 darktable is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with darktable. If not, see <http://www.gnu.org/licenses/>.
19*/
20#ifndef DT_PIXEL_NLMEANS_CORE_H
21#define DT_PIXEL_NLMEANS_CORE_H
22
23#include "iop/iop_api.h"
24#include "develop/develop.h"
25
27{
28 float scattering; // scattering factor for patches (default 0 = densest possible)
29 float scale; // image scaling, affects scattering
30 float luma; // blend amount, L channel in Lab (set to 1.00 for RGB)
31 float chroma; // blend amount, a/b channels (set to 1.00 for RBG)
32 float center_weight; // weighting of central pixel in patch (<0 for no special handling; used by denoise[non-local])
33 float sharpness; // relative weight of central pixel (preserves detail), ignored if center_weight >= 0
34 int patch_radius; // radius of patches which are compared, 1..4
35 int search_radius; // radius around a pixel in which to compare patches (default = 7)
36 int decimate; // set to 1 to search only half the patches in the neighborhood (default = 0)
37 const float* const norm; // array of four per-channel weight factors
39 int kernel_init; // CL: initialization (runs once)
40 int kernel_dist; // CL: compute channel-normed squared pixel differences (runs for each patch)
41 int kernel_horiz; // CL: horizontal sum (runs for each patch)
42 int kernel_vert; // CL: vertical sum (runs for each patch)
43 int kernel_accu; // CL: add to output pixel (runs for each patch)
44};
46
47void nlmeans_denoise(const float *const inbuf, float *const outbuf,
48 const dt_iop_roi_t *const roi_in, const dt_iop_roi_t *const roi_out,
49 const dt_nlmeans_param_t *const params);
50
51void nlmeans_denoise_sse2(const float *const inbuf, float *const outbuf,
52 const dt_iop_roi_t *const roi_in, const dt_iop_roi_t *const roi_out,
53 const dt_nlmeans_param_t *const params);
54
55#ifdef HAVE_OPENCL
56int nlmeans_denoise_cl(const dt_nlmeans_param_t *const params, const int devid,
57 cl_mem dev_in, cl_mem dev_out, const dt_iop_roi_t *const roi_in);
58int nlmeans_denoiseprofile_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);
60#endif /* HAVE_OPENCL */
61
62#endif // DT_PIXEL_NLMEANS_CORE_H
63
64// clang-format off
65// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
66// vim: shiftwidth=2 expandtab tabstop=2 cindent
67// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
68// clang-format on
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)
void 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)
dt_dev_pixelpipe_type_t
Definition pixelpipe.h:40
Region of interest passed through the pixelpipe.
Definition format.h:49
const float *const norm
dt_dev_pixelpipe_type_t pipetype