![]() |
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: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 1449 of file filmic.c.
References CPF_DIRECTION_DOWN, CPF_DIRECTION_LEFT, dtgtk_cairo_paint_solid_arrow(), DTGTK_EXPANDER, dtgtk_expander_set_expanded(), DTGTK_TOGGLEBUTTON, dtgtk_togglebutton_set_paint(), g, and dt_iop_module_t::gui_data.
Referenced by gui_init().
|
static |
Definition at line 618 of file filmic.c.
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(), noise, 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 |
Definition at line 592 of file filmic.c.
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 |
Definition at line 646 of file filmic.c.
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(), noise, 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 |
Definition at line 706 of file filmic.c.
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(), 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, dt_gui_gtk_t::reset, sanitize_latitude(), TRUE, dt_iop_module_t::widget, and XYZ.
Referenced by color_picker_apply().
Definition at line 908 of file filmic.c.
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().
Definition at line 801 of file filmic.c.
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().
Definition at line 886 of file filmic.c.
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 | ) |
Definition at line 1325 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 1331 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 1249 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 746 of file filmic.c.
References apply_auto_black(), apply_auto_grey(), apply_auto_white_point_source(), apply_autotune(), g, and dt_iop_module_t::gui_data.
| 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 1178 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 967 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, 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 844 of file filmic.c.
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 | ||
| ) |
Definition at line 197 of file filmic.c.
References IOP_CS_LAB.
| int default_group | ( | ) |
Definition at line 182 of file filmic.c.
References IOP_GROUP_TONES.
|
static |
Definition at line 1348 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_PIXEL_APPLY_DPI, FALSE, dt_iop_module_t::gui_data, 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 187 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 865 of file filmic.c.
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().
Definition at line 761 of file filmic.c.
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().
Definition at line 817 of file filmic.c.
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 | ) |
Definition at line 1459 of file filmic.c.
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_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(), 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 | ) |
Definition at line 1338 of file filmic.c.
References CPF_DIRECTION_LEFT, dt_iop_color_picker_reset(), dtgtk_cairo_paint_solid_arrow(), DTGTK_EXPANDER, dtgtk_expander_set_expanded(), DTGTK_TOGGLEBUTTON, dtgtk_togglebutton_set_paint(), FALSE, g, dt_iop_module_t::gui_data, and TRUE.
| void gui_update | ( | dt_iop_module_t * | self | ) |
Refresh GUI controls from current params and configuration.
Definition at line 1255 of file filmic.c.
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 | ) |
Definition at line 1287 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 1315 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 1243 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 302 of file filmic.c.
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 | ||
| ) |
Definition at line 202 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 919 of file filmic.c.
References CATMULL_ROM, CUBIC_SPLINE, darktable, darktable_t::develop, dt_bauhaus_combobox_get(), dt_dev_add_history_item, dt_iop_color_picker_reset(), darktable_t::gui, MONOTONE_HERMITE, p, dt_iop_module_t::params, dt_gui_gtk_t::reset, TRUE, and dt_iop_module_t::widget.
Referenced by gui_init().
Definition at line 828 of file filmic.c.
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 | ||
| ) |
Definition at line 210 of file filmic.c.
References d, dt_iop_module_t::default_params, and n.
Definition at line 897 of file filmic.c.
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 |
Definition at line 959 of file filmic.c.
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().
| __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 403 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 521 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 579 of file filmic.c.
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().
Definition at line 855 of file filmic.c.
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().
Definition at line 673 of file filmic.c.
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().
Definition at line 785 of file filmic.c.
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().
Definition at line 875 of file filmic.c.
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().