![]() |
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>
Include dependency graph for filmic.c: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(), g, darktable_t::gui, dt_iop_module_t::gui_data, Log2Thres(), p, dt_iop_module_t::params, dt_iop_module_t::picked_color_min, dt_gui_gtk_t::reset, sanitize_latitude(), TRUE, dt_iop_module_t::widget, and XYZ.
Referenced by color_picker_apply().
|
static |
References darktable, darktable_t::develop, dt_bauhaus_slider_set(), dt_dev_add_history_item, dt_Lab_to_XYZ(), g, darktable_t::gui, dt_iop_module_t::gui_data, Log2(), p, dt_iop_module_t::params, dt_iop_module_t::picked_color, dt_gui_gtk_t::reset, TRUE, dt_iop_module_t::widget, and XYZ.
Referenced by color_picker_apply().
|
static |
References darktable, darktable_t::develop, dt_bauhaus_slider_set(), dt_dev_add_history_item, dt_Lab_to_XYZ(), g, darktable_t::gui, dt_iop_module_t::gui_data, Log2Thres(), p, dt_iop_module_t::params, dt_iop_module_t::picked_color_max, dt_gui_gtk_t::reset, sanitize_latitude(), TRUE, dt_iop_module_t::widget, and XYZ.
Referenced by color_picker_apply().
|
static |
References darktable, darktable_t::develop, dt_bauhaus_slider_set(), dt_dev_add_history_item, dt_Lab_to_XYZ(), g, darktable_t::gui, dt_iop_module_t::gui_data, Log2Thres(), p, 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, dt_iop_module_t::widget, and XYZ.
Referenced by color_picker_apply().
References darktable, darktable_t::develop, dt_bauhaus_slider_get(), dt_dev_add_history_item, dt_iop_color_picker_reset(), darktable_t::gui, p, dt_iop_module_t::params, dt_gui_gtk_t::reset, TRUE, and dt_iop_module_t::widget.
Referenced by gui_init().
References darktable, darktable_t::develop, dt_bauhaus_slider_get(), dt_dev_add_history_item, dt_iop_color_picker_reset(), g, darktable_t::gui, dt_iop_module_t::gui_data, p, dt_iop_module_t::params, dt_gui_gtk_t::reset, sanitize_latitude(), TRUE, and dt_iop_module_t::widget.
Referenced by gui_init().
References darktable, darktable_t::develop, dt_bauhaus_slider_get(), dt_dev_add_history_item, dt_iop_color_picker_reset(), darktable_t::gui, p, 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, dt_free, 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, and dt_free_align.
| void color_picker_apply | ( | dt_iop_module_t * | self, |
| GtkWidget * | picker, | ||
| dt_dev_pixelpipe_t * | pipe, | ||
| 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 compute_curve_lut(), d, dt_dev_pixelpipe_iop_t::data, dt_free, p, and x.
| 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 coeff, CUBIC_SPLINE, d, dt_draw_curve_add_point(), dt_draw_curve_calc_values(), dt_draw_curve_destroy(), dt_draw_curve_new(), FALSE, MONOTONE_HERMITE, dt_iop_filmic_nodes_t::nodes, p, TRUE, dt_iop_filmic_nodes_t::x, and dt_iop_filmic_nodes_t::y.
Referenced by commit_params(), and dt_iop_tonecurve_draw().
References darktable, darktable_t::develop, dt_bauhaus_slider_get(), dt_dev_add_history_item, dt_iop_color_picker_reset(), darktable_t::gui, p, 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, | ||
| const dt_dev_pixelpipe_iop_t * | piece | ||
| ) |
References IOP_CS_LAB.
| int default_group | ( | ) |
References IOP_GROUP_TONES.
| const char * deprecated_msg | ( | ) |
|
static |
References a, b, c, compute_curve_lut(), d, dt_cairo_image_surface_create(), dt_draw_grid(), dt_free, DT_GUI_CURVE_EDITOR_INSET, DT_PIXEL_APPLY_DPI, FALSE, dt_iop_module_t::gui_data, height, i, Log2(), M_PI, dt_iop_filmic_nodes_t::nodes, p, dt_iop_module_t::params, TRUE, width, x, dt_iop_filmic_nodes_t::x, and dt_iop_filmic_nodes_t::y.
Referenced by gui_init().
| int flags | ( | ) |
References darktable, darktable_t::develop, dt_bauhaus_slider_get(), dt_dev_add_history_item, dt_iop_color_picker_reset(), darktable_t::gui, p, dt_iop_module_t::params, dt_gui_gtk_t::reset, and TRUE.
Referenced by gui_init().
References darktable, darktable_t::develop, dt_bauhaus_slider_get(), dt_bauhaus_slider_set(), dt_dev_add_history_item, dt_iop_color_picker_reset(), g, darktable_t::gui, dt_iop_module_t::gui_data, Log2(), p, dt_iop_module_t::params, dt_gui_gtk_t::reset, TRUE, and dt_iop_module_t::widget.
Referenced by gui_init().
References darktable, darktable_t::develop, dt_bauhaus_slider_get(), dt_dev_add_history_item, dt_iop_color_picker_reset(), darktable_t::gui, p, 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, g, global_saturation_callback(), grey_point_source_callback(), grey_point_target_callback(), interpolator_callback(), IOP_GUI_ALLOC, latitude_stops_callback(), output_power_callback(), p, 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 | ) |
Refresh GUI controls from current params and configuration.
References dt_bauhaus_combobox_set(), dt_bauhaus_slider_set(), dt_iop_color_picker_reset(), DTGTK_EXPANDER, dtgtk_expander_set_expanded(), g, dt_iop_module_t::gui_data, p, TRUE, and dt_iop_module_t::widget.
| 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, dt_dev_pixelpipe_iop_t::data_size, and dt_calloc_align().
| void init_presets | ( | dt_iop_module_so_t * | self | ) |
References CUBIC_SPLINE, DEVELOP_BLEND_CS_RGB_DISPLAY, dt_gui_presets_add_generic(), dt_iop_module_so_t::op, and p.
| void input_format | ( | dt_iop_module_t * | self, |
| dt_dev_pixelpipe_t * | pipe, | ||
| dt_dev_pixelpipe_iop_t * | piece, | ||
| dt_iop_buffer_dsc_t * | dsc | ||
| ) |
|
static |
References darktable, darktable_t::develop, dt_bauhaus_slider_get(), dt_dev_add_history_item, dt_iop_color_picker_reset(), g, darktable_t::gui, dt_iop_module_t::gui_data, p, dt_iop_module_t::params, dt_gui_gtk_t::reset, sanitize_latitude(), TRUE, and dt_iop_module_t::widget.
Referenced by gui_init().
| 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 d, dt_iop_module_t::default_params, and n.
| const char * name | ( | ) |
References darktable, darktable_t::develop, dt_bauhaus_slider_get(), dt_dev_add_history_item, dt_iop_color_picker_reset(), darktable_t::gui, p, 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, p, dt_iop_module_t::params, dt_gui_gtk_t::reset, and TRUE.
Referenced by gui_init().
| int process | ( | dt_iop_module_t * | self, |
| const dt_dev_pixelpipe_t * | pipe, | ||
| const dt_dev_pixelpipe_iop_t * | piece, | ||
| const void *const | ivoid, | ||
| void *const | ovoid | ||
| ) |
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, c, 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_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_dev_pixelpipe_t::mask_display, max, out, dt_iop_filmic_data_t::output_power, dt_iop_filmic_data_t::preserve_color, rgb, dt_dev_pixelpipe_iop_t::roi_out, dt_iop_filmic_data_t::table, TRUE, dt_iop_roi_t::width, and XYZ.
|
static |
References darktable, dt_bauhaus_slider_set(), g, darktable_t::gui, p, and dt_gui_gtk_t::reset.
Referenced by apply_auto_black(), apply_auto_white_point_source(), apply_autotune(), black_point_source_callback(), latitude_stops_callback(), security_threshold_callback(), and white_point_source_callback().
References darktable, darktable_t::develop, dt_bauhaus_slider_get(), dt_dev_add_history_item, dt_iop_color_picker_reset(), darktable_t::gui, p, dt_iop_module_t::params, dt_gui_gtk_t::reset, and TRUE.
Referenced by gui_init().
References darktable, darktable_t::develop, dt_bauhaus_slider_get(), dt_bauhaus_slider_set(), dt_dev_add_history_item, dt_iop_color_picker_reset(), g, darktable_t::gui, dt_iop_module_t::gui_data, p, dt_iop_module_t::params, dt_gui_gtk_t::reset, sanitize_latitude(), TRUE, and dt_iop_module_t::widget.
Referenced by gui_init().
References darktable, darktable_t::develop, dt_bauhaus_slider_get(), dt_dev_add_history_item, dt_iop_color_picker_reset(), g, darktable_t::gui, dt_iop_module_t::gui_data, p, dt_iop_module_t::params, dt_gui_gtk_t::reset, sanitize_latitude(), TRUE, and dt_iop_module_t::widget.
Referenced by gui_init().
References darktable, darktable_t::develop, dt_bauhaus_slider_get(), dt_dev_add_history_item, dt_iop_color_picker_reset(), darktable_t::gui, p, dt_iop_module_t::params, dt_gui_gtk_t::reset, TRUE, and dt_iop_module_t::widget.
Referenced by gui_init().