Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
gamma.c
Go to the documentation of this file.
1/*
2 This file is part of darktable,
3 Copyright (C) 2009-2012 johannes hanika.
4 Copyright (C) 2010-2011 Bruce Guenter.
5 Copyright (C) 2010-2011 Henrik Andersson.
6 Copyright (C) 2010 José Carlos García Sogo.
7 Copyright (C) 2010 Pascal de Bruijn.
8 Copyright (C) 2011 Robert Bieber.
9 Copyright (C) 2012 Richard Wonka.
10 Copyright (C) 2012, 2014, 2017 Ulrich Pegelow.
11 Copyright (C) 2013, 2020 Aldric Renaudin.
12 Copyright (C) 2013-2014, 2016-2017, 2019 Tobias Ellinghaus.
13 Copyright (C) 2014-2016 Roman Lebedev.
14 Copyright (C) 2015 Pedro Côrte-Real.
15 Copyright (C) 2018, 2020, 2023, 2025-2026 Aurélien PIERRE.
16 Copyright (C) 2018-2019 Edgardo Hoszowski.
17 Copyright (C) 2019 Andreas Schneider.
18 Copyright (C) 2020 Diederik Ter Rahe.
19 Copyright (C) 2020 Harold le Clément de Saint-Marcq.
20 Copyright (C) 2020-2021 Pascal Obry.
21 Copyright (C) 2021 Ralf Brown.
22 Copyright (C) 2022 Martin Bařinka.
23 Copyright (C) 2022 Philipp Lutz.
24
25 darktable is free software: you can redistribute it and/or modify
26 it under the terms of the GNU General Public License as published by
27 the Free Software Foundation, either version 3 of the License, or
28 (at your option) any later version.
29
30 darktable is distributed in the hope that it will be useful,
31 but WITHOUT ANY WARRANTY; without even the implied warranty of
32 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33 GNU General Public License for more details.
34
35 You should have received a copy of the GNU General Public License
36 along with darktable. If not, see <http://www.gnu.org/licenses/>.
37*/
38#ifdef HAVE_CONFIG_H
39#include "common/darktable.h"
40#include "config.h"
41#endif
42#include <assert.h>
43#include <math.h>
44#include <stdlib.h>
45#include <string.h>
46
48#include "common/opencl.h"
49#include "control/control.h"
50#include "develop/develop.h"
51
52#include "gui/gtk.h"
53#include "iop/iop_api.h"
54
63
64
69
70#ifdef HAVE_OPENCL
75
83
97#endif
98
99const char *name()
100{
101 return C_("modulename", "display encoding");
102}
103
105{
106 return IOP_GROUP_TECHNICAL;
107}
108
113
118
121{
122 default_input_format(self, pipe, piece, dsc);
123 dsc->channels = 4;
124 dsc->datatype = TYPE_FLOAT;
125}
126
129{
130 dsc->channels = 4;
131 dsc->datatype = TYPE_UINT8;
132 dsc->cst = self->default_colorspace(self, pipe, piece);
133}
134
135
151
155__OMP_DECLARE_SIMD__(uniform(preview))
156static inline void _write_pixel(const float *const restrict in, uint8_t *const restrict out,
157 const dt_iop_gamma_mask_preview_t *const preview,
158 const size_t pixel_index, const float alpha)
159{
160 // Blend the image with the checker in linear RGB, then encode the result once.
161 const size_t y = pixel_index / preview->width;
162 const size_t x = pixel_index - y * preview->width;
163 const gboolean first_x = x % preview->checker_1 < x % preview->checker_2;
164 const gboolean first_y = y % preview->checker_1 < y % preview->checker_2;
165 const float *const checker_color
166 = first_x == first_y ? preview->checker_color_2 : preview->checker_color_1;
167 dt_aligned_pixel_t pixel;
168 for(size_t c = 0; c < 3; c++)
169 {
170 const float value = in[c] * (1.0f - alpha) + checker_color[c] * alpha;
171 pixel[c] = value <= 0.0031308f ? 12.92f * value
172 : (1.0f + 0.055f) * powf(value, 1.0f / 2.4f) - 0.055f;
173 }
174
175 // the output of this module is BGR(A) instead of RGBA; can't use for_each_channel here due to the index swap
176 for(size_t c = 0; c < 3; c++)
177 {
178 const float value = roundf(255.0f * pixel[c]);
179 out[2 - c] = (uint8_t)(fminf(fmaxf(value, 0.0f), 255.0f));
180 }
181}
182__OMP_DECLARE_SIMD__(aligned(pixel: 16) uniform(norm))
183static inline __attribute__((always_inline)) void _normalize_color(float *const restrict pixel, const float norm)
184{
185 // color may not be black!
186 const float factor = norm / fmaxf(pixel[0], fmaxf(pixel[1], pixel[2]));
188 pixel[x] *= factor;
189}
190
191__OMP_DECLARE_SIMD__(aligned(XYZ, sRGB: 16) uniform(norm))
192static inline void _XYZ_to_REC_709_normalized(const float *const restrict XYZ, float *const restrict sRGB,
193 const float norm)
194{
196 _normalize_color(sRGB, norm);
197}
199static void _channel_display_monochrome(const float *const restrict in, uint8_t *const restrict out,
200 const size_t buffsize, const float alpha,
201 const dt_iop_gamma_mask_preview_t *const preview)
202{
203 // Render each selected channel value as a neutral image over the shared mask checkerboard.
204 __OMP_PARALLEL_FOR_SIMD__(aligned(in, out: 64))
205 for(size_t j = 0; j < buffsize; j += 4)
206 {
207 dt_aligned_pixel_t pixel = { in[j + 1], in[j + 1], in[j + 1], in[j + 1] };
208 _write_pixel(pixel, out + j, preview, j / 4, in[j + 3] * alpha);
209 }
210}
212static void _channel_display_false_color(const float *const restrict in, uint8_t *const restrict out,
213 const size_t buffsize, const float alpha,
215 const dt_iop_gamma_mask_preview_t *const preview)
216{
218 {
220 __OMP_PARALLEL_FOR_SIMD__(aligned(in, out: 64))
221 for(size_t j = 0; j < buffsize; j += 4)
222 {
224 dt_aligned_pixel_t pixel;
225 // colors with "a" exceeding the range [-56,56] range will yield colors not representable in sRGB
226 const float value = fminf(fmaxf(in[j + 1] * 256.0f - 128.0f, -56.0f), 56.0f);
227 const dt_aligned_pixel_t lab = { 79.0f - value * (11.0f / 56.0f), value, 0.0f, 0.0f };
228 dt_Lab_to_XYZ(lab, xyz);
229 _XYZ_to_REC_709_normalized(xyz, pixel, 0.75f);
230 _write_pixel(pixel, out + j, preview, j / 4, in[j + 3] * alpha);
231 }
232 break;
234 __OMP_PARALLEL_FOR_SIMD__(aligned(in, out: 64))
235 for(size_t j = 0; j < buffsize; j += 4)
236 {
237 dt_aligned_pixel_t xyz, pixel;
238 // colors with "b" exceeding the range [-65,65] range will yield colors not representable in sRGB
239 const float value = fminf(fmaxf(in[j + 1] * 256.0f - 128.0f, -65.0f), 65.0f);
240 const dt_aligned_pixel_t lab = { 60.0f + value * (2.0f / 65.0f), 0.0f, value, 0.0f };
241 dt_Lab_to_XYZ(lab, xyz);
242 _XYZ_to_REC_709_normalized(xyz, pixel, 0.75f);
243 _write_pixel(pixel, out + j, preview, j / 4, in[j + 3] * alpha);
244 }
245 break;
247 __OMP_PARALLEL_FOR_SIMD__(aligned(in, out: 64))
248 for(size_t j = 0; j < buffsize; j += 4)
249 {
250 const dt_aligned_pixel_t pixel = { in[j + 1], 0.0f, 0.0f, 0.0f };
251 _write_pixel(pixel, out + j, preview, j / 4, in[j + 3] * alpha);
252 }
253 break;
255 __OMP_PARALLEL_FOR_SIMD__(aligned(in, out: 64))
256 for(size_t j = 0; j < buffsize; j += 4)
257 {
258 const dt_aligned_pixel_t pixel = { 0.0f, in[j + 1], 0.0f, 0.0f };
259 _write_pixel(pixel, out + j, preview, j / 4, in[j + 3] * alpha);
260 }
261 break;
263 __OMP_PARALLEL_FOR_SIMD__(aligned(in, out: 64))
264 for(size_t j = 0; j < buffsize; j += 4)
265 {
266 const dt_aligned_pixel_t pixel = { 0.0f, 0.0f, in[j + 1], 0.0f };
267 _write_pixel(pixel, out + j, preview, j / 4, in[j + 3] * alpha);
268 }
269 break;
273 __OMP_PARALLEL_FOR_SIMD__(aligned(in, out: 64))
274 for(size_t j = 0; j < buffsize; j += 4)
275 {
276 const dt_aligned_pixel_t pixel = { 0.5f, 0.5f * (1.0f - in[j + 1]), 0.5f, 0.0f };
277 _write_pixel(pixel, out + j, preview, j / 4, in[j + 3] * alpha);
278 }
279 break;
281 __OMP_PARALLEL_FOR_SIMD__(aligned(in, out: 64))
282 for(size_t j = 0; j < buffsize; j += 4)
283 {
284 dt_aligned_pixel_t lch = { 65.0f, 37.0f, in[j + 1], 0.0f };
285 dt_aligned_pixel_t lab, xyz, pixel;
286 dt_LCH_2_Lab(lch, lab);
287 lab[3] = 0.0f;
288 dt_Lab_to_XYZ(lab, xyz);
289 _XYZ_to_REC_709_normalized(xyz, pixel, 0.75f);
290 _write_pixel(pixel, out + j, preview, j / 4, in[j + 3] * alpha);
291 }
292 break;
295 for(size_t j = 0; j < buffsize; j += 4)
296 {
297 dt_aligned_pixel_t hsl = { in[j + 1], 0.5f, 0.5f, 0.0f };
298 dt_aligned_pixel_t pixel;
299 dt_HSL_2_RGB(hsl, pixel);
300 _normalize_color(pixel, 0.75f);
301 _write_pixel(pixel, out + j, preview, j / 4, in[j + 3] * alpha);
302 }
303 break;
306 for(size_t j = 0; j < buffsize; j += 4)
307 {
308 const dt_aligned_pixel_t JzCzhz = { 0.011f, 0.01f, in[j + 1] };
311 dt_aligned_pixel_t pixel;
312 dt_JzCzhz_2_JzAzBz(JzCzhz, JzAzBz);
313 dt_JzAzBz_2_XYZ(JzAzBz, XYZ_D65);
314 dt_XYZ_to_Rec709_D65(XYZ_D65, pixel);
315 _normalize_color(pixel, 0.75f);
316 _write_pixel(pixel, out + j, preview, j / 4, in[j + 3] * alpha);
317 }
318 break;
323 default:
324 _channel_display_monochrome(in, out, buffsize, alpha, preview);
325 break;
326 }
327}
329static void _mask_display(const float *const restrict in, uint8_t *const restrict out, const size_t buffsize,
330 const float alpha, const dt_iop_gamma_mask_preview_t *const preview)
331{
332 // Loop over the displayed mask and preserve the image colors unless the global monochrome option is enabled.
333 __OMP_PARALLEL_FOR_SIMD__(aligned(in, out: 64))
334 for(size_t j = 0; j < buffsize; j += 4)
335 {
336 dt_aligned_pixel_t pixel = { in[j], in[j + 1], in[j + 2], 0.0f };
337 if(preview->black_and_white)
338 {
339 const float gray = 0.3f * in[j + 0] + 0.59f * in[j + 1] + 0.11f * in[j + 2];
340 pixel[0] = pixel[1] = pixel[2] = gray;
341 }
342 const float hide = 1.0f - fminf(fmaxf(in[j + 3] * alpha, 0.0f), 1.0f);
343 _write_pixel(pixel, out + j, preview, j / 4, hide);
344 }
345}
347static void _copy_output(const float *const restrict in, uint8_t *const restrict out, const size_t buffsize)
348{
349 __OMP_PARALLEL_FOR_SIMD__(aligned(in, out: 64))
350 for(size_t j = 0; j < buffsize; j += 4)
351 {
352 // the output of this module is BGR(A) instead of RGBA, so we can't use for_each_channel
353 for(size_t c = 0; c < 3; c++)
354 {
355 out[j + 2 - c] = (uint8_t)(fminf(roundf(255.0f * fmaxf(in[j + c], 0.0f)), 255.0f));
356 }
357 }
358}
359
360
361int 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)
362{
363 const dt_iop_roi_t *const roi_out = &piece->roi_out;
364 const dt_dev_pixelpipe_display_mask_t mask_display = pipe->mask_display;
365 const size_t buffsize = (size_t)roi_out->width * roi_out->height * 4;
366
368 {
369 _copy_output((const float *const restrict)i, (uint8_t *const restrict)o, buffsize);
370 return 0;
371 }
372
373 const float alpha = (mask_display & DT_DEV_PIXELPIPE_DISPLAY_MASK) ? 1.0f : 0.0f;
374 const size_t checker_1
375 = MAX((size_t)DT_PIXEL_APPLY_DPI(dt_conf_get_int("plugins/darkroom/colorbalancergb/checker/size")), 2);
376 const dt_iop_gamma_mask_preview_t preview = {
377 .checker_color_1 = {
378 CLAMP(dt_conf_get_float("plugins/darkroom/colorbalancergb/checker1/red"), 0.0f, 1.0f),
379 CLAMP(dt_conf_get_float("plugins/darkroom/colorbalancergb/checker1/green"), 0.0f, 1.0f),
380 CLAMP(dt_conf_get_float("plugins/darkroom/colorbalancergb/checker1/blue"), 0.0f, 1.0f),
381 0.0f
382 },
383 .checker_color_2 = {
384 CLAMP(dt_conf_get_float("plugins/darkroom/colorbalancergb/checker2/red"), 0.0f, 1.0f),
385 CLAMP(dt_conf_get_float("plugins/darkroom/colorbalancergb/checker2/green"), 0.0f, 1.0f),
386 CLAMP(dt_conf_get_float("plugins/darkroom/colorbalancergb/checker2/blue"), 0.0f, 1.0f),
387 0.0f
388 },
389 .checker_1 = checker_1,
390 .checker_2 = 2 * checker_1,
391 .width = roi_out->width,
392 .black_and_white
393 = dt_conf_get_bool("plugins/darkroom/colorbalancergb/mask_preview/greyscaled")
394 };
395
396 if((mask_display & DT_DEV_PIXELPIPE_DISPLAY_CHANNEL) && (mask_display & DT_DEV_PIXELPIPE_DISPLAY_ANY))
397 {
398 if(dt_conf_is_equal("channel_display", "false color"))
399 {
400 _channel_display_false_color((const float *const restrict)i, (uint8_t *const restrict)o, buffsize, alpha,
401 mask_display, &preview);
402 }
403 else
404 {
405 _channel_display_monochrome((const float *const restrict)i, (uint8_t *const restrict)o, buffsize, alpha,
406 &preview);
407 }
408 return 0;
409 }
410
411 if(mask_display & DT_DEV_PIXELPIPE_DISPLAY_MASK)
412 {
413 _mask_display((const float *const restrict)i, (uint8_t *const restrict)o, buffsize, 1.0f, &preview);
414 return 0;
415 }
416
417 _copy_output((const float *const restrict)i, (uint8_t *const restrict)o, buffsize);
418 return 0;
419}
420
421#ifdef HAVE_OPENCL
454
455int 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)
456{
457 const dt_iop_roi_t *const roi_out = &piece->roi_out;
459 const int devid = pipe->devid;
460 cl_int err = CL_SUCCESS;
461
462 const int width = roi_out->width;
463 const int height = roi_out->height;
464
465 size_t sizes[] = { ROUNDUPDWD(width, devid), ROUNDUPDHT(height, devid), 1 };
466
467 const dt_dev_pixelpipe_display_mask_t mask_display = pipe->mask_display;
468 const gboolean fcolor = dt_conf_is_equal("channel_display", "false color");
469 int mode = DT_IOP_GAMMA_KERNEL_COPY;
470 int channel = DT_IOP_GAMMA_FALSE_COLOR_MONO;
471 float alpha = (mask_display & DT_DEV_PIXELPIPE_DISPLAY_MASK) ? 1.0f : 0.0f;
472 const dt_aligned_pixel_t checker_color_1 = {
473 CLAMP(dt_conf_get_float("plugins/darkroom/colorbalancergb/checker1/red"), 0.0f, 1.0f),
474 CLAMP(dt_conf_get_float("plugins/darkroom/colorbalancergb/checker1/green"), 0.0f, 1.0f),
475 CLAMP(dt_conf_get_float("plugins/darkroom/colorbalancergb/checker1/blue"), 0.0f, 1.0f),
476 0.0f
477 };
478 const dt_aligned_pixel_t checker_color_2 = {
479 CLAMP(dt_conf_get_float("plugins/darkroom/colorbalancergb/checker2/red"), 0.0f, 1.0f),
480 CLAMP(dt_conf_get_float("plugins/darkroom/colorbalancergb/checker2/green"), 0.0f, 1.0f),
481 CLAMP(dt_conf_get_float("plugins/darkroom/colorbalancergb/checker2/blue"), 0.0f, 1.0f),
482 0.0f
483 };
484 const int checker_1
485 = MAX(DT_PIXEL_APPLY_DPI(dt_conf_get_int("plugins/darkroom/colorbalancergb/checker/size")), 2);
486 const int checker_2 = 2 * checker_1;
487 const int black_and_white
488 = dt_conf_get_bool("plugins/darkroom/colorbalancergb/mask_preview/greyscaled");
489
490 if((mask_display & DT_DEV_PIXELPIPE_DISPLAY_CHANNEL)
491 && (mask_display & DT_DEV_PIXELPIPE_DISPLAY_ANY))
492 {
493 if(fcolor)
494 {
496 channel = _false_color_channel_to_kernel_code(mask_display);
497 }
498 else
499 {
501 }
502 }
503 else if(mask_display & DT_DEV_PIXELPIPE_DISPLAY_MASK)
504 {
506 alpha = 1.0f;
507 }
508 dt_opencl_set_kernel_arg(devid, gd->kernel_gamma_pack, 0, sizeof(cl_mem), (void *)&dev_in);
509 dt_opencl_set_kernel_arg(devid, gd->kernel_gamma_pack, 1, sizeof(cl_mem), (void *)&dev_out);
510 dt_opencl_set_kernel_arg(devid, gd->kernel_gamma_pack, 2, sizeof(int), (void *)&width);
511 dt_opencl_set_kernel_arg(devid, gd->kernel_gamma_pack, 3, sizeof(int), (void *)&height);
512 dt_opencl_set_kernel_arg(devid, gd->kernel_gamma_pack, 4, sizeof(int), (void *)&mode);
513 dt_opencl_set_kernel_arg(devid, gd->kernel_gamma_pack, 5, sizeof(int), (void *)&channel);
514 dt_opencl_set_kernel_arg(devid, gd->kernel_gamma_pack, 6, sizeof(float), (void *)&alpha);
515 dt_opencl_set_kernel_arg(devid, gd->kernel_gamma_pack, 7, sizeof(checker_color_1), (void *)&checker_color_1);
516 dt_opencl_set_kernel_arg(devid, gd->kernel_gamma_pack, 8, sizeof(checker_color_2), (void *)&checker_color_2);
517 dt_opencl_set_kernel_arg(devid, gd->kernel_gamma_pack, 9, sizeof(int), (void *)&checker_1);
518 dt_opencl_set_kernel_arg(devid, gd->kernel_gamma_pack, 10, sizeof(int), (void *)&checker_2);
519 dt_opencl_set_kernel_arg(devid, gd->kernel_gamma_pack, 11, sizeof(int), (void *)&black_and_white);
520
521 err = dt_opencl_enqueue_kernel_2d(devid, gd->kernel_gamma_pack, sizes);
522 if(err == CL_SUCCESS) return TRUE;
523
524 dt_print(DT_DEBUG_OPENCL, "[opencl_gamma] couldn't enqueue kernel! %d\n", err);
525 return FALSE;
526}
527
529{
530 const int program = 2; // basic.cl, from programs.conf
532 if(!gd) return;
533 module->data = gd;
534 gd->kernel_gamma_pack = dt_opencl_create_kernel(program, "gamma_pack");
535}
536
543#endif
544
546{
547 // module->data = malloc(sizeof(dt_iop_gamma_data_t));
548 module->params = calloc(1, sizeof(dt_iop_gamma_params_t));
549 module->default_params = calloc(1, sizeof(dt_iop_gamma_params_t));
550 module->params_size = sizeof(dt_iop_gamma_params_t);
551 module->gui_data = NULL;
552 module->hide_enable_button = 1;
553 module->default_enabled = 1;
554}
555
557{
558 piece->data = NULL;
559 piece->data_size = 0;
560}
561
563{
564}
565
568{
569 // Only GUI pipes return 8 bits unsigned integer BGRA
571 piece->enabled = 1;
572 else
573 piece->enabled = 0;
574}
575
576// clang-format off
577// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
578// vim: shiftwidth=2 expandtab tabstop=2 cindent
579// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
580// clang-format on
#define TRUE
Definition ashift_lsd.c:162
#define FALSE
Definition ashift_lsd.c:158
int width
Definition bilateral.h:1
int height
Definition bilateral.h:1
dt_XYZ_to_Rec709_D50(XYZ, rgb)
dt_Lab_to_XYZ(Lab, XYZ)
static dt_aligned_pixel_t XYZ
static dt_aligned_pixel_t sRGB
static dt_aligned_pixel_t XYZ_D65
const dt_colormatrix_t dt_aligned_pixel_t out
static dt_aligned_pixel_t JzAzBz
typedef void((*dt_cache_allocate_t)(void *userdata, dt_cache_entry_t *entry))
int dt_conf_get_bool(const char *name)
float dt_conf_get_float(const char *name)
int dt_conf_get_int(const char *name)
gboolean dt_conf_is_equal(const char *name, const char *value)
void dt_print(dt_debug_thread_t thread, const char *msg,...)
Definition darktable.c:1542
@ DT_DEBUG_OPENCL
Definition darktable.h:722
#define for_each_channel(_var,...)
Definition darktable.h:662
float dt_aligned_pixel_simd_t __attribute__((vector_size(16), aligned(16)))
Enable aggressive floating-point arithmetic optimizations, in denormals handling. Set through user pr...
Definition darktable.h:524
#define dt_free(ptr)
Definition darktable.h:456
#define DT_MODULE_INTROSPECTION(MODVER, PARAMSTYPE)
Definition darktable.h:151
#define __OMP_DECLARE_SIMD__(...)
Definition darktable.h:263
#define __DT_CLONE_TARGETS__
Definition darktable.h:367
#define __OMP_PARALLEL_FOR__(...)
Definition darktable.h:258
static const dt_aligned_pixel_simd_t value
Definition darktable.h:577
#define __OMP_PARALLEL_FOR_SIMD__(...)
Definition darktable.h:259
void dt_iop_params_t
Definition dev_history.h:41
dt_dev_pixelpipe_display_mask_t
Definition develop.h:116
@ DT_DEV_PIXELPIPE_DISPLAY_a
Definition develop.h:122
@ DT_DEV_PIXELPIPE_DISPLAY_OUTPUT
Definition develop.h:120
@ DT_DEV_PIXELPIPE_DISPLAY_G
Definition develop.h:125
@ DT_DEV_PIXELPIPE_DISPLAY_L
Definition develop.h:121
@ DT_DEV_PIXELPIPE_DISPLAY_CHANNEL
Definition develop.h:119
@ DT_DEV_PIXELPIPE_DISPLAY_ANY
Definition develop.h:138
@ DT_DEV_PIXELPIPE_DISPLAY_LCH_h
Definition develop.h:129
@ DT_DEV_PIXELPIPE_DISPLAY_JzCzhz_hz
Definition develop.h:135
@ DT_DEV_PIXELPIPE_DISPLAY_HSL_H
Definition develop.h:130
@ DT_DEV_PIXELPIPE_DISPLAY_HSL_S
Definition develop.h:131
@ DT_DEV_PIXELPIPE_DISPLAY_JzCzhz_Cz
Definition develop.h:134
@ DT_DEV_PIXELPIPE_DISPLAY_LCH_C
Definition develop.h:128
@ DT_DEV_PIXELPIPE_DISPLAY_b
Definition develop.h:123
@ DT_DEV_PIXELPIPE_DISPLAY_MASK
Definition develop.h:118
@ DT_DEV_PIXELPIPE_DISPLAY_JzCzhz_Jz
Definition develop.h:133
@ DT_DEV_PIXELPIPE_DISPLAY_HSL_l
Definition develop.h:132
@ DT_DEV_PIXELPIPE_DISPLAY_GRAY
Definition develop.h:127
@ DT_DEV_PIXELPIPE_DISPLAY_B
Definition develop.h:126
@ DT_DEV_PIXELPIPE_DISPLAY_R
Definition develop.h:124
void default_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 format.c:57
@ TYPE_FLOAT
Definition format.h:46
@ TYPE_UINT8
Definition format.h:48
void init(dt_iop_module_t *module)
Definition gamma.c:545
static __DT_CLONE_TARGETS__ void _channel_display_monochrome(const float *const restrict in, uint8_t *const restrict out, const size_t buffsize, const float alpha, const dt_iop_gamma_mask_preview_t *const preview)
Definition gamma.c:199
int default_group()
Definition gamma.c:104
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 gamma.c:361
static int _false_color_channel_to_kernel_code(const dt_dev_pixelpipe_display_mask_t mask_display)
Definition gamma.c:422
static __DT_CLONE_TARGETS__ void _channel_display_false_color(const float *const restrict in, uint8_t *const restrict out, const size_t buffsize, const float alpha, dt_dev_pixelpipe_display_mask_t channel, const dt_iop_gamma_mask_preview_t *const preview)
Definition gamma.c:212
static void _write_pixel(const float *const restrict in, uint8_t *const restrict out, const dt_iop_gamma_mask_preview_t *const preview, const size_t pixel_index, const float alpha)
Blend one linear RGB pixel with its mask checker and encode it for display.
Definition gamma.c:156
static __DT_CLONE_TARGETS__ void _copy_output(const float *const restrict in, uint8_t *const restrict out, const size_t buffsize)
Definition gamma.c:347
dt_iop_gamma_kernel_mode_t
Definition gamma.c:77
@ DT_IOP_GAMMA_KERNEL_MASK
Definition gamma.c:79
@ DT_IOP_GAMMA_KERNEL_CHANNEL_FALSE_COLOR
Definition gamma.c:81
@ DT_IOP_GAMMA_KERNEL_COPY
Definition gamma.c:78
@ DT_IOP_GAMMA_KERNEL_CHANNEL_MONO
Definition gamma.c:80
void init_pipe(struct dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
Definition gamma.c:556
const char * name()
Definition gamma.c:99
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 gamma.c:127
dt_iop_gamma_false_color_t
Definition gamma.c:85
@ DT_IOP_GAMMA_FALSE_COLOR_MONO
Definition gamma.c:86
@ DT_IOP_GAMMA_FALSE_COLOR_G
Definition gamma.c:90
@ DT_IOP_GAMMA_FALSE_COLOR_C
Definition gamma.c:92
@ DT_IOP_GAMMA_FALSE_COLOR_A
Definition gamma.c:87
@ DT_IOP_GAMMA_FALSE_COLOR_R
Definition gamma.c:89
@ DT_IOP_GAMMA_FALSE_COLOR_B_CH
Definition gamma.c:91
@ DT_IOP_GAMMA_FALSE_COLOR_LCH_H
Definition gamma.c:93
@ DT_IOP_GAMMA_FALSE_COLOR_JZ_HZ
Definition gamma.c:95
@ DT_IOP_GAMMA_FALSE_COLOR_HSL_H
Definition gamma.c:94
@ DT_IOP_GAMMA_FALSE_COLOR_B
Definition gamma.c:88
void cleanup_global(dt_iop_module_so_t *module)
Definition gamma.c:537
int default_colorspace(dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece)
Definition gamma.c:114
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 gamma.c:119
int flags()
Definition gamma.c:109
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 gamma.c:566
void cleanup_pipe(struct dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
Definition gamma.c:562
void init_global(dt_iop_module_so_t *module)
Definition gamma.c:528
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 gamma.c:455
static __DT_CLONE_TARGETS__ void _mask_display(const float *const restrict in, uint8_t *const restrict out, const size_t buffsize, const float alpha, const dt_iop_gamma_mask_preview_t *const preview)
Definition gamma.c:329
#define DT_PIXEL_APPLY_DPI(value)
Definition gtk.h:90
@ IOP_FLAGS_HIDDEN
Definition imageop.h:170
@ IOP_FLAGS_UNSAFE_COPY
Definition imageop.h:177
@ IOP_FLAGS_ONE_INSTANCE
Definition imageop.h:172
@ IOP_FLAGS_NO_HISTORY_STACK
Definition imageop.h:174
@ IOP_CS_RGB_DISPLAY
Definition imageop.h:210
@ IOP_GROUP_TECHNICAL
Definition imageop.h:143
static const float x
@ linear
Definition lightroom.c:368
float dt_aligned_pixel_t[4]
int dt_opencl_enqueue_kernel_2d(const int dev, const int kernel, const size_t *sizes)
Definition opencl.c:2136
int dt_opencl_create_kernel(const int prog, const char *name)
Definition opencl.c:2030
void dt_opencl_free_kernel(const int kernel)
Definition opencl.c:2073
int dt_opencl_set_kernel_arg(const int dev, const int kernel, const int num, const size_t size, const void *arg)
Definition opencl.c:2127
#define ROUNDUPDHT(a, b)
Definition opencl.h:82
#define ROUNDUPDWD(a, b)
Definition opencl.h:81
const float factor
Definition pdf.h:90
@ DT_DEV_PIXELPIPE_PREVIEW
Definition pixelpipe.h:40
@ DT_DEV_PIXELPIPE_FULL
Definition pixelpipe.h:39
struct dt_iop_module_t *void * data
dt_dev_pixelpipe_type_t type
unsigned int channels
Definition format.h:54
dt_iop_buffer_type_t datatype
Definition format.h:56
Shared appearance of mask previews rendered by the display encoding module.
Definition gamma.c:143
dt_aligned_pixel_t checker_color_2
Definition gamma.c:145
dt_aligned_pixel_t checker_color_1
Definition gamma.c:144
This module converts float32 RGBA pixels to uint8 BGRA pixels, for GUI pipelines only (darkroom main ...
Definition gamma.c:66
dt_iop_global_data_t * data
Definition imageop.h:233
dt_iop_global_data_t * global_data
Definition imageop.h:314
Region of interest passed through the pixelpipe.
Definition imageop.h:72
#define MAX(a, b)
Definition thinplate.c:29