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 }
106 return _(
"overexposed");
126 void *new_params,
const int new_version)
150 const float *
const restrict in = __builtin_assume_aligned((
const float *
const restrict)ivoid, 64);
151 float *
const restrict
out = __builtin_assume_aligned((
float *
const restrict)
ovoid, 64);
161 if(in[
k + 0] >= upper || in[
k + 1] >= upper || in[
k + 2] >= upper)
165 else if(in[
k + 0] <= lower && in[
k + 1] <= lower && in[
k + 2] <= lower)
182 const float luminance = dt_ioppr_get_rgb_matrix_luminance(in +
k,
184 current_profile->unbounded_coeffs_in,
204 saturation[c] = sqrtf(saturation[c] * saturation[c] / (
luminance *
luminance + in[
k + c] * in[
k + c]));
208 if(saturation[0] > upper || saturation[1] > upper || saturation[2] > upper ||
209 in[
k + 0] >= upper || in[
k + 1] >= upper || in[
k + 2] >= upper)
215 else if(in[
k + 0] <= lower && in[
k + 1] <= lower && in[
k + 2] <= lower)
235 const float luminance = dt_ioppr_get_rgb_matrix_luminance(in +
k,
237 current_profile->unbounded_coeffs_in,
262 const float luminance = dt_ioppr_get_rgb_matrix_luminance(in +
k,
264 current_profile->unbounded_coeffs_in,
266 if(luminance < upper && luminance > lower)
273 saturation[c] = sqrtf(saturation[c] * saturation[c] / (
luminance *
luminance + in[
k + c] * in[
k + c]));
277 if(saturation[0] > upper || saturation[1] > upper || saturation[2] > upper ||
278 in[
k + 0] >= upper || in[
k + 1] >= upper || in[
k + 2] >= upper)
282 else if(in[
k + 0] <= lower && in[
k + 1] <= lower && in[
k + 2] <= lower)
313 const int devid = pipe->
devid;
319 const int use_work_profile = (
IS_NULL_PTR(current_profile)) ? 0 : 1;
320 cl_mem dev_profile_info = NULL;
321 cl_mem dev_profile_lut = NULL;
323 cl_float *profile_lut_cl = NULL;
326 &dev_profile_info, &dev_profile_lut);
327 if(err != CL_SUCCESS)
goto error;
351 if(err != CL_SUCCESS)
goto error;
375 const int program = 2;
409 module->params = calloc(1, sizeof(dt_iop_overexposed_t));
410 module->default_params = calloc(1, sizeof(dt_iop_overexposed_t));
411 module->hide_enable_button = 1;
412 module->default_enabled = 1;
413 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_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
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_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)
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,...)
The device-side view of a dt_iop_order_iccprofile_info_t: the scalar fields only.
struct dt_iop_module_t *void * data
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...
Region of interest passed through the pixelpipe.
#define __DT_CLONE_TARGETS__