76static inline __attribute__((always_inline)) uint8_t scale_type(
const int s,
const int scales)
85static inline void guide_laplacians(
const float *
const restrict high_freq,
const float *
const restrict low_freq,
86 const float *
const restrict clipping_mask,
float *
const restrict output,
87 const size_t width,
const size_t height,
const int mult,
88 const float noise_level,
const int salt,
const uint8_t scale,
89 const float radius_sq)
96 const dt_aligned_pixel_simd_t inv_patch =
dt_simd_set1(1.f / 9.f);
97 const dt_aligned_pixel_simd_t scale_multiplier =
dt_simd_set1(1.f / radius_sq);
98 const float eps = 1e-12f;
104 const float *
const row0 = HF + 4 * ((size_t)
MAX(
i - mult, 0) *
width);
105 const float *
const row1 = HF + 4 * ((size_t)
i *
width);
108 const int max_col = (int)
width - 1;
110 for(
int j = 0; j <
width; ++j)
112 const size_t idx = (
i *
width + j);
113 const size_t index = idx * 4;
114 const float alpha = clipping_mask[index +
ALPHA];
115 const float alpha_comp = 1.f - alpha;
116 dt_aligned_pixel_simd_t high_frequency = dt_load_simd_aligned(HF + index);
120 const int col_offsets[3] = { 4 *
MAX(j - mult, 0), 4 * j, 4 *
MIN(j + mult, max_col) };
121 dt_aligned_pixel_simd_t sum = zero;
122 dt_aligned_pixel_simd_t sum_sq = zero;
123 dt_aligned_pixel_simd_t prod_r = zero;
124 dt_aligned_pixel_simd_t prod_g = zero;
125 dt_aligned_pixel_simd_t prod_b = zero;
130#if defined(__GNUC__) && !defined(__clang__)
133 for(
int jj = 0; jj < 3; ++jj)
135 const float *
const row_ptr = rows[jj];
136#if defined(__GNUC__) && !defined(__clang__)
139 for(
int ii = 0; ii < 3; ++ii)
141 const dt_aligned_pixel_simd_t sample = dt_load_simd_aligned(row_ptr + col_offsets[ii]);
144 sum_sq += sample * sample;
151 dt_aligned_pixel_simd_t means = sum * inv_patch;
152 dt_aligned_pixel_simd_t variance = sum_sq * inv_patch - means * means;
153 variance = dt_simd_max_zero(variance);
154 variance[
ALPHA] = 0.f;
156 size_t guiding_channel =
RED;
157 float guide_variance = variance[
RED];
158 if(variance[
GREEN] > guide_variance)
160 guiding_channel =
GREEN;
161 guide_variance = variance[
GREEN];
163 if(variance[
BLUE] > guide_variance)
165 guiding_channel =
BLUE;
166 guide_variance = variance[
BLUE];
169 if(guide_variance >
eps)
171 const float guide_mean = means[guiding_channel];
172 dt_aligned_pixel_simd_t covariance
173 = (guiding_channel ==
RED ? prod_r : (guiding_channel ==
GREEN ? prod_g : prod_b)) * inv_patch
175 dt_aligned_pixel_simd_t slope = covariance /
dt_simd_set1(guide_variance);
176 slope = dt_simd_max_zero(slope);
177 dt_aligned_pixel_simd_t intercept = means - slope *
dt_simd_set1(guide_mean);
178 const dt_aligned_pixel_simd_t blend = dt_load_simd_aligned(clipping_mask + index) * scale_multiplier;
179 const dt_aligned_pixel_simd_t guide =
dt_simd_set1(high_frequency[guiding_channel]);
180 high_frequency = blend * (slope * guide + intercept) + (ones - blend) * high_frequency;
184 dt_aligned_pixel_simd_t out_pixel = high_frequency;
192 out_pixel += dt_load_simd_aligned(
out + index);
198 out_pixel = dt_simd_max_zero(out_pixel + dt_load_simd_aligned(LF + index));
202 if((scale &
LAST_SCALE) && salt && alpha > 0.f)
228 out_pixel[
RED] = fmaxf(alpha *
noise[
RED] + alpha_comp * current[
RED], 0.f);
237 const float norm = fmaxf(sqrtf(sqf(out_pixel[
RED]) + sqf(out_pixel[
GREEN]) + sqf(out_pixel[
BLUE])), 1e-6f);
239 out_pixel[
ALPHA] = norm;
248static inline void heat_PDE_diffusion(
const float *
const restrict high_freq,
const float *
const restrict low_freq,
249 const float *
const restrict clipping_mask,
float *
const restrict output,
250 const size_t width,
const size_t height,
const int mult,
const uint8_t scale,
251 const float first_order_factor)
272 const size_t i_neighbours[3] = {
MAX((
int)(
i - mult), (
int)0) *
width,
277 = { 0.25f, 0.5f, 0.25f, 0.5f, -3.f, 0.5f, 0.25f, 0.5f, 0.25f };
279 for(
size_t j = 0; j <
width; ++j)
281 const size_t idx = (
i *
width + j);
282 const size_t index = idx * 4;
286 clipping_mask[index +
BLUE], clipping_mask[index +
ALPHA] };
288 dt_aligned_pixel_t high_frequency = { HF[index + 0], HF[index + 1], HF[index + 2], HF[index + 3] };
294 const float norm_backup = high_frequency[3];
296 if(alpha[
ALPHA] > 0.f)
299 const size_t j_neighbours[3] = {
MAX((
int)(j - mult), (
int)0),
301 MIN((
int)(j + mult), (
int)
width - 1) };
307 neighbour_pixel_HF[3 * 0 + 0][c] = HF[4 * (i_neighbours[0] + j_neighbours[0]) + c];
308 neighbour_pixel_HF[3 * 0 + 1][c] = HF[4 * (i_neighbours[0] + j_neighbours[1]) + c];
309 neighbour_pixel_HF[3 * 0 + 2][c] = HF[4 * (i_neighbours[0] + j_neighbours[2]) + c];
311 neighbour_pixel_HF[3 * 1 + 0][c] = HF[4 * (i_neighbours[1] + j_neighbours[0]) + c];
312 neighbour_pixel_HF[3 * 1 + 1][c] = HF[4 * (i_neighbours[1] + j_neighbours[1]) + c];
313 neighbour_pixel_HF[3 * 1 + 2][c] = HF[4 * (i_neighbours[1] + j_neighbours[2]) + c];
315 neighbour_pixel_HF[3 * 2 + 0][c] = HF[4 * (i_neighbours[2] + j_neighbours[0]) + c];
316 neighbour_pixel_HF[3 * 2 + 1][c] = HF[4 * (i_neighbours[2] + j_neighbours[1]) + c];
317 neighbour_pixel_HF[3 * 2 + 2][c] = HF[4 * (i_neighbours[2] + j_neighbours[2]) + c];
323 for(
int k = 0;
k < 9;
k++)
326 aligned(anisotropic_kernel_isophote : 64)) laplacian_HF[c]
327 += neighbour_pixel_HF[
k][c] * anisotropic_kernel_isophote[
k];
333 for_each_channel(c, aligned(high_frequency, multipliers_HF, laplacian_HF, alpha)) high_frequency[c]
334 += alpha[c] * multipliers_HF[c] * (laplacian_HF[c] - first_order_factor * high_frequency[c]);
337 high_frequency[3] = norm_backup;
355 = fmaxf(
out[index + c] + LF[index + c], 0.f);
358 if(alpha[
ALPHA] > 0.f)
362 /= (c !=
ALPHA && norm > 1e-4f) ? norm : 1.f;
374static inline int wavelets_process(
const float *
const restrict in,
float *
const restrict reconstructed,
375 const float *
const restrict clipping_mask,
const size_t width,
376 const size_t height,
const int scales,
float *
const restrict HF,
377 float *
const restrict LF_odd,
float *
const restrict LF_even,
379 const int salt,
const float first_order_factor)
390 for(
int s = 0; s < scales; ++s)
393 const int mult = 1 << s;
395 const float *restrict buffer_in;
396 float *restrict buffer_out;
406 buffer_out = LF_even;
416 uint8_t current_scale_type = scale_type(s, scales);
421 current_scale_type, radius);
450 const uint8_t(*
const xtrans)[6]
459 const size_t ds_size = ds_height * ds_width;
461 float *
const restrict interpolated
463 float *
const restrict clipping_mask
472 const float final_radius = (float)((
int)(1 << data->
scales)) / scale;
473 const int scales = CLAMP((
int)ceilf(log2f(final_radius)), 1,
MAX_NUM_SCALES);
475 const float noise_level = data->
noise_level / scale;
489 const float *
const restrict input = (
const float *
const restrict)ivoid;
490 float *
const restrict output = (
float *
const restrict)
ovoid;
507 int32_t
lookup[6][6][32] = { { { 0 } } };
531 if(
wavelets_process(ds_interpolated, temp, ds_clipping_mask, ds_width, ds_height, scales, HF, LF_odd, LF_even,
537 if(
wavelets_process(temp, ds_interpolated, ds_clipping_mask, ds_width, ds_height, scales, HF, LF_odd, LF_even,
579 cl_mem reconstructed_scratch, cl_mem clipping_mask,
const size_t sizes[3],
582 cl_mem LF_odd, cl_mem LF_even,
584 const int salt,
const float solid_color)
587 cl_mem reconstruct_read = reconstructed_scratch;
592 for(
int s = 0; s < scales; ++s)
595 const int mult = 1 << s;
608 buffer_out = LF_even;
617 const int clamp_lf = 1;
623 .cellsize = 4 *
sizeof(float),
628 hblocksize = hlocopt.
sizex;
635 const size_t horizontal_local[3] = { hblocksize, 1, 1 };
645 (hblocksize + 4 * mult) * 4 *
sizeof(
float), NULL);
647 horizontal_sizes, horizontal_local);
659 if(err != CL_SUCCESS)
return err;
666 .cellsize = 4 *
sizeof(float),
671 vblocksize = vlocopt.
sizey;
678 const size_t vertical_local[3] = { 1, vblocksize, 1 };
681 (
void *)&buffer_out);
687 (vblocksize + 4 * mult) * 4 *
sizeof(
float), NULL);
701 if(err != CL_SUCCESS)
return err;
703 uint8_t current_scale_type = scale_type(s, scales);
705 cl_mem reconstruct_write = (s == scales - 1)
707 : (reconstruct_read == reconstructed ? reconstructed_scratch : reconstructed);
716 (
void *)&buffer_out);
718 (
void *)&clipping_mask);
720 (
void *)&reconstruct_read);
722 (
void *)&reconstruct_write);
727 (
void *)&noise_level);
730 (
void *)¤t_scale_type);
733 if(err != CL_SUCCESS)
return err;
740 (
void *)&clipping_mask);
742 (
void *)&reconstruct_read);
744 (
void *)&reconstruct_write);
749 (
void *)¤t_scale_type);
752 if(err != CL_SUCCESS)
return err;
755 reconstruct_read = reconstruct_write;
774 const int devid = pipe->
devid;
795 cl_mem normalization = NULL;
796 cl_mem normalization_tmp = NULL;
797 cl_mem normalization_partials = NULL;
798 cl_mem normalization_final = NULL;
807 const float final_radius = (float)((
int)(1 << data->
scales)) / scale;
808 const int scales = CLAMP((
int)ceilf(log2f(final_radius)), 1,
MAX_NUM_SCALES);
810 const float noise_level = data->
noise_level / scale;
816 cl_mem reconstructed_scratch =
dt_opencl_alloc_device(devid, ds_sizes[0], ds_sizes[1],
sizeof(
float) * 4);
829 .cellsize = 4 *
sizeof(float),
838 const int bufsize = (int)((bwidth / flocopt.
sizex) * (bheight / flocopt.
sizey));
843 if(!normalization_partials || !normalization || !normalization_tmp)
goto error;
845 size_t fsizes[3] = { bwidth, bheight, 1 };
846 size_t flocal[3] = { flocopt.
sizex, flocopt.
sizey, 1 };
851 &normalization_partials);
856 sizeof(
float) * 4 * flocopt.
sizex * flocopt.
sizey, NULL);
859 if(err != CL_SUCCESS)
goto error;
865 .cellsize = 4 *
sizeof(float),
872 int current_length = bufsize;
873 cl_mem reduce_in = normalization_partials;
874 cl_mem reduce_out = normalization;
879 size_t ssizes[3] = { (size_t)reducesize * slocopt.
sizex, 1, 1 };
880 size_t slocal[3] = { slocopt.
sizex, 1, 1 };
887 sizeof(
float) * 4 * slocopt.
sizex, NULL);
890 if(err != CL_SUCCESS)
goto error;
892 if(reducesize == 1)
break;
893 current_length = reducesize;
894 cl_mem
swap = reduce_in;
895 reduce_in = reduce_out;
896 reduce_out = (
swap == normalization_partials) ? normalization_tmp : normalization;
899 normalization_final = reduce_out;
904 (
void *)&interpolated);
908 (
void *)&normalization_final);
910 (
void *)&filters_shifted);
913 (
void *)&roi_out->
height);
915 if(err != CL_SUCCESS)
goto error;
922 if(err != CL_SUCCESS)
goto error;
925 const int RGBa =
TRUE;
934 if(err != CL_SUCCESS)
goto error;
944 if(err != CL_SUCCESS)
goto error;
949 err =
wavelets_process_cl(devid, ds_interpolated, temp, reconstructed_scratch, ds_clipping_mask, ds_sizes,
952 if(err != CL_SUCCESS)
goto error;
954 err =
wavelets_process_cl(devid, temp, ds_interpolated, reconstructed_scratch, ds_clipping_mask, ds_sizes,
957 if(err != CL_SUCCESS)
goto error;
968 if(err != CL_SUCCESS)
goto error;
971 const int clip_floor_off =
FALSE;
975 (
void *)&interpolated);
977 (
void *)&clipping_mask);
980 (
void *)&normalization_final);
983 (
void *)&clip_floor_off);
985 (
void *)&filters_shifted);
989 if(err != CL_SUCCESS)
goto error;
1041 const uint8_t(*
const xtrans)[6] = (
const uint8_t(*
const)[6])piece->
dsc_in.
xtrans;
1042 const int devid = pipe->
devid;
1054 cl_mem normalization = NULL;
1055 cl_mem normalization_tmp = NULL;
1056 cl_mem normalization_partials = NULL;
1057 cl_mem normalization_final = NULL;
1063 const float final_radius = (float)((
int)(1 << data->
scales)) / scale;
1064 const int scales = CLAMP((
int)ceilf(log2f(final_radius)), 1,
MAX_NUM_SCALES);
1065 const float noise_level = data->
noise_level / scale;
1070 cl_mem reconstructed_scratch =
dt_opencl_alloc_device(devid, ds_sizes[0], ds_sizes[1],
sizeof(
float) * 4);
1075 int32_t
lookup[6][6][32] = { { { 0 } } };
1090 .cellsize = 4 *
sizeof(float),
1100 const int bufsize = (int)((bwidth / flocopt.
sizex) * (bheight / flocopt.
sizey));
1105 if(!normalization_partials || !normalization || !normalization_tmp)
goto error;
1107 size_t fsizes[3] = { bwidth, bheight, 1 };
1108 size_t flocal[3] = { flocopt.
sizex, flocopt.
sizey, 1 };
1114 &normalization_partials);
1122 sizeof(
float) * 4 * flocopt.
sizex * flocopt.
sizey, NULL);
1125 if(err != CL_SUCCESS)
goto error;
1131 .cellsize = 4 *
sizeof(float),
1138 int current_length = bufsize;
1139 cl_mem reduce_in = normalization_partials;
1140 cl_mem reduce_out = normalization;
1145 size_t ssizes[3] = { (size_t)reducesize * slocopt.
sizex, 1, 1 };
1146 size_t slocal[3] = { slocopt.
sizex, 1, 1 };
1153 sizeof(
float) * 4 * slocopt.
sizex, NULL);
1156 if(err != CL_SUCCESS)
goto error;
1158 if(reducesize == 1)
break;
1159 current_length = reducesize;
1160 cl_mem
swap = reduce_in;
1161 reduce_in = reduce_out;
1162 reduce_out = (
swap == normalization_partials) ? normalization_tmp : normalization;
1165 normalization_final = reduce_out;
1171 (
void *)&interpolated);
1176 (
void *)&normalization_final);
1180 (
void *)&roi_in->
x);
1182 (
void *)&roi_in->
y);
1184 (
void *)&dev_xtrans);
1186 (
void *)&lookup_cl);
1188 if(err != CL_SUCCESS)
goto error;
1195 if(err != CL_SUCCESS)
goto error;
1197 const int RGBa =
TRUE;
1206 if(err != CL_SUCCESS)
goto error;
1216 if(err != CL_SUCCESS)
goto error;
1221 err =
wavelets_process_cl(devid, ds_interpolated, temp, reconstructed_scratch, ds_clipping_mask, ds_sizes,
1224 if(err != CL_SUCCESS)
goto error;
1226 err =
wavelets_process_cl(devid, temp, ds_interpolated, reconstructed_scratch, ds_clipping_mask, ds_sizes,
1229 if(err != CL_SUCCESS)
goto error;
1239 if(err != CL_SUCCESS)
goto error;
1241 const int clip_floor_off =
FALSE;
1247 (
void *)&interpolated);
1249 (
void *)&clipping_mask);
1253 (
void *)&normalization_final);
1257 (
void *)&clip_floor_off);
1263 (
void *)&roi_in->
x);
1265 (
void *)&roi_in->
y);
1267 (
void *)&dev_xtrans);
1269 if(err != CL_SUCCESS)
goto error;
1324 const int devid = pipe->
devid;
1336 cl_mem normalization = NULL;
1337 cl_mem normalization_tmp = NULL;
1338 cl_mem normalization_partials = NULL;
1339 cl_mem normalization_final = NULL;
1346 const float final_radius = (float)((
int)(1 << data->
scales)) / scale;
1347 const int scales = CLAMP((
int)ceilf(log2f(final_radius)), 1,
MAX_NUM_SCALES);
1348 const float noise_level = data->
noise_level / scale;
1353 cl_mem reconstructed_scratch =
dt_opencl_alloc_device(devid, ds_sizes[0], ds_sizes[1],
sizeof(
float) * 4);
1366 .cellsize = 4 *
sizeof(float),
1376 const int bufsize = (int)((bwidth / flocopt.
sizex) * (bheight / flocopt.
sizey));
1381 if(!normalization_partials || !normalization || !normalization_tmp)
goto error;
1383 size_t fsizes[3] = { bwidth, bheight, 1 };
1384 size_t flocal[3] = { flocopt.
sizex, flocopt.
sizey, 1 };
1392 &normalization_partials);
1394 sizeof(
float) * 4 * flocopt.
sizex * flocopt.
sizey, NULL);
1397 if(err != CL_SUCCESS)
goto error;
1403 .cellsize = 4 *
sizeof(float),
1410 int current_length = bufsize;
1411 cl_mem reduce_in = normalization_partials;
1412 cl_mem reduce_out = normalization;
1417 size_t ssizes[3] = { (size_t)reducesize * slocopt.
sizex, 1, 1 };
1418 size_t slocal[3] = { slocopt.
sizex, 1, 1 };
1426 sizeof(
float) * 4 * slocopt.
sizex, NULL);
1429 if(err != CL_SUCCESS)
goto error;
1431 if(reducesize == 1)
break;
1432 current_length = reducesize;
1433 cl_mem
swap = reduce_in;
1434 reduce_in = reduce_out;
1435 reduce_out = (
swap == normalization_partials) ? normalization_tmp : normalization;
1438 normalization_final = reduce_out;
1445 (
void *)&interpolated);
1451 (
void *)&normalization_final);
1453 (
void *)&roi_out->
width);
1455 (
void *)&roi_out->
height);
1457 if(err != CL_SUCCESS)
goto error;
1464 if(err != CL_SUCCESS)
goto error;
1467 const int RGBa =
TRUE;
1476 if(err != CL_SUCCESS)
goto error;
1486 if(err != CL_SUCCESS)
goto error;
1491 err =
wavelets_process_cl(devid, ds_interpolated, temp, reconstructed_scratch, ds_clipping_mask, ds_sizes,
1494 if(err != CL_SUCCESS)
goto error;
1496 err =
wavelets_process_cl(devid, temp, ds_interpolated, reconstructed_scratch, ds_clipping_mask, ds_sizes,
1499 if(err != CL_SUCCESS)
goto error;
1510 if(err != CL_SUCCESS)
goto error;
1513 const int clip_floor_off =
FALSE;
1519 (
void *)&interpolated);
1521 (
void *)&clipping_mask);
1525 (
void *)&normalization_final);
1529 (
void *)&clip_floor_off);
1535 if(err != CL_SUCCESS)
goto error;
1552 if(err != CL_SUCCESS)
static void error(char *msg)
int dt_box_mean(float *const buf, const size_t height, const size_t width, const int ch, const int radius, const unsigned iterations)
static float equivalent_sigma_at_step(const float sigma, const unsigned int s)
#define B_SPLINE_TO_LAPLACIAN
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)
typedef void((*dt_cache_allocate_t)(void *userdata, dt_cache_entry_t *entry))
return vector dt_simd_set1(valid ?(scaling+NORM_MIN) :NORM_MIN)
static float lookup(read_only image2d_t lut, const float x)
const dt_colormatrix_t dt_aligned_pixel_t out
dt_store_simd_aligned(out, dt_mat3x4_mul_vec4(vin, dt_colormatrix_row_to_simd(matrix, 0), dt_colormatrix_row_to_simd(matrix, 1), dt_colormatrix_row_to_simd(matrix, 2)))
static float4 dt_noise_generator_simd(const dt_noise_distribution_t distribution, const float4 mu, const float4 param, uint state[4])
static unsigned int splitmix32(const unsigned long seed)
static float xoshiro128plus(uint state[4])
static int dwt_interleave_rows(const int rowid, const int height, const int stride)
static __DT_CLONE_TARGETS__ void interpolate_bilinear(const float *const restrict in, const size_t width_in, const size_t height_in, float *const restrict out, const size_t width_out, const size_t height_out, const size_t ch)
__DT_CLONE_TARGETS__ void _interpolate_and_mask_passthrough(const float *const restrict input, float *const restrict interpolated, float *const restrict clipping_mask, const dt_aligned_pixel_t clips, const dt_aligned_pixel_t white_balance, const size_t width, const size_t height)
__DT_CLONE_TARGETS__ void _compute_laplacian_normalization(const float *const restrict input, const dt_iop_roi_t *const roi_in, const uint32_t filters, const uint8_t(*const xtrans)[6], dt_aligned_pixel_t normalization)
__DT_CLONE_TARGETS__ void _remosaic_and_replace_xtrans(const float *const restrict input, const float *const restrict input_raw, const float *const restrict interpolated, const float *const restrict clipping_mask, float *const restrict output, const dt_aligned_pixel_t white_balance, const dt_aligned_pixel_t clips, const int clip_is_floor, const dt_iop_roi_t *const roi_in, const uint8_t(*const xtrans)[6], const size_t width, const size_t height)
__DT_CLONE_TARGETS__ void _interpolate_and_mask(const float *const restrict input, float *const restrict interpolated, float *const restrict clipping_mask, const dt_aligned_pixel_t clips_in, const dt_aligned_pixel_t det_scale, const dt_aligned_pixel_t white_balance, const uint32_t filters, const size_t width, const size_t height)
__DT_CLONE_TARGETS__ void _remosaic_and_replace(const float *const restrict input, const float *const restrict input_raw, const float *const restrict interpolated, const float *const restrict clipping_mask, float *const restrict output, const dt_aligned_pixel_t white_balance, const dt_aligned_pixel_t clips, const int clip_is_floor, const uint32_t filters, const size_t width, const size_t height)
__DT_CLONE_TARGETS__ void _interpolate_and_mask_xtrans(const float *const restrict input, float *const restrict interpolated, float *const restrict clipping_mask, const dt_aligned_pixel_t clips, const dt_aligned_pixel_t white_balance, const dt_iop_roi_t *const roi_in, const int32_t lookup[6][6][32], const uint8_t(*const xtrans)[6], const size_t width, const size_t height)
__DT_CLONE_TARGETS__ void _build_xtrans_bilinear_lookup(int32_t lookup[6][6][32], const dt_iop_roi_t *const roi_in, const uint8_t(*const xtrans)[6])
__DT_CLONE_TARGETS__ void _remosaic_and_replace_passthrough(const float *const restrict input, const float *const restrict input_raw, const float *const restrict interpolated, const float *const restrict clipping_mask, float *const restrict output, const dt_aligned_pixel_t white_balance, const dt_aligned_pixel_t clips, const int clip_is_floor, const size_t width, const size_t height)
static dt_hl_cfa_t _hl_cfa_strategy(const uint32_t filters)
uint32_t dt_dev_get_roi_filters(const dt_dev_pixelpipe_iop_t *const piece, const dt_iop_roi_t *const roi_in)
float dt_dev_get_module_scale(const dt_dev_pixelpipe_t *const pipe, const dt_iop_roi_t *const roi_in)
static __DT_CLONE_TARGETS__ void heat_PDE_diffusion(const float *const restrict high_freq, const float *const restrict low_freq, const float *const restrict clipping_mask, float *const restrict output, const size_t width, const size_t height, const int mult, const uint8_t scale, const float first_order_factor)
static int wavelets_process(const float *const restrict in, float *const restrict reconstructed, const float *const restrict clipping_mask, const size_t width, const size_t height, const int scales, float *const restrict HF, float *const restrict LF_odd, float *const restrict LF_even, const diffuse_reconstruct_variant_t variant, const float noise_level, const int salt, const float first_order_factor)
cl_int process_laplacian_bayer_cl(struct dt_iop_module_t *self, const dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece, cl_mem dev_in, cl_mem dev_out, const dt_iop_roi_t *const roi_in, const dt_iop_roi_t *const roi_out, const dt_aligned_pixel_t clips)
cl_int process_laplacian_xtrans_cl(struct dt_iop_module_t *self, const dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece, cl_mem dev_in, cl_mem dev_out, const dt_iop_roi_t *const roi_in, const dt_iop_roi_t *const roi_out, const dt_aligned_pixel_t clips)
cl_int process_laplacian_passthrough_cl(struct dt_iop_module_t *self, const dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece, cl_mem dev_in, cl_mem dev_out, const dt_iop_roi_t *const roi_in, const dt_iop_roi_t *const roi_out, const dt_aligned_pixel_t clips)
__DT_CLONE_TARGETS__ int process_laplacian(struct dt_iop_module_t *self, const dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece, const void *const restrict ivoid, void *const restrict ovoid, const dt_iop_roi_t *const roi_in, const dt_iop_roi_t *const roi_out, const dt_aligned_pixel_t clips)
static __DT_CLONE_TARGETS__ void guide_laplacians(const float *const restrict high_freq, const float *const restrict low_freq, const float *const restrict clipping_mask, float *const restrict output, const size_t width, const size_t height, const int mult, const float noise_level, const int salt, const uint8_t scale, const float radius_sq)
static cl_int wavelets_process_cl(const int devid, cl_mem in, cl_mem reconstructed, cl_mem reconstructed_scratch, cl_mem clipping_mask, const size_t sizes[3], const int width, const int height, dt_iop_highlights_global_data_t *const gd, const int scales, cl_mem HF, cl_mem LF_odd, cl_mem LF_even, const diffuse_reconstruct_variant_t variant, const float noise_level, const int salt, const float solid_color)
static void swap(float *x, float *y)
void dt_print(dt_debug_thread_t thread, const char *msg,...) __attribute__((format(printf
Print to stdout when thread is enabled, prefixed with seconds since startup.
float *const restrict const size_t k
#define IS_NULL_PTR(p)
C is way too permissive with !=, == and if(var) checks, which can mean too many things depending on w...
#define DT_ALIGNED_ARRAY
Align an object on a cacheline boundary, so AVX2 can load it whole.
#define DT_IS_ALIGNED(x)
Promise the compiler that x is already cacheline-aligned, and return it.
int dt_opencl_local_buffer_opt(const int devid, const int kernel, dt_opencl_local_buffer_t *factors)
int dt_opencl_enqueue_kernel_2d(const int dev, const int kernel, const size_t *sizes)
void * dt_opencl_alloc_device_buffer(const int devid, const size_t size)
void * dt_opencl_alloc_device(const int devid, const int width, const int height, const int bpp)
void * dt_opencl_copy_host_to_device_constant(const int devid, const size_t size, void *host)
int dt_opencl_set_kernel_arg(const int dev, const int kernel, const int num, const size_t size, const void *arg)
int dt_opencl_enqueue_kernel_2d_with_local(const int dev, const int kernel, const size_t *sizes, const size_t *local)
void dt_opencl_release_mem_object(cl_mem mem)
#define DT_OPENCL_DEFAULT_ERROR
#define __OMP_PARALLEL_FOR__(...)
#define dt_pixelpipe_cache_free_align(mem)
#define dt_pixelpipe_cache_alloc_align_float(pixels, pipe)
#define dt_pixelpipe_cache_alloc_perthread_float(n, padded_size)
static const dt_aligned_pixel_simd_t const dt_aligned_pixel_simd_t row1
DT_ALIGNED_PIXEL float dt_aligned_pixel_t[4]
#define for_each_channel(_var,...)
float dt_aligned_pixel_simd_t __attribute__((vector_size(16), aligned(16)))
Apply one channel's tone curve to each of the three colour channels, or pass the channel through unto...
static const dt_aligned_pixel_simd_t const dt_aligned_pixel_simd_t const dt_aligned_pixel_simd_t row2
#define for_four_channels(_var,...)
static const dt_aligned_pixel_simd_t row0
diffuse_reconstruct_variant_t
@ DIFFUSE_RECONSTRUCT_RGB
@ DIFFUSE_RECONSTRUCT_CHROMA
const float uint32_t state[4]
const float const int flip
dt_iop_buffer_dsc_t dsc_in
struct dt_iop_module_t *void * data
int kernel_highlights_diffuse_color
int kernel_highlights_bilinear_and_mask_passthrough
int kernel_highlights_guide_laplacians
int kernel_highlights_normalize_reduce_first_passthrough
int kernel_highlights_remosaic_and_replace
int kernel_filmic_bspline_horizontal_local
int kernel_highlights_normalize_reduce_first
int kernel_highlights_remosaic_and_replace_passthrough
int kernel_highlights_bilinear_and_mask_xtrans
int kernel_highlights_normalize_reduce_first_xtrans
int kernel_interpolate_bilinear
int kernel_filmic_bspline_horizontal
int kernel_highlights_box_blur
int kernel_filmic_bspline_vertical
int kernel_highlights_normalize_reduce_second
int kernel_highlights_remosaic_and_replace_xtrans
int kernel_highlights_bilinear_and_mask
int kernel_filmic_bspline_vertical_local
dt_atrous_wavelets_scales_t scales
dt_iop_global_data_t * global_data
Region of interest passed through the pixelpipe.
#define __DT_CLONE_TARGETS__