76 gboolean in_between =
FALSE;
78 for(GList *modules = iop_list; modules; modules = g_list_next(modules))
83 if(strcmp(mod->
op, module->
op) == 0)
break;
86 if(strcmp(mod->
op,
"colorout") == 0)
93 if(strcmp(mod->
op,
"colorin") == 0)
103 const char *filename = NULL;
117 const char *filename,
124 fprintf(stderr,
"[dt_ioppr_set_pipe_work_profile_info] unsupported working profile %i %s, it will be replaced with linear Rec2020\n",
type, filename);
127 pipe->work_profile_info = profile_info;
136 const char *filename,
157 profile_info =
pipe->owned_input_profile_info;
162 g_strlcpy(profile_info->
filename, filename,
sizeof(profile_info->
filename));
163 profile_info->
intent = intent;
165 profile_info->
grey = 0.1842f;
176 "[dt_ioppr_set_pipe_input_profile_info] unsupported input profile %i %s, it will be replaced with "
181 else if(image_derived)
191 pipe->input_profile_info = profile_info;
200 const char *filename,
212 "[dt_ioppr_set_pipe_output_profile_info] unsupported output"
213 " profile %i %s, it will be replaced with sRGB\n",
218 pipe->output_profile_info = profile_info;
225 return pipe->work_profile_info;
230 return pipe->input_profile_info;
235 return pipe->output_profile_info;
265 const char **profile_filename)
268 *profile_filename = NULL;
276 if(!strcmp(module_so->
op,
"colorin"))
278 colorin_so = module_so;
282 if(colorin_so && colorin_so->
get_p)
284 for(
const GList *modules =
dev->iop; modules; modules = g_list_next(modules))
287 if(!strcmp(module->
op,
"colorin"))
297 char *_filename = colorin_so->
get_p(colorin->
params,
"filename_work");
298 if(_type && _filename)
300 *profile_type = *_type;
301 *profile_filename = _filename;
304 fprintf(stderr,
"[dt_ioppr_get_work_profile_type] can't get colorin parameters\n");
307 fprintf(stderr,
"[dt_ioppr_get_work_profile_type] can't find colorin iop\n");
312 const char **profile_filename)
315 *profile_filename = NULL;
320 for(
const GList *modules = g_list_last(
dt_iop_get_modules_so()); modules; modules = g_list_previous(modules))
323 if(!strcmp(module_so->
op,
"colorout"))
325 colorout_so = module_so;
329 if(colorout_so && colorout_so->
get_p)
331 for(
const GList *modules = g_list_last(
dev->iop); modules; modules = g_list_previous(modules))
334 if(!strcmp(module->
op,
"colorout"))
344 char *_filename = colorout_so->
get_p(colorout->
params,
"filename");
345 if(_type && _filename)
347 *profile_type = *_type;
348 *profile_filename = _filename;
351 fprintf(stderr,
"[dt_ioppr_get_export_profile_type] can't get colorout parameters\n");
354 fprintf(stderr,
"[dt_ioppr_get_export_profile_type] can't find colorout iop\n");
359#undef DT_IOP_ORDER_PROFILE
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_init_profile_info(dt_iop_order_iccprofile_info_t *profile_info, const int lutsize)
Put a freshly allocated dt_iop_order_iccprofile_info_t into its empty state – must be called before u...
The colour-profile struct and the maths over it: the derived matrix/LUT engine.
The colour-profile module's API: which profiles exist, and how to apply one.
GList * dt_iop_get_modules_so(void)
void * dt_alloc_align(size_t size)
Allocate cacheline-aligned memory.
dt_atomic_set_uint64 & dev
dt_iop_order_iccprofile_info_t * dt_ioppr_get_pipe_output_profile_info(const struct dt_dev_pixelpipe_t *pipe)
void dt_ioppr_get_work_profile_type(struct dt_develop_t *dev, dt_colorspaces_color_profile_type_t *profile_type, const char **profile_filename)
dt_ioppr_profile_stage_t dt_ioppr_get_module_profile_stage(const dt_iop_module_t *module)
dt_iop_order_iccprofile_info_t * dt_ioppr_get_pipe_work_profile_info(const struct dt_dev_pixelpipe_t *pipe)
dt_iop_order_iccprofile_info_t * dt_ioppr_set_pipe_work_profile_info(struct dt_develop_t *dev, struct dt_dev_pixelpipe_t *pipe, const dt_colorspaces_color_profile_type_t type, const char *filename, const int intent)
dt_iop_order_iccprofile_info_t * dt_ioppr_set_pipe_output_profile_info(struct dt_develop_t *dev, struct dt_dev_pixelpipe_t *pipe, const dt_colorspaces_color_profile_type_t type, const char *filename, const int intent)
dt_iop_order_iccprofile_info_t * dt_ioppr_get_pipe_current_profile_info(dt_iop_module_t *module, const struct dt_dev_pixelpipe_t *pipe)
dt_iop_order_iccprofile_info_t * dt_ioppr_get_pipe_input_profile_info(const struct dt_dev_pixelpipe_t *pipe)
dt_iop_order_iccprofile_info_t * dt_ioppr_set_pipe_input_profile_info(struct dt_develop_t *dev, struct dt_dev_pixelpipe_t *pipe, const dt_colorspaces_color_profile_type_t type, const char *filename, const int intent, const dt_colormatrix_t matrix_in)
__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_ioppr_get_export_profile_type(struct dt_develop_t *dev, dt_colorspaces_color_profile_type_t *profile_type, const char **profile_filename)
@ DT_IOPPR_PROFILE_STAGE_INPUT
@ DT_IOPPR_PROFILE_STAGE_WORK
@ DT_IOPPR_PROFILE_STAGE_OUTPUT
memcpy(roundtrip, origin, sizeof(roundtrip))
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.
static const dt_dev_pixelpipe_t * pipe
_lib_location_type_t type
#define IS_NULL_PTR(p)
C is way too permissive with !=, == and if(var) checks, which can mean too many things depending on w...
float DT_ALIGNED_ARRAY dt_colormatrix_t[4][4]
static void transpose_3xSSE(const dt_colormatrix_t input, dt_colormatrix_t output)
static int mat3SSEinv(dt_colormatrix_t dst, const dt_colormatrix_t src)
dt_colorspaces_color_profile_type_t
@ DT_COLORSPACE_EMBEDDED_ICC
Image-derived profiles: enum 9..14, NOT registered in the list.
@ DT_COLORSPACE_DISPLAY
The monitor profile – the one list entry that mutates after init.
@ DT_COLORSPACE_SRGB
sRGB – registered TWICE, and the two entries are not interchangeable.
@ DT_COLORSPACE_NONE
No profile / "take it from the image settings". Never matches a list entry.
@ DT_COLORSPACE_LIN_REC2020
@ DT_COLORSPACE_ALTERNATE_MATRIX
void *(* get_p)(const void *param, const char *name)
struct dt_develop_t * dev
A profile reduced to the arithmetic the pixel loop can run: two matrices and six tone-curve LUTs,...
int nonlinearlut
Non-zero when the profile has tone curves at all; tested as a boolean everywhere, but it is really th...
dt_iop_color_intent_t intent
Rendering intent, passed to cmsCreateTransform on the lcms2 fallback only. The matrix path ignores it...
dt_colormatrix_t matrix_out_transposed
float grey
Luminance of 18.42% grey through this profile, used by the tone-mapping modules to place middle grey....
dt_colorspaces_color_profile_type_t type
Profile identity, half of the memo key. DT_COLORSPACE_NONE means "unset" and makes every apply functi...
dt_colormatrix_t matrix_out
XYZ (D50) -> RGB, row-major; the inverse of matrix_in.
char filename[DT_IOP_COLOR_ICC_LEN]
ICC file name, the other half of the memo key; "" for every built-in. Compared with strcmp,...
dt_colormatrix_t matrix_in_transposed
dt_colormatrix_t matrix_in
RGB -> XYZ (D50), row-major. matrix_in[1][*] is the luminance row. NaN in [0][0] marks the whole prof...
#define __DT_CLONE_TARGETS__