Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
locallaplacian.h
Go to the documentation of this file.
1/*
2 This file is part of darktable,
3 Copyright (C) 2016-2017 johannes hanika.
4 Copyright (C) 2016 Maximilian Trescher.
5 Copyright (C) 2017 Ulrich Pegelow.
6 Copyright (C) 2020 Pascal Obry.
7 Copyright (C) 2021 Chris Elston.
8 Copyright (C) 2022 Martin Bařinka.
9 Copyright (C) 2025-2026 Aurélien PIERRE.
10
11 darktable is free software: you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
15
16 darktable is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with darktable. If not, see <http://www.gnu.org/licenses/>.
23*/
24#ifndef DT_PIXEL_LOCALLAPLACIAN_H
25#define DT_PIXEL_LOCALLAPLACIAN_H
26
28#include "pixel/format.h" // dt_iop_roi_t
29
30// struct bundling all the auxiliary buffers
31// required to fill the boundary of a full res pipeline
32// with the coarse but complete roi preview pipeline
34{
35 int mode; // 0-regular, 1-preview/collect, 2-full/read
36 float *pad0; // padded preview buffer, grey levels (allocated via dt_alloc_align)
37 int wd; // preview width
38 int ht; // preview height
39 int pwd; // padded preview width
40 int pht; // padded preview height
41 const dt_iop_roi_t *roi; // roi of current view (pointing to pixelpipe roi)
42 const dt_iop_roi_t *buf; // dimensions of full buffer
43 float *output[30]; // output pyramid of preview pass (allocated via dt_alloc_align)
44 int num_levels; // number of levels in preview output pyramid
45}
47
48#if 0
49// WARNING: CRITICAL: why is this not used anywhere ?
50static void local_laplacian_boundary_free(local_laplacian_boundary_t *b)
51{
53 for(int l=0;l<b->num_levels;l++) dt_pixelpipe_cache_free_align(b->output[l]);
54 memset(b, 0, sizeof(*b));
55}
56#endif
57
59 const float *const input, // input buffer in some Labx or yuvx format
60 float *const out, // output buffer with colour
61 const int wd, // width and
62 const int ht, // height of the input buffer
63 const float sigma, // user param: separate shadows/mid-tones/highlights
64 const float shadows, // user param: lift shadows
65 const float highlights, // user param: compress highlights
66 const float clarity, // user param: increase clarity/local contrast
67 const int use_sse2, // switch on sse optimised version, if available
68 // the following is just needed for clipped roi with boundary conditions from coarse buffer (can be 0)
70
71static inline int local_laplacian(
72 const float *const input, // input buffer in some Labx or yuvx format
73 float *const out, // output buffer with colour
74 const int wd, // width and
75 const int ht, // height of the input buffer
76 const float sigma, // user param: separate shadows/mid-tones/highlights
77 const float shadows, // user param: lift shadows
78 const float highlights, // user param: compress highlights
79 const float clarity, // user param: increase clarity/local contrast
80 local_laplacian_boundary_t *b) // can be 0
81{
82 return local_laplacian_internal(input, out, wd, ht, sigma, shadows, highlights, clarity, 0, b);
83}
84
85size_t local_laplacian_memory_use(const int width, // width of input image
86 const int height); // height of input image
87
88
89size_t local_laplacian_singlebuffer_size(const int width, // width of input image
90 const int height); // height of input image
91
92#endif // DT_PIXEL_LOCALLAPLACIAN_H
93
94// clang-format off
95// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
96// vim: shiftwidth=2 expandtab tabstop=2 cindent
97// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
98// clang-format on
const dt_colormatrix_t dt_aligned_pixel_t out
size_t local_laplacian_memory_use(const int width, const int height)
int local_laplacian_internal(const float *const input, float *const out, const int wd, const int ht, const float sigma, const float shadows, const float highlights, const float clarity, const int use_sse2, local_laplacian_boundary_t *b)
size_t local_laplacian_singlebuffer_size(const int width, const int height)
static int local_laplacian(const float *const input, float *const out, const int wd, const int ht, const float sigma, const float shadows, const float highlights, const float clarity, local_laplacian_boundary_t *b)
uint32_t width
Definition mipmap_cache.c:0
uint32_t height
Definition mipmap_cache.c:1
#define dt_pixelpipe_cache_free_align(mem)
const float sigma
Region of interest passed through the pixelpipe.
Definition format.h:49
const dt_iop_roi_t * roi
const dt_iop_roi_t * buf