49#include <glib/gstdio.h>
80#define DT_IOP_LUT3D_MAX_PATHNAME 512
81#define DT_IOP_LUT3D_MAX_LUTNAME 128
82#define DT_IOP_LUT3D_CLUT_LEVEL 48
83#define DT_IOP_LUT3D_MAX_KEYPOINTS 2048
160 _(
"corrective or creative"),
161 _(
"linear, RGB, display-referred"),
162 _(
"defined by profile, RGB"),
163 _(
"linear or non-linear, RGB, display-referred"));
182 const int new_version)
184 if(old_version == 1 && new_version == 3)
186 typedef struct dt_iop_lut3d_params_v1_t
191 } dt_iop_lut3d_params_v1_t;
193 dt_iop_lut3d_params_v1_t *o = (dt_iop_lut3d_params_v1_t *)old_params;
195 g_strlcpy(
n->filepath, o->filepath,
sizeof(
n->filepath));
196 n->colorspace = o->colorspace;
197 n->interpolation = o->interpolation;
199 memset(&
n->c_clut, 0,
sizeof(
n->c_clut));
200 memset(&
n->lutname, 0,
sizeof(
n->lutname));
203 if(old_version == 2 && new_version == 3)
205 typedef struct dt_iop_lut3d_params_v2_t
213 uint32_t gmic_version;
214 } dt_iop_lut3d_params_v2_t;
216 dt_iop_lut3d_params_v2_t *o = (dt_iop_lut3d_params_v2_t *)old_params;
229 fprintf(stderr,
"[lut3d] invalid png file %s\n", filepath);
237 fprintf(stderr,
"[lut3d] png bit-depth %d not supported\n", png.
bit_depth);
246 while(level * level * level < png.
width) ++level;
248 if(level * level * level != png.
width)
252 fprintf(stderr,
"[lut3d] this Ansel build is not compatible with compressed clut\n");
253 dt_control_log(_(
"this Ansel build is not compatible with compressed clut"));
257 fprintf(stderr,
"[lut3d] invalid level in png file %d %d\n", level, png.
width);
268 fprintf(stderr,
"[lut3d] error - LUT 3D size %d > 256\n", level);
269 dt_control_log(_(
"error - lut 3D size %d exceeds the maximum supported"), level);
275 dt_print(
DT_DEBUG_DEV,
"[lut3d] allocating %" G_GSIZE_FORMAT
" bytes for png file\n", buf_size);
280 fprintf(stderr,
"[lut3d] error allocating buffer for png lut\n");
288 fprintf(stderr,
"[lut3d] error - could not read png image `%s'\n", filepath);
289 dt_control_log(_(
"error - could not read png image %s"), filepath);
293 const size_t buf_size_lut = (size_t)png.
height * png.
height * 3;
294 dt_print(
DT_DEBUG_DEV,
"[lut3d] allocating %" G_GSIZE_FORMAT
" floats for png lut - level %d\n", buf_size_lut, level);
298 fprintf(stderr,
"[lut3d] error - allocating buffer for png lut\n");
304 const float norm = 1.0f / (powf(2.f, png.
bit_depth) - 1.0f);
307 for (
size_t i = 0;
i < buf_size_lut; ++
i)
308 lclut[
i] = (
float)buf[
i] * norm;
312 for (
size_t i = 0;
i < buf_size_lut; ++
i)
313 lclut[
i] = (256.0f * (
float)buf[2*
i] + (float)buf[2*
i+1]) * norm;
323 if (strncmp(str,
"nan", 3) == 0 || strncmp(str,
"NAN", 3) == 0)
325 double integral_result = 0;
326 double fractional_result = 0;
332 }
else if (*str ==
'-')
337 if (strncmp(str,
"inf", 3) == 0 || strncmp(str,
"INF", 3) == 0)
338 return sign * INFINITY;
341 const char * istr_back = str;
342 while (*str >=
'0' && *str <=
'9')
344 const char * istr_2 = str;
345 double imultiplier = 1;
346 while (istr_2 != istr_back)
349 integral_result += (*istr_2 -
'0') * imultiplier;
357 const char * fstr_back = str;
358 while (*str >=
'0' && *str <=
'9')
360 const char * fstr_2 = str;
361 double fmultiplier = 1;
362 while (fstr_2 != fstr_back)
365 fractional_result += (*fstr_2 -
'0') * fmultiplier;
368 fractional_result /= fmultiplier;
370 double result =
sign * (integral_result + fractional_result);
371 if (*str ==
'e' || *str ==
'E')
374 double power_sign = 1;
380 else if (*str ==
'-')
386 while (*str >=
'0' && *str <=
'9')
393 result *= pow(10, power);
395 result /= pow(10, power);
404 const int max_token_len = 50;
407 char *
t = &token[0][0];
410 while (*l != 0 &&
i < max_token_len)
412 if (*l ==
'#' || *l ==
'\n' || *l ==
'\r')
426 if (*l ==
' ' || *l ==
'\t')
433 t = &token[c > 2 ? 2 : c][0];
451 token[0][max_token_len - 1] = 0;
452 token[1][max_token_len - 1] = 0;
453 token[2][max_token_len - 1] = 0;
468 uint32_t out_of_range_nb = 0;
470 if(!(cube_file = g_fopen(filepath,
"r")))
472 fprintf(stderr,
"[lut3d] invalid cube file: %s\n", filepath);
476 while ((read =
getline(&line, &len, cube_file)) != -1)
481 if (token[0][0] ==
'T')
continue;
482 else if (strcmp(
"DOMAIN_MIN", token[0]) == 0)
484 if (strtod(token[1], NULL) != 0.0f)
486 fprintf(stderr,
"[lut3d] DOMAIN MIN <> 0.0 is not supported\n");
493 else if (strcmp(
"DOMAIN_MAX", token[0]) == 0)
495 if (strtod(token[1], NULL) != 1.0f)
497 fprintf(stderr,
"[lut3d] DOMAIN MAX <> 1.0 is not supported\n");
504 else if (strcmp(
"LUT_1D_SIZE", token[0]) == 0)
506 fprintf(stderr,
"[lut3d] 1D cube lut is not supported\n");
512 else if (strcmp(
"LUT_3D_SIZE", token[0]) == 0)
514 level = atoll(token[1]);
517 fprintf(stderr,
"[lut3d] error - LUT 3D size %d > 256\n", level);
518 dt_control_log(_(
"error - lut 3D size %d exceeds the maximum supported"), level);
523 buf_size = level * level * level * 3;
524 dt_print(
DT_DEBUG_DEV,
"[lut3d] allocating %" G_GSIZE_FORMAT
" bytes for cube lut - level %d\n", buf_size, level);
528 fprintf(stderr,
"[lut3d] error - allocating buffer for cube lut\n");
535 else if (nb_token == 3)
539 fprintf(stderr,
"[lut3d] error - cube lut size is not defined\n");
545 for (
int j=0; j < 3; j++)
548 if(isnan(lclut[
i+j]))
550 fprintf(stderr,
"[lut3d] error - invalid number line %d\n", (
int)
i/3);
551 dt_control_log(_(
"error - cube lut invalid number line %d"), (
int)
i/3);
556 else if(lclut[
i+j] < 0.0 || lclut[
i+j] > 1.0)
563 if (
i != buf_size ||
i == 0)
565 fprintf(stderr,
"[lut3d] error - cube lut lines number %d is not correct, should be %d\n",
566 (
int)
i/3, (
int)buf_size/3);
567 dt_control_log(_(
"error - cube lut lines number %d is not correct, should be %d"),
568 (
int)
i/3, (
int)buf_size/3);
576 fprintf(stderr,
"[lut3d] warning - %d out of range values [0,1]\n", out_of_range_nb);
577 dt_control_log(_(
"warning - cube lut %d out of range values [0,1]"), out_of_range_nb);
598 if(!(cube_file = g_fopen(filepath,
"r")))
600 fprintf(stderr,
"[lut3d] invalid 3dl file: %s\n", filepath);
604 while ((read =
getline(&line, &len, cube_file)) != -1)
614 const int min_shaper = atoll(token[0]);
615 const int max_shaper = atoll(token[2]);
616 if (max_shaper > min_shaper)
621 fprintf(stderr,
"[lut3d] error - the maximum shaper lut value %d is too low\n", max_shaper);
622 dt_control_log(_(
"error - the maximum shaper lut value %d is too low"), max_shaper);
627 buf_size = level * level * level * 3;
628 dt_print(
DT_DEBUG_DEV,
"[lut3d] allocating %" G_GSIZE_FORMAT
" bytes for cube lut - level %d\n", buf_size, level);
632 fprintf(stderr,
"[lut3d] error - allocating buffer for cube lut\n");
641 else if (nb_token == 3)
645 fprintf(stderr,
"[lut3d] error - cube lut size is not defined\n");
652 const uint32_t level2 = level * level;
653 const uint32_t red =
i / level2;
654 const uint32_t rr =
i - red * level2;
655 const uint32_t green = rr / level;
656 const uint32_t blue = rr - green * level;
657 const uint32_t
k = red + level * green + level2 * blue;
658 for (
int j=0; j < 3; j++)
660 const uint32_t
value = atoll(token[j]);
661 lclut[
k*3+j] = (float)
value;
662 if (
value > max_value)
666 if (
i * 3 > buf_size)
671 if (
i * 3 != buf_size ||
i == 0)
673 fprintf(stderr,
"[lut3d] error - cube lut lines number is not correct\n");
674 dt_control_log(_(
"error - cube lut lines number is not correct"));
685 while ((inorm < max_value) && (inorm < 65536))
689 fprintf(stderr,
"[lut3d] error - the maximum lut value does not match any valid bit depth\n");
690 dt_control_log(_(
"error - the maximum lut value does not match any valid bit depth"));
694 const float norm = 1.0f / (float)(inorm - 1);
696 for (
i =0;
i < buf_size;
i++)
697 lclut[
i] = CLAMP(lclut[
i] * norm, 0.0f, 1.0f);
708 cl_int err = CL_SUCCESS;
709 const float *
const clut = (
float *)
d->clut;
710 const int level =
d->level;
726 cl_mem clut_cl = NULL;
727 const int devid = pipe->
devid;
737 fprintf(stderr,
"[lut3d process_cl] error allocating memory\n");
738 err = CL_MEM_OBJECT_ALLOCATION_FAILURE;
744 work_profile, lut_profile,
"work profile to LUT profile");
760 lut_profile, work_profile,
"LUT profile to work profile");
770 if(err != CL_SUCCESS)
772 fprintf(stderr,
"[lut3d process_cl] error %i enqueue kernel\n", err);
780 return (err == CL_SUCCESS) ?
TRUE :
FALSE;
791 const float *
const clut = (
float *)
d->clut;
792 const uint16_t level =
d->level;
793 const int interpolation =
d->params.interpolation;
811 work_profile, lut_profile,
"work profile to LUT profile");
815 lut_profile, work_profile,
"LUT profile to work profile");
832 const int len = strlen(filepath);
833 for(
int i=0;
i<len; ++
i)
834 if (filepath[
i]==
'\\') filepath[
i] =
'/';
839 const int program = 28;
878#define DT_LUT3D_GMZ_DOC_URL "https://ansel.photos/en/doc/views/darkroom/modules/lut-3d/"
882 if(
p->nb_keypoints > 0)
return TRUE;
883 return p->filepath[0] && (g_str_has_suffix(
p->filepath,
".gmz") || g_str_has_suffix(
p->filepath,
".GMZ"));
889 const char *filepath =
p->filepath;
891 if (filepath[0] && lutfolder[0])
893 char *fullpath = g_build_filename(lutfolder, filepath, NULL);
894 if (g_str_has_suffix (filepath,
".png") || g_str_has_suffix (filepath,
".PNG"))
898 else if (g_str_has_suffix (filepath,
".cube") || g_str_has_suffix (filepath,
".CUBE"))
902 else if (g_str_has_suffix (filepath,
".3dl") || g_str_has_suffix (filepath,
".3DL"))
919 if (strcmp(
p->filepath,
d->params.filepath) != 0 || strcmp(
p->lutname,
d->params.lutname) != 0 )
935 "[lut3d] %s: compressed G'MIC LUTs (.gmz) are no longer supported, so no LUT was "
936 "applied to this image. Convert it to .cube -- see %s\n",
955 d->params.filepath[0] =
'\0';
976 fprintf(stdout,
"filepath: %s\n", filepath);
981 g_strlcpy(
p->filepath, filepath,
sizeof(
p->filepath));
990 const int j = strlen(lutfolder) + 1;
992 for(
i = 0; filepath[
i+j] !=
'\0';
i++)
993 filepath[
i] = filepath[
i+j];
1000 if (!filename || !filename[0])
return res;
1001 char *
p = g_strrstr(filename,
".");
1003 char *fext = g_ascii_strdown(g_strdup(
p), -1);
1004 if (!g_strcmp0(fext,
".png") || !g_strcmp0(fext,
".cube") || !g_strcmp0(fext,
".3dl") )
res =
TRUE;
1022 char *relativepath = g_path_get_dirname(filepath);
1023 char *
folder = g_build_filename(lutfolder, relativepath, NULL);
1029 while ((dir = readdir(
d)) != NULL)
1031 char *file = dir->d_name;
1034 char *ofilepath = (strcmp(relativepath,
".") != 0)
1035 ? g_build_filename(relativepath, file, NULL)
1064 if (strlen(lutfolder) == 0)
1066 fprintf(stderr,
"[lut3d] Lut root folder not defined\n");
1072 GtkFileChooserNative *filechooser = gtk_file_chooser_native_new(
1073 _(
"select lut file"), GTK_WINDOW(win), GTK_FILE_CHOOSER_ACTION_OPEN,
1074 _(
"_select"), _(
"_cancel"));
1075 gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(filechooser),
FALSE);
1077 char *composed = g_build_filename(lutfolder,
p->filepath, NULL);
1078 if (strlen(
p->filepath) == 0 || g_access(composed, F_OK) == -1)
1079 gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(filechooser), lutfolder);
1081 gtk_file_chooser_select_filename(GTK_FILE_CHOOSER(filechooser), composed);
1084 GtkFileFilter* filter = GTK_FILE_FILTER(gtk_file_filter_new());
1085 gtk_file_filter_add_pattern(filter,
"*.png");
1086 gtk_file_filter_add_pattern(filter,
"*.PNG");
1087 gtk_file_filter_add_pattern(filter,
"*.cube");
1088 gtk_file_filter_add_pattern(filter,
"*.CUBE");
1089 gtk_file_filter_add_pattern(filter,
"*.3dl");
1090 gtk_file_filter_add_pattern(filter,
"*.3DL");
1091 gtk_file_filter_set_name(filter, _(
"hald cluts (png) or 3D lut (cube or 3dl)"));
1092 gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(filechooser), filter);
1093 gtk_file_chooser_set_filter(GTK_FILE_CHOOSER(filechooser), filter);
1097 filter = GTK_FILE_FILTER(gtk_file_filter_new());
1098 gtk_file_filter_add_pattern(filter,
"*");
1099 gtk_file_filter_set_name(filter, _(
"all files"));
1100 gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(filechooser), filter);
1102 if(gtk_native_dialog_run(GTK_NATIVE_DIALOG(filechooser)) == GTK_RESPONSE_ACCEPT)
1104 gchar *filepath = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(filechooser));
1105 if (strcmp(lutfolder, filepath) < 0)
1111 else if (!filepath[0])
1113 fprintf(stderr,
"[lut3d] select file outside Lut root folder is not allowed\n");
1114 dt_control_log(_(
"select file outside Lut root folder is not allowed"));
1117 gtk_widget_set_sensitive(
g->filepath,
p->filepath[0]);
1122 g_object_unref(filechooser);
1134 if(order_lut3d < order_colorin || order_lut3d > order_colorout)
1136 gtk_widget_hide(
g->colorspace);
1140 gtk_widget_show(
g->colorspace);
1153 GtkWidget *dialog = gtk_message_dialog_new(
1154 GTK_WINDOW(win), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_CLOSE,
1155 _(
"This edit uses a compressed G'MIC LUT (.gmz), which Ansel no longer supports.\n\n"
1156 "No LUT is being applied to this image, so it will not look as it did. Convert the LUT "
1157 "to the .cube format and select it again -- the documentation gives the command.\n\n"
1159 p->filepath[0] ?
p->filepath : _(
"(the LUT was stored inside this edit)"));
1160 gtk_window_set_title(GTK_WINDOW(dialog), _(
"3D LUT: unsupported file format"));
1162 gtk_dialog_add_button(GTK_DIALOG(dialog), _(
"open documentation"), GTK_RESPONSE_HELP);
1163 if(gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_HELP)
1166 GtkWindow *parent = gtk_window_get_transient_for(GTK_WINDOW(dialog));
1167 gtk_widget_destroy(dialog);
1181 gtk_widget_set_sensitive(
g->hbox,
FALSE);
1182 gtk_widget_set_sensitive(
g->filepath,
FALSE);
1187 gtk_widget_set_sensitive(
g->hbox,
TRUE);
1188 gtk_widget_set_sensitive(
g->filepath,
p->filepath[0]);
1197 g->gmz_warned =
TRUE;
1198 g_strlcpy(
g->gmz_warned_for,
p->filepath,
sizeof(
g->gmz_warned_for));
1216 gtk_widget_set_tooltip_text(button, _(
"select a png (haldclut)"
1217 ", a cube or a 3dl file "
1218 "CAUTION: 3D lut folder must be set in preferences/processing before choosing the lut file"));
1219 gtk_box_pack_start(GTK_BOX(
g->hbox), button,
FALSE,
FALSE, 0);
1220 g_signal_connect(G_OBJECT(button),
"clicked", G_CALLBACK(
button_clicked), self);
1224 gtk_box_pack_start(GTK_BOX(
g->hbox),
g->filepath,
TRUE,
TRUE, 0);
1225 gtk_widget_set_tooltip_text(
g->filepath,
1226 _(
"the file path (relative to lut folder) is saved with image (and not the lut data themselves)"));
1227 g_signal_connect(G_OBJECT(
g->filepath),
"value-changed", G_CALLBACK(
filepath_callback), self);
1233 gtk_widget_set_tooltip_text(
g->colorspace, _(
"select the color space in which the LUT has to be applied"));
1236 gtk_widget_set_tooltip_text(
g->interpolation, _(
"select the interpolation method"));
GtkWidget * dt_gui_main_window(void)
void cleanup(dt_imageio_module_format_t *self)
void dt_bauhaus_combobox_clear(GtkWidget *widget)
void dt_bauhaus_combobox_set_entries_ellipsis(GtkWidget *widget, PangoEllipsizeMode ellipis)
const char * dt_bauhaus_combobox_get_text(GtkWidget *widget)
GtkWidget * dt_bauhaus_combobox_new(dt_bauhaus_t *bh, dt_gui_module_t *self)
gboolean dt_bauhaus_combobox_set_from_text(GtkWidget *widget, const char *text)
void dt_bauhaus_combobox_add(GtkWidget *widget, const char *text)
#define DT_BAUHAUS_WIDGET(obj)
static void transform(float *x, float *o, const float *m, const float t_h, const float t_v)
dt_iop_order_iccprofile_info_t * dt_colorspaces_add_profile(const dt_colorspaces_color_profile_type_t profile_type, const char *profile_filename, const int intent)
Find-or-build the derived matrix/LUT data for a profile identity, memoised.
void dt_ioppr_transform_image_colorspace_rgb(const float *const restrict image_in, float *const restrict image_out, const int width, const int height, const dt_iop_order_iccprofile_info_t *const profile_info_from, const dt_iop_order_iccprofile_info_t *const profile_info_to, const char *message)
int dt_ioppr_transform_image_colorspace_rgb_cl(const int devid, cl_mem dev_img_in, cl_mem dev_img_out, const int width, const int height, const dt_iop_order_iccprofile_info_t *const profile_info_from, const dt_iop_order_iccprofile_info_t *const profile_info_to, const char *message)
OpenCL counterpart of dt_ioppr_transform_image_colorspace_rgb().
The colour-profile module's API: which profiles exist, and how to apply one.
struct _GtkWidget GtkWidget
GtkWidget, opaque, spelled exactly as GTK spells it.
gchar * dt_conf_get_string(const char *name)
Read the stored string for name as a private copy.
void dt_control_log(const char *msg,...)
struct dt_bauhaus_t * dt_bauhaus_get_global(void)
#define dt_dev_add_history_item(dev, module, enable, redraw)
__DT_CLONE_TARGETS__ dt_iop_order_iccprofile_info_t * dt_ioppr_get_iop_work_profile_info(struct dt_iop_module_t *module, GList *iop_list)
void dt_gui_refocus_parent(GtkWindow *parent)
GtkWidget * folder
destination folder chooser
ssize_t getline(char **lineptr, size_t *n, FILE *stream)
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)
int read_header(const char *filename, dt_imageio_png_t *png)
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_combobox_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)
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)
static int calculate_clut(dt_iop_lut3d_params_t *const p, float **clut)
static gboolean _params_need_gmz(const dt_iop_lut3d_params_t *const p)
const char ** description(struct dt_iop_module_t *self)
int process(struct dt_iop_module_t *self, const dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece, const void *const ibuf, void *const obuf)
uint16_t calculate_clut_3dl(const char *const filepath, float **clut)
const char invalid_filepath_prefix[]
void gui_update(dt_iop_module_t *self)
Refresh GUI controls from current params and configuration.
gboolean check_extension(char *filename)
dt_iop_lut3d_interpolation_t
#define DT_IOP_LUT3D_MAX_KEYPOINTS
void init_pipe(struct dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
double dt_atof(const char *str)
uint8_t parse_cube_line(char *line, char(*token)[50])
void module_moved_callback(gpointer instance, dt_iop_module_t *self)
static void filepath_callback(GtkWidget *widget, dt_iop_module_t *self)
void gui_init(dt_iop_module_t *self)
static void button_clicked(GtkWidget *widget, dt_iop_module_t *self)
void filepath_set_unix_separator(char *filepath)
dt_iop_lut3d_colorspace_t
static void update_filepath_combobox(dt_iop_lut3d_gui_data_t *g, char *filepath, char *lutfolder)
#define DT_IOP_LUT3D_MAX_PATHNAME
void gui_cleanup(dt_iop_module_t *self)
static gint array_str_cmp(gconstpointer a, gconstpointer b)
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)
static void _warn_gmz_deprecated(const dt_iop_lut3d_params_t *const p)
uint16_t calculate_clut_haldclut(dt_iop_lut3d_params_t *const p, const char *const filepath, float **clut)
void cleanup_pipe(struct dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
static void _show_hide_colorspace(dt_iop_module_t *self)
uint16_t calculate_clut_cube(const char *const filepath, float **clut)
#define DT_IOP_LUT3D_MAX_LUTNAME
void init_global(dt_iop_module_so_t *module)
static void remove_root_from_path(const char *const lutfolder, char *const filepath)
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)
#define DT_LUT3D_GMZ_DOC_URL
int legacy_params(dt_iop_module_t *self, const void *const old_params, const int old_version, void *new_params, const int new_version)
int dt_ioppr_get_iop_order(GList *iop_order_list, const char *op_name, const int multi_priority)
Return the iop_order for a given operation/instance pair.
int read_image(dt_imageio_module_data_t *jpg_tmp, uint8_t *out)
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_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)
void dt_lut3d_apply(const float *const in, float *const out, const size_t pixel_nb, const float *const clut, const uint16_t level, const float normalization, const dt_lut3d_interpolation_t interpolation)
Apply one interpolation model over a packed RGB CLUT.
#define dt_pixelpipe_cache_alloc_align_cache(size, id)
#define dt_pixelpipe_cache_free_align(mem)
@ DT_COLORSPACE_SRGB
sRGB – registered TWICE, and the two entries are not interchangeable.
@ DT_COLORSPACE_LIN_REC2020
@ DT_COLORSPACE_ITUR_BT1886
@ DT_COLORSPACE_LIN_REC709
#define DT_DEBUG_CONTROL_SIGNAL_DISCONNECT(ctlsig, cb, user_data)
struct dt_control_signal_t * dt_control_signal_get_global(void)
@ DT_SIGNAL_DEVELOP_MODULE_MOVED
This signal is raised when order of modules in pipeline is changed.
#define DT_DEBUG_CONTROL_SIGNAL_CONNECT(ctlsig, signal, cb, user_data)
static const dt_aligned_pixel_simd_t sign
static const dt_aligned_pixel_simd_t value
dt_iop_buffer_dsc_t dsc_in
struct dt_iop_module_t *void * data
struct dt_develop_t * dev
char filename[DT_MAX_FILENAME_LEN]
dt_iop_lut3d_params_t params
int kernel_lut3d_tetrahedral
int kernel_lut3d_trilinear
GtkWidget * interpolation
dt_iop_lut3d_colorspace_t colorspace
dt_iop_lut3d_interpolation_t interpolation
dt_iop_global_data_t * data
dt_iop_params_t * default_params
struct dt_iop_module_gui_t * gui
struct dt_develop_t * dev
dt_iop_global_data_t * global_data
A profile reduced to the arithmetic the pixel loop can run: two matrices and six tone-curve LUTs,...
Region of interest passed through the pixelpipe.
dt_bauhaus_combobox_data_t combobox