![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
#include "bauhaus/bauhaus.h"
#include "chart/common.h"
#include "develop/imageop_gui.h"
#include "dtgtk/drawingarea.h"
#include "common/chromatic_adaptation.h"
#include "common/colorspaces_inline_conversions.h"
#include "common/colorchecker.h"
#include "common/opencl.h"
#include "common/illuminants.h"
#include "common/imagebuf.h"
#include "common/iop_profile.h"
#include "control/control.h"
#include "develop/imageop_math.h"
#include "develop/openmp_maths.h"
#include "gui/color_picker_proxy.h"
#include "gui/gtk.h"
#include "gui/presets.h"
#include "iop/iop_api.h"
#include "gaussian_elimination.h"
#include <assert.h>
#include <gtk/gtk.h>
#include <inttypes.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
Data Structures | |
struct | dt_iop_channelmixer_rgb_params_t |
struct | dt_iop_channelmixer_rgb_gui_data_t |
struct | dt_iop_channelmixer_rbg_data_t |
struct | dt_iop_channelmixer_rgb_global_data_t |
struct | extraction_result_t |
Macros | |
#define | CHANNEL_SIZE 4 |
#define | INVERSE_SQRT_3 0.5773502691896258f |
#define | COLOR_MIN -2.0 |
#define | COLOR_MAX 2.0 |
#define | ILLUM_X_MAX 360.0 |
#define | ILLUM_Y_MAX 300.0 |
#define | LIGHTNESS_MAX 100.0 |
#define | HUE_MAX 360.0 |
#define | CHROMA_MAX 128.0 |
#define | TEMP_MIN 1667. |
#define | TEMP_MAX 25000. |
#define | SHF(ii, jj, c) ((i + ii) * width + j + jj) * ch + c |
#define | OFF 4 |
#define | DEG_TO_RAD(x) (x * M_PI / 180.f) |
#define | RAD_TO_DEG(x) (x * 180.f / M_PI) |
#define | GET_WEIGHT |
#define | NOTEBOOK_PAGE(var, short, label, tooltip, section, swap) |
Typedefs | |
typedef enum dt_iop_channelmixer_rgb_version_t | dt_iop_channelmixer_rgb_version_t |
typedef struct dt_iop_channelmixer_rgb_params_t | dt_iop_channelmixer_rgb_params_t |
typedef enum dt_solving_strategy_t | dt_solving_strategy_t |
typedef enum dt_spot_mode_t | dt_spot_mode_t |
typedef struct dt_iop_channelmixer_rgb_gui_data_t | dt_iop_channelmixer_rgb_gui_data_t |
typedef struct dt_iop_channelmixer_rbg_data_t | dt_iop_channelmixer_rbg_data_t |
typedef struct dt_iop_channelmixer_rgb_global_data_t | dt_iop_channelmixer_rgb_global_data_t |
Enumerations | |
enum | dt_iop_channelmixer_rgb_version_t { CHANNELMIXERRGB_V_1 = 0 , CHANNELMIXERRGB_V_2 = 1 , CHANNELMIXERRGB_V_3 = 2 } |
enum | dt_solving_strategy_t { DT_SOLVE_OPTIMIZE_NONE = 0 , DT_SOLVE_OPTIMIZE_LOW_SAT = 1 , DT_SOLVE_OPTIMIZE_HIGH_SAT = 2 , DT_SOLVE_OPTIMIZE_SKIN = 3 , DT_SOLVE_OPTIMIZE_FOLIAGE = 4 , DT_SOLVE_OPTIMIZE_SKY = 5 , DT_SOLVE_OPTIMIZE_AVG_DELTA_E = 6 , DT_SOLVE_OPTIMIZE_MAX_DELTA_E = 7 } |
enum | dt_spot_mode_t { DT_SPOT_MODE_CORRECT = 0 , DT_SPOT_MODE_MEASURE = 1 , DT_SPOT_MODE_LAST } |
Functions | |
void | _auto_set_illuminant (dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe) |
const char * | name () |
const char * | aliases () |
const char ** | description (struct dt_iop_module_t *self) |
int | flags () |
int | default_group () |
int | default_colorspace (dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece) |
int | legacy_params (dt_iop_module_t *self, const void *const old_params, const int old_version, void *new_params, const int new_version) |
void | init_presets (dt_iop_module_so_t *self) |
static int | get_white_balance_coeff (struct dt_iop_module_t *self, dt_aligned_pixel_t custom_wb) |
static void | gamut_mapping (const dt_aligned_pixel_t input, const float compression, const int clip, dt_aligned_pixel_t output) |
static void | luma_chroma (const dt_aligned_pixel_t input, const dt_aligned_pixel_t saturation, const dt_aligned_pixel_t lightness, dt_aligned_pixel_t output, const dt_iop_channelmixer_rgb_version_t version) |
static void | loop_switch (const float *const restrict in, float *const restrict out, const size_t width, const size_t height, const size_t ch, const dt_colormatrix_t XYZ_to_RGB, const dt_colormatrix_t RGB_to_XYZ, const dt_colormatrix_t MIX, const dt_aligned_pixel_t illuminant, const dt_aligned_pixel_t saturation, const dt_aligned_pixel_t lightness, const dt_aligned_pixel_t grey, const float p, const float gamut, const int clip, const int apply_grey, const dt_adaptation_t kind, const dt_iop_channelmixer_rgb_version_t version) |
static void | auto_detect_WB (const float *const restrict in, dt_illuminant_t illuminant, const size_t width, const size_t height, const size_t ch, const dt_colormatrix_t RGB_to_XYZ, dt_aligned_pixel_t xyz) |
static void | declare_cat_on_pipe (struct dt_iop_module_t *self, gboolean preset) |
static gboolean | _is_another_module_cat_on_pipe (struct dt_iop_module_t *self) |
static void | update_illuminants (struct dt_iop_module_t *self) |
static void | update_approx_cct (struct dt_iop_module_t *self) |
static void | update_illuminant_color (struct dt_iop_module_t *self) |
static void | paint_temperature_background (struct dt_iop_module_t *self) |
static void | check_if_close_to_daylight (const float x, const float y, float *temperature, dt_illuminant_t *illuminant, dt_adaptation_t *adaptation) |
static void | compute_patches_delta_E (const float *const restrict patches, const dt_color_checker_t *const checker, float *const restrict delta_E, float *const restrict avg_delta_E, float *const restrict max_delta_E) |
static const extraction_result_t | _extract_patches (const float *const restrict in, const dt_iop_roi_t *const roi_in, dt_iop_channelmixer_rgb_gui_data_t *g, const dt_colormatrix_t RGB_to_XYZ, const dt_colormatrix_t XYZ_to_CAM, float *const restrict patches, const gboolean normalize_exposure) |
void | extract_color_checker (const float *const restrict in, float *const restrict out, const dt_iop_roi_t *const roi_in, dt_iop_channelmixer_rgb_gui_data_t *g, const dt_colormatrix_t RGB_to_XYZ, const dt_colormatrix_t XYZ_to_RGB, const dt_colormatrix_t XYZ_to_CAM, const dt_adaptation_t kind) |
void | validate_color_checker (const float *const restrict in, const dt_iop_roi_t *const roi_in, dt_iop_channelmixer_rgb_gui_data_t *g, const dt_colormatrix_t RGB_to_XYZ, const dt_colormatrix_t XYZ_to_RGB, const dt_colormatrix_t XYZ_to_CAM) |
void | process (struct dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, const void *const restrict ivoid, void *const restrict ovoid, const dt_iop_roi_t *const roi_in, const dt_iop_roi_t *const roi_out) |
static void | update_bounding_box (dt_iop_channelmixer_rgb_gui_data_t *g, const float x_increment, const float y_increment) |
static void | init_bounding_box (dt_iop_channelmixer_rgb_gui_data_t *g, const float width, const float height) |
int | mouse_moved (struct dt_iop_module_t *self, double x, double y, double pressure, int which) |
int | button_pressed (struct dt_iop_module_t *self, double x, double y, double pressure, int which, int type, uint32_t state) |
int | button_released (struct dt_iop_module_t *self, double x, double y, int which, uint32_t state) |
void | gui_post_expose (struct dt_iop_module_t *self, cairo_t *cr, int32_t width, int32_t height, int32_t pointerx, int32_t pointery) |
static void | optimize_changed_callback (GtkWidget *widget, gpointer user_data) |
static void | checker_changed_callback (GtkWidget *widget, gpointer user_data) |
static void | safety_changed_callback (GtkWidget *widget, gpointer user_data) |
static void | start_profiling_callback (GtkWidget *togglebutton, dt_iop_module_t *self) |
static void | run_profile_callback (GtkWidget *widget, GdkEventButton *event, gpointer user_data) |
static void | run_validation_callback (GtkWidget *widget, GdkEventButton *event, gpointer user_data) |
static void | commit_profile_callback (GtkWidget *widget, GdkEventButton *event, gpointer user_data) |
static void | _develop_ui_pipe_finished_callback (gpointer instance, gpointer user_data) |
static void | _preview_pipe_finished_callback (gpointer instance, gpointer user_data) |
void | commit_params (struct dt_iop_module_t *self, dt_iop_params_t *p1, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece) |
static void | update_xy_color (dt_iop_module_t *self) |
static void | paint_hue (dt_iop_module_t *self) |
static void | _convert_GUI_colors (dt_iop_channelmixer_rgb_params_t *p, const struct dt_iop_order_iccprofile_info_t *const work_profile, const dt_aligned_pixel_t LMS, dt_aligned_pixel_t RGB) |
static void | _update_RGB_slider_stop (dt_iop_channelmixer_rgb_params_t *p, const struct dt_iop_order_iccprofile_info_t *const work_profile, GtkWidget *w, float stop, float c, float r, float g, float b) |
static void | _update_RGB_colors (dt_iop_module_t *self, float r, float g, float b, gboolean normalize, float *a, GtkWidget *w_r, GtkWidget *w_g, GtkWidget *w_b) |
static gboolean | illuminant_color_draw (GtkWidget *widget, cairo_t *crf, gpointer user_data) |
static gboolean | target_color_draw (GtkWidget *widget, cairo_t *crf, gpointer user_data) |
static gboolean | origin_color_draw (GtkWidget *widget, cairo_t *crf, gpointer user_data) |
static void | illum_xy_callback (GtkWidget *slider, gpointer user_data) |
void | init_pipe (struct dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece) |
void | cleanup_pipe (struct dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece) |
void | gui_reset (dt_iop_module_t *self) |
void | gui_update (struct dt_iop_module_t *self) |
void | init (dt_iop_module_t *module) |
void | reload_defaults (dt_iop_module_t *module) |
static void | _spot_settings_changed_callback (GtkWidget *slider, dt_iop_module_t *self) |
void | gui_changed (dt_iop_module_t *self, GtkWidget *w, void *previous) |
void | color_picker_apply (dt_iop_module_t *self, GtkWidget *picker, dt_dev_pixelpipe_iop_t *piece) |
void | gui_init (struct dt_iop_module_t *self) |
void | gui_cleanup (struct dt_iop_module_t *self) |
#define CHANNEL_SIZE 4 |
Note : we use finite-math-only and fast-math because divisions by zero are manually avoided in the code fp-contract=fast enables hardware-accelerated Fused Multiply-Add the rest is loop reorganization and vectorization optimization
#define CHROMA_MAX 128.0 |
#define COLOR_MAX 2.0 |
#define COLOR_MIN -2.0 |
#define GET_WEIGHT |
#define HUE_MAX 360.0 |
#define ILLUM_X_MAX 360.0 |
#define ILLUM_Y_MAX 300.0 |
#define INVERSE_SQRT_3 0.5773502691896258f |
#define LIGHTNESS_MAX 100.0 |
#define OFF 4 |
#define SHF | ( | ii, | |
jj, | |||
c | |||
) | ((i + ii) * width + j + jj) * ch + c |
#define TEMP_MAX 25000. |
#define TEMP_MIN 1667. |
typedef struct dt_iop_channelmixer_rbg_data_t dt_iop_channelmixer_rbg_data_t |
typedef struct dt_iop_channelmixer_rgb_params_t dt_iop_channelmixer_rgb_params_t |
typedef enum dt_solving_strategy_t dt_solving_strategy_t |
typedef enum dt_spot_mode_t dt_spot_mode_t |
enum dt_spot_mode_t |
void _auto_set_illuminant | ( | dt_iop_module_t * | self, |
dt_dev_pixelpipe_t * | pipe | ||
) |
References check_if_close_to_daylight(), chroma_adapt_pixel(), convert_any_LMS_to_XYZ(), convert_any_XYZ_to_LMS(), convert_D50_to_LMS(), darktable, dt_iop_module_t::dev, darktable_t::develop, dot_product(), dt_bauhaus_combobox_get(), dt_bauhaus_combobox_set(), dt_bauhaus_slider_get(), dt_bauhaus_slider_set(), dt_conf_set_bool(), dt_conf_set_float(), dt_dev_add_history_item, DT_ILLUMINANT_CAMERA, DT_ILLUMINANT_CUSTOM, dt_iop_gui_enter_critical_section(), dt_iop_gui_leave_critical_section(), dt_ioppr_get_pipe_work_profile_info(), dt_Lab_2_LCH(), dt_Lab_to_XYZ(), dt_LCH_2_Lab(), DT_SPOT_MODE_CORRECT, DT_SPOT_MODE_MEASURE, dt_xyY_to_Lch(), dt_XYZ_to_Lab(), dt_XYZ_to_sRGB(), get_white_balance_coeff(), darktable_t::gui, dt_iop_module_t::gui_data, illuminant_to_xy(), illuminant_xy_to_XYZ(), dt_develop_t::image_storage, Lab(), M_PI, matrice_pseudoinverse(), dt_iop_order_iccprofile_info_t::matrix_in, NORM_MIN, pack_3xSSE_to_3x3(), paint_hue(), paint_temperature_background(), dt_iop_module_t::params, dt_iop_module_t::picked_color, dt_iop_module_t::picked_color_max, dt_iop_module_t::picked_color_min, dt_gui_gtk_t::reset, transpose_3x3_to_3xSSE(), TRUE, update_approx_cct(), update_illuminant_color(), and update_illuminants().
Referenced by _spot_settings_changed_callback(), and color_picker_apply().
|
static |
References convert_any_LMS_to_RGB(), DT_ADAPTATION_RGB, dt_ioppr_rgb_matrix_to_xyz(), dt_XYZ_to_Rec709_D65(), dt_iop_order_iccprofile_info_t::lut_in, dt_iop_order_iccprofile_info_t::lutsize, dt_iop_order_iccprofile_info_t::matrix_in_transposed, and dt_iop_order_iccprofile_info_t::nonlinearlut.
Referenced by _update_RGB_slider_stop().
|
static |
References check_if_close_to_daylight(), darktable, darktable_t::develop, dt_bauhaus_combobox_set(), dt_bauhaus_slider_set(), dt_dev_add_history_item, DT_ILLUMINANT_DETECT_EDGES, DT_ILLUMINANT_DETECT_SURFACES, dt_iop_gui_enter_critical_section(), dt_iop_gui_leave_critical_section(), dt_xyY_to_Lch(), darktable_t::gui, gui_changed(), dt_iop_module_t::gui_data, M_PI, paint_temperature_background(), dt_iop_module_t::params, dt_gui_gtk_t::reset, TRUE, update_approx_cct(), update_illuminant_color(), and update_illuminants().
Referenced by gui_cleanup(), and gui_init().
|
static |
References apply_homography(), darktable, darktable_t::develop, dot_product(), dt_alloc_sse_ps(), dt_dev_exposure_get_black(), dt_dev_exposure_get_exposure(), dt_Lab_to_XYZ(), euclidean_norm(), height, dt_iop_roi_t::height, sqf(), width, dt_iop_roi_t::width, point_t::x, and point_t::y.
Referenced by extract_color_checker(), and validate_color_checker().
|
inlinestatic |
|
static |
References dt_iop_gui_enter_critical_section(), dt_iop_gui_leave_critical_section(), and dt_iop_module_t::gui_data.
Referenced by gui_cleanup(), and gui_init().
|
static |
References _auto_set_illuminant(), darktable, darktable_t::develop, dt_bauhaus_combobox_get(), dt_bauhaus_slider_get(), dt_conf_set_bool(), dt_conf_set_float(), dt_iop_gui_enter_critical_section(), dt_iop_gui_leave_critical_section(), DT_SPOT_MODE_CORRECT, darktable_t::gui, dt_iop_module_t::gui_data, paint_hue(), dt_develop_t::pipe, and dt_gui_gtk_t::reset.
Referenced by gui_init().
|
static |
|
static |
References _convert_GUI_colors(), and dt_bauhaus_slider_set_stop().
Referenced by _update_RGB_colors().
const char * aliases | ( | ) |
|
inlinestatic |
Detect the chromaticity of the illuminant based on the grey edges hypothesis. So we compute a laplacian filter and get the weighted average of its chromaticities
Inspired by : A Fast White Balance Algorithm Based on Pixel Greyness, Ba Thai·Guang Deng·Robert Ross https://www.researchgate.net/profile/Ba_Son_Thai/publication/308692177_A_Fast_White_Balance_Algorithm_Based_on_Pixel_Greyness/
Edge-Based Color Constancy, Joost van de Weijer, Theo Gevers, Arjan Gijsenij https://hal.inria.fr/inria-00548686/document
References dot_product(), DT_ALIGNED_PIXEL, dt_alloc_sse_ps(), dt_fast_hypotf(), dt_free_align, DT_ILLUMINANT_DETECT_EDGES, DT_ILLUMINANT_DETECT_SURFACES, for_each_channel, height, NORM_MIN, OFF, SHF, sqf(), weight(), and width.
Referenced by process().
int button_pressed | ( | struct dt_iop_module_t * | self, |
double | x, | ||
double | y, | ||
double | pressure, | ||
int | which, | ||
int | type, | ||
uint32_t | state | ||
) |
References dt_dev_pixelpipe_t::backbuf_height, dt_dev_pixelpipe_t::backbuf_width, dt_iop_module_t::dev, dt_control_queue_redraw_center(), dt_dev_get_pointer_zoom_pos(), dt_iop_gui_enter_critical_section(), dt_iop_gui_leave_critical_section(), dt_iop_module_t::enabled, FALSE, dt_iop_module_t::gui_data, init_bounding_box(), dt_develop_t::preview_pipe, TRUE, and type.
int button_released | ( | struct dt_iop_module_t * | self, |
double | x, | ||
double | y, | ||
int | which, | ||
uint32_t | state | ||
) |
References dt_dev_pixelpipe_t::backbuf_height, dt_dev_pixelpipe_t::backbuf_width, dt_iop_module_t::dev, dt_control_queue_redraw_center(), dt_dev_get_pointer_zoom_pos(), dt_iop_gui_enter_critical_section(), dt_iop_gui_leave_critical_section(), dt_iop_module_t::enabled, FALSE, dt_iop_module_t::gui_data, dt_develop_t::preview_pipe, and update_bounding_box().
|
static |
References CCT_reverse_lookup(), DT_ADAPTATION_CAT16, dt_fast_hypotf(), DT_ILLUMINANT_BB, DT_ILLUMINANT_CUSTOM, DT_ILLUMINANT_D, DT_ILLUMINANT_FLUO_LAST, DT_ILLUMINANT_LED_LAST, illuminant_to_xy(), xy_to_CCT(), and xy_to_uv().
Referenced by _auto_set_illuminant(), _develop_ui_pipe_finished_callback(), commit_params(), commit_profile_callback(), extract_color_checker(), gui_changed(), reload_defaults(), and update_approx_cct().
|
static |
References dt_dev_pixelpipe_t::backbuf_height, dt_dev_pixelpipe_t::backbuf_width, darktable, dt_iop_module_t::dev, dt_bauhaus_combobox_get(), dt_conf_set_int(), dt_control_queue_redraw_center(), dt_get_color_checker(), dt_iop_gui_enter_critical_section(), dt_iop_gui_leave_critical_section(), FALSE, darktable_t::gui, dt_iop_module_t::gui_data, init_bounding_box(), dt_develop_t::preview_pipe, and dt_gui_gtk_t::reset.
Referenced by gui_init().
void cleanup_pipe | ( | struct dt_iop_module_t * | self, |
dt_dev_pixelpipe_t * | pipe, | ||
dt_dev_pixelpipe_iop_t * | piece | ||
) |
void color_picker_apply | ( | dt_iop_module_t * | self, |
GtkWidget * | picker, | ||
dt_dev_pixelpipe_iop_t * | piece | ||
) |
References _auto_set_illuminant(), darktable, darktable_t::gui, dt_dev_pixelpipe_iop_t::pipe, and dt_gui_gtk_t::reset.
void commit_params | ( | struct dt_iop_module_t * | self, |
dt_iop_params_t * | p1, | ||
dt_dev_pixelpipe_t * | pipe, | ||
dt_dev_pixelpipe_iop_t * | piece | ||
) |
References dt_iop_channelmixer_rbg_data_t::adaptation, dt_iop_channelmixer_rbg_data_t::apply_grey, CHANNEL_SIZE, CHANNELMIXERRGB_V_1, check_if_close_to_daylight(), dt_iop_channelmixer_rbg_data_t::clip, convert_any_XYZ_to_LMS(), dt_dev_pixelpipe_iop_t::data, dt_iop_module_t::dev, DT_DEV_PIXELPIPE_FULL, DT_DEV_PIXELPIPE_PREVIEW, DT_ILLUMINANT_CAMERA, DT_ILLUMINANT_DETECT_EDGES, DT_ILLUMINANT_DETECT_SURFACES, dt_iop_channelmixer_rbg_data_t::gamut, get_white_balance_coeff(), dt_iop_channelmixer_rbg_data_t::grey, dt_develop_t::gui_attached, dt_iop_module_t::gui_data, dt_iop_channelmixer_rbg_data_t::illuminant, illuminant_to_xy(), dt_iop_channelmixer_rbg_data_t::illuminant_type, illuminant_xy_to_XYZ(), dt_develop_t::image_storage, dt_iop_channelmixer_rbg_data_t::lightness, dt_iop_channelmixer_rbg_data_t::MIX, dt_iop_channelmixer_rbg_data_t::p, dt_dev_pixelpipe_iop_t::pipe, dt_dev_pixelpipe_iop_t::process_cl_ready, dt_iop_channelmixer_rbg_data_t::saturation, and dt_iop_channelmixer_rbg_data_t::version.
|
static |
References check_if_close_to_daylight(), darktable, darktable_t::develop, dt_bauhaus_combobox_set(), dt_bauhaus_slider_set(), dt_dev_add_history_item, DT_ILLUMINANT_CUSTOM, dt_iop_gui_enter_critical_section(), dt_iop_gui_leave_critical_section(), dt_xyY_to_Lch(), darktable_t::gui, gui_changed(), dt_iop_module_t::gui_data, M_PI, dt_iop_module_t::params, dt_gui_gtk_t::reset, and TRUE.
Referenced by gui_init().
|
inlinestatic |
References DEG_TO_RAD, dt_fast_hypotf(), dt_XYZ_to_Lab(), dt_color_checker_patch::Lab, M_PI, dt_color_checker_t::patches, RAD_TO_DEG, sqf(), and dt_color_checker_t::values.
Referenced by extract_color_checker(), and validate_color_checker().
|
static |
int default_colorspace | ( | dt_iop_module_t * | self, |
dt_dev_pixelpipe_t * | pipe, | ||
dt_dev_pixelpipe_iop_t * | piece | ||
) |
References IOP_CS_RGB.
int default_group | ( | ) |
References IOP_GROUP_COLOR.
const char ** description | ( | struct dt_iop_module_t * | self | ) |
References dt_iop_set_description().
void extract_color_checker | ( | const float *const restrict | in, |
float *const restrict | out, | ||
const dt_iop_roi_t *const | roi_in, | ||
dt_iop_channelmixer_rgb_gui_data_t * | g, | ||
const dt_colormatrix_t | RGB_to_XYZ, | ||
const dt_colormatrix_t | XYZ_to_RGB, | ||
const dt_colormatrix_t | XYZ_to_CAM, | ||
const dt_adaptation_t | kind | ||
) |
References _extract_patches(), A, extraction_result_t::black, bradford_adapt_D50(), CAT16_adapt_D50(), check_if_close_to_daylight(), compute_patches_delta_E(), convert_any_LMS_to_XYZ(), convert_any_XYZ_to_LMS(), dot_product(), downscale_vector(), DT_ADAPTATION_CAT16, DT_ADAPTATION_FULL_BRADFORD, DT_ADAPTATION_LAST, DT_ADAPTATION_LINEAR_BRADFORD, DT_ADAPTATION_RGB, DT_ADAPTATION_XYZ, dt_alloc_align, dt_alloc_sse_ps(), dt_free_align, DT_ILLUMINANT_BB, DT_ILLUMINANT_D, dt_Lab_to_XYZ(), dt_simd_memcpy(), DT_SOLVE_OPTIMIZE_AVG_DELTA_E, DT_SOLVE_OPTIMIZE_FOLIAGE, DT_SOLVE_OPTIMIZE_HIGH_SAT, DT_SOLVE_OPTIMIZE_LOW_SAT, DT_SOLVE_OPTIMIZE_MAX_DELTA_E, DT_SOLVE_OPTIMIZE_NONE, DT_SOLVE_OPTIMIZE_SKIN, DT_SOLVE_OPTIMIZE_SKY, dt_XYZ_to_xyY(), extraction_result_t::exposure, FALSE, GET_WEIGHT, dt_iop_roi_t::height, illuminant_xy_to_XYZ(), pseudo_solve_gaussian(), repack_double3x3_to_3xSSE(), TRUE, upscale_vector(), dt_iop_roi_t::width, and XYZ_adapt_D50().
Referenced by process().
int flags | ( | ) |
References IOP_FLAGS_ALLOW_TILING, IOP_FLAGS_INCLUDE_IN_STYLES, and IOP_FLAGS_SUPPORTS_BLENDING.
|
inlinestatic |
References DT_ALIGNED_PIXEL, DT_FMA, dt_uvY_to_xyY(), dt_xyY_to_uvY(), dt_xyY_to_XYZ(), NORM_MIN, and sqf().
Referenced by loop_switch().
|
static |
References dt_image_t::adobe_XYZ_to_CAM, dt_image_t::d65_color_matrix, dt_iop_module_t::dev, dt_colorspaces_conversion_matrices_rgb(), dt_image_is_matrix_correction_supported(), dt_develop_t::image_storage, dt_develop_t::proxy, and dt_develop_t::wb_coeffs.
Referenced by _auto_set_illuminant(), commit_params(), gui_changed(), illuminant_color_draw(), process(), reload_defaults(), and update_approx_cct().
void gui_changed | ( | dt_iop_module_t * | self, |
GtkWidget * | w, | ||
void * | previous | ||
) |
References _update_RGB_colors(), check_if_close_to_daylight(), darktable, declare_cat_on_pipe(), dt_iop_module_t::dev, dt_bauhaus_slider_set(), dt_control_log(), DT_ILLUMINANT_BB, DT_ILLUMINANT_CAMERA, DT_ILLUMINANT_CUSTOM, DT_ILLUMINANT_D, DT_ILLUMINANT_DETECT_EDGES, DT_ILLUMINANT_DETECT_SURFACES, dt_xyY_to_Lch(), FALSE, find_temperature_from_raw_coeffs(), get_white_balance_coeff(), darktable_t::gui, dt_iop_module_t::gui_data, illuminant_to_xy(), dt_develop_t::image_storage, M_PI, paint_hue(), paint_temperature_background(), dt_iop_module_t::params, dt_gui_gtk_t::reset, update_approx_cct(), update_illuminant_color(), and update_illuminants().
Referenced by _develop_ui_pipe_finished_callback(), commit_profile_callback(), gui_reset(), gui_update(), and reload_defaults().
void gui_cleanup | ( | struct dt_iop_module_t * | self | ) |
void gui_init | ( | struct dt_iop_module_t * | self | ) |
References _develop_ui_pipe_finished_callback(), _preview_pipe_finished_callback(), _spot_settings_changed_callback(), B, darktable_t::bauhaus, checker_changed_callback(), CHROMA_MAX, commit_profile_callback(), darktable, dt_bauhaus_combobox_from_params(), DT_BAUHAUS_COMBOBOX_NEW_FULL, dt_bauhaus_slider_from_params(), dt_bauhaus_slider_new_with_range(), dt_bauhaus_slider_new_with_range_and_feedback(), dt_bauhaus_slider_set_default(), dt_bauhaus_slider_set_digits(), dt_bauhaus_slider_set_format(), dt_bauhaus_slider_set_hard_max(), dt_bauhaus_slider_set_soft_max(), dt_bauhaus_slider_set_soft_range(), DT_BAUHAUS_SPACE, dt_bauhaus_toggle_from_params(), dt_bauhaus_widget_set_label(), DT_COLOR_PICKER_AREA, dt_color_picker_new(), dt_conf_get_int(), DT_DEBUG_CONTROL_SIGNAL_CONNECT, DT_GUI_MODULE, dt_gui_new_collapsible_section(), DT_PIXEL_APPLY_DPI, DT_SIGNAL_DEVELOP_PREVIEW_PIPE_FINISHED, DT_SIGNAL_DEVELOP_UI_PIPE_FINISHED, dt_ui_label_new(), dt_ui_notebook_new(), dt_ui_notebook_page(), dt_ui_section_label_new(), dtgtk_button_new(), dtgtk_cairo_paint_check_mark(), dtgtk_cairo_paint_refresh(), dtgtk_cairo_paint_softproof(), FALSE, dt_iop_order_iccprofile_info_t::grey, HUE_MAX, ILLUM_X_MAX, illum_xy_callback(), ILLUM_Y_MAX, illuminant_color_draw(), IOP_GUI_ALLOC, LIGHTNESS_MAX, NOTEBOOK_PAGE, optimize_changed_callback(), origin_color_draw(), dt_bauhaus_t::quad_width, R, run_profile_callback(), run_validation_callback(), safety_changed_callback(), darktable_t::signals, start_profiling_callback(), target_color_draw(), TRUE, and dt_iop_module_t::widget.
void gui_post_expose | ( | struct dt_iop_module_t * | self, |
cairo_t * | cr, | ||
int32_t | width, | ||
int32_t | height, | ||
int32_t | pointerx, | ||
int32_t | pointery | ||
) |
References apply_homography(), apply_homography_scaling(), dt_dev_pixelpipe_t::backbuf_height, dt_dev_pixelpipe_t::backbuf_width, dt_iop_module_t::dev, dt_control_get_dev_closeup(), dt_control_get_dev_zoom(), dt_control_get_dev_zoom_x(), dt_control_get_dev_zoom_y(), dt_dev_get_zoom_scale(), dt_ioppr_get_pipe_output_profile_info(), dt_ioppr_lab_to_rgb_matrix(), dt_iop_module_t::gui_data, height, dt_iop_order_iccprofile_info_t::lut_out, dt_iop_order_iccprofile_info_t::lutsize, M_PI, dt_iop_order_iccprofile_info_t::matrix_out_transposed, dt_iop_order_iccprofile_info_t::nonlinearlut, dt_develop_t::pipe, dt_develop_t::preview_pipe, width, point_t::x, and point_t::y.
void gui_reset | ( | dt_iop_module_t * | self | ) |
References dt_iop_color_picker_reset(), FALSE, gui_changed(), dt_iop_module_t::gui_data, and TRUE.
void gui_update | ( | struct dt_iop_module_t * | self | ) |
References CHANNELMIXERRGB_V_3, dt_bauhaus_combobox_set(), dt_bauhaus_slider_set(), dt_conf_get_bool(), dt_conf_get_float(), dt_conf_get_int(), dt_conf_key_exists(), dt_get_color_checker(), dt_gui_hide_collapsible_section(), dt_gui_update_collapsible_section(), dt_iop_color_picker_reset(), dt_iop_gui_enter_critical_section(), dt_iop_gui_leave_critical_section(), DT_SPOT_MODE_CORRECT, FALSE, gui_changed(), dt_iop_module_t::gui_data, and TRUE.
|
static |
References CCT_reverse_lookup(), darktable, darktable_t::develop, dt_bauhaus_slider_get(), dt_bauhaus_slider_set(), dt_dev_add_history_item, dt_Lch_to_xyY(), darktable_t::gui, dt_iop_module_t::gui_data, M_PI, paint_temperature_background(), dt_iop_module_t::params, dt_gui_gtk_t::reset, TRUE, update_approx_cct(), update_illuminant_color(), and xy_to_CCT().
Referenced by gui_init().
|
static |
void init | ( | dt_iop_module_t * | module | ) |
|
inlinestatic |
References TRUE, update_bounding_box(), and width.
Referenced by button_pressed(), checker_changed_callback(), and start_profiling_callback().
void init_pipe | ( | struct dt_iop_module_t * | self, |
dt_dev_pixelpipe_t * | pipe, | ||
dt_dev_pixelpipe_iop_t * | piece | ||
) |
References dt_dev_pixelpipe_iop_t::data, dt_dev_pixelpipe_iop_t::data_size, and dt_calloc_align().
void init_presets | ( | dt_iop_module_so_t * | self | ) |
References CHANNELMIXERRGB_V_3, DEVELOP_BLEND_CS_RGB_SCENE, DT_ADAPTATION_RGB, DT_ADAPTATION_XYZ, dt_gui_presets_add_generic(), DT_ILLUMINANT_FLUO_F3, DT_ILLUMINANT_FLUO_LAST, DT_ILLUMINANT_LED_B5, DT_ILLUMINANT_LED_LAST, DT_ILLUMINANT_PIPE, FALSE, illuminant_to_xy(), dt_iop_module_so_t::op, and TRUE.
int legacy_params | ( | dt_iop_module_t * | self, |
const void *const | old_params, | ||
const int | old_version, | ||
void * | new_params, | ||
const int | new_version | ||
) |
|
inlinestatic |
References bradford_adapt_D50(), CAT16_adapt_D50(), convert_any_LMS_to_XYZ(), convert_any_XYZ_to_LMS(), convert_bradford_LMS_to_XYZ(), convert_CAT16_LMS_to_XYZ(), convert_XYZ_to_bradford_LMS(), convert_XYZ_to_CAT16_LMS(), dot_product(), downscale_vector(), DT_ADAPTATION_CAT16, DT_ADAPTATION_FULL_BRADFORD, DT_ADAPTATION_LAST, DT_ADAPTATION_LINEAR_BRADFORD, DT_ADAPTATION_RGB, DT_ADAPTATION_XYZ, DT_PIXEL_SIMD_CHANNELS, FALSE, gamut_mapping(), height, luma_chroma(), scalar_product(), TRUE, upscale_vector(), width, and XYZ_adapt_D50().
Referenced by process().
|
inlinestatic |
References CHANNELMIXERRGB_V_1, CHANNELMIXERRGB_V_3, DT_FMA, euclidean_norm(), INVERSE_SQRT_3, mix(), NORM_MIN, scalar_product(), and sqf().
Referenced by loop_switch().
int mouse_moved | ( | struct dt_iop_module_t * | self, |
double | x, | ||
double | y, | ||
double | pressure, | ||
int | which | ||
) |
References dt_dev_pixelpipe_t::backbuf_height, dt_dev_pixelpipe_t::backbuf_width, darktable, dt_iop_module_t::dev, dt_control_change_cursor(), dt_control_queue_redraw_center(), dt_dev_get_pointer_zoom_pos(), dt_iop_gui_enter_critical_section(), dt_iop_gui_leave_critical_section(), dt_ui_main_window(), dt_iop_module_t::enabled, FALSE, darktable_t::gui, dt_iop_module_t::gui_data, dt_develop_t::preview_pipe, TRUE, dt_gui_gtk_t::ui, and update_bounding_box().
const char * name | ( | ) |
|
static |
|
static |
References dt_cairo_image_surface_create(), DT_PIXEL_APPLY_DPI, dt_iop_module_t::gui_data, height, INNER_PADDING, INTERNAL_PADDING, TRUE, and width.
Referenced by gui_init().
|
static |
References CHROMA_MAX, dt_bauhaus_slider_get(), DT_BAUHAUS_SLIDER_MAX_STOPS, dt_bauhaus_slider_set_stop(), dt_Lab_to_XYZ(), dt_LCH_2_Lab(), dt_XYZ_to_sRGB(), dt_iop_module_t::gui_data, HUE_MAX, Lab(), and LIGHTNESS_MAX.
Referenced by _auto_set_illuminant(), _spot_settings_changed_callback(), and gui_changed().
|
static |
void process | ( | struct dt_iop_module_t * | self, |
dt_dev_pixelpipe_iop_t * | piece, | ||
const void *const restrict | ivoid, | ||
void *const restrict | ovoid, | ||
const dt_iop_roi_t *const | roi_in, | ||
const dt_iop_roi_t *const | roi_out | ||
) |
References dt_iop_channelmixer_rbg_data_t::adaptation, dt_iop_channelmixer_rbg_data_t::apply_grey, auto_detect_WB(), dt_iop_channelmixer_rbg_data_t::clip, dt_dev_pixelpipe_iop_t::colors, convert_any_XYZ_to_LMS(), dt_dev_pixelpipe_iop_t::data, declare_cat_on_pipe(), dt_iop_module_t::dev, DT_ADAPTATION_CAT16, DT_ADAPTATION_FULL_BRADFORD, DT_ADAPTATION_LAST, DT_ADAPTATION_LINEAR_BRADFORD, DT_ADAPTATION_RGB, DT_ADAPTATION_XYZ, dt_control_log(), DT_DEV_PIXELPIPE_FULL, DT_DEV_PIXELPIPE_PREVIEW, DT_ILLUMINANT_CAMERA, DT_ILLUMINANT_DETECT_EDGES, DT_ILLUMINANT_DETECT_SURFACES, dt_iop_gui_enter_critical_section(), dt_iop_gui_leave_critical_section(), dt_iop_have_required_input_format(), dt_iop_image_copy_by_size(), dt_iop_set_cache_bypass(), dt_ioppr_get_pipe_current_profile_info(), dt_ioppr_get_pipe_input_profile_info(), extract_color_checker(), FALSE, find_temperature_from_raw_coeffs(), dt_iop_channelmixer_rbg_data_t::gamut, get_white_balance_coeff(), dt_iop_channelmixer_rbg_data_t::grey, dt_develop_t::gui_attached, dt_iop_module_t::gui_data, dt_iop_roi_t::height, dt_iop_channelmixer_rbg_data_t::illuminant, dt_iop_channelmixer_rbg_data_t::illuminant_type, illuminant_xy_to_XYZ(), dt_develop_t::image_storage, dt_iop_channelmixer_rbg_data_t::lightness, loop_switch(), dt_iop_order_iccprofile_info_t::matrix_in, dt_iop_order_iccprofile_info_t::matrix_out, dt_iop_channelmixer_rbg_data_t::MIX, dt_iop_channelmixer_rbg_data_t::p, dt_dev_pixelpipe_iop_t::pipe, dt_iop_channelmixer_rbg_data_t::saturation, TRUE, validate_color_checker(), dt_iop_channelmixer_rbg_data_t::version, and dt_iop_roi_t::width.
void reload_defaults | ( | dt_iop_module_t * | module | ) |
References dt_iop_channelmixer_rgb_params_t::adaptation, check_if_close_to_daylight(), declare_cat_on_pipe(), dt_iop_module_t::default_params, DT_ADAPTATION_RGB, dt_bauhaus_combobox_add_full(), DT_BAUHAUS_COMBOBOX_ALIGN_RIGHT, dt_bauhaus_combobox_length(), dt_bauhaus_combobox_remove_at(), dt_bauhaus_combobox_set_default(), dt_bauhaus_slider_set_default(), dt_conf_is_equal(), DT_ILLUMINANT_CAMERA, DT_ILLUMINANT_PIPE, dt_image_is_matrix_correction_supported(), dt_image_is_monochrome(), dt_xyY_to_Lch(), find_temperature_from_raw_coeffs(), get_white_balance_coeff(), gui_changed(), dt_iop_module_t::gui_data, dt_iop_channelmixer_rgb_params_t::illuminant, M_PI, dt_iop_channelmixer_rgb_params_t::temperature, TRUE, dt_iop_channelmixer_rgb_params_t::x, and dt_iop_channelmixer_rgb_params_t::y.
|
static |
References darktable, dt_iop_module_t::dev, dt_dev_pixelpipe_resync_preview(), dt_dev_refresh_ui_images, dt_iop_gui_enter_critical_section(), dt_iop_gui_leave_critical_section(), dt_iop_set_cache_bypass(), darktable_t::gui, dt_iop_module_t::gui_data, dt_gui_gtk_t::reset, and TRUE.
Referenced by gui_init().
|
static |
References darktable, dt_iop_module_t::dev, dt_dev_pixelpipe_resync_preview(), dt_dev_refresh_ui_images, dt_iop_gui_enter_critical_section(), dt_iop_gui_leave_critical_section(), dt_iop_set_cache_bypass(), darktable_t::gui, dt_iop_module_t::gui_data, dt_gui_gtk_t::reset, and TRUE.
Referenced by gui_init().
|
static |
|
static |
References dt_dev_pixelpipe_t::backbuf_height, dt_dev_pixelpipe_t::backbuf_width, darktable, dt_iop_module_t::dev, dt_control_queue_redraw_center(), dt_iop_gui_enter_critical_section(), dt_iop_gui_leave_critical_section(), dt_iop_request_focus(), darktable_t::gui, dt_iop_module_t::gui_data, init_bounding_box(), dt_iop_module_t::off, dt_develop_t::preview_pipe, dt_gui_gtk_t::reset, and TRUE.
Referenced by gui_init().
|
static |
References dt_bauhaus_slider_get(), dt_cairo_image_surface_create(), dt_Lab_to_XYZ(), dt_LCH_2_Lab(), DT_PIXEL_APPLY_DPI, dt_XYZ_to_sRGB(), dt_iop_module_t::gui_data, height, INNER_PADDING, INTERNAL_PADDING, Lab(), TRUE, and width.
Referenced by gui_init().
|
static |
References check_if_close_to_daylight(), dt_iop_module_t::dev, DT_ILLUMINANT_BB, DT_ILLUMINANT_D, get_white_balance_coeff(), dt_iop_module_t::gui_data, illuminant_to_xy(), dt_develop_t::image_storage, and dt_iop_module_t::params.
Referenced by _auto_set_illuminant(), _develop_ui_pipe_finished_callback(), gui_changed(), and illum_xy_callback().
|
inlinestatic |
References get_homography().
Referenced by button_released(), init_bounding_box(), and mouse_moved().
|
static |
References dt_iop_module_t::gui_data, and update_xy_color().
Referenced by _auto_set_illuminant(), _develop_ui_pipe_finished_callback(), gui_changed(), and illum_xy_callback().
|
static |
References DT_ADAPTATION_LAST, DT_ADAPTATION_RGB, DT_ILLUMINANT_A, DT_ILLUMINANT_BB, DT_ILLUMINANT_CAMERA, DT_ILLUMINANT_CUSTOM, DT_ILLUMINANT_D, DT_ILLUMINANT_DETECT_EDGES, DT_ILLUMINANT_DETECT_SURFACES, DT_ILLUMINANT_E, DT_ILLUMINANT_F, DT_ILLUMINANT_LAST, DT_ILLUMINANT_LED, DT_ILLUMINANT_PIPE, FALSE, dt_iop_module_t::gui_data, dt_iop_module_t::params, and TRUE.
Referenced by _auto_set_illuminant(), _develop_ui_pipe_finished_callback(), and gui_changed().
|
static |
DOCUMENTATION
The illuminant is stored in params as a set of x and y coordinates, describing its chrominance in xyY color space. xyY is a normalized XYZ space, derivated from the retina cone sensors. By definition, for an illuminant, Y = 1, so we only really care about (x, y).
Using (x, y) is a robust and interoperable way to describe an illuminant, since it is all the actual pixel code needs to perform the chromatic adaptation. This (x, y) can be computed in many different ways or taken from databases, and possibly from other software, so storing only the result let us room to improve the computation in the future, without losing compatibility with older versions.
However, it's not a great GUI since x and y are not perceptually scaled. So the g->illum_x
and g->illum_y
actually display respectively hue and chroma, in LCh color space, which is designed for illuminants and preceptually spaced. This gives UI controls which effect feels more even to the user.
But that makes things a bit tricky, API-wise, since a set of (x, y) depends on a set of (hue, chroma), so they always need to be handled together, but also because the back-and-forth computations Lch <-> xyY need to be done anytime we read or write from/to params from/to GUI.
Also, the R, G, B sliders have a background color gradient that shows the actual R, G, B sensors used by the selected chromatic adaptation. Each chromatic adaptation method uses a different RGB space, called LMS in the literature (but it's only a special-purpose RGB space for all we care here), which primaries are projected to sRGB colors, to be displayed in the GUI, so users may get a feeling of what colors they will get.
References DT_BAUHAUS_SLIDER_MAX_STOPS, dt_bauhaus_slider_set_stop(), dt_Lch_to_xyY(), dt_xyY_to_Lch(), dt_iop_module_t::gui_data, ILLUM_X_MAX, ILLUM_Y_MAX, illuminant_xy_to_RGB(), M_PI, and dt_iop_module_t::params.
Referenced by update_illuminant_color().
void validate_color_checker | ( | const float *const restrict | in, |
const dt_iop_roi_t *const | roi_in, | ||
dt_iop_channelmixer_rgb_gui_data_t * | g, | ||
const dt_colormatrix_t | RGB_to_XYZ, | ||
const dt_colormatrix_t | XYZ_to_RGB, | ||
const dt_colormatrix_t | XYZ_to_CAM | ||
) |
References _extract_patches(), extraction_result_t::black, compute_patches_delta_E(), dt_alloc_sse_ps(), dt_free_align, extraction_result_t::exposure, and FALSE.
Referenced by process().