Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
illuminants.h File Reference
+ Include dependency graph for illuminants.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  pair
 

Typedefs

typedef enum dt_illuminant_t dt_illuminant_t
 
typedef enum dt_illuminant_fluo_t dt_illuminant_fluo_t
 
typedef enum dt_illuminant_led_t dt_illuminant_led_t
 
typedef struct pair pair
 

Enumerations

enum  dt_illuminant_t {
  DT_ILLUMINANT_PIPE = 0 ,
  DT_ILLUMINANT_A = 1 ,
  DT_ILLUMINANT_D = 2 ,
  DT_ILLUMINANT_E = 3 ,
  DT_ILLUMINANT_F = 4 ,
  DT_ILLUMINANT_LED = 5 ,
  DT_ILLUMINANT_BB = 6 ,
  DT_ILLUMINANT_CUSTOM = 7 ,
  DT_ILLUMINANT_DETECT_SURFACES = 8 ,
  DT_ILLUMINANT_DETECT_EDGES = 9 ,
  DT_ILLUMINANT_CAMERA = 10 ,
  DT_ILLUMINANT_LAST
}
 
enum  dt_illuminant_fluo_t {
  DT_ILLUMINANT_FLUO_F1 = 0 ,
  DT_ILLUMINANT_FLUO_F2 = 1 ,
  DT_ILLUMINANT_FLUO_F3 = 2 ,
  DT_ILLUMINANT_FLUO_F4 = 3 ,
  DT_ILLUMINANT_FLUO_F5 = 4 ,
  DT_ILLUMINANT_FLUO_F6 = 5 ,
  DT_ILLUMINANT_FLUO_F7 = 6 ,
  DT_ILLUMINANT_FLUO_F8 = 7 ,
  DT_ILLUMINANT_FLUO_F9 = 8 ,
  DT_ILLUMINANT_FLUO_F10 = 9 ,
  DT_ILLUMINANT_FLUO_F11 = 10 ,
  DT_ILLUMINANT_FLUO_F12 = 11 ,
  DT_ILLUMINANT_FLUO_LAST
}
 
enum  dt_illuminant_led_t {
  DT_ILLUMINANT_LED_B1 = 0 ,
  DT_ILLUMINANT_LED_B2 = 1 ,
  DT_ILLUMINANT_LED_B3 = 2 ,
  DT_ILLUMINANT_LED_B4 = 3 ,
  DT_ILLUMINANT_LED_B5 = 4 ,
  DT_ILLUMINANT_LED_BH1 = 5 ,
  DT_ILLUMINANT_LED_RGB1 = 6 ,
  DT_ILLUMINANT_LED_V1 = 7 ,
  DT_ILLUMINANT_LED_V2 = 8 ,
  DT_ILLUMINANT_LED_LAST
}
 

Functions

static float xy_to_CCT (const float x, const float y)
 
static void CCT_to_xy_daylight (const float t, float *x, float *y)
 
static void CCT_to_xy_blackbody (const float t, float *x, float *y)
 
static void illuminant_xy_to_XYZ (const float x, const float y, dt_aligned_pixel_t XYZ)
 
static void illuminant_xy_to_RGB (const float x, const float y, dt_aligned_pixel_t RGB)
 
static void illuminant_CCT_to_RGB (const float t, dt_aligned_pixel_t RGB)
 
static int find_temperature_from_raw_coeffs (const dt_image_t *img, const dt_aligned_pixel_t custom_wb, float *chroma_x, float *chroma_y)
 
static int illuminant_to_xy (const dt_illuminant_t illuminant, const dt_image_t *img, const dt_aligned_pixel_t custom_wb, float *x_out, float *y_out, const float t, const dt_illuminant_fluo_t fluo, const dt_illuminant_led_t iled)
 
static void WB_coeffs_to_illuminant_xy (const float CAM_to_XYZ[4][3], const dt_aligned_pixel_t WB, float *x, float *y)
 
static void matrice_pseudoinverse (float(*in)[3], float(*out)[3], int size)
 
static float planckian_normal (const float x, const float t)
 
static void blackbody_xy_to_tinted_xy (const float x, const float y, const float t, const float tint, float *x_out, float *y_out)
 
static float get_tint_from_tinted_xy (const float x, const float y, const float t)
 
static void xy_to_uv (const float xy[2], float uv[2])
 
struct pair pair_min (struct pair r, struct pair n)
 
static float CCT_reverse_lookup (const float x, const float y)
 

Variables

static float fluorescent [DT_ILLUMINANT_FLUO_LAST][2]
 
static float led [DT_ILLUMINANT_LED_LAST][2]
 

Typedef Documentation

◆ dt_illuminant_fluo_t

◆ dt_illuminant_led_t

◆ dt_illuminant_t

◆ pair

typedef struct pair pair

Enumeration Type Documentation

◆ dt_illuminant_fluo_t

Enumerator
DT_ILLUMINANT_FLUO_F1 
DT_ILLUMINANT_FLUO_F2 
DT_ILLUMINANT_FLUO_F3 
DT_ILLUMINANT_FLUO_F4 
DT_ILLUMINANT_FLUO_F5 
DT_ILLUMINANT_FLUO_F6 
DT_ILLUMINANT_FLUO_F7 
DT_ILLUMINANT_FLUO_F8 
DT_ILLUMINANT_FLUO_F9 
DT_ILLUMINANT_FLUO_F10 
DT_ILLUMINANT_FLUO_F11 
DT_ILLUMINANT_FLUO_F12 
DT_ILLUMINANT_FLUO_LAST 

Definition at line 51 of file illuminants.h.

◆ dt_illuminant_led_t

Enumerator
DT_ILLUMINANT_LED_B1 
DT_ILLUMINANT_LED_B2 
DT_ILLUMINANT_LED_B3 
DT_ILLUMINANT_LED_B4 
DT_ILLUMINANT_LED_B5 
DT_ILLUMINANT_LED_BH1 
DT_ILLUMINANT_LED_RGB1 
DT_ILLUMINANT_LED_V1 
DT_ILLUMINANT_LED_V2 
DT_ILLUMINANT_LED_LAST 

Definition at line 69 of file illuminants.h.

◆ dt_illuminant_t

Enumerator
DT_ILLUMINANT_PIPE 
DT_ILLUMINANT_A 
DT_ILLUMINANT_D 
DT_ILLUMINANT_E 
DT_ILLUMINANT_F 
DT_ILLUMINANT_LED 
DT_ILLUMINANT_BB 
DT_ILLUMINANT_CUSTOM 
DT_ILLUMINANT_DETECT_SURFACES 
DT_ILLUMINANT_DETECT_EDGES 
DT_ILLUMINANT_CAMERA 
DT_ILLUMINANT_LAST 

Definition at line 34 of file illuminants.h.

Function Documentation

◆ blackbody_xy_to_tinted_xy()

static void blackbody_xy_to_tinted_xy ( const float  x,
const float  y,
const float  t,
const float  tint,
float *  x_out,
float *  y_out 
)
inlinestatic

Definition at line 476 of file illuminants.h.

References n, planckian_normal(), t, and x.

◆ CCT_reverse_lookup()

static float CCT_reverse_lookup ( const float  x,
const float  y 
)
inlinestatic

◆ CCT_to_xy_blackbody()

static void CCT_to_xy_blackbody ( const float  t,
float *  x,
float *  y 
)
inlinestatic

◆ CCT_to_xy_daylight()

static void CCT_to_xy_daylight ( const float  t,
float *  x,
float *  y 
)
inlinestatic

Definition at line 139 of file illuminants.h.

References t, and x.

Referenced by _temperature_to_xy(), CCT_reverse_lookup(), illuminant_CCT_to_RGB(), and illuminant_to_xy().

◆ find_temperature_from_raw_coeffs()

static int find_temperature_from_raw_coeffs ( const dt_image_t img,
const dt_aligned_pixel_t  custom_wb,
float *  chroma_x,
float *  chroma_y 
)
inlinestatic

◆ get_tint_from_tinted_xy()

static float get_tint_from_tinted_xy ( const float  x,
const float  y,
const float  t 
)
inlinestatic

Definition at line 488 of file illuminants.h.

References CCT_to_xy_blackbody(), n, planckian_normal(), t, and x.

◆ illuminant_CCT_to_RGB()

static void illuminant_CCT_to_RGB ( const float  t,
dt_aligned_pixel_t  RGB 
)
inlinestatic

◆ illuminant_to_xy()

static int illuminant_to_xy ( const dt_illuminant_t  illuminant,
const dt_image_t img,
const dt_aligned_pixel_t  custom_wb,
float *  x_out,
float *  y_out,
const float  t,
const dt_illuminant_fluo_t  fluo,
const dt_illuminant_led_t  iled 
)
inlinestatic

Compute the x and y chromaticity coordinates in Yxy spaces for standard illuminants

Returns : TRUE if chromaticity of the requested standard illuminant has been found FALSE if no valid chromaticity has been found or custom illuminant has been requested

Definition at line 225 of file illuminants.h.

References CCT_to_xy_blackbody(), CCT_to_xy_daylight(), DT_ILLUMINANT_A, DT_ILLUMINANT_BB, DT_ILLUMINANT_CAMERA, DT_ILLUMINANT_CUSTOM, DT_ILLUMINANT_D, DT_ILLUMINANT_DETECT_EDGES, DT_ILLUMINANT_DETECT_SURFACES, DT_ILLUMINANT_E, DT_ILLUMINANT_F, DT_ILLUMINANT_FLUO_LAST, DT_ILLUMINANT_LAST, DT_ILLUMINANT_LED, DT_ILLUMINANT_LED_LAST, DT_ILLUMINANT_PIPE, FALSE, find_temperature_from_raw_coeffs(), fluorescent, illuminant, led, t, TRUE, and x.

Referenced by _auto_set_illuminant(), commit_params(), gui_changed(), illuminant_color_draw(), init_presets(), and update_approx_cct().

◆ illuminant_xy_to_RGB()

static void illuminant_xy_to_RGB ( const float  x,
const float  y,
dt_aligned_pixel_t  RGB 
)
inlinestatic

◆ illuminant_xy_to_XYZ()

static void illuminant_xy_to_XYZ ( const float  x,
const float  y,
dt_aligned_pixel_t  XYZ 
)
inlinestatic

◆ matrice_pseudoinverse()

static void matrice_pseudoinverse ( float(*)  in[3],
float(*)  out[3],
int  size 
)
inlinestatic

Definition at line 355 of file illuminants.h.

References DT_ALIGNED_ARRAY, i, k, out, and size.

Referenced by _auto_set_illuminant(), autoset(), and find_temperature_from_raw_coeffs().

◆ pair_min()

struct pair pair_min ( struct pair  r,
struct pair  n 
)

Definition at line 530 of file illuminants.h.

References n, and r.

Referenced by CCT_reverse_lookup().

◆ planckian_normal()

static float planckian_normal ( const float  x,
const float  t 
)
inlinestatic

Definition at line 459 of file illuminants.h.

References n, t, and x.

Referenced by blackbody_xy_to_tinted_xy(), and get_tint_from_tinted_xy().

◆ WB_coeffs_to_illuminant_xy()

static void WB_coeffs_to_illuminant_xy ( const float  CAM_to_XYZ[4][3],
const dt_aligned_pixel_t  WB,
float *  x,
float *  y 
)
inlinestatic

◆ xy_to_CCT()

static float xy_to_CCT ( const float  x,
const float  y 
)
inlinestatic

Definition at line 127 of file illuminants.h.

References n, and x.

Referenced by illum_xy_callback().

◆ xy_to_uv()

static void xy_to_uv ( const float  xy[2],
float  uv[2] 
)
inlinestatic

Definition at line 501 of file illuminants.h.

Variable Documentation

◆ fluorescent

float fluorescent[DT_ILLUMINANT_FLUO_LAST][2]
static
Initial value:
= { { 0.31310f, 0.33727f },
{ 0.37208f, 0.37529f },
{ 0.40910f, 0.39430f },
{ 0.44018f, 0.40329f },
{ 0.31379f, 0.34531f },
{ 0.37790f, 0.38835f },
{ 0.31292f, 0.32933f },
{ 0.34588f, 0.35875f },
{ 0.37417f, 0.37281f },
{ 0.34609f, 0.35986f },
{ 0.38052f, 0.37713f },
{ 0.43695f, 0.40441f } }

References: https://en.wikipedia.org/wiki/Planckian_locus https://en.wikipedia.org/wiki/Standard_illuminant

Note : All values are x and y chromaticities for CIE 1931 2° observer

Definition at line 94 of file illuminants.h.

Referenced by illuminant_to_xy().

◆ led

float led[DT_ILLUMINANT_LED_LAST][2]
static
Initial value:
= { { 0.4560f, 0.4078f },
{ 0.4357f, 0.4012f },
{ 0.3756f, 0.3723f },
{ 0.3422f, 0.3502f },
{ 0.3118f, 0.3236f },
{ 0.4474f, 0.4066f },
{ 0.4557f, 0.4211f },
{ 0.4560f, 0.4548f },
{ 0.3781f, 0.3775f }}

FLUORESCENT

F1-F6 : standard fluo lamps (two semi-broadband emissions). F4 : used for calibrating the CIE color rendering index (CRI = 51). F7-F9 : broadband / full-spectrum light (multiple phosphors, higher CRI). F10-F12 : three narrowband emissions in the R,G,B regions of the visible spectrum tuned to desired CCT.

Definition at line 116 of file illuminants.h.

Referenced by illuminant_to_xy().