![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
#include "widgets/bauhaus.h"#include "pixel/chromatic_adaptation.h"#include "pixel/illuminants.h"#include "math/matrices.h"#include "iop/channelmixerrgb_shared.h"#include <float.h>#include <math.h>
Include dependency graph for channelmixerrgb_shared.c:Go to the source code of this file.
Macros | |
| #define | DT_IOP_CHANNELMIXER_SHARED_INV_SQRT_3 0.5773502691896258f |
Functions | |
| float | dt_iop_channelmixer_shared_wrap_pi (float angle) |
| float | dt_iop_channelmixer_shared_wrap_half_pi (float angle) |
| float | dt_iop_channelmixer_shared_encode_simple_stretch (const float stretch) |
| float | dt_iop_channelmixer_shared_decode_simple_stretch (const float slider) |
| float | dt_iop_channelmixer_shared_encode_simple_coupling_amount (const float amount) |
| float | dt_iop_channelmixer_shared_decode_simple_coupling_amount (const float slider) |
| void | dt_iop_channelmixer_shared_simple_from_sliders (GtkWidget *const widgets[6], dt_iop_channelmixer_shared_simple_params_t *simple) |
| void | dt_iop_channelmixer_shared_simple_to_sliders (const dt_iop_channelmixer_shared_simple_params_t *const simple, GtkWidget *const widgets[6]) |
| void | dt_iop_channelmixer_shared_primaries_from_sliders (GtkWidget *const widgets[9], dt_iop_channelmixer_shared_primaries_params_t *primaries) |
| void | dt_iop_channelmixer_shared_primaries_to_sliders (const dt_iop_channelmixer_shared_primaries_params_t *const primaries, GtkWidget *const widgets[9]) |
| void | dt_iop_channelmixer_shared_white_preserving_from_sliders (GtkWidget *const widgets[6], dt_iop_channelmixer_shared_white_preserving_params_t *white_preserving) |
| void | dt_iop_channelmixer_shared_white_preserving_to_sliders (const dt_iop_channelmixer_shared_white_preserving_params_t *const white_preserving, GtkWidget *const widgets[6]) |
| gboolean | dt_iop_channelmixer_shared_rows_are_normalized (const gboolean normalize[3]) |
| gboolean | dt_iop_channelmixer_shared_get_matrix (const float rows[3][3], const gboolean normalize[3], const gboolean force_normalize, float M[3][3]) |
| void | dt_iop_channelmixer_shared_set_matrix (float rows[3][3], const float M[3][3]) |
| void | dt_iop_channelmixer_shared_mul3x3 (const float A[3][3], const float B[3][3], float C[3][3]) |
| static void | _mixer_to_chroma_basis (const float M[3][3], float B[3][3]) |
| static void | _mixer_from_chroma_basis (const float B[3][3], float M[3][3]) |
| void | dt_iop_channelmixer_shared_simple_from_matrix (const float M[3][3], dt_iop_channelmixer_shared_simple_params_t *simple) |
| void | dt_iop_channelmixer_shared_simple_to_matrix (const dt_iop_channelmixer_shared_simple_params_t *const simple, float M[3][3]) |
| float | dt_iop_channelmixer_shared_roundtrip_error (const float M[3][3], const float roundtrip[3][3]) |
| float | dt_iop_channelmixer_shared_roundtrip_error_relative (const float M[3][3], const float roundtrip[3][3]) |
| Roundtrip error, measured against the magnitude of the matrix itself. | |
| dt_iop_channelmixer_shared_primaries_basis_t | dt_iop_channelmixer_shared_primaries_basis_from_adaptation (const dt_adaptation_t adaptation) |
| static void | _primaries_reference_white (const dt_iop_channelmixer_shared_primaries_basis_t basis, float white[3]) |
| static float | _affine_sum3 (const float vector[3]) |
| static gboolean | _affine_normalize (const float vector[3], float normalized[3]) |
| static void | _affine_project_difference (const float difference[3], float uv[2]) |
| static void | _affine_unproject_difference (const float uv[2], float difference[3]) |
| static void | _rotate_2d (const float vector[2], const float angle, float rotated[2]) |
| static float | _intersect_affine_ray_segment (const float direction[2], const float first[2], const float second[2]) |
| static float | _affine_distance_to_edge (const float direction[2], const float reference_primaries[3][2]) |
| static gboolean | _build_affine_simplex (const dt_iop_channelmixer_shared_primaries_basis_t basis, float white_normalized[3], float reference_primaries[3][2]) |
| static gboolean | _affine_point_from_polar (const float white_normalized[3], const float reference_primaries[3][2], const int reference_index, const float hue, const float purity, float point_normalized[3]) |
| static gboolean | _affine_polar_from_point (const float white_normalized[3], const float reference_primaries[3][2], const int reference_index, const float point_normalized[3], float *hue, float *purity) |
| static gboolean | _white_preserving_point_from_polar (const float white_normalized[3], const float reference_primaries[3][2], const int reference_index, const float rotation, const float saturation, float point_normalized[3]) |
| Place one white-preserving primary from its rotation and saturation. | |
| static gboolean | _white_preserving_polar_from_point (const float white_normalized[3], const float reference_primaries[3][2], const int reference_index, const float point_normalized[3], float *rotation, float *saturation) |
| Read back the rotation and saturation of one white-preserving primary. | |
| gboolean | dt_iop_channelmixer_shared_primaries_to_matrix (const dt_iop_channelmixer_shared_primaries_basis_t basis, const dt_iop_channelmixer_shared_primaries_params_t *primaries, float M[3][3]) |
| gboolean | dt_iop_channelmixer_shared_primaries_from_matrix (const dt_iop_channelmixer_shared_primaries_basis_t basis, const float M[3][3], dt_iop_channelmixer_shared_primaries_params_t *primaries) |
| static float | _affine_triangle_area (const float vertices[3][2]) |
| Twice the signed area of a triangle given in affine plane coordinates. | |
| gboolean | dt_iop_channelmixer_shared_white_preserving_to_matrix (const dt_iop_channelmixer_shared_primaries_basis_t basis, const dt_iop_channelmixer_shared_white_preserving_params_t *const white_preserving, float M[3][3]) |
| Build the mixer matrix of a white-preserving primaries state. | |
| gboolean | dt_iop_channelmixer_shared_white_preserving_from_matrix (const dt_iop_channelmixer_shared_primaries_basis_t basis, const float M[3][3], dt_iop_channelmixer_shared_white_preserving_params_t *white_preserving) |
| Read a white-preserving primaries state back from a mixer matrix. | |
| void | dt_iop_channelmixer_shared_simple_probe_source (const dt_iop_channelmixer_shared_simple_probe_t probe, float source[3]) |
| static void | _normalize_linear_display_rgb (dt_aligned_pixel_t linear_display_rgb) |
| void | dt_iop_channelmixer_shared_work_rgb_to_display (const dt_aligned_pixel_t work_rgb, const dt_iop_order_iccprofile_info_t *const work_profile, const dt_iop_order_iccprofile_info_t *const display_profile, dt_aligned_pixel_t display_rgb) |
| void | dt_iop_channelmixer_shared_module_color_to_display (const float module_color[3], const dt_adaptation_t adaptation, const dt_iop_order_iccprofile_info_t *const work_profile, const dt_iop_order_iccprofile_info_t *const display_profile, float display_rgb[3]) |
| void | dt_iop_channelmixer_shared_paint_temperature_slider (GtkWidget *const widget, const float temperature_min, const float temperature_max) |
| static void | _paint_RGB_slider_stop (const dt_adaptation_t adaptation, const dt_iop_order_iccprofile_info_t *const work_profile, const dt_iop_order_iccprofile_info_t *const display_profile, GtkWidget *const widget, const float stop, const float c, const float r, const float g, const float b) |
| void | dt_iop_channelmixer_shared_paint_row_sliders (dt_adaptation_t adaptation, const dt_iop_order_iccprofile_info_t *const work_profile, const dt_iop_order_iccprofile_info_t *const display_profile, const float r, const float g, const float b, const gboolean normalize, const float row[3], GtkWidget *const widgets[3]) |
| static void | _shared_paint_probe_matrix (const float source[3], const float M[3][3], float module_color[3]) |
| static void | _shared_simple_hue_probe (const float hue, float module_color[3]) |
| Build a stable hue cue in the fixed chroma basis for hue-like sliders. | |
| void | dt_iop_channelmixer_shared_paint_simple_sliders (const dt_adaptation_t adaptation, const dt_iop_order_iccprofile_info_t *const work_profile, const dt_iop_order_iccprofile_info_t *const display_profile, const dt_iop_channelmixer_shared_simple_params_t *const simple, GtkWidget *const widgets[6]) |
| static void | _shared_primaries_probe_color (const float M[3][3], const int widget_index, float module_color[3]) |
| void | dt_iop_channelmixer_shared_paint_primaries_sliders (const dt_adaptation_t adaptation, const dt_iop_order_iccprofile_info_t *const work_profile, const dt_iop_order_iccprofile_info_t *const display_profile, const dt_iop_channelmixer_shared_primaries_basis_t basis, const dt_iop_channelmixer_shared_primaries_params_t *const primaries, GtkWidget *const widgets[9]) |
| void | dt_iop_channelmixer_shared_paint_white_preserving_sliders (const dt_adaptation_t adaptation, const dt_iop_order_iccprofile_info_t *const work_profile, const dt_iop_order_iccprofile_info_t *const display_profile, const dt_iop_channelmixer_shared_primaries_basis_t basis, const dt_iop_channelmixer_shared_white_preserving_params_t *const white_preserving, GtkWidget *const widgets[6]) |
| #define DT_IOP_CHANNELMIXER_SHARED_INV_SQRT_3 0.5773502691896258f |
Definition at line 33 of file channelmixerrgb_shared.c.
|
static |
Definition at line 400 of file channelmixerrgb_shared.c.
References _intersect_affine_ray_segment(), and i.
Referenced by _affine_point_from_polar(), and _affine_polar_from_point().
|
static |
Definition at line 357 of file channelmixerrgb_shared.c.
References _affine_sum3(), DT_IOP_CHANNELMIXER_SHARED_SIMPLE_EPS, FALSE, and TRUE.
Referenced by _build_affine_simplex(), dt_iop_channelmixer_shared_primaries_from_matrix(), and dt_iop_channelmixer_shared_white_preserving_from_matrix().
|
static |
Definition at line 437 of file channelmixerrgb_shared.c.
References _affine_distance_to_edge(), _affine_unproject_difference(), _rotate_2d(), DT_IOP_CHANNELMIXER_SHARED_SIMPLE_EPS, FALSE, reference(), and TRUE.
Referenced by dt_iop_channelmixer_shared_primaries_to_matrix().
|
static |
Definition at line 462 of file channelmixerrgb_shared.c.
References _affine_distance_to_edge(), _affine_project_difference(), DT_IOP_CHANNELMIXER_SHARED_SIMPLE_EPS, dt_iop_channelmixer_shared_wrap_pi(), FALSE, reference(), and TRUE.
Referenced by dt_iop_channelmixer_shared_primaries_from_matrix().
|
static |
Definition at line 366 of file channelmixerrgb_shared.c.
Referenced by _affine_polar_from_point(), _build_affine_simplex(), _white_preserving_polar_from_point(), and dt_iop_channelmixer_shared_white_preserving_to_matrix().
|
inlinestatic |
Definition at line 352 of file channelmixerrgb_shared.c.
Referenced by _affine_normalize(), dt_iop_channelmixer_shared_primaries_from_matrix(), and dt_iop_channelmixer_shared_primaries_to_matrix().
|
static |
Twice the signed area of a triangle given in affine plane coordinates.
| [in] | vertices | The three vertices, projected on the affine plane. |
Definition at line 686 of file channelmixerrgb_shared.c.
Referenced by dt_iop_channelmixer_shared_white_preserving_to_matrix().
|
static |
Definition at line 372 of file channelmixerrgb_shared.c.
Referenced by _affine_point_from_polar(), and _white_preserving_point_from_polar().
|
static |
Definition at line 415 of file channelmixerrgb_shared.c.
References _affine_normalize(), _affine_project_difference(), _primaries_reference_white(), FALSE, i, and TRUE.
Referenced by dt_iop_channelmixer_shared_primaries_from_matrix(), dt_iop_channelmixer_shared_primaries_to_matrix(), dt_iop_channelmixer_shared_white_preserving_from_matrix(), and dt_iop_channelmixer_shared_white_preserving_to_matrix().
|
static |
Definition at line 387 of file channelmixerrgb_shared.c.
References DT_IOP_CHANNELMIXER_SHARED_SIMPLE_EPS, and t.
Referenced by _affine_distance_to_edge().
|
static |
Definition at line 204 of file channelmixerrgb_shared.c.
References B, DT_IOP_CHANNELMIXER_SHARED_INV_SQRT_3, dt_iop_channelmixer_shared_mul3x3(), M, P, and row.
Referenced by dt_iop_channelmixer_shared_simple_to_matrix().
|
static |
Definition at line 187 of file channelmixerrgb_shared.c.
References B, DT_IOP_CHANNELMIXER_SHARED_INV_SQRT_3, dt_iop_channelmixer_shared_mul3x3(), M, P, and row.
Referenced by dt_iop_channelmixer_shared_simple_from_matrix().
|
static |
Definition at line 839 of file channelmixerrgb_shared.c.
Referenced by dt_iop_channelmixer_shared_work_rgb_to_display().
|
static |
Definition at line 916 of file channelmixerrgb_shared.c.
References adaptation, dt_bauhaus_slider_set_stop(), dt_iop_channelmixer_shared_module_color_to_display(), g, and r.
Referenced by dt_iop_channelmixer_shared_paint_row_sliders().
|
static |
Definition at line 328 of file channelmixerrgb_shared.c.
References convert_D50_to_LMS(), DT_ADAPTATION_CAT16, DT_ADAPTATION_LINEAR_BRADFORD, DT_ADAPTATION_RGB, DT_ADAPTATION_XYZ, DT_IOP_CHANNELMIXER_SHARED_PRIMARIES_BASIS_BRADFORD, DT_IOP_CHANNELMIXER_SHARED_PRIMARIES_BASIS_CAT16, DT_IOP_CHANNELMIXER_SHARED_PRIMARIES_BASIS_RGB, and DT_IOP_CHANNELMIXER_SHARED_PRIMARIES_BASIS_XYZ.
Referenced by _build_affine_simplex(), dt_iop_channelmixer_shared_primaries_from_matrix(), dt_iop_channelmixer_shared_primaries_to_matrix(), and dt_iop_channelmixer_shared_white_preserving_to_matrix().
|
static |
Definition at line 379 of file channelmixerrgb_shared.c.
Referenced by _affine_point_from_polar(), and _white_preserving_point_from_polar().
|
static |
Definition at line 970 of file channelmixerrgb_shared.c.
Referenced by dt_iop_channelmixer_shared_paint_simple_sliders().
|
static |
Definition at line 1110 of file channelmixerrgb_shared.c.
Referenced by dt_iop_channelmixer_shared_paint_primaries_sliders().
|
static |
Build a stable hue cue in the fixed chroma basis for hue-like sliders.
Some simple-mode parameters become ineffective for degenerate mixer states, for example when the chroma stretches collapse or when the achromatic coupling amount is zero. In those cases, effect-based slider painting can legitimately converge to grey and the hue ramp disappears. This helper keeps a readable hue cue in reserve by projecting a constant-chroma vector from the fixed simple-mode basis into module RGB coordinates.
| [in] | hue | Angular direction in the chroma plane. |
| [out] | module_color | Probe color in module RGB coordinates. |
Definition at line 997 of file channelmixerrgb_shared.c.
References DT_IOP_CHANNELMIXER_SHARED_INV_SQRT_3, DT_IOP_CHANNELMIXER_SHARED_SIMPLE_CHROMA_PROBE, P, and row.
Referenced by dt_iop_channelmixer_shared_paint_simple_sliders().
|
static |
Place one white-preserving primary from its rotation and saturation.
Unlike the generalized primaries model, the radius is measured against the REFERENCE primary itself rather than against the gamut footprint edge, so the control reads as a saturation : 0 keeps the basis primary, -1 collapses it onto the white, +1 doubles its distance to it.
| [in] | white_normalized | Basis white, normalized in the affine plane. |
| [in] | reference_primaries | Affine coordinates of the three basis primaries. |
| [in] | reference_index | Which primary is being placed. |
| [in] | rotation | Rotation around the white, in radians. |
| [in] | saturation | Radial scaling of the distance to the white, by 1 + saturation. |
| [out] | point_normalized | Resulting chromaticity, normalized in the affine plane. |
Definition at line 507 of file channelmixerrgb_shared.c.
References _affine_unproject_difference(), _rotate_2d(), DT_IOP_CHANNELMIXER_SHARED_SIMPLE_EPS, FALSE, reference(), and TRUE.
Referenced by dt_iop_channelmixer_shared_white_preserving_to_matrix().
|
static |
Read back the rotation and saturation of one white-preserving primary.
| [in] | white_normalized | Basis white, normalized in the affine plane. |
| [in] | reference_primaries | Affine coordinates of the three basis primaries. |
| [in] | reference_index | Which primary is being read. |
| [in] | point_normalized | Chromaticity of the mixer column, normalized in the affine plane. |
| [out] | rotation | Rotation around the white, in radians. |
| [out] | saturation | Radial scaling of the distance to the white, minus one. |
Definition at line 540 of file channelmixerrgb_shared.c.
References _affine_project_difference(), DT_IOP_CHANNELMIXER_SHARED_SIMPLE_EPS, dt_iop_channelmixer_shared_wrap_pi(), FALSE, reference(), and TRUE.
Referenced by dt_iop_channelmixer_shared_white_preserving_from_matrix().
| float dt_iop_channelmixer_shared_decode_simple_coupling_amount | ( | const float | slider | ) |
Definition at line 68 of file channelmixerrgb_shared.c.
References DT_IOP_CHANNELMIXER_SHARED_SIMPLE_TAN_SCALE.
Referenced by dt_iop_channelmixer_shared_paint_simple_sliders(), and dt_iop_channelmixer_shared_simple_from_sliders().
| float dt_iop_channelmixer_shared_decode_simple_stretch | ( | const float | slider | ) |
Definition at line 56 of file channelmixerrgb_shared.c.
Referenced by dt_iop_channelmixer_shared_paint_simple_sliders(), and dt_iop_channelmixer_shared_simple_from_sliders().
| float dt_iop_channelmixer_shared_encode_simple_coupling_amount | ( | const float | amount | ) |
Definition at line 63 of file channelmixerrgb_shared.c.
References DT_IOP_CHANNELMIXER_SHARED_SIMPLE_TAN_SCALE.
Referenced by dt_iop_channelmixer_shared_simple_to_sliders().
| float dt_iop_channelmixer_shared_encode_simple_stretch | ( | const float | stretch | ) |
Definition at line 49 of file channelmixerrgb_shared.c.
Referenced by dt_iop_channelmixer_shared_simple_to_sliders().
| gboolean dt_iop_channelmixer_shared_get_matrix | ( | const float | rows[3][3], |
| const gboolean | normalize[3], | ||
| const gboolean | force_normalize, | ||
| float | M[3][3] | ||
| ) |
Definition at line 152 of file channelmixerrgb_shared.c.
References FALSE, M, normalize(), row, and TRUE.
Referenced by _build_point_transform(), _channelmixerrgb_mixer_mode_callback(), _channelmixerrgb_sync_primaries_from_params(), _channelmixerrgb_sync_simple_from_params(), _channelmixerrgb_sync_white_preserving_from_params(), _sync_primaries_from_params(), _sync_simple_from_params(), and _sync_white_preserving_from_params().
| void dt_iop_channelmixer_shared_module_color_to_display | ( | const float | module_color[3], |
| const dt_adaptation_t | adaptation, | ||
| const dt_iop_order_iccprofile_info_t *const | work_profile, | ||
| const dt_iop_order_iccprofile_info_t *const | display_profile, | ||
| float | display_rgb[3] | ||
| ) |
Definition at line 879 of file channelmixerrgb_shared.c.
References adaptation, DT_ADAPTATION_RGB, dt_iop_channelmixer_shared_work_rgb_to_display(), and LMS.
Referenced by _paint_RGB_slider_stop(), dt_iop_channelmixer_shared_paint_primaries_sliders(), dt_iop_channelmixer_shared_paint_simple_sliders(), and dt_iop_channelmixer_shared_paint_white_preserving_sliders().
| void dt_iop_channelmixer_shared_mul3x3 | ( | const float | A[3][3], |
| const float | B[3][3], | ||
| float | C[3][3] | ||
| ) |
Definition at line 177 of file channelmixerrgb_shared.c.
References A, B, C, k, and row.
Referenced by _build_point_transform(), _mixer_from_chroma_basis(), and _mixer_to_chroma_basis().
| void dt_iop_channelmixer_shared_paint_primaries_sliders | ( | const dt_adaptation_t | adaptation, |
| const dt_iop_order_iccprofile_info_t *const | work_profile, | ||
| const dt_iop_order_iccprofile_info_t *const | display_profile, | ||
| const dt_iop_channelmixer_shared_primaries_basis_t | basis, | ||
| const dt_iop_channelmixer_shared_primaries_params_t *const | primaries, | ||
| GtkWidget *const | widgets[9] | ||
| ) |
Definition at line 1123 of file channelmixerrgb_shared.c.
References _shared_primaries_probe_color(), dt_iop_channelmixer_shared_primaries_params_t::achromatic_hue, dt_iop_channelmixer_shared_primaries_params_t::achromatic_purity, adaptation, dt_iop_channelmixer_shared_primaries_params_t::blue_hue, dt_iop_channelmixer_shared_primaries_params_t::blue_purity, dt_bauhaus_slider_clear_stops(), dt_bauhaus_slider_get_hard_max(), dt_bauhaus_slider_get_hard_min(), DT_BAUHAUS_SLIDER_MAX_STOPS, dt_bauhaus_slider_set_stop(), dt_iop_channelmixer_shared_module_color_to_display(), dt_iop_channelmixer_shared_primaries_to_matrix(), dt_iop_channelmixer_shared_primaries_params_t::gain, dt_iop_channelmixer_shared_primaries_params_t::green_hue, dt_iop_channelmixer_shared_primaries_params_t::green_purity, i, M, dt_iop_channelmixer_shared_primaries_params_t::red_hue, dt_iop_channelmixer_shared_primaries_params_t::red_purity, and value.
Referenced by _channelmixerrgb_update_primaries_colors(), and _update_point_slider_colors().
| void dt_iop_channelmixer_shared_paint_row_sliders | ( | dt_adaptation_t | adaptation, |
| const dt_iop_order_iccprofile_info_t *const | work_profile, | ||
| const dt_iop_order_iccprofile_info_t *const | display_profile, | ||
| const float | r, | ||
| const float | g, | ||
| const float | b, | ||
| const gboolean | normalize, | ||
| const float | row[3], | ||
| GtkWidget *const | widgets[3] | ||
| ) |
Definition at line 931 of file channelmixerrgb_shared.c.
References _paint_RGB_slider_stop(), adaptation, dt_bauhaus_slider_clear_stops(), dt_bauhaus_slider_get_hard_max(), dt_bauhaus_slider_get_hard_min(), DT_BAUHAUS_SLIDER_MAX_STOPS, g, i, normalize(), r, RGB, and row.
Referenced by _update_point_slider_colors().
| void dt_iop_channelmixer_shared_paint_simple_sliders | ( | const dt_adaptation_t | adaptation, |
| const dt_iop_order_iccprofile_info_t *const | work_profile, | ||
| const dt_iop_order_iccprofile_info_t *const | display_profile, | ||
| const dt_iop_channelmixer_shared_simple_params_t *const | simple, | ||
| GtkWidget *const | widgets[6] | ||
| ) |
Definition at line 1014 of file channelmixerrgb_shared.c.
References _shared_paint_probe_matrix(), _shared_simple_hue_probe(), adaptation, dt_iop_channelmixer_shared_simple_params_t::coupling_amount, dt_iop_channelmixer_shared_simple_params_t::coupling_hue, dt_bauhaus_slider_clear_stops(), DT_BAUHAUS_SLIDER_MAX_STOPS, dt_bauhaus_slider_set_stop(), dt_iop_channelmixer_shared_decode_simple_coupling_amount(), dt_iop_channelmixer_shared_decode_simple_stretch(), DT_IOP_CHANNELMIXER_SHARED_INV_SQRT_3, dt_iop_channelmixer_shared_module_color_to_display(), DT_IOP_CHANNELMIXER_SHARED_SIMPLE_CHROMA_PROBE, DT_IOP_CHANNELMIXER_SHARED_SIMPLE_PROBE_AXIS_1, DT_IOP_CHANNELMIXER_SHARED_SIMPLE_PROBE_AXIS_2, DT_IOP_CHANNELMIXER_SHARED_SIMPLE_PROBE_ROTATION, dt_iop_channelmixer_shared_simple_probe_source(), dt_iop_channelmixer_shared_simple_to_matrix(), i, M, M_PI, P, dt_iop_channelmixer_shared_simple_params_t::psi, row, dt_iop_channelmixer_shared_simple_params_t::stretch_1, dt_iop_channelmixer_shared_simple_params_t::stretch_2, and dt_iop_channelmixer_shared_simple_params_t::theta.
Referenced by _channelmixerrgb_update_simple_colors(), and _update_point_slider_colors().
| void dt_iop_channelmixer_shared_paint_temperature_slider | ( | GtkWidget *const | widget, |
| const float | temperature_min, | ||
| const float | temperature_max | ||
| ) |
Definition at line 897 of file channelmixerrgb_shared.c.
References dt_bauhaus_slider_clear_stops(), DT_BAUHAUS_SLIDER_MAX_STOPS, dt_bauhaus_slider_set_stop(), i, illuminant_CCT_to_RGB(), and RGB.
Referenced by _auto_set_illuminant(), _develop_ui_pipe_finished_callback(), _update_point_slider_colors(), gui_changed(), and illum_xy_callback().
| void dt_iop_channelmixer_shared_paint_white_preserving_sliders | ( | const dt_adaptation_t | adaptation, |
| const dt_iop_order_iccprofile_info_t *const | work_profile, | ||
| const dt_iop_order_iccprofile_info_t *const | display_profile, | ||
| const dt_iop_channelmixer_shared_primaries_basis_t | basis, | ||
| const dt_iop_channelmixer_shared_white_preserving_params_t *const | white_preserving, | ||
| GtkWidget *const | widgets[6] | ||
| ) |
Definition at line 1190 of file channelmixerrgb_shared.c.
References adaptation, dt_iop_channelmixer_shared_white_preserving_params_t::blue_rotation, dt_iop_channelmixer_shared_white_preserving_params_t::blue_saturation, dt_bauhaus_slider_clear_stops(), dt_bauhaus_slider_get_hard_max(), dt_bauhaus_slider_get_hard_min(), DT_BAUHAUS_SLIDER_MAX_STOPS, dt_bauhaus_slider_set_stop(), dt_iop_channelmixer_shared_module_color_to_display(), dt_iop_channelmixer_shared_white_preserving_to_matrix(), dt_iop_channelmixer_shared_white_preserving_params_t::green_rotation, dt_iop_channelmixer_shared_white_preserving_params_t::green_saturation, i, M, dt_iop_channelmixer_shared_white_preserving_params_t::red_rotation, dt_iop_channelmixer_shared_white_preserving_params_t::red_saturation, row, and value.
Referenced by _channelmixerrgb_update_white_preserving_colors(), and _update_point_slider_colors().
| dt_iop_channelmixer_shared_primaries_basis_t dt_iop_channelmixer_shared_primaries_basis_from_adaptation | ( | const dt_adaptation_t | adaptation | ) |
Definition at line 310 of file channelmixerrgb_shared.c.
References adaptation, DT_ADAPTATION_CAT16, DT_ADAPTATION_FULL_BRADFORD, DT_ADAPTATION_LAST, DT_ADAPTATION_LINEAR_BRADFORD, DT_ADAPTATION_RGB, DT_ADAPTATION_XYZ, DT_IOP_CHANNELMIXER_SHARED_PRIMARIES_BASIS_BRADFORD, DT_IOP_CHANNELMIXER_SHARED_PRIMARIES_BASIS_CAT16, DT_IOP_CHANNELMIXER_SHARED_PRIMARIES_BASIS_RGB, and DT_IOP_CHANNELMIXER_SHARED_PRIMARIES_BASIS_XYZ.
Referenced by _channelmixerrgb_primaries_slider_callback(), _channelmixerrgb_sync_primaries_from_params(), _channelmixerrgb_sync_white_preserving_from_params(), _channelmixerrgb_update_primaries_colors(), _channelmixerrgb_update_white_preserving_colors(), and _channelmixerrgb_white_preserving_slider_callback().
| gboolean dt_iop_channelmixer_shared_primaries_from_matrix | ( | const dt_iop_channelmixer_shared_primaries_basis_t | basis, |
| const float | M[3][3], | ||
| dt_iop_channelmixer_shared_primaries_params_t * | primaries | ||
| ) |
Definition at line 630 of file channelmixerrgb_shared.c.
References _affine_normalize(), _affine_polar_from_point(), _affine_sum3(), _build_affine_simplex(), _primaries_reference_white(), dt_iop_channelmixer_shared_primaries_params_t::achromatic_hue, dt_iop_channelmixer_shared_primaries_params_t::achromatic_purity, dt_iop_channelmixer_shared_primaries_params_t::blue_hue, dt_iop_channelmixer_shared_primaries_params_t::blue_purity, DT_IOP_CHANNELMIXER_SHARED_SIMPLE_EPS, FALSE, dt_iop_channelmixer_shared_primaries_params_t::gain, dt_iop_channelmixer_shared_primaries_params_t::green_hue, dt_iop_channelmixer_shared_primaries_params_t::green_purity, M, mat3SSEinv(), dt_iop_channelmixer_shared_primaries_params_t::red_hue, dt_iop_channelmixer_shared_primaries_params_t::red_purity, row, and TRUE.
Referenced by _channelmixerrgb_sync_primaries_from_params(), and _sync_primaries_from_params().
| void dt_iop_channelmixer_shared_primaries_from_sliders | ( | GtkWidget *const | widgets[9], |
| dt_iop_channelmixer_shared_primaries_params_t * | primaries | ||
| ) |
Definition at line 96 of file channelmixerrgb_shared.c.
References dt_iop_channelmixer_shared_primaries_params_t::achromatic_hue, dt_iop_channelmixer_shared_primaries_params_t::achromatic_purity, dt_iop_channelmixer_shared_primaries_params_t::blue_hue, dt_iop_channelmixer_shared_primaries_params_t::blue_purity, dt_bauhaus_slider_get(), dt_iop_channelmixer_shared_primaries_params_t::gain, dt_iop_channelmixer_shared_primaries_params_t::green_hue, dt_iop_channelmixer_shared_primaries_params_t::green_purity, dt_iop_channelmixer_shared_primaries_params_t::red_hue, and dt_iop_channelmixer_shared_primaries_params_t::red_purity.
Referenced by _channelmixerrgb_primaries_slider_callback(), _channelmixerrgb_update_primaries_colors(), _primaries_slider_callback(), and _update_point_slider_colors().
| gboolean dt_iop_channelmixer_shared_primaries_to_matrix | ( | const dt_iop_channelmixer_shared_primaries_basis_t | basis, |
| const dt_iop_channelmixer_shared_primaries_params_t * | primaries, | ||
| float | M[3][3] | ||
| ) |
Definition at line 572 of file channelmixerrgb_shared.c.
References _affine_point_from_polar(), _affine_sum3(), _build_affine_simplex(), _primaries_reference_white(), dt_iop_channelmixer_shared_primaries_params_t::achromatic_hue, dt_iop_channelmixer_shared_primaries_params_t::achromatic_purity, dt_iop_channelmixer_shared_primaries_params_t::blue_hue, dt_iop_channelmixer_shared_primaries_params_t::blue_purity, DT_IOP_CHANNELMIXER_SHARED_SIMPLE_EPS, FALSE, dt_iop_channelmixer_shared_primaries_params_t::gain, dt_iop_channelmixer_shared_primaries_params_t::green_hue, dt_iop_channelmixer_shared_primaries_params_t::green_purity, M, mat3SSEinv(), dt_iop_channelmixer_shared_primaries_params_t::red_hue, dt_iop_channelmixer_shared_primaries_params_t::red_purity, row, and TRUE.
Referenced by _channelmixerrgb_primaries_slider_callback(), _channelmixerrgb_sync_primaries_from_params(), _primaries_slider_callback(), _sync_primaries_from_params(), and dt_iop_channelmixer_shared_paint_primaries_sliders().
| void dt_iop_channelmixer_shared_primaries_to_sliders | ( | const dt_iop_channelmixer_shared_primaries_params_t *const | primaries, |
| GtkWidget *const | widgets[9] | ||
| ) |
Definition at line 110 of file channelmixerrgb_shared.c.
References dt_iop_channelmixer_shared_primaries_params_t::achromatic_hue, dt_iop_channelmixer_shared_primaries_params_t::achromatic_purity, dt_iop_channelmixer_shared_primaries_params_t::blue_hue, dt_iop_channelmixer_shared_primaries_params_t::blue_purity, dt_bauhaus_slider_set(), dt_iop_channelmixer_shared_primaries_params_t::gain, dt_iop_channelmixer_shared_primaries_params_t::green_hue, dt_iop_channelmixer_shared_primaries_params_t::green_purity, dt_iop_channelmixer_shared_primaries_params_t::red_hue, and dt_iop_channelmixer_shared_primaries_params_t::red_purity.
Referenced by _channelmixerrgb_sync_primaries_from_params(), and _sync_primaries_from_params().
| float dt_iop_channelmixer_shared_roundtrip_error | ( | const float | M[3][3], |
| const float | roundtrip[3][3] | ||
| ) |
Definition at line 274 of file channelmixerrgb_shared.c.
References M, max_error(), and row.
Referenced by _channelmixerrgb_sync_primaries_from_params(), _channelmixerrgb_sync_simple_from_params(), _sync_primaries_from_params(), _sync_simple_from_params(), and dt_iop_channelmixer_shared_roundtrip_error_relative().
| float dt_iop_channelmixer_shared_roundtrip_error_relative | ( | const float | M[3][3], |
| const float | roundtrip[3][3] | ||
| ) |
Roundtrip error, measured against the magnitude of the matrix itself.
A reduced mixer model is a reparametrization, so the question its gate asks is whether the rebuilt matrix is the SAME matrix, which is a relative question. Comparing an absolute coefficient difference against a fixed tolerance silently demands more and more precision as the coefficients grow, and the white-preserving model can legitimately produce large ones : two primaries rotated onto the same ray make the chromaticity basis near-singular, which inflates the column scales that the white constraint solves for. The denominator is floored at 1 so ordinary, near-identity matrices keep the plain absolute behaviour.
| [in] | M | Original mixer matrix. |
| [in] | roundtrip | Matrix rebuilt from the parameters read back from M. |
Definition at line 299 of file channelmixerrgb_shared.c.
References dt_iop_channelmixer_shared_roundtrip_error(), M, and row.
Referenced by _channelmixerrgb_sync_white_preserving_from_params(), and _sync_white_preserving_from_params().
| gboolean dt_iop_channelmixer_shared_rows_are_normalized | ( | const gboolean | normalize[3] | ) |
Definition at line 147 of file channelmixerrgb_shared.c.
References normalize().
Referenced by _channelmixerrgb_sync_simple_from_params(), _sync_simple_from_params(), and gui_changed().
| void dt_iop_channelmixer_shared_set_matrix | ( | float | rows[3][3], |
| const float | M[3][3] | ||
| ) |
Definition at line 170 of file channelmixerrgb_shared.c.
| void dt_iop_channelmixer_shared_simple_from_matrix | ( | const float | M[3][3], |
| dt_iop_channelmixer_shared_simple_params_t * | simple | ||
| ) |
Definition at line 221 of file channelmixerrgb_shared.c.
References _mixer_to_chroma_basis(), B, dt_iop_channelmixer_shared_simple_params_t::coupling_amount, dt_iop_channelmixer_shared_simple_params_t::coupling_hue, d, dt_iop_channelmixer_shared_wrap_half_pi(), dt_iop_channelmixer_shared_wrap_pi(), M, dt_iop_channelmixer_shared_simple_params_t::psi, dt_iop_channelmixer_shared_simple_params_t::stretch_1, dt_iop_channelmixer_shared_simple_params_t::stretch_2, and dt_iop_channelmixer_shared_simple_params_t::theta.
Referenced by _channelmixerrgb_sync_simple_from_params(), and _sync_simple_from_params().
| void dt_iop_channelmixer_shared_simple_from_sliders | ( | GtkWidget *const | widgets[6], |
| dt_iop_channelmixer_shared_simple_params_t * | simple | ||
| ) |
Definition at line 74 of file channelmixerrgb_shared.c.
References dt_iop_channelmixer_shared_simple_params_t::coupling_amount, dt_iop_channelmixer_shared_simple_params_t::coupling_hue, dt_bauhaus_slider_get(), dt_iop_channelmixer_shared_decode_simple_coupling_amount(), dt_iop_channelmixer_shared_decode_simple_stretch(), M_PI, dt_iop_channelmixer_shared_simple_params_t::psi, dt_iop_channelmixer_shared_simple_params_t::stretch_1, dt_iop_channelmixer_shared_simple_params_t::stretch_2, and dt_iop_channelmixer_shared_simple_params_t::theta.
Referenced by _channelmixerrgb_simple_slider_callback(), _channelmixerrgb_update_simple_colors(), _simple_slider_callback(), and _update_point_slider_colors().
| void dt_iop_channelmixer_shared_simple_probe_source | ( | const dt_iop_channelmixer_shared_simple_probe_t | probe, |
| float | source[3] | ||
| ) |
Definition at line 814 of file channelmixerrgb_shared.c.
References DT_IOP_CHANNELMIXER_SHARED_INV_SQRT_3, DT_IOP_CHANNELMIXER_SHARED_SIMPLE_CHROMA_PROBE, DT_IOP_CHANNELMIXER_SHARED_SIMPLE_PROBE_AXIS_1, DT_IOP_CHANNELMIXER_SHARED_SIMPLE_PROBE_AXIS_2, DT_IOP_CHANNELMIXER_SHARED_SIMPLE_PROBE_ROTATION, P, and row.
Referenced by dt_iop_channelmixer_shared_paint_simple_sliders().
| void dt_iop_channelmixer_shared_simple_to_matrix | ( | const dt_iop_channelmixer_shared_simple_params_t *const | simple, |
| float | M[3][3] | ||
| ) |
Definition at line 253 of file channelmixerrgb_shared.c.
References _mixer_from_chroma_basis(), B, dt_iop_channelmixer_shared_simple_params_t::coupling_amount, dt_iop_channelmixer_shared_simple_params_t::coupling_hue, M, dt_iop_channelmixer_shared_simple_params_t::psi, dt_iop_channelmixer_shared_simple_params_t::stretch_1, dt_iop_channelmixer_shared_simple_params_t::stretch_2, and dt_iop_channelmixer_shared_simple_params_t::theta.
Referenced by _channelmixerrgb_simple_slider_callback(), _channelmixerrgb_sync_simple_from_params(), _simple_slider_callback(), _sync_simple_from_params(), and dt_iop_channelmixer_shared_paint_simple_sliders().
| void dt_iop_channelmixer_shared_simple_to_sliders | ( | const dt_iop_channelmixer_shared_simple_params_t *const | simple, |
| GtkWidget *const | widgets[6] | ||
| ) |
Definition at line 85 of file channelmixerrgb_shared.c.
References dt_iop_channelmixer_shared_simple_params_t::coupling_amount, dt_iop_channelmixer_shared_simple_params_t::coupling_hue, dt_bauhaus_slider_set(), dt_iop_channelmixer_shared_encode_simple_coupling_amount(), dt_iop_channelmixer_shared_encode_simple_stretch(), dt_iop_channelmixer_shared_wrap_half_pi(), dt_iop_channelmixer_shared_wrap_pi(), M_PI, dt_iop_channelmixer_shared_simple_params_t::psi, dt_iop_channelmixer_shared_simple_params_t::stretch_1, dt_iop_channelmixer_shared_simple_params_t::stretch_2, and dt_iop_channelmixer_shared_simple_params_t::theta.
Referenced by _channelmixerrgb_sync_simple_from_params(), and _sync_simple_from_params().
| gboolean dt_iop_channelmixer_shared_white_preserving_from_matrix | ( | const dt_iop_channelmixer_shared_primaries_basis_t | basis, |
| const float | M[3][3], | ||
| dt_iop_channelmixer_shared_white_preserving_params_t * | white_preserving | ||
| ) |
Read a white-preserving primaries state back from a mixer matrix.
Only the column DIRECTIONS are read here, so this succeeds for any matrix whose columns have a non-zero affine sum, white-preserving or not. Callers must gate on the roundtrip error against dt_iop_channelmixer_shared_white_preserving_to_matrix() to know whether the matrix actually sits on the white-preserving submanifold : a matrix that moves the white reconstructs to a different one, exactly like the other reduced mixer models.
| [in] | basis | Affine basis the mixer operates in, from the module's adaptation. |
| [in] | M | Mixer matrix. |
| [out] | white_preserving | Per-primary rotations and saturations. |
Definition at line 784 of file channelmixerrgb_shared.c.
References _affine_normalize(), _build_affine_simplex(), _white_preserving_polar_from_point(), dt_iop_channelmixer_shared_white_preserving_params_t::blue_rotation, dt_iop_channelmixer_shared_white_preserving_params_t::blue_saturation, FALSE, dt_iop_channelmixer_shared_white_preserving_params_t::green_rotation, dt_iop_channelmixer_shared_white_preserving_params_t::green_saturation, M, dt_iop_channelmixer_shared_white_preserving_params_t::red_rotation, dt_iop_channelmixer_shared_white_preserving_params_t::red_saturation, and TRUE.
Referenced by _channelmixerrgb_sync_white_preserving_from_params(), and _sync_white_preserving_from_params().
| void dt_iop_channelmixer_shared_white_preserving_from_sliders | ( | GtkWidget *const | widgets[6], |
| dt_iop_channelmixer_shared_white_preserving_params_t * | white_preserving | ||
| ) |
Definition at line 124 of file channelmixerrgb_shared.c.
References dt_iop_channelmixer_shared_white_preserving_params_t::blue_rotation, dt_iop_channelmixer_shared_white_preserving_params_t::blue_saturation, dt_bauhaus_slider_get(), dt_iop_channelmixer_shared_white_preserving_params_t::green_rotation, dt_iop_channelmixer_shared_white_preserving_params_t::green_saturation, dt_iop_channelmixer_shared_white_preserving_params_t::red_rotation, and dt_iop_channelmixer_shared_white_preserving_params_t::red_saturation.
Referenced by _channelmixerrgb_update_white_preserving_colors(), _channelmixerrgb_white_preserving_slider_callback(), _update_point_slider_colors(), and _white_preserving_slider_callback().
| gboolean dt_iop_channelmixer_shared_white_preserving_to_matrix | ( | const dt_iop_channelmixer_shared_primaries_basis_t | basis, |
| const dt_iop_channelmixer_shared_white_preserving_params_t *const | white_preserving, | ||
| float | M[3][3] | ||
| ) |
Build the mixer matrix of a white-preserving primaries state.
The three rotated and rescaled chromaticities give the DIRECTION of each mixer column. Their magnitudes are then solved from the single constraint that the basis white maps to itself : with t = P^-1 . w (P holding the chromaticities in columns), column c of the matrix is t_c / w_c times chromaticity c, and M . w == w holds by construction.
| [in] | basis | Affine basis the mixer operates in, from the module's adaptation. |
| [in] | white_preserving | Per-primary rotations and saturations. |
| [out] | M | Resulting mixer matrix. |
Definition at line 707 of file channelmixerrgb_shared.c.
References _affine_project_difference(), _affine_triangle_area(), _build_affine_simplex(), _primaries_reference_white(), _white_preserving_point_from_polar(), dt_iop_channelmixer_shared_white_preserving_params_t::blue_rotation, dt_iop_channelmixer_shared_white_preserving_params_t::blue_saturation, DT_IOP_CHANNELMIXER_SHARED_MIN_FOOTPRINT, DT_IOP_CHANNELMIXER_SHARED_SIMPLE_EPS, FALSE, dt_iop_channelmixer_shared_white_preserving_params_t::green_rotation, dt_iop_channelmixer_shared_white_preserving_params_t::green_saturation, M, mat3SSEinv(), dt_iop_channelmixer_shared_white_preserving_params_t::red_rotation, dt_iop_channelmixer_shared_white_preserving_params_t::red_saturation, row, and TRUE.
Referenced by _channelmixerrgb_sync_white_preserving_from_params(), _channelmixerrgb_white_preserving_slider_callback(), _sync_white_preserving_from_params(), _white_preserving_slider_callback(), and dt_iop_channelmixer_shared_paint_white_preserving_sliders().
| void dt_iop_channelmixer_shared_white_preserving_to_sliders | ( | const dt_iop_channelmixer_shared_white_preserving_params_t *const | white_preserving, |
| GtkWidget *const | widgets[6] | ||
| ) |
Definition at line 135 of file channelmixerrgb_shared.c.
References dt_iop_channelmixer_shared_white_preserving_params_t::blue_rotation, dt_iop_channelmixer_shared_white_preserving_params_t::blue_saturation, dt_bauhaus_slider_set(), dt_iop_channelmixer_shared_white_preserving_params_t::green_rotation, dt_iop_channelmixer_shared_white_preserving_params_t::green_saturation, dt_iop_channelmixer_shared_white_preserving_params_t::red_rotation, and dt_iop_channelmixer_shared_white_preserving_params_t::red_saturation.
Referenced by _channelmixerrgb_sync_white_preserving_from_params(), and _sync_white_preserving_from_params().
| void dt_iop_channelmixer_shared_work_rgb_to_display | ( | const dt_aligned_pixel_t | work_rgb, |
| const dt_iop_order_iccprofile_info_t *const | work_profile, | ||
| const dt_iop_order_iccprofile_info_t *const | display_profile, | ||
| dt_aligned_pixel_t | display_rgb | ||
| ) |
Definition at line 848 of file channelmixerrgb_shared.c.
References _normalize_linear_display_rgb(), dt_apply_transposed_color_matrix(), IS_NULL_PTR, dt_iop_order_iccprofile_info_t::lut_in, dt_iop_order_iccprofile_info_t::lut_out, dt_iop_order_iccprofile_info_t::lutsize, dt_iop_order_iccprofile_info_t::matrix_in_transposed, dt_iop_order_iccprofile_info_t::matrix_out_transposed, dt_iop_order_iccprofile_info_t::nonlinearlut, and XYZ.
Referenced by _convert_GUI_colors(), _render_preview_surface(), and dt_iop_channelmixer_shared_module_color_to_display().
| float dt_iop_channelmixer_shared_wrap_half_pi | ( | float | angle | ) |
Definition at line 42 of file channelmixerrgb_shared.c.
References M_PI.
Referenced by dt_iop_channelmixer_shared_simple_from_matrix(), and dt_iop_channelmixer_shared_simple_to_sliders().
| float dt_iop_channelmixer_shared_wrap_pi | ( | float | angle | ) |
Definition at line 35 of file channelmixerrgb_shared.c.
References M_PI.
Referenced by _affine_polar_from_point(), _white_preserving_polar_from_point(), dt_iop_channelmixer_shared_simple_from_matrix(), and dt_iop_channelmixer_shared_simple_to_sliders().