Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
blend.c File Reference
#include "develop/pipeline_notify.h"
#include "system/macros.h"
#include "develop/iop_profile.h"
#include "system/openmp.h"
#include "system/mem_alloc.h"
#include "common/logging.h"
#include "caches/pixelpipe_cache_alloc.h"
#include "blend.h"
#include "pixel/gaussian.h"
#include "pixel/guided_filter.h"
#include "common/imagebuf.h"
#include "common/opencl.h"
#include "develop/imageop.h"
#include "develop/masks.h"
#include "develop/masks_detail.h"
#include "develop/pixelpipe_hb.h"
#include "develop/supervisor.h"
#include "develop/tiling.h"
#include <inttypes.h>
#include <limits.h>
#include <math.h>
#include <string.h>
+ Include dependency graph for blend.c:

Go to the source code of this file.

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
}
 

Functions

dt_blendop_cl_global_tdt_develop_blend_get_cl_global (void)
 
static const char * dt_pipe_type_to_str (dt_dev_pixelpipe_type_t pipe_type)
 
static dt_develop_blend_colorspace_t _blend_default_module_blend_colorspace (dt_iop_module_t *module, gboolean is_scene_referred)
 
dt_develop_blend_colorspace_t dt_develop_blend_default_module_blend_colorspace (dt_iop_module_t *module)
 
gboolean dt_develop_blend_colorspace_is_compatible (dt_iop_module_t *module, dt_develop_blend_colorspace_t cst)
 Whether the given module may blend in the given color space.
 
static void _blend_init_blendif_boost_parameters (dt_develop_blend_params_t *blend_params, dt_develop_blend_colorspace_t cst)
 
void dt_develop_blend_resolve_default_colorspace (dt_iop_module_t *module, dt_develop_blend_params_t *blend_params)
 Replace DEVELOP_BLEND_CS_NONE, which stands for "whichever space this module blends in", by the module's own blending space and the boost factors that space starts from.
 
void dt_develop_blend_init_blend_parameters (dt_develop_blend_params_t *blend_params, dt_develop_blend_colorspace_t cst)
 
void dt_develop_blend_init_blendif_parameters (dt_develop_blend_params_t *blend_params, dt_develop_blend_colorspace_t cst)
 
dt_iop_colorspace_type_t dt_develop_blend_colorspace (const dt_dev_pixelpipe_iop_t *const piece, dt_iop_colorspace_type_t cst)
 
void dt_develop_blendif_process_parameters (float *const restrict parameters, const dt_develop_blend_params_t *const params)
 
void dt_develop_blend_get_mask_usage (const dt_iop_module_t *module, const dt_develop_blend_params_t *params, gboolean *top_enabled, gboolean *raster_used, gboolean *drawn_used, gboolean *parametric_used)
 
int dt_develop_blendif_init_masking_profile (const struct dt_dev_pixelpipe_t *pipe, const struct dt_dev_pixelpipe_iop_t *piece, dt_iop_order_iccprofile_info_t *blending_profile, dt_develop_blend_colorspace_t cst)
 
static float _detail_mask_threshold (const float level, const gboolean detail)
 
static void _refine_with_detail_mask (struct dt_iop_module_t *self, const struct dt_dev_pixelpipe_t *pipe, const struct dt_dev_pixelpipe_iop_t *piece, float *mask, const float level)
 
static size_t _develop_mask_get_post_operations (const dt_develop_blend_params_t *const params, const dt_dev_pixelpipe_iop_t *const piece, _develop_mask_post_processing operations[3])
 
static float * _develop_blend_process_copy_region (const float *const restrict input, const size_t iwidth, const size_t xoffs, const size_t yoffs, const size_t owidth, const size_t oheight)
 
static void _develop_blend_process_free_region (float *const restrict input)
 
static const dt_iop_module_t_develop_blend_get_raster_source_module (const dt_develop_blend_params_t *const params, const dt_iop_module_t *const self)
 
static void _develop_blend_init_raster_mask (const dt_develop_blend_params_t *const params, dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece, float *const restrict mask, const size_t owidth, const size_t oheight, int *const raster_error)
 
static int _develop_blend_init_drawn_mask (const dt_develop_blend_params_t *const params, dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece, const struct dt_iop_roi_t *const roi_out, float *const restrict mask, const size_t owidth, const size_t oheight)
 
static void _develop_blend_combine_masks (float *const restrict mask, const float *const restrict other_mask, const size_t buffsize)
 
static int _develop_blend_process_feather (const float *const guide, float *const mask, const size_t width, const size_t height, const int ch, const float guide_weight, const float feathering_radius, const float scale)
 
static void _develop_blend_process_mask_tone_curve (float *const restrict mask, const size_t buffsize, const float contrast, const float brightness, const float opacity)
 
int dt_develop_blend_process (struct dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, const struct dt_dev_pixelpipe_iop_t *piece, const void *const ivoid, void *const ovoid)
 
static void _refine_with_detail_mask_cl (struct dt_iop_module_t *self, const struct dt_dev_pixelpipe_t *pipe, const struct dt_dev_pixelpipe_iop_t *piece, float *mask, const float level, const int devid)
 
static void _blend_process_cl_exchange (cl_mem *a, cl_mem *b)
 
int dt_develop_blend_process_cl (struct dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, const struct dt_dev_pixelpipe_iop_t *piece, cl_mem dev_in, cl_mem dev_out)
 
void dt_develop_blend_init_cl_global (void)
 
void dt_develop_blend_free_cl_global (void)
 
int dt_develop_blend_version (void)
 
void tiling_callback_blendop (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)
 
gboolean dt_develop_blend_params_is_all_zero (const void *params, size_t length)
 
static uint32_t _blend_legacy_blend_mode (uint32_t legacy_blend_mode)
 
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)
 
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)
 

Variables

static dt_blendop_cl_global_t_blendop_cl_global = NULL
 
static dt_develop_blend_params_t _default_blendop_params
 
const dt_develop_name_value_t dt_develop_blend_mode_names []
 
const dt_develop_name_value_t dt_develop_blend_mode_flag_names []
 
const dt_develop_name_value_t dt_develop_blend_colorspace_names []
 
const dt_develop_name_value_t dt_develop_mask_mode_names []
 
const dt_develop_name_value_t dt_develop_combine_masks_names []
 
const dt_develop_name_value_t dt_develop_feathering_guide_names []
 
const dt_develop_name_value_t dt_develop_invert_mask_names []
 

Typedef Documentation

◆ _develop_mask_post_processing

Enumeration Type Documentation

◆ _develop_mask_post_processing

Enumerator
DEVELOP_MASK_POST_NONE 
DEVELOP_MASK_POST_BLUR 
DEVELOP_MASK_POST_FEATHER_IN 
DEVELOP_MASK_POST_FEATHER_OUT 
DEVELOP_MASK_POST_TONE_CURVE 

Definition at line 77 of file blend.c.

Function Documentation

◆ _blend_default_module_blend_colorspace()

◆ _blend_init_blendif_boost_parameters()

◆ _blend_legacy_blend_mode()

◆ _blend_process_cl_exchange()

static void _blend_process_cl_exchange ( cl_mem *  a,
cl_mem *  b 
)
inlinestatic

Definition at line 1153 of file blend.c.

Referenced by dt_develop_blend_process_cl().

◆ _detail_mask_threshold()

static float _detail_mask_threshold ( const float  level,
const gboolean  detail 
)
inlinestatic

Definition at line 394 of file blend.c.

Referenced by _refine_with_detail_mask(), and _refine_with_detail_mask_cl().

◆ _develop_blend_combine_masks()

static void _develop_blend_combine_masks ( float *const restrict  mask,
const float *const restrict  other_mask,
const size_t  buffsize 
)
static

Definition at line 640 of file blend.c.

References __OMP_FOR_SIMD__, and i.

Referenced by dt_develop_blend_process(), and dt_develop_blend_process_cl().

◆ _develop_blend_get_raster_source_module()

static const dt_iop_module_t * _develop_blend_get_raster_source_module ( const dt_develop_blend_params_t *const  params,
const dt_iop_module_t *const  self 
)
static

◆ _develop_blend_init_drawn_mask()

static int _develop_blend_init_drawn_mask ( const dt_develop_blend_params_t *const  params,
dt_iop_module_t self,
dt_dev_pixelpipe_t pipe,
const dt_dev_pixelpipe_iop_t piece,
const struct dt_iop_roi_t *const  roi_out,
float *const restrict  mask,
const size_t  owidth,
const size_t  oheight 
)
static

◆ _develop_blend_init_raster_mask()

static void _develop_blend_init_raster_mask ( const dt_develop_blend_params_t *const  params,
dt_iop_module_t self,
dt_dev_pixelpipe_t pipe,
const dt_dev_pixelpipe_iop_t piece,
float *const restrict  mask,
const size_t  owidth,
const size_t  oheight,
int *const  raster_error 
)
static

◆ _develop_blend_process_copy_region()

static float * _develop_blend_process_copy_region ( const float *const restrict  input,
const size_t  iwidth,
const size_t  xoffs,
const size_t  yoffs,
const size_t  owidth,
const size_t  oheight 
)
inlinestatic

◆ _develop_blend_process_feather()

static int _develop_blend_process_feather ( const float *const  guide,
float *const  mask,
const size_t  width,
const size_t  height,
const int  ch,
const float  guide_weight,
const float  feathering_radius,
const float  scale 
)
static

◆ _develop_blend_process_free_region()

static void _develop_blend_process_free_region ( float *const restrict  input)
inlinestatic

Definition at line 532 of file blend.c.

References dt_pixelpipe_cache_free_align.

Referenced by dt_develop_blend_process().

◆ _develop_blend_process_mask_tone_curve()

static void _develop_blend_process_mask_tone_curve ( float *const restrict  mask,
const size_t  buffsize,
const float  contrast,
const float  brightness,
const float  opacity 
)
static

Definition at line 673 of file blend.c.

References __OMP_PARALLEL_FOR_SIMD__, clamp_range_f(), k, and x.

Referenced by dt_develop_blend_process().

◆ _develop_mask_get_post_operations()

◆ _refine_with_detail_mask()

◆ _refine_with_detail_mask_cl()

◆ dt_develop_blend_colorspace()

◆ dt_develop_blend_colorspace_is_compatible()

gboolean dt_develop_blend_colorspace_is_compatible ( dt_iop_module_t module,
dt_develop_blend_colorspace_t  cst 
)

Whether the given module may blend in the given color space.

Answered from the module's own color space and, for Lab, from its position against colorin and colorout: the blend reaches Lab through the working profile, which describes neither camera RGB nor the display encoding. The module must belong to a develop with an iop order list.

Parameters
moduleThe module to blend.
cstThe candidate blending color space.
Returns
TRUE when blending in cst is meaningful for this module.

Definition at line 158 of file blend.c.

References DEVELOP_BLEND_CS_LAB, DEVELOP_BLEND_CS_RAW, DEVELOP_BLEND_CS_RGB_DISPLAY, DEVELOP_BLEND_CS_RGB_SCENE, dt_develop_blend_default_module_blend_colorspace(), dt_ioppr_get_module_profile_stage(), DT_IOPPR_PROFILE_STAGE_WORK, FALSE, dt_iop_module_t::iop_order, and TRUE.

Referenced by _blendif_append_colorspace_item(), and _blendif_change_blend_colorspace().

◆ dt_develop_blend_default_module_blend_colorspace()

dt_develop_blend_colorspace_t dt_develop_blend_default_module_blend_colorspace ( dt_iop_module_t module)

◆ dt_develop_blend_free_cl_global()

void dt_develop_blend_free_cl_global ( void  )

global cleanup of blendops

Definition at line 1685 of file blend.c.

References _blendop_cl_global, dt_free, dt_opencl_free_kernel(), and IS_NULL_PTR.

Referenced by dt_opencl_cleanup().

◆ dt_develop_blend_get_cl_global()

dt_blendop_cl_global_t * dt_develop_blend_get_cl_global ( void  )

The blend OpenCL kernels, for the two IOPs that reuse them (iop/detailmask.c, iop/demosaic/dual.c). NULL when OpenCL is unavailable or not yet initialised.

Definition at line 72 of file blend.c.

References _blendop_cl_global.

Referenced by dual_demosaic_cl(), and process_cl().

◆ dt_develop_blend_get_mask_usage()

void dt_develop_blend_get_mask_usage ( const dt_iop_module_t module,
const dt_develop_blend_params_t params,
gboolean *  top_enabled,
gboolean *  raster_used,
gboolean *  drawn_used,
gboolean *  parametric_used 
)

Return effective mask usage for current blending parameters.

This inspects mask mode bits and payload state to decide whether raster, drawn and/or parametric masks are actually contributing, so callers can skip mask computation branches when modes are enabled but still at default.

State rules:

  • top_enabled: set by params->mask_mode & DEVELOP_MASK_ENABLED.
  • raster_used: requires params->mask_mode & DEVELOP_MASK_RASTER and module->raster_mask.sink.source set.
  • drawn_used: requires params->mask_mode & DEVELOP_MASK_MASK and a valid group form from params->mask_id containing at least one shape.
  • parametric_used: requires params->mask_mode & DEVELOP_MASK_CONDITIONAL and at least one active blendif channel (channel bit set in params->blendif, channel allowed by blend colorspace mask, and channel thresholds different from defaults [0, 0, 1, 1] in params->blendif_parameters).

Definition at line 301 of file blend.c.

References ch, dt_iop_module_t::dev, DEVELOP_BLEND_CS_LAB, DEVELOP_BLENDIF_Lab_MASK, DEVELOP_BLENDIF_RGB_MASK, DEVELOP_BLENDIF_SIZE, DEVELOP_MASK_ENABLED, DEVELOP_MASK_PARAMETRIC, DEVELOP_MASK_RASTER, DEVELOP_MASK_SHAPE, dt_masks_get_from_id(), DT_MASKS_GROUP, FALSE, IS_NULL_PTR, dt_masks_form_t::points, dt_iop_module_t::raster_mask, dt_iop_module_t::sink, dt_iop_module_t::source, top, and dt_masks_form_t::type.

Referenced by _mask_indicator_get_usage(), dt_develop_blend_process(), dt_develop_blend_process_cl(), dt_iop_module_needs_mask_history_ext(), and dt_iop_set_mask_mode().

◆ dt_develop_blend_init_blend_parameters()

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

Definition at line 212 of file blend.c.

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().

◆ dt_develop_blend_init_blendif_parameters()

◆ dt_develop_blend_init_cl_global()

void dt_develop_blend_init_cl_global ( void  )

global init of blendops

Definition at line 1654 of file blend.c.

References _blendop_cl_global, and dt_opencl_create_kernel().

Referenced by dt_opencl_init().

◆ dt_develop_blend_legacy_params()

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

Definition at line 1778 of file blend.c.

References _blend_default_module_blend_colorspace(), _blend_legacy_blend_mode(), DEVELOP_BLEND_DISABLED_OBSOLETE, DEVELOP_BLENDIF_active, DEVELOP_BLENDIF_SIZE, DEVELOP_MASK_DISABLED, DEVELOP_MASK_ENABLED, DEVELOP_MASK_PARAMETRIC, dt_develop_blend_init_blend_parameters(), dt_develop_blend_params_is_all_zero(), i, mask_id, dt_develop_blend_params_t::mask_mode, and n.

Referenced by _dt_styles_apply_item_to_module(), _init_presets(), _sync_blendop_params(), dt_develop_blend_legacy_params_from_so(), and dt_gui_presets_apply_preset().

◆ dt_develop_blend_legacy_params_from_so()

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 
)

◆ dt_develop_blend_params_is_all_zero()

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.

Definition at line 1741 of file blend.c.

References FALSE, k, and TRUE.

Referenced by dt_develop_blend_legacy_params().

◆ dt_develop_blend_process()

int dt_develop_blend_process ( struct dt_iop_module_t self,
struct dt_dev_pixelpipe_t pipe,
const struct dt_dev_pixelpipe_iop_t piece,
const void *const  i,
void *const  o 
)

apply blend. Return 0 if ok, 1 if error

Definition at line 704 of file blend.c.

References _develop_blend_combine_masks(), _develop_blend_init_drawn_mask(), _develop_blend_init_raster_mask(), _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_dev_pixelpipe_iop_t::blendop_data, dt_dev_pixelpipe_t::bypass_blendif, ch, dt_iop_buffer_dsc_t::channels, d, 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_MASK_POST_BLUR, DEVELOP_MASK_POST_FEATHER_IN, DEVELOP_MASK_POST_FEATHER_OUT, DEVELOP_MASK_POST_TONE_CURVE, dt_dev_pixelpipe_iop_t::dsc_in, DT_DEBUG_MASKS, dt_dev_pixelpipe_cache_get(), dt_dev_pixelpipe_cache_ref_count_entry(), dt_dev_pixelpipe_cache_remove(), dt_dev_pixelpipe_cache_wrlock_entry(), DT_DEV_PIXELPIPE_DISPLAY_CHANNEL, DT_DEV_PIXELPIPE_DISPLAY_MASK, DT_DEV_PIXELPIPE_DISPLAY_NONE, dt_dev_pixelpipe_raster_mask_hash(), dt_develop_blend_colorspace(), dt_develop_blend_get_mask_usage(), 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_gaussian_blur(), dt_gaussian_free(), dt_gaussian_init(), dt_iop_colorspace_is_rgb(), dt_iop_image_fill(), dt_iop_image_mul_const(), dt_iop_is_raster_mask_used(), dt_pipe_type_to_str(), dt_pipeline_message(), dt_pixelpipe_cache_alloc_align_float, dt_pixelpipe_cache_free_align, dt_print(), dt_supervisor_active(), dt_supervisor_cacheline_create(), dt_supervisor_node_key(), FALSE, g, dt_dev_pixelpipe_iop_t::global_hash, dt_develop_t::gui_attached, dt_develop_t::gui_module, dt_dev_pixelpipe_iop_t::hash, dt_iop_roi_t::height, dt_dev_pixelpipe_t::imgid, IOP_CS_NONE, IS_NULL_PTR, iscale, dt_dev_pixelpipe_t::mask_display, dt_iop_module_t::op, ovoid, dt_develop_t::pipe, dt_dev_pixelpipe_t::raster_mask_hashes, dt_iop_module_t::request_mask_display, dt_dev_pixelpipe_iop_t::roi_in, dt_dev_pixelpipe_iop_t::roi_out, dt_iop_roi_t::scale, sigma, dt_dev_pixelpipe_t::store_all_raster_masks, TRUE, dt_dev_pixelpipe_t::type, dt_iop_roi_t::width, dt_iop_roi_t::x, and dt_iop_roi_t::y.

Referenced by pixelpipe_process_on_CPU(), and pixelpipe_process_on_GPU().

◆ dt_develop_blend_process_cl()

int dt_develop_blend_process_cl ( struct dt_iop_module_t self,
struct dt_dev_pixelpipe_t pipe,
const struct dt_dev_pixelpipe_iop_t piece,
cl_mem  dev_in,
cl_mem  dev_out 
)

apply blend for opencl modules. Return 0 if ok, 1 on error

Definition at line 1160 of file blend.c.

References _blend_process_cl_exchange(), _blendop_cl_global, _develop_blend_combine_masks(), _develop_blend_init_drawn_mask(), _develop_blend_init_raster_mask(), _develop_mask_get_post_operations(), _refine_with_detail_mask_cl(), dt_dev_pixelpipe_iop_t::blendop_data, dt_dev_pixelpipe_t::bypass_blendif, ch, dt_iop_buffer_dsc_t::channels, d, dt_iop_module_t::dev, DEVELOP_BLEND_CS_LAB, DEVELOP_BLEND_CS_RAW, DEVELOP_BLEND_CS_RGB_DISPLAY, DEVELOP_BLEND_CS_RGB_SCENE, DEVELOP_BLENDIF_PARAMETER_ITEMS, DEVELOP_BLENDIF_SIZE, DEVELOP_COMBINE_INCL, DEVELOP_MASK_POST_BLUR, DEVELOP_MASK_POST_FEATHER_IN, DEVELOP_MASK_POST_FEATHER_OUT, DEVELOP_MASK_POST_TONE_CURVE, dt_dev_pixelpipe_t::devid, dt_dev_pixelpipe_iop_t::dsc_in, DT_ALIGNED_ARRAY, DT_DEBUG_MASKS, DT_DEBUG_OPENCL, dt_dev_pixelpipe_cache_get(), dt_dev_pixelpipe_cache_ref_count_entry(), dt_dev_pixelpipe_cache_remove(), dt_dev_pixelpipe_cache_wrlock_entry(), DT_DEV_PIXELPIPE_DISPLAY_ANY, DT_DEV_PIXELPIPE_DISPLAY_CHANNEL, DT_DEV_PIXELPIPE_DISPLAY_MASK, DT_DEV_PIXELPIPE_DISPLAY_NONE, dt_dev_pixelpipe_raster_mask_hash(), dt_develop_blend_colorspace(), dt_develop_blend_get_mask_usage(), dt_develop_blendif_init_masking_profile(), dt_develop_blendif_process_parameters(), dt_gaussian_blur_cl(), dt_gaussian_free_cl(), dt_gaussian_init_cl(), dt_iop_colorspace_is_rgb(), dt_iop_image_fill(), dt_iop_image_mul_const(), dt_iop_is_raster_mask_used(), dt_ioppr_build_iccprofile_params_cl(), dt_ioppr_free_iccprofile_params_cl(), dt_ioppr_get_pipe_work_profile_info(), dt_opencl_alloc_device(), dt_opencl_copy_device_to_host(), dt_opencl_copy_host_to_device_constant(), dt_opencl_enqueue_copy_image(), dt_opencl_enqueue_kernel_2d(), dt_opencl_release_mem_object(), dt_opencl_set_kernel_arg(), dt_opencl_write_host_to_device(), dt_pipe_type_to_str(), dt_pipeline_message(), dt_pixelpipe_cache_alloc_align_float, dt_pixelpipe_cache_free_align, dt_print(), dt_supervisor_active(), dt_supervisor_cacheline_create(), dt_supervisor_node_key(), error(), FALSE, g, dt_dev_pixelpipe_iop_t::global_hash, dt_develop_t::gui_attached, dt_develop_t::gui_module, guided_filter_cl(), dt_dev_pixelpipe_iop_t::hash, dt_iop_roi_t::height, dt_dev_pixelpipe_t::imgid, IOP_CS_NONE, IS_NULL_PTR, iscale, kernel(), dt_blendop_cl_global_t::kernel_blendop_display_channel, dt_blendop_cl_global_t::kernel_blendop_Lab, dt_blendop_cl_global_t::kernel_blendop_mask_Lab, dt_blendop_cl_global_t::kernel_blendop_mask_RAW, dt_blendop_cl_global_t::kernel_blendop_mask_rgb_hsl, dt_blendop_cl_global_t::kernel_blendop_mask_rgb_jzczhz, dt_blendop_cl_global_t::kernel_blendop_mask_tone_curve, dt_blendop_cl_global_t::kernel_blendop_RAW, dt_blendop_cl_global_t::kernel_blendop_rgb_hsl, dt_blendop_cl_global_t::kernel_blendop_rgb_jzczhz, dt_blendop_cl_global_t::kernel_blendop_set_mask, dt_dev_pixelpipe_t::mask_display, dt_iop_module_t::op, dt_develop_t::pipe, dt_dev_pixelpipe_t::raster_mask_hashes, dt_iop_module_t::request_mask_display, dt_dev_pixelpipe_iop_t::roi_in, dt_dev_pixelpipe_iop_t::roi_out, ROUNDUPDHT, ROUNDUPDWD, dt_iop_roi_t::scale, sigma, dt_dev_pixelpipe_t::store_all_raster_masks, TRUE, dt_dev_pixelpipe_t::type, dt_iop_roi_t::width, dt_iop_roi_t::x, and dt_iop_roi_t::y.

Referenced by pixelpipe_process_on_GPU().

◆ dt_develop_blend_resolve_default_colorspace()

void dt_develop_blend_resolve_default_colorspace ( dt_iop_module_t module,
dt_develop_blend_params_t blend_params 
)

Replace DEVELOP_BLEND_CS_NONE, which stands for "whichever space this module blends in", by the module's own blending space and the boost factors that space starts from.

Any other space is left alone, boost factors included: it is the space the edit or the preset chose.

Parameters
moduleModule the space is read from.
blend_paramsBlending parameters, rewritten in place when they carry NONE.

Definition at line 205 of file blend.c.

References _blend_init_blendif_boost_parameters(), dt_develop_blend_params_t::blend_cst, DEVELOP_BLEND_CS_NONE, and dt_develop_blend_default_module_blend_colorspace().

Referenced by _resolve_presets_blend_colorspace(), and dt_iop_commit_blend_params().

◆ dt_develop_blend_version()

◆ dt_develop_blendif_init_masking_profile()

int dt_develop_blendif_init_masking_profile ( const struct dt_dev_pixelpipe_t pipe,
const 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.

Definition at line 361 of file blend.c.

References DEVELOP_BLEND_CS_RGB_SCENE, dt_ioppr_get_iop_work_profile_info(), dt_ioppr_get_pipe_current_profile_info(), i, IS_NULL_PTR, M, 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 x.

Referenced by dt_develop_blend_process_cl(), 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().

◆ dt_develop_blendif_process_parameters()

◆ dt_pipe_type_to_str()

static const char * dt_pipe_type_to_str ( dt_dev_pixelpipe_type_t  pipe_type)
static

◆ tiling_callback_blendop()

void tiling_callback_blendop ( 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 
)

report back specific memory requirements for blend step (only relevant for OpenCL path)

Definition at line 1720 of file blend.c.

References dt_dev_pixelpipe_iop_t::blendop_data, dt_develop_blend_params_t::details, and IS_NULL_PTR.

Referenced by dt_dev_pixelpipe_process_rec().

Variable Documentation

◆ _blendop_cl_global

◆ _default_blendop_params

dt_develop_blend_params_t _default_blendop_params
static
Initial value:
0.0f,
100.0f,
0,
0,
0.0f,
0.0f,
0.0f,
0.0f,
0.0f,
{ 0, 0, 0 },
{ 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f,
0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f,
0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f,
0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f },
{ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f },
{ 0 }, 0, 0, FALSE }
#define FALSE
Definition ashift_lsd.c:158
@ DEVELOP_MASK_GUIDE_IN_AFTER_BLUR
Definition blend.h:137
@ DEVELOP_BLEND_CS_NONE
Definition blend.h:54
@ DEVELOP_COMBINE_NORM_EXCL
Definition blend.h:127
@ DEVELOP_BLEND_NORMAL2
Definition blend.h:87
@ DEVELOP_MASK_RASTER
Definition blend.h:116
@ DEVELOP_MASK_PARAMETRIC
Definition blend.h:115
@ DEVELOP_MASK_SHAPE
Definition blend.h:114

Definition at line 103 of file blend.c.

Referenced by dt_develop_blend_init_blend_parameters(), and dt_develop_blend_init_blendif_parameters().

◆ dt_develop_blend_colorspace_names

const dt_develop_name_value_t dt_develop_blend_colorspace_names[]
Initial value:
= { { N_("default"), DEVELOP_BLEND_CS_NONE },
{ N_("RAW"), DEVELOP_BLEND_CS_RAW },
{ N_("Lab"), DEVELOP_BLEND_CS_LAB },
{ N_("RGB (display)"), DEVELOP_BLEND_CS_RGB_DISPLAY },
{ N_("RGB (scene)"), DEVELOP_BLEND_CS_RGB_SCENE },
{ "", 0 } }
@ DEVELOP_BLEND_CS_LAB
Definition blend.h:56
@ DEVELOP_BLEND_CS_RGB_SCENE
Definition blend.h:58
@ DEVELOP_BLEND_CS_RGB_DISPLAY
Definition blend.h:57
@ DEVELOP_BLEND_CS_RAW
Definition blend.h:55

Definition at line 2344 of file blend.c.

Referenced by _blendop_json(), and _create_tooltip_text().

◆ dt_develop_blend_mode_flag_names

const dt_develop_name_value_t dt_develop_blend_mode_flag_names[]
Initial value:
= { { NC_("blendoperation", "normal"), 0 },
{ NC_("blendoperation", "reverse"), DEVELOP_BLEND_REVERSE },
{ "", 0 } }
@ DEVELOP_BLEND_REVERSE
Definition blend.h:106

Definition at line 2339 of file blend.c.

Referenced by _blendop_json(), and _create_tooltip_text().

◆ dt_develop_blend_mode_names

const dt_develop_name_value_t dt_develop_blend_mode_names[]

Definition at line 2297 of file blend.c.

Referenced by _add_blendmode_combo(), _blendop_json(), and _create_tooltip_text().

◆ dt_develop_combine_masks_names

const dt_develop_name_value_t dt_develop_combine_masks_names[]
Initial value:
= { { N_("exclusive"), DEVELOP_COMBINE_NORM_EXCL },
{ N_("inclusive"), DEVELOP_COMBINE_NORM_INCL },
{ N_("exclusive & inverted"), DEVELOP_COMBINE_INV_EXCL },
{ N_("inclusive & inverted"), DEVELOP_COMBINE_INV_INCL },
{ "", 0 } }
@ DEVELOP_COMBINE_NORM_INCL
Definition blend.h:128
@ DEVELOP_COMBINE_INV_INCL
Definition blend.h:130
@ DEVELOP_COMBINE_INV_EXCL
Definition blend.h:129

Definition at line 2361 of file blend.c.

Referenced by _blendop_json(), _create_tooltip_text(), and dt_iop_gui_init_blending_body().

◆ dt_develop_feathering_guide_names

const dt_develop_name_value_t dt_develop_feathering_guide_names[]
Initial value:
= { { N_("output before blur"), DEVELOP_MASK_GUIDE_OUT_BEFORE_BLUR },
{ N_("input before blur"), DEVELOP_MASK_GUIDE_IN_BEFORE_BLUR },
{ N_("output after blur"), DEVELOP_MASK_GUIDE_OUT_AFTER_BLUR },
{ N_("input after blur"), DEVELOP_MASK_GUIDE_IN_AFTER_BLUR },
{ "", 0 } }
@ DEVELOP_MASK_GUIDE_OUT_BEFORE_BLUR
Definition blend.h:136
@ DEVELOP_MASK_GUIDE_OUT_AFTER_BLUR
Definition blend.h:138
@ DEVELOP_MASK_GUIDE_IN_BEFORE_BLUR
Definition blend.h:135

Definition at line 2368 of file blend.c.

Referenced by _blendop_json(), _create_tooltip_text(), and dt_iop_gui_init_blending_body().

◆ dt_develop_invert_mask_names

const dt_develop_name_value_t dt_develop_invert_mask_names[]
Initial value:
= { { N_("off"), DEVELOP_COMBINE_NORM },
{ N_("on"), DEVELOP_COMBINE_INV },
{ "", 0 } }
@ DEVELOP_COMBINE_INV
Definition blend.h:123
@ DEVELOP_COMBINE_NORM
Definition blend.h:122

Definition at line 2375 of file blend.c.

Referenced by _blendop_json(), and _create_tooltip_text().

◆ dt_develop_mask_mode_names

const dt_develop_name_value_t dt_develop_mask_mode_names[]
Initial value:
= { { N_("None"), 0 },
{ N_("Uniform"), 1 },
{ N_("Parametric mask"), 2 },
{ N_("Drawn mask"), 3 },
{ N_("Drawn & parametric mask"), 4 },
{ N_("Reuse an existing mask"), 5 },
{ "", 0 } }

Definition at line 2352 of file blend.c.

Referenced by _blendop_json(), and _create_tooltip_text().