![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
#include "develop/imageop_gui.h"#include "widgets/bauhaus.h"#include "system/macros.h"#include "system/openmp.h"#include "system/target_clones.h"#include "system/mem_alloc.h"#include "system/simd.h"#include "common/logging.h"#include "common/module_versioning.h"#include "math/math.h"#include "common/opencl.h"#include "develop/develop.h"#include "develop/imageop_math.h"#include "widgets/expander.h"#include "widgets/paint.h"#include "gui/presets.h"#include "gui/color_picker_proxy.h"#include "iop/iop_api.h"#include "develop/imageop.h"#include "widgets/draw.h"#include <assert.h>#include <stdlib.h>#include <string.h>#include "widgets/label.h"#include "widgets/scroll_wrap.h"#include "gui/screen_metrics.h"#include "widgets/togglebutton.h"
Include dependency graph for filmic.c:Go to the source code of this file.
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 |
Definition at line 1455 of file filmic.c.
References CPF_DIRECTION_DOWN, CPF_DIRECTION_LEFT, dt_iop_gui_data(), dtgtk_cairo_paint_solid_arrow(), DTGTK_EXPANDER, dtgtk_expander_set_expanded(), DTGTK_TOGGLEBUTTON, dtgtk_togglebutton_set_paint(), and g.
Referenced by gui_init().
|
static |
Definition at line 625 of file filmic.c.
References dt_iop_module_t::dev, dt_bauhaus_slider_set(), dt_dev_add_history_item, dt_gui_freeze_begin, dt_gui_freeze_end, dt_gui_widgets_suppressed(), dt_iop_gui_data(), dt_Lab_to_XYZ(), g, dt_iop_module_t::gui, Log2Thres(), noise, p, dt_iop_module_t::params, dt_iop_module_t::picked_color_min, sanitize_latitude(), TRUE, dt_iop_module_gui_t::widget, and XYZ.
Referenced by color_picker_apply().
|
static |
Definition at line 599 of file filmic.c.
References dt_iop_module_t::dev, dt_bauhaus_slider_set(), dt_dev_add_history_item, dt_gui_freeze_begin, dt_gui_freeze_end, dt_gui_widgets_suppressed(), dt_iop_gui_data(), dt_Lab_to_XYZ(), g, dt_iop_module_t::gui, Log2(), p, dt_iop_module_t::params, dt_iop_module_t::picked_color, TRUE, dt_iop_module_gui_t::widget, and XYZ.
Referenced by color_picker_apply().
|
static |
Definition at line 653 of file filmic.c.
References dt_iop_module_t::dev, dt_bauhaus_slider_set(), dt_dev_add_history_item, dt_gui_freeze_begin, dt_gui_freeze_end, dt_gui_widgets_suppressed(), dt_iop_gui_data(), dt_Lab_to_XYZ(), g, dt_iop_module_t::gui, Log2Thres(), noise, p, dt_iop_module_t::params, dt_iop_module_t::picked_color_max, sanitize_latitude(), TRUE, dt_iop_module_gui_t::widget, and XYZ.
Referenced by color_picker_apply().
|
static |
Definition at line 713 of file filmic.c.
References dt_iop_module_t::dev, dt_bauhaus_slider_set(), dt_dev_add_history_item, dt_gui_freeze_begin, dt_gui_freeze_end, dt_iop_gui_data(), dt_Lab_to_XYZ(), g, dt_iop_module_t::gui, Log2Thres(), noise, 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, sanitize_latitude(), TRUE, dt_iop_module_gui_t::widget, and XYZ.
Referenced by color_picker_apply().
Definition at line 915 of file filmic.c.
References dt_iop_module_t::dev, dt_bauhaus_slider_get(), dt_dev_add_history_item, dt_gui_widgets_suppressed(), dt_iop_color_picker_reset(), dt_iop_module_t::gui, p, dt_iop_module_t::params, TRUE, and dt_iop_module_gui_t::widget.
Referenced by gui_init().
Definition at line 808 of file filmic.c.
References dt_iop_module_t::dev, dt_bauhaus_slider_get(), dt_dev_add_history_item, dt_gui_widgets_suppressed(), dt_iop_color_picker_reset(), dt_iop_gui_data(), g, dt_iop_module_t::gui, p, dt_iop_module_t::params, sanitize_latitude(), TRUE, and dt_iop_module_gui_t::widget.
Referenced by gui_init().
Definition at line 893 of file filmic.c.
References dt_iop_module_t::dev, dt_bauhaus_slider_get(), dt_dev_add_history_item, dt_gui_widgets_suppressed(), dt_iop_color_picker_reset(), dt_iop_module_t::gui, p, dt_iop_module_t::params, TRUE, and dt_iop_module_gui_t::widget.
Referenced by gui_init().
| void cleanup | ( | dt_iop_module_t * | module | ) |
Definition at line 1331 of file filmic.c.
References dt_iop_module_t::default_params, dt_free, and dt_iop_module_t::params.
| void cleanup_global | ( | dt_iop_module_so_t * | module | ) |
Definition at line 1337 of file filmic.c.
References dt_iop_module_so_t::data, dt_free, dt_opencl_free_kernel(), and dt_iop_filmic_global_data_t::kernel_filmic.
| void cleanup_pipe | ( | dt_iop_module_t * | self, |
| dt_dev_pixelpipe_t * | pipe, | ||
| dt_dev_pixelpipe_iop_t * | piece | ||
| ) |
Definition at line 1256 of file filmic.c.
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 | ||
| ) |
Definition at line 753 of file filmic.c.
References apply_auto_black(), apply_auto_grey(), apply_auto_white_point_source(), apply_autotune(), dt_iop_gui_data(), and g.
| void commit_params | ( | dt_iop_module_t * | self, |
| dt_iop_params_t * | p1, | ||
| dt_dev_pixelpipe_t * | pipe, | ||
| dt_dev_pixelpipe_iop_t * | piece | ||
| ) |
Definition at line 1185 of file filmic.c.
References __OMP_PARALLEL_FOR_SIMD__, compute_curve_lut(), d, dt_dev_pixelpipe_iop_t::data, dt_free, k, p, sigma, 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
Definition at line 974 of file filmic.c.
References __OMP_PARALLEL_FOR_SIMD__, coeff, CUBIC_SPLINE, d, dt_draw_curve_add_point(), dt_draw_curve_calc_values(), dt_draw_curve_destroy(), dt_draw_curve_new(), FALSE, IS_NULL_PTR, k, MONOTONE_HERMITE, dt_iop_filmic_nodes_t::nodes, p, res, TRUE, dt_iop_filmic_nodes_t::x, and dt_iop_filmic_nodes_t::y.
Referenced by commit_params(), and dt_iop_tonecurve_draw().
Definition at line 851 of file filmic.c.
References dt_iop_module_t::dev, dt_bauhaus_slider_get(), dt_dev_add_history_item, dt_gui_widgets_suppressed(), dt_iop_color_picker_reset(), dt_iop_module_t::gui, p, dt_iop_module_t::params, TRUE, and dt_iop_module_gui_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 | ||
| ) |
Definition at line 204 of file filmic.c.
References IOP_CS_LAB.
| int default_group | ( | ) |
Definition at line 189 of file filmic.c.
References IOP_GROUP_TONES.
|
static |
Definition at line 1354 of file filmic.c.
References compute_curve_lut(), d, dt_cairo_image_surface_create(), dt_draw_grid(), dt_free, DT_GUI_CURVE_EDITOR_INSET, dt_iop_gui_data(), DT_PIXEL_APPLY_DPI, FALSE, height, i, k, 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 | ( | ) |
Definition at line 194 of file filmic.c.
References IOP_FLAGS_ALLOW_TILING, IOP_FLAGS_DEPRECATED, IOP_FLAGS_INCLUDE_IN_STYLES, and IOP_FLAGS_SUPPORTS_BLENDING.
|
inlinestatic |
Definition at line 404 of file filmic.c.
Referenced by _cf_stage_cl(), _hf_stage_cl(), _hl_gauss_cache_flush(), _hl_gauss_get(), _knee_blur(), _knee_blur4(), _region_blur(), and _region_blur_cl().
Definition at line 872 of file filmic.c.
References dt_iop_module_t::dev, dt_bauhaus_slider_get(), dt_dev_add_history_item, dt_gui_widgets_suppressed(), dt_iop_color_picker_reset(), p, dt_iop_module_t::params, and TRUE.
Referenced by gui_init().
Definition at line 768 of file filmic.c.
References dt_iop_module_t::dev, dt_bauhaus_slider_get(), dt_bauhaus_slider_set(), dt_dev_add_history_item, dt_gui_freeze_begin, dt_gui_freeze_end, dt_gui_widgets_suppressed(), dt_iop_color_picker_reset(), dt_iop_gui_data(), g, dt_iop_module_t::gui, Log2(), p, dt_iop_module_t::params, TRUE, and dt_iop_module_gui_t::widget.
Referenced by gui_init().
Definition at line 824 of file filmic.c.
References dt_iop_module_t::dev, dt_bauhaus_slider_get(), dt_dev_add_history_item, dt_gui_widgets_suppressed(), dt_iop_color_picker_reset(), dt_iop_module_t::gui, p, dt_iop_module_t::params, TRUE, and dt_iop_module_gui_t::widget.
Referenced by gui_init().
| void gui_init | ( | dt_iop_module_t * | self | ) |
Definition at line 1465 of file filmic.c.
References _extra_options_button_changed(), balance_callback(), black_point_source_callback(), black_point_target_callback(), contrast_callback(), CPF_DIRECTION_LEFT, dt_iop_module_t::default_params, dt_bauhaus_combobox_add(), dt_bauhaus_combobox_new(), dt_bauhaus_get_global(), dt_bauhaus_slider_new_with_range(), dt_bauhaus_slider_set_format(), dt_bauhaus_slider_set_soft_range(), dt_bauhaus_widget_set_label(), DT_COLOR_PICKER_AREA, dt_color_picker_new(), DT_GUI_BOX_SPACING, DT_GUI_MODULE, dt_iop_tonecurve_draw(), dt_ui_resizable_drawing_area(), dt_ui_section_label_new(), dtgtk_cairo_paint_solid_arrow(), 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(), dt_iop_module_t::gui, 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_gui_t::widget.
| void gui_reset | ( | dt_iop_module_t * | self | ) |
Definition at line 1344 of file filmic.c.
References CPF_DIRECTION_LEFT, dt_iop_color_picker_reset(), dt_iop_gui_data(), dtgtk_cairo_paint_solid_arrow(), DTGTK_EXPANDER, dtgtk_expander_set_expanded(), DTGTK_TOGGLEBUTTON, dtgtk_togglebutton_set_paint(), FALSE, g, and TRUE.
| void gui_update | ( | dt_iop_module_t * | self | ) |
Refresh GUI controls from current params and configuration.
Definition at line 1262 of file filmic.c.
References dt_bauhaus_combobox_set(), dt_bauhaus_slider_set(), dt_iop_color_picker_reset(), dt_iop_gui_data(), DTGTK_EXPANDER, dtgtk_expander_set_expanded(), g, dt_iop_module_t::gui, p, TRUE, and dt_iop_module_gui_t::widget.
| void init | ( | dt_iop_module_t * | module | ) |
Definition at line 1294 of file filmic.c.
References CUBIC_SPLINE, and dt_iop_module_t::default_params.
| void init_global | ( | dt_iop_module_so_t * | module | ) |
Definition at line 1321 of file filmic.c.
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 | ||
| ) |
Definition at line 1250 of file filmic.c.
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 | ) |
Definition at line 309 of file filmic.c.
References CUBIC_SPLINE, 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 | ||
| ) |
Definition at line 209 of file filmic.c.
References dt_iop_buffer_dsc_t::channels, dt_iop_buffer_dsc_t::datatype, default_input_format(), and TYPE_FLOAT.
|
static |
Definition at line 926 of file filmic.c.
References CATMULL_ROM, CUBIC_SPLINE, dt_iop_module_t::dev, dt_bauhaus_combobox_get(), dt_dev_add_history_item, dt_gui_widgets_suppressed(), dt_iop_color_picker_reset(), dt_iop_module_t::gui, MONOTONE_HERMITE, p, dt_iop_module_t::params, TRUE, and dt_iop_module_gui_t::widget.
Referenced by gui_init().
Definition at line 835 of file filmic.c.
References dt_iop_module_t::dev, dt_bauhaus_slider_get(), dt_dev_add_history_item, dt_gui_widgets_suppressed(), dt_iop_color_picker_reset(), dt_iop_gui_data(), g, dt_iop_module_t::gui, p, dt_iop_module_t::params, sanitize_latitude(), TRUE, and dt_iop_module_gui_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 | ||
| ) |
Definition at line 217 of file filmic.c.
References d, dt_iop_module_t::default_params, and n.
Definition at line 904 of file filmic.c.
References dt_iop_module_t::dev, dt_bauhaus_slider_get(), dt_dev_add_history_item, dt_gui_widgets_suppressed(), dt_iop_color_picker_reset(), dt_iop_module_t::gui, p, dt_iop_module_t::params, TRUE, and dt_iop_module_gui_t::widget.
Referenced by gui_init().
|
static |
Definition at line 966 of file filmic.c.
References dt_iop_module_t::dev, dt_dev_add_history_item, dt_gui_widgets_suppressed(), p, dt_iop_module_t::params, and TRUE.
Referenced by gui_init().
| __DT_CLONE_TARGETS__ 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
Definition at line 410 of file filmic.c.
References __OMP_PARALLEL_FOR_SIMD__, dt_iop_filmic_data_t::black_source, ch, dt_dev_pixelpipe_iop_t::data, DT_ALIGNED_ARRAY, DT_DEV_PIXELPIPE_DISPLAY_MASK, 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, k, dt_dev_pixelpipe_t::mask_display, max, out, dt_iop_filmic_data_t::output_power, ovoid, 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.
| int process_cl | ( | struct dt_iop_module_t * | self, |
| const dt_dev_pixelpipe_t * | pipe, | ||
| const dt_dev_pixelpipe_iop_t * | piece, | ||
| cl_mem | dev_in, | ||
| cl_mem | dev_out | ||
| ) |
Definition at line 528 of file filmic.c.
References d, dt_dev_pixelpipe_iop_t::data, dt_dev_pixelpipe_t::devid, DT_DEBUG_OPENCL, dt_opencl_copy_host_to_device(), dt_opencl_enqueue_kernel_2d(), dt_opencl_release_mem_object(), dt_opencl_set_kernel_arg(), dt_print(), error(), FALSE, dt_iop_module_t::global_data, height, dt_iop_roi_t::height, IS_NULL_PTR, dt_iop_filmic_global_data_t::kernel_filmic, dt_dev_pixelpipe_iop_t::roi_in, ROUNDUPDHT, ROUNDUPDWD, TRUE, width, and dt_iop_roi_t::width.
|
static |
Definition at line 586 of file filmic.c.
References dt_bauhaus_slider_set(), dt_gui_freeze_begin, dt_gui_freeze_end, g, and p.
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().
Definition at line 862 of file filmic.c.
References dt_iop_module_t::dev, dt_bauhaus_slider_get(), dt_dev_add_history_item, dt_gui_widgets_suppressed(), dt_iop_color_picker_reset(), p, dt_iop_module_t::params, and TRUE.
Referenced by gui_init().
Definition at line 680 of file filmic.c.
References dt_iop_module_t::dev, dt_bauhaus_slider_get(), dt_bauhaus_slider_set(), dt_dev_add_history_item, dt_gui_freeze_begin, dt_gui_freeze_end, dt_gui_widgets_suppressed(), dt_iop_color_picker_reset(), dt_iop_gui_data(), g, dt_iop_module_t::gui, p, dt_iop_module_t::params, sanitize_latitude(), TRUE, and dt_iop_module_gui_t::widget.
Referenced by gui_init().
Definition at line 792 of file filmic.c.
References dt_iop_module_t::dev, dt_bauhaus_slider_get(), dt_dev_add_history_item, dt_gui_widgets_suppressed(), dt_iop_color_picker_reset(), dt_iop_gui_data(), g, dt_iop_module_t::gui, p, dt_iop_module_t::params, sanitize_latitude(), TRUE, and dt_iop_module_gui_t::widget.
Referenced by gui_init().
Definition at line 882 of file filmic.c.
References dt_iop_module_t::dev, dt_bauhaus_slider_get(), dt_dev_add_history_item, dt_gui_widgets_suppressed(), dt_iop_color_picker_reset(), dt_iop_module_t::gui, p, dt_iop_module_t::params, TRUE, and dt_iop_module_gui_t::widget.
Referenced by gui_init().