13#define B_SPLINE_SIGMA 1.0553651328015339f
19 return 2.f /
sqf(sigma);
24#define B_SPLINE_TO_LAPLACIAN 3.182727439285017f
25#define B_SPLINE_TO_LAPLACIAN_2 10.129753952777762f
45 float radius = sigma_filter;
46 while(radius < sigma_final)
49 radius = sqrtf(
sqf(radius) +
sqf((
float)(1 << s) * sigma_filter));
56#pragma omp declare simd aligned(buf, indices, result:64)
59 dt_aligned_pixel_t result,
const gboolean clip_negatives)
73 result[c] =
MAX(0.0f, filter[0] * buf[indices[0] + c] +
74 filter[1] * buf[indices[1] + c] +
75 filter[2] * buf[indices[2] + c] +
76 filter[3] * buf[indices[3] + c] +
77 filter[4] * buf[indices[4] + c]);
84 result[c] = filter[0] * buf[indices[0] + c] +
85 filter[1] * buf[indices[1] + c] +
86 filter[2] * buf[indices[2] + c] +
87 filter[3] * buf[indices[3] + c] +
88 filter[4] * buf[indices[4] + c];
94#pragma omp declare simd aligned(in, temp)
97 size_t row,
size_t width,
size_t height,
int mult,
const gboolean clip_negatives)
102 indices[0] = 4 *
width *
MAX((
int)row - 2 * mult, 0);
103 indices[1] = 4 *
width *
MAX((
int)row - mult, 0);
104 indices[2] = 4 *
width * row;
107 for(
size_t j = 0; j <
width; j++)
115#pragma omp declare simd aligned(temp, out)
118 size_t col,
size_t width,
int mult,
const gboolean clip_negatives)
123 indices[0] = 4 *
MAX((
int)col - 2 * mult, 0);
124 indices[1] = 4 *
MAX((
int)col - mult, 0);
125 indices[2] = 4 * col;
126 indices[3] = 4 *
MIN(col + mult,
width-1);
127 indices[4] = 4 *
MIN(col + 2 * mult,
width-1);
134#pragma omp declare simd aligned(in, out:64) aligned(tempbuf:16)
136inline static void blur_2D_Bspline(
const float *
const restrict in,
float *
const restrict out,
137 float *
const restrict tempbuf,
138 const size_t width,
const size_t height,
const int mult,
const gboolean clip_negatives)
142 #pragma omp parallel for default(none) \
143 dt_omp_firstprivate(width, height, mult) \
144 dt_omp_sharedconst(out, in, tempbuf, clip_negatives) \
147 for(
size_t row = 0; row <
height; row++)
156 for(
size_t j = 0; j <
width; j++)
164#pragma omp declare simd aligned(in, HF, LF:64) aligned(tempbuf:16)
167 float *
const restrict HF,
168 float *
const restrict LF,
169 const size_t width,
const size_t height,
const int mult,
170 float *
const tempbuf,
size_t padded_size)
174#pragma omp parallel for default(none) \
175 dt_omp_firstprivate(width, height, mult, padded_size) \
176 dt_omp_sharedconst(in, HF, LF, tempbuf) \
179 for(
size_t row = 0; row <
height; row++)
188 for(
size_t j = 0; j <
width; j++)
190 const size_t index = 4U * (i *
width + j);
194 HF[index + c] = in[index + c] - LF[index + c];
#define TRUE
Definition ashift_lsd.c:151
int width
Definition bilateral.h:1
int height
Definition bilateral.h:1
static unsigned int num_steps_to_reach_equivalent_sigma(const float sigma_filter, const float sigma_final)
Definition bspline.h:40
static void _bspline_horizontal(const float *const restrict temp, float *const restrict out, size_t col, size_t width, int mult, const gboolean clip_negatives)
Definition bspline.h:117
static void sparse_scalar_product(const dt_aligned_pixel_t buf, const size_t indices[5], dt_aligned_pixel_t result, const gboolean clip_negatives)
Definition bspline.h:58
static float equivalent_sigma_at_step(const float sigma, const unsigned int s)
Definition bspline.h:27
static void blur_2D_Bspline(const float *const restrict in, float *const restrict out, float *const restrict tempbuf, const size_t width, const size_t height, const int mult, const gboolean clip_negatives)
Definition bspline.h:136
#define BSPLINE_FSIZE
Definition bspline.h:9
static float normalize_laplacian(const float sigma)
Definition bspline.h:15
static void decompose_2D_Bspline(const float *const restrict in, float *const restrict HF, float *const restrict LF, const size_t width, const size_t height, const int mult, float *const tempbuf, size_t padded_size)
Definition bspline.h:166
static void _bspline_vertical_pass(const float *const restrict in, float *const restrict temp, size_t row, size_t width, size_t height, int mult, const gboolean clip_negatives)
Definition bspline.h:96
#define DT_ALIGNED_ARRAY
Definition darktable.h:270
#define for_each_channel(_var,...)
Definition darktable.h:411
static int dt_get_thread_num()
Definition darktable.h:227
#define dt_get_perthread(buf, padsize)
Definition darktable.h:797
#define for_four_channels(_var,...)
Definition darktable.h:413
static int dwt_interleave_rows(const int rowid, const int height, const int stride)
Definition dwt.h:89
static float sqf(const float x)
Definition math.h:215
#define MIN(a, b)
Definition thinplate.c:23
#define MAX(a, b)
Definition thinplate.c:20