22#ifndef DT_PIXEL_BSPLINE_H
23#define DT_PIXEL_BSPLINE_H
34#define BSPLINE_FSIZE 5
38#define B_SPLINE_SIGMA 1.0553651328015339f
49#define B_SPLINE_TO_LAPLACIAN 3.182727439285017f
50#define B_SPLINE_TO_LAPLACIAN_2 10.129753952777762f
81 return (
size - 1u) / 2u + 1u;
98 result[c] =
MAX(0.0f, filter[0] * buf[
indices[0] + c] +
99 filter[1] * buf[
indices[1] + c] +
100 filter[2] * buf[
indices[2] + c] +
101 filter[3] * buf[
indices[3] + c] +
102 filter[4] * buf[
indices[4] + c]);
109 result[c] = filter[0] * buf[
indices[0] + c] +
110 filter[1] * buf[
indices[1] + c] +
111 filter[2] * buf[
indices[2] + c] +
112 filter[3] * buf[
indices[3] + c] +
113 filter[4] * buf[
indices[4] + c];
160 const size_t center =
col * 2u;
198 for(
int jj = -2;
jj <= 2; ++
jj)
201 for(
int ii = -2;
ii <= 2; ++
ii)
204 const float weight = filter[
ii + 2] * filter[
jj + 2];
205 const size_t index = 4 * (
yy *
width +
xx);
260 for(
int jj = -1;
jj <= 1; ++
jj)
261 for(
int ii = -1;
ii <= 1; ++
ii)
265 const float weight = 4.f * filter[2 * (
jj + 1)] * filter[2 * (
ii + 1)];
274 for(
int jj = -1;
jj <= 1; ++
jj)
275 for(
int ii = 0;
ii <= 1; ++
ii)
279 const float weight = 4.f * filter[2 * (
jj + 1)] * filter[2 *
ii + 1];
288 for(
int jj = 0;
jj <= 1; ++
jj)
289 for(
int ii = -1;
ii <= 1; ++
ii)
293 const float weight = 4.f * filter[2 *
jj + 1] * filter[2 * (
ii + 1)];
302 for(
int jj = 0;
jj <= 1; ++
jj)
303 for(
int ii = 0;
ii <= 1; ++
ii)
307 const float weight = 4.f * filter[2 *
jj + 1] * filter[2 *
ii + 1];
370 const size_t index = 4U * (
i *
width +
j);
374 HF[index + c] = in[index + c] -
LF[index + c];
static unsigned int num_steps_to_reach_equivalent_sigma(const float sigma_filter, const float sigma_final)
static void _bspline_horizontal_decimated(const float *const restrict temp, float *const restrict out, const size_t col, const size_t width, const gboolean clip_negatives)
static void reduce_2D_Bspline(const float *const restrict in, float *const restrict out, const size_t width, const size_t height, float *const restrict tempbuf, const size_t padded_size, const gboolean clip_negatives)
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)
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)
static float equivalent_sigma_at_step(const float sigma, const unsigned int s)
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)
static void expand_2D_Bspline(const float *const restrict in, float *const restrict out, const size_t width, const size_t height, const gboolean clip_negatives)
static float normalize_laplacian(const float sigma)
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)
static size_t decimated_bspline_size(const size_t size)
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)
typedef void((*dt_cache_allocate_t)(void *userdata, dt_cache_entry_t *entry))
const dt_colormatrix_t dt_aligned_pixel_t out
static int dwt_interleave_rows(const int rowid, const int height, const int stride)
static void weight(const float *c1, const float *c2, const float sharpen, dt_aligned_pixel_t weight)
#define DT_ALIGNED_ARRAY
Align an object on a cacheline boundary, so AVX2 can load it whole.
static int dt_get_thread_num()
Index of the calling thread within its parallel region, 0 outside one.
#define __OMP_DECLARE_SIMD__(...)
#define __OMP_PARALLEL_FOR__(...)
#define dt_get_perthread(buf, padsize)
DT_ALIGNED_PIXEL float dt_aligned_pixel_t[4]
#define for_each_channel(_var,...)
static void copy_pixel_nontemporal(float *const __restrict__ out, const float *const __restrict__ in)
#define for_four_channels(_var,...)