Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
channelmixerrgb_shared.c File Reference
#include "bauhaus/bauhaus.h"
#include "common/chromatic_adaptation.h"
#include "common/colorspaces_inline_conversions.h"
#include "common/illuminants.h"
#include "common/matrices.h"
#include "develop/imageop_math.h"
#include "gaussian_elimination.h"
#include "iop/channelmixerrgb_shared.h"
#include <float.h>
#include <math.h>
#include <string.h>
+ Include dependency graph for channelmixerrgb_shared.c:
+ This graph shows which files directly or indirectly include this file:

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])
 
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])
 
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)
 
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)
 
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])
 

Macro Definition Documentation

◆ DT_IOP_CHANNELMIXER_SHARED_INV_SQRT_3

#define DT_IOP_CHANNELMIXER_SHARED_INV_SQRT_3   0.5773502691896258f

Function Documentation

◆ _affine_distance_to_edge()

static float _affine_distance_to_edge ( const float  direction[2],
const float  reference_primaries[3][2] 
)
static

◆ _affine_normalize()

static gboolean _affine_normalize ( const float  vector[3],
float  normalized[3] 
)
static

◆ _affine_point_from_polar()

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

◆ _affine_polar_from_point()

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

◆ _affine_project_difference()

static void _affine_project_difference ( const float  difference[3],
float  uv[2] 
)
static

◆ _affine_sum3()

static float _affine_sum3 ( const float  vector[3])
inlinestatic

◆ _affine_unproject_difference()

static void _affine_unproject_difference ( const float  uv[2],
float  difference[3] 
)
static

◆ _build_affine_simplex()

static gboolean _build_affine_simplex ( const dt_iop_channelmixer_shared_primaries_basis_t  basis,
float  white_normalized[3],
float  reference_primaries[3][2] 
)
static

◆ _intersect_affine_ray_segment()

static float _intersect_affine_ray_segment ( const float  direction[2],
const float  first[2],
const float  second[2] 
)
static

◆ _mixer_from_chroma_basis()

static void _mixer_from_chroma_basis ( const float  B[3][3],
float  M[3][3] 
)
static

◆ _mixer_to_chroma_basis()

static void _mixer_to_chroma_basis ( const float  M[3][3],
float  B[3][3] 
)
static

◆ _normalize_linear_display_rgb()

static void _normalize_linear_display_rgb ( dt_aligned_pixel_t  linear_display_rgb)
static

◆ _paint_RGB_slider_stop()

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 
)
static

◆ _primaries_reference_white()

◆ _rotate_2d()

static void _rotate_2d ( const float  vector[2],
const float  angle,
float  rotated[2] 
)
static

◆ _shared_paint_probe_matrix()

static void _shared_paint_probe_matrix ( const float  source[3],
const float  M[3][3],
float  module_color[3] 
)
static

◆ _shared_primaries_probe_color()

static void _shared_primaries_probe_color ( const float  M[3][3],
const int  widget_index,
float  module_color[3] 
)
static

◆ _shared_simple_hue_probe()

static void _shared_simple_hue_probe ( const float  hue,
float  module_color[3] 
)
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.

Parameters
[in]hueAngular direction in the chroma plane.
[out]module_colorProbe color in module RGB coordinates.

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

◆ dt_iop_channelmixer_shared_decode_simple_coupling_amount()

float dt_iop_channelmixer_shared_decode_simple_coupling_amount ( const float  slider)

◆ dt_iop_channelmixer_shared_decode_simple_stretch()

float dt_iop_channelmixer_shared_decode_simple_stretch ( const float  slider)

◆ dt_iop_channelmixer_shared_encode_simple_coupling_amount()

float dt_iop_channelmixer_shared_encode_simple_coupling_amount ( const float  amount)

◆ dt_iop_channelmixer_shared_encode_simple_stretch()

float dt_iop_channelmixer_shared_encode_simple_stretch ( const float  stretch)

◆ dt_iop_channelmixer_shared_get_matrix()

gboolean dt_iop_channelmixer_shared_get_matrix ( const float  rows[3][3],
const gboolean  normalize[3],
const gboolean  force_normalize,
float  M[3][3] 
)

◆ dt_iop_channelmixer_shared_module_color_to_display()

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] 
)

◆ dt_iop_channelmixer_shared_mul3x3()

void dt_iop_channelmixer_shared_mul3x3 ( const float  A[3][3],
const float  B[3][3],
float  C[3][3] 
)

◆ dt_iop_channelmixer_shared_paint_primaries_sliders()

◆ dt_iop_channelmixer_shared_paint_row_sliders()

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] 
)

◆ dt_iop_channelmixer_shared_paint_simple_sliders()

◆ dt_iop_channelmixer_shared_paint_temperature_slider()

void dt_iop_channelmixer_shared_paint_temperature_slider ( GtkWidget *const  widget,
const float  temperature_min,
const float  temperature_max 
)

◆ dt_iop_channelmixer_shared_primaries_basis_from_adaptation()

◆ dt_iop_channelmixer_shared_primaries_from_matrix()

◆ dt_iop_channelmixer_shared_primaries_from_sliders()

◆ dt_iop_channelmixer_shared_primaries_to_matrix()

◆ dt_iop_channelmixer_shared_primaries_to_sliders()

◆ dt_iop_channelmixer_shared_roundtrip_error()

float dt_iop_channelmixer_shared_roundtrip_error ( const float  M[3][3],
const float  roundtrip[3][3] 
)

◆ dt_iop_channelmixer_shared_rows_are_normalized()

gboolean dt_iop_channelmixer_shared_rows_are_normalized ( const gboolean  normalize[3])

◆ dt_iop_channelmixer_shared_set_matrix()

void dt_iop_channelmixer_shared_set_matrix ( float  rows[3][3],
const float  M[3][3] 
)

References M, and row.

◆ dt_iop_channelmixer_shared_simple_from_matrix()

◆ dt_iop_channelmixer_shared_simple_from_sliders()

◆ dt_iop_channelmixer_shared_simple_probe_source()

◆ dt_iop_channelmixer_shared_simple_to_matrix()

◆ dt_iop_channelmixer_shared_simple_to_sliders()

◆ dt_iop_channelmixer_shared_work_rgb_to_display()

◆ dt_iop_channelmixer_shared_wrap_half_pi()

float dt_iop_channelmixer_shared_wrap_half_pi ( float  angle)

◆ dt_iop_channelmixer_shared_wrap_pi()

float dt_iop_channelmixer_shared_wrap_pi ( float  angle)