105 return _(
"hot pixels");
110 return dt_iop_set_description(self, _(
"remove abnormally bright pixels by dampening them with neighbours"),
112 _(
"linear, raw, scene-referred"),
113 _(
"reconstruction, raw"),
114 _(
"linear, raw, scene-referred"));
142 int *
const count,
float *
const maxin)
144 const float other = in[offset];
148 if(other > *maxin) *maxin = other;
162 const void *
const ivoid,
void *
const ovoid,
167 const int min_neighbours = data->
permissive ? 3 : 4;
169 const int widthx2 =
width * 2;
173 const float *in = (
float *)ivoid + (
size_t)
width *
row + 2;
175 for(
int col = 2; col <
width - 2; col++, in++,
out++)
177 float mid = *in * multiplier;
186 if(count >= min_neighbours)
198 const void *
const ivoid,
void *
const ovoid,
199 const dt_iop_roi_t *
const roi_out,
const uint8_t (*
const xtrans)[6])
203 int offsets[6][6][4][2];
205 const int search[20][2] = { { -1, 0 }, { 1, 0 }, { 0, -1 }, { 0, 1 }, { -1, -1 }, { -1, 1 }, { 1, -1 },
206 { 1, 1 }, { -2, 0 }, { 2, 0 }, { 0, -2 }, { 0, 2 }, { -2, -1 }, { -2, 1 },
207 { 2, -1 }, { 2, 1 }, { -1, -2 }, { 1, -2 }, { -1, 2 }, { 1, 2 } };
209 for(
int j = 0; j < 6; ++j)
211 for(
int i = 0;
i < 6; ++
i)
213 const uint8_t c =
FCxtrans(j,
i, roi_out, xtrans);
214 for(
int s = 0, found = 0; s < 20 && found < 4; ++s)
216 if(c ==
FCxtrans(j + search[s][1],
i + search[s][0], roi_out, xtrans))
218 offsets[j][
i][found][0] = search[s][0];
219 offsets[j][
i][found][1] = search[s][1];
228 const int min_neighbours = data->
permissive ? 3 : 4;
233 const float *in = (
float *)ivoid + (
size_t)
width *
row + 2;
235 for(
int col = 2; col <
width - 2; col++, in++,
out++)
237 float mid = *in * multiplier;
242 for(
int n = 0;
n < 4; ++
n)
244 int xx = offsets[
row % 6][col % 6][
n][0];
245 int yy = offsets[
row % 6][col % 6][
n][1];
246 float other = *(in + xx + yy * (size_t)
width);
250 if(other > maxin) maxin = other;
254 if(count >= min_neighbours)
292 const int devid = pipe->
devid;
293 const int min_neighbours = data->
permissive ? 3 : 4;
297 cl_mem dev_xtrans = NULL;
318 const int rx = roi_out->
x;
319 const int ry = roi_out->
y;
326 if(err != CL_SUCCESS)
goto error;
338 const int program = 2;
364 const dt_image_t *img = &
module->dev->image_storage;
367 module->hide_enable_button = !enabled;
368 dt_iop_fmt_log(module,
"reload_defaults: class=%s needs_demosaic=%d mono=%d -> hide_enable=%d",
378 const gboolean
state = current_state && active;
379 dt_iop_fmt_log(self,
"force_enable: class=%s supported=%d current=%d -> %d",
381 active, current_state,
state);
391 d->multiplier =
p->strength / 2.0;
392 d->threshold =
p->threshold;
393 d->permissive =
p->permissive;
397 if(
p->strength == 0.0) piece->
enabled = 0;
398 dt_iop_fmt_log(self,
"commit: class=%s filters=%u strength=%.3f -> enabled=%d",
400 d->filters,
p->strength, piece->
enabled);
420 gtk_toggle_button_set_active(
g->permissive,
p->permissive);
438 gtk_widget_set_tooltip_text(
g->threshold, _(
"lower threshold for hot pixel"));
442 gtk_widget_set_tooltip_text(
g->strength, _(
"strength of hot pixel correction"));
453 gtk_stack_add_named(GTK_STACK(self->
gui->
widget), label_non_raw,
"non_raw");
454 gtk_stack_add_named(GTK_STACK(self->
gui->
widget), box_raw,
"raw");
static void error(char *msg)
void dt_bauhaus_slider_set_digits(GtkWidget *widget, int val)
struct _GtkWidget GtkWidget
GtkWidget, opaque, spelled exactly as GTK spells it.
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)
static int FCxtrans(const int row, const int col, global const unsigned char(*const xtrans)[6])
gboolean enabled
–doc was passed on the command line
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
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 dt_iop_gui_data_t * dt_iop_gui_data(const struct dt_iop_module_t *m)
The module's GUI data blob, NULL-safe for headless callers: IOP process() implementations read it for...
#define IOP_GUI_ALLOC(module)
static float kernel(const float *x, const float *y)
GtkWidget * dt_ui_label_new(const gchar *str)
#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_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)
#define __OMP_PARALLEL_FOR__(...)
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_iop_module_gui_t * gui
struct dt_develop_t * dev
dt_iop_global_data_t * global_data
Region of interest passed through the pixelpipe.
#define __DT_CLONE_TARGETS__