103 _(
"linear or non-linear, Lab, scene-referred"),
104 _(
"frequential, Lab"),
105 _(
"special, Lab, scene-referred"));
130 const int rad =
MAX_RADIUS * (fmin(100.0f,
d->sharpness + 1) / 100.0f);
134 const int wdh = ceilf(3.0f *
sigma);
155 cl_mem dev_tmp = NULL;
158 const int devid = pipe->
devid;
162 const int rad =
MAX_RADIUS * (fmin(100.0f,
d->sharpness + 1) / 100.0f);
168 const int wdh = ceilf(3.0f *
sigma);
169 const int wd = 2 * wdh + 1;
170 const size_t mat_size = (size_t)wd *
sizeof(
float);
171 float *mat = malloc(mat_size);
172 float *
m = mat + wdh;
176 for(
int l = -wdh; l <= wdh; l++)
weight +=
m[l] = expf(-(l * l) / (2.f *
sigma *
sigma));
177 for(
int l = -wdh; l <= wdh; l++)
m[l] /=
weight;
182 float contrast_scale = ((
d->contrast / 100.0f) * 7.5f);
187 .cellsize =
sizeof(float), .overhead = 0,
188 .sizex = 1 << 16, .sizey = 1 };
191 hblocksize = hlocopt.
sizex;
198 .cellsize =
sizeof(float), .overhead = 0,
199 .sizex = 1, .sizey = 1 << 16 };
202 vblocksize = vlocopt.
sizey;
228 if(err != CL_SUCCESS)
goto error;
236 local[0] = hblocksize;
248 if(err != CL_SUCCESS)
goto error;
256 local[1] = vblocksize;
267 if(err != CL_SUCCESS)
goto error;
281 if(err != CL_SUCCESS)
goto error;
304 const float *
const in = (
float *)ivoid;
311 const size_t npixels = (size_t)roi_out->
height * roi_out->
width;
313 for(
size_t k = 0;
k < (size_t)npixels;
k++)
320 const int range = 2 * radius + 1;
321 const int hr = range / 2;
328 const float contrast_scale = ((data->
contrast / 100.0) * 7.5);
335 for(
size_t k = npixels - 1;
k > npixels/4;
k--)
337 size_t index =
ch *
k;
339 const float L =
out[
k] * 0.5 + in[index] * 0.5;
340 out[index] =
LCLIP(50.0f + ((
L - 50.0f) * contrast_scale));
341 out[index + 1] =
out[index + 2] = 0.0f;
342 out[index + 3] = in[index + 3];
345 for(ssize_t
k = npixels/4;
k >= 0;
k--)
347 size_t index =
ch *
k;
349 const float L =
out[
k] * 0.5 + in[index] * 0.5;
350 out[index] =
LCLIP(50.0f + ((
L - 50.0f) * contrast_scale));
351 out[index + 1] =
out[index + 2] = 0.0f;
352 out[index + 3] = in[index + 3];
364 d->sharpness =
p->sharpness;
365 d->contrast =
p->contrast;
382 const int program = 4;
409 gtk_widget_set_tooltip_text(
g->sharpness, _(
"the sharpness of highpass filter"));
413 gtk_widget_set_tooltip_text(
g->contrast, _(
"the contrast of highpass filter"));
static void error(char *msg)
void dt_bauhaus_slider_set_format(GtkWidget *widget, const char *format)
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 const dt_aligned_pixel_simd_t const dt_adaptation_t const float p
const dt_colormatrix_t dt_aligned_pixel_t out
typedef void((*dt_cache_allocate_t)(void *userdata, dt_cache_entry_t *entry))
void dt_print(dt_debug_thread_t thread, const char *msg,...)
#define dt_free_align(ptr)
static void * dt_calloc_align(size_t size)
#define DT_MODULE_INTROSPECTION(MODVER, PARAMSTYPE)
#define __DT_CLONE_TARGETS__
#define __OMP_PARALLEL_FOR__(...)
#define IS_NULL_PTR(p)
C is way too permissive with !=, == and if(var) checks, which can mean too many things depending on w...
static void weight(const float *c1, const float *c2, const float sharpen, dt_aligned_pixel_t weight)
void commit_params(struct dt_iop_module_t *self, dt_iop_params_t *p1, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
const char ** description(struct dt_iop_module_t *self)
__DT_CLONE_TARGETS__ int process(struct dt_iop_module_t *self, const dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece, const void *const ivoid, void *const ovoid)
void init_pipe(struct dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
void gui_init(struct dt_iop_module_t *self)
void tiling_callback(struct dt_iop_module_t *self, const struct dt_dev_pixelpipe_t *pipe, const struct dt_dev_pixelpipe_iop_t *piece, struct dt_develop_tiling_t *tiling)
void cleanup_global(dt_iop_module_so_t *module)
int default_colorspace(dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece)
void cleanup_pipe(struct dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
void init_global(dt_iop_module_so_t *module)
int process_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 char ** dt_iop_set_description(dt_iop_module_t *module, const char *main_text, const char *purpose, const char *input, const char *process, const char *output)
@ IOP_FLAGS_INCLUDE_IN_STYLES
@ IOP_FLAGS_SUPPORTS_BLENDING
#define IOP_GUI_ALLOC(module)
GtkWidget * dt_bauhaus_slider_from_params(dt_iop_module_t *self, const char *param)
float *const restrict const size_t k
float *const restrict const size_t const size_t ch
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(const int devid, const int width, const int height, const int bpp)
int dt_opencl_create_kernel(const int prog, const char *name)
void * dt_opencl_copy_host_to_device_constant(const int devid, const size_t size, void *host)
void dt_opencl_free_kernel(const int kernel)
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)
struct _GtkWidget GtkWidget
struct dt_iop_module_t *void * data
int kernel_highpass_vblur
int kernel_highpass_hblur
int kernel_highpass_invert
dt_iop_global_data_t * data
dt_iop_global_data_t * global_data
Region of interest passed through the pixelpipe.