![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
#include "bauhaus/bauhaus.h"#include "common/imagebuf.h"#include "common/opencl.h"#include "common/iop_profile.h"#include "common/math.h"#include "develop/imageop.h"#include "develop/imageop_gui.h"#include "develop/noise_generator.h"#include "gui/presets.h"#include "gui/gtk.h"#include "iop/iop_api.h"#include <float.h>#include <gtk/gtk.h>#include <stdint.h>#include <stdlib.h>#include <string.h>
Include dependency graph for crystgrain.c:Data Structures | |
| struct | dt_iop_crystgrain_params_t |
| struct | dt_iop_crystgrain_gui_data_t |
| struct | dt_iop_crystgrain_data_t |
| struct | dt_iop_crystgrain_kernel_t |
| struct | dt_iop_crystgrain_layer_kernel_t |
| struct | dt_iop_crystgrain_runtime_t |
| struct | dt_iop_crystgrain_color_state_t |
| struct | dt_iop_crystgrain_global_data_t |
Macros | |
| #define | DT_CRYSTGRAIN_LAYER_KERNELS 16 |
| #define | DT_CRYSTGRAIN_CL_PROGRAM 36 |
| #define | DT_CRYSTGRAIN_REDUCESIZE 64 |
Typedefs | |
| typedef enum dt_iop_crystgrain_mode_t | dt_iop_crystgrain_mode_t |
| typedef struct dt_iop_crystgrain_params_t | dt_iop_crystgrain_params_t |
| typedef struct dt_iop_crystgrain_gui_data_t | dt_iop_crystgrain_gui_data_t |
| typedef struct dt_iop_crystgrain_data_t | dt_iop_crystgrain_data_t |
| typedef struct dt_iop_crystgrain_kernel_t | dt_iop_crystgrain_kernel_t |
| typedef struct dt_iop_crystgrain_layer_kernel_t | dt_iop_crystgrain_layer_kernel_t |
| typedef struct dt_iop_crystgrain_runtime_t | dt_iop_crystgrain_runtime_t |
| typedef struct dt_iop_crystgrain_color_state_t | dt_iop_crystgrain_color_state_t |
| typedef struct dt_iop_crystgrain_global_data_t | dt_iop_crystgrain_global_data_t |
Enumerations | |
| enum | dt_iop_crystgrain_mode_t { DT_CRYSTGRAIN_MONO = 0 , DT_CRYSTGRAIN_COLOR = 1 } |
Functions | |
| const char * | name () |
| const char ** | description (struct dt_iop_module_t *self) |
| int | flags () |
| int | default_group () |
| int | default_colorspace (dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece) |
| void | init_presets (dt_iop_module_so_t *self) |
| int | legacy_params (dt_iop_module_t *self, const void *const old_params, const int old_version, void *new_params, const int new_version) |
| static __DT_CLONE_TARGETS__ unsigned int | _hash_string (const char *s) |
| Hash a string into a stable 32-bit seed. | |
| static float | _uniform_random (const uint64_t seed) |
| Turn a 64-bit seed into a uniform random number in [0; 1). | |
| static float | _gaussian_random (const uint64_t seed_a, const uint64_t seed_b) |
| Turn 2 seeds into one gaussian deviate. | |
| static int | _reflect_index (int i, const int max) |
| Mirror indices outside the current buffer like scipy ‘boundary='symm’`. | |
| static float | _seed_probability (const float filling, const float crystal_area) |
| Map the requested filling ratio to the Bernoulli probability used to plant seeds. | |
| static float | _crystal_coverage (const int dx, const int dy, const float radius_f, const float vertices, const float rotation) |
| Estimate the partial coverage of one pixel by one crystal boundary. | |
| static __DT_CLONE_TARGETS__ int | _create_crystal_kernel (dt_iop_crystgrain_kernel_t *const kernel, const float radius_f, const float vertices, const float rotation) |
| Build one partially-occluding crystal footprint for a layer. | |
| static | __attribute__ ((always_inline)) |
| Release one crystal kernel. | |
| static __DT_CLONE_TARGETS__ int | _pick_layer_kernel (dt_iop_crystgrain_layer_kernel_t *const entry, const dt_iop_crystgrain_runtime_t *const rt, const uint64_t seed) |
| Pick one crystal geometry for one bank entry. | |
| static float | _average_grain_surface (const dt_iop_crystgrain_runtime_t *const rt) |
| Estimate the reference grain surface used to normalize layer capture. | |
| static int | _build_layer_kernel_bank (dt_iop_crystgrain_layer_kernel_t *const bank, const dt_iop_crystgrain_runtime_t *const rt, const uint64_t layer_seed) |
| Build the crystal bank for one layer. | |
| static void | _free_layer_kernel_bank (dt_iop_crystgrain_layer_kernel_t *const bank) |
| Release all crystal footprints from one layer bank. | |
| static __DT_CLONE_TARGETS__ float | _average_discrete_grain_surface (const dt_iop_crystgrain_runtime_t *const rt) |
| Estimate the actual rasterized grain surface at the current scale. | |
| static __DT_CLONE_TARGETS__ float | _predict_layer_capture (const dt_iop_crystgrain_layer_kernel_t *const bank, const float layer_scale, const float remaining_fraction) |
| Predict the mean captured energy of one flat-field layer. | |
| static float | _predict_stack_exposure (const float remaining_fraction) |
| Predict the exposure compensation of one monochrome grain stack. | |
| static size_t | _rgb_index (const size_t pixel, const int channel) |
| static __DT_CLONE_TARGETS__ int | _simulate_channel (const dt_iop_crystgrain_runtime_t *const rt, const float *const image, float *const result, float *const remaining, float *const exposure) |
| Simulate one monochrome grain field from one scalar image. | |
| static __DT_CLONE_TARGETS__ int | _simulate_color (const dt_iop_crystgrain_runtime_t *const rt, const dt_iop_crystgrain_color_state_t *const state, float *const exposure) |
| Simulate one color grain stack with shared crystal geometry. | |
| static __DT_CLONE_TARGETS__ void | _extract_luminance_kernel (const float *const restrict in, float *const restrict image, const int width, const int height, const dt_iop_order_iccprofile_info_t *const work_profile) |
| Extract a luminance image from the RGB input buffer. | |
| static __DT_CLONE_TARGETS__ void | _extract_rgb_kernels (const float *const restrict in, float *const restrict image, const int width, const int height) |
| Extract the three RGB light channels as scalar images. | |
| static __DT_CLONE_TARGETS__ void | _apply_mono_grain_kernel (const float *const restrict in, float *const restrict out, const float *const restrict image, const float *const restrict result, const int width, const int height, const float exposure) |
| Apply one monochrome grain field back onto the RGB image. | |
| static __DT_CLONE_TARGETS__ void | _finalize_color_grain_kernel (const float *const restrict in, float *const restrict out, const float *const restrict image, const float *const restrict result, const int width, const int height, const float exposure_r, const float exposure_g, const float exposure_b, const float colorfulness) |
| Finalize the three color grain channels in one pass. | |
| static int | _simulate_channel_cl (const int devid, dt_iop_crystgrain_global_data_t *const gd, const dt_iop_crystgrain_runtime_t *const rt, cl_mem dev_image, cl_mem dev_result, cl_mem dev_remaining, float *const exposure) |
| Simulate one grain field entirely on the OpenCL device. | |
| void | init_global (dt_iop_module_so_t *module) |
| void | cleanup_global (dt_iop_module_so_t *module) |
| 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) |
| void | commit_params (dt_iop_module_t *self, dt_iop_params_t *p1, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece) |
| void | init_pipe (dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece) |
| void | cleanup_pipe (dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece) |
| 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 | gui_update (struct dt_iop_module_t *self) |
| static void | _mode_changed (GtkWidget *widget, dt_iop_module_t *self) |
| void | gui_init (struct dt_iop_module_t *self) |
| #define DT_CRYSTGRAIN_CL_PROGRAM 36 |
| #define DT_CRYSTGRAIN_LAYER_KERNELS 16 |
| #define DT_CRYSTGRAIN_REDUCESIZE 64 |
| typedef struct dt_iop_crystgrain_color_state_t dt_iop_crystgrain_color_state_t |
| typedef struct dt_iop_crystgrain_data_t dt_iop_crystgrain_data_t |
| typedef struct dt_iop_crystgrain_global_data_t dt_iop_crystgrain_global_data_t |
| typedef struct dt_iop_crystgrain_gui_data_t dt_iop_crystgrain_gui_data_t |
| typedef struct dt_iop_crystgrain_kernel_t dt_iop_crystgrain_kernel_t |
| typedef struct dt_iop_crystgrain_layer_kernel_t dt_iop_crystgrain_layer_kernel_t |
| typedef enum dt_iop_crystgrain_mode_t dt_iop_crystgrain_mode_t |
| typedef struct dt_iop_crystgrain_params_t dt_iop_crystgrain_params_t |
| typedef struct dt_iop_crystgrain_runtime_t dt_iop_crystgrain_runtime_t |
|
inlinestatic |
Release one crystal kernel.
References kernel().
|
static |
Apply one monochrome grain field back onto the RGB image.
We loop over rows, looking for the ratio between the original and grainy luminance, then rescale RGB together so hue stays unchanged. The fully synthesized grain field is applied directly after exposure normalization, with no extra transparency stage. Since the module now lives before filmic RGB, we preserve scene-referred highlights and only clamp negative values away.
References __OMP_PARALLEL_FOR__, height, k, out, row, width, and x.
Referenced by process().
|
static |
Estimate the actual rasterized grain surface at the current scale.
The grain size slider lives in continuous preview pixels, but the simulation ultimately grows integer odd-width kernels that get discretized on the raster grid. That quantization is exactly what changes the look at small preview scales, so we normalize layer capture against the average discrete footprint area sampled from a few layer banks instead of against a noisier variance proxy.
References _average_grain_surface(), _build_layer_kernel_bank(), _free_layer_kernel_bank(), dt_iop_crystgrain_runtime_t::base_seed, DT_CRYSTGRAIN_LAYER_KERNELS, i, dt_iop_crystgrain_runtime_t::layers, and MIN.
Referenced by process(), and process_cl().
|
inlinestatic |
Estimate the reference grain surface used to normalize layer capture.
The user-facing layer capture is expressed against the average grain size control, not against the exact randomized footprint drawn for each seed. We therefore normalize it by the area of a circle built from the average grain radius at the current preview scale.
References dt_iop_crystgrain_runtime_t::grain_size, dt_iop_crystgrain_runtime_t::kernel_scale, M_PI_F, and MAX.
Referenced by _average_discrete_grain_surface().
|
static |
Build the crystal bank for one layer.
We precompute several crystal footprints for the current layer so each accepted seed can randomly pick one geometry without paying the kernel construction cost inside the hot pixel loop.
References _pick_layer_kernel(), DT_CRYSTGRAIN_LAYER_KERNELS, i, and k.
Referenced by _average_discrete_grain_surface(), _simulate_channel(), _simulate_channel_cl(), _simulate_color(), and process_cl().
|
static |
Build one partially-occluding crystal footprint for a layer.
Each bank entry keeps one crystal size, shape and orientation, then the stochastic look comes from stacking many layers and randomly picking between several bank entries at each seed position. The support window is rasterized to integer pixels, but each tap stores a partial-coverage weight so non-integer radii do not collapse to a binary edge.
References _crystal_coverage(), IS_NULL_PTR, k, kernel(), MAX, width, and x.
Referenced by _pick_layer_kernel().
|
inlinestatic |
Estimate the partial coverage of one pixel by one crystal boundary.
The continuous grain radius lives in floating-point, but the raster simulation ultimately writes on whole pixels. We therefore keep the exact radius for the geometry and only quantize the support window. Pixels fully inside the crystal get weight 1, fully outside get 0, and pixels crossed by the boundary get a linear partial occlusion in a 1-pixel transition band.
References CLAMPS, envelope(), and M_PI_F.
Referenced by _create_crystal_kernel().
|
static |
Extract a luminance image from the RGB input buffer.
We loop over rows so each OpenMP worker owns whole scanlines and writes to disjoint cache lines in the destination buffer.
References __OMP_PARALLEL_FOR__, dt_camera_rgb_luminance(), height, k, luminance, dt_iop_order_iccprofile_info_t::lut_in, dt_iop_order_iccprofile_info_t::lutsize, dt_iop_order_iccprofile_info_t::matrix_in, dt_iop_order_iccprofile_info_t::nonlinearlut, row, width, and x.
Referenced by process().
|
static |
Extract the three RGB light channels as scalar images.
The grain model works on per-channel light fields, so we extract them together in one pass to keep the input image hot in cache and avoid three independent full-frame reads before color synthesis starts.
References __OMP_PARALLEL_FOR__, _rgb_index(), height, k, row, width, and x.
Referenced by process().
|
static |
Finalize the three color grain channels in one pass.
The color path only needs one final RGB pass once synthesis is done. We therefore restore each channel exposure, extract the RGB grain residual around the original image, mute only its chromatic excursion, and write the final RGBA output without staging intermediate normalized buffers.
References __OMP_PARALLEL_FOR__, _rgb_index(), height, k, out, row, width, and x.
Referenced by process().
|
static |
Release all crystal footprints from one layer bank.
References DT_CRYSTGRAIN_LAYER_KERNELS, and i.
Referenced by _average_discrete_grain_surface(), _simulate_channel(), _simulate_channel_cl(), _simulate_color(), and process_cl().
Turn 2 seeds into one gaussian deviate.
We only need gaussian draws to pick crystal size and vertex count for one whole layer, so Box-Muller is enough and keeps the implementation local to this module.
References _uniform_random(), M_PI_F, and u2.
Referenced by _pick_layer_kernel().
|
static |
Hash a string into a stable 32-bit seed.
Referenced by process(), and process_cl().
|
static |
References gui_update().
Referenced by gui_init().
|
static |
Pick one crystal geometry for one bank entry.
References _create_crystal_kernel(), _gaussian_random(), _seed_probability(), _uniform_random(), dt_iop_crystgrain_kernel_t::area, CLAMPS, dt_iop_crystgrain_runtime_t::filling, dt_iop_crystgrain_layer_kernel_t::footprint, dt_iop_crystgrain_runtime_t::grain_size, dt_iop_crystgrain_runtime_t::kernel_scale, M_PI_F, MAX, max_size, dt_iop_crystgrain_layer_kernel_t::probability, dt_iop_crystgrain_kernel_t::radius, dt_iop_crystgrain_layer_kernel_t::rotation, dt_iop_crystgrain_runtime_t::size_stddev, dt_iop_crystgrain_layer_kernel_t::vertices, and dt_iop_crystgrain_layer_kernel_t::width.
Referenced by _build_layer_kernel_bank().
|
static |
Predict the mean captured energy of one flat-field layer.
The output normalization only needs the average exposure loss of the stochastic crystal stack. For a unit flat field with remaining energy r, one seed of kernel area A prints a flat tone c = min(r, A * layer_scale), because the unit input averages to 1 over the whole crystal support and the layer sensitivity is expressed per grain surface. One translated crystal contributes c * alpha to a destination pixel, and the sum of all translated weights over the lattice equals A, so the expected per-pixel capture of one bank entry is:
E_i = p_i * A_i * min(r, A_i * layer_scale)
where p_i is the Bernoulli seed probability of that bank entry. Averaging E_i over the precomputed kernel bank gives a mean-field prediction of the layer capture that depends only on the grain statistics, not on the image content.
References dt_iop_crystgrain_kernel_t::area, DT_CRYSTGRAIN_LAYER_KERNELS, dt_iop_crystgrain_layer_kernel_t::footprint, i, MAX, and dt_iop_crystgrain_layer_kernel_t::probability.
Referenced by _simulate_channel(), _simulate_channel_cl(), _simulate_color(), and process_cl().
|
inlinestatic |
Predict the exposure compensation of one monochrome grain stack.
We reuse the exact layer bank sampled for the synthesis and update a flat-field remaining-light fraction alongside the real image simulation. If r_l is the remaining light fraction before layer l, the recurrence is
r_(l+1) = max(r_l - mean_i(E_i(r_l)), 0)
with r_0 = 1. The synthesized stack therefore transmits on average 1 - r_L, so the final global exposure correction is simply
exposure = 1 / (1 - r_L).
This keeps the output normalization tied to the current grain size, filling ratio and layer sensitivity without measuring any image averages.
Referenced by _simulate_channel(), _simulate_channel_cl(), _simulate_color(), and process_cl().
|
inlinestatic |
Mirror indices outside the current buffer like scipy ‘boundary='symm’`.
Referenced by _simulate_channel(), and _simulate_color().
|
inlinestatic |
Referenced by _extract_rgb_kernels(), _finalize_color_grain_kernel(), and _simulate_color().
|
inlinestatic |
Map the requested filling ratio to the Bernoulli probability used to plant seeds.
In the simplified Bernoulli model, one binary crystal of area A covers a destination pixel if any of the A source positions that would hit that pixel spawns a seed. Assuming independent seed events, the uncovered probability is (1 - p)^A, so matching a requested filling ratio f amounts to solving 1 - f = (1 - p)^A, that is p = 1 - (1 - f)^(1 / A). This keeps the expected covered surface stable for the actual discrete grain area at every preview scale.
References CLAMPS.
Referenced by _pick_layer_kernel().
|
static |
Simulate one monochrome grain field from one scalar image.
We loop over seed candidates, looking for pixels that still have photons left to capture on the current layer. Each seed first picks one crystal footprint from the precomputed layer bank, then averages the local layer energy over that footprint so one whole crystal prints one uniform tone. The crystal is finally grown over that footprint while capping the accumulated capture by the local layer capacity so the growth stays energy-conserving. Most pixels live away from image borders, so we keep a fast path there with direct indexing and only fall back to reflected coordinates near the edges.
References _build_layer_kernel_bank(), _free_layer_kernel_bank(), _predict_layer_capture(), _predict_stack_exposure(), _reflect_index(), _uniform_random(), dt_iop_crystgrain_runtime_t::base_seed, DT_CRYSTGRAIN_LAYER_KERNELS, dt_iop_crystgrain_layer_kernel_t::footprint, height, dt_iop_crystgrain_runtime_t::height, dt_iop_crystgrain_runtime_t::inv_scale, kernel(), dt_iop_crystgrain_runtime_t::layer_scale, dt_iop_crystgrain_runtime_t::layers, dt_iop_crystgrain_layer_kernel_t::probability, dt_iop_crystgrain_kernel_t::radius, dt_iop_crystgrain_runtime_t::roi_x, dt_iop_crystgrain_runtime_t::roi_y, splitmix32(), width, dt_iop_crystgrain_runtime_t::width, and x.
Referenced by process().
|
static |
Simulate one grain field entirely on the OpenCL device.
The host precomputes a small bank of crystal geometries for the current layer and uploads only their analytic parameters. Each layer is then dispatched once on the GPU: every pixel decides whether it spawns a crystal, averages the input and current light field over that footprint, then updates the output and remaining light in place through atomic writes.
References _build_layer_kernel_bank(), _free_layer_kernel_bank(), _predict_layer_capture(), _predict_stack_exposure(), dt_iop_crystgrain_runtime_t::base_seed, DT_CRYSTGRAIN_LAYER_KERNELS, dt_opencl_copy_host_to_device_constant(), dt_opencl_enqueue_copy_buffer_to_buffer(), dt_opencl_enqueue_kernel_2d(), dt_opencl_release_mem_object(), dt_opencl_set_kernel_arg(), dt_iop_crystgrain_layer_kernel_t::footprint, height, dt_iop_crystgrain_runtime_t::height, i, dt_iop_crystgrain_runtime_t::inv_scale, IS_NULL_PTR, dt_iop_crystgrain_global_data_t::kernel_simulate_layer, dt_iop_crystgrain_global_data_t::kernel_zero_scalar, dt_iop_crystgrain_runtime_t::layer_scale, dt_iop_crystgrain_runtime_t::layers, dt_iop_crystgrain_layer_kernel_t::probability, dt_iop_crystgrain_kernel_t::radius_f, dt_iop_crystgrain_runtime_t::roi_x, dt_iop_crystgrain_runtime_t::roi_y, dt_iop_crystgrain_layer_kernel_t::rotation, ROUNDUP, dt_iop_crystgrain_layer_kernel_t::vertices, width, and dt_iop_crystgrain_runtime_t::width.
Referenced by process_cl().
|
static |
Simulate one color grain stack with shared crystal geometry.
Real color film is not achromatic either: it stacks blue-, green- and red-sensitive monochrome emulsions in depth, each with its own crystal population. This routine therefore keeps one sequential remaining-light model, but assigns each layer to one spectral sub-stack in blue/green/red order. That keeps the physical "light goes through upper layers first" behavior while avoiding the over-correlated all-channels-at-once look.
References _build_layer_kernel_bank(), _free_layer_kernel_bank(), _predict_layer_capture(), _predict_stack_exposure(), _reflect_index(), _rgb_index(), _uniform_random(), dt_iop_crystgrain_runtime_t::base_seed, dt_iop_crystgrain_runtime_t::channel_correlation, DT_CRYSTGRAIN_LAYER_KERNELS, dt_iop_crystgrain_layer_kernel_t::footprint, height, dt_iop_crystgrain_runtime_t::height, dt_iop_crystgrain_runtime_t::inv_scale, kernel(), dt_iop_crystgrain_runtime_t::layer_scale, dt_iop_crystgrain_runtime_t::layers, dt_iop_crystgrain_layer_kernel_t::probability, dt_iop_crystgrain_kernel_t::radius, dt_iop_crystgrain_runtime_t::roi_x, dt_iop_crystgrain_runtime_t::roi_y, splitmix32(), state, width, dt_iop_crystgrain_runtime_t::width, and x.
Referenced by process().
|
inlinestatic |
Turn a 64-bit seed into a uniform random number in [0; 1).
References splitmix32().
Referenced by _gaussian_random(), _pick_layer_kernel(), _simulate_channel(), and _simulate_color().
| void cleanup_global | ( | dt_iop_module_so_t * | module | ) |
References dt_iop_module_so_t::data, dt_opencl_free_kernel(), dt_iop_crystgrain_global_data_t::kernel_apply_mono, dt_iop_crystgrain_global_data_t::kernel_extract_luminance, dt_iop_crystgrain_global_data_t::kernel_extract_rgb, dt_iop_crystgrain_global_data_t::kernel_finalize_color, dt_iop_crystgrain_global_data_t::kernel_simulate_layer, dt_iop_crystgrain_global_data_t::kernel_simulate_layer_color, dt_iop_crystgrain_global_data_t::kernel_zero_rgb, and dt_iop_crystgrain_global_data_t::kernel_zero_scalar.
| void cleanup_pipe | ( | dt_iop_module_t * | self, |
| dt_dev_pixelpipe_t * | pipe, | ||
| dt_dev_pixelpipe_iop_t * | piece | ||
| ) |
References dt_dev_pixelpipe_iop_t::data, and dt_free_align.
| void commit_params | ( | dt_iop_module_t * | self, |
| dt_iop_params_t * | p1, | ||
| dt_dev_pixelpipe_t * | pipe, | ||
| dt_dev_pixelpipe_iop_t * | piece | ||
| ) |
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 | ||
| ) |
References IOP_CS_RGB.
| int default_group | ( | ) |
References IOP_GROUP_EFFECTS.
| const char ** description | ( | struct dt_iop_module_t * | self | ) |
References dt_iop_set_description().
| int flags | ( | ) |
References IOP_FLAGS_INCLUDE_IN_STYLES, and IOP_FLAGS_SUPPORTS_BLENDING.
| void gui_init | ( | struct dt_iop_module_t * | self | ) |
| void gui_update | ( | struct dt_iop_module_t * | self | ) |
References DT_CRYSTGRAIN_COLOR, g, dt_iop_module_t::gui_data, p, and dt_iop_module_t::params.
Referenced by _mode_changed(), and gui_init().
| void init_global | ( | dt_iop_module_so_t * | module | ) |
References DT_CRYSTGRAIN_CL_PROGRAM, dt_opencl_create_kernel(), dt_iop_crystgrain_global_data_t::kernel_apply_mono, dt_iop_crystgrain_global_data_t::kernel_extract_luminance, dt_iop_crystgrain_global_data_t::kernel_extract_rgb, dt_iop_crystgrain_global_data_t::kernel_finalize_color, dt_iop_crystgrain_global_data_t::kernel_simulate_layer, dt_iop_crystgrain_global_data_t::kernel_simulate_layer_color, dt_iop_crystgrain_global_data_t::kernel_zero_rgb, and dt_iop_crystgrain_global_data_t::kernel_zero_scalar.
| void init_pipe | ( | dt_iop_module_t * | self, |
| dt_dev_pixelpipe_t * | pipe, | ||
| dt_dev_pixelpipe_iop_t * | piece | ||
| ) |
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 | ) |
| int legacy_params | ( | dt_iop_module_t * | self, |
| const void *const | old_params, | ||
| const int | old_version, | ||
| void * | new_params, | ||
| const int | new_version | ||
| ) |
References n.
| const char * name | ( | ) |
| 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 | ||
| ) |
References _apply_mono_grain_kernel(), _average_discrete_grain_surface(), _extract_luminance_kernel(), _extract_rgb_kernels(), _finalize_color_grain_kernel(), _hash_string(), _simulate_channel(), _simulate_color(), d, dt_dev_pixelpipe_iop_t::data, dt_dev_pixelpipe_t::dev, DT_CRYSTGRAIN_MONO, dt_dev_get_module_scale(), DT_IMGSZ_CLEARBUF, dt_iop_alloc_image_buffers(), dt_iop_copy_image_roi(), dt_iop_image_copy_by_size(), dt_ioppr_get_pipe_work_profile_info(), dt_pixelpipe_cache_free_align, dt_image_t::filename, height, dt_iop_roi_t::height, dt_iop_crystgrain_color_state_t::image, dt_develop_t::image_storage, dt_iop_crystgrain_runtime_t::layer_scale, MAX, out, ovoid, dt_dev_pixelpipe_iop_t::roi_in, dt_dev_pixelpipe_iop_t::roi_out, TRUE, width, dt_iop_roi_t::width, dt_iop_crystgrain_runtime_t::width, dt_iop_roi_t::x, and dt_iop_roi_t::y.
| 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 | ||
| ) |
References _average_discrete_grain_surface(), _build_layer_kernel_bank(), _free_layer_kernel_bank(), _hash_string(), _predict_layer_capture(), _predict_stack_exposure(), _simulate_channel_cl(), dt_iop_crystgrain_runtime_t::base_seed, dt_iop_crystgrain_runtime_t::channel_correlation, d, dt_dev_pixelpipe_iop_t::data, dt_dev_pixelpipe_t::dev, dt_dev_pixelpipe_t::devid, DT_CRYSTGRAIN_LAYER_KERNELS, DT_CRYSTGRAIN_MONO, dt_dev_get_module_scale(), dt_ioppr_build_iccprofile_params_cl(), dt_ioppr_free_iccprofile_params_cl(), dt_ioppr_get_pipe_work_profile_info(), dt_opencl_alloc_device_buffer(), dt_opencl_copy_host_to_device_constant(), dt_opencl_enqueue_copy_buffer_to_buffer(), dt_opencl_enqueue_copy_image(), dt_opencl_enqueue_kernel_2d(), dt_opencl_release_mem_object(), dt_opencl_set_kernel_arg(), error(), FALSE, dt_image_t::filename, dt_iop_crystgrain_layer_kernel_t::footprint, dt_iop_module_t::global_data, height, dt_iop_roi_t::height, i, dt_develop_t::image_storage, dt_iop_crystgrain_runtime_t::inv_scale, IS_NULL_PTR, dt_iop_crystgrain_global_data_t::kernel_apply_mono, dt_iop_crystgrain_global_data_t::kernel_extract_luminance, dt_iop_crystgrain_global_data_t::kernel_extract_rgb, dt_iop_crystgrain_global_data_t::kernel_finalize_color, dt_iop_crystgrain_global_data_t::kernel_simulate_layer_color, dt_iop_crystgrain_global_data_t::kernel_zero_rgb, dt_iop_crystgrain_runtime_t::layer_scale, dt_iop_crystgrain_runtime_t::layers, MAX, dt_iop_crystgrain_layer_kernel_t::probability, dt_iop_crystgrain_kernel_t::radius_f, dt_dev_pixelpipe_iop_t::roi_in, dt_dev_pixelpipe_iop_t::roi_out, dt_iop_crystgrain_runtime_t::roi_x, dt_iop_crystgrain_runtime_t::roi_y, dt_iop_crystgrain_layer_kernel_t::rotation, ROUNDUP, TRUE, dt_iop_crystgrain_layer_kernel_t::vertices, width, dt_iop_roi_t::width, dt_iop_crystgrain_runtime_t::width, dt_iop_roi_t::x, and dt_iop_roi_t::y.