![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
#include "bauhaus/bauhaus.h"
#include "common/exif.h"
#include "common/colorspaces_inline_conversions.h"
#include "common/opencl.h"
#include "develop/blend.h"
#include "develop/imageop.h"
#include "develop/imageop_math.h"
#include "develop/imageop_gui.h"
#include "dtgtk/gradientslider.h"
#include "gui/gtk.h"
#include "gui/presets.h"
#include "gui/color_picker_proxy.h"
#include "iop/iop_api.h"
#include <stdlib.h>
Data Structures | |
struct | dt_iop_colorbalance_params_t |
struct | dt_iop_colorbalance_gui_data_t |
struct | dt_iop_colorbalance_data_t |
struct | dt_iop_colorbalance_global_data_t |
Macros | |
#define | HSL_CALLBACK(which) |
#define | ADD_CHANNEL(which, section, c, n, N, text, span) |
#define | ADD_BLOCK(blk, which, section, text, span, satspan) |
Typedefs | |
typedef enum dt_iop_colorbalance_mode_t | dt_iop_colorbalance_mode_t |
typedef enum _colorbalance_channel_t | _colorbalance_channel_t |
typedef enum _colorbalance_levels_t | _colorbalance_levels_t |
typedef enum _controls_t | _controls_t |
typedef enum _colorbalance_patch_t | _colorbalance_patch_t |
typedef struct dt_iop_colorbalance_params_t | dt_iop_colorbalance_params_t |
typedef struct dt_iop_colorbalance_gui_data_t | dt_iop_colorbalance_gui_data_t |
typedef struct dt_iop_colorbalance_data_t | dt_iop_colorbalance_data_t |
typedef struct dt_iop_colorbalance_global_data_t | dt_iop_colorbalance_global_data_t |
Enumerations | |
enum | dt_iop_colorbalance_mode_t { LIFT_GAMMA_GAIN = 0 , SLOPE_OFFSET_POWER = 1 , LEGACY = 2 } |
enum | _colorbalance_channel_t { CHANNEL_FACTOR = 0 , CHANNEL_RED , CHANNEL_GREEN , CHANNEL_BLUE , CHANNEL_SIZE } |
enum | _colorbalance_levels_t { LIFT = 0 , GAMMA , GAIN , LEVELS } |
enum | _controls_t { HSL , RGBL , BOTH } |
enum | _colorbalance_patch_t { INVALID , USER_SELECTED , AUTO_SELECTED } |
#define ADD_BLOCK | ( | blk, | |
which, | |||
section, | |||
text, | |||
span, | |||
satspan | |||
) |
#define ADD_CHANNEL | ( | which, | |
section, | |||
c, | |||
n, | |||
N, | |||
text, | |||
span | |||
) |
#define HSL_CALLBACK | ( | which | ) |
typedef enum _colorbalance_channel_t _colorbalance_channel_t |
typedef enum _colorbalance_levels_t _colorbalance_levels_t |
typedef enum _colorbalance_patch_t _colorbalance_patch_t |
typedef enum _controls_t _controls_t |
typedef struct dt_iop_colorbalance_data_t dt_iop_colorbalance_data_t |
typedef struct dt_iop_colorbalance_gui_data_t dt_iop_colorbalance_gui_data_t |
typedef enum dt_iop_colorbalance_mode_t dt_iop_colorbalance_mode_t |
typedef struct dt_iop_colorbalance_params_t dt_iop_colorbalance_params_t |
enum _controls_t |
|
inlinestatic |
References dt_bauhaus_widget_set_label(), GAIN, GAMMA, dt_iop_module_t::gui_data, LIFT, and USER_SELECTED.
Referenced by color_picker_apply(), gui_reset(), and gui_update().
|
static |
References DT_BAUHAUS_SPACE, dt_conf_get_string(), dt_ui_section_label_new(), and dt_iop_module_t::gui_data.
Referenced by _cycle_layout_callback(), gui_changed(), gui_cleanup(), and gui_init().
|
static |
References _configure_slider_blocks().
Referenced by gui_init().
|
static |
References dt_develop_blend_legacy_params_from_so(), dt_develop_blend_version(), dt_exif_xmp_decode(), dt_gui_presets_add_with_blendop(), name(), and dt_iop_module_so_t::op.
Referenced by init_presets().
const char * aliases | ( | ) |
|
static |
Optimization loop : We try to find the CDL curves that neutralize the 3 input color patches, while not affecting the overall lightness. But this is a non-linear overconstrained problem with tainted inputs, so the best we can do is a numerical optimization. To do so, we compute each parameter of each RGB curve from the input color and the 2 other parameters. Then, we loop over the previous optimization until the difference between 2 updates is insignificant. This would need a proper stopping criterion based on convergence analysis, but it would be overkill here since it should converge usually in 20 iterations, and maximum in 100. Also, the convergence has not been proven formally. For better color accuracy, we compute on luminance corrected RGB values (after the main factors corrections). To avoid divergence, we constrain the parameters between +- 0.25 around the neutral value. Experimentally, nothing good happens out of these bounds.
References AUTO_SELECTED, CDL(), CHANNEL_BLUE, CHANNEL_FACTOR, CHANNEL_GREEN, CHANNEL_RED, darktable, darktable_t::develop, dt_bauhaus_slider_set(), dt_dev_add_history_item, dt_iop_color_picker_reset(), dt_Lab_to_XYZ(), dt_prophotorgb_to_XYZ(), dt_XYZ_to_prophotorgb(), GAIN, GAMMA, darktable_t::gui, dt_iop_module_t::gui_data, INVALID, LIFT, MAX, dt_iop_module_t::params, dt_iop_module_t::picked_color, dt_gui_gtk_t::reset, set_HSL_sliders(), and TRUE.
Referenced by color_picker_apply().
|
static |
References CDL(), CHANNEL_BLUE, CHANNEL_FACTOR, CHANNEL_GREEN, CHANNEL_RED, darktable, darktable_t::develop, dt_bauhaus_slider_set(), dt_dev_add_history_item, dt_Lab_to_XYZ(), dt_prophotorgb_to_XYZ(), dt_XYZ_to_prophotorgb(), darktable_t::gui, dt_iop_module_t::gui_data, dt_iop_module_t::params, dt_iop_module_t::picked_color, dt_gui_gtk_t::reset, and TRUE.
Referenced by color_picker_apply().
|
static |
Optimization loop : We try to find the CDL curves that neutralize the 3 input luma patches
References AUTO_SELECTED, CHANNEL_FACTOR, darktable, darktable_t::develop, dt_bauhaus_slider_set(), dt_dev_add_history_item, dt_iop_color_picker_reset(), dt_Lab_to_XYZ(), GAIN, GAMMA, darktable_t::gui, dt_iop_module_t::gui_data, INVALID, LIFT, MAX, 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, and TRUE.
Referenced by color_picker_apply().
|
static |
References CHANNEL_FACTOR, darktable, darktable_t::develop, dt_bauhaus_slider_set(), dt_dev_add_history_item, dt_Lab_to_XYZ(), dt_XYZ_to_prophotorgb(), GAIN, darktable_t::gui, dt_iop_module_t::gui_data, dt_iop_module_t::params, dt_iop_module_t::picked_color_max, dt_gui_gtk_t::reset, TRUE, and USER_SELECTED.
Referenced by color_picker_apply().
|
static |
References CDL(), CHANNEL_BLUE, CHANNEL_FACTOR, CHANNEL_GREEN, CHANNEL_RED, darktable, darktable_t::develop, dt_bauhaus_slider_set(), dt_dev_add_history_item, dt_Lab_to_XYZ(), dt_XYZ_to_prophotorgb(), GAIN, darktable_t::gui, dt_iop_module_t::gui_data, MAX, dt_iop_module_t::params, dt_iop_module_t::picked_color, dt_gui_gtk_t::reset, set_HSL_sliders(), TRUE, and USER_SELECTED.
Referenced by color_picker_apply().
|
static |
References CHANNEL_FACTOR, darktable, darktable_t::develop, dt_bauhaus_slider_set(), dt_dev_add_history_item, dt_Lab_to_XYZ(), dt_XYZ_to_prophotorgb(), GAMMA, darktable_t::gui, dt_iop_module_t::gui_data, MAX, dt_iop_module_t::params, dt_iop_module_t::picked_color, dt_gui_gtk_t::reset, TRUE, and USER_SELECTED.
Referenced by color_picker_apply().
|
static |
References CDL(), CHANNEL_BLUE, CHANNEL_FACTOR, CHANNEL_GREEN, CHANNEL_RED, darktable, darktable_t::develop, dt_bauhaus_slider_set(), dt_dev_add_history_item, dt_Lab_to_XYZ(), dt_XYZ_to_prophotorgb(), GAMMA, darktable_t::gui, dt_iop_module_t::gui_data, dt_iop_module_t::params, dt_iop_module_t::picked_color, dt_gui_gtk_t::reset, set_HSL_sliders(), TRUE, and USER_SELECTED.
Referenced by color_picker_apply().
|
static |
References CHANNEL_FACTOR, darktable, darktable_t::develop, dt_bauhaus_slider_set(), dt_dev_add_history_item, dt_Lab_to_XYZ(), dt_XYZ_to_prophotorgb(), darktable_t::gui, dt_iop_module_t::gui_data, LIFT, dt_iop_module_t::params, dt_iop_module_t::picked_color_min, dt_gui_gtk_t::reset, TRUE, and USER_SELECTED.
Referenced by color_picker_apply().
|
static |
References CDL(), CHANNEL_BLUE, CHANNEL_FACTOR, CHANNEL_GREEN, CHANNEL_RED, darktable, darktable_t::develop, dt_bauhaus_slider_set(), dt_dev_add_history_item, dt_Lab_to_XYZ(), dt_XYZ_to_prophotorgb(), darktable_t::gui, dt_iop_module_t::gui_data, LIFT, dt_iop_module_t::params, dt_iop_module_t::picked_color, dt_gui_gtk_t::reset, set_HSL_sliders(), TRUE, and USER_SELECTED.
Referenced by color_picker_apply().
|
inlinestatic |
Referenced by apply_autocolor(), apply_autogrey(), apply_gain_neutralize(), apply_gamma_neutralize(), apply_lift_neutralize(), and process().
void cleanup_global | ( | dt_iop_module_so_t * | module | ) |
void cleanup_pipe | ( | dt_iop_module_t * | self, |
dt_dev_pixelpipe_t * | pipe, | ||
dt_dev_pixelpipe_iop_t * | piece | ||
) |
References dt_dev_pixelpipe_iop_t::data.
void color_picker_apply | ( | dt_iop_module_t * | self, |
GtkWidget * | picker, | ||
dt_dev_pixelpipe_iop_t * | piece | ||
) |
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_BLUE, CHANNEL_FACTOR, CHANNEL_GREEN, CHANNEL_RED, CHANNEL_SIZE, dt_iop_colorbalance_data_t::contrast, dt_dev_pixelpipe_iop_t::data, dt_prophotorgb_to_XYZ(), dt_iop_colorbalance_data_t::gain, dt_iop_colorbalance_data_t::gamma, dt_iop_colorbalance_data_t::grey, LEGACY, dt_iop_colorbalance_data_t::lift, LIFT_GAMMA_GAIN, dt_iop_colorbalance_data_t::mode, dt_iop_colorbalance_data_t::saturation, dt_iop_colorbalance_data_t::saturation_out, and SLOPE_OFFSET_POWER.
|
static |
References darktable, dt_iop_color_picker_reset(), darktable_t::gui, dt_iop_module_t::gui_data, dt_gui_gtk_t::reset, set_visible_widgets(), and TRUE.
Referenced by gui_init().
int default_colorspace | ( | dt_iop_module_t * | self, |
dt_dev_pixelpipe_t * | pipe, | ||
dt_dev_pixelpipe_iop_t * | piece | ||
) |
References IOP_CS_LAB.
int default_group | ( | ) |
References IOP_GROUP_COLOR.
const char ** description | ( | struct dt_iop_module_t * | self | ) |
References dt_iop_set_description().
int flags | ( | ) |
References IOP_FLAGS_DEPRECATED, IOP_FLAGS_INCLUDE_IN_STYLES, and IOP_FLAGS_SUPPORTS_BLENDING.
|
static |
|
static |
void gui_changed | ( | dt_iop_module_t * | self, |
GtkWidget * | w, | ||
void * | previous | ||
) |
References _configure_slider_blocks(), darktable, darktable_t::gui, dt_iop_module_t::gui_data, dt_iop_module_t::params, dt_gui_gtk_t::reset, set_HSL_sliders(), and set_visible_widgets().
Referenced by gui_update().
void gui_cleanup | ( | struct dt_iop_module_t * | self | ) |
void gui_init | ( | dt_iop_module_t * | self | ) |
References _configure_slider_blocks(), _cycle_layout_callback(), ADD_BLOCK, darktable_t::bauhaus, BOTH, controls_callback(), darktable, dt_bauhaus_combobox_add(), dt_bauhaus_combobox_from_params(), dt_bauhaus_combobox_new(), dt_bauhaus_combobox_set(), dt_bauhaus_slider_from_params(), dt_bauhaus_slider_set_digits(), dt_bauhaus_slider_set_factor(), dt_bauhaus_slider_set_format(), dt_bauhaus_slider_set_offset(), dt_bauhaus_slider_set_soft_range(), DT_BAUHAUS_SPACE, dt_bauhaus_widget_set_label(), DT_COLOR_PICKER_AREA, dt_color_picker_new(), dt_conf_get_string_const(), DT_DEBUG_CONTROL_SIGNAL_CONNECT, DT_GUI_MODULE, DT_SIGNAL_PREFERENCES_CHANGE, dt_ui_section_label_new(), dtgtk_drawing_area_new_with_aspect_ratio(), FALSE, HSL, INVALID, IOP_GUI_ALLOC, LEVELS, RGBL, darktable_t::signals, and TRUE.
void gui_reset | ( | dt_iop_module_t * | self | ) |
void gui_update | ( | dt_iop_module_t * | self | ) |
References _check_tuner_picker_labels(), dt_iop_color_picker_reset(), gui_changed(), and TRUE.
void init_global | ( | dt_iop_module_so_t * | module | ) |
void init_pipe | ( | dt_iop_module_t * | self, |
dt_dev_pixelpipe_t * | pipe, | ||
dt_dev_pixelpipe_iop_t * | piece | ||
) |
References dt_dev_pixelpipe_iop_t::data, and dt_dev_pixelpipe_iop_t::data_size.
void init_presets | ( | dt_iop_module_so_t * | self | ) |
References add_preset().
int legacy_params | ( | dt_iop_module_t * | self, |
const void *const | old_params, | ||
const int | old_version, | ||
void * | new_params, | ||
const int | new_version | ||
) |
References CHANNEL_SIZE, dt_iop_colorbalance_params_t::contrast, dt_iop_module_t::default_params, dt_iop_colorbalance_params_t::gain, dt_iop_colorbalance_params_t::gamma, dt_iop_colorbalance_params_t::grey, LEGACY, dt_iop_colorbalance_params_t::lift, dt_iop_colorbalance_params_t::mode, and dt_iop_colorbalance_params_t::saturation.
|
static |
const char * name | ( | ) |
Referenced by add_preset().
void process | ( | struct dt_iop_module_t * | self, |
dt_dev_pixelpipe_iop_t * | piece, | ||
const void *const | ivoid, | ||
void *const | ovoid, | ||
const dt_iop_roi_t *const | roi_in, | ||
const dt_iop_roi_t *const | roi_out | ||
) |
References CDL(), CHANNEL_BLUE, CHANNEL_FACTOR, CHANNEL_GREEN, CHANNEL_RED, dt_dev_pixelpipe_iop_t::colors, dt_iop_colorbalance_data_t::contrast, dt_dev_pixelpipe_iop_t::data, DT_DEV_PIXELPIPE_DISPLAY_MASK, dt_iop_alpha_copy(), dt_Lab_to_XYZ(), dt_prophotorgb_to_XYZ(), dt_sRGB_to_XYZ(), dt_XYZ_to_Lab(), dt_XYZ_to_prophotorgb(), dt_XYZ_to_sRGB(), dt_iop_colorbalance_data_t::gain, dt_iop_colorbalance_data_t::gamma, dt_iop_colorbalance_data_t::grey, dt_iop_roi_t::height, LEGACY, dt_iop_colorbalance_data_t::lift, LIFT_GAMMA_GAIN, dt_iop_colorbalance_data_t::mode, dt_dev_pixelpipe_iop_t::pipe, dt_iop_colorbalance_data_t::saturation, dt_iop_colorbalance_data_t::saturation_out, SLOPE_OFFSET_POWER, and dt_iop_roi_t::width.
|
inlinestatic |
HSL sliders are set from the RGB values at any time. Only the RGB values are saved and used in the computations. The HSL sliders are merely an interface.
References CHANNEL_BLUE, CHANNEL_GREEN, CHANNEL_RED, dt_bauhaus_slider_set(), rgb2hsl(), and update_saturation_slider_color().
Referenced by apply_autocolor(), apply_gain_neutralize(), apply_gamma_neutralize(), apply_lift_neutralize(), and gui_changed().
|
inlinestatic |
References B, CHANNEL_BLUE, CHANNEL_GREEN, CHANNEL_RED, darktable, dt_bauhaus_slider_set(), darktable_t::gui, hsl2rgb(), R, and dt_gui_gtk_t::reset.
void set_visible_widgets | ( | dt_iop_colorbalance_gui_data_t * | g | ) |
References BOTH, dt_bauhaus_combobox_get(), dt_conf_set_string(), HSL, LEGACY, RGBL, and SLOPE_OFFSET_POWER.
Referenced by controls_callback(), gui_changed(), and gui_reset().
|
inlinestatic |
References dt_bauhaus_slider_set_stop(), and hsl2rgb().
Referenced by set_HSL_sliders().