106 _(
"linear or non-linear, Lab, scene-referred"),
107 _(
"frequential, Lab"),
108 _(
"special, Lab, scene-referred"));
133 const int rad =
MAX_RADIUS * (fmin(100.0f,
d->sharpness + 1) / 100.0f);
137 const int wdh = ceilf(3.0f *
sigma);
158 cl_mem dev_tmp = NULL;
161 const int devid = pipe->
devid;
165 const int rad =
MAX_RADIUS * (fmin(100.0f,
d->sharpness + 1) / 100.0f);
171 const int wdh = ceilf(3.0f *
sigma);
172 const int wd = 2 * wdh + 1;
173 const size_t mat_size = (size_t)wd *
sizeof(
float);
174 float *mat = malloc(mat_size);
175 float *
m = mat + wdh;
179 for(
int l = -wdh; l <= wdh; l++)
weight +=
m[l] = expf(-(l * l) / (2.f *
sigma *
sigma));
180 for(
int l = -wdh; l <= wdh; l++)
m[l] /=
weight;
185 float contrast_scale = ((
d->contrast / 100.0f) * 7.5f);
190 .cellsize =
sizeof(float), .overhead = 0,
191 .sizex = 1 << 16, .sizey = 1 };
194 hblocksize = hlocopt.
sizex;
201 .cellsize =
sizeof(float), .overhead = 0,
202 .sizex = 1, .sizey = 1 << 16 };
205 vblocksize = vlocopt.
sizey;
231 if(err != CL_SUCCESS)
goto error;
239 local[0] = hblocksize;
251 if(err != CL_SUCCESS)
goto error;
259 local[1] = vblocksize;
270 if(err != CL_SUCCESS)
goto error;
284 if(err != CL_SUCCESS)
goto error;
307 const float *
const in = (
float *)ivoid;
314 const size_t npixels = (size_t)roi_out->
height * roi_out->
width;
316 for(
size_t k = 0;
k < (size_t)npixels;
k++)
323 const int range = 2 * radius + 1;
324 const int hr = range / 2;
331 const float contrast_scale = ((data->
contrast / 100.0) * 7.5);
338 for(
size_t k = npixels - 1;
k > npixels/4;
k--)
340 size_t index =
ch *
k;
342 const float L =
out[
k] * 0.5 + in[index] * 0.5;
343 out[index] =
LCLIP(50.0f + ((
L - 50.0f) * contrast_scale));
344 out[index + 1] =
out[index + 2] = 0.0f;
345 out[index + 3] = in[index + 3];
348 for(ssize_t
k = npixels/4;
k >= 0;
k--)
350 size_t index =
ch *
k;
352 const float L =
out[
k] * 0.5 + in[index] * 0.5;
353 out[index] =
LCLIP(50.0f + ((
L - 50.0f) * contrast_scale));
354 out[index + 1] =
out[index + 2] = 0.0f;
355 out[index + 3] = in[index + 3];
367 d->sharpness =
p->sharpness;
368 d->contrast =
p->contrast;
385 const int program = 4;
412 gtk_widget_set_tooltip_text(
g->sharpness, _(
"the sharpness of highpass filter"));
416 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)
typedef void((*dt_cache_allocate_t)(void *userdata, dt_cache_entry_t *entry))
struct _GtkWidget GtkWidget
GtkWidget, opaque, spelled exactly as GTK spells it.
const dt_colormatrix_t dt_aligned_pixel_t out
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
GtkWidget * dt_bauhaus_slider_from_params(dt_iop_module_t *self, const char *param)
#define IOP_GUI_ALLOC(module)
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
float *const restrict const size_t const size_t ch
#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_free_align(ptr)
Release memory from dt_alloc_align() and set ptr to NULL.
static void * dt_calloc_align(size_t size)
dt_alloc_align() followed by a zero fill.
#define dt_free(ptr)
g_free() ptr and set it to NULL, skipping both if it is already NULL.
#define DT_MODULE_INTROSPECTION(MODVER, PARAMSTYPE)
DT_MODULE() for a module whose params struct is introspected.
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)
#define __OMP_PARALLEL_FOR__(...)
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.
#define __DT_CLONE_TARGETS__