Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
colorequal_shared.h File Reference
#include "common/dtpthread.h"
#include "common/iop_profile.h"
#include "common/lut3d.h"
+ Include dependency graph for colorequal_shared.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  dt_colorrings_node_t
 
struct  dt_colorrings_sparse_anchor_t
 

Macros

#define DT_COLORRINGS_ANGLE_SHIFT   +20.f
 
#define DT_COLORRINGS_NUM_RINGS   3
 
#define DT_COLORRINGS_MAXNODES   20
 
#define DT_COLORRINGS_DEFAULT_NODES   8
 
#define DT_COLORRINGS_HUE_SAMPLES   64
 
#define DT_COLORRINGS_CLUT_LEVEL   64
 
#define DT_COLORRINGS_LOCAL_FIELD_RINGS   (DT_COLORRINGS_NUM_RINGS + 1)
 

Typedefs

typedef enum dt_colorrings_ring_t dt_colorrings_ring_t
 
typedef struct dt_colorrings_node_t dt_colorrings_node_t
 
typedef struct dt_colorrings_sparse_anchor_t dt_colorrings_sparse_anchor_t
 

Enumerations

enum  dt_colorrings_ring_t {
  DT_COLORRINGS_RING_DARK = 0 ,
  DT_COLORRINGS_RING_MID = 1 ,
  DT_COLORRINGS_RING_LIGHT = 2
}
 

Functions

float dt_colorrings_graph_white (void)
 
float dt_colorrings_wrap_hue_2pi (float hue)
 
float dt_colorrings_wrap_hue_pi (float hue)
 
float dt_colorrings_curve_x_to_hue (float x)
 
float dt_colorrings_hue_to_curve_x (float hue)
 
float dt_colorrings_curve_periodic_distance (float x0, float x1)
 
float dt_colorrings_ring_brightness (dt_colorrings_ring_t ring)
 
float dt_colorrings_curve_periodic_sample (const dt_colorrings_node_t *curve, int nodes, float x)
 
gboolean dt_colorrings_apply_rgb_lut (const dt_aligned_pixel_t input_rgb, float white_level, const dt_iop_order_iccprofile_info_t *work_profile, const dt_iop_order_iccprofile_info_t *lut_profile, const float *clut, uint16_t clut_level, dt_pthread_rwlock_t *clut_lock, dt_lut3d_interpolation_t interpolation, dt_aligned_pixel_t output_rgb)
 
void dt_colorrings_hsb_to_profile_rgb (const dt_aligned_pixel_t HSB, float white, const dt_iop_order_iccprofile_info_t *profile, dt_aligned_pixel_t RGB)
 
void dt_colorrings_hsb_to_display_rgb (const dt_aligned_pixel_t HSB, float white, const dt_iop_order_iccprofile_info_t *display_profile, dt_aligned_pixel_t RGB)
 
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)
 
void dt_colorrings_profile_rgb_to_dt_ucs_hsb (const dt_aligned_pixel_t RGB, 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, float white, const dt_iop_order_iccprofile_info_t *profile, dt_aligned_pixel_t JCH)
 
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)
 
void dt_colorrings_compute_reference_saturations (float white, float reference_saturation[3])
 
float dt_colorrings_ring_axis_position_from_brightness (float brightness, float white, const dt_iop_order_iccprofile_info_t *profile)
 
void dt_colorrings_brightness_to_axis_rgb (float brightness, float white, const dt_iop_order_iccprofile_info_t *profile, dt_aligned_pixel_t RGB)
 
float dt_colorrings_distance_to_cube_shell (const dt_aligned_pixel_t axis, const dt_aligned_pixel_t direction)
 
void dt_colorrings_project_to_cube_shell (const dt_aligned_pixel_t axis, dt_aligned_pixel_t RGB)
 
float dt_colorrings_vector_norm3 (const dt_aligned_pixel_t vector)
 
float dt_colorrings_dot3 (const dt_aligned_pixel_t a, const dt_aligned_pixel_t b)
 
void dt_colorrings_cross3 (const dt_aligned_pixel_t a, const dt_aligned_pixel_t b, dt_aligned_pixel_t out)
 
void dt_colorrings_normalize3 (dt_aligned_pixel_t vector)
 
void dt_colorrings_rotate_around_axis (const dt_aligned_pixel_t input, const dt_aligned_pixel_t axis, float cos_angle, float sin_angle, dt_aligned_pixel_t output)
 
void dt_colorrings_rgb_to_gray_cyl (const float rgb[3], float *L, float *rho, float *theta)
 
void dt_colorrings_gray_basis_to_rgb (float L, float u, float v, float rgb[3])
 
void dt_colorrings_gray_axis_rgb_from_L (float L, dt_aligned_pixel_t RGB)
 
float dt_colorrings_wendland_c2 (float d)
 
float dt_colorrings_wrap_pi (float x)
 
void dt_colorrings_eval_local_field (const float x[3], const float anchor_L[(3+1)][64], const float anchor_rho[(3+1)][64], const float anchor_theta[(3+1)][64], const float delta_L[(3+1)][64], const float chroma_scale[(3+1)][64], const float delta_theta[(3+1)][64], float inv_sigma_L, float inv_sigma_rho, float inv_sigma_theta, float rho0, float out[3])
 
void dt_colorrings_fill_lut_local_field (float *lut, int level, const float anchor_L[(3+1)][64], const float anchor_rho[(3+1)][64], const float anchor_theta[(3+1)][64], const float delta_L[(3+1)][64], const float chroma_scale[(3+1)][64], const float delta_theta[(3+1)][64], float inv_sigma_L, float inv_sigma_rho, float inv_sigma_theta, float rho0)
 
void dt_colorrings_eval_sparse_local_field (const float x[3], const dt_colorrings_sparse_anchor_t *anchors, int anchor_count, float inv_sigma_L, float inv_sigma_rho, float inv_sigma_theta, float rho0, float out[3])
 
void dt_colorrings_fill_lut_sparse_local_field (float *lut, int level, const dt_colorrings_sparse_anchor_t *anchors, int anchor_count, float inv_sigma_L, float inv_sigma_rho, float inv_sigma_theta, float rho0)
 

Macro Definition Documentation

◆ DT_COLORRINGS_ANGLE_SHIFT

#define DT_COLORRINGS_ANGLE_SHIFT   +20.f

We keep the same GUI hue convention as the original color equalizer so the red primary sits at the left edge of the hue graphs.

◆ DT_COLORRINGS_CLUT_LEVEL

#define DT_COLORRINGS_CLUT_LEVEL   64

◆ DT_COLORRINGS_DEFAULT_NODES

#define DT_COLORRINGS_DEFAULT_NODES   8

◆ DT_COLORRINGS_HUE_SAMPLES

#define DT_COLORRINGS_HUE_SAMPLES   64

◆ DT_COLORRINGS_LOCAL_FIELD_RINGS

#define DT_COLORRINGS_LOCAL_FIELD_RINGS   (DT_COLORRINGS_NUM_RINGS + 1)

◆ DT_COLORRINGS_MAXNODES

#define DT_COLORRINGS_MAXNODES   20

◆ DT_COLORRINGS_NUM_RINGS

#define DT_COLORRINGS_NUM_RINGS   3

Typedef Documentation

◆ dt_colorrings_node_t

◆ dt_colorrings_ring_t

◆ dt_colorrings_sparse_anchor_t

Enumeration Type Documentation

◆ dt_colorrings_ring_t

Enumerator
DT_COLORRINGS_RING_DARK 
DT_COLORRINGS_RING_MID 
DT_COLORRINGS_RING_LIGHT 

Function Documentation

◆ dt_colorrings_apply_rgb_lut()

gboolean dt_colorrings_apply_rgb_lut ( const dt_aligned_pixel_t  input_rgb,
float  white_level,
const dt_iop_order_iccprofile_info_t work_profile,
const dt_iop_order_iccprofile_info_t lut_profile,
const float *  clut,
uint16_t  clut_level,
dt_pthread_rwlock_t clut_lock,
dt_lut3d_interpolation_t  interpolation,
dt_aligned_pixel_t  output_rgb 
)

◆ dt_colorrings_brightness_to_axis_rgb()

void dt_colorrings_brightness_to_axis_rgb ( float  brightness,
float  white,
const dt_iop_order_iccprofile_info_t profile,
dt_aligned_pixel_t  RGB 
)

◆ dt_colorrings_compute_reference_saturations()

void dt_colorrings_compute_reference_saturations ( float  white,
float  reference_saturation[3] 
)

◆ dt_colorrings_cross3()

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().

◆ dt_colorrings_curve_periodic_distance()

float dt_colorrings_curve_periodic_distance ( float  x0,
float  x1 
)

◆ dt_colorrings_curve_periodic_sample()

float dt_colorrings_curve_periodic_sample ( const dt_colorrings_node_t curve,
int  nodes,
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().

◆ dt_colorrings_curve_x_to_hue()

◆ dt_colorrings_distance_to_cube_shell()

float dt_colorrings_distance_to_cube_shell ( const dt_aligned_pixel_t  axis,
const dt_aligned_pixel_t  direction 
)

◆ dt_colorrings_dot3()

float dt_colorrings_dot3 ( const dt_aligned_pixel_t  a,
const dt_aligned_pixel_t  b 
)

◆ dt_colorrings_eval_local_field()

void dt_colorrings_eval_local_field ( const float  x[3],
const float  anchor_L[(3+1)][64],
const float  anchor_rho[(3+1)][64],
const float  anchor_theta[(3+1)][64],
const float  delta_L[(3+1)][64],
const float  chroma_scale[(3+1)][64],
const float  delta_theta[(3+1)][64],
float  inv_sigma_L,
float  inv_sigma_rho,
float  inv_sigma_theta,
float  rho0,
float  out[3] 
)

◆ dt_colorrings_eval_sparse_local_field()

void dt_colorrings_eval_sparse_local_field ( const float  x[3],
const dt_colorrings_sparse_anchor_t anchors,
int  anchor_count,
float  inv_sigma_L,
float  inv_sigma_rho,
float  inv_sigma_theta,
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().

◆ dt_colorrings_fill_lut_local_field()

void dt_colorrings_fill_lut_local_field ( float *  lut,
int  level,
const float  anchor_L[(3+1)][64],
const float  anchor_rho[(3+1)][64],
const float  anchor_theta[(3+1)][64],
const float  delta_L[(3+1)][64],
const float  chroma_scale[(3+1)][64],
const float  delta_theta[(3+1)][64],
float  inv_sigma_L,
float  inv_sigma_rho,
float  inv_sigma_theta,
float  rho0 
)

◆ dt_colorrings_fill_lut_sparse_local_field()

void dt_colorrings_fill_lut_sparse_local_field ( float *  lut,
int  level,
const dt_colorrings_sparse_anchor_t anchors,
int  anchor_count,
float  inv_sigma_L,
float  inv_sigma_rho,
float  inv_sigma_theta,
float  rho0 
)

◆ dt_colorrings_graph_white()

◆ dt_colorrings_gray_axis_rgb_from_L()

◆ dt_colorrings_gray_basis_to_rgb()

void dt_colorrings_gray_basis_to_rgb ( float  L,
float  u,
float  v,
float  rgb[3] 
)

◆ dt_colorrings_hsb_to_display_rgb()

void dt_colorrings_hsb_to_display_rgb ( const dt_aligned_pixel_t  HSB,
float  white,
const dt_iop_order_iccprofile_info_t display_profile,
dt_aligned_pixel_t  RGB 
)

◆ dt_colorrings_hsb_to_profile_rgb()

◆ dt_colorrings_hue_to_curve_x()

float dt_colorrings_hue_to_curve_x ( float  hue)

◆ dt_colorrings_normalize3()

void dt_colorrings_normalize3 ( dt_aligned_pixel_t  vector)

◆ dt_colorrings_profile_rgb_to_display_rgb()

◆ dt_colorrings_profile_rgb_to_dt_ucs_hsb()

◆ dt_colorrings_profile_rgb_to_dt_ucs_jch()

◆ dt_colorrings_profile_rgb_to_Ych()

◆ dt_colorrings_project_to_cube_shell()

◆ dt_colorrings_rgb_to_gray_cyl()

void dt_colorrings_rgb_to_gray_cyl ( const float  rgb[3],
float *  L,
float *  rho,
float *  theta 
)

◆ dt_colorrings_ring_axis_position_from_brightness()

float dt_colorrings_ring_axis_position_from_brightness ( float  brightness,
float  white,
const dt_iop_order_iccprofile_info_t profile 
)

◆ dt_colorrings_ring_brightness()

◆ dt_colorrings_rotate_around_axis()

void dt_colorrings_rotate_around_axis ( const dt_aligned_pixel_t  input,
const dt_aligned_pixel_t  axis,
float  cos_angle,
float  sin_angle,
dt_aligned_pixel_t  output 
)

◆ dt_colorrings_vector_norm3()

float dt_colorrings_vector_norm3 ( const dt_aligned_pixel_t  vector)

◆ dt_colorrings_wendland_c2()

float dt_colorrings_wendland_c2 ( float  d)

◆ dt_colorrings_wrap_hue_2pi()

float dt_colorrings_wrap_hue_2pi ( float  hue)

◆ dt_colorrings_wrap_hue_pi()

◆ dt_colorrings_wrap_pi()