Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
gaussian.h
Go to the documentation of this file.
1/*
2 This file is part of darktable,
3 Copyright (C) 2012, 2017 Ulrich Pegelow.
4 Copyright (C) 2014, 2016 Tobias Ellinghaus.
5 Copyright (C) 2015-2016 Roman Lebedev.
6 Copyright (C) 2020 Aurélien PIERRE.
7 Copyright (C) 2020 Pascal Obry.
8 Copyright (C) 2021 Ralf Brown.
9 Copyright (C) 2022 Martin Bařinka.
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
25#pragma once
26
27#include "common/opencl.h"
28#include <assert.h>
29#include <math.h>
30
32{
33 DT_IOP_GAUSSIAN_ZERO = 0, // $DESCRIPTION: "order 0"
34 DT_IOP_GAUSSIAN_ONE = 1, // $DESCRIPTION: "order 1"
35 DT_IOP_GAUSSIAN_TWO = 2 // $DESCRIPTION: "order 2"
37
38
39typedef struct dt_gaussian_t
40{
42 float sigma;
43 int order;
44 float *max;
45 float *min;
46 float *buf;
48
49dt_gaussian_t *dt_gaussian_init(const int width, const int height, const int channels, const float *max,
50 const float *min, const float sigma, const int order);
51
52size_t dt_gaussian_memory_use(const int width, const int height, const int channels);
53#ifdef HAVE_OPENCL
54size_t dt_gaussian_memory_use_cl(const int width, const int height, const int channels);
55#endif
56
57size_t dt_gaussian_singlebuffer_size(const int width, const int height, const int channels);
58
59void dt_gaussian_blur(dt_gaussian_t *g, const float *const in, float *const out);
60
61void dt_gaussian_blur_4c(dt_gaussian_t *g, const float *const in, float *const out);
62
64
65
66#ifdef HAVE_OPENCL
67typedef struct dt_gaussian_cl_global_t
68{
69 int kernel_gaussian_column_4c, kernel_gaussian_transpose_4c;
70 int kernel_gaussian_column_1c, kernel_gaussian_transpose_1c;
71} dt_gaussian_cl_global_t;
72
73
74typedef struct dt_gaussian_cl_t
75{
76 dt_gaussian_cl_global_t *global;
77 int devid;
78 int width, height, channels;
79 int blocksize;
80 size_t bwidth, bheight;
81 float sigma;
82 int order;
83 float *min;
84 float *max;
85 cl_mem dev_temp1;
86 cl_mem dev_temp2;
87} dt_gaussian_cl_t;
88
89dt_gaussian_cl_global_t *dt_gaussian_init_cl_global(void);
90
91void dt_gaussian_free_cl_global(dt_gaussian_cl_global_t *g);
92
93dt_gaussian_cl_t *dt_gaussian_init_cl(const int devid, const int width, const int height, const int channels,
94 const float *max, const float *min, const float sigma, const int order);
95
96cl_int dt_gaussian_blur_cl(dt_gaussian_cl_t *g, cl_mem dev_in, cl_mem dev_out);
97
98void dt_gaussian_free_cl(dt_gaussian_cl_t *g);
99#endif
100
101// clang-format off
102// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
103// vim: shiftwidth=2 expandtab tabstop=2 cindent
104// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
105// clang-format on
106
int width
Definition bilateral.h:1
int height
Definition bilateral.h:1
const float g
Definition colorspaces_inline_conversions.h:925
static const float const float const float min
Definition colorspaces_inline_conversions.h:667
const float max
Definition colorspaces_inline_conversions.h:721
static const dt_colormatrix_t dt_aligned_pixel_t out
Definition colorspaces_inline_conversions.h:184
void dt_gaussian_free(dt_gaussian_t *g)
Definition gaussian.c:514
void dt_gaussian_blur(dt_gaussian_t *g, const float *const in, float *const out)
Definition gaussian.c:173
size_t dt_gaussian_singlebuffer_size(const int width, const int height, const int channels)
Definition gaussian.c:111
dt_gaussian_order_t
Definition gaussian.h:32
@ DT_IOP_GAUSSIAN_TWO
Definition gaussian.h:35
@ DT_IOP_GAUSSIAN_ONE
Definition gaussian.h:34
@ DT_IOP_GAUSSIAN_ZERO
Definition gaussian.h:33
void dt_gaussian_blur_4c(dt_gaussian_t *g, const float *const in, float *const out)
Definition gaussian.c:503
dt_gaussian_t * dt_gaussian_init(const int width, const int height, const int channels, const float *max, const float *min, const float sigma, const int order)
Definition gaussian.c:125
size_t dt_gaussian_memory_use(const int width, const int height, const int channels)
Definition gaussian.c:95
Definition gaussian.h:40
float * buf
Definition gaussian.h:46
int channels
Definition gaussian.h:41
float * min
Definition gaussian.h:45
float * max
Definition gaussian.h:44
int height
Definition gaussian.h:41
int order
Definition gaussian.h:43
float sigma
Definition gaussian.h:42
int width
Definition gaussian.h:41