![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
#include "bauhaus/bauhaus.h"
#include "common/colorspaces_inline_conversions.h"
#include "common/darktable.h"
#include "common/math.h"
#include "common/opencl.h"
#include "control/control.h"
#include "develop/develop.h"
#include "develop/imageop_math.h"
#include "dtgtk/button.h"
#include "dtgtk/drawingarea.h"
#include "dtgtk/expander.h"
#include "dtgtk/paint.h"
#include "gui/gtk.h"
#include "gui/presets.h"
#include "gui/color_picker_proxy.h"
#include "iop/iop_api.h"
#include "develop/imageop.h"
#include "gui/draw.h"
#include <assert.h>
#include <stdlib.h>
#include <string.h>
Data Structures | |
struct | dt_iop_filmic_params_t |
struct | dt_iop_filmic_gui_data_t |
struct | dt_iop_filmic_data_t |
struct | dt_iop_filmic_nodes_t |
struct | dt_iop_filmic_global_data_t |
Macros | |
#define | DT_GUI_CURVE_EDITOR_INSET DT_PIXEL_APPLY_DPI(1) |
Typedefs | |
typedef struct dt_iop_filmic_params_t | dt_iop_filmic_params_t |
typedef struct dt_iop_filmic_gui_data_t | dt_iop_filmic_gui_data_t |
typedef struct dt_iop_filmic_data_t | dt_iop_filmic_data_t |
typedef struct dt_iop_filmic_nodes_t | dt_iop_filmic_nodes_t |
typedef struct dt_iop_filmic_global_data_t | dt_iop_filmic_global_data_t |
#define DT_GUI_CURVE_EDITOR_INSET DT_PIXEL_APPLY_DPI(1) |
typedef struct dt_iop_filmic_data_t dt_iop_filmic_data_t |
typedef struct dt_iop_filmic_global_data_t dt_iop_filmic_global_data_t |
typedef struct dt_iop_filmic_gui_data_t dt_iop_filmic_gui_data_t |
typedef struct dt_iop_filmic_nodes_t dt_iop_filmic_nodes_t |
typedef struct dt_iop_filmic_params_t dt_iop_filmic_params_t |
DOCUMENTATION
This code ports :
The ACES log implementation is taken from the profile_gamma.c IOP where it works in camera RGB space. Here, it works on an arbitrary RGB space. ProPhotoRGB has been chosen for its wide gamut coverage and for conveniency because it's already in darktable's libs. Any other RGB working space could work. This chouice could (should) also be exposed to the user.
The filmic curves are tonecurves intended to simulate the luminance transfer function of film with "S" curves. These could be reproduced in the tonecurve.c IOP, however what we offer here is a parametric interface useful to remap accurately and promptly the middle grey to any arbitrary value chosen accordingly to the destination space.
The combined use of both define a modern way to deal with large dynamic range photographs by remapping the values with a comprehensive interface avoiding many of the back and forth adjustments darktable is prone to enforce.
|
static |
|
static |
References darktable, darktable_t::develop, dt_bauhaus_slider_set(), dt_dev_add_history_item, dt_Lab_to_XYZ(), darktable_t::gui, dt_iop_module_t::gui_data, Log2Thres(), dt_iop_module_t::params, dt_iop_module_t::picked_color_min, dt_gui_gtk_t::reset, sanitize_latitude(), TRUE, and dt_iop_module_t::widget.
Referenced by color_picker_apply().
|
static |
References darktable, darktable_t::develop, dt_bauhaus_slider_set(), dt_dev_add_history_item, dt_Lab_to_XYZ(), darktable_t::gui, dt_iop_module_t::gui_data, Log2(), dt_iop_module_t::params, dt_iop_module_t::picked_color, dt_gui_gtk_t::reset, TRUE, and dt_iop_module_t::widget.
Referenced by color_picker_apply().
|
static |
References darktable, darktable_t::develop, dt_bauhaus_slider_set(), dt_dev_add_history_item, dt_Lab_to_XYZ(), darktable_t::gui, dt_iop_module_t::gui_data, Log2Thres(), dt_iop_module_t::params, dt_iop_module_t::picked_color_max, dt_gui_gtk_t::reset, sanitize_latitude(), TRUE, and dt_iop_module_t::widget.
Referenced by color_picker_apply().
|
static |
References darktable, darktable_t::develop, dt_bauhaus_slider_set(), dt_dev_add_history_item, dt_Lab_to_XYZ(), darktable_t::gui, dt_iop_module_t::gui_data, Log2Thres(), dt_iop_module_t::params, dt_iop_module_t::picked_color, dt_iop_module_t::picked_color_max, dt_iop_module_t::picked_color_min, dt_gui_gtk_t::reset, sanitize_latitude(), TRUE, and dt_iop_module_t::widget.
Referenced by color_picker_apply().
|
static |
References darktable, darktable_t::develop, dt_bauhaus_slider_get(), dt_dev_add_history_item, dt_iop_color_picker_reset(), darktable_t::gui, dt_iop_module_t::params, dt_gui_gtk_t::reset, TRUE, and dt_iop_module_t::widget.
Referenced by gui_init().
|
static |
|
static |
References darktable, darktable_t::develop, dt_bauhaus_slider_get(), dt_dev_add_history_item, dt_iop_color_picker_reset(), darktable_t::gui, dt_iop_module_t::params, dt_gui_gtk_t::reset, TRUE, and dt_iop_module_t::widget.
Referenced by gui_init().
void cleanup | ( | dt_iop_module_t * | module | ) |
References dt_iop_module_t::default_params, and dt_iop_module_t::params.
void cleanup_global | ( | dt_iop_module_so_t * | module | ) |
void cleanup_pipe | ( | dt_iop_module_t * | self, |
dt_dev_pixelpipe_t * | pipe, | ||
dt_dev_pixelpipe_iop_t * | piece | ||
) |
References dt_dev_pixelpipe_iop_t::data.
void color_picker_apply | ( | dt_iop_module_t * | self, |
GtkWidget * | picker, | ||
dt_dev_pixelpipe_iop_t * | piece | ||
) |
void commit_params | ( | dt_iop_module_t * | self, |
dt_iop_params_t * | p1, | ||
dt_dev_pixelpipe_t * | pipe, | ||
dt_dev_pixelpipe_iop_t * | piece | ||
) |
References dt_iop_filmic_data_t::black_source, compute_curve_lut(), dt_iop_filmic_data_t::contrast, dt_dev_pixelpipe_iop_t::data, dt_iop_filmic_data_t::dynamic_range, dt_iop_filmic_data_t::global_saturation, dt_iop_filmic_data_t::grad_2, dt_iop_filmic_data_t::grey_source, dt_iop_filmic_data_t::latitude_max, dt_iop_filmic_data_t::latitude_min, dt_iop_filmic_data_t::output_power, dt_iop_filmic_data_t::preserve_color, dt_iop_filmic_data_t::saturation, dt_iop_filmic_data_t::table, and dt_iop_filmic_data_t::table_temp.
void compute_curve_lut | ( | dt_iop_filmic_params_t * | p, |
float * | table, | ||
float * | table_temp, | ||
int | res, | ||
dt_iop_filmic_data_t * | d, | ||
dt_iop_filmic_nodes_t * | nodes_data | ||
) |
Now we have 3 segments :
BUT : in case some nodes overlap, we need to remove them to avoid degenerating of the curve
References CUBIC_SPLINE, dt_draw_curve_add_point(), dt_draw_curve_calc_values(), dt_draw_curve_destroy(), dt_draw_curve_new(), FALSE, dt_iop_filmic_data_t::latitude_max, dt_iop_filmic_data_t::latitude_min, MONOTONE_HERMITE, dt_iop_filmic_nodes_t::nodes, TRUE, dt_iop_filmic_nodes_t::x, and dt_iop_filmic_nodes_t::y.
Referenced by commit_params(), and dt_iop_tonecurve_draw().
|
static |
References darktable, darktable_t::develop, dt_bauhaus_slider_get(), dt_dev_add_history_item, dt_iop_color_picker_reset(), darktable_t::gui, dt_iop_module_t::params, dt_gui_gtk_t::reset, TRUE, and dt_iop_module_t::widget.
Referenced by gui_init().
int default_colorspace | ( | dt_iop_module_t * | self, |
dt_dev_pixelpipe_t * | pipe, | ||
dt_dev_pixelpipe_iop_t * | piece | ||
) |
References IOP_CS_LAB.
int default_group | ( | ) |
References IOP_GROUP_TONES.
const char * deprecated_msg | ( | ) |
|
static |
References compute_curve_lut(), dt_cairo_image_surface_create(), dt_draw_grid(), DT_GUI_CURVE_EDITOR_INSET, DT_PIXEL_APPLY_DPI, FALSE, dt_iop_module_t::gui_data, height, Log2(), M_PI, dt_iop_filmic_nodes_t::nodes, dt_iop_module_t::params, TRUE, width, dt_iop_filmic_nodes_t::x, and dt_iop_filmic_nodes_t::y.
Referenced by gui_init().
int flags | ( | ) |
|
inlinestatic |
References M_PI.
|
static |
References darktable, darktable_t::develop, dt_bauhaus_slider_get(), dt_dev_add_history_item, dt_iop_color_picker_reset(), darktable_t::gui, dt_iop_module_t::params, dt_gui_gtk_t::reset, and TRUE.
Referenced by gui_init().
|
static |
References darktable, darktable_t::develop, dt_bauhaus_slider_get(), dt_bauhaus_slider_set(), dt_dev_add_history_item, dt_iop_color_picker_reset(), darktable_t::gui, dt_iop_module_t::gui_data, Log2(), dt_iop_module_t::params, dt_gui_gtk_t::reset, TRUE, and dt_iop_module_t::widget.
Referenced by gui_init().
|
static |
References darktable, darktable_t::develop, dt_bauhaus_slider_get(), dt_dev_add_history_item, dt_iop_color_picker_reset(), darktable_t::gui, dt_iop_module_t::params, dt_gui_gtk_t::reset, TRUE, and dt_iop_module_t::widget.
Referenced by gui_init().
void gui_init | ( | dt_iop_module_t * | self | ) |
References _extra_options_button_changed(), balance_callback(), darktable_t::bauhaus, black_point_source_callback(), black_point_target_callback(), contrast_callback(), CPF_DIRECTION_LEFT, darktable, dt_iop_module_t::default_params, dt_bauhaus_combobox_add(), dt_bauhaus_combobox_new(), dt_bauhaus_slider_new_with_range(), dt_bauhaus_slider_set_format(), dt_bauhaus_slider_set_soft_range(), DT_BAUHAUS_SPACE, dt_bauhaus_widget_set_label(), DT_COLOR_PICKER_AREA, dt_color_picker_new(), dt_gui_add_class(), DT_GUI_MODULE, dt_iop_tonecurve_draw(), dt_ui_section_label_new(), dtgtk_cairo_paint_solid_arrow(), dtgtk_drawing_area_new_with_aspect_ratio(), DTGTK_EXPANDER, dtgtk_expander_new(), dtgtk_expander_set_expanded(), dtgtk_togglebutton_new(), FALSE, global_saturation_callback(), grey_point_source_callback(), grey_point_target_callback(), interpolator_callback(), IOP_GUI_ALLOC, latitude_stops_callback(), output_power_callback(), preserve_color_callback(), saturation_callback(), security_threshold_callback(), TRUE, white_point_source_callback(), white_point_target_callback(), and dt_iop_module_t::widget.
void gui_reset | ( | dt_iop_module_t * | self | ) |
void gui_update | ( | dt_iop_module_t * | self | ) |
void init | ( | dt_iop_module_t * | module | ) |
References CUBIC_SPLINE, and dt_iop_module_t::default_params.
void init_global | ( | dt_iop_module_so_t * | module | ) |
References dt_opencl_create_kernel(), and dt_iop_filmic_global_data_t::kernel_filmic.
void init_pipe | ( | dt_iop_module_t * | self, |
dt_dev_pixelpipe_t * | pipe, | ||
dt_dev_pixelpipe_iop_t * | piece | ||
) |
References dt_dev_pixelpipe_iop_t::data, and dt_dev_pixelpipe_iop_t::data_size.
void init_presets | ( | dt_iop_module_so_t * | self | ) |
|
static |
|
static |
int legacy_params | ( | dt_iop_module_t * | self, |
const void *const | old_params, | ||
const int | old_version, | ||
void * | new_params, | ||
const int | new_version | ||
) |
References dt_iop_filmic_params_t::balance, dt_iop_filmic_params_t::black_point_source, dt_iop_filmic_params_t::black_point_target, dt_iop_filmic_params_t::contrast, dt_iop_module_t::default_params, dt_iop_filmic_params_t::global_saturation, dt_iop_filmic_params_t::grey_point_source, dt_iop_filmic_params_t::grey_point_target, dt_iop_filmic_params_t::interpolator, dt_iop_filmic_params_t::latitude_stops, dt_iop_filmic_params_t::output_power, dt_iop_filmic_params_t::preserve_color, dt_iop_filmic_params_t::saturation, dt_iop_filmic_params_t::security_factor, dt_iop_filmic_params_t::white_point_source, and dt_iop_filmic_params_t::white_point_target.
const char * name | ( | ) |
|
static |
References darktable, darktable_t::develop, dt_bauhaus_slider_get(), dt_dev_add_history_item, dt_iop_color_picker_reset(), darktable_t::gui, dt_iop_module_t::params, dt_gui_gtk_t::reset, TRUE, and dt_iop_module_t::widget.
Referenced by gui_init().
|
static |
References darktable, darktable_t::develop, dt_dev_add_history_item, darktable_t::gui, dt_iop_module_t::params, dt_gui_gtk_t::reset, and TRUE.
Referenced by gui_init().
void process | ( | 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 | ||
) |
The log2(x) -> -INF when x -> 0 thus very low values (noise) will get even lower, resulting in noise negative amplification, which leads to pepper noise in shadows. To avoid that, we need to clip values that are noise for sure. Using 16 bits RAW data, the black value (known by rawspeed for every manufacturer) could be used as a threshold. However, at this point of the pixelpipe, the RAW levels have already been corrected and everything can happen with black levels in the exposure module. So we define the threshold as the first non-null 16 bit integer
References dt_iop_filmic_data_t::black_source, dt_dev_pixelpipe_iop_t::colors, dt_dev_pixelpipe_iop_t::data, DT_ALIGNED_ARRAY, DT_DEV_PIXELPIPE_DISPLAY_MASK, dt_iop_alpha_copy(), dt_Lab_to_XYZ(), dt_prophotorgb_to_Lab(), dt_prophotorgb_to_XYZ(), dt_XYZ_to_prophotorgb(), dt_iop_filmic_data_t::dynamic_range, FALSE, fastlog2(), dt_iop_filmic_data_t::global_saturation, dt_iop_filmic_data_t::grad_2, dt_iop_filmic_data_t::grey_source, dt_iop_roi_t::height, dt_iop_filmic_data_t::output_power, dt_dev_pixelpipe_iop_t::pipe, dt_iop_filmic_data_t::preserve_color, dt_iop_filmic_data_t::table, TRUE, and dt_iop_roi_t::width.
|
static |
|
static |
References darktable, darktable_t::develop, dt_bauhaus_slider_get(), dt_dev_add_history_item, dt_iop_color_picker_reset(), darktable_t::gui, dt_iop_module_t::params, dt_gui_gtk_t::reset, and TRUE.
Referenced by gui_init().
|
static |
References darktable, darktable_t::develop, dt_bauhaus_slider_get(), dt_bauhaus_slider_set(), dt_dev_add_history_item, dt_iop_color_picker_reset(), darktable_t::gui, dt_iop_module_t::gui_data, dt_iop_module_t::params, dt_gui_gtk_t::reset, sanitize_latitude(), TRUE, and dt_iop_module_t::widget.
Referenced by gui_init().
|
static |
|
static |
References darktable, darktable_t::develop, dt_bauhaus_slider_get(), dt_dev_add_history_item, dt_iop_color_picker_reset(), darktable_t::gui, dt_iop_module_t::params, dt_gui_gtk_t::reset, TRUE, and dt_iop_module_t::widget.
Referenced by gui_init().