82 { 0.0f, 0.0f, 0.0f, 1.0f },
83 { 1.0f, 1.0f, 1.0f, 1.0f }
86 { 1.0f, 0.0f, 0.0f, 1.0f },
87 { 0.0f, 0.0f, 1.0f, 1.0f }
90 { 0.371f, 0.434f, 0.934f, 1.0f },
91 { 0.512f, 0.934f, 0.371f, 1.0f }
118 return _(
"overexposed");
138 void *new_params,
const int new_version)
154 const float lower = exp2f(fminf(
d->lower, -4.f));
155 const float upper =
d->upper / 100.0f;
157 const int colorscheme =
d->colorscheme;
161 const float *
const restrict in = __builtin_assume_aligned((
const float *
const restrict)ivoid, 64);
162 float *
const restrict
out = __builtin_assume_aligned((
float *
const restrict)
ovoid, 64);
172 if(in[
k + 0] >= upper || in[
k + 1] >= upper || in[
k + 2] >= upper)
176 else if(in[
k + 0] <= lower && in[
k + 1] <= lower && in[
k + 2] <= lower)
193 const float luminance = dt_ioppr_get_rgb_matrix_luminance(in +
k,
195 current_profile->unbounded_coeffs_in,
215 saturation[c] = sqrtf(saturation[c] * saturation[c] / (
luminance *
luminance + in[
k + c] * in[
k + c]));
219 if(saturation[0] > upper || saturation[1] > upper || saturation[2] > upper ||
220 in[
k + 0] >= upper || in[
k + 1] >= upper || in[
k + 2] >= upper)
226 else if(in[
k + 0] <= lower && in[
k + 1] <= lower && in[
k + 2] <= lower)
246 const float luminance = dt_ioppr_get_rgb_matrix_luminance(in +
k,
248 current_profile->unbounded_coeffs_in,
273 const float luminance = dt_ioppr_get_rgb_matrix_luminance(in +
k,
275 current_profile->unbounded_coeffs_in,
277 if(luminance < upper && luminance > lower)
284 saturation[c] = sqrtf(saturation[c] * saturation[c] / (
luminance *
luminance + in[
k + c] * in[
k + c]));
288 if(saturation[0] > upper || saturation[1] > upper || saturation[2] > upper ||
289 in[
k + 0] >= upper || in[
k + 1] >= upper || in[
k + 2] >= upper)
293 else if(in[
k + 0] <= lower && in[
k + 1] <= lower && in[
k + 2] <= lower)
330 const int use_work_profile = (
IS_NULL_PTR(current_profile)) ? 0 : 1;
331 cl_mem dev_profile_info = NULL;
332 cl_mem dev_profile_lut = NULL;
334 cl_float *profile_lut_cl = NULL;
337 &dev_profile_info, &dev_profile_lut);
338 if(err != CL_SUCCESS)
goto error;
340 const float lower = exp2f(fminf(
d->lower, -4.f));
341 const float upper =
d->upper / 100.0f;
342 const int colorscheme =
d->colorscheme;
346 const int mode =
d->mode;
362 if(err != CL_SUCCESS)
goto error;
386 const int program = 2;
436 module->params = calloc(1, sizeof(dt_iop_overexposed_t));
437 module->default_params = calloc(1, sizeof(dt_iop_overexposed_t));
438 module->hide_enable_button = 1;
439 module->default_enabled = 1;
440 module->params_size = sizeof(dt_iop_overexposed_t);
static void error(char *msg)
cl_int dt_ioppr_build_iccprofile_params_cl(const dt_iop_order_iccprofile_info_t *const profile_info, const int devid, dt_colorspaces_iccprofile_info_cl_t **_profile_info_cl, cl_float **_profile_lut_cl, cl_mem *_dev_profile_info, cl_mem *_dev_profile_lut)
build the required parameters for a kernel that uses a profile info.
const dt_colormatrix_t dt_aligned_pixel_t out
dt_iop_order_iccprofile_info_t * dt_ioppr_get_pipe_current_profile_info(dt_iop_module_t *module, const struct dt_dev_pixelpipe_t *pipe)
dt_dev_overexposed_colorscheme_t
@ DT_DEV_PIXELPIPE_DISPLAY_MASK
dt_clipping_preview_mode_t
@ DT_CLIPPING_PREVIEW_ANYRGB
@ DT_CLIPPING_PREVIEW_GAMUT
@ DT_CLIPPING_PREVIEW_SATURATION
@ DT_CLIPPING_PREVIEW_LUMINANCE
void dt_iop_set_cache_bypass(dt_iop_module_t *module, gboolean state)
@ IOP_FLAGS_NO_HISTORY_STACK
static const dt_dev_pixelpipe_t * pipe
static const dt_dev_pixelpipe_t const dt_dev_pixelpipe_iop_t * piece
void dt_print(dt_debug_thread_t thread, const char *msg,...) __attribute__((format(printf
Print to stdout when thread is enabled, prefixed with seconds since startup.
float *const restrict luminance
float *const restrict const size_t k
float *const restrict const size_t const size_t ch
#define IS_NULL_PTR(p)
C is way too permissive with !=, == and if(var) checks, which can mean too many things depending on w...
#define dt_free_align(ptr)
Release memory from dt_alloc_align() and set ptr to NULL.
static void * dt_calloc_align(size_t size)
dt_alloc_align() followed by a zero fill.
#define DT_ALIGNED_ARRAY
Align an object on a cacheline boundary, so AVX2 can load it whole.
#define dt_free(ptr)
g_free() ptr and set it to NULL, skipping both if it is already NULL.
#define DT_MODULE(MODVER)
Instantiate the version handshake every module must export. Use once, at file scope,...
int dt_opencl_enqueue_kernel_2d(const int dev, const int kernel, const size_t *sizes)
int dt_opencl_create_kernel(const int prog, const char *name)
void dt_opencl_free_kernel(const int kernel)
int dt_opencl_set_kernel_arg(const int dev, const int kernel, const int num, const size_t size, const void *arg)
#define __OMP_PARALLEL_FOR__(...)
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 init(dt_iop_module_t *module)
__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 init_pipe(struct dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
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 cleanup_global(dt_iop_module_so_t *module)
dt_iop_overexposed_colorscheme_t
@ DT_IOP_OVEREXPOSED_BLACKWHITE
@ DT_IOP_OVEREXPOSED_REDBLUE
@ DT_IOP_OVEREXPOSED_PURPLEGREEN
int default_colorspace(dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece)
gboolean runtime_data_hash(struct dt_iop_module_t *self __attribute__((unused)), dt_dev_pixelpipe_t *pipe __attribute__((unused)), const dt_dev_pixelpipe_iop_t *piece __attribute__((unused)))
static const float DT_ALIGNED_ARRAY dt_iop_overexposed_colors[][2][4]
void cleanup_pipe(struct dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
void init_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)
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 void copy_pixel(float *const __restrict__ out, const float *const __restrict__ in)
DT_ALIGNED_PIXEL float dt_aligned_pixel_t[4]
#define for_each_channel(_var,...)
float dt_aligned_pixel_simd_t __attribute__((vector_size(16), aligned(16)))
Apply one channel's tone curve to each of the three colour channels, or pass the channel through unto...
The device-side view of a dt_iop_order_iccprofile_info_t: the scalar fields only.
dt_dev_pixelpipe_type_t type
dt_clipping_preview_mode_t mode
struct dt_develop_t::@15 overexposed
dt_dev_overexposed_colorscheme_t colorscheme
dt_iop_global_data_t * data
struct dt_develop_t * dev
dt_iop_global_data_t * global_data
A profile reduced to the arithmetic the pixel loop can run: two matrices and six tone-curve LUTs,...
int nonlinearlut
Non-zero when the profile has tone curves at all; tested as a boolean everywhere, but it is really th...
int lutsize
Entry count of each of the six LUTs. Always 65536 in practice: both callers of dt_ioppr_init_profile_...
float * lut_in[3]
Per-channel encoded -> linear tone curve, lutsize entries each, sampled over [0,1]....
dt_colormatrix_t matrix_in
RGB -> XYZ (D50), row-major. matrix_in[1][*] is the luminance row. NaN in [0][0] marks the whole prof...
dt_dev_overexposed_colorscheme_t colorscheme
dt_clipping_preview_mode_t mode
Region of interest passed through the pixelpipe.
#define __DT_CLONE_TARGETS__