![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
#include "blend.h"
#include "common/gaussian.h"
#include "common/guided_filter.h"
#include "common/imagebuf.h"
#include "common/interpolation.h"
#include "common/opencl.h"
#include "control/control.h"
#include "develop/imageop.h"
#include "develop/masks.h"
#include "develop/tiling.h"
#include "develop/imageop_math.h"
#include <math.h>
Typedefs | |
typedef enum _develop_mask_post_processing | _develop_mask_post_processing |
Enumerations | |
enum | _develop_mask_post_processing { DEVELOP_MASK_POST_NONE = 0 , DEVELOP_MASK_POST_BLUR = 1 , DEVELOP_MASK_POST_FEATHER_IN = 2 , DEVELOP_MASK_POST_FEATHER_OUT = 3 , DEVELOP_MASK_POST_TONE_CURVE = 4 } |
Variables | |
static dt_develop_blend_params_t | _default_blendop_params |
|
inlinestatic |
References DEVELOP_BLEND_CS_LAB, DEVELOP_BLEND_CS_NONE, DEVELOP_BLEND_CS_RAW, DEVELOP_BLEND_CS_RGB_DISPLAY, DEVELOP_BLEND_CS_RGB_SCENE, IOP_CS_HSL, IOP_CS_JZCZHZ, IOP_CS_LAB, IOP_CS_LCH, IOP_CS_RAW, IOP_CS_RGB, and IOP_FLAGS_SUPPORTS_BLENDING.
Referenced by dt_develop_blend_default_module_blend_colorspace(), and dt_develop_blend_legacy_params().
|
static |
|
static |
References DEVELOP_BLEND_BOUNDED, DEVELOP_BLEND_DISABLED_OBSOLETE, DEVELOP_BLEND_INVERSE_OBSOLETE, DEVELOP_BLEND_MODE_MASK, DEVELOP_BLEND_MULTIPLY, DEVELOP_BLEND_MULTIPLY_REVERSE_OBSOLETE, DEVELOP_BLEND_NORMAL2, DEVELOP_BLEND_NORMAL_OBSOLETE, DEVELOP_BLEND_REVERSE, DEVELOP_BLEND_UNBOUNDED_OBSOLETE, FALSE, and TRUE.
Referenced by dt_develop_blend_legacy_params().
|
inlinestatic |
Referenced by _refine_with_detail_mask().
|
inlinestatic |
References dt_alloc_align_float().
Referenced by dt_develop_blend_process().
|
static |
References dt_alloc_align_float(), dt_free_align, guided_filter(), height, and width.
Referenced by dt_develop_blend_process().
|
inlinestatic |
References dt_free_align.
Referenced by dt_develop_blend_process().
|
static |
References clamp_range_f().
Referenced by dt_develop_blend_process().
|
static |
References dt_dev_pixelpipe_iop_t::colors, DEVELOP_MASK_GUIDE_IN_BEFORE_BLUR, DEVELOP_MASK_GUIDE_OUT_AFTER_BLUR, DEVELOP_MASK_GUIDE_OUT_BEFORE_BLUR, DEVELOP_MASK_POST_BLUR, DEVELOP_MASK_POST_FEATHER_IN, DEVELOP_MASK_POST_FEATHER_OUT, and DEVELOP_MASK_POST_TONE_CURVE.
Referenced by dt_develop_blend_process().
|
static |
References _detail_mask_threshold(), darktable, dt_alloc_align_float(), dt_control_log(), DT_DEBUG_MASKS, dt_dev_distort_detail_mask(), DT_DEV_PIXELPIPE_FULL, dt_free_align, dt_masks_calc_detail_mask(), error(), dt_iop_roi_t::height, MAX, dt_iop_module_t::op, dt_dev_pixelpipe_iop_t::pipe, darktable_t::unmuted, and dt_iop_roi_t::width.
Referenced by dt_develop_blend_process().
dt_iop_colorspace_type_t dt_develop_blend_colorspace | ( | const dt_dev_pixelpipe_iop_t *const | piece, |
dt_iop_colorspace_type_t | cst | ||
) |
returns the color space for the given module
References dt_develop_blend_params_t::blend_cst, dt_dev_pixelpipe_iop_t::blendop_data, DEVELOP_BLEND_CS_LAB, DEVELOP_BLEND_CS_RAW, DEVELOP_BLEND_CS_RGB_DISPLAY, DEVELOP_BLEND_CS_RGB_SCENE, IOP_CS_LAB, IOP_CS_RAW, and IOP_CS_RGB.
Referenced by dt_develop_blend_process(), and pixelpipe_process_on_CPU().
dt_develop_blend_colorspace_t dt_develop_blend_default_module_blend_colorspace | ( | dt_iop_module_t * | module | ) |
returns the default blend color space for the given module
References _blend_default_module_blend_colorspace(), and TRUE.
Referenced by _blendif_change_blend_colorspace(), _blendif_options_callback(), dt_iop_gui_update_blending(), and dt_iop_load_default_params().
void dt_develop_blend_free_cl_global | ( | dt_blendop_cl_global_t * | b | ) |
global cleanup of blendops
References dt_opencl_free_kernel().
void dt_develop_blend_init_blend_parameters | ( | dt_develop_blend_params_t * | blend_params, |
dt_develop_blend_colorspace_t | cst | ||
) |
initializes the default blend parameters for the given color space in blend_params
References _blend_init_blendif_boost_parameters(), _default_blendop_params, and dt_develop_blend_params_t::blend_cst.
Referenced by dt_develop_blend_legacy_params(), dt_gui_presets_add_generic(), and dt_iop_load_default_params().
void dt_develop_blend_init_blendif_parameters | ( | dt_develop_blend_params_t * | blend_params, |
dt_develop_blend_colorspace_t | cst | ||
) |
initializes the default blendif parameters for the given color space in blend_params
References _blend_init_blendif_boost_parameters(), _default_blendop_params, dt_develop_blend_params_t::blend_cst, dt_develop_blend_params_t::blend_mode, dt_develop_blend_params_t::blend_parameter, dt_develop_blend_params_t::blendif, dt_develop_blend_params_t::blendif_boost_factors, and dt_develop_blend_params_t::blendif_parameters.
Referenced by _blendif_change_blend_colorspace().
dt_blendop_cl_global_t * dt_develop_blend_init_cl_global | ( | void | ) |
global init of blendops
References dt_opencl_create_kernel().
int dt_develop_blend_legacy_params | ( | dt_iop_module_t * | module, |
const void *const | old_params, | ||
const int | old_version, | ||
void * | new_params, | ||
const int | new_version, | ||
const int | length | ||
) |
update blendop params from older versions
blend legacy parameters version 1
blend legacy parameters version 2
blending mode
mixing opacity
id of mask in current pipeline
blendif mask
blendif parameters
blend legacy parameters version 3
blending mode
mixing opacity
id of mask in current pipeline
blendif mask
blendif parameters
blend legacy parameters version 4
blending mode
mixing opacity
id of mask in current pipeline
blendif mask
blur radius
blendif parameters
blend legacy parameters version 5 (identical to version 6)
what kind of masking to use: off, non-mask (uniformly), hand-drawn mask and/or conditional mask
blending mode
mixing opacity
how masks are combined
id of mask in current pipeline
blendif mask
blur radius
some reserved fields for future use
blendif parameters
blend legacy parameters version 6 (identical to version 7)
what kind of masking to use: off, non-mask (uniformly), hand-drawn mask and/or conditional mask
blending mode
mixing opacity
how masks are combined
id of mask in current pipeline
blendif mask
blur radius
some reserved fields for future use
blendif parameters
blend legacy parameters version 7
what kind of masking to use: off, non-mask (uniformly), hand-drawn mask and/or conditional mask
blending mode
mixing opacity
how masks are combined
id of mask in current pipeline
blendif mask
blur radius
some reserved fields for future use
blendif parameters
blend legacy parameters version 8
what kind of masking to use: off, non-mask (uniformly), hand-drawn mask and/or conditional mask
blending mode
mixing opacity
how masks are combined
id of mask in current pipeline
blendif mask
feathering radius
feathering guide
blur radius
mask contrast enhancement
mask brightness adjustment
some reserved fields for future use
blendif parameters
blend legacy parameters version 9
what kind of masking to use: off, non-mask (uniformly), hand-drawn mask and/or conditional mask or raster mask
blending mode
mixing opacity
how masks are combined
id of mask in current pipeline
blendif mask
feathering radius
feathering guide
blur radius
mask contrast enhancement
mask brightness adjustment
some reserved fields for future use
blendif parameters
blend legacy parameters version 10
what kind of masking to use: off, non-mask (uniformly), hand-drawn mask and/or conditional mask or raster mask
blending color space type
blending mode
parameter for the blending
mixing opacity
how masks are combined
id of mask in current pipeline
blendif mask
feathering radius
feathering guide
blur radius
mask contrast enhancement
mask brightness adjustment
some reserved fields for future use
blendif parameters
References _blend_default_module_blend_colorspace(), _blend_legacy_blend_mode(), dt_develop_blend_params_t::blend_cst, dt_develop_blend_params_t::blend_mode, dt_develop_blend_params_t::blend_parameter, dt_develop_blend_params_t::blendif, dt_develop_blend_params_t::blendif_boost_factors, dt_develop_blend_params_t::blendif_parameters, dt_develop_blend_params_t::blur_radius, dt_develop_blend_params_t::brightness, dt_develop_blend_params_t::contrast, dt_develop_blend_params_t::details, DEVELOP_BLEND_DISABLED_OBSOLETE, DEVELOP_BLENDIF_active, DEVELOP_BLENDIF_SIZE, DEVELOP_MASK_CONDITIONAL, DEVELOP_MASK_DISABLED, DEVELOP_MASK_ENABLED, dt_develop_blend_init_blend_parameters(), dt_develop_blend_params_is_all_zero(), dt_develop_blend_params_t::feathering_guide, dt_develop_blend_params_t::feathering_radius, dt_develop_blend_params_t::mask_combine, dt_develop_blend_params_t::mask_id, mask_id, dt_develop_blend_params_t::mask_mode, dt_develop_blend_params_t::opacity, dt_develop_blend_params_t::raster_mask_id, dt_develop_blend_params_t::raster_mask_instance, dt_develop_blend_params_t::raster_mask_invert, and dt_develop_blend_params_t::raster_mask_source.
Referenced by _init_presets(), _sync_blendop_params(), dt_develop_blend_legacy_params_from_so(), dt_gui_presets_apply_preset(), and dt_styles_apply_style_item().
int dt_develop_blend_legacy_params_from_so | ( | dt_iop_module_so_t * | module_so, |
const void *const | old_params, | ||
const int | old_version, | ||
void * | new_params, | ||
const int | new_version, | ||
const int | length | ||
) |
References dt_develop_blend_legacy_params(), dt_develop_blend_version(), dt_iop_cleanup_module(), and dt_iop_load_module_by_so().
Referenced by add_preset().
gboolean dt_develop_blend_params_is_all_zero | ( | const void * | params, |
size_t | length | ||
) |
check if content of params is all zero, indicating a non-initialized set of blend parameters which needs special care.
Referenced by dt_develop_blend_legacy_params().
int dt_develop_blend_process | ( | struct dt_iop_module_t * | self, |
struct dt_dev_pixelpipe_iop_t * | piece, | ||
const void *const | i, | ||
void *const | o, | ||
const struct dt_iop_roi_t *const | roi_in, | ||
const struct dt_iop_roi_t *const | roi_out | ||
) |
apply blend. Return 0 if ok, 1 if error
References _develop_blend_process_copy_region(), _develop_blend_process_feather(), _develop_blend_process_free_region(), _develop_blend_process_mask_tone_curve(), _develop_mask_get_post_operations(), _refine_with_detail_mask(), dt_develop_blend_params_t::blend_cst, dt_dev_pixelpipe_iop_t::blendop_data, dt_develop_blend_params_t::blur_radius, dt_develop_blend_params_t::brightness, dt_dev_pixelpipe_iop_t::colors, dt_develop_blend_params_t::contrast, dt_develop_blend_params_t::details, dt_iop_module_t::dev, DEVELOP_BLEND_CS_LAB, DEVELOP_BLEND_CS_RAW, DEVELOP_BLEND_CS_RGB_DISPLAY, DEVELOP_BLEND_CS_RGB_SCENE, DEVELOP_COMBINE_INCL, DEVELOP_COMBINE_MASKS_POS, DEVELOP_MASK_ENABLED, DEVELOP_MASK_MASK, DEVELOP_MASK_MASK_CONDITIONAL, DEVELOP_MASK_POST_BLUR, DEVELOP_MASK_POST_FEATHER_IN, DEVELOP_MASK_POST_FEATHER_OUT, DEVELOP_MASK_POST_TONE_CURVE, DEVELOP_MASK_RASTER, dt_alloc_align_float(), dt_control_log(), DT_DEBUG_MASKS, dt_dev_get_raster_mask(), DT_DEV_PIXELPIPE_DISPLAY_CHANNEL, DT_DEV_PIXELPIPE_DISPLAY_MASK, DT_DEV_PIXELPIPE_DISPLAY_NONE, dt_develop_blend_colorspace(), dt_develop_blendif_lab_blend(), dt_develop_blendif_lab_make_mask(), dt_develop_blendif_raw_blend(), dt_develop_blendif_raw_make_mask(), dt_develop_blendif_rgb_hsl_blend(), dt_develop_blendif_rgb_hsl_make_mask(), dt_develop_blendif_rgb_jzczhz_blend(), dt_develop_blendif_rgb_jzczhz_make_mask(), dt_free_align, dt_gaussian_blur(), dt_gaussian_free(), dt_gaussian_init(), dt_iop_image_fill(), dt_iop_image_invert(), dt_iop_image_scaled_copy(), dt_iop_is_raster_mask_used(), dt_masks_get_from_id_ext(), dt_masks_group_render_roi(), dt_print(), FALSE, dt_develop_blend_params_t::feathering_radius, dt_dev_pixelpipe_iop_t::global_mask_hash, dt_develop_t::gui_attached, dt_develop_t::gui_module, dt_iop_roi_t::height, dt_iop_module_t::id, IOP_CS_NONE, IOP_CS_RGB, IOP_FLAGS_NO_MASKS, iscale, dt_develop_blend_params_t::mask_combine, dt_develop_blend_params_t::mask_id, dt_develop_blend_params_t::mask_mode, dt_iop_module_t::op, dt_develop_blend_params_t::opacity, dt_develop_t::pipe, dt_dev_pixelpipe_iop_t::pipe, dt_iop_module_t::raster_mask, dt_develop_blend_params_t::raster_mask_invert, dt_dev_pixelpipe_iop_t::raster_masks, dt_iop_module_t::request_mask_display, dt_iop_roi_t::scale, dt_iop_module_t::sink, dt_iop_module_t::source, dt_iop_module_t::suppress_mask, dt_iop_roi_t::width, dt_iop_roi_t::x, and dt_iop_roi_t::y.
Referenced by pixelpipe_process_on_CPU().
int dt_develop_blend_version | ( | void | ) |
blend version
References DEVELOP_BLEND_VERSION.
Referenced by _edit_preset_response(), _init_presets(), _menuitem_update_preset(), _sync_blendop_params(), add_preset(), dt_dev_write_history_item(), dt_develop_blend_legacy_params_from_so(), dt_gui_presets_add_with_blendop(), dt_gui_presets_apply_preset(), and dt_styles_apply_style_item().
int dt_develop_blendif_init_masking_profile | ( | struct dt_dev_pixelpipe_iop_t * | piece, |
dt_iop_order_iccprofile_info_t * | blending_profile, | ||
dt_develop_blend_colorspace_t | cst | ||
) |
Set up a profile adapted to the blending.
darktable built-in color profiles are chroma-adjusted such that they define a [D65 RGB -> D50 XYZ] transform, which is expected by CIE Lab and the ICC pipeline. Since JzAzBz expects an XYZ vector adjusted for D65, we apply a Bradford transform on the profile primaries to output D65 XYZ. The updated primaries are stored in matrix_out. This is valid only in the context of blending with JzAzBz color space. The resulting XYZ is used only to define masks and not re-injected into the pipeline.
The initialized profile may only be used to convert from RGB to XYZ.
References DEVELOP_BLEND_CS_RGB_SCENE, dt_ioppr_get_iop_work_profile_info(), dt_ioppr_get_pipe_current_profile_info(), dt_iop_order_iccprofile_info_t::matrix_in, dt_iop_order_iccprofile_info_t::matrix_out, dt_iop_order_iccprofile_info_t::matrix_out_transposed, and dt_dev_pixelpipe_iop_t::pipe.
Referenced by dt_develop_blendif_rgb_hsl_blend(), dt_develop_blendif_rgb_hsl_make_mask(), dt_develop_blendif_rgb_jzczhz_blend(), and dt_develop_blendif_rgb_jzczhz_make_mask().
void dt_develop_blendif_process_parameters | ( | float *const restrict | parameters, |
const dt_develop_blend_params_t *const | params | ||
) |
References DEVELOP_BLEND_CS_LAB, DEVELOP_BLENDIF_A_in, DEVELOP_BLENDIF_A_out, DEVELOP_BLENDIF_B_in, DEVELOP_BLENDIF_B_out, DEVELOP_BLENDIF_PARAMETER_ITEMS, and DEVELOP_BLENDIF_SIZE.
Referenced by dt_develop_blendif_lab_make_mask(), dt_develop_blendif_rgb_hsl_make_mask(), and dt_develop_blendif_rgb_jzczhz_make_mask().
void tiling_callback_blendop | ( | struct dt_iop_module_t * | self, |
struct dt_dev_pixelpipe_iop_t * | piece, | ||
const dt_iop_roi_t * | roi_in, | ||
const dt_iop_roi_t * | roi_out, | ||
struct dt_develop_tiling_t * | tiling | ||
) |
report back specific memory requirements for blend step (only relevant for OpenCL path)
References dt_dev_pixelpipe_iop_t::blendop_data, and dt_develop_blend_params_t::details.
Referenced by dt_dev_pixelpipe_process_rec().
|
static |
Referenced by dt_develop_blend_init_blend_parameters(), and dt_develop_blend_init_blendif_parameters().