29 gboolean success =
TRUE;
31 gchar *target_name = g_strdup_printf(
"%s (%s)", clean_target_name, target_module->
multi_name);
33 if(source_piece == NULL || current_piece == NULL)
35 fprintf(stderr,
"[raster masks] ERROR: source: %s, current: %s\n",
36 (source_piece != NULL) ?
"is defined" :
"is undefined",
37 (current_piece != NULL) ?
"is definded" :
"is undefined");
40 if(source_piece == NULL)
42 hint = g_strdup_printf(
43 _(
"- Check if the module providing the masks for the module %s has not been deleted.\n"),
46 else if(current_piece == NULL)
48 hint = g_strdup_printf(_(
"- Check if the module %s (%s) providing the masks has not been moved above %s.\n"),
50 source_piece->module->multi_name, clean_target_name);
53 dt_control_log(_(
"The %s module is trying to reuse a mask from a module but it can't be found.\n"
55 target_name, hint ? hint :
"");
58 fprintf(stderr,
"[raster masks] no source module for module %s could be found\n", target_name);
62 if(success && !source_piece->
enabled)
65 gchar *source_name = g_strdup_printf(
"%s (%s)", clean_source_name, source_piece->module->multi_name);
66 dt_control_log(_(
"The `%s` module is trying to reuse a mask from disabled module `%s`.\n"
67 "Disabled modules cannot provide their masks to other modules.\n"
68 "\n- Please enable `%s` or change the raster mask in `%s`."),
69 target_name, source_name, source_name, target_name);
71 fprintf(stderr,
"[raster masks] module %s trying to reuse a mask from disabled instance of %s\n",
72 target_name, source_name);
86 gboolean *free_mask,
int *
error)
88 if(!
error)
return NULL;
92 gchar *target_name = g_strdup_printf(
"%s (%s)", clean_target_name, target_module->
multi_name);
94 if(!raster_mask_source)
96 fprintf(stderr,
"[raster masks] The source module of the mask for %s was not found\n", target_name);
103 float *raster_mask = NULL;
107 GList *source_iter = NULL;
108 for(source_iter = g_list_last(pipe->
nodes); source_iter; source_iter = g_list_previous(source_iter))
111 if(candidate->module == target_module)
112 current_piece = candidate;
113 else if(candidate->module == raster_mask_source)
115 source_piece = candidate;
128 gchar *source_name = g_strdup_printf(
"%s (%s)", clean_source_name, source_piece->module->multi_name);
135 "[raster masks] found in %s mask id %i from %s for module %s in pipe %s with hash %" PRIu64
"\n",
136 "internal", raster_mask_id, source_name, target_name,
type, raster_hash);
142 "[raster masks] mask id %i from %s for module %s could not be found in pipe %s. Pipe re-entry will be attempted.\n",
143 raster_mask_id, source_name, target_name,
type);
155 for(GList *iter = g_list_next(source_iter); iter; iter = g_list_next(iter))
162 if(module->module->distort_mask
163 && !(!strcmp(module->module->op,
"finalscale")
164 && module->roi_in.width == 0
165 && module->roi_in.height == 0))
168 (
size_t)module->roi_out.width * module->roi_out.height, 0);
169 if(!transformed_mask)
171 fprintf(stderr,
"[raster masks] could not allocate memory for transformed mask\n");
178 module->module->distort_mask(module->module, pipe, module, raster_mask, transformed_mask,
179 &module->roi_in, &module->roi_out);
182 raster_mask = transformed_mask;
185 else if(!module->module->distort_mask
186 && (module->roi_in.width != module->roi_out.width
187 || module->roi_in.height != module->roi_out.height
188 || module->roi_in.x != module->roi_out.x
189 || module->roi_in.y != module->roi_out.y))
190 fprintf(stderr,
"FIXME: module `%s' changed the roi from %d x %d @ %d / %d to %d x %d | %d / %d but doesn't have "
191 "distort_mask() implemented!\n", module->module->op, module->roi_in.width,
192 module->roi_in.height, module->roi_in.x, module->roi_in.y,
193 module->roi_out.width, module->roi_out.height, module->roi_out.x,
197 if(module->module == target_module)
static void error(char *msg)
Definition ashift_lsd.c:202
#define TRUE
Definition ashift_lsd.c:162
#define FALSE
Definition ashift_lsd.c:158
void dt_control_log(const char *msg,...)
Definition control.c:530
void dt_print(dt_debug_thread_t thread, const char *msg,...)
Definition darktable.c:1530
@ DT_DEBUG_MASKS
Definition darktable.h:647
#define dt_pixelpipe_cache_alloc_align_float_cache(pixels, id)
Definition darktable.h:371
#define dt_free(ptr)
Definition darktable.h:380
static gchar * delete_underscore(const char *s)
Definition darktable.h:1015
#define dt_pixelpipe_cache_free_align(mem)
Definition darktable.h:377
gboolean dt_dev_pixelpipe_activemodule_disables_currentmodule(struct dt_develop_t *dev, struct dt_iop_module_t *current_module)
Definition dev_pixelpipe.c:212
float * dt_pixelpipe_raster_get(GHashTable *raster_masks, const int raster_mask_id)
Get the raster mask with given id from the raster masks hashtable of the pixelpipe.
Definition pixelpipe.c:71
char * dt_pixelpipe_get_pipe_name(dt_dev_pixelpipe_type_t pipe_type)
Definition pixelpipe_hb.c:259
gboolean dt_dev_pixelpipe_unset_reentry(dt_dev_pixelpipe_t *pipe, uint64_t hash)
Remove the re-entry pipeline flag, only if the object identifier is the one that set it....
Definition pixelpipe_hb.c:549
gboolean dt_dev_pixelpipe_set_reentry(dt_dev_pixelpipe_t *pipe, uint64_t hash)
Set the re-entry pipeline flag, only if no object is already capturing it. Re-entered pipelines run w...
Definition pixelpipe_hb.c:535
static gboolean _dt_dev_raster_mask_check(dt_dev_pixelpipe_iop_t *source_piece, dt_dev_pixelpipe_iop_t *current_piece, const dt_iop_module_t *target_module)
Check that the raster-mask provider/consumer relation is still valid in the current pipe.
Definition pixelpipe_raster_masks.c:25
float * dt_dev_get_raster_mask(dt_dev_pixelpipe_t *pipe, const dt_iop_module_t *raster_mask_source, const int raster_mask_id, const dt_iop_module_t *target_module, gboolean *free_mask, int *error)
Definition pixelpipe_raster_masks.c:84
unsigned __int64 uint64_t
Definition strptime.c:74
Definition pixelpipe_hb.h:95
gboolean enabled
Definition pixelpipe_hb.h:110
uint64_t global_mask_hash
Definition pixelpipe_hb.h:126
struct dt_iop_module_t *void * data
Definition pixelpipe_hb.h:96
GHashTable * raster_masks
Definition pixelpipe_hb.h:159
Definition pixelpipe_hb.h:216
gboolean flush_cache
Definition pixelpipe_hb.h:335
GList * nodes
Definition pixelpipe_hb.h:237
dt_dev_pixelpipe_type_t type
Definition pixelpipe_hb.h:284
char multi_name[128]
Definition imageop.h:328