![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
The colour-profile vocabulary, and nothing else. More...
#include <glib.h>
Include dependency graph for profile_types.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Macros | |
| #define | DT_IOP_COLOR_ICC_LEN 512 |
| Size of every ICC filename buffer that crosses a module boundary. | |
Functions | |
| static dt_colorspaces_color_profile_type_t | sanitize_colorspaces (dt_colorspaces_color_profile_type_t colorspace) |
| Coerce an integer read back from storage into a colour space this build still has. | |
| static gboolean | dt_colorspaces_is_raw_matrix_profile_type (const dt_colorspaces_color_profile_type_t type) |
| Is this one of the four camera-matrix profile kinds? | |
The colour-profile vocabulary, and nothing else.
These enums are serialised into iop params blobs in the library database and into XMP sidecars, so their numeric values are frozen ABI – they cannot move or be renumbered. That is not an abstract worry: dt_iop_colorin_params_t stores two dt_colorspaces_color_profile_type_t (input and working), a dt_iop_color_intent_t and two char[DT_IOP_COLOR_ICC_LEN]; dt_iop_colorout_params_t stores one of each. Those structs are memcpy'd into main.history.op_params and base64'd into Xmp.darktable.history_params (common/exif.cc). The export module serialises icctype/iccintent into its preset blobs too, and already carries several legacy_params versions to migrate them (libs/export.c). Renumbering any enumerator below silently repoints every stored edit at a different colour space.
Almost everything that includes colorprofiles/ wants only this: a profile type to store in its params, an intent to pass along. Carrying that vocabulary in the same header as the module's API meant <lcms2.h> and <pthread.h> reached several hundred translation units that never call either – 300 of 425 at the point this split was made.
Definition in file profile_types.h.
| #define DT_IOP_COLOR_ICC_LEN 512 |
Size of every ICC filename buffer that crosses a module boundary.
512 bytes. This is the declared width of filename inside the serialised iop params of colorin and colorout, so it is part of the params ABI: changing it changes the size of every stored history entry and every XMP blob. It is also the width of dt_colorspaces_color_profile_t::filename and of the filename in the value-copy descriptor the CRUDE calls hand back, so the three never need a length negotiation.
Definition at line 85 of file profile_types.h.
CICP colour primaries, as tagged in AVIF/HEIF/JPEG XL containers.
Values are fixed by Recommendation ITU-T H.273, not by Ansel: this is an external ABI and the gaps in the numbering are the codepoints for primaries the codebase does not handle. Only imageio reads them, to map a container's CICP triplet onto one of the DT_COLORSPACE_* values above.
CICP matrix coefficients, as tagged in AVIF/HEIF/JPEG XL containers.
Values fixed by Recommendation ITU-T H.273. IDENTITY is what a lossless or 4:4:4 RGB file carries; the imageio mapping accepts it, the matching YCbCr codepoint, UNSPECIFIED, and a couple of commonly mistagged neighbours for the same primaries.
| typedef enum dt_colorspaces_cicp_transfer_characteristics_t dt_colorspaces_cicp_transfer_characteristics_t |
CICP transfer characteristics, as tagged in AVIF/HEIF/JPEG XL containers.
Values fixed by Recommendation ITU-T H.273. Several are treated as equivalent by the imageio mapping specifically to tolerate mistagged files (Rec601 and the two Rec2020 bit depths are accepted wherever Rec709 is expected).
What the output transform is being asked to show: the picture, or a proof of it.
Application-wide state, not per-image: one setting shared by the darkroom toolbox toggles, the backbuf overlay label and colorout's transform construction (GAMUTCHECK adds cmsFLAGS_GAMUTCHECK to the proofing transform). It is persisted across sessions in the ui_last/color/mode conf key and range-checked on load, so an out-of-range stored value falls back to DT_PROFILE_NORMAL rather than reaching lcms2.
Which use a profile is eligible for – the mandatory filter on every lookup and enumeration.
A bitmask, but read it as "which combo box would list this profile", not as a colour-management direction. That distinction matters because the module has two entries for DT_COLORSPACE_SRGB distinguished by nothing else (see DT_COLORSPACE_SRGB): the role is what picks between them, so it cannot be omitted or approximated.
A multi-bit mask resolves to the FIRST entry in registration order that serves any of its bits. Calls that return or consume a combo-box INDEX therefore require a single bit: an index means nothing outside the enumeration that produced it, and an index taken from INPUT|OUTPUT equals neither menu's row number.
Which of the five user-visible profile SLOTS a notification concerns.
Not a colour space: it names a role in the UI. Its only use is as the payload of DT_SIGNAL_CONTROL_PROFILE_USER_CHANGED, raised by colorin (input, working), the display actions (display) and the darkroom toolbox (softproof), and read back by listeners such as basicadj and the thumbtable. The signal bus carries it as a uint8_t.
ICC rendering intent, as stored in iop params and in conf.
Spelled as literals rather than as lcms2's INTENT_* so this header needs no <lcms2.h> – the values are fixed by the ICC specification, and colorspaces.c static-asserts that they still match lcms2's (four _Static_asserts, one per intent). A divergence is therefore a compile error in the one translation unit that talks to lcms2, not a silently wrong render everywhere else.
CICP colour primaries, as tagged in AVIF/HEIF/JPEG XL containers.
Values are fixed by Recommendation ITU-T H.273, not by Ansel: this is an external ABI and the gaps in the numbering are the codepoints for primaries the codebase does not handle. Only imageio reads them, to map a container's CICP triplet onto one of the DT_COLORSPACE_* values above.
| Enumerator | |
|---|---|
| DT_CICP_COLOR_PRIMARIES_REC709 | |
| DT_CICP_COLOR_PRIMARIES_UNSPECIFIED | |
| DT_CICP_COLOR_PRIMARIES_REC2020 | |
| DT_CICP_COLOR_PRIMARIES_XYZ | |
| DT_CICP_COLOR_PRIMARIES_P3 | |
Definition at line 323 of file profile_types.h.
CICP matrix coefficients, as tagged in AVIF/HEIF/JPEG XL containers.
Values fixed by Recommendation ITU-T H.273. IDENTITY is what a lossless or 4:4:4 RGB file carries; the imageio mapping accepts it, the matching YCbCr codepoint, UNSPECIFIED, and a couple of commonly mistagged neighbours for the same primaries.
Definition at line 359 of file profile_types.h.
CICP transfer characteristics, as tagged in AVIF/HEIF/JPEG XL containers.
Values fixed by Recommendation ITU-T H.273. Several are treated as equivalent by the imageio mapping specifically to tolerate mistagged files (Rec601 and the two Rec2020 bit depths are accepted wherever Rec709 is expected).
Definition at line 339 of file profile_types.h.
What the output transform is being asked to show: the picture, or a proof of it.
Application-wide state, not per-image: one setting shared by the darkroom toolbox toggles, the backbuf overlay label and colorout's transform construction (GAMUTCHECK adds cmsFLAGS_GAMUTCHECK to the proofing transform). It is persisted across sessions in the ui_last/color/mode conf key and range-checked on load, so an out-of-range stored value falls back to DT_PROFILE_NORMAL rather than reaching lcms2.
| Enumerator | |
|---|---|
| DT_PROFILE_NORMAL | |
| DT_PROFILE_SOFTPROOF | |
| DT_PROFILE_GAMUTCHECK | |
Definition at line 255 of file profile_types.h.
| Enumerator | |
|---|---|
| DT_COLORSPACE_NONE | No profile / "take it from the image settings". Never matches a list entry. |
| DT_COLORSPACE_FILE | A user ICC file on disk; the only type whose Every lookup for this type compares filenames rather than identity, and does so with |
| DT_COLORSPACE_SRGB | sRGB – registered TWICE, and the two entries are not interchangeable. A v4 profile with parametric curves is registered for INPUT, and a v2 profile with a point TRC is registered for output/display/category/work. Nothing but the pattern of -1 in their five position fields distinguishes them: same type, same empty filename. A lookup with a multi-bit role mask returns the FIRST match in registration order, which for sRGB is the v4 input entry – so asking for "sRGB, any role" while meaning the working profile hands back the wrong variant. Pass DT_PROFILE_ROLE_WORKING (or OUT, or DISPLAY) explicitly. |
| DT_COLORSPACE_ADOBERGB | |
| DT_COLORSPACE_LIN_REC709 | |
| DT_COLORSPACE_LIN_REC2020 | |
| DT_COLORSPACE_XYZ | |
| DT_COLORSPACE_LAB | |
| DT_COLORSPACE_INFRARED | |
| DT_COLORSPACE_DISPLAY | The monitor profile – the one list entry that mutates after init. Registered with an sRGB placeholder so that code running before the real profile can be fetched has something to work with, then replaced in place (old handle closed, new one stored) every time the system profile changes – which includes moving or resizing the window onto another monitor.
|
| DT_COLORSPACE_EMBEDDED_ICC | Image-derived profiles: enum 9..14, NOT registered in the list. These describe a profile that exists only for one image – the ICC embedded in that file, or a matrix taken from that camera's data by colorin. They cannot be resolved by identity, because there is no list entry to find, and they must not be shared: the pipe that built one owns it ( |
| DT_COLORSPACE_EMBEDDED_MATRIX | |
| DT_COLORSPACE_STANDARD_MATRIX | |
| DT_COLORSPACE_ENHANCED_MATRIX | |
| DT_COLORSPACE_VENDOR_MATRIX | |
| DT_COLORSPACE_ALTERNATE_MATRIX | |
| DT_COLORSPACE_BRG | |
| DT_COLORSPACE_EXPORT | Category placeholders: "whatever the export/softproof/work setting currently says". These three ARE registered, with |
| DT_COLORSPACE_SOFTPROOF | |
| DT_COLORSPACE_WORK | |
| DT_COLORSPACE_DISPLAY2 | Dead value, kept only because old params and conf keys contain it. The second-display feature it belonged to is gone: there is no list entry, no backing position field, and |
| DT_COLORSPACE_REC709 | |
| DT_COLORSPACE_PROPHOTO_RGB | |
| DT_COLORSPACE_PQ_REC2020 | |
| DT_COLORSPACE_HLG_REC2020 | |
| DT_COLORSPACE_PQ_P3 | |
| DT_COLORSPACE_HLG_P3 | |
| DT_COLORSPACE_ITUR_BT1886 | |
| DT_COLORSPACE_DISPLAY_P3 | |
| DT_COLORSPACE_LAST | Count, not a colour space. The last usable value is DT_COLORSPACE_LAST - 1. |
Definition at line 151 of file profile_types.h.
Which use a profile is eligible for – the mandatory filter on every lookup and enumeration.
A bitmask, but read it as "which combo box would list this profile", not as a colour-management direction. That distinction matters because the module has two entries for DT_COLORSPACE_SRGB distinguished by nothing else (see DT_COLORSPACE_SRGB): the role is what picks between them, so it cannot be omitted or approximated.
A multi-bit mask resolves to the FIRST entry in registration order that serves any of its bits. Calls that return or consume a combo-box INDEX therefore require a single bit: an index means nothing outside the enumeration that produced it, and an index taken from INPUT|OUTPUT equals neither menu's row number.
Definition at line 284 of file profile_types.h.
Which of the five user-visible profile SLOTS a notification concerns.
Not a colour space: it names a role in the UI. Its only use is as the payload of DT_SIGNAL_CONTROL_PROFILE_USER_CHANGED, raised by colorin (input, working), the display actions (display) and the darkroom toolbox (softproof), and read back by listeners such as basicadj and the thumbtable. The signal bus carries it as a uint8_t.
| Enumerator | |
|---|---|
| DT_COLORSPACES_PROFILE_TYPE_INPUT | |
| DT_COLORSPACES_PROFILE_TYPE_WORK | |
| DT_COLORSPACES_PROFILE_TYPE_EXPORT | |
| DT_COLORSPACES_PROFILE_TYPE_DISPLAY | |
| DT_COLORSPACES_PROFILE_TYPE_SOFTPROOF | |
Definition at line 127 of file profile_types.h.
ICC rendering intent, as stored in iop params and in conf.
Spelled as literals rather than as lcms2's INTENT_* so this header needs no <lcms2.h> – the values are fixed by the ICC specification, and colorspaces.c static-asserts that they still match lcms2's (four _Static_asserts, one per intent). A divergence is therefore a compile error in the one translation unit that talks to lcms2, not a silently wrong render everywhere else.
| Enumerator | |
|---|---|
| DT_INTENT_PERCEPTUAL | |
| DT_INTENT_RELATIVE_COLORIMETRIC | |
| DT_INTENT_SATURATION | |
| DT_INTENT_ABSOLUTE_COLORIMETRIC | |
| DT_INTENT_LAST | Count of real intents, and the codebase's "unset" marker – never a user choice.
|
Definition at line 97 of file profile_types.h.
|
inlinestatic |
Is this one of the four camera-matrix profile kinds?
Matches DT_COLORSPACE_STANDARD_MATRIX, _ENHANCED_MATRIX, _VENDOR_MATRIX and _ALTERNATE_MATRIX – the types whose matrix comes from the camera data for one image, and which therefore have no entry in the profile list to resolve against.
| type | the profile type stored in a module's params. |
Definition at line 412 of file profile_types.h.
References DT_COLORSPACE_ALTERNATE_MATRIX, DT_COLORSPACE_ENHANCED_MATRIX, DT_COLORSPACE_STANDARD_MATRIX, DT_COLORSPACE_VENDOR_MATRIX, and type.
Referenced by gui_update().
|
inlinestatic |
Coerce an integer read back from storage into a colour space this build still has.
Two distinct rescues, both for values that were valid when they were written: DT_COLORSPACE_DISPLAY2 is remapped to DT_COLORSPACE_DISPLAY (the second-display feature is gone, but the number survives in old conf keys and params), and anything at or above DT_COLORSPACE_LAST – a file written by a newer build – is clamped to the last enumerator this build knows.
| colorspace | the stored value, typically straight out of dt_conf_get_int(). |
Definition at line 386 of file profile_types.h.
References DT_COLORSPACE_DISPLAY, DT_COLORSPACE_DISPLAY2, DT_COLORSPACE_LAST, and MIN.
Referenced by _export_button_clicked().