Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
colorspaces.h File Reference
#include "common/darktable.h"
#include "common/matrices.h"
#include <lcms2.h>
+ Include dependency graph for colorspaces.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  dt_colorspaces_t
 
struct  dt_colorspaces_color_profile_t
 
struct  dt_colorspaces_cicp_t
 

Macros

#define TYPE_XYZA_FLT   (FLOAT_SH(1)|COLORSPACE_SH(PT_XYZ)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(4))
 
#define DT_IOP_COLOR_ICC_LEN   512
 
#define LUT_SAMPLES   0x10000
 

Typedefs

typedef enum dt_iop_color_intent_t dt_iop_color_intent_t
 
typedef enum dt_colorspaces_profile_type_t dt_colorspaces_profile_type_t
 
typedef enum dt_colorspaces_color_profile_type_t dt_colorspaces_color_profile_type_t
 
typedef enum dt_colorspaces_color_mode_t dt_colorspaces_color_mode_t
 
typedef enum dt_colorspaces_profile_direction_t dt_colorspaces_profile_direction_t
 
typedef enum dt_colorspaces_cicp_color_primaries_t dt_colorspaces_cicp_color_primaries_t
 
typedef enum dt_colorspaces_cicp_transfer_characteristics_t dt_colorspaces_cicp_transfer_characteristics_t
 
typedef enum dt_colorspaces_cicp_matrix_coefficients_t dt_colorspaces_cicp_matrix_coefficients_t
 
typedef struct dt_colorspaces_t dt_colorspaces_t
 
typedef struct dt_colorspaces_color_profile_t dt_colorspaces_color_profile_t
 
typedef struct dt_colorspaces_cicp_t dt_colorspaces_cicp_t
 

Enumerations

enum  dt_iop_color_intent_t {
  DT_INTENT_PERCEPTUAL = INTENT_PERCEPTUAL ,
  DT_INTENT_RELATIVE_COLORIMETRIC = INTENT_RELATIVE_COLORIMETRIC ,
  DT_INTENT_SATURATION = INTENT_SATURATION ,
  DT_INTENT_ABSOLUTE_COLORIMETRIC = INTENT_ABSOLUTE_COLORIMETRIC ,
  DT_INTENT_LAST
}
 
enum  dt_colorspaces_profile_type_t {
  DT_COLORSPACES_PROFILE_TYPE_INPUT = 1 ,
  DT_COLORSPACES_PROFILE_TYPE_WORK = 2 ,
  DT_COLORSPACES_PROFILE_TYPE_EXPORT = 3 ,
  DT_COLORSPACES_PROFILE_TYPE_DISPLAY = 4 ,
  DT_COLORSPACES_PROFILE_TYPE_SOFTPROOF = 5
}
 
enum  dt_colorspaces_color_profile_type_t {
  DT_COLORSPACE_NONE = -1 ,
  DT_COLORSPACE_FILE = 0 ,
  DT_COLORSPACE_SRGB = 1 ,
  DT_COLORSPACE_ADOBERGB = 2 ,
  DT_COLORSPACE_LIN_REC709 = 3 ,
  DT_COLORSPACE_LIN_REC2020 = 4 ,
  DT_COLORSPACE_XYZ = 5 ,
  DT_COLORSPACE_LAB = 6 ,
  DT_COLORSPACE_INFRARED = 7 ,
  DT_COLORSPACE_DISPLAY = 8 ,
  DT_COLORSPACE_EMBEDDED_ICC = 9 ,
  DT_COLORSPACE_EMBEDDED_MATRIX = 10 ,
  DT_COLORSPACE_STANDARD_MATRIX = 11 ,
  DT_COLORSPACE_ENHANCED_MATRIX = 12 ,
  DT_COLORSPACE_VENDOR_MATRIX = 13 ,
  DT_COLORSPACE_ALTERNATE_MATRIX = 14 ,
  DT_COLORSPACE_BRG = 15 ,
  DT_COLORSPACE_EXPORT = 16 ,
  DT_COLORSPACE_SOFTPROOF = 17 ,
  DT_COLORSPACE_WORK = 18 ,
  DT_COLORSPACE_DISPLAY2 = 19 ,
  DT_COLORSPACE_REC709 = 20 ,
  DT_COLORSPACE_PROPHOTO_RGB = 21 ,
  DT_COLORSPACE_PQ_REC2020 = 22 ,
  DT_COLORSPACE_HLG_REC2020 = 23 ,
  DT_COLORSPACE_PQ_P3 = 24 ,
  DT_COLORSPACE_HLG_P3 = 25 ,
  DT_COLORSPACE_ITUR_BT1886 = 26 ,
  DT_COLORSPACE_DISPLAY_P3 = 27 ,
  DT_COLORSPACE_LAST = 28
}
 
enum  dt_colorspaces_color_mode_t {
  DT_PROFILE_NORMAL = 0 ,
  DT_PROFILE_SOFTPROOF ,
  DT_PROFILE_GAMUTCHECK
}
 
enum  dt_colorspaces_profile_direction_t {
  DT_PROFILE_DIRECTION_IN = 1 << 0 ,
  DT_PROFILE_DIRECTION_OUT = 1 << 1 ,
  DT_PROFILE_DIRECTION_DISPLAY = 1 << 2 ,
  DT_PROFILE_DIRECTION_CATEGORY = 1 << 3 ,
  DT_PROFILE_DIRECTION_WORK = 1 << 4 ,
  DT_PROFILE_DIRECTION_DISPLAY2 = 1 << 5 ,
  DT_PROFILE_DIRECTION_ANY
}
 
enum  dt_colorspaces_cicp_color_primaries_t {
  DT_CICP_COLOR_PRIMARIES_REC709 = 1 ,
  DT_CICP_COLOR_PRIMARIES_UNSPECIFIED = 2 ,
  DT_CICP_COLOR_PRIMARIES_REC2020 = 9 ,
  DT_CICP_COLOR_PRIMARIES_XYZ = 10 ,
  DT_CICP_COLOR_PRIMARIES_P3 = 12
}
 
enum  dt_colorspaces_cicp_transfer_characteristics_t {
  DT_CICP_TRANSFER_CHARACTERISTICS_REC709 = 1 ,
  DT_CICP_TRANSFER_CHARACTERISTICS_UNSPECIFIED = 2 ,
  DT_CICP_TRANSFER_CHARACTERISTICS_REC601 = 6 ,
  DT_CICP_TRANSFER_CHARACTERISTICS_LINEAR = 8 ,
  DT_CICP_TRANSFER_CHARACTERISTICS_SRGB = 13 ,
  DT_CICP_TRANSFER_CHARACTERISTICS_REC2020_10B = 14 ,
  DT_CICP_TRANSFER_CHARACTERISTICS_REC2020_12B = 15 ,
  DT_CICP_TRANSFER_CHARACTERISTICS_PQ = 16 ,
  DT_CICP_TRANSFER_CHARACTERISTICS_HLG = 18
}
 
enum  dt_colorspaces_cicp_matrix_coefficients_t {
  DT_CICP_MATRIX_COEFFICIENTS_IDENTITY = 0 ,
  DT_CICP_MATRIX_COEFFICIENTS_REC709 = 1 ,
  DT_CICP_MATRIX_COEFFICIENTS_UNSPECIFIED = 2 ,
  DT_CICP_MATRIX_COEFFICIENTS_SYCC = 5 ,
  DT_CICP_MATRIX_COEFFICIENTS_REC601 = 6 ,
  DT_CICP_MATRIX_COEFFICIENTS_REC2020_NCL = 9 ,
  DT_CICP_MATRIX_COEFFICIENTS_CHROMA_DERIVED_NCL = 12
}
 

Functions

int mat3inv_float (float *const dst, const float *const src)
 
int mat3inv (float *const dst, const float *const src)
 
dt_colorspaces_tdt_colorspaces_init ()
 
void dt_colorspaces_cleanup (dt_colorspaces_t *self)
 
cmsHPROFILE dt_colorspaces_create_xyzimatrix_profile (float cam_xyz[3][3])
 
cmsHPROFILE dt_colorspaces_create_darktable_profile (const char *makermodel)
 
cmsHPROFILE dt_colorspaces_create_vendor_profile (const char *makermodel)
 
cmsHPROFILE dt_colorspaces_create_alternate_profile (const char *makermodel)
 
const dt_colorspaces_color_profile_tdt_colorspaces_get_work_profile (const int32_t imgid)
 
const cmsHPROFILE dt_colorspaces_get_embedded_profile (const int32_t imgid, dt_colorspaces_color_profile_type_t *type, gboolean *new_profile)
 
const dt_colorspaces_color_profile_tdt_colorspaces_get_output_profile (const int32_t imgid, dt_colorspaces_color_profile_type_t *over_type, const char *over_filename)
 
cmsHPROFILE dt_colorspaces_get_rgb_profile_from_mem (uint8_t *data, uint32_t size)
 
void dt_colorspaces_cleanup_profile (cmsHPROFILE p)
 
int dt_colorspaces_get_matrix_from_input_profile (cmsHPROFILE prof, dt_colormatrix_t matrix, float *lutr, float *lutg, float *lutb, const int lutsize)
 
int dt_colorspaces_get_matrix_from_output_profile (cmsHPROFILE prof, dt_colormatrix_t matrix, float *lutr, float *lutg, float *lutb, const int lutsize)
 
void dt_colorspaces_get_profile_name (cmsHPROFILE p, const char *language, const char *country, char *name, size_t len)
 
const char * dt_colorspaces_get_name (dt_colorspaces_color_profile_type_t type, const char *filename)
 
void rgb2hsl (const dt_aligned_pixel_t rgb, float *h, float *s, float *l)
 
void hsl2rgb (dt_aligned_pixel_t rgb, float h, float s, float l)
 
void dt_colorspaces_set_display_profile (const dt_colorspaces_color_profile_type_t profile_type)
 
const dt_colorspaces_color_profile_tdt_colorspaces_get_profile (dt_colorspaces_color_profile_type_t type, const char *filename, dt_colorspaces_profile_direction_t direction)
 
gboolean dt_colorspaces_is_profile_equal (const char *fullname, const char *filename)
 
dt_colorspaces_color_profile_type_t dt_colorspaces_cicp_to_type (const dt_colorspaces_cicp_t *cicp, const char *filename)
 
void dt_colorspaces_update_display_transforms ()
 
int dt_colorspaces_conversion_matrices_xyz (const float adobe_XYZ_to_CAM[4][3], float in_XYZ_to_CAM[9], double XYZ_to_CAM[4][3], double CAM_to_XYZ[3][4])
 
int dt_colorspaces_conversion_matrices_rgb (const float adobe_XYZ_to_CAM[4][3], double RGB_to_CAM[4][3], double CAM_to_RGB[3][4], const float *embedded_matrix, double mul[4])
 
void dt_colorspaces_cygm_apply_coeffs_to_rgb (float *out, const float *in, int num, double RGB_to_CAM[4][3], double CAM_to_RGB[3][4], dt_aligned_pixel_t coeffs)
 
void dt_colorspaces_cygm_to_rgb (float *out, int num, double CAM_to_RGB[3][4])
 
void dt_colorspaces_rgb_to_cygm (float *out, int num, double RGB_to_CAM[4][3])
 
static dt_colorspaces_color_profile_type_t sanitize_colorspaces (dt_colorspaces_color_profile_type_t colorspace)
 
dt_colorspaces_color_profile_type_t dt_image_find_best_color_profile (int32_t imgid, cmsHPROFILE *output, gboolean *new_profile)
 Best effort to find a suitable (input) color profile for a given image, using embedded ICC or EXIF whenever possible. This will also init the profile in the image cache.
 

Macro Definition Documentation

◆ DT_IOP_COLOR_ICC_LEN

#define DT_IOP_COLOR_ICC_LEN   512

◆ LUT_SAMPLES

#define LUT_SAMPLES   0x10000

◆ TYPE_XYZA_FLT

#define TYPE_XYZA_FLT   (FLOAT_SH(1)|COLORSPACE_SH(PT_XYZ)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(4))

Typedef Documentation

◆ dt_colorspaces_cicp_color_primaries_t

◆ dt_colorspaces_cicp_matrix_coefficients_t

◆ dt_colorspaces_cicp_t

◆ dt_colorspaces_cicp_transfer_characteristics_t

◆ dt_colorspaces_color_mode_t

◆ dt_colorspaces_color_profile_t

◆ dt_colorspaces_color_profile_type_t

◆ dt_colorspaces_profile_direction_t

◆ dt_colorspaces_profile_type_t

◆ dt_colorspaces_t

◆ dt_iop_color_intent_t

Enumeration Type Documentation

◆ dt_colorspaces_cicp_color_primaries_t

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 

◆ dt_colorspaces_cicp_matrix_coefficients_t

Enumerator
DT_CICP_MATRIX_COEFFICIENTS_IDENTITY 
DT_CICP_MATRIX_COEFFICIENTS_REC709 
DT_CICP_MATRIX_COEFFICIENTS_UNSPECIFIED 
DT_CICP_MATRIX_COEFFICIENTS_SYCC 
DT_CICP_MATRIX_COEFFICIENTS_REC601 
DT_CICP_MATRIX_COEFFICIENTS_REC2020_NCL 
DT_CICP_MATRIX_COEFFICIENTS_CHROMA_DERIVED_NCL 

◆ dt_colorspaces_cicp_transfer_characteristics_t

Enumerator
DT_CICP_TRANSFER_CHARACTERISTICS_REC709 
DT_CICP_TRANSFER_CHARACTERISTICS_UNSPECIFIED 
DT_CICP_TRANSFER_CHARACTERISTICS_REC601 
DT_CICP_TRANSFER_CHARACTERISTICS_LINEAR 
DT_CICP_TRANSFER_CHARACTERISTICS_SRGB 
DT_CICP_TRANSFER_CHARACTERISTICS_REC2020_10B 
DT_CICP_TRANSFER_CHARACTERISTICS_REC2020_12B 
DT_CICP_TRANSFER_CHARACTERISTICS_PQ 
DT_CICP_TRANSFER_CHARACTERISTICS_HLG 

◆ dt_colorspaces_color_mode_t

Enumerator
DT_PROFILE_NORMAL 
DT_PROFILE_SOFTPROOF 
DT_PROFILE_GAMUTCHECK 

◆ dt_colorspaces_color_profile_type_t

Enumerator
DT_COLORSPACE_NONE 
DT_COLORSPACE_FILE 
DT_COLORSPACE_SRGB 
DT_COLORSPACE_ADOBERGB 
DT_COLORSPACE_LIN_REC709 
DT_COLORSPACE_LIN_REC2020 
DT_COLORSPACE_XYZ 
DT_COLORSPACE_LAB 
DT_COLORSPACE_INFRARED 
DT_COLORSPACE_DISPLAY 
DT_COLORSPACE_EMBEDDED_ICC 
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 
DT_COLORSPACE_SOFTPROOF 
DT_COLORSPACE_WORK 
DT_COLORSPACE_DISPLAY2 
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 

◆ dt_colorspaces_profile_direction_t

Enumerator
DT_PROFILE_DIRECTION_IN 
DT_PROFILE_DIRECTION_OUT 
DT_PROFILE_DIRECTION_DISPLAY 
DT_PROFILE_DIRECTION_CATEGORY 
DT_PROFILE_DIRECTION_WORK 
DT_PROFILE_DIRECTION_DISPLAY2 
DT_PROFILE_DIRECTION_ANY 

◆ dt_colorspaces_profile_type_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 

◆ dt_iop_color_intent_t

Enumerator
DT_INTENT_PERCEPTUAL 
DT_INTENT_RELATIVE_COLORIMETRIC 
DT_INTENT_SATURATION 
DT_INTENT_ABSOLUTE_COLORIMETRIC 
DT_INTENT_LAST 

Function Documentation

◆ dt_colorspaces_cicp_to_type()

◆ dt_colorspaces_cleanup()

◆ dt_colorspaces_cleanup_profile()

void dt_colorspaces_cleanup_profile ( cmsHPROFILE  p)

free the resources of a profile created with the functions above.

Referenced by _update_display_profile(), cleanup_pipe(), commit_params(), and dt_colorspaces_cleanup().

◆ dt_colorspaces_conversion_matrices_rgb()

int dt_colorspaces_conversion_matrices_rgb ( const float  adobe_XYZ_to_CAM[4][3],
double  RGB_to_CAM[4][3],
double  CAM_to_RGB[3][4],
const float *  embedded_matrix,
double  mul[4] 
)

Calculate CAM->RGB, RGB->CAM matrices and default WB multipliers

References dt_colorspaces_pseudoinverse(), FALSE, and TRUE.

Referenced by calculate_bogus_daylight_wb(), commit_params(), get_white_balance_coeff(), legacy_params(), and reload_defaults().

◆ dt_colorspaces_conversion_matrices_xyz()

int dt_colorspaces_conversion_matrices_xyz ( const float  adobe_XYZ_to_CAM[4][3],
float  in_XYZ_to_CAM[9],
double  XYZ_to_CAM[4][3],
double  CAM_to_XYZ[3][4] 
)

Calculate CAM->XYZ, XYZ->CAM matrices

References dt_colorspaces_pseudoinverse(), FALSE, and TRUE.

Referenced by prepare_matrices().

◆ dt_colorspaces_create_alternate_profile()

cmsHPROFILE dt_colorspaces_create_alternate_profile ( const char *  makermodel)

create a ICC virtual profile from the shipped alternate matrices in darktable.

References dt_alternate_colormatrices, dt_alternate_colormatrix_cnt, name, and preset.

Referenced by commit_params().

◆ dt_colorspaces_create_darktable_profile()

cmsHPROFILE dt_colorspaces_create_darktable_profile ( const char *  makermodel)

create a ICC virtual profile from the shipped presets in darktable.

References dt_profiled_colormatrices, dt_profiled_colormatrix_cnt, name, and preset.

Referenced by commit_params().

◆ dt_colorspaces_create_vendor_profile()

cmsHPROFILE dt_colorspaces_create_vendor_profile ( const char *  makermodel)

create a ICC virtual profile from the shipped vendor matrices in darktable.

References dt_vendor_colormatrices, dt_vendor_colormatrix_cnt, name, and preset.

Referenced by commit_params().

◆ dt_colorspaces_create_xyzimatrix_profile()

cmsHPROFILE dt_colorspaces_create_xyzimatrix_profile ( float  cam_xyz[3][3])

create a profile from a xyz->camera matrix.

References dt_colorspaces_create_xyzmatrix_profile(), and mat3inv().

Referenced by commit_params(), and dt_image_find_best_color_profile().

◆ dt_colorspaces_cygm_apply_coeffs_to_rgb()

void dt_colorspaces_cygm_apply_coeffs_to_rgb ( float *  out,
const float *  in,
int  num,
double  RGB_to_CAM[4][3],
double  CAM_to_RGB[3][4],
dt_aligned_pixel_t  coeffs 
)

Applies CYGM WB coeffs to an image that's already been converted to RGB by dt_colorspaces_cygm_to_rgb

Todo:
: CRITICAL: why is this function NOT used anywhere ???

◆ dt_colorspaces_cygm_to_rgb()

void dt_colorspaces_cygm_to_rgb ( float *  out,
int  num,
double  CAM_to_RGB[3][4] 
)

convert CYGM buffer to RGB

Referenced by gui_update_from_coeffs(), and process().

◆ dt_colorspaces_get_embedded_profile()

const cmsHPROFILE dt_colorspaces_get_embedded_profile ( const int32_t  imgid,
dt_colorspaces_color_profile_type_t type,
gboolean *  new_profile 
)

return the embedded profile of a particular image

References dt_image_find_best_color_profile(), and type.

Referenced by _build_embedded_profile(), and commit_params().

◆ dt_colorspaces_get_matrix_from_input_profile()

int dt_colorspaces_get_matrix_from_input_profile ( cmsHPROFILE  prof,
dt_colormatrix_t  matrix,
float *  lutr,
float *  lutg,
float *  lutb,
const int  lutsize 
)

extracts tonecurves and color matrix prof to XYZ from a given input profile, returns 0 on success (curves and matrix are inverted for input)

References dt_colorspaces_get_matrix_from_profile().

Referenced by commit_params(), dt_colorspaces_init(), and dt_ioppr_generate_profile_info().

◆ dt_colorspaces_get_matrix_from_output_profile()

int dt_colorspaces_get_matrix_from_output_profile ( cmsHPROFILE  prof,
dt_colormatrix_t  matrix,
float *  lutr,
float *  lutg,
float *  lutb,
const int  lutsize 
)

extracts tonecurves and color matrix prof to XYZ from a given output profile, returns 0 on success.

References dt_colorspaces_get_matrix_from_profile().

Referenced by commit_params(), dt_colorspaces_init(), and dt_ioppr_generate_profile_info().

◆ dt_colorspaces_get_name()

◆ dt_colorspaces_get_output_profile()

◆ dt_colorspaces_get_profile()

◆ dt_colorspaces_get_profile_name()

void dt_colorspaces_get_profile_name ( cmsHPROFILE  p,
const char *  language,
const char *  country,
char *  name,
size_t  len 
)

wrapper to get the name from a color profile. this tries to handle character encodings.

References error(), name, and size.

Referenced by _build_embedded_profile(), _update_display_profile(), load_profile_from_dir(), and write_image().

◆ dt_colorspaces_get_rgb_profile_from_mem()

cmsHPROFILE dt_colorspaces_get_rgb_profile_from_mem ( uint8_t *  data,
uint32_t  size 
)

return an rgb lcms2 profile from data. if data points to a grayscale profile a new rgb profile is created that has the same TRC, black and white point and rec709 primaries.

References _ensure_rgb_profile(), and size.

Referenced by commit_params(), and dt_image_find_best_color_profile().

◆ dt_colorspaces_get_work_profile()

const dt_colorspaces_color_profile_t * dt_colorspaces_get_work_profile ( const int32_t  imgid)

return the work profile as set in colorin

Todo:
: does this work when using JPEG thumbs and the image was never opened?

References darktable, darktable_t::db, DT_COLORSPACE_LIN_REC2020, dt_colorspaces_get_profile(), dt_database_get(), DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_PREPARE_V2, DT_PROFILE_DIRECTION_WORK, darktable_t::iop, and type.

◆ dt_colorspaces_init()

dt_colorspaces_t * dt_colorspaces_init ( )

populate the global color profile lists

Todo:
: what about display?
Todo:
: do want to filter out non-RGB profiles for cases besides histogram profile? colorin is OK with RGB or XYZ, print is OK with anything which LCMS likes, otherwise things are more choosey

References _compute_prequantized_primaries(), _create_profile(), _update_display_transforms(), dt_colorspaces_color_profile_t::category_pos, cms_error_handler(), color_space, D65xyY, dt_colorspaces_t::display_filename, dt_colorspaces_t::display_intent, dt_colorspaces_color_profile_t::display_pos, dt_colorspaces_t::display_type, DT_COLORSPACE_ADOBERGB, DT_COLORSPACE_BRG, DT_COLORSPACE_DISPLAY, DT_COLORSPACE_DISPLAY_P3, DT_COLORSPACE_EXPORT, DT_COLORSPACE_FILE, DT_COLORSPACE_HLG_P3, DT_COLORSPACE_HLG_REC2020, DT_COLORSPACE_INFRARED, DT_COLORSPACE_ITUR_BT1886, DT_COLORSPACE_LAB, DT_COLORSPACE_LAST, DT_COLORSPACE_LIN_REC2020, DT_COLORSPACE_LIN_REC709, DT_COLORSPACE_PQ_P3, DT_COLORSPACE_PQ_REC2020, DT_COLORSPACE_PROPHOTO_RGB, DT_COLORSPACE_REC709, DT_COLORSPACE_SOFTPROOF, DT_COLORSPACE_SRGB, DT_COLORSPACE_WORK, DT_COLORSPACE_XYZ, dt_colorspaces_create_adobergb_profile(), dt_colorspaces_create_brg_profile(), dt_colorspaces_create_display_p3_rgb_profile(), dt_colorspaces_create_gamma_rec709_rgb_profile(), dt_colorspaces_create_hlg_p3_rgb_profile(), dt_colorspaces_create_hlg_rec2020_rgb_profile(), dt_colorspaces_create_itur_bt1886_rgb_profile(), dt_colorspaces_create_lab_profile(), dt_colorspaces_create_linear_infrared_profile(), dt_colorspaces_create_linear_prophoto_rgb_profile(), dt_colorspaces_create_linear_rec2020_rgb_profile(), dt_colorspaces_create_linear_rec709_rgb_profile(), dt_colorspaces_create_pq_p3_rgb_profile(), dt_colorspaces_create_pq_rec2020_rgb_profile(), dt_colorspaces_create_srgb_profile(), dt_colorspaces_create_srgb_profile_v4(), dt_colorspaces_create_xyz_profile(), dt_colorspaces_get_matrix_from_input_profile(), dt_colorspaces_get_matrix_from_output_profile(), dt_conf_get_bool(), dt_conf_get_int(), dt_conf_get_string_const(), DT_DEBUG_DEV, dt_print(), DT_PROFILE_GAMUTCHECK, DT_PROFILE_NORMAL, dt_colorspaces_color_profile_t::in_pos, load_profile_from_dir(), dt_colorspaces_t::mode, dt_colorspaces_color_profile_t::name, dt_colorspaces_color_profile_t::out_pos, dt_colorspaces_color_profile_t::profile, dt_colorspaces_t::profiles, Rec709_Primaries, Rec709_Primaries_Prequantized, dt_colorspaces_t::softproof_filename, dt_colorspaces_t::softproof_intent, dt_colorspaces_t::softproof_type, dt_colorspaces_color_profile_t::work_pos, and dt_colorspaces_t::xprofile_lock.

Referenced by dt_init().

◆ dt_colorspaces_is_profile_equal()

gboolean dt_colorspaces_is_profile_equal ( const char *  fullname,
const char *  filename 
)

check whether filename is the same profil as fullname, this is taking into account that fullname is always the fullpathname to the profile and filename may be a full pathname or just a base name

References _colorspaces_get_base_name(), and _colorspaces_is_base_name().

Referenced by _get_profile(), _resolve_work_profile(), and gui_update().

◆ dt_colorspaces_rgb_to_cygm()

void dt_colorspaces_rgb_to_cygm ( float *  out,
int  num,
double  RGB_to_CAM[4][3] 
)

convert RGB buffer to CYGM

Referenced by colorpicker_callback(), and legacy_params().

◆ dt_colorspaces_set_display_profile()

◆ dt_colorspaces_update_display_transforms()

void dt_colorspaces_update_display_transforms ( )

update the display transforms of srgb and adobergb to the display profile. make sure that darktable.color_profiles->xprofile_lock is held when calling this!

References _update_display_transforms(), darktable_t::color_profiles, and darktable.

Referenced by _update_display_profile(), intent_callback(), and profile_callback().

◆ dt_image_find_best_color_profile()

dt_colorspaces_color_profile_type_t dt_image_find_best_color_profile ( int32_t  imgid,
cmsHPROFILE *  output,
gboolean *  new_profile 
)

Best effort to find a suitable (input) color profile for a given image, using embedded ICC or EXIF whenever possible. This will also init the profile in the image cache.

Parameters
imgidID of the picture
outputIf not NULL, writes the generated color profile into this pointer.
new_profileWill be set to true if a new profile was generated (aka embedded profile) and will need to be freed. If false and output profile is returned, the profile returned already exists on the public list of profiles and should not be freed.
Returns
dt_colorspaces_color_profile_type_t type of profile detected. This type is tested internally and guaranteed to work.

References dt_image_t::adobe_XYZ_to_CAM, dt_image_t::colorspace, dt_image_t::d65_color_matrix, darktable, DT_COLORSPACE_ADOBERGB, DT_COLORSPACE_EMBEDDED_ICC, DT_COLORSPACE_EMBEDDED_MATRIX, DT_COLORSPACE_LIN_REC2020, DT_COLORSPACE_LIN_REC709, DT_COLORSPACE_NONE, DT_COLORSPACE_SRGB, DT_COLORSPACE_STANDARD_MATRIX, dt_colorspaces_cicp_to_type(), dt_colorspaces_create_xyzimatrix_profile(), dt_colorspaces_get_profile(), dt_colorspaces_get_rgb_profile_from_mem(), DT_IMAGE_4BAYER, dt_image_cache_get(), DT_IMAGE_CACHE_RELAXED, dt_image_cache_write_release(), DT_IMAGE_COLORSPACE_ADOBE_RGB, DT_IMAGE_COLORSPACE_SRGB, dt_image_full_path(), dt_image_is_matrix_correction_supported(), dt_image_is_monochrome(), dt_imageio_avif_read_profile(), dt_imageio_heif_read_profile(), dt_imageio_j2k_read_profile(), dt_imageio_jpeg_read_header(), dt_imageio_jpeg_read_profile(), dt_imageio_png_read_profile(), dt_imageio_tiff_read_profile(), DT_PROFILE_DIRECTION_IN, FALSE, dt_image_t::flags, darktable_t::image_cache, PATH_MAX, dt_colorspaces_color_profile_t::profile, dt_image_t::profile, dt_image_t::profile_size, and TRUE.

Referenced by dt_colorspaces_get_embedded_profile(), and reload_defaults().

◆ hsl2rgb()

◆ mat3inv()

int mat3inv ( float *const  dst,
const float *const  src 
)

◆ mat3inv_float()

int mat3inv_float ( float *const  dst,
const float *const  src 
)

inverts the given 3x3 matrix

Referenced by mat3inv().

◆ rgb2hsl()

void rgb2hsl ( const dt_aligned_pixel_t  rgb,
float *  h,
float *  s,
float *  l 
)

common functions to change between colorspaces, used in iop modules

Referenced by color_picker_apply(), colorpick_callback(), process(), process_hsl_v1(), process_hsl_v2(), and set_HSL_sliders().

◆ sanitize_colorspaces()