Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
colorbalancergb.c File Reference
#include "bauhaus/bauhaus.h"
#include "common/exif.h"
#include "common/chromatic_adaptation.h"
#include "common/colorspaces_inline_conversions.h"
#include "common/opencl.h"
#include "control/control.h"
#include "develop/blend.h"
#include "develop/imageop.h"
#include "develop/imageop_math.h"
#include "develop/openmp_maths.h"
#include "develop/imageop_gui.h"
#include "dtgtk/drawingarea.h"
#include "dtgtk/gradientslider.h"
#include "gui/draw.h"
#include "gui/gtk.h"
#include "gui/presets.h"
#include "gui/color_picker_proxy.h"
#include "iop/iop_api.h"
#include <stdlib.h>
+ Include dependency graph for colorbalancergb.c:

Data Structures

struct  dt_iop_colorbalancergb_params_t
 
struct  dt_iop_colorbalancergb_gui_data_t
 
struct  dt_iop_colorbalancergb_data_t
 
struct  dt_iop_colorbalance_global_data_t
 

Macros

#define LUT_ELEM   360
 
#define STEPS   92
 
#define ANGLE_SHIFT   -30.f
 
#define DEG_TO_RAD(x)   ((x + ANGLE_SHIFT) * M_PI / 180.f)
 
#define RAD_TO_DEG(x)   (x * 180.f / M_PI - ANGLE_SHIFT)
 

Typedefs

typedef enum dt_iop_colorbalancrgb_saturation_t dt_iop_colorbalancrgb_saturation_t
 
typedef struct dt_iop_colorbalancergb_params_t dt_iop_colorbalancergb_params_t
 
typedef enum dt_iop_colorbalancergb_mask_data_t dt_iop_colorbalancergb_mask_data_t
 
typedef struct dt_iop_colorbalancergb_gui_data_t dt_iop_colorbalancergb_gui_data_t
 
typedef struct dt_iop_colorbalancergb_data_t dt_iop_colorbalancergb_data_t
 
typedef struct dt_iop_colorbalance_global_data_t dt_iop_colorbalancergb_global_data_t
 

Enumerations

enum  dt_iop_colorbalancrgb_saturation_t {
  DT_COLORBALANCE_SATURATION_JZAZBZ = 0 ,
  DT_COLORBALANCE_SATURATION_DTUCS = 1
}
 
enum  dt_iop_colorbalancergb_mask_data_t {
  MASK_SHADOWS = 0 ,
  MASK_MIDTONES = 1 ,
  MASK_HIGHLIGHTS = 2 ,
  MASK_NONE
}
 

Functions

const char * name ()
 
const char * aliases ()
 
const char ** description (struct dt_iop_module_t *self)
 
int flags ()
 
int default_group ()
 
int default_colorspace (dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
 
int legacy_params (dt_iop_module_t *self, const void *const old_params, const int old_version, void *new_params, const int new_version)
 
void init_presets (dt_iop_module_so_t *self)
 
static void opacity_masks (const float x, const float shadows_weight, const float highlights_weight, const float midtones_weight, const float mask_grey_fulcrum, dt_aligned_pixel_t output, dt_aligned_pixel_t output_comp)
 
static float soft_clip (const float x, const float soft_threshold, const float hard_threshold)
 
static float lookup_gamut (const float *const gamut_lut, const float x)
 
void process (struct dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, const void *const ivoid, void *const ovoid, const dt_iop_roi_t *const roi_in, const dt_iop_roi_t *const roi_out)
 
static float Delta_H (const float h_1, const float h_2)
 
void commit_params (struct dt_iop_module_t *self, dt_iop_params_t *p1, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
 
void init_pipe (dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
 
void cleanup_pipe (dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
 
void pipe_RGB_to_Ych (dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, const dt_aligned_pixel_t RGB, dt_aligned_pixel_t Ych)
 
void color_picker_apply (dt_iop_module_t *self, GtkWidget *picker, dt_dev_pixelpipe_iop_t *piece)
 
static void paint_chroma_slider (GtkWidget *w, const float hue)
 
static void mask_callback (GtkWidget *togglebutton, dt_iop_module_t *self)
 
static gboolean dt_iop_tonecurve_draw (GtkWidget *widget, cairo_t *crf, gpointer user_data)
 
static void checker_1_picker_callback (GtkColorButton *widget, dt_iop_module_t *self)
 
static void checker_2_picker_callback (GtkColorButton *widget, dt_iop_module_t *self)
 
static void checker_size_callback (GtkWidget *widget, dt_iop_module_t *self)
 
void gui_changed (dt_iop_module_t *self, GtkWidget *w, void *previous)
 
void gui_update (dt_iop_module_t *self)
 
void gui_reset (dt_iop_module_t *self)
 
static gboolean area_scroll_callback (GtkWidget *widget, GdkEventScroll *event, gpointer user_data)
 
void gui_init (dt_iop_module_t *self)
 
void gui_cleanup (struct dt_iop_module_t *self)
 

Macro Definition Documentation

◆ ANGLE_SHIFT

#define ANGLE_SHIFT   -30.f

◆ DEG_TO_RAD

#define DEG_TO_RAD (   x)    ((x + ANGLE_SHIFT) * M_PI / 180.f)

◆ LUT_ELEM

#define LUT_ELEM   360

◆ RAD_TO_DEG

#define RAD_TO_DEG (   x)    (x * 180.f / M_PI - ANGLE_SHIFT)

◆ STEPS

#define STEPS   92

Typedef Documentation

◆ dt_iop_colorbalancergb_data_t

◆ dt_iop_colorbalancergb_global_data_t

◆ dt_iop_colorbalancergb_gui_data_t

◆ dt_iop_colorbalancergb_mask_data_t

◆ dt_iop_colorbalancergb_params_t

◆ dt_iop_colorbalancrgb_saturation_t

Enumeration Type Documentation

◆ dt_iop_colorbalancergb_mask_data_t

Enumerator
MASK_SHADOWS 
MASK_MIDTONES 
MASK_HIGHLIGHTS 
MASK_NONE 

◆ dt_iop_colorbalancrgb_saturation_t

Enumerator
DT_COLORBALANCE_SATURATION_JZAZBZ 
DT_COLORBALANCE_SATURATION_DTUCS 

Function Documentation

◆ aliases()

const char * aliases ( )

◆ area_scroll_callback()

static gboolean area_scroll_callback ( GtkWidget *  widget,
GdkEventScroll *  event,
gpointer  user_data 
)
static

◆ checker_1_picker_callback()

static void checker_1_picker_callback ( GtkColorButton *  widget,
dt_iop_module_t self 
)
static

◆ checker_2_picker_callback()

static void checker_2_picker_callback ( GtkColorButton *  widget,
dt_iop_module_t self 
)
static

◆ checker_size_callback()

static void checker_size_callback ( GtkWidget *  widget,
dt_iop_module_t self 
)
static

◆ cleanup_pipe()

◆ color_picker_apply()

◆ commit_params()

void commit_params ( struct dt_iop_module_t self,
dt_iop_params_t p1,
dt_dev_pixelpipe_t pipe,
dt_dev_pixelpipe_iop_t piece 
)

References dt_iop_colorbalancergb_data_t::brilliance, dt_iop_colorbalancergb_data_t::brilliance_global, dt_iop_colorbalancergb_data_t::checker_color_1, dt_iop_colorbalancergb_data_t::checker_color_2, dt_iop_colorbalancergb_data_t::checker_size, dt_iop_colorbalancergb_data_t::chroma, dt_iop_colorbalancergb_data_t::chroma_global, dt_iop_colorbalancergb_data_t::contrast, dt_dev_pixelpipe_iop_t::data, DEG_TO_RAD, Delta_H(), dot_product(), dt_alloc_align_float(), DT_COLORBALANCE_SATURATION_DTUCS, DT_COLORBALANCE_SATURATION_JZAZBZ, dt_colormatrix_mul(), dt_conf_get_float(), dt_conf_get_int(), dt_fast_hypotf(), dt_free_align, dt_ioppr_get_pipe_current_profile_info(), dt_XYZ_2_JzAzBz(), dt_XYZ_to_xyY(), FALSE, dt_iop_colorbalancergb_data_t::gamut_LUT, dt_iop_colorbalancergb_data_t::global, dt_iop_colorbalancergb_data_t::grey_fulcrum, H, dt_iop_colorbalancergb_data_t::highlights, dt_iop_colorbalancergb_data_t::highlights_weight, dt_iop_colorbalancergb_data_t::hue_angle, LUT_ELEM, dt_iop_colorbalancergb_data_t::lut_inited, M_PI, M_PI_F, dt_iop_colorbalancergb_data_t::mask_grey_fulcrum, dt_iop_order_iccprofile_info_t::matrix_in, MAX, dt_iop_colorbalancergb_data_t::midtones, dt_iop_colorbalancergb_data_t::midtones_weight, dt_iop_colorbalancergb_data_t::midtones_Y, dt_dev_pixelpipe_iop_t::pipe, dt_iop_colorbalancergb_data_t::saturation, dt_iop_colorbalancergb_data_t::saturation_formula, dt_iop_colorbalancergb_data_t::saturation_global, dt_iop_colorbalancergb_data_t::shadows, dt_iop_colorbalancergb_data_t::shadows_weight, sqf(), STEPS, TRUE, dt_iop_colorbalancergb_data_t::vibrance, dt_iop_colorbalancergb_data_t::white_fulcrum, dt_iop_colorbalancergb_data_t::work_profile, xyY_to_dt_UCS_UV(), XYZ_D50_to_D65_CAT16, and Ych_to_gradingRGB().

◆ default_colorspace()

int default_colorspace ( dt_iop_module_t self,
dt_dev_pixelpipe_t pipe,
dt_dev_pixelpipe_iop_t piece 
)

References IOP_CS_RGB.

◆ default_group()

int default_group ( )

References IOP_GROUP_COLOR.

◆ Delta_H()

static float Delta_H ( const float  h_1,
const float  h_2 
)
inlinestatic

References M_PI_F.

Referenced by commit_params().

◆ description()

const char ** description ( struct dt_iop_module_t self)

◆ dt_iop_tonecurve_draw()

◆ flags()

◆ gui_changed()

◆ gui_cleanup()

void gui_cleanup ( struct dt_iop_module_t self)

References IOP_GUI_FREE.

◆ gui_init()

◆ gui_reset()

void gui_reset ( dt_iop_module_t self)

◆ gui_update()

◆ init_pipe()

◆ init_presets()

◆ legacy_params()

◆ lookup_gamut()

static float lookup_gamut ( const float *const  gamut_lut,
const float  x 
)
inlinestatic

References LUT_ELEM, and M_PI_F.

Referenced by process().

◆ mask_callback()

◆ name()

const char * name ( )

◆ opacity_masks()

static void opacity_masks ( const float  x,
const float  shadows_weight,
const float  highlights_weight,
const float  midtones_weight,
const float  mask_grey_fulcrum,
dt_aligned_pixel_t  output,
dt_aligned_pixel_t  output_comp 
)
inlinestatic

References sqf().

Referenced by dt_iop_tonecurve_draw(), and process().

◆ paint_chroma_slider()

static void paint_chroma_slider ( GtkWidget *  w,
const float  hue 
)
static

◆ pipe_RGB_to_Ych()

◆ process()

void process ( struct dt_iop_module_t self,
dt_dev_pixelpipe_iop_t piece,
const void *const  ivoid,
void *const  ovoid,
const dt_iop_roi_t *const  roi_in,
const dt_iop_roi_t *const  roi_out 
)

References dt_iop_colorbalancergb_data_t::brilliance, dt_iop_colorbalancergb_data_t::brilliance_global, dt_iop_colorbalancergb_data_t::checker_color_1, dt_iop_colorbalancergb_data_t::checker_color_2, dt_iop_colorbalancergb_data_t::checker_size, dt_iop_colorbalancergb_data_t::chroma, dt_iop_colorbalancergb_data_t::chroma_global, dt_iop_colorbalancergb_data_t::contrast, dt_dev_pixelpipe_iop_t::data, dt_iop_module_t::dev, dot_product(), DT_ALIGNED_PIXEL, DT_COLORBALANCE_SATURATION_JZAZBZ, dt_colormatrix_mul(), DT_DEV_PIXELPIPE_FULL, dt_fast_hypotf(), dt_ioppr_get_pipe_current_profile_info(), dt_JzAzBz_2_XYZ(), DT_M_PI_F, DT_PIXEL_APPLY_DPI, dt_UCS_HCB_to_JCH(), dt_UCS_HSB_to_JCH(), dt_UCS_JCH_to_HCB(), dt_UCS_JCH_to_HSB(), dt_UCS_JCH_to_xyY(), dt_xyY_to_XYZ(), dt_XYZ_2_JzAzBz(), dt_XYZ_to_xyY(), for_four_channels, gamut_check_Yrg(), dt_iop_colorbalancergb_data_t::gamut_LUT, dt_iop_colorbalancergb_data_t::global, gradingRGB_to_LMS(), dt_iop_colorbalancergb_data_t::grey_fulcrum, dt_develop_t::gui_attached, dt_iop_module_t::gui_data, dt_iop_roi_t::height, dt_iop_colorbalancergb_data_t::highlights, dt_iop_colorbalancergb_data_t::highlights_weight, dt_iop_colorbalancergb_data_t::hue_angle, LMS_to_gradingRGB(), LMS_to_XYZ(), LMS_to_Yrg(), lookup_gamut(), M_PI_F, dt_iop_colorbalancergb_data_t::mask_grey_fulcrum, dt_iop_order_iccprofile_info_t::matrix_in, dt_iop_order_iccprofile_info_t::matrix_out, dt_iop_colorbalancergb_data_t::midtones, dt_iop_colorbalancergb_data_t::midtones_weight, dt_iop_colorbalancergb_data_t::midtones_Y, opacity_masks(), P, dt_dev_pixelpipe_iop_t::pipe, dt_iop_colorbalancergb_data_t::saturation, dt_iop_colorbalancergb_data_t::saturation_formula, dt_iop_colorbalancergb_data_t::saturation_global, scalar_product(), dt_iop_colorbalancergb_data_t::shadows, dt_iop_colorbalancergb_data_t::shadows_weight, sign(), soft_clip(), sqf(), dt_iop_colorbalancergb_data_t::vibrance, dt_iop_colorbalancergb_data_t::white_fulcrum, dt_iop_roi_t::width, xyY_to_dt_UCS_JCH(), XYZ_D50_to_D65_CAT16, XYZ_D65_to_D50_CAT16, XYZ_D65_to_LMS_2006_D65, Y_to_dt_UCS_L_star(), Ych_to_Yrg(), Yrg_to_LMS(), and Yrg_to_Ych().

◆ soft_clip()

static float soft_clip ( const float  x,
const float  soft_threshold,
const float  hard_threshold 
)
inlinestatic

Referenced by legacy_params(), and process().