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-2020 darktable developers.
4
5 darktable is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 darktable is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with darktable. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19#pragma once
20
21#include "common/opencl.h"
22#include <assert.h>
23#include <math.h>
24
26{
27 DT_IOP_GAUSSIAN_ZERO = 0, // $DESCRIPTION: "order 0"
28 DT_IOP_GAUSSIAN_ONE = 1, // $DESCRIPTION: "order 1"
29 DT_IOP_GAUSSIAN_TWO = 2 // $DESCRIPTION: "order 2"
31
32
33typedef struct dt_gaussian_t
34{
36 float sigma;
37 int order;
38 float *max;
39 float *min;
40 float *buf;
42
43dt_gaussian_t *dt_gaussian_init(const int width, const int height, const int channels, const float *max,
44 const float *min, const float sigma, const int order);
45
46size_t dt_gaussian_memory_use(const int width, const int height, const int channels);
47#ifdef HAVE_OPENCL
48size_t dt_gaussian_memory_use_cl(const int width, const int height, const int channels);
49#endif
50
51size_t dt_gaussian_singlebuffer_size(const int width, const int height, const int channels);
52
53void dt_gaussian_blur(dt_gaussian_t *g, const float *const in, float *const out);
54
55void dt_gaussian_blur_4c(dt_gaussian_t *g, const float *const in, float *const out);
56
58
59
60#ifdef HAVE_OPENCL
61typedef struct dt_gaussian_cl_global_t
62{
63 int kernel_gaussian_column_4c, kernel_gaussian_transpose_4c;
64 int kernel_gaussian_column_1c, kernel_gaussian_transpose_1c;
65} dt_gaussian_cl_global_t;
66
67
68typedef struct dt_gaussian_cl_t
69{
70 dt_gaussian_cl_global_t *global;
71 int devid;
72 int width, height, channels;
73 int blocksize;
74 size_t bwidth, bheight;
75 float sigma;
76 int order;
77 float *min;
78 float *max;
79 cl_mem dev_temp1;
80 cl_mem dev_temp2;
81} dt_gaussian_cl_t;
82
83dt_gaussian_cl_global_t *dt_gaussian_init_cl_global(void);
84
85void dt_gaussian_free_cl_global(dt_gaussian_cl_global_t *g);
86
87dt_gaussian_cl_t *dt_gaussian_init_cl(const int devid, const int width, const int height, const int channels,
88 const float *max, const float *min, const float sigma, const int order);
89
90cl_int dt_gaussian_blur_cl(dt_gaussian_cl_t *g, cl_mem dev_in, cl_mem dev_out);
91
92void dt_gaussian_free_cl(dt_gaussian_cl_t *g);
93#endif
94
95// clang-format off
96// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
97// vim: shiftwidth=2 expandtab tabstop=2 cindent
98// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
99// clang-format on
100
int width
Definition bilateral.h:1
int height
Definition bilateral.h:1
void dt_gaussian_free(dt_gaussian_t *g)
Definition gaussian.c:497
void dt_gaussian_blur(dt_gaussian_t *g, const float *const in, float *const out)
Definition gaussian.c:156
size_t dt_gaussian_singlebuffer_size(const int width, const int height, const int channels)
Definition gaussian.c:100
dt_gaussian_order_t
Definition gaussian.h:26
@ DT_IOP_GAUSSIAN_TWO
Definition gaussian.h:29
@ DT_IOP_GAUSSIAN_ONE
Definition gaussian.h:28
@ DT_IOP_GAUSSIAN_ZERO
Definition gaussian.h:27
void dt_gaussian_blur_4c(dt_gaussian_t *g, const float *const in, float *const out)
Definition gaussian.c:486
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:114
size_t dt_gaussian_memory_use(const int width, const int height, const int channels)
Definition gaussian.c:84
Definition gaussian.h:34
float * buf
Definition gaussian.h:40
int channels
Definition gaussian.h:35
float * min
Definition gaussian.h:39
float * max
Definition gaussian.h:38
int height
Definition gaussian.h:35
int order
Definition gaussian.h:37
float sigma
Definition gaussian.h:36
int width
Definition gaussian.h:35