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#pragma once
25
26#include "develop/imageop.h"
27
28// struct bundling all the auxiliary buffers
29// required to fill the boundary of a full res pipeline
30// with the coarse but complete roi preview pipeline
32{
33 int mode; // 0-regular, 1-preview/collect, 2-full/read
34 float *pad0; // padded preview buffer, grey levels (allocated via dt_alloc_align)
35 int wd; // preview width
36 int ht; // preview height
37 int pwd; // padded preview width
38 int pht; // padded preview height
39 const dt_iop_roi_t *roi; // roi of current view (pointing to pixelpipe roi)
40 const dt_iop_roi_t *buf; // dimensions of full buffer
41 float *output[30]; // output pyramid of preview pass (allocated via dt_alloc_align)
42 int num_levels; // number of levels in preview output pyramid
43}
45
46#if 0
47// WARNING: CRITICAL: why is this not used anywhere ?
48static void local_laplacian_boundary_free(local_laplacian_boundary_t *b)
49{
51 for(int l=0;l<b->num_levels;l++) dt_pixelpipe_cache_free_align(b->output[l]);
52 memset(b, 0, sizeof(*b));
53}
54#endif
55
57 const float *const input, // input buffer in some Labx or yuvx format
58 float *const out, // output buffer with colour
59 const int wd, // width and
60 const int ht, // height of the input buffer
61 const float sigma, // user param: separate shadows/mid-tones/highlights
62 const float shadows, // user param: lift shadows
63 const float highlights, // user param: compress highlights
64 const float clarity, // user param: increase clarity/local contrast
65 const int use_sse2, // switch on sse optimised version, if available
66 // the following is just needed for clipped roi with boundary conditions from coarse buffer (can be 0)
68
70 const float *const input, // input buffer in some Labx or yuvx format
71 float *const out, // output buffer with colour
72 const int wd, // width and
73 const int ht, // height of the input buffer
74 const float sigma, // user param: separate shadows/mid-tones/highlights
75 const float shadows, // user param: lift shadows
76 const float highlights, // user param: compress highlights
77 const float clarity, // user param: increase clarity/local contrast
78 local_laplacian_boundary_t *b) // can be 0
79{
80 return local_laplacian_internal(input, out, wd, ht, sigma, shadows, highlights, clarity, 0, b);
81}
82
83size_t local_laplacian_memory_use(const int width, // width of input image
84 const int height); // height of input image
85
86
87size_t local_laplacian_singlebuffer_size(const int width, // width of input image
88 const int height); // height of input image
89
90
91#if defined(__SSE2__)
92int local_laplacian_sse2(
93 const float *const input, // input buffer in some Labx or yuvx format
94 float *const out, // output buffer with colour
95 const int wd, // width and
96 const int ht, // height of the input buffer
97 const float sigma, // user param: separate shadows/mid-tones/highlights
98 const float shadows, // user param: lift shadows
99 const float highlights, // user param: compress highlights
100 const float clarity, // user param: increase clarity/local contrast
101 local_laplacian_boundary_t *b) // can be 0
102{
103 return local_laplacian_internal(input, out, wd, ht, sigma, shadows, highlights, clarity, 1, b);
104}
105#endif
106// clang-format off
107// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
108// vim: shiftwidth=2 expandtab tabstop=2 cindent
109// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
110// clang-format on
int width
Definition bilateral.h:1
int height
Definition bilateral.h:1
const float b
Definition colorspaces_inline_conversions.h:1326
static const dt_colormatrix_t dt_aligned_pixel_t out
Definition colorspaces_inline_conversions.h:184
#define dt_pixelpipe_cache_free_align(mem)
Definition darktable.h:377
size_t local_laplacian_memory_use(const int width, const int height)
Definition locallaplacian.c:819
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)
Definition locallaplacian.h:69
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)
Definition locallaplacian.c:577
size_t local_laplacian_singlebuffer_size(const int width, const int height)
Definition locallaplacian.c:835
Definition imageop.h:67
Definition locallaplacian.h:32
int mode
Definition locallaplacian.h:33
int num_levels
Definition locallaplacian.h:42
int wd
Definition locallaplacian.h:35
float * output[30]
Definition locallaplacian.h:41
int ht
Definition locallaplacian.h:36
float * pad0
Definition locallaplacian.h:34
const dt_iop_roi_t * roi
Definition locallaplacian.h:39
int pwd
Definition locallaplacian.h:37
const dt_iop_roi_t * buf
Definition locallaplacian.h:40
int pht
Definition locallaplacian.h:38