77 { 0.0f, 0.0f, 0.0f, 1.0f },
78 { 1.0f, 1.0f, 1.0f, 1.0f }
81 { 1.0f, 0.0f, 0.0f, 1.0f },
82 { 0.0f, 0.0f, 1.0f, 1.0f }
85 { 0.371f, 0.434f, 0.934f, 1.0f },
86 { 0.512f, 0.934f, 0.371f, 1.0f }
101 return _(
"overexposed");
121 void *new_params,
const int new_version)
145 const float *
const restrict in = __builtin_assume_aligned((
const float *
const restrict)ivoid, 64);
146 float *
const restrict
out = __builtin_assume_aligned((
float *
const restrict)
ovoid, 64);
156 if(in[
k + 0] >= upper || in[
k + 1] >= upper || in[
k + 2] >= upper)
160 else if(in[
k + 0] <= lower && in[
k + 1] <= lower && in[
k + 2] <= lower)
177 const float luminance = dt_ioppr_get_rgb_matrix_luminance(in +
k,
179 current_profile->unbounded_coeffs_in,
199 saturation[c] = sqrtf(saturation[c] * saturation[c] / (
luminance *
luminance + in[
k + c] * in[
k + c]));
203 if(saturation[0] > upper || saturation[1] > upper || saturation[2] > upper ||
204 in[
k + 0] >= upper || in[
k + 1] >= upper || in[
k + 2] >= upper)
210 else if(in[
k + 0] <= lower && in[
k + 1] <= lower && in[
k + 2] <= lower)
230 const float luminance = dt_ioppr_get_rgb_matrix_luminance(in +
k,
232 current_profile->unbounded_coeffs_in,
257 const float luminance = dt_ioppr_get_rgb_matrix_luminance(in +
k,
259 current_profile->unbounded_coeffs_in,
261 if(luminance < upper && luminance > lower)
268 saturation[c] = sqrtf(saturation[c] * saturation[c] / (
luminance *
luminance + in[
k + c] * in[
k + c]));
272 if(saturation[0] > upper || saturation[1] > upper || saturation[2] > upper ||
273 in[
k + 0] >= upper || in[
k + 1] >= upper || in[
k + 2] >= upper)
277 else if(in[
k + 0] <= lower && in[
k + 1] <= lower && in[
k + 2] <= lower)
308 const int devid = pipe->
devid;
314 const int use_work_profile = (
IS_NULL_PTR(current_profile)) ? 0 : 1;
315 cl_mem dev_profile_info = NULL;
316 cl_mem dev_profile_lut = NULL;
318 cl_float *profile_lut_cl = NULL;
321 &dev_profile_info, &dev_profile_lut);
322 if(err != CL_SUCCESS)
goto error;
346 if(err != CL_SUCCESS)
goto error;
370 const int program = 2;
404 module->params = calloc(1, sizeof(dt_iop_overexposed_t));
405 module->default_params = calloc(1, sizeof(dt_iop_overexposed_t));
406 module->hide_enable_button = 1;
407 module->default_enabled = 1;
408 module->params_size = sizeof(dt_iop_overexposed_t);
409 module->gui_data = NULL;
static void error(char *msg)
const dt_colormatrix_t dt_aligned_pixel_t out
void dt_print(dt_debug_thread_t thread, const char *msg,...)
static void copy_pixel(float *const __restrict__ out, const float *const __restrict__ in)
#define for_each_channel(_var,...)
#define DT_MODULE(MODVER)
#define __DT_CLONE_TARGETS__
#define __OMP_PARALLEL_FOR__(...)
#define IS_NULL_PTR(p)
C is way too permissive with !=, == and if(var) checks, which can mean too many things depending on w...
@ DT_DEV_PIXELPIPE_DISPLAY_MASK
@ 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
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)
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)
float *const restrict luminance
float *const restrict const size_t k
float *const restrict const size_t const size_t ch
float dt_aligned_pixel_t[4]
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)
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)
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)
struct dt_iop_module_t *void * data
dt_dev_pixelpipe_type_t type
dt_clipping_preview_mode_t mode
dt_dev_overexposed_colorscheme_t colorscheme
struct dt_develop_t::@21 overexposed
dt_iop_global_data_t * data
struct dt_develop_t * dev
dt_iop_global_data_t * global_data
dt_colormatrix_t matrix_in
Region of interest passed through the pixelpipe.