Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
dt_iop_order_iccprofile_info_t Struct Reference

A profile reduced to the arithmetic the pixel loop can run: two matrices and six tone-curve LUTs, plus the identity they were derived from. More...

#include <iop_profile.h>

+ Collaboration diagram for dt_iop_order_iccprofile_info_t:

Data Fields

dt_colorspaces_color_profile_type_t type
 Profile identity, half of the memo key. DT_COLORSPACE_NONE means "unset" and makes every apply function below refuse the buffer rather than convert it.
 
char filename [DT_IOP_COLOR_ICC_LEN]
 ICC file name, the other half of the memo key; "" for every built-in. Compared with strcmp, so it must be NUL-terminated (g_strlcpy writes it).
 
dt_iop_color_intent_t intent
 Rendering intent, passed to cmsCreateTransform on the lcms2 fallback only. The matrix path ignores it – it is NOT part of the memo key, so the first caller to ask for a given (type, filename) fixes the intent every later caller gets.
 
dt_colormatrix_t matrix_in
 RGB -> XYZ (D50), row-major. matrix_in[1][*] is the luminance row. NaN in [0][0] marks the whole profile as non-matrix; see the struct warning.
 
dt_colormatrix_t matrix_out
 XYZ (D50) -> RGB, row-major; the inverse of matrix_in.
 
int lutsize
 Entry count of each of the six LUTs. Always 65536 in practice: both callers of dt_ioppr_init_profile_info() pass 0, which selects that default.
 
float * lut_in [3]
 Per-channel encoded -> linear tone curve, lutsize entries each, sampled over [0,1]. lut_in[c][0] < 0 marks channel c linear (no curve). Above 1.0 the curve is extrapolated from ::unbounded_coeffs_in instead; see dt_ioppr_eval_trc().
 
float * lut_out [3]
 Per-channel linear -> encoded tone curve, same convention as lut_in.
 
float unbounded_coeffs_in[3][3] DT_ALIGNED_PIXEL
 Power-law fit {a, b, c} of lut_in past 1.0, evaluated by eval_exp() as b * (a*x)^c. Fitted on x = {0.7, 0.8, 0.9, 1.0} by dt_ioppr_init_unbounded_coeffs(), which is what lets the pipeline carry values above white through a curve lcms2 would have clipped. [c][0] == -1.0f marks channel c as having no fit.
 
float unbounded_coeffs_out[3][3] DT_ALIGNED_PIXEL
 Same fit for lut_out.
 
int nonlinearlut
 Non-zero when the profile has tone curves at all; tested as a boolean everywhere, but it is really the COUNT (0..3) of non-linear channels returned by dt_ioppr_init_unbounded_coeffs(), and it is taken from the INPUT curves only – the return value of the lut_out fit is discarded. A profile whose in-curves are linear but whose out-curves are not would therefore read as linear.
 
float grey
 Luminance of 18.42% grey through this profile, used by the tone-mapping modules to place middle grey. Defaults to 0.1842 and is only recomputed (through matrix_in and lut_in) when the profile has both valid matrices AND nonlinearlut – so a linear matrix profile legitimately keeps the 0.1842 literal.
 
dt_colormatrix_t matrix_in_transposed
 
dt_colormatrix_t matrix_out_transposed
 

Detailed Description

A profile reduced to the arithmetic the pixel loop can run: two matrices and six tone-curve LUTs, plus the identity they were derived from.

This is the DERIVED form of a profile, not the profile. It is produced once by dt_colorspaces_add_profile() from the cmsHPROFILE that colorprofiles/colorspaces.c owns, and from then on it is self-contained: nothing in it points back at lcms2, so the pixel loops below need no lock and no lcms2 call per pixel.

Warning
SOLE OWNERSHIP. One of these is ~1.5 MB: six eagerly-allocated 65536-float LUTs (lut_in[3] + lut_out[3]), see dt_ioppr_init_profile_info(). develop/blend.c shallow-memcpys the struct onto the stack (dt_develop_blendif_init_masking_profile()), which ALIASES those six pointers into a second struct. Such a copy is read-only borrowed state: it must never be handed to dt_ioppr_cleanup_profile_info(), and the original must outlive it. Only the allocator of an instance may free it.
Two sentinel encodings drive every dispatch below, and neither is a flag: isnan(matrix_in[0][0]) means "not a matrix-shaper profile, use lcms2" (dt_ioppr_mark_as_nonmatrix_profile()), and lut_x[c][0] < 0.0f means "channel c has no tone curve, treat it as linear" (dt_ioppr_clear_lut_curves()). Code that memsets or calloc's one of these structs instead of calling dt_ioppr_init_profile_info() gets the opposite meaning for both.

Definition at line 115 of file colorprofiles/iop_profile.h.

Field Documentation

◆ DT_ALIGNED_PIXEL [1/2]

float unbounded_coeffs_in [3][3] dt_iop_order_iccprofile_info_t::DT_ALIGNED_PIXEL

Power-law fit {a, b, c} of lut_in past 1.0, evaluated by eval_exp() as b * (a*x)^c. Fitted on x = {0.7, 0.8, 0.9, 1.0} by dt_ioppr_init_unbounded_coeffs(), which is what lets the pipeline carry values above white through a curve lcms2 would have clipped. [c][0] == -1.0f marks channel c as having no fit.

Definition at line 148 of file colorprofiles/iop_profile.h.

◆ DT_ALIGNED_PIXEL [2/2]

float unbounded_coeffs_out [3][3] dt_iop_order_iccprofile_info_t::DT_ALIGNED_PIXEL

Same fit for lut_out.

Definition at line 150 of file colorprofiles/iop_profile.h.

◆ filename

◆ grey

float dt_iop_order_iccprofile_info_t::grey

Luminance of 18.42% grey through this profile, used by the tone-mapping modules to place middle grey. Defaults to 0.1842 and is only recomputed (through matrix_in and lut_in) when the profile has both valid matrices AND nonlinearlut – so a linear matrix profile legitimately keeps the 0.1842 literal.

See also
dt_ioppr_get_profile_info_middle_grey()

Definition at line 162 of file colorprofiles/iop_profile.h.

Referenced by _generate_profile_info(), dt_ioppr_get_profile_info_cl(), dt_ioppr_init_profile_info(), dt_ioppr_set_pipe_input_profile_info(), and gui_init().

◆ intent

dt_iop_color_intent_t dt_iop_order_iccprofile_info_t::intent

Rendering intent, passed to cmsCreateTransform on the lcms2 fallback only. The matrix path ignores it – it is NOT part of the memo key, so the first caller to ask for a given (type, filename) fixes the intent every later caller gets.

Definition at line 126 of file colorprofiles/iop_profile.h.

Referenced by _generate_profile_info(), _get_current_work_profile_key(), _get_profile_info_from_list(), commit_params(), dt_ioppr_init_profile_info(), dt_ioppr_set_pipe_input_profile_info(), and dt_ioppr_transform_lcms2().

◆ lut_in

◆ lut_out

◆ lutsize

◆ matrix_in

◆ matrix_in_transposed

◆ matrix_out

◆ matrix_out_transposed

◆ nonlinearlut

◆ type


The documentation for this struct was generated from the following file: