![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
#include "common/colorspaces.h"
#include "common/colormatrices.c"
#include "common/darktable.h"
#include "common/debug.h"
#include "common/image_cache.h"
#include "common/file_location.h"
#include "common/math.h"
#include "common/matrices.h"
#include "common/srgb_tone_curve_values.h"
#include "common/utility.h"
#include "control/conf.h"
#include "control/control.h"
#include "develop/imageop.h"
#include <strings.h>
#include "common/imageio_jpeg.h"
#include "common/imageio_png.h"
#include "common/imageio_tiff.h"
Macros | |
#define | generate_mat3inv_body(c_type, A, B) |
#define | A(y, x) src[(y - 1) * 3 + (x - 1)] |
#define | B(y, x) dst[(y - 1) * 3 + (x - 1)] |
Functions | |
static dt_colorspaces_color_profile_t * | _create_profile (dt_colorspaces_color_profile_type_t type, cmsHPROFILE profile, const char *name, int in_pos, int out_pos, int display_pos, int category_pos, int work_pos) |
int | mat3inv_float (float *const dst, const float *const src) |
int | mat3inv (float *const dst, const float *const src) |
int | mat3inv_double (double *const dst, const double *const src) |
static const dt_colorspaces_color_profile_t * | _get_profile (dt_colorspaces_t *self, dt_colorspaces_color_profile_type_t type, const char *filename, dt_colorspaces_profile_direction_t direction) |
static int | dt_colorspaces_get_matrix_from_profile (cmsHPROFILE prof, dt_colormatrix_t matrix, float *lutr, float *lutg, float *lutb, const int lutsize, const int input) |
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) |
static cmsHPROFILE | dt_colorspaces_create_lab_profile () |
static void | _compute_prequantized_primaries (const cmsCIExyY *whitepoint, const cmsCIExyYTRIPLE *primaries, cmsCIEXYZTRIPLE *primaries_prequantized) |
static cmsHPROFILE | _create_lcms_profile (const char *desc, const char *dmdd, const cmsCIExyY *whitepoint, const cmsCIExyYTRIPLE *primaries, cmsToneCurve *trc, gboolean v2) |
static double | _PQ_fct (double x) |
static double | _HLG_fct (double x) |
static cmsToneCurve * | _colorspaces_create_transfer (int32_t size, double(*fct)(double)) |
static cmsHPROFILE | _colorspaces_create_srgb_profile (gboolean v2) |
static cmsHPROFILE | dt_colorspaces_create_srgb_profile () |
static cmsHPROFILE | dt_colorspaces_create_srgb_profile_v4 () |
static cmsHPROFILE | dt_colorspaces_create_brg_profile () |
static cmsHPROFILE | dt_colorspaces_create_gamma_rec709_rgb_profile (void) |
static cmsHPROFILE | dt_colorspaces_create_itur_bt1886_rgb_profile (void) |
static cmsHPROFILE | dt_colorspaces_create_adobergb_profile (void) |
cmsHPROFILE | dt_colorspaces_create_alternate_profile (const char *makermodel) |
cmsHPROFILE | dt_colorspaces_create_vendor_profile (const char *makermodel) |
cmsHPROFILE | dt_colorspaces_create_darktable_profile (const char *makermodel) |
static cmsHPROFILE | dt_colorspaces_create_xyz_profile (void) |
static cmsHPROFILE | dt_colorspaces_create_linear_rec709_rgb_profile (void) |
static cmsHPROFILE | dt_colorspaces_create_linear_rec2020_rgb_profile (void) |
static cmsHPROFILE | dt_colorspaces_create_pq_rec2020_rgb_profile (void) |
static cmsHPROFILE | dt_colorspaces_create_hlg_rec2020_rgb_profile (void) |
static cmsHPROFILE | dt_colorspaces_create_pq_p3_rgb_profile (void) |
static cmsHPROFILE | dt_colorspaces_create_hlg_p3_rgb_profile (void) |
static cmsHPROFILE | dt_colorspaces_create_display_p3_rgb_profile (void) |
static cmsHPROFILE | dt_colorspaces_create_linear_prophoto_rgb_profile (void) |
static cmsHPROFILE | dt_colorspaces_create_linear_infrared_profile (void) |
const dt_colorspaces_color_profile_t * | dt_colorspaces_get_work_profile (const int32_t imgid) |
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. | |
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_t * | _build_embedded_profile (const int32_t imgid, dt_colorspaces_color_profile_type_t *type) |
const dt_colorspaces_color_profile_t * | dt_colorspaces_get_output_profile (const int32_t imgid, dt_colorspaces_color_profile_type_t *over_type, const char *over_filename) |
static cmsHPROFILE | dt_colorspaces_create_xyzmatrix_profile (const float mat[3][3]) |
cmsHPROFILE | dt_colorspaces_create_xyzimatrix_profile (float mat[3][3]) |
static cmsHPROFILE | _ensure_rgb_profile (cmsHPROFILE profile) |
cmsHPROFILE | dt_colorspaces_get_rgb_profile_from_mem (uint8_t *data, uint32_t size) |
void | dt_colorspaces_cleanup_profile (cmsHPROFILE p) |
void | dt_colorspaces_get_profile_name (cmsHPROFILE p, const char *language, const char *country, char *name, size_t len) |
void | rgb2hsl (const dt_aligned_pixel_t rgb, float *h, float *s, float *l) |
static float | hue2rgb (float m1, float m2, float hue) |
void | hsl2rgb (dt_aligned_pixel_t rgb, float h, float s, float l) |
static void | _update_display_transforms (dt_colorspaces_t *self) |
void | dt_colorspaces_update_display_transforms () |
static void | _update_display_profile (guchar *tmp_data, gsize size, char *name, size_t name_size) |
static void | cms_error_handler (cmsContext ContextID, cmsUInt32Number ErrorCode, const char *text) |
static gint | _sort_profiles (gconstpointer a, gconstpointer b) |
static GList * | load_profile_from_dir (const char *subdir) |
dt_colorspaces_t * | dt_colorspaces_init () |
void | dt_colorspaces_cleanup (dt_colorspaces_t *self) |
const char * | dt_colorspaces_get_name (dt_colorspaces_color_profile_type_t type, const char *filename) |
void | dt_colorspaces_set_display_profile (const dt_colorspaces_color_profile_type_t profile_type) |
static gboolean | _colorspaces_is_base_name (const char *profile) |
static const char * | _colorspaces_get_base_name (const char *profile) |
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) |
const dt_colorspaces_color_profile_t * | dt_colorspaces_get_profile (dt_colorspaces_color_profile_type_t type, const char *filename, dt_colorspaces_profile_direction_t direction) |
static void | dt_colorspaces_pseudoinverse (double(*in)[3], double(*out)[3], int size) |
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 out_RGB_to_CAM[4][3], double out_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]) |
Variables | |
static const cmsCIEXYZ | d65 = {0.95045471, 1.00000000, 1.08905029} |
static const cmsCIExyY | D65xyY = {0.312700492, 0.329000939, 1.0} |
static const cmsCIExyY | D50xyY = {0.3457, 0.3585, 1.0} |
static const cmsCIExyYTRIPLE | sRGB_Primaries |
static const cmsCIExyYTRIPLE | Rec2020_Primaries |
static const cmsCIExyYTRIPLE | Rec709_Primaries |
static const cmsCIExyYTRIPLE | Adobe_Primaries |
static const cmsCIExyYTRIPLE | P3_Primaries |
static const cmsCIExyYTRIPLE | ProPhoto_Primaries |
cmsCIEXYZTRIPLE | Rec709_Primaries_Prequantized |
#define A | ( | y, | |
x | |||
) | src[(y - 1) * 3 + (x - 1)] |
#define B | ( | y, | |
x | |||
) | dst[(y - 1) * 3 + (x - 1)] |
const dt_colorspaces_color_profile_t * _build_embedded_profile | ( | const int32_t | imgid, |
dt_colorspaces_color_profile_type_t * | type | ||
) |
|
static |
References _create_lcms_profile(), D65xyY, and sRGB_Primaries.
Referenced by dt_colorspaces_create_srgb_profile(), and dt_colorspaces_create_srgb_profile_v4().
|
static |
References f().
Referenced by dt_colorspaces_is_profile_equal().
|
static |
References f(), FALSE, and TRUE.
Referenced by dt_colorspaces_is_profile_equal().
|
static |
References B, double(), and R.
Referenced by dt_colorspaces_init().
|
static |
Referenced by _colorspaces_create_srgb_profile(), 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_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(), and dt_colorspaces_create_pq_rec2020_rgb_profile().
|
static |
References dt_colorspaces_color_profile_t::category_pos, dt_colorspaces_color_profile_t::display_pos, dt_colorspaces_color_profile_t::in_pos, dt_colorspaces_color_profile_t::name, name, dt_colorspaces_color_profile_t::out_pos, dt_colorspaces_color_profile_t::profile, dt_colorspaces_color_profile_t::type, type, and dt_colorspaces_color_profile_t::work_pos.
Referenced by _build_embedded_profile(), and dt_colorspaces_init().
|
static |
References Rec709_Primaries_Prequantized.
Referenced by dt_colorspaces_get_rgb_profile_from_mem(), and load_profile_from_dir().
|
static |
References B, MAX, and sign().
Referenced by dt_colorspaces_create_hlg_p3_rgb_profile(), and dt_colorspaces_create_hlg_rec2020_rgb_profile().
|
static |
References dt_colorspaces_color_profile_t::name.
Referenced by load_profile_from_dir().
|
static |
References darktable_t::color_profiles, darktable, DT_COLORSPACE_DISPLAY, dt_colorspaces_cleanup_profile(), dt_colorspaces_get_profile_name(), dt_colorspaces_update_display_transforms(), name, dt_colorspaces_t::profiles, size, dt_colorspaces_t::xprofile_data, and dt_colorspaces_t::xprofile_size.
Referenced by dt_colorspaces_set_display_profile().
|
static |
References _get_profile(), dt_colorspaces_t::display_filename, dt_colorspaces_t::display_intent, dt_colorspaces_t::display_type, DT_COLORSPACE_ADOBERGB, DT_COLORSPACE_SRGB, DT_COLORSPACE_XYZ, DT_PROFILE_DIRECTION_DISPLAY, DT_PROFILE_DIRECTION_IN, dt_colorspaces_color_profile_t::profile, dt_colorspaces_t::transform_adobe_rgb_to_display, dt_colorspaces_t::transform_srgb_to_display, dt_colorspaces_t::transform_xyz_to_display, and TYPE_XYZA_FLT.
Referenced by dt_colorspaces_init(), and dt_colorspaces_update_display_transforms().
|
static |
Referenced by dt_colorspaces_init().
dt_colorspaces_color_profile_type_t dt_colorspaces_cicp_to_type | ( | const dt_colorspaces_cicp_t * | cicp, |
const char * | filename | ||
) |
try to infer profile type from CICP
References dt_colorspaces_cicp_t::color_primaries, DT_CICP_COLOR_PRIMARIES_P3, DT_CICP_COLOR_PRIMARIES_REC2020, DT_CICP_COLOR_PRIMARIES_REC709, DT_CICP_COLOR_PRIMARIES_UNSPECIFIED, DT_CICP_COLOR_PRIMARIES_XYZ, DT_CICP_MATRIX_COEFFICIENTS_CHROMA_DERIVED_NCL, DT_CICP_MATRIX_COEFFICIENTS_IDENTITY, DT_CICP_MATRIX_COEFFICIENTS_REC2020_NCL, DT_CICP_MATRIX_COEFFICIENTS_REC601, DT_CICP_MATRIX_COEFFICIENTS_REC709, DT_CICP_MATRIX_COEFFICIENTS_SYCC, DT_CICP_MATRIX_COEFFICIENTS_UNSPECIFIED, DT_CICP_TRANSFER_CHARACTERISTICS_HLG, DT_CICP_TRANSFER_CHARACTERISTICS_LINEAR, DT_CICP_TRANSFER_CHARACTERISTICS_PQ, DT_CICP_TRANSFER_CHARACTERISTICS_REC2020_10B, DT_CICP_TRANSFER_CHARACTERISTICS_REC2020_12B, DT_CICP_TRANSFER_CHARACTERISTICS_REC601, DT_CICP_TRANSFER_CHARACTERISTICS_REC709, DT_CICP_TRANSFER_CHARACTERISTICS_SRGB, DT_CICP_TRANSFER_CHARACTERISTICS_UNSPECIFIED, DT_COLORSPACE_DISPLAY_P3, DT_COLORSPACE_HLG_P3, DT_COLORSPACE_HLG_REC2020, DT_COLORSPACE_LIN_REC2020, DT_COLORSPACE_LIN_REC709, DT_COLORSPACE_NONE, DT_COLORSPACE_PQ_P3, DT_COLORSPACE_PQ_REC2020, DT_COLORSPACE_REC709, DT_COLORSPACE_SRGB, DT_COLORSPACE_XYZ, DT_DEBUG_IMAGEIO, dt_print(), dt_colorspaces_cicp_t::matrix_coefficients, and dt_colorspaces_cicp_t::transfer_characteristics.
Referenced by dt_image_find_best_color_profile().
void dt_colorspaces_cleanup | ( | dt_colorspaces_t * | self | ) |
cleanup on shutdown
References dt_colorspaces_t::colord_profile_file, dt_colorspaces_t::display_filename, dt_colorspaces_t::display_intent, dt_colorspaces_t::display_type, dt_colorspaces_cleanup_profile(), dt_conf_set_int(), dt_conf_set_string(), dt_colorspaces_t::mode, dt_colorspaces_t::profiles, dt_colorspaces_t::softproof_filename, dt_colorspaces_t::softproof_intent, dt_colorspaces_t::softproof_type, dt_colorspaces_t::transform_adobe_rgb_to_display, dt_colorspaces_t::transform_srgb_to_display, dt_colorspaces_t::transform_xyz_to_display, dt_colorspaces_t::xprofile_data, and dt_colorspaces_t::xprofile_lock.
Referenced by dt_cleanup().
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().
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().
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().
|
static |
References _create_lcms_profile(), Adobe_Primaries, D65xyY, and TRUE.
Referenced by dt_colorspaces_init().
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().
|
static |
References _create_lcms_profile(), D65xyY, sRGB_Primaries, and TRUE.
Referenced by dt_colorspaces_init().
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().
|
static |
References _create_lcms_profile(), D65xyY, P3_Primaries, and TRUE.
Referenced by dt_colorspaces_init().
|
static |
References _create_lcms_profile(), D65xyY, Rec709_Primaries, and TRUE.
Referenced by dt_colorspaces_init().
|
static |
References _colorspaces_create_transfer(), _create_lcms_profile(), _HLG_fct(), D65xyY, P3_Primaries, and TRUE.
Referenced by dt_colorspaces_init().
|
static |
References _colorspaces_create_transfer(), _create_lcms_profile(), _HLG_fct(), D65xyY, Rec2020_Primaries, and TRUE.
Referenced by dt_colorspaces_init().
|
static |
References _create_lcms_profile(), D65xyY, Rec709_Primaries, and TRUE.
Referenced by dt_colorspaces_init().
|
static |
Referenced by dt_colorspaces_init().
|
static |
References _create_lcms_profile(), D65xyY, FALSE, and sRGB_Primaries.
Referenced by dt_colorspaces_init().
|
static |
References _create_lcms_profile(), D50xyY, ProPhoto_Primaries, and TRUE.
Referenced by dt_colorspaces_init().
|
static |
References _create_lcms_profile(), D65xyY, Rec2020_Primaries, and TRUE.
Referenced by dt_colorspaces_init().
|
static |
References _create_lcms_profile(), D65xyY, Rec709_Primaries, and TRUE.
Referenced by dt_colorspaces_init().
|
static |
References _colorspaces_create_transfer(), _create_lcms_profile(), _PQ_fct(), D65xyY, P3_Primaries, and TRUE.
Referenced by dt_colorspaces_init().
|
static |
References _colorspaces_create_transfer(), _create_lcms_profile(), _PQ_fct(), D65xyY, Rec2020_Primaries, and TRUE.
Referenced by dt_colorspaces_init().
|
static |
References _colorspaces_create_srgb_profile(), and TRUE.
Referenced by dt_colorspaces_init().
|
static |
References _colorspaces_create_srgb_profile(), and FALSE.
Referenced by dt_colorspaces_init().
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().
|
static |
Referenced by dt_colorspaces_init().
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().
|
static |
References d65.
Referenced by dt_colorspaces_create_xyzimatrix_profile().
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
convert CYGM buffer to RGB
Referenced by gui_update_from_coeffs(), and process().
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().
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().
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().
|
static |
References mat3SSEinv().
Referenced by dt_colorspaces_get_matrix_from_input_profile(), and dt_colorspaces_get_matrix_from_output_profile().
const char * dt_colorspaces_get_name | ( | dt_colorspaces_color_profile_type_t | type, |
const char * | filename | ||
) |
get a nice printable name.
References DT_COLORSPACE_ADOBERGB, DT_COLORSPACE_ALTERNATE_MATRIX, DT_COLORSPACE_BRG, DT_COLORSPACE_DISPLAY, DT_COLORSPACE_DISPLAY2, DT_COLORSPACE_DISPLAY_P3, DT_COLORSPACE_EMBEDDED_ICC, DT_COLORSPACE_EMBEDDED_MATRIX, DT_COLORSPACE_ENHANCED_MATRIX, 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_NONE, DT_COLORSPACE_PQ_P3, DT_COLORSPACE_PQ_REC2020, DT_COLORSPACE_PROPHOTO_RGB, DT_COLORSPACE_REC709, DT_COLORSPACE_SOFTPROOF, DT_COLORSPACE_SRGB, DT_COLORSPACE_STANDARD_MATRIX, DT_COLORSPACE_VENDOR_MATRIX, DT_COLORSPACE_WORK, DT_COLORSPACE_XYZ, and type.
Referenced by _resolve_work_profile(), commit_params(), gui_update(), profile_changed(), update_profile_list(), workicc_changed(), and write_image().
const dt_colorspaces_color_profile_t * dt_colorspaces_get_output_profile | ( | const int32_t | imgid, |
dt_colorspaces_color_profile_type_t * | over_type, | ||
const char * | over_filename | ||
) |
return the output profile as set in colorout, taking export override into account if passed in.
References _build_embedded_profile(), DT_COLORSPACE_EMBEDDED_ICC, DT_COLORSPACE_EMBEDDED_MATRIX, DT_COLORSPACE_NONE, DT_COLORSPACE_SRGB, DT_COLORSPACE_STANDARD_MATRIX, dt_colorspaces_get_profile(), DT_PROFILE_DIRECTION_DISPLAY, and DT_PROFILE_DIRECTION_OUT.
Referenced by _export_image(), dt_imageio_export_with_flags(), dt_imageio_jpeg_write_with_icc_profile(), write_image(), write_image(), write_image(), write_image(), write_image(), write_image(), write_image(), and write_image().
const dt_colorspaces_color_profile_t * dt_colorspaces_get_profile | ( | dt_colorspaces_color_profile_type_t | type, |
const char * | filename, | ||
dt_colorspaces_profile_direction_t | direction | ||
) |
get the profile described by type & filename. this doesn't support image specifics like embedded profiles or camera matrices
References _get_profile(), darktable_t::color_profiles, darktable, and type.
Referenced by _export_image(), _read_chunky_16_Lab(), _read_chunky_8_Lab(), _transform_from_to_rgb_lab_lcms2(), _transform_rgb_to_rgb_lcms2(), commit_params(), dt_colorspaces_get_output_profile(), dt_colorspaces_get_work_profile(), dt_image_find_best_color_profile(), dt_imageio_tiff_read_profile(), dt_ioppr_generate_profile_info(), and gui_init().
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().
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().
const dt_colorspaces_color_profile_t * dt_colorspaces_get_work_profile | ( | const int32_t | imgid | ) |
return the work profile as set in colorin
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_t * dt_colorspaces_init | ( | ) |
populate the global color profile lists
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().
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().
References size.
Referenced by dt_colorspaces_conversion_matrices_rgb(), and dt_colorspaces_conversion_matrices_xyz().
convert RGB buffer to CYGM
Referenced by colorpicker_callback(), and legacy_params().
void dt_colorspaces_set_display_profile | ( | const dt_colorspaces_color_profile_type_t | profile_type | ) |
trigger updating the display profile from the system settings (x atom, colord, ...)
References _update_display_profile(), darktable_t::color_profiles, darktable, darktable_t::develop, DT_COLORSPACE_DISPLAY2, dt_conf_get_string_const(), dt_control_running(), DT_DEBUG_CONTROL, DT_DEBUG_CONTROL_SIGNAL_RAISE, dt_print(), DT_SIGNAL_CONTROL_PROFILE_CHANGED, dt_ui_center(), FALSE, darktable_t::gui, name, profile_changed(), darktable_t::signals, size, TRUE, type, dt_gui_gtk_t::ui, dt_colorspaces_t::xprofile_data, dt_colorspaces_t::xprofile_lock, and dt_colorspaces_t::xprofile_size.
Referenced by _configure(), _window_configure(), and dt_gui_gtk_init().
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_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.
imgid | ID of the picture |
output | If not NULL, writes the generated color profile into this pointer. |
new_profile | Will 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. |
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().
void hsl2rgb | ( | dt_aligned_pixel_t | rgb, |
float | h, | ||
float | s, | ||
float | l | ||
) |
References hue2rgb().
Referenced by commit_params(), hue_conversion(), process(), process_hsl_v1(), process_hsl_v2(), set_RGB_sliders(), update_balance_slider_colors(), update_colorpicker_color(), update_saturation_slider_color(), update_saturation_slider_end_color(), update_saturation_slider_end_color(), and update_saturation_slider_end_color().
|
inlinestatic |
Referenced by hsl2rgb().
|
static |
References _ensure_rgb_profile(), _sort_profiles(), dt_colorspaces_color_profile_t::category_pos, dt_colorspaces_color_profile_t::display_pos, DT_COLORSPACE_FILE, dt_colorspaces_get_profile_name(), dt_loc_get_datadir(), dt_loc_get_user_config_dir(), dt_read_file(), dt_colorspaces_color_profile_t::filename, dt_colorspaces_color_profile_t::in_pos, dt_colorspaces_color_profile_t::name, dt_colorspaces_color_profile_t::out_pos, PATH_MAX, dt_colorspaces_color_profile_t::profile, dt_colorspaces_color_profile_t::type, and dt_colorspaces_color_profile_t::work_pos.
Referenced by dt_colorspaces_init().
int mat3inv | ( | float *const | dst, |
const float *const | src | ||
) |
References mat3inv_float().
Referenced by dt_colorspaces_create_xyzimatrix_profile(), dt_imageio_open_rgbe(), and homography().
int mat3inv_float | ( | float *const | dst, |
const float *const | src | ||
) |
inverts the given 3x3 matrix
Referenced by mat3inv().
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().
|
static |
Referenced by dt_colorspaces_create_adobergb_profile().
|
static |
Referenced by dt_colorspaces_create_linear_prophoto_rgb_profile().
|
static |
Referenced by dt_colorspaces_create_xyzmatrix_profile(), and dt_imageio_open_exr().
|
static |
Referenced by _colorspaces_create_srgb_profile(), 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_linear_infrared_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(), and dt_colorspaces_init().
|
static |
Referenced by dt_colorspaces_create_display_p3_rgb_profile(), dt_colorspaces_create_hlg_p3_rgb_profile(), and dt_colorspaces_create_pq_p3_rgb_profile().
|
static |
Referenced by dt_colorspaces_create_linear_prophoto_rgb_profile().
|
static |
Referenced by dt_colorspaces_create_hlg_rec2020_rgb_profile(), dt_colorspaces_create_linear_rec2020_rgb_profile(), and dt_colorspaces_create_pq_rec2020_rgb_profile().
|
static |
Referenced by dt_colorspaces_create_gamma_rec709_rgb_profile(), dt_colorspaces_create_itur_bt1886_rgb_profile(), dt_colorspaces_create_linear_rec709_rgb_profile(), and dt_colorspaces_init().
cmsCIEXYZTRIPLE Rec709_Primaries_Prequantized |
Referenced by _ensure_rgb_profile(), and dt_colorspaces_init().
|
static |
Referenced by _colorspaces_create_srgb_profile(), dt_colorspaces_create_brg_profile(), and dt_colorspaces_create_linear_infrared_profile().