![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
#include "bauhaus/bauhaus.h"#include "common/chromatic_adaptation.h"#include "common/darktable.h"#include "common/iop_profile.h"#include "common/illuminants.h"#include "common/matrices.h"#include "common/opencl.h"#include "control/control.h"#include "develop/develop.h"#include "develop/imageop.h"#include "develop/imageop_gui.h"#include "develop/imageop_math.h"#include "develop/openmp_maths.h"#include "gui/color_picker_proxy.h"#include "gui/gtk.h"#include "iop/channelmixerrgb_shared.h"#include "iop/iop_api.h"#include "channelmixerrgb_shared.c"#include <gtk/gtk.h>#include <math.h>#include <stdlib.h>#include <string.h>
Include dependency graph for splittoningrgb.c:Data Structures | |
| struct | dt_iop_splittoning_rgb_params_t |
| struct | dt_iop_splittoning_rgb_data_t |
| struct | dt_iop_splittoning_rgb_global_data_t |
| struct | dt_iop_splittoning_rgb_point_gui_t |
| struct | dt_iop_splittoning_rgb_gui_data_t |
Macros | |
| #define | DT_SPLITTONING_RGB_POINT_COUNT 2 |
| #define | DT_SPLITTONING_RGB_ROW_COUNT 3 |
| #define | DT_SPLITTONING_RGB_COMPLETE_COUNT 3 |
| #define | DT_SPLITTONING_RGB_PREVIEW_HEIGHT 60 |
Typedefs | |
| typedef enum dt_iop_splittoning_rgb_point_t | dt_iop_splittoning_rgb_point_t |
| typedef enum dt_iop_splittoning_rgb_mixer_mode_t | dt_iop_splittoning_rgb_mixer_mode_t |
| typedef struct dt_iop_splittoning_rgb_params_t | dt_iop_splittoning_rgb_params_t |
| typedef struct dt_iop_splittoning_rgb_data_t | dt_iop_splittoning_rgb_data_t |
| typedef struct dt_iop_splittoning_rgb_global_data_t | dt_iop_splittoning_rgb_global_data_t |
| typedef struct dt_iop_splittoning_rgb_point_gui_t | dt_iop_splittoning_rgb_point_gui_t |
| typedef struct dt_iop_splittoning_rgb_gui_data_t | dt_iop_splittoning_rgb_gui_data_t |
Enumerations | |
| enum | dt_iop_splittoning_rgb_point_t { DT_SPLITTONING_RGB_POINT_DARK = 0 , DT_SPLITTONING_RGB_POINT_BRIGHT = 1 } |
| enum | dt_iop_splittoning_rgb_mixer_mode_t { DT_SPLITTONING_RGB_MIXER_COMPLETE = 0 , DT_SPLITTONING_RGB_MIXER_SIMPLE = 1 , DT_SPLITTONING_RGB_MIXER_PRIMARIES = 2 } |
Variables | |
| static const char *const | _mode_conf [2] |
| static const char *const | _point_label [2] |
| #define DT_SPLITTONING_RGB_COMPLETE_COUNT 3 |
| #define DT_SPLITTONING_RGB_POINT_COUNT 2 |
| #define DT_SPLITTONING_RGB_PREVIEW_HEIGHT 60 |
| #define DT_SPLITTONING_RGB_ROW_COUNT 3 |
| typedef struct dt_iop_splittoning_rgb_data_t dt_iop_splittoning_rgb_data_t |
| typedef struct dt_iop_splittoning_rgb_params_t dt_iop_splittoning_rgb_params_t |
|
inlinestatic |
Interpolate two keyed correction matrices entry-wise.
Build the keyed full transform matrix for one scene luminance.
The transforms are stored in transposed padded form so they can be fed directly to the SIMD matrix-vector multiply. Interpolating them entry-wise in that storage remains equivalent to interpolating the underlying 3x3 matrix.
| [in] | from | Source keyed correction matrix in transposed padded form. |
| [in] | to | Destination keyed correction matrix in transposed padded form. |
| [in] | alpha | Interpolation factor from source to destination. |
| [out] | interpolated | Interpolated matrix in the same transposed padded form. |
Inside the [dark ; bright] segment, the module linearly interpolates between the two user transforms. Outside that segment, the nearest transform fades linearly back to identity over one segment length so the correction tapers out instead of clipping.
| [in] | luminance | Current pixel scene luminance in XYZ Y. |
| [in] | d | Precomputed module state for the current pipe. |
| [out] | matrix | Keyed full transform matrix in transposed padded form. |
References row.
|
static |
References _temperature_to_xy(), DT_ADAPTATION_CAT16, dt_apply_transposed_color_matrix(), dt_store_simd_aligned(), illuminant_xy_to_XYZ(), IS_NULL_PTR, dt_iop_order_iccprofile_info_t::matrix_in_transposed, dt_iop_order_iccprofile_info_t::matrix_out_transposed, row, and x.
Referenced by _build_point_transform().
|
static |
References _general_callback(), _tag_widget(), darktable_t::bauhaus, container(), darktable, dt_bauhaus_slider_new_with_range(), dt_bauhaus_widget_set_label(), DT_GUI_MODULE, dt_ui_section_label_new(), FALSE, g, and row.
Referenced by gui_init().
|
static |
References _build_cat16_rgb_matrix(), _get_point_rows(), dt_iop_channelmixer_shared_get_matrix(), dt_iop_channelmixer_shared_mul3x3(), FALSE, normalize(), p, and row.
Referenced by _render_preview_surface(), and commit_params().
|
static |
References _primaries_slider_callback(), _tag_widget(), darktable_t::bauhaus, container(), darktable, dt_bauhaus_slider_new_with_range(), dt_bauhaus_slider_set_factor(), dt_bauhaus_slider_set_format(), dt_bauhaus_widget_set_label(), DT_GUI_MODULE, dt_ui_section_label_new(), FALSE, g, and i.
Referenced by gui_init().
|
static |
References _simple_slider_callback(), _tag_widget(), darktable_t::bauhaus, container(), darktable, dt_bauhaus_slider_new_with_range(), dt_bauhaus_slider_set_factor(), dt_bauhaus_slider_set_format(), dt_bauhaus_widget_set_label(), DT_GUI_MODULE, dt_ui_section_label_new(), FALSE, g, and i.
Referenced by gui_init().
|
static |
References _queue_preview_redraw(), _update_point_slider_colors(), darktable, darktable_t::develop, dt_dev_add_history_item, g, dt_iop_module_t::gui_data, and TRUE.
Referenced by _general_callback(), _mixer_mode_callback(), _primaries_slider_callback(), _simple_slider_callback(), and color_picker_apply().
|
inlinestatic |
Referenced by _ev_to_luminance().
|
inlinestatic |
References _ev_to_grey().
Referenced by _render_preview_surface(), and commit_params().
References _commit_gui_change(), _update_point_gui(), darktable, dt_bauhaus_slider_get(), FALSE, g, darktable_t::gui, dt_iop_module_t::gui_data, p, dt_iop_module_t::params, dt_gui_gtk_t::reset, row, and TRUE.
Referenced by _build_complete_ui(), and gui_init().
|
static |
References normalize(), p, and row.
Referenced by _build_point_transform(), _sync_primaries_from_params(), and _sync_simple_from_params().
References _commit_gui_change(), _mode_conf, _set_point_complete_widgets(), _set_point_mixer_mode(), _sync_primaries_from_params(), _sync_simple_from_params(), darktable, dt_bauhaus_combobox_get(), dt_bauhaus_combobox_set(), dt_conf_set_int(), dt_control_log(), DT_SPLITTONING_RGB_MIXER_COMPLETE, DT_SPLITTONING_RGB_MIXER_PRIMARIES, DT_SPLITTONING_RGB_MIXER_SIMPLE, error(), g, darktable_t::gui, dt_iop_module_t::gui_data, p, dt_iop_module_t::params, dt_gui_gtk_t::reset, row, and TRUE.
Referenced by gui_init().
|
static |
Refresh cached GUI colors after the darkroom pipe has converged.
Slider backgrounds and the preview gradient depend on the current work and display profiles. Those profiles may be unavailable during the very first draw after the module widget is created, so we listen to pipe completion and rebuild the cached surfaces as soon as the pipe is ready.
| [in] | instance | Unused signal emitter. |
| [in] | user_data | Current module instance. |
References _queue_preview_redraw(), _update_point_slider_colors(), DT_SPLITTONING_RGB_POINT_COUNT, g, dt_iop_module_t::gui_data, and IS_NULL_PTR.
Referenced by gui_cleanup(), and gui_init().
|
static |
References _render_preview_surface(), FALSE, g, dt_iop_module_t::gui_data, IS_NULL_PTR, and TRUE.
Referenced by gui_init().
References _commit_gui_change(), _set_point_complete_widgets(), _set_point_rows(), darktable, dt_control_log(), DT_IOP_CHANNELMIXER_SHARED_PRIMARIES_BASIS_RGB, dt_iop_channelmixer_shared_primaries_from_sliders(), dt_iop_channelmixer_shared_primaries_to_matrix(), FALSE, g, darktable_t::gui, dt_iop_module_t::gui_data, M, p, dt_iop_module_t::params, dt_gui_gtk_t::reset, and row.
Referenced by _build_primaries_ui().
|
static |
References g, and dt_iop_module_t::gui_data.
Referenced by _commit_gui_change(), _pipe_finished_callback(), _update_point_gui(), and gui_update().
|
static |
Render the cached split-toning preview as a simple keyed gradient.
The drawing area is meant as a direct preview of the keyed blend, not as a plotting canvas. We therefore sweep a neutral grey ramp once, cache the resulting Cairo image surface and only rebuild it when parameters change or the widget size changes.
| [in] | self | Current module instance. |
| [in,out] | surface | Cached Cairo image surface to repaint. |
References _build_point_transform(), _ev_to_luminance(), dt_iop_module_t::dev, dt_apply_transposed_color_matrix(), dt_iop_channelmixer_shared_work_rgb_to_display(), dt_ioppr_get_pipe_output_profile_info(), dt_ioppr_get_pipe_work_profile_info(), DT_SPLITTONING_RGB_POINT_BRIGHT, DT_SPLITTONING_RGB_POINT_DARK, dt_store_simd_aligned(), height, i, IS_NULL_PTR, dt_iop_order_iccprofile_info_t::matrix_in_transposed, p, dt_iop_module_t::params, dt_develop_t::preview_pipe, state, width, x, and XYZ.
Referenced by _preview_draw().
|
static |
References dt_bauhaus_slider_set(), g, p, and row.
Referenced by _mixer_mode_callback(), _primaries_slider_callback(), _simple_slider_callback(), _update_point_gui(), and gui_update().
|
static |
References DT_SPLITTONING_RGB_MIXER_PRIMARIES, DT_SPLITTONING_RGB_MIXER_SIMPLE, and g.
Referenced by _mixer_mode_callback(), _update_point_gui(), and gui_update().
|
static |
Referenced by _primaries_slider_callback(), and _simple_slider_callback().
References _commit_gui_change(), _set_point_complete_widgets(), _set_point_rows(), _sync_primaries_from_params(), darktable, dt_iop_channelmixer_shared_simple_from_sliders(), dt_iop_channelmixer_shared_simple_to_matrix(), g, darktable_t::gui, dt_iop_module_t::gui_data, M, p, dt_iop_module_t::params, dt_gui_gtk_t::reset, row, and TRUE.
Referenced by _build_simple_ui().
|
static |
References _get_point_rows(), darktable, dt_iop_channelmixer_shared_get_matrix(), DT_IOP_CHANNELMIXER_SHARED_PRIMARIES_BASIS_RGB, dt_iop_channelmixer_shared_primaries_from_matrix(), dt_iop_channelmixer_shared_primaries_to_matrix(), dt_iop_channelmixer_shared_primaries_to_sliders(), dt_iop_channelmixer_shared_roundtrip_error(), DT_IOP_CHANNELMIXER_SHARED_SIMPLE_EPS, error(), FALSE, g, darktable_t::gui, dt_iop_module_t::gui_data, IS_NULL_PTR, M, normalize(), p, dt_iop_module_t::params, and dt_gui_gtk_t::reset.
Referenced by _mixer_mode_callback(), _simple_slider_callback(), _update_point_gui(), and gui_update().
|
static |
References _get_point_rows(), darktable, dt_iop_channelmixer_shared_get_matrix(), dt_iop_channelmixer_shared_roundtrip_error(), dt_iop_channelmixer_shared_rows_are_normalized(), DT_IOP_CHANNELMIXER_SHARED_SIMPLE_EPS, dt_iop_channelmixer_shared_simple_from_matrix(), dt_iop_channelmixer_shared_simple_to_matrix(), dt_iop_channelmixer_shared_simple_to_sliders(), error(), FALSE, g, darktable_t::gui, dt_iop_module_t::gui_data, IS_NULL_PTR, M, normalize(), p, dt_iop_module_t::params, and dt_gui_gtk_t::reset.
Referenced by _mixer_mode_callback(), _update_point_gui(), and gui_update().
Referenced by _build_complete_ui(), _build_primaries_ui(), _build_simple_ui(), and gui_init().
|
static |
References CCT_to_xy_blackbody(), CCT_to_xy_daylight(), and x.
Referenced by _build_cat16_rgb_matrix().
|
static |
References _mode_conf, _queue_preview_redraw(), _set_point_complete_widgets(), _set_point_mixer_mode(), _sync_primaries_from_params(), _sync_simple_from_params(), darktable, dt_bauhaus_combobox_get(), dt_bauhaus_combobox_set(), dt_conf_set_int(), dt_control_log(), DT_SPLITTONING_RGB_MIXER_COMPLETE, DT_SPLITTONING_RGB_MIXER_PRIMARIES, DT_SPLITTONING_RGB_MIXER_SIMPLE, FALSE, g, darktable_t::gui, dt_iop_module_t::gui_data, IS_NULL_PTR, p, dt_iop_module_t::params, dt_gui_gtk_t::reset, and row.
Referenced by _general_callback().
|
static |
Repaint every slider background for one split-toning keyframe.
The complete, simple and primaries controls all act on the same effective mixer, just viewed through different parameterizations. We therefore refresh every slider tint from the current widget state after each edit so the GUI keeps reflecting the exact correction the user is shaping.
| [in] | self | Current module instance. |
| [in] | point | Shadow or highlight keyframe being edited. |
References dt_iop_module_t::dev, DT_ADAPTATION_RGB, dt_iop_channelmixer_shared_paint_primaries_sliders(), dt_iop_channelmixer_shared_paint_row_sliders(), dt_iop_channelmixer_shared_paint_simple_sliders(), dt_iop_channelmixer_shared_paint_temperature_slider(), DT_IOP_CHANNELMIXER_SHARED_PRIMARIES_BASIS_RGB, dt_iop_channelmixer_shared_primaries_from_sliders(), dt_iop_channelmixer_shared_simple_from_sliders(), dt_ioppr_get_pipe_output_profile_info(), dt_ioppr_get_pipe_work_profile_info(), g, dt_iop_module_t::gui_data, p, dt_iop_module_t::params, dt_develop_t::pipe, and row.
Referenced by _commit_gui_change(), _pipe_finished_callback(), and gui_update().
| const char * aliases | ( | ) |
| void cleanup_global | ( | dt_iop_module_so_t * | module | ) |
| void cleanup_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, and dt_free_align.
| void color_picker_apply | ( | dt_iop_module_t * | self, |
| GtkWidget * | picker, | ||
| dt_dev_pixelpipe_t * | pipe, | ||
| dt_dev_pixelpipe_iop_t * | piece | ||
| ) |
Set a brightness keyframe from the average luminance of a picked area.
The picker samples the current module buffer in working RGB. We convert that average RGB to scene luminance Y in the active working profile, then map the result to EV so each anchor can be snapped directly to image content.
| [in] | self | Current module instance. |
| [in] | picker | Picker-enabled brightness slider that requested the sample. |
| [in] | pipe | Active pixelpipe that produced the sampled buffer. |
| [in] | piece | Current module instance on that pipe. |
References _commit_gui_change(), darktable, dt_iop_module_t::dev, dt_bauhaus_slider_set(), dt_camera_rgb_luminance(), dt_ioppr_get_iop_work_profile_info(), dt_ioppr_get_pipe_current_profile_info(), DT_SPLITTONING_RGB_POINT_BRIGHT, DT_SPLITTONING_RGB_POINT_DARK, g, darktable_t::gui, dt_iop_module_t::gui_data, dt_develop_t::iop, IS_NULL_PTR, luminance, dt_iop_order_iccprofile_info_t::lut_in, dt_iop_order_iccprofile_info_t::lutsize, dt_iop_order_iccprofile_info_t::matrix_in, dt_iop_order_iccprofile_info_t::nonlinearlut, NORM_MIN, p, 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, and dt_gui_gtk_t::reset.
| void commit_params | ( | struct dt_iop_module_t * | self, |
| dt_iop_params_t * | params, | ||
| dt_dev_pixelpipe_t * | pipe, | ||
| dt_dev_pixelpipe_iop_t * | piece | ||
| ) |
References _build_point_transform(), _ev_to_luminance(), d, dt_dev_pixelpipe_iop_t::data, dt_ioppr_get_pipe_current_profile_info(), DT_SPLITTONING_RGB_POINT_BRIGHT, DT_SPLITTONING_RGB_POINT_COUNT, DT_SPLITTONING_RGB_POINT_DARK, i, IS_NULL_PTR, dt_iop_order_iccprofile_info_t::matrix_in_transposed, p, pack_3xSSE_to_3x4(), and transpose_3xSSE().
| 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 flags | ( | ) |
References IOP_FLAGS_ALLOW_TILING, IOP_FLAGS_INCLUDE_IN_STYLES, and IOP_FLAGS_SUPPORTS_BLENDING.
| void gui_cleanup | ( | struct dt_iop_module_t * | self | ) |
| void gui_init | ( | struct dt_iop_module_t * | self | ) |
References _build_complete_ui(), _build_primaries_ui(), _build_simple_ui(), _general_callback(), _mixer_mode_callback(), _pipe_finished_callback(), _point_label, _preview_draw(), _tag_widget(), darktable_t::bauhaus, darktable, dt_bauhaus_combobox_add(), dt_bauhaus_combobox_new(), dt_bauhaus_slider_new_with_range(), dt_bauhaus_slider_set_format(), dt_bauhaus_slider_set_soft_range(), DT_BAUHAUS_SPACE, dt_bauhaus_widget_set_label(), DT_COLOR_PICKER_AREA, dt_color_picker_new(), DT_DEBUG_CONTROL_SIGNAL_CONNECT, DT_GUI_MODULE, DT_PIXEL_APPLY_DPI, DT_SIGNAL_DEVELOP_PREVIEW_PIPE_FINISHED, DT_SIGNAL_DEVELOP_UI_PIPE_FINISHED, DT_SPLITTONING_RGB_POINT_COUNT, DT_SPLITTONING_RGB_PREVIEW_HEIGHT, dt_ui_notebook_new(), dt_ui_notebook_page(), FALSE, g, gui_update(), IOP_GUI_ALLOC, darktable_t::signals, and dt_iop_module_t::widget.
| void gui_update | ( | struct dt_iop_module_t * | self | ) |
Refresh GUI controls from current params and configuration.
References _mode_conf, _queue_preview_redraw(), _set_point_complete_widgets(), _set_point_mixer_mode(), _sync_primaries_from_params(), _sync_simple_from_params(), _update_point_slider_colors(), darktable, dt_bauhaus_combobox_set(), dt_bauhaus_slider_set(), dt_conf_get_int(), dt_conf_key_exists(), DT_SPLITTONING_RGB_MIXER_COMPLETE, DT_SPLITTONING_RGB_MIXER_PRIMARIES, DT_SPLITTONING_RGB_MIXER_SIMPLE, DT_SPLITTONING_RGB_POINT_COUNT, g, darktable_t::gui, dt_iop_module_t::gui_data, p, dt_iop_module_t::params, and dt_gui_gtk_t::reset.
Referenced by gui_init().
| void init | ( | dt_iop_module_t * | module | ) |
| void init_global | ( | dt_iop_module_so_t * | module | ) |
| 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 input_format | ( | dt_iop_module_t * | self, |
| dt_dev_pixelpipe_t * | pipe, | ||
| dt_dev_pixelpipe_iop_t * | piece, | ||
| dt_iop_buffer_dsc_t * | dsc | ||
| ) |
| const char * name | ( | ) |
| __DT_CLONE_TARGETS__ 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 | ||
| ) |
| int process_cl | ( | struct dt_iop_module_t * | self, |
| const dt_dev_pixelpipe_t * | pipe, | ||
| const dt_dev_pixelpipe_iop_t * | piece, | ||
| cl_mem | dev_in, | ||
| cl_mem | dev_out | ||
| ) |
References d, dt_dev_pixelpipe_iop_t::data, dt_dev_pixelpipe_t::devid, DT_DEBUG_OPENCL, dt_opencl_copy_host_to_device_constant(), dt_opencl_enqueue_kernel_2d(), dt_opencl_release_mem_object(), dt_opencl_set_kernel_arg(), dt_print(), DT_SPLITTONING_RGB_POINT_BRIGHT, DT_SPLITTONING_RGB_POINT_DARK, error(), FALSE, dt_iop_module_t::global_data, height, dt_iop_roi_t::height, dt_iop_splittoning_rgb_global_data_t::kernel_splittoningrgb, dt_dev_pixelpipe_iop_t::roi_in, ROUNDUPDHT, ROUNDUPDWD, TRUE, width, and dt_iop_roi_t::width.
|
static |
Referenced by _mixer_mode_callback(), _update_point_gui(), and gui_update().
|
static |
Referenced by gui_init().