103 return _(
"hot pixels");
108 return dt_iop_set_description(self, _(
"remove abnormally bright pixels by dampening them with neighbours"),
110 _(
"linear, raw, scene-referred"),
111 _(
"reconstruction, raw"),
112 _(
"linear, raw, scene-referred"));
140 int *
const count,
float *
const maxin)
142 const float other = in[offset];
146 if(other > *maxin) *maxin = other;
160 const void *
const ivoid,
void *
const ovoid,
165 const int min_neighbours = data->
permissive ? 3 : 4;
167 const int widthx2 =
width * 2;
171 const float *in = (
float *)ivoid + (
size_t)
width *
row + 2;
173 for(
int col = 2; col <
width - 2; col++, in++,
out++)
175 float mid = *in * multiplier;
184 if(count >= min_neighbours)
196 const void *
const ivoid,
void *
const ovoid,
197 const dt_iop_roi_t *
const roi_out,
const uint8_t (*
const xtrans)[6])
201 int offsets[6][6][4][2];
203 const int search[20][2] = { { -1, 0 }, { 1, 0 }, { 0, -1 }, { 0, 1 }, { -1, -1 }, { -1, 1 }, { 1, -1 },
204 { 1, 1 }, { -2, 0 }, { 2, 0 }, { 0, -2 }, { 0, 2 }, { -2, -1 }, { -2, 1 },
205 { 2, -1 }, { 2, 1 }, { -1, -2 }, { 1, -2 }, { -1, 2 }, { 1, 2 } };
207 for(
int j = 0; j < 6; ++j)
209 for(
int i = 0;
i < 6; ++
i)
211 const uint8_t c =
FCxtrans(j,
i, roi_out, xtrans);
212 for(
int s = 0, found = 0; s < 20 && found < 4; ++s)
214 if(c ==
FCxtrans(j + search[s][1],
i + search[s][0], roi_out, xtrans))
216 offsets[j][
i][found][0] = search[s][0];
217 offsets[j][
i][found][1] = search[s][1];
226 const int min_neighbours = data->
permissive ? 3 : 4;
231 const float *in = (
float *)ivoid + (
size_t)
width *
row + 2;
233 for(
int col = 2; col <
width - 2; col++, in++,
out++)
235 float mid = *in * multiplier;
240 for(
int n = 0;
n < 4; ++
n)
242 int xx = offsets[
row % 6][col % 6][
n][0];
243 int yy = offsets[
row % 6][col % 6][
n][1];
244 float other = *(in + xx + yy * (size_t)
width);
248 if(other > maxin) maxin = other;
252 if(count >= min_neighbours)
290 const int devid = pipe->
devid;
291 const int min_neighbours = data->
permissive ? 3 : 4;
295 cl_mem dev_xtrans = NULL;
316 const int rx = roi_out->
x;
317 const int ry = roi_out->
y;
324 if(err != CL_SUCCESS)
goto error;
336 const int program = 2;
362 const dt_image_t *img = &
module->dev->image_storage;
365 module->hide_enable_button = !enabled;
366 dt_iop_fmt_log(module,
"reload_defaults: class=%s needs_demosaic=%d mono=%d -> hide_enable=%d",
376 const gboolean
state = current_state && active;
377 dt_iop_fmt_log(self,
"force_enable: class=%s supported=%d current=%d -> %d",
379 active, current_state,
state);
389 d->multiplier =
p->strength / 2.0;
390 d->threshold =
p->threshold;
391 d->permissive =
p->permissive;
395 if(
p->strength == 0.0) piece->
enabled = 0;
396 dt_iop_fmt_log(self,
"commit: class=%s filters=%u strength=%.3f -> enabled=%d",
398 d->filters,
p->strength, piece->
enabled);
418 gtk_toggle_button_set_active(
g->permissive,
p->permissive);
436 gtk_widget_set_tooltip_text(
g->threshold, _(
"lower threshold for hot pixel"));
440 gtk_widget_set_tooltip_text(
g->strength, _(
"strength of hot pixel correction"));
446 self->
widget = gtk_stack_new();
447 gtk_stack_set_homogeneous(GTK_STACK(self->
widget),
FALSE);
451 gtk_stack_add_named(GTK_STACK(self->
widget), label_non_raw,
"non_raw");
452 gtk_stack_add_named(GTK_STACK(self->
widget), box_raw,
"raw");
static void error(char *msg)
void dt_bauhaus_slider_set_digits(GtkWidget *widget, int val)
static const dt_aligned_pixel_simd_t const dt_adaptation_t const float p
const dt_colormatrix_t dt_aligned_pixel_t out
dt_image_pipe_class_t dt_image_pipe_class(const dt_image_t *img)
const char * dt_image_pipe_class_name(const dt_image_pipe_class_t klass)
gboolean dt_image_is_monochrome(const dt_image_t *img)
gboolean dt_image_needs_demosaic(const dt_image_t *img)
#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 int FCxtrans(const int row, const int col, global const unsigned char(*const xtrans)[6])
#define DT_GUI_BOX_SPACING
static GtkWidget * dt_ui_label_new(const gchar *str)
const char ** description(struct dt_iop_module_t *self)
void reload_defaults(dt_iop_module_t *module)
void commit_params(struct dt_iop_module_t *self, dt_iop_params_t *params, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
void gui_update(dt_iop_module_t *self)
Refresh GUI controls from current params and configuration.
void init_pipe(struct dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
static void hotpixels_testone(const float *const in, const float mid, const int offset, int *const count, float *const maxin)
void gui_init(dt_iop_module_t *self)
static __DT_CLONE_TARGETS__ void process_bayer(const dt_iop_hotpixels_data_t *data, const void *const ivoid, void *const ovoid, const dt_iop_roi_t *const roi_out)
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 input_format(dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece, dt_iop_buffer_dsc_t *dsc)
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)
gboolean force_enable(struct dt_iop_module_t *self, const gboolean current_state)
static __DT_CLONE_TARGETS__ void process_xtrans(const dt_iop_hotpixels_data_t *data, const void *const ivoid, void *const ovoid, const dt_iop_roi_t *const roi_out, const uint8_t(*const xtrans)[6])
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)
static gboolean _hotpixels_supported(const dt_image_t *img)
static void dt_iop_image_copy_by_size(float *const __restrict__ out, const float *const __restrict__ in, const size_t width, const size_t height, const size_t ch)
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)
#define dt_iop_fmt_log(module, fmt,...)
Debug helper to trace a module's input-format-driven decisions on the -d pipe channel (DT_DEBUG_PIPE)...
@ IOP_FLAGS_SUPPORTS_BLENDING
#define IOP_GUI_ALLOC(module)
GtkWidget * dt_bauhaus_toggle_from_params(dt_iop_module_t *self, const char *param)
GtkWidget * dt_bauhaus_slider_from_params(dt_iop_module_t *self, const char *param)
static float kernel(const float *x, const float *y)
int dt_opencl_enqueue_kernel_2d(const int dev, const int kernel, const size_t *sizes)
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)
void dt_opencl_release_mem_object(cl_mem mem)
struct _GtkWidget GtkWidget
const float uint32_t state[4]
dt_iop_buffer_dsc_t dsc_in
struct dt_iop_module_t *void * data
struct dt_develop_t * dev
int kernel_hotpixels_xtrans
int kernel_hotpixels_bayer
GtkToggleButton * permissive
dt_iop_global_data_t * data
int32_t hide_enable_button
struct dt_develop_t * dev
dt_iop_gui_data_t * gui_data
dt_iop_global_data_t * global_data
Region of interest passed through the pixelpipe.