![]() |
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>
Include dependency graph for channelmixerrgb.c: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, const dt_dev_pixelpipe_iop_t *piece) |
| void | input_format (dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece, dt_iop_buffer_dsc_t *dsc) |
| 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 | __attribute__ ((always_inline)) |
| 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 int | 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 int | _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, extraction_result_t *result) |
| int | 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) |
| int | 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) |
| int | process (struct dt_iop_module_t *self, const dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece, const void *const restrict ivoid, void *const restrict ovoid) |
| 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_t *pipe, 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 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 |
|
inlinestatic |
| void _auto_set_illuminant | ( | dt_iop_module_t * | self, |
| dt_dev_pixelpipe_t * | pipe | ||
| ) |
References adaptation, c, check_if_close_to_daylight(), convert_D50_to_LMS(), darktable, dt_iop_module_t::dev, 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_DEBUG_DEV, dt_gui_throttle_queue(), DT_ILLUMINANT_CAMERA, DT_ILLUMINANT_CUSTOM, dt_iop_gui_enter_critical_section(), dt_iop_gui_leave_critical_section(), dt_iop_throttled_history_update(), dt_ioppr_get_pipe_current_profile_info(), dt_Lab_to_XYZ(), dt_load_simd_aligned(), dt_print(), DT_SPOT_MODE_CORRECT, DT_SPOT_MODE_MEASURE, dt_store_simd_aligned(), dt_XYZ_to_Lab(), dt_XYZ_to_sRGB(), g, get_white_balance_coeff(), darktable_t::gui, dt_iop_module_t::gui_data, i, illuminant_to_xy(), illuminant_xy_to_XYZ(), dt_develop_t::image_storage, Lab, Lch, LMS, M_PI, matrice_pseudoinverse(), dt_iop_order_iccprofile_info_t::matrix_in, NORM_MIN, p, 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, RGB, transpose_3x3_to_3xSSE(), update_approx_cct(), update_illuminant_color(), update_illuminants(), x, xyY, and XYZ.
Referenced by _spot_settings_changed_callback(), and color_picker_apply().
|
static |
References c, DT_ADAPTATION_RGB, dt_ioppr_rgb_matrix_to_xyz(), LMS, dt_iop_order_iccprofile_info_t::lut_in, dt_iop_order_iccprofile_info_t::lutsize, dt_iop_order_iccprofile_info_t::matrix_in_transposed, dt_iop_order_iccprofile_info_t::nonlinearlut, p, RGB, and XYZ.
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_DEBUG_DEV, 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_print(), g, darktable_t::gui, gui_changed(), dt_iop_module_t::gui_data, Lch, M_PI, p, paint_temperature_background(), dt_iop_module_t::params, dt_gui_gtk_t::reset, TRUE, update_approx_cct(), update_illuminant_color(), update_illuminants(), and xyY.
Referenced by gui_cleanup(), and gui_init().
|
static |
References apply_homography(), extraction_result_t::black, c, dot_product(), dt_alloc_align_float(), dt_Lab_to_XYZ(), euclidean_norm(), extraction_result_t::exposure, g, height, dt_iop_roi_t::height, i, sqf(), width, dt_iop_roi_t::width, point_t::x, x, XYZ, and point_t::y.
Referenced by extract_color_checker(), and validate_color_checker().
|
inlinestatic |
References dt_develop_t::chroma_adaptation, dt_iop_module_t::dev, FALSE, g, dt_iop_module_t::gui_data, and dt_develop_t::proxy.
|
static |
References dt_iop_gui_enter_critical_section(), dt_iop_gui_leave_critical_section(), g, and dt_iop_module_t::gui_data.
Referenced by gui_cleanup(), and gui_init().
|
static |
References _auto_set_illuminant(), darktable, dt_iop_module_t::dev, dt_bauhaus_combobox_get(), dt_bauhaus_slider_get(), dt_conf_set_bool(), dt_conf_set_float(), dt_iop_color_picker_is_active_module(), dt_iop_gui_enter_critical_section(), dt_iop_gui_leave_critical_section(), DT_SPOT_MODE_CORRECT, g, 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 |
References _update_RGB_slider_stop(), a, b, c, COLOR_MAX, COLOR_MIN, dt_iop_module_t::dev, DT_BAUHAUS_SLIDER_MAX_STOPS, dt_ioppr_get_pipe_output_profile_info(), g, i, normalize(), p, dt_iop_module_t::params, dt_develop_t::pipe, r, RGB, and x.
Referenced by gui_changed().
|
static |
References _convert_GUI_colors(), b, c, dt_bauhaus_slider_set_stop(), g, LMS, p, and r.
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 c, dot_product(), DT_ALIGNED_PIXEL, dt_fast_hypotf(), DT_ILLUMINANT_DETECT_EDGES, DT_ILLUMINANT_DETECT_SURFACES, dt_pixelpipe_cache_alloc_align_float_cache, dt_pixelpipe_cache_free_align, for_each_channel, height, i, illuminant, NORM_MIN, OFF, p, RGB, SHF, sqf(), weight(), width, xyY, and XYZ.
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_iop_module_t::dev, dt_control_queue_redraw_center(), dt_dev_coordinates_image_norm_to_preview_abs(), dt_dev_coordinates_widget_to_image_norm(), dt_iop_gui_enter_critical_section(), dt_iop_gui_leave_critical_section(), dt_iop_module_t::enabled, FALSE, g, dt_iop_module_t::gui_data, init_bounding_box(), dt_develop_t::preview_height, dt_develop_t::preview_width, dt_develop_t::roi, TRUE, type, and x.
| int button_released | ( | struct dt_iop_module_t * | self, |
| double | x, | ||
| double | y, | ||
| int | which, | ||
| uint32_t | state | ||
| ) |
References dt_iop_module_t::dev, dt_control_queue_redraw_center(), dt_dev_coordinates_image_norm_to_preview_abs(), dt_dev_coordinates_widget_to_image_norm(), dt_iop_gui_enter_critical_section(), dt_iop_gui_leave_critical_section(), dt_iop_module_t::enabled, FALSE, g, dt_iop_module_t::gui_data, dt_develop_t::preview_height, dt_develop_t::preview_width, dt_develop_t::roi, update_bounding_box(), and x.
|
static |
References adaptation, 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, illuminant_to_xy(), t, x, 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().
References 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, g, darktable_t::gui, dt_iop_module_t::gui_data, i, init_bounding_box(), dt_develop_t::preview_height, dt_develop_t::preview_width, dt_gui_gtk_t::reset, and dt_develop_t::roi.
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_t * | pipe, | ||
| dt_dev_pixelpipe_iop_t * | piece | ||
| ) |
References _auto_set_illuminant(), darktable, DT_DEBUG_DEV, dt_print(), darktable_t::gui, 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 CHANNEL_SIZE, CHANNELMIXERRGB_V_1, check_if_close_to_daylight(), d, 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_load_simd_aligned(), dt_store_simd_aligned(), g, get_white_balance_coeff(), dt_develop_t::gui_attached, dt_iop_module_t::gui_data, i, illuminant_to_xy(), illuminant_xy_to_XYZ(), dt_develop_t::image_storage, p, dt_dev_pixelpipe_iop_t::process_cl_ready, dt_dev_pixelpipe_t::type, x, and XYZ.
|
static |
References check_if_close_to_daylight(), darktable, darktable_t::develop, dt_bauhaus_combobox_set(), dt_bauhaus_slider_set(), DT_DEBUG_DEV, dt_dev_add_history_item, DT_ILLUMINANT_CUSTOM, dt_iop_gui_enter_critical_section(), dt_iop_gui_leave_critical_section(), dt_print(), g, darktable_t::gui, gui_changed(), dt_iop_module_t::gui_data, Lch, M_PI, p, dt_iop_module_t::params, dt_gui_gtk_t::reset, TRUE, and xyY.
Referenced by gui_init().
|
inlinestatic |
References c, 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 |
References dt_develop_t::chroma_adaptation, dt_iop_module_t::dev, DT_ADAPTATION_RGB, DT_ILLUMINANT_PIPE, dt_iop_is_first_instance(), dt_iop_module_t::enabled, dt_develop_t::iop, p, dt_iop_module_t::params, preset, and dt_develop_t::proxy.
Referenced by gui_changed(), process(), and reload_defaults().
| int default_colorspace | ( | dt_iop_module_t * | self, |
| dt_dev_pixelpipe_t * | pipe, | ||
| const 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().
| int 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(), c, CAT16_adapt_D50(), check_if_close_to_daylight(), compute_patches_delta_E(), 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_align_float(), dt_free, dt_free_align, DT_ILLUMINANT_BB, DT_ILLUMINANT_D, dt_Lab_to_XYZ(), dt_load_simd_aligned(), 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_store_simd_aligned(), dt_XYZ_to_xyY(), extraction_result_t::exposure, FALSE, g, GET_WEIGHT, dt_iop_roi_t::height, illuminant, illuminant_xy_to_XYZ(), kind, LMS, out, p, pseudo_solve_gaussian(), repack_double3x3_to_3xSSE(), TRUE, upscale_vector(), dt_iop_roi_t::width, x, and XYZ_adapt_D50().
Referenced by process().
| int flags | ( | ) |
References IOP_FLAGS_ALLOW_TILING, IOP_FLAGS_INCLUDE_IN_STYLES, and IOP_FLAGS_SUPPORTS_BLENDING.
|
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, FALSE, find_temperature_from_raw_coeffs(), g, get_white_balance_coeff(), darktable_t::gui, dt_iop_module_t::gui_data, illuminant_to_xy(), dt_develop_t::image_storage, Lch, M_PI, p, paint_hue(), paint_temperature_background(), dt_iop_module_t::params, dt_gui_gtk_t::reset, update_approx_cct(), update_illuminant_color(), update_illuminants(), and xyY.
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 | ) |
References _develop_ui_pipe_finished_callback(), _preview_pipe_finished_callback(), darktable, dt_conf_set_int(), DT_DEBUG_CONTROL_SIGNAL_DISCONNECT, dt_free, dt_free_align, DT_REQUEST_COLORPICK_OFF, g, dt_iop_module_t::gui_data, IOP_GUI_FREE, dt_iop_module_t::request_color_pick, and darktable_t::signals.
| 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, g, 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(), c, dt_iop_module_t::dev, dt_dev_get_overlay_scale(), dt_dev_rescale_roi(), dt_ioppr_get_pipe_output_profile_info(), dt_ioppr_lab_to_rgb_matrix(), g, 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, RGB, scaling, top, width, point_t::x, x, and point_t::y.
| void gui_reset | ( | dt_iop_module_t * | self | ) |
References dt_iop_color_picker_reset(), FALSE, g, gui_changed(), dt_iop_module_t::gui_data, and TRUE.
| void gui_update | ( | struct dt_iop_module_t * | self | ) |
References CHANNELMIXERRGB_V_3, darktable, 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, g, darktable_t::gui, gui_changed(), dt_iop_module_t::gui_data, i, p, dt_gui_gtk_t::reset, and TRUE.
References CCT_reverse_lookup(), darktable, darktable_t::develop, dt_bauhaus_slider_get(), dt_bauhaus_slider_set(), DT_DEBUG_DEV, dt_dev_add_history_item, dt_print(), g, darktable_t::gui, dt_iop_module_t::gui_data, Lch, M_PI, p, paint_temperature_background(), dt_iop_module_t::params, dt_gui_gtk_t::reset, t, TRUE, update_approx_cct(), update_illuminant_color(), xy_to_CCT(), and xyY.
Referenced by gui_init().
|
static |
References dt_iop_module_t::dev, dt_cairo_image_surface_create(), DT_PIXEL_APPLY_DPI, get_white_balance_coeff(), height, illuminant_to_xy(), illuminant_xy_to_RGB(), dt_develop_t::image_storage, INNER_PADDING, INTERNAL_PADDING, p, dt_iop_module_t::params, RGB, TRUE, width, and x.
Referenced by gui_init().
| void init | ( | dt_iop_module_t * | module | ) |
References d, dt_iop_module_t::default_params, and dt_iop_default_init().
|
inlinestatic |
References g, 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, p, and TRUE.
| void input_format | ( | dt_iop_module_t * | self, |
| dt_dev_pixelpipe_t * | pipe, | ||
| dt_dev_pixelpipe_iop_t * | piece, | ||
| dt_iop_buffer_dsc_t * | dsc | ||
| ) |
| 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_bradford_LMS_to_XYZ(), convert_CAT16_LMS_to_XYZ(), convert_XYZ_to_bradford_LMS(), convert_XYZ_to_CAT16_LMS(), DT_ADAPTATION_CAT16, DT_ADAPTATION_FULL_BRADFORD, DT_ADAPTATION_LAST, DT_ADAPTATION_LINEAR_BRADFORD, DT_ADAPTATION_RGB, DT_ADAPTATION_XYZ, dt_load_simd_aligned(), dt_omploop_sfence, dt_store_simd_aligned(), FALSE, height, illuminant, kind, luma_chroma(), out, p, transpose_3xSSE(), TRUE, width, and XYZ_adapt_D50().
Referenced by process().
|
inlinestatic |
References c, 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 darktable, dt_iop_module_t::dev, dt_control_queue_redraw_center(), dt_control_set_cursor(), dt_dev_coordinates_image_norm_to_preview_abs(), dt_dev_coordinates_widget_to_image_norm(), dt_iop_gui_enter_critical_section(), dt_iop_gui_leave_critical_section(), dt_ui_main_window(), dt_iop_module_t::enabled, FALSE, g, darktable_t::gui, dt_iop_module_t::gui_data, dt_develop_t::preview_height, dt_develop_t::preview_width, dt_develop_t::roi, TRUE, dt_gui_gtk_t::ui, update_bounding_box(), and x.
| const char * name | ( | ) |
References darktable, dt_bauhaus_combobox_get(), dt_conf_set_int(), dt_iop_gui_enter_critical_section(), dt_iop_gui_leave_critical_section(), g, darktable_t::gui, dt_iop_module_t::gui_data, i, and dt_gui_gtk_t::reset.
Referenced by gui_init().
|
static |
References dt_cairo_image_surface_create(), DT_PIXEL_APPLY_DPI, g, 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_XYZ_to_sRGB(), g, dt_iop_module_t::gui_data, HUE_MAX, i, Lab, LIGHTNESS_MAX, RGB, and XYZ.
Referenced by _auto_set_illuminant(), _spot_settings_changed_callback(), and gui_changed().
|
static |
References DT_BAUHAUS_SLIDER_MAX_STOPS, dt_bauhaus_slider_set_stop(), g, dt_iop_module_t::gui_data, i, illuminant_CCT_to_RGB(), RGB, t, TEMP_MAX, and TEMP_MIN.
Referenced by _auto_set_illuminant(), _develop_ui_pipe_finished_callback(), gui_changed(), and illum_xy_callback().
| int process | ( | struct dt_iop_module_t * | self, |
| const dt_dev_pixelpipe_t * | pipe, | ||
| const dt_dev_pixelpipe_iop_t * | piece, | ||
| const void *const restrict | ivoid, | ||
| void *const restrict | ovoid | ||
| ) |
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::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_image_copy_by_size(), dt_iop_set_cache_bypass(), dt_ioppr_get_pipe_current_profile_info(), dt_ioppr_get_pipe_input_profile_info(), dt_load_simd_aligned(), dt_store_simd_aligned(), extract_color_checker(), FALSE, find_temperature_from_raw_coeffs(), g, 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, out, dt_iop_channelmixer_rbg_data_t::p, dt_dev_pixelpipe_iop_t::roi_in, dt_dev_pixelpipe_iop_t::roi_out, dt_iop_channelmixer_rbg_data_t::saturation, TRUE, dt_dev_pixelpipe_t::type, validate_color_checker(), dt_iop_channelmixer_rbg_data_t::version, dt_iop_roi_t::width, x, and XYZ.
| void reload_defaults | ( | dt_iop_module_t * | module | ) |
References check_if_close_to_daylight(), d, 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_free, DT_ILLUMINANT_CAMERA, DT_ILLUMINANT_PIPE, dt_image_is_matrix_correction_supported(), dt_image_is_monochrome(), find_temperature_from_raw_coeffs(), g, get_white_balance_coeff(), gui_changed(), dt_iop_module_t::gui_data, Lch, M_PI, TRUE, and xyY.
|
static |
References 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(), g, darktable_t::gui, dt_iop_module_t::gui_data, init_bounding_box(), dt_iop_module_t::off, dt_develop_t::preview_height, dt_develop_t::preview_width, dt_gui_gtk_t::reset, dt_develop_t::roi, and TRUE.
Referenced by gui_init().
|
static |
References dt_bauhaus_slider_get(), dt_cairo_image_surface_create(), dt_Lab_to_XYZ(), DT_PIXEL_APPLY_DPI, dt_XYZ_to_sRGB(), g, dt_iop_module_t::gui_data, height, INNER_PADDING, INTERNAL_PADDING, Lab, Lch, RGB, TRUE, width, and XYZ.
Referenced by gui_init().
|
static |
References check_if_close_to_daylight(), dt_iop_module_t::dev, dt_free, DT_ILLUMINANT_BB, DT_ILLUMINANT_D, g, get_white_balance_coeff(), dt_iop_module_t::gui_data, illuminant_to_xy(), dt_develop_t::image_storage, p, dt_iop_module_t::params, t, and x.
Referenced by _auto_set_illuminant(), _develop_ui_pipe_finished_callback(), gui_changed(), and illum_xy_callback().
|
inlinestatic |
References g, and get_homography().
Referenced by button_released(), init_bounding_box(), and mouse_moved().
|
static |
References g, 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, g, dt_iop_module_t::gui_data, p, 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(), g, dt_iop_module_t::gui_data, i, ILLUM_X_MAX, ILLUM_Y_MAX, illuminant_xy_to_RGB(), Lch, M_PI, p, dt_iop_module_t::params, RGB, x, and xyY.
Referenced by update_illuminant_color().
| int 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_align_float(), dt_free, dt_free_align, extraction_result_t::exposure, FALSE, and g.
Referenced by process().