![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
#include "common/colorequal_shared.h"#include "common/chromatic_adaptation.h"#include "common/curve_tools.h"#include "common/colorspaces_inline_conversions.h"#include "common/interpolation.h"#include "common/splines.h"#include <float.h>#include <math.h>#include <string.h>
Include dependency graph for colorequal_shared.c:Go to the source code of this file.
|
static |
The graph background should stay inside the preview gamut across the whole hue circle, so we binary-search the highest dt UCS saturation that keeps every sampled hue inside sRGB.
Definition at line 300 of file colorequal_shared.c.
References _dt_ucs_hsb_to_preview_rgb_unclamped(), dt_colorrings_curve_x_to_hue(), DT_COLORRINGS_HUE_SAMPLES, FALSE, RGB, and TRUE.
Referenced by dt_colorrings_compute_reference_saturations().
|
inlinestatic |
Definition at line 92 of file colorequal_shared.c.
References _profile_linear_rgb_to_display_rgb_normalized(), _xyz_d50_to_profile_linear_rgb(), RGB, XYZ_D50, XYZ_D65, and XYZ_D65_to_D50().
Referenced by dt_colorrings_hsb_to_display_rgb().
|
inlinestatic |
Definition at line 54 of file colorequal_shared.c.
References dt_XYZ_to_sRGB(), RGB, XYZ_D50, XYZ_D65, and XYZ_D65_to_D50().
Referenced by _compute_reference_saturation().
|
inlinestatic |
The GUI gradients are hue/chroma visual guides, not photometric previews. Keep in-gamut display colors untouched and only compress actual out-of-range linear RGB back into the unit cube before applying the display TRC. This keeps color equalizer and color primaries on the exact same display-rendering path.
Definition at line 64 of file colorequal_shared.c.
References for_each_channel, dt_iop_order_iccprofile_info_t::lut_out, dt_iop_order_iccprofile_info_t::lutsize, dt_iop_order_iccprofile_info_t::nonlinearlut, and RGB.
Referenced by _dt_ucs_hsb_to_display_rgb_normalized(), and dt_colorrings_profile_rgb_to_display_rgb().
|
inlinestatic |
Definition at line 44 of file colorequal_shared.c.
References dt_apply_transposed_color_matrix(), dt_iop_order_iccprofile_info_t::matrix_out_transposed, RGB, and XYZ_D50.
Referenced by _dt_ucs_hsb_to_display_rgb_normalized(), and dt_colorrings_profile_rgb_to_display_rgb().
|
inlinestatic |
Definition at line 31 of file colorequal_shared.c.
References dt_apply_transposed_color_matrix(), for_each_channel, dt_iop_order_iccprofile_info_t::lut_out, dt_iop_order_iccprofile_info_t::lutsize, dt_iop_order_iccprofile_info_t::matrix_out_transposed, dt_iop_order_iccprofile_info_t::nonlinearlut, RGB, and XYZ_D50.
Referenced by dt_colorrings_hsb_to_profile_rgb().
| gboolean dt_colorrings_apply_rgb_lut | ( | const dt_aligned_pixel_t | input_rgb, |
| const float | white_level, | ||
| const dt_iop_order_iccprofile_info_t * | work_profile, | ||
| const dt_iop_order_iccprofile_info_t * | lut_profile, | ||
| const float * | clut, | ||
| const uint16_t | clut_level, | ||
| dt_pthread_rwlock_t * | clut_lock, | ||
| const dt_lut3d_interpolation_t | interpolation, | ||
| dt_aligned_pixel_t | output_rgb | ||
| ) |
Definition at line 175 of file colorequal_shared.c.
References dt_ioppr_transform_image_colorspace_rgb(), dt_lut3d_apply(), dt_pthread_rwlock_rdlock, dt_pthread_rwlock_unlock, FALSE, IS_NULL_PTR, and TRUE.
Referenced by _refresh_preview_cursor_sample().
| void dt_colorrings_brightness_to_axis_rgb | ( | const float | brightness, |
| const float | white, | ||
| const dt_iop_order_iccprofile_info_t * | profile, | ||
| dt_aligned_pixel_t | RGB | ||
| ) |
Definition at line 356 of file colorequal_shared.c.
References dt_colorrings_ring_axis_position_from_brightness(), and RGB.
Referenced by _build_anchor_from_source_rgb(), _build_clut(), _build_viewer_control_nodes(), _refresh_slider_gradients(), and _sample_ring_anchor().
| void dt_colorrings_compute_reference_saturations | ( | const float | white, |
| float | reference_saturation[DT_COLORRINGS_NUM_RINGS] | ||
| ) |
Definition at line 338 of file colorequal_shared.c.
References _compute_reference_saturation(), DT_COLORRINGS_NUM_RINGS, and dt_colorrings_ring_brightness().
Referenced by _build_clut(), _build_viewer_control_nodes(), and _draw_curve().
| void dt_colorrings_cross3 | ( | const dt_aligned_pixel_t | a, |
| const dt_aligned_pixel_t | b, | ||
| dt_aligned_pixel_t | out | ||
| ) |
Definition at line 411 of file colorequal_shared.c.
References out.
Referenced by dt_colorrings_rotate_around_axis().
| float dt_colorrings_curve_periodic_distance | ( | const float | x0, |
| const float | x1 | ||
| ) |
Definition at line 133 of file colorequal_shared.c.
| float dt_colorrings_curve_periodic_sample | ( | const dt_colorrings_node_t * | curve, |
| const int | nodes, | ||
| const float | x | ||
| ) |
GUI state and history entries are expected to normalize the editable hue nodes before they reach the shared sampler. Keep the interpolation backend away from empty or degenerate anchor sets anyway so it never throws from the underlying C++ spline code while a module is still repairing its params.
Definition at line 153 of file colorequal_shared.c.
References DT_COLORRINGS_MAXNODES, interpolate_val_V2_periodic(), IS_NULL_PTR, k, MONOTONE_HERMITE, dt_colorrings_node_t::x, CurveAnchorPoint::x, x, dt_colorrings_node_t::y, and CurveAnchorPoint::y.
Referenced by _area_button_press_callback(), _build_clut(), _build_viewer_control_nodes(), _cursor_curve_state(), and button_pressed().
| float dt_colorrings_curve_x_to_hue | ( | const float | x | ) |
Definition at line 123 of file colorequal_shared.c.
References DT_COLORRINGS_ANGLE_SHIFT, dt_colorrings_wrap_hue_pi(), M_PI_F, and x.
Referenced by _build_clut(), _build_viewer_control_nodes(), _compute_reference_saturation(), _draw_curve(), and _graph_background_hsb().
| float dt_colorrings_distance_to_cube_shell | ( | const dt_aligned_pixel_t | axis, |
| const dt_aligned_pixel_t | direction | ||
| ) |
Definition at line 366 of file colorequal_shared.c.
Referenced by dt_colorrings_project_to_cube_shell().
| float dt_colorrings_dot3 | ( | const dt_aligned_pixel_t | a, |
| const dt_aligned_pixel_t | b | ||
| ) |
Definition at line 406 of file colorequal_shared.c.
Referenced by dt_colorrings_rotate_around_axis().
| void dt_colorrings_eval_local_field | ( | const float | x[3], |
| const float | anchor_L[DT_COLORRINGS_LOCAL_FIELD_RINGS][DT_COLORRINGS_HUE_SAMPLES], | ||
| const float | anchor_rho[DT_COLORRINGS_LOCAL_FIELD_RINGS][DT_COLORRINGS_HUE_SAMPLES], | ||
| const float | anchor_theta[DT_COLORRINGS_LOCAL_FIELD_RINGS][DT_COLORRINGS_HUE_SAMPLES], | ||
| const float | delta_L[DT_COLORRINGS_LOCAL_FIELD_RINGS][DT_COLORRINGS_HUE_SAMPLES], | ||
| const float | chroma_scale[DT_COLORRINGS_LOCAL_FIELD_RINGS][DT_COLORRINGS_HUE_SAMPLES], | ||
| const float | delta_theta[DT_COLORRINGS_LOCAL_FIELD_RINGS][DT_COLORRINGS_HUE_SAMPLES], | ||
| const float | inv_sigma_L, | ||
| const float | inv_sigma_rho, | ||
| const float | inv_sigma_theta, | ||
| const float | rho0, | ||
| float | out[3] | ||
| ) |
We loop over every sparse control node in the cylindrical basis to rebuild a dense displacement field directly inside the LUT RGB cube.
Definition at line 507 of file colorequal_shared.c.
References dt_colorrings_gray_axis_rgb_from_L(), dt_colorrings_gray_basis_to_rgb(), DT_COLORRINGS_HUE_SAMPLES, DT_COLORRINGS_LOCAL_FIELD_RINGS, dt_colorrings_project_to_cube_shell(), dt_colorrings_rgb_to_gray_cyl(), dt_colorrings_wendland_c2(), dt_colorrings_wrap_pi(), k, n, out, t, and x.
Referenced by dt_colorrings_fill_lut_local_field().
| void dt_colorrings_eval_sparse_local_field | ( | const float | x[3], |
| const dt_colorrings_sparse_anchor_t *const | anchors, | ||
| const int | anchor_count, | ||
| const float | inv_sigma_L, | ||
| const float | inv_sigma_rho, | ||
| const float | inv_sigma_theta, | ||
| const float | rho0, | ||
| float | out[3] | ||
| ) |
Sparse anchors let modules author their own control geometry while reusing the same RGB cylindrical local field as the original color rings. We therefore loop only over the caller-provided anchors instead of synthesizing fake ring samples that would bias the normalization.
Definition at line 623 of file colorequal_shared.c.
References dt_colorrings_sparse_anchor_t::chroma_scale, dt_colorrings_sparse_anchor_t::delta_L, dt_colorrings_sparse_anchor_t::delta_theta, dt_colorrings_gray_axis_rgb_from_L(), dt_colorrings_gray_basis_to_rgb(), dt_colorrings_project_to_cube_shell(), dt_colorrings_rgb_to_gray_cyl(), dt_colorrings_wendland_c2(), dt_colorrings_wrap_pi(), IS_NULL_PTR, k, dt_colorrings_sparse_anchor_t::L, out, dt_colorrings_sparse_anchor_t::rho, t, dt_colorrings_sparse_anchor_t::weight, and x.
Referenced by dt_colorrings_fill_lut_sparse_local_field().
| void dt_colorrings_fill_lut_local_field | ( | float * | lut, |
| const int | level, | ||
| const float | anchor_L[DT_COLORRINGS_LOCAL_FIELD_RINGS][DT_COLORRINGS_HUE_SAMPLES], | ||
| const float | anchor_rho[DT_COLORRINGS_LOCAL_FIELD_RINGS][DT_COLORRINGS_HUE_SAMPLES], | ||
| const float | anchor_theta[DT_COLORRINGS_LOCAL_FIELD_RINGS][DT_COLORRINGS_HUE_SAMPLES], | ||
| const float | delta_L[DT_COLORRINGS_LOCAL_FIELD_RINGS][DT_COLORRINGS_HUE_SAMPLES], | ||
| const float | chroma_scale[DT_COLORRINGS_LOCAL_FIELD_RINGS][DT_COLORRINGS_HUE_SAMPLES], | ||
| const float | delta_theta[DT_COLORRINGS_LOCAL_FIELD_RINGS][DT_COLORRINGS_HUE_SAMPLES], | ||
| const float | inv_sigma_L, | ||
| const float | inv_sigma_rho, | ||
| const float | inv_sigma_theta, | ||
| const float | rho0 | ||
| ) |
Definition at line 596 of file colorequal_shared.c.
References __OMP_PARALLEL_FOR__, d, dt_colorrings_eval_local_field(), g, lut, r, and x.
Referenced by _build_clut().
| void dt_colorrings_fill_lut_sparse_local_field | ( | float * | lut, |
| const int | level, | ||
| const dt_colorrings_sparse_anchor_t *const | anchors, | ||
| const int | anchor_count, | ||
| const float | inv_sigma_L, | ||
| const float | inv_sigma_rho, | ||
| const float | inv_sigma_theta, | ||
| const float | rho0 | ||
| ) |
Definition at line 704 of file colorequal_shared.c.
References __OMP_PARALLEL_FOR__, d, dt_colorrings_eval_sparse_local_field(), g, lut, r, and x.
Referenced by _build_clut().
| float dt_colorrings_graph_white | ( | void | ) |
Definition at line 105 of file colorequal_shared.c.
References Y_to_dt_UCS_L_star().
Referenced by _build_anchor_from_source_rgb(), _build_clut(), _build_edge_edit(), _build_halfway_extreme_anchor_from_source_rgb(), _build_halfway_radial_anchor_from_source_rgb(), _build_viewer_control_nodes(), _draw_curve(), _node_source_hsb(), _pipe_rgb_to_dt_ucs_hsb(), _refresh_slider_gradients(), and _set_slider_stop_from_hsb().
| void dt_colorrings_gray_axis_rgb_from_L | ( | const float | L, |
| dt_aligned_pixel_t | RGB | ||
| ) |
Definition at line 483 of file colorequal_shared.c.
Referenced by _apply_anchor_to_rgb(), _build_halfway_radial_anchor_from_source_rgb(), dt_colorrings_eval_local_field(), and dt_colorrings_eval_sparse_local_field().
| void dt_colorrings_gray_basis_to_rgb | ( | const float | L, |
| const float | u, | ||
| const float | v, | ||
| float | rgb[3] | ||
| ) |
Definition at line 464 of file colorequal_shared.c.
Referenced by _apply_anchor_to_rgb(), _halfway_to_axis_rgb(), dt_colorrings_eval_local_field(), and dt_colorrings_eval_sparse_local_field().
| void dt_colorrings_hsb_to_display_rgb | ( | const dt_aligned_pixel_t | HSB, |
| const float | white, | ||
| const dt_iop_order_iccprofile_info_t * | display_profile, | ||
| dt_aligned_pixel_t | RGB | ||
| ) |
Definition at line 218 of file colorequal_shared.c.
References _dt_ucs_hsb_to_display_rgb_normalized(), for_each_channel, and RGB.
Referenced by _draw_curve(), _draw_graph_background(), and _set_slider_stop_from_hsb().
| void dt_colorrings_hsb_to_profile_rgb | ( | const dt_aligned_pixel_t | HSB, |
| const float | white, | ||
| const dt_iop_order_iccprofile_info_t * | profile, | ||
| dt_aligned_pixel_t | RGB | ||
| ) |
Definition at line 208 of file colorequal_shared.c.
References _xyz_d50_to_profile_rgb(), RGB, XYZ_D50, XYZ_D65, and XYZ_D65_to_D50().
Referenced by _build_clut(), _build_viewer_control_nodes(), _refresh_slider_gradients(), and dt_colorrings_ring_axis_position_from_brightness().
| float dt_colorrings_hue_to_curve_x | ( | const float | hue | ) |
Definition at line 128 of file colorequal_shared.c.
References DT_COLORRINGS_ANGLE_SHIFT, dt_colorrings_wrap_hue_2pi(), and M_PI_F.
Referenced by _cursor_curve_state(), _draw_curve(), button_pressed(), and scrolled().
| void dt_colorrings_normalize3 | ( | dt_aligned_pixel_t | vector | ) |
Definition at line 419 of file colorequal_shared.c.
References dt_colorrings_vector_norm3().
| void dt_colorrings_profile_rgb_to_display_rgb | ( | const dt_aligned_pixel_t | RGB, |
| const dt_iop_order_iccprofile_info_t * | profile, | ||
| const dt_iop_order_iccprofile_info_t * | display_profile, | ||
| dt_aligned_pixel_t | display_rgb | ||
| ) |
Definition at line 225 of file colorequal_shared.c.
References _profile_linear_rgb_to_display_rgb_normalized(), _xyz_d50_to_profile_linear_rgb(), for_each_channel, 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, RGB, and XYZ_D50.
Referenced by _set_slider_stop_from_profile_rgb().
| void dt_colorrings_profile_rgb_to_dt_ucs_hsb | ( | const dt_aligned_pixel_t | RGB, |
| const float | white, | ||
| const dt_iop_order_iccprofile_info_t * | profile, | ||
| dt_aligned_pixel_t | HSB | ||
| ) |
Definition at line 272 of file colorequal_shared.c.
References dt_colorrings_profile_rgb_to_dt_ucs_jch(), dt_UCS_JCH_to_HSB(), and RGB.
Referenced by _build_anchor_from_source_rgb(), _build_edge_edit(), _build_halfway_extreme_anchor_from_source_rgb(), _build_halfway_radial_anchor_from_source_rgb(), _node_source_hsb(), and _pipe_rgb_to_dt_ucs_hsb().
| void dt_colorrings_profile_rgb_to_dt_ucs_jch | ( | const dt_aligned_pixel_t | RGB, |
| const float | white, | ||
| const dt_iop_order_iccprofile_info_t * | profile, | ||
| dt_aligned_pixel_t | JCH | ||
| ) |
Definition at line 244 of file colorequal_shared.c.
References dt_XYZ_to_xyY(), for_each_channel, IS_NULL_PTR, 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, RGB, xyY, xyY_to_dt_UCS_JCH(), XYZ_D50, XYZ_D50_to_D65(), and XYZ_D65.
Referenced by dt_colorrings_profile_rgb_to_dt_ucs_hsb().
| void dt_colorrings_profile_rgb_to_Ych | ( | const dt_aligned_pixel_t | RGB, |
| const dt_iop_order_iccprofile_info_t * | profile, | ||
| dt_aligned_pixel_t | Ych | ||
| ) |
Definition at line 280 of file colorequal_shared.c.
References IS_NULL_PTR, dt_iop_order_iccprofile_info_t::lut_in, dt_iop_order_iccprofile_info_t::lutsize, M_PI_F, dt_iop_order_iccprofile_info_t::matrix_in_transposed, dt_iop_order_iccprofile_info_t::nonlinearlut, RGB, XYZ_D50, XYZ_D50_to_D65(), and XYZ_D65.
Referenced by _pipe_rgb_to_Ych(), _pipe_rgb_to_Ych(), and autoset().
| void dt_colorrings_project_to_cube_shell | ( | const dt_aligned_pixel_t | axis, |
| dt_aligned_pixel_t | RGB | ||
| ) |
Definition at line 382 of file colorequal_shared.c.
References dt_colorrings_distance_to_cube_shell(), dt_colorrings_vector_norm3(), and RGB.
Referenced by _apply_anchor_to_rgb(), _build_clut(), _build_viewer_control_nodes(), _refresh_preview_cursor_sample(), _refresh_slider_gradients(), color_picker_apply(), dt_colorrings_eval_local_field(), and dt_colorrings_eval_sparse_local_field().
| void dt_colorrings_rgb_to_gray_cyl | ( | const float | rgb[3], |
| float * | L, | ||
| float * | rho, | ||
| float * | theta | ||
| ) |
Definition at line 441 of file colorequal_shared.c.
Referenced by _apply_anchor_to_rgb(), _build_anchor_from_source_rgb(), _build_clut(), _build_halfway_radial_anchor_from_source_rgb(), _halfway_to_axis_rgb(), dt_colorrings_eval_local_field(), and dt_colorrings_eval_sparse_local_field().
| float dt_colorrings_ring_axis_position_from_brightness | ( | const float | brightness, |
| const float | white, | ||
| const dt_iop_order_iccprofile_info_t * | profile | ||
| ) |
Definition at line 347 of file colorequal_shared.c.
References dt_colorrings_hsb_to_profile_rgb(), and RGB.
Referenced by dt_colorrings_brightness_to_axis_rgb().
| float dt_colorrings_ring_brightness | ( | const dt_colorrings_ring_t | ring | ) |
Definition at line 139 of file colorequal_shared.c.
References DT_COLORRINGS_RING_DARK, DT_COLORRINGS_RING_LIGHT, and DT_COLORRINGS_RING_MID.
Referenced by _build_clut(), _build_viewer_control_nodes(), _draw_curve(), _draw_graph_background(), _sample_ring_anchor(), and dt_colorrings_compute_reference_saturations().
| void dt_colorrings_rotate_around_axis | ( | const dt_aligned_pixel_t | input, |
| const dt_aligned_pixel_t | axis, | ||
| const float | cos_angle, | ||
| const float | sin_angle, | ||
| dt_aligned_pixel_t | output | ||
| ) |
Definition at line 429 of file colorequal_shared.c.
References dt_colorrings_cross3(), and dt_colorrings_dot3().
| float dt_colorrings_vector_norm3 | ( | const dt_aligned_pixel_t | vector | ) |
Definition at line 401 of file colorequal_shared.c.
Referenced by dt_colorrings_normalize3(), and dt_colorrings_project_to_cube_shell().
| float dt_colorrings_wendland_c2 | ( | float | d | ) |
Definition at line 492 of file colorequal_shared.c.
Referenced by dt_colorrings_eval_local_field(), and dt_colorrings_eval_sparse_local_field().
| float dt_colorrings_wrap_hue_2pi | ( | float | hue | ) |
Definition at line 110 of file colorequal_shared.c.
References M_PI_F.
Referenced by _refresh_slider_gradients(), _sample_ring_hue(), dt_colorrings_hue_to_curve_x(), and dt_colorrings_wrap_hue_pi().
| float dt_colorrings_wrap_hue_pi | ( | float | hue | ) |
Definition at line 117 of file colorequal_shared.c.
References dt_colorrings_wrap_hue_2pi(), and M_PI_F.
Referenced by _build_clut(), _build_viewer_control_nodes(), _graph_background_hsb(), _node_target_hsb(), _refresh_preview_cursor_sample(), color_picker_apply(), and dt_colorrings_curve_x_to_hue().
| float dt_colorrings_wrap_pi | ( | float | x | ) |
Definition at line 499 of file colorequal_shared.c.
Referenced by _build_anchor_from_source_rgb(), _build_clut(), _hsb_distance(), dt_colorrings_eval_local_field(), and dt_colorrings_eval_sparse_local_field().