![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
#include "develop/imageop_gui.h"#include <assert.h>#include <math.h>#include <stdlib.h>#include <string.h>#include "common/colorspaces_inline_conversions.h"#include "common/opencl.h"#include "develop/develop.h"#include "iop/iop_api.h"#include "widgets/widget_settings.h"
Include dependency graph for gamma.c:Go to the source code of this file.
Data Structures | |
| struct | dt_iop_gamma_params_t |
| This module converts float32 RGBA pixels to uint8 BGRA pixels, for GUI pipelines only (darkroom main preview and navigation thumbnail). It self-disables for export pipelines. More... | |
| struct | dt_iop_gamma_global_data_t |
| struct | dt_iop_gamma_mask_preview_t |
| Shared appearance of mask previews rendered by the display encoding module. More... | |
| struct | dt_iop_gamma_data_t |
| Everything the two process() paths need, settled once per commit_params(). More... | |
Typedefs | |
| typedef struct dt_iop_gamma_params_t | dt_iop_gamma_params_t |
| This module converts float32 RGBA pixels to uint8 BGRA pixels, for GUI pipelines only (darkroom main preview and navigation thumbnail). It self-disables for export pipelines. | |
| typedef struct dt_iop_gamma_global_data_t | dt_iop_gamma_global_data_t |
| typedef enum dt_iop_gamma_kernel_mode_t | dt_iop_gamma_kernel_mode_t |
| typedef enum dt_iop_gamma_false_color_t | dt_iop_gamma_false_color_t |
| typedef struct dt_iop_gamma_mask_preview_t | dt_iop_gamma_mask_preview_t |
| Shared appearance of mask previews rendered by the display encoding module. | |
| typedef struct dt_iop_gamma_data_t | dt_iop_gamma_data_t |
| Everything the two process() paths need, settled once per commit_params(). | |
Enumerations | |
| enum | dt_iop_gamma_kernel_mode_t { DT_IOP_GAMMA_KERNEL_COPY = 0 , DT_IOP_GAMMA_KERNEL_MASK = 1 , DT_IOP_GAMMA_KERNEL_CHANNEL_MONO = 2 , DT_IOP_GAMMA_KERNEL_CHANNEL_FALSE_COLOR = 3 } |
| enum | dt_iop_gamma_false_color_t { DT_IOP_GAMMA_FALSE_COLOR_MONO = 0 , DT_IOP_GAMMA_FALSE_COLOR_A = 1 , DT_IOP_GAMMA_FALSE_COLOR_B = 2 , DT_IOP_GAMMA_FALSE_COLOR_R = 3 , DT_IOP_GAMMA_FALSE_COLOR_G = 4 , DT_IOP_GAMMA_FALSE_COLOR_B_CH = 5 , DT_IOP_GAMMA_FALSE_COLOR_C = 6 , DT_IOP_GAMMA_FALSE_COLOR_LCH_H = 7 , DT_IOP_GAMMA_FALSE_COLOR_HSL_H = 8 , DT_IOP_GAMMA_FALSE_COLOR_JZ_HZ = 9 } |
| typedef struct dt_iop_gamma_data_t dt_iop_gamma_data_t |
Everything the two process() paths need, settled once per commit_params().
Display encoding is the LAST node of every darkroom frame, so whatever it reads is paid at the frame rate, on every interaction. All of this describes the mask-preview checkerboard and the false-colour channel display, and every field of it used to be read from conf inside process()/process_cl() – six of them through dt_conf_get_float(), which runs dt_calculator_solve() over the stored string on EVERY call: an expression parser, per value, per frame, for a checkerboard an ordinary frame never draws.
Reading application-level configuration is not a pipeline filter's job in the first place. commit_params() is where a node's effective contract is settled, and iop/colorbalancergb.c already settles these same keys there; this module is the other half of the same preview and had simply never been moved.
What makes that safe is runtime_data_hash() (iop/iop_api.h): it folds the first piece->data_size bytes into the cache key, so a settled value that changes re-keys this node instead of being silently served from a cacheline that no longer describes it. The struct therefore holds CONTENT only and no pointers at all – see the api doc for why a pointer in the hashed prefix is wrong in both directions (issue #1145).
preview.width is the ROI's, not a setting: it stays 0 here and is filled per call.
| typedef enum dt_iop_gamma_false_color_t dt_iop_gamma_false_color_t |
| typedef struct dt_iop_gamma_global_data_t dt_iop_gamma_global_data_t |
| typedef enum dt_iop_gamma_kernel_mode_t dt_iop_gamma_kernel_mode_t |
| typedef struct dt_iop_gamma_mask_preview_t dt_iop_gamma_mask_preview_t |
Shared appearance of mask previews rendered by the display encoding module.
The checker colors remain in linear RGB until they are blended with the image so this path matches module-authored previews that continue through display encoding.
| typedef struct dt_iop_gamma_params_t dt_iop_gamma_params_t |
This module converts float32 RGBA pixels to uint8 BGRA pixels, for GUI pipelines only (darkroom main preview and navigation thumbnail). It self-disables for export pipelines.
| __OMP_DECLARE_SIMD__ | ( | aligned(pixel:16) uniform(norm) | ) |
Definition at line 217 of file gamma.c.
References factor, for_each_channel, and x.
| __OMP_DECLARE_SIMD__ | ( | aligned(XYZ, sRGB:16) uniform(norm) | ) |
Definition at line 226 of file gamma.c.
References dt_XYZ_to_Rec709_D50(), sRGB, and XYZ.
|
static |
Definition at line 247 of file gamma.c.
References __OMP_PARALLEL_FOR__, __OMP_PARALLEL_FOR_SIMD__, _channel_display_monochrome(), _write_pixel(), DT_DEV_PIXELPIPE_DISPLAY_a, DT_DEV_PIXELPIPE_DISPLAY_ANY, DT_DEV_PIXELPIPE_DISPLAY_b, DT_DEV_PIXELPIPE_DISPLAY_B, DT_DEV_PIXELPIPE_DISPLAY_G, DT_DEV_PIXELPIPE_DISPLAY_GRAY, DT_DEV_PIXELPIPE_DISPLAY_HSL_H, DT_DEV_PIXELPIPE_DISPLAY_HSL_l, DT_DEV_PIXELPIPE_DISPLAY_HSL_S, DT_DEV_PIXELPIPE_DISPLAY_JzCzhz_Cz, DT_DEV_PIXELPIPE_DISPLAY_JzCzhz_hz, DT_DEV_PIXELPIPE_DISPLAY_JzCzhz_Jz, DT_DEV_PIXELPIPE_DISPLAY_L, DT_DEV_PIXELPIPE_DISPLAY_LCH_C, DT_DEV_PIXELPIPE_DISPLAY_LCH_h, DT_DEV_PIXELPIPE_DISPLAY_OUTPUT, DT_DEV_PIXELPIPE_DISPLAY_R, dt_Lab_to_XYZ(), JzAzBz, out, preview, value, and XYZ_D65.
Referenced by process().
|
static |
Definition at line 234 of file gamma.c.
References __OMP_PARALLEL_FOR_SIMD__, _write_pixel(), out, and preview.
Referenced by _channel_display_false_color(), and process().
|
static |
Definition at line 382 of file gamma.c.
References __OMP_PARALLEL_FOR_SIMD__, and out.
Referenced by process().
|
static |
Definition at line 449 of file gamma.c.
References DT_DEV_PIXELPIPE_DISPLAY_a, DT_DEV_PIXELPIPE_DISPLAY_ANY, DT_DEV_PIXELPIPE_DISPLAY_b, DT_DEV_PIXELPIPE_DISPLAY_B, DT_DEV_PIXELPIPE_DISPLAY_G, DT_DEV_PIXELPIPE_DISPLAY_GRAY, DT_DEV_PIXELPIPE_DISPLAY_HSL_H, DT_DEV_PIXELPIPE_DISPLAY_HSL_l, DT_DEV_PIXELPIPE_DISPLAY_HSL_S, DT_DEV_PIXELPIPE_DISPLAY_JzCzhz_Cz, DT_DEV_PIXELPIPE_DISPLAY_JzCzhz_hz, DT_DEV_PIXELPIPE_DISPLAY_JzCzhz_Jz, DT_DEV_PIXELPIPE_DISPLAY_L, DT_DEV_PIXELPIPE_DISPLAY_LCH_C, DT_DEV_PIXELPIPE_DISPLAY_LCH_h, DT_DEV_PIXELPIPE_DISPLAY_OUTPUT, DT_DEV_PIXELPIPE_DISPLAY_R, DT_IOP_GAMMA_FALSE_COLOR_A, DT_IOP_GAMMA_FALSE_COLOR_B, DT_IOP_GAMMA_FALSE_COLOR_B_CH, DT_IOP_GAMMA_FALSE_COLOR_C, DT_IOP_GAMMA_FALSE_COLOR_G, DT_IOP_GAMMA_FALSE_COLOR_HSL_H, DT_IOP_GAMMA_FALSE_COLOR_JZ_HZ, DT_IOP_GAMMA_FALSE_COLOR_LCH_H, DT_IOP_GAMMA_FALSE_COLOR_MONO, and DT_IOP_GAMMA_FALSE_COLOR_R.
Referenced by process_cl().
|
static |
Definition at line 364 of file gamma.c.
References __OMP_PARALLEL_FOR_SIMD__, _write_pixel(), out, and preview.
Referenced by process().
|
inlinestatic |
Blend one linear RGB pixel with its mask checker and encode it for display.
Definition at line 191 of file gamma.c.
References out, preview, value, and x.
Referenced by _channel_display_false_color(), _channel_display_monochrome(), and _mask_display().
| void cleanup_global | ( | dt_iop_module_so_t * | module | ) |
Definition at line 574 of file gamma.c.
References dt_iop_module_so_t::data, dt_free, dt_opencl_free_kernel(), and dt_iop_gamma_global_data_t::kernel_gamma_pack.
| void cleanup_pipe | ( | struct dt_iop_module_t * | self, |
| dt_dev_pixelpipe_t * | pipe, | ||
| dt_dev_pixelpipe_iop_t * | piece | ||
| ) |
Definition at line 608 of file gamma.c.
References dt_free_align, and piece.
| void commit_params | ( | dt_iop_module_t * | self, |
| dt_iop_params_t * | params, | ||
| dt_dev_pixelpipe_t * | pipe, | ||
| dt_dev_pixelpipe_iop_t * | piece | ||
| ) |
Definition at line 615 of file gamma.c.
References d, dt_conf_get_bool(), dt_conf_get_float(), dt_conf_get_int(), dt_conf_is_equal(), DT_DEV_PIXELPIPE_FULL, DT_DEV_PIXELPIPE_PREVIEW, DT_PIXEL_APPLY_DPI, IS_NULL_PTR, MAX, piece, pipe, and dt_dev_pixelpipe_t::type.
| int default_colorspace | ( | dt_iop_module_t * | self, |
| dt_dev_pixelpipe_t * | pipe, | ||
| const dt_dev_pixelpipe_iop_t * | piece | ||
| ) |
Definition at line 120 of file gamma.c.
References IOP_CS_RGB_DISPLAY.
| int default_group | ( | ) |
Definition at line 110 of file gamma.c.
References IOP_GROUP_TECHNICAL.
| int flags | ( | ) |
Definition at line 115 of file gamma.c.
References IOP_FLAGS_HIDDEN, IOP_FLAGS_NO_HISTORY_STACK, IOP_FLAGS_ONE_INSTANCE, and IOP_FLAGS_UNSAFE_COPY.
| void init | ( | dt_iop_module_t * | module | ) |
| void init_global | ( | dt_iop_module_so_t * | module | ) |
Definition at line 565 of file gamma.c.
References dt_opencl_create_kernel(), and dt_iop_gamma_global_data_t::kernel_gamma_pack.
| void init_pipe | ( | struct dt_iop_module_t * | self, |
| dt_dev_pixelpipe_t * | pipe, | ||
| dt_dev_pixelpipe_iop_t * | piece | ||
| ) |
Definition at line 602 of file gamma.c.
References dt_calloc_align(), IS_NULL_PTR, and piece.
| 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 125 of file gamma.c.
References dt_iop_buffer_dsc_t::channels, dt_iop_buffer_dsc_t::datatype, default_input_format(), piece, pipe, and TYPE_FLOAT.
| void output_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 133 of file gamma.c.
References dt_iop_buffer_dsc_t::channels, dt_iop_buffer_dsc_t::cst, dt_iop_buffer_dsc_t::datatype, piece, pipe, and TYPE_UINT8.
| int process | ( | struct dt_iop_module_t * | self, |
| const dt_dev_pixelpipe_t * | pipe, | ||
| const dt_dev_pixelpipe_iop_t * | piece, | ||
| const void *const | i, | ||
| void *const | o | ||
| ) |
Definition at line 396 of file gamma.c.
References _channel_display_false_color(), _channel_display_monochrome(), _copy_output(), _mask_display(), d, DT_DEV_PIXELPIPE_DISPLAY_ANY, DT_DEV_PIXELPIPE_DISPLAY_CHANNEL, DT_DEV_PIXELPIPE_DISPLAY_MASK, dt_iop_roi_t::height, i, IS_NULL_PTR, dt_dev_pixelpipe_t::mask_display, o, piece, pipe, preview, dt_iop_gamma_mask_preview_t::width, and dt_iop_roi_t::width.
| 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 482 of file gamma.c.
References _false_color_channel_to_kernel_code(), d, dt_dev_pixelpipe_t::devid, DT_DEBUG_OPENCL, DT_DEV_PIXELPIPE_DISPLAY_ANY, DT_DEV_PIXELPIPE_DISPLAY_CHANNEL, DT_DEV_PIXELPIPE_DISPLAY_MASK, DT_IOP_GAMMA_FALSE_COLOR_MONO, DT_IOP_GAMMA_KERNEL_CHANNEL_FALSE_COLOR, DT_IOP_GAMMA_KERNEL_CHANNEL_MONO, DT_IOP_GAMMA_KERNEL_COPY, DT_IOP_GAMMA_KERNEL_MASK, dt_opencl_enqueue_kernel_2d(), dt_opencl_set_kernel_arg(), dt_print(), FALSE, dt_iop_module_t::global_data, height, dt_iop_roi_t::height, IS_NULL_PTR, dt_iop_gamma_global_data_t::kernel_gamma_pack, dt_dev_pixelpipe_t::mask_display, piece, pipe, ROUNDUPDHT, ROUNDUPDWD, TRUE, width, and dt_iop_roi_t::width.
| gboolean runtime_data_hash | ( | struct dt_iop_module_t * | self, |
| dt_dev_pixelpipe_t * | pipe, | ||
| const dt_dev_pixelpipe_iop_t * | piece | ||
| ) |