![]() |
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:
|
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.
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 |
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 |
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.
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 |
|
inlinestatic |
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 | ||
| ) |
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 | ||
| ) |
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] | ||
| ) |
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 | ||
| ) |
References out.
Referenced by dt_colorrings_rotate_around_axis().
| float dt_colorrings_curve_periodic_distance | ( | const float | x0, |
| const float | x1 | ||
| ) |
| 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.
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 | ) |
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 | ||
| ) |
Referenced by dt_colorrings_project_to_cube_shell().
| float dt_colorrings_dot3 | ( | const dt_aligned_pixel_t | a, |
| const dt_aligned_pixel_t | b | ||
| ) |
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.
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.
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 | ||
| ) |
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 | ||
| ) |
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 | ) |
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 | ||
| ) |
| void dt_colorrings_gray_basis_to_rgb | ( | const float | L, |
| const float | u, | ||
| const float | v, | ||
| float | rgb[3] | ||
| ) |
| 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 | ||
| ) |
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 | ||
| ) |
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 | ) |
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 | ) |
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 | ||
| ) |
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 | ||
| ) |
| 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 | ||
| ) |
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 | ||
| ) |
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 | ||
| ) |
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 | ||
| ) |
| float dt_colorrings_ring_axis_position_from_brightness | ( | const float | brightness, |
| const float | white, | ||
| const dt_iop_order_iccprofile_info_t * | profile | ||
| ) |
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 | ) |
| 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 | ||
| ) |
References dt_colorrings_cross3(), and dt_colorrings_dot3().
| float dt_colorrings_vector_norm3 | ( | const dt_aligned_pixel_t | vector | ) |
Referenced by dt_colorrings_normalize3(), and dt_colorrings_project_to_cube_shell().
| float dt_colorrings_wendland_c2 | ( | float | d | ) |
Referenced by dt_colorrings_eval_local_field(), and dt_colorrings_eval_sparse_local_field().
| float dt_colorrings_wrap_hue_2pi | ( | float | hue | ) |
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 | ) |
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 | ) |