![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
#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/module_versioning.h"#include <glib/gstdio.h>#include "pixel/bilateral.h"#include "colorprofiles/colorspaces.h"#include "common/imagebuf.h"#include "common/points.h"#include "control/control.h"#include "develop/develop.h"#include "develop/imageop.h"#include "develop/imageop_gui.h"#include "develop/tiling.h"#include "widgets/drawingarea.h"#include "iop/iop_api.h"#include <gtk/gtk.h>#include <inttypes.h>#include <math.h>#include <stdlib.h>#include <string.h>#include "widgets/label.h"#include "gui/screen_metrics.h"#include "control/signal.h"
Include dependency graph for colormapping.c:Go to the source code of this file.
Data Structures | |
| struct | dt_iop_colormapping_flowback_t |
| struct | dt_iop_colormapping_params_t |
| struct | dt_iop_colormapping_gui_data_t |
Macros | |
| #define | HISTN (1 << 11) |
| #define | MAXN 5 |
Typedefs | |
| typedef float | float2[2] |
| typedef enum dt_iop_colormapping_flags_t | dt_iop_colormapping_flags_t |
| typedef struct dt_iop_colormapping_flowback_t | dt_iop_colormapping_flowback_t |
| typedef struct dt_iop_colormapping_params_t | dt_iop_colormapping_params_t |
| typedef struct dt_iop_colormapping_params_t | dt_iop_colormapping_data_t |
| typedef struct dt_iop_colormapping_gui_data_t | dt_iop_colormapping_gui_data_t |
Enumerations | |
| enum | dt_iop_colormapping_flags_t { NEUTRAL = 0 , HAS_SOURCE = 1 << 0 , HAS_TARGET = 1 << 1 , HAS_SOURCE_TARGET = HAS_SOURCE | HAS_TARGET , ACQUIRE = 1 << 2 , GET_SOURCE = 1 << 3 , GET_TARGET = 1 << 4 } |
Functions | |
| const char * | name () |
| const char ** | description (struct dt_iop_module_t *self) |
| int | default_group () |
| int | flags () |
| int | default_colorspace (dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece) |
| static void | capture_histogram (const float *col, const int width, const int height, int *hist) |
| static void | invert_histogram (const int *hist, float *inv_hist) |
| static __DT_CLONE_TARGETS__ void | get_cluster_mapping (const int n, float2 *mi, const float *wi, float2 *mo, const float *wo, const float dominance, int *mapio) |
| static __DT_CLONE_TARGETS__ void | get_clusters (const float *col, const int n, float2 *mean, float *weight) |
| static int | get_cluster (const float *col, const int n, float2 *mean) |
| static void | kmeans (const float *col, const int width, const int height, const int n, float2 *mean_out, float2 *var_out, float *weight_out) |
| __DT_CLONE_TARGETS__ int | process (struct 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) |
| void | tiling_callback (struct dt_iop_module_t *self, const struct dt_dev_pixelpipe_t *pipe, const struct dt_dev_pixelpipe_iop_t *piece, struct dt_develop_tiling_t *tiling) |
| 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 | gui_changed (dt_iop_module_t *self, GtkWidget *w, void *previous) |
| static void | acquire_source_button_pressed (GtkButton *button, dt_iop_module_t *self) |
| static void | acquire_target_button_pressed (GtkButton *button, dt_iop_module_t *self) |
| void | init_pipe (struct dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece) |
| void | cleanup_pipe (struct dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece) |
| void | reload_defaults (dt_iop_module_t *module) |
| static gboolean | cluster_preview_draw (GtkWidget *widget, cairo_t *crf, dt_iop_module_t *self) |
| static void | process_clusters (gpointer instance, gpointer user_data) |
| void | gui_init (struct dt_iop_module_t *self) |
| void | gui_cleanup (struct dt_iop_module_t *self) |
| #define HISTN (1 << 11) |
color transfer somewhat based on the glorious paper ‘color transfer between images’ by erik reinhard, michael ashikhmin, bruce gooch, and peter shirley, 2001. chosen because it officially cites the playboy.
workflow:
Definition at line 87 of file colormapping.c.
| #define MAXN 5 |
Definition at line 88 of file colormapping.c.
| typedef struct dt_iop_colormapping_params_t dt_iop_colormapping_data_t |
and pixelpipe data is just the same
Definition at line 142 of file colormapping.c.
| typedef enum dt_iop_colormapping_flags_t dt_iop_colormapping_flags_t |
| typedef struct dt_iop_colormapping_flowback_t dt_iop_colormapping_flowback_t |
| typedef struct dt_iop_colormapping_gui_data_t dt_iop_colormapping_gui_data_t |
| typedef struct dt_iop_colormapping_params_t dt_iop_colormapping_params_t |
| typedef float float2[2] |
Definition at line 90 of file colormapping.c.
| Enumerator | |
|---|---|
| NEUTRAL | |
| HAS_SOURCE | |
| HAS_TARGET | |
| HAS_SOURCE_TARGET | |
| ACQUIRE | |
| GET_SOURCE | |
| GET_TARGET | |
Definition at line 92 of file colormapping.c.
|
static |
Definition at line 658 of file colormapping.c.
References ACQUIRE, dt_iop_module_t::dev, dt_dev_add_history_item, dt_gui_widgets_suppressed(), dt_iop_request_focus(), GET_SOURCE, p, dt_iop_module_t::params, and TRUE.
Referenced by gui_init().
|
static |
Definition at line 669 of file colormapping.c.
References ACQUIRE, dt_iop_module_t::dev, dt_dev_add_history_item, dt_gui_widgets_suppressed(), dt_iop_request_focus(), GET_TARGET, p, dt_iop_module_t::params, and TRUE.
Referenced by gui_init().
|
static |
Definition at line 193 of file colormapping.c.
References height, HISTN, i, k, and width.
Referenced by process_clusters().
| void cleanup_pipe | ( | struct dt_iop_module_t * | self, |
| dt_dev_pixelpipe_t * | pipe, | ||
| dt_dev_pixelpipe_iop_t * | piece | ||
| ) |
Definition at line 686 of file colormapping.c.
References dt_dev_pixelpipe_iop_t::data, and dt_free_align.
|
static |
Definition at line 709 of file colormapping.c.
References dt_cairo_image_surface_create(), dt_iop_gui_data(), DT_PIXEL_APPLY_DPI, g, height, i, Lab, p, dt_iop_module_t::params, rgb, TRUE, and width.
Referenced by gui_init().
| 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 | ||
| ) |
Definition at line 627 of file colormapping.c.
References d, dt_dev_pixelpipe_iop_t::data, and p.
| int default_colorspace | ( | dt_iop_module_t * | self, |
| dt_dev_pixelpipe_t * | pipe, | ||
| const dt_dev_pixelpipe_iop_t * | piece | ||
| ) |
Definition at line 188 of file colormapping.c.
References IOP_CS_LAB.
| int default_group | ( | ) |
Definition at line 178 of file colormapping.c.
References IOP_GROUP_COLOR.
| const char ** description | ( | struct dt_iop_module_t * | self | ) |
Definition at line 169 of file colormapping.c.
References dt_iop_set_description().
| int flags | ( | ) |
Definition at line 183 of file colormapping.c.
References IOP_FLAGS_DEPRECATED, IOP_FLAGS_ONE_INSTANCE, and IOP_FLAGS_SUPPORTS_BLENDING.
|
static |
|
static |
|
static |
| void gui_changed | ( | dt_iop_module_t * | self, |
| GtkWidget * | w, | ||
| void * | previous | ||
| ) |
Definition at line 636 of file colormapping.c.
References dt_control_queue_redraw_widget(), dt_iop_gui_data(), g, HISTN, MAXN, NEUTRAL, p, and dt_iop_module_t::params.
| void gui_cleanup | ( | struct dt_iop_module_t * | self | ) |
Definition at line 926 of file colormapping.c.
References dt_control_signal_get_global(), DT_DEBUG_CONTROL_SIGNAL_DISCONNECT, dt_free_align, dt_iop_gui_data(), g, IOP_GUI_FREE, and process_clusters().
| void gui_init | ( | struct dt_iop_module_t * | self | ) |
Definition at line 862 of file colormapping.c.
References acquire_source_button_pressed(), acquire_target_button_pressed(), cluster_preview_draw(), dt_bauhaus_slider_from_params(), dt_bauhaus_slider_set_format(), DT_COLORSPACE_LAB, DT_COLORSPACE_SRGB, dt_colorspaces_get_profile(), dt_control_signal_get_global(), DT_DEBUG_CONTROL_SIGNAL_CONNECT, DT_GUI_BOX_SPACING, dt_iop_button_new(), DT_PROFILE_ROLE_ANY, DT_PROFILE_ROLE_INPUT, DT_SIGNAL_DEVELOP_PREVIEW_PIPE_FINISHED, dt_ui_label_new(), dtgtk_drawing_area_new_with_aspect_ratio(), f, FALSE, g, dt_iop_module_t::gui, IOP_GUI_ALLOC, NEUTRAL, process_clusters(), dt_colorspaces_color_profile_t::profile, TRUE, and dt_iop_module_gui_t::widget.
| void init_pipe | ( | struct dt_iop_module_t * | self, |
| dt_dev_pixelpipe_t * | pipe, | ||
| dt_dev_pixelpipe_iop_t * | piece | ||
| ) |
Definition at line 680 of file colormapping.c.
References dt_dev_pixelpipe_iop_t::data, dt_dev_pixelpipe_iop_t::data_size, and dt_calloc_align().
|
static |
Definition at line 212 of file colormapping.c.
Referenced by process_clusters().
|
static |
Definition at line 315 of file colormapping.c.
References __OMP_PARALLEL_FOR__, dt_free, dt_points_get(), get_cluster(), height, i, k, L, Lab, n, and width.
Referenced by process_clusters().
| const char * name | ( | ) |
Definition at line 164 of file colormapping.c.
| __DT_CLONE_TARGETS__ int process | ( | struct 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 | ||
| ) |
Definition at line 454 of file colormapping.c.
References __OMP_FOR__, __OMP_PARALLEL__, __OMP_PARALLEL_FOR__, ACQUIRE, dt_dev_pixelpipe_iop_t::data, dt_iop_module_t::dev, dt_bilateral_blur(), dt_bilateral_free(), dt_bilateral_init(), dt_bilateral_slice(), dt_bilateral_splat(), dt_dev_get_module_scale(), dt_dev_pixelpipe_has_preview_output(), dt_free, dt_free_align, dt_get_perthread, dt_iop_gui_data(), dt_iop_gui_enter_critical_section(), dt_iop_gui_leave_critical_section(), dt_iop_image_alloc(), dt_iop_image_copy_by_size(), dt_pixelpipe_cache_alloc_perthread, dt_pixelpipe_cache_free_align, g, get_cluster_mapping(), get_clusters(), dt_develop_t::gui_attached, HAS_SOURCE, HAS_TARGET, height, dt_iop_roi_t::height, HISTN, i, IS_NULL_PTR, k, L, Lab, out, ovoid, dt_dev_pixelpipe_iop_t::roi_in, dt_dev_pixelpipe_iop_t::roi_out, sigma_r, sigma_s, weight(), width, and dt_iop_roi_t::width.
|
static |
Definition at line 774 of file colormapping.c.
References ACQUIRE, capture_histogram(), ch, dt_iop_module_t::dev, dt_control_queue_redraw(), dt_control_queue_redraw_widget(), dt_dev_add_history_item, dt_free_align, dt_gui_widget_freeze, dt_iop_gui_data(), dt_iop_gui_enter_critical_section(), dt_iop_gui_leave_critical_section(), dt_iop_image_alloc(), dt_iop_image_copy_by_size(), f, g, GET_SOURCE, GET_TARGET, HAS_SOURCE, HAS_TARGET, height, HISTN, invert_histogram(), IS_NULL_PTR, kmeans(), MAXN, p, dt_iop_module_t::params, TRUE, and width.
Referenced by gui_cleanup(), and gui_init().
| void reload_defaults | ( | dt_iop_module_t * | module | ) |
Definition at line 692 of file colormapping.c.
References d, dt_iop_module_t::dev, dt_iop_gui_data(), g, dt_develop_t::gui_attached, HAS_SOURCE, HISTN, IS_NULL_PTR, and MAXN.
| void tiling_callback | ( | struct dt_iop_module_t * | self, |
| const struct dt_dev_pixelpipe_t * | pipe, | ||
| const struct dt_dev_pixelpipe_iop_t * | piece, | ||
| struct dt_develop_tiling_t * | tiling | ||
| ) |
Definition at line 605 of file colormapping.c.
References dt_iop_buffer_dsc_t::channels, dt_dev_pixelpipe_iop_t::dsc_in, dt_bilateral_memory_use(), dt_bilateral_singlebuffer_size(), dt_dev_get_module_scale(), height, dt_iop_roi_t::height, dt_dev_pixelpipe_iop_t::roi_in, sigma_r, sigma_s, width, and dt_iop_roi_t::width.