Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
pixelpipe_gui.c
Go to the documentation of this file.
1/*
2 This file is part of the Ansel project.
3 Copyright (C) 2009-2022 darktable developers.
4 Copyright (C) 2026 Aurélien PIERRE.
5
6 Ansel is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 Ansel is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with Ansel. If not, see <http://www.gnu.org/licenses/>.
18*/
19
77#include "common/color_picker.h"
78#include "common/darktable.h"
79#include "common/histogram.h"
80#include "common/iop_order.h"
81#include "control/signal.h"
82#include "develop/blend.h"
83#include "develop/pixelpipe.h"
86#include "libs/colorpicker.h"
87
88#include <math.h>
89#include <string.h>
90
109
117static void histogram_collect(dt_dev_pixelpipe_iop_t *piece, const void *pixel, const dt_iop_roi_t roi,
118 uint32_t **histogram, uint32_t *histogram_max)
119{
121 dt_histogram_roi_t histogram_roi;
122
123 // If the current module did not specify its own ROI, use the full ROI.
124 if(histogram_params.roi == NULL)
125 {
126 histogram_roi = (dt_histogram_roi_t){
127 .width = roi.width, .height = roi.height, .crop_x = 0, .crop_y = 0, .crop_width = 0, .crop_height = 0
128 };
129
130 histogram_params.roi = &histogram_roi;
131 }
132
133 const dt_iop_colorspace_type_t cst = piece->module->input_colorspace(piece->module, piece->pipe, piece);
134
135 dt_histogram_helper(&histogram_params, &piece->histogram_stats, cst, piece->module->histogram_cst, pixel, histogram,
136 piece->module->histogram_middle_grey, dt_ioppr_get_pipe_work_profile_info(piece->pipe));
137 dt_histogram_max_helper(&piece->histogram_stats, cst, piece->module->histogram_cst, histogram, histogram_max);
138}
139
150static dt_backbuf_t *_get_backuf(dt_develop_t *dev, const char *op)
151{
152 if(!strcmp(op, "demosaic"))
153 return &dev->raw_histogram;
154 else if(!strcmp(op, "colorout"))
155 return &dev->output_histogram;
156 else if(!strcmp(op, "gamma"))
157 return &dev->display_histogram;
158 else
159 return NULL;
160}
161
163 dt_iop_module_t *module, const uint64_t hash);
164
165static inline gboolean _pipe_tracks_gui_observables(const dt_dev_pixelpipe_t *pipe, const dt_develop_t *dev)
166{
167 return pipe && dev && dev->gui_attached && pipe->gui_observable_source;
168}
169
170static inline gboolean _module_requests_color_picker(const dt_develop_t *dev, const dt_iop_module_t *module)
171{
172 return dev && module && dev->gui_module && darktable.lib->proxy.colorpicker.picker_proxy
173 && module == dev->gui_module && dev->gui_module->enabled
174 && dev->gui_module->request_color_pick != DT_REQUEST_COLORPICK_OFF;
175}
176
177static inline gboolean _module_requests_input_histogram(const dt_develop_t *dev,
178 const dt_dev_pixelpipe_iop_t *piece)
179{
180 return dev && piece && (piece->request_histogram & DT_REQUEST_ON)
182}
183
185 const dt_develop_t *dev,
186 const dt_iop_module_t *module,
187 const dt_dev_pixelpipe_iop_t *piece)
188{
189 return _pipe_tracks_gui_observables(pipe, dev)
190 && (_module_requests_color_picker(dev, module)
191 || _module_requests_input_histogram(dev, piece));
192}
193
195 const dt_develop_t *dev,
196 const dt_iop_module_t *module)
197{
199 && module && _get_backuf((dt_develop_t *)dev, module->op) && strcmp(module->op, "gamma") != 0;
200}
201
203 const dt_develop_t *dev,
204 const dt_iop_module_t *module)
205{
207 && module && !strcmp(module->op, "gamma");
208}
209
211{
212 if(!_pipe_tracks_gui_observables(pipe, dev) || !pipe->nodes) return FALSE;
213
214 for(GList *pieces = g_list_first(pipe->nodes); pieces; pieces = g_list_next(pieces))
215 {
217 if(piece && piece->enabled
218 && _module_needs_gui_host_input_sampling(pipe, dev, piece->module, piece))
219 return TRUE;
220 }
221
222 return FALSE;
223}
224
237 const dt_develop_t *dev,
238 const dt_iop_module_t *module)
239{
240 return _pipe_tracks_gui_observables(pipe, dev)
241 && module
242 && dev
243 && dev->gui_module
244 && darktable.lib->proxy.colorpicker.picker_proxy
245 && dev->gui_module->enabled
246 && dev->gui_module->request_color_pick != DT_REQUEST_COLORPICK_OFF
247 && module != dev->gui_module
248 && module->iop_order > dev->gui_module->iop_order;
249}
250
253 dt_pixel_cache_entry_t *output_entry,
254 const dt_iop_roi_t roi_out, const uint64_t hash)
255{
256 if(!_module_needs_gui_output_backbuf_sync(pipe, dev, module) || !output_entry) return;
257 pixelpipe_get_histogram_backbuf(dev, roi_out, output_entry, piece->module, hash);
258}
259
270 dt_iop_module_t *module, const uint64_t hash)
271{
272 dt_backbuf_t *backbuf = _get_backuf(dev, module->op);
273 if(backbuf == NULL) return; // This module is not wired to global histograms.
274 if(dt_dev_backbuf_get_hash(backbuf) == hash) return; // Hash didn't change, nothing to update.
275
276 // Hash has changed, our previous stored entry is obsolete: decrement its refcount.
277 dt_pixel_cache_entry_t *previous_entry;
279 &previous_entry))
281
282 // Update metadata. The global histogram backbuf stores its bpp; infer it from cache entry size.
283 const size_t entry_size = dt_pixel_cache_entry_get_size(entry);
284 const int bpp = (roi.width > 0 && roi.height > 0) ? (int)(entry_size / ((size_t)roi.width * (size_t)roi.height)) : 0;
285 dt_dev_set_backbuf(backbuf, roi.width, roi.height, bpp, hash, -1);
286
287 // Increment the refcount on current entry so nobody removes it while the GUI still needs it.
289}
290
300static int pixelpipe_picker_helper(dt_iop_module_t *module, const dt_iop_roi_t roi, dt_aligned_pixel_t picked_color,
301 dt_aligned_pixel_t picked_color_min, dt_aligned_pixel_t picked_color_max,
302 dt_pixelpipe_picker_source_t picker_source, int *box)
303{
304 const int width = roi.width;
305 const int height = roi.height;
307
308 dt_boundingbox_t fbox = { 0.0f };
309
310 // Get absolute pixel coordinates in final preview image.
311 if(sample->size == DT_LIB_COLORPICKER_SIZE_BOX)
312 {
313 memcpy(fbox, sample->box, sizeof(float) * 4);
315 }
316 else if(sample->size == DT_LIB_COLORPICKER_SIZE_POINT)
317 {
318 fbox[0] = sample->point[0];
319 fbox[1] = sample->point[1];
321 fbox[2] = fbox[0];
322 fbox[3] = fbox[1];
323 }
324
325 // Transform back to current module coordinates.
329 fbox, 2);
330
331 fbox[0] -= roi.x;
332 fbox[1] -= roi.y;
333 fbox[2] -= roi.x;
334 fbox[3] -= roi.y;
335
336 // Re-order edges of bounding box.
337 box[0] = fminf(fbox[0], fbox[2]);
338 box[1] = fminf(fbox[1], fbox[3]);
339 box[2] = fmaxf(fbox[0], fbox[2]);
340 box[3] = fmaxf(fbox[1], fbox[3]);
341
343 {
344 // If we are sampling one point, make sure that we actually sample it.
345 for(int k = 2; k < 4; k++) box[k] += 1;
346 }
347
348 // Do not continue if box is completely outside of roi.
349 if(box[0] >= width || box[1] >= height || box[2] < 0 || box[3] < 0) return 1;
350
351 // Clamp bounding box to roi.
352 for(int k = 0; k < 4; k += 2) box[k] = MIN(width - 1, MAX(0, box[k]));
353 for(int k = 1; k < 4; k += 2) box[k] = MIN(height - 1, MAX(0, box[k]));
354
355 // Safety check: area needs to have minimum 1 pixel width and height.
356 if(box[2] <= box[0] || box[3] <= box[1]) return 1;
357
358 // If module isn't the one where pickers are assigned, reset the values and don't sample.
359 if(module != darktable.develop->gui_module)
360 {
361 for(int k = 0; k < 4; k++)
362 {
363 picked_color_min[k] = INFINITY;
364 picked_color_max[k] = -INFINITY;
365 picked_color[k] = 0.0f;
366 }
367 return 1;
368 }
369
370 return 0;
371}
372
381 const float *pixel, const dt_iop_roi_t roi, float *picked_color,
382 float *picked_color_min, float *picked_color_max,
383 const dt_iop_colorspace_type_t image_cst, dt_pixelpipe_picker_source_t picker_source)
384{
385 int box[4];
386 if(pixelpipe_picker_helper(module, roi, picked_color, picked_color_min, picked_color_max, picker_source, box))
387 return;
388
389 dt_aligned_pixel_t avg = { 0.0f };
390 dt_aligned_pixel_t min = { 0.0f };
391 dt_aligned_pixel_t max = { 0.0f };
392
394
395 dt_color_picker_helper(dsc, pixel, &roi, box, avg, min, max, image_cst,
396 dt_iop_color_picker_get_active_cst(module), profile);
397
398 for(int k = 0; k < 4; k++)
399 {
400 picked_color_min[k] = min[k];
401 picked_color_max[k] = max[k];
402 picked_color[k] = avg[k];
403 }
404}
405
415{
417
418 switch(picker_cst)
419 {
420 case IOP_CS_LAB:
421 case IOP_CS_RGB:
422 case IOP_CS_HSL:
423 case IOP_CS_JZCZHZ:
424 return IOP_CS_RGB;
425 case IOP_CS_NONE:
426 // IOP_CS_NONE is used by temperature.c as it may work in RAW or RGB: return the pipe colorspace to avoid
427 // extra conversions.
428 return cst;
429 default:
430 return picker_cst;
431 }
432}
433
446 float *input, const dt_iop_roi_t roi_in,
447 dt_iop_buffer_dsc_t *input_format,
449{
450 // Histogram collection for module.
452 && (piece->request_histogram & DT_REQUEST_ON))
453 {
454 const dt_iop_order_iccprofile_info_t *const work_profile
455 = (input_format->cst != IOP_CS_RAW) ? dt_ioppr_get_pipe_work_profile_info(pipe) : NULL;
456
457 // Transform to module input colorspace.
458 dt_ioppr_transform_image_colorspace(module, input, input, roi_in.width, roi_in.height, input_format->cst,
459 module->input_colorspace(module, pipe, piece), &input_format->cst,
460 work_profile);
461
462 histogram_collect(piece, input, roi_in, &(piece->histogram), piece->histogram_max);
463
464 if(piece->histogram && (module->request_histogram & DT_REQUEST_ON))
465 {
466 const size_t buf_size = 4 * piece->histogram_stats.bins_count * sizeof(uint32_t);
467 module->histogram = realloc(module->histogram, buf_size);
468 memcpy(module->histogram, piece->histogram, buf_size);
469 module->histogram_stats = piece->histogram_stats;
470 memcpy(module->histogram_max, piece->histogram_max, sizeof(piece->histogram_max));
471 if(module->widget) dt_control_queue_redraw_widget(module->widget);
472 }
473 }
474}
475
483static void _sample_color_picker(dt_dev_pixelpipe_t *pipe, dt_develop_t *dev, float *input,
484 dt_iop_buffer_dsc_t *input_format, const dt_iop_roi_t roi_in, void **output,
485 dt_iop_buffer_dsc_t **out_format, const dt_iop_roi_t roi_out,
487{
489 && module == dev->gui_module
490 && dev->gui_module->enabled
492 return;
493
494 const dt_iop_order_iccprofile_info_t *const work_profile
495 = (input_format->cst != IOP_CS_RAW) ? dt_ioppr_get_pipe_work_profile_info(pipe) : NULL;
496
497 // Ensure we are using the right colorspace for picker values.
498 dt_iop_colorspace_type_t picker_cst = _transform_for_picker(module, pipe->dsc.cst);
499 dt_ioppr_transform_image_colorspace(module, input, input, roi_in.width, roi_in.height,
500 input_format->cst, picker_cst, &input_format->cst,
501 work_profile);
502 dt_ioppr_transform_image_colorspace(module, *output, *output, roi_out.width, roi_out.height,
503 pipe->dsc.cst, picker_cst, &pipe->dsc.cst,
504 work_profile);
505
506 pixelpipe_picker(module, piece, &piece->dsc_in, (float *)input, roi_in, module->picked_color,
507 module->picked_color_min, module->picked_color_max, input_format->cst, PIXELPIPE_PICKER_INPUT);
508 pixelpipe_picker(module, piece, &pipe->dsc, (float *)(*output), roi_out, module->picked_output_color,
511
513}
514
528static void _sample_gui(dt_dev_pixelpipe_t *pipe, dt_develop_t *dev, void *input, void **output,
529 const dt_iop_roi_t roi_in, const dt_iop_roi_t roi_out, dt_iop_buffer_dsc_t *input_format,
531 const uint64_t input_hash, const uint64_t hash, const size_t in_bpp, const size_t bpp,
532 dt_pixel_cache_entry_t *const input_entry, dt_pixel_cache_entry_t *const output_entry)
533{
534 (void)in_bpp;
535 (void)bpp;
536
537 if(!_pipe_tracks_gui_observables(pipe, dev))
538 return;
539
542
543 // Need to go first because we want module output RGB without color conversion.
544 // Gamma outputs uint8_t so we take its input. We want float32.
545 dt_iop_roi_t roi;
547 int64_t buf_hash;
548
549 if(strcmp(module->op, "gamma") == 0)
550 {
551 roi = roi_in;
552 entry = input_entry;
553 buf_hash = input_hash;
554 }
555 else
556 {
557 roi = roi_out;
558 entry = output_entry;
559 buf_hash = hash;
560 }
561
562 // Copy the cache entry reference to global histogram cache, except in
563 // realtime mode where we intentionally skip global histogram sampling.
565 pixelpipe_get_histogram_backbuf(dev, roi, entry, piece->module, buf_hash);
566
567 // Sample internal histogram on input and color pickers.
568 collect_histogram_on_CPU(pipe, dev, (float *)input, roi_in, input_format, module, piece);
569 _sample_color_picker(pipe, dev, (float *)input, input_format, roi_in, output, output_format, roi_out, module, piece);
570
573}
574
589{
590 if(dt_dev_pixelpipe_get_realtime(pipe)) return 1;
591 if(!_pipe_tracks_gui_observables(pipe, dev)) return 1;
592
593 GList *pieces = g_list_first(pipe->nodes);
594 int64_t input_hash = -1;
595
596 while(pieces)
597 {
599 if(piece->enabled)
600 {
601 int64_t hash = piece->global_hash;
602
603 if(_get_backuf(dev, piece->module->op))
604 {
605 // Gamma outputs uint8_t so we take its input. We want float32.
606 dt_iop_roi_t roi;
608 int64_t buf_hash;
609
610 if(strcmp(piece->module->op, "gamma") == 0)
611 {
612 roi = piece->planned_roi_in;
613 buf_hash = input_hash;
614 }
615 else
616 {
617 roi = piece->planned_roi_out;
618 buf_hash = hash;
619 }
620
621 if(!dt_dev_pixelpipe_cache_peek(darktable.pixelpipe_cache, buf_hash, NULL, NULL, &entry))
622 return 0;
623
624 pixelpipe_get_histogram_backbuf(dev, roi, entry, piece->module, buf_hash);
625 }
626
627 input_hash = hash;
628 }
629
630 pieces = g_list_next(pieces);
631 }
632
633 return 1;
634}
635
636// clang-format off
637// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
638// vim: shiftwidth=2 expandtab tabstop=2 cindent
639// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
640// 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_iop_colorspace_type_t
Definition color_conversion.h:30
@ IOP_CS_RAW
Definition color_conversion.h:32
@ IOP_CS_JZCZHZ
Definition color_conversion.h:37
@ IOP_CS_RGB
Definition color_conversion.h:34
@ IOP_CS_HSL
Definition color_conversion.h:36
@ IOP_CS_LAB
Definition color_conversion.h:33
@ IOP_CS_NONE
Definition color_conversion.h:31
void dt_color_picker_helper(const dt_iop_buffer_dsc_t *dsc, const float *const pixel, const dt_iop_roi_t *roi, const int *const box, dt_aligned_pixel_t picked_color, dt_aligned_pixel_t picked_color_min, dt_aligned_pixel_t picked_color_max, const dt_iop_colorspace_type_t image_cst, const dt_iop_colorspace_type_t picker_cst, const dt_iop_order_iccprofile_info_t *const profile)
Definition color_picker.c:616
dt_iop_colorspace_type_t dt_iop_color_picker_get_active_cst(dt_iop_module_t *module)
Definition color_picker_proxy.c:258
@ DT_LIB_COLORPICKER_SIZE_POINT
Definition colorpicker.h:37
@ DT_LIB_COLORPICKER_SIZE_BOX
Definition colorpicker.h:38
static const float const float const float min
Definition colorspaces_inline_conversions.h:667
const float max
Definition colorspaces_inline_conversions.h:721
typedef void((*dt_cache_allocate_t)(void *userdata, dt_cache_entry_t *entry))
void dt_histogram_max_helper(const dt_dev_histogram_stats_t *const histogram_stats, const dt_iop_colorspace_type_t cst, const dt_iop_colorspace_type_t cst_to, uint32_t **histogram, uint32_t *histogram_max)
Definition common/histogram.c:403
void dt_histogram_helper(dt_dev_histogram_collection_params_t *histogram_params, dt_dev_histogram_stats_t *histogram_stats, const dt_iop_colorspace_type_t cst, const dt_iop_colorspace_type_t cst_to, const void *pixel, uint32_t **histogram, const int compensate_middle_grey, const dt_iop_order_iccprofile_info_t *const profile_info)
Definition common/histogram.c:372
void dt_control_queue_redraw_widget(GtkWidget *widget)
threadsafe request of redraw of specific widget. Use this function if you need to redraw a specific w...
Definition control.c:656
darktable_t darktable
Definition darktable.c:178
float dt_boundingbox_t[4]
Definition darktable.h:630
int dt_dev_distort_backtransform_plus(dt_develop_t *dev, dt_dev_pixelpipe_t *pipe, const double iop_order, const int transf_direction, float *points, size_t points_count)
Definition develop.c:1366
void dt_dev_coordinates_image_norm_to_preview_abs(dt_develop_t *dev, float *points, size_t num_points)
Definition develop.c:934
void dt_dev_set_backbuf(dt_backbuf_t *backbuf, const int width, const int height, const size_t bpp, const int64_t hash, const int64_t history_hash)
Definition develop.c:1629
@ DT_DEV_TRANSFORM_DIR_FORW_INCL
Definition develop.h:99
@ DT_DEV_TRANSFORM_DIR_FORW_EXCL
Definition develop.h:100
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:119
int bpp
Definition imageio/format/pdf.c:88
@ DT_REQUEST_COLORPICK_OFF
Definition imageop.h:172
void dt_ioppr_transform_image_colorspace(struct dt_iop_module_t *self, const float *const image_in, float *const image_out, const int width, const int height, const int cst_from, const int cst_to, int *converted_cst, const dt_iop_order_iccprofile_info_t *const profile_info)
Definition iop_profile.c:1042
dt_iop_order_iccprofile_info_t * dt_ioppr_get_pipe_work_profile_info(struct dt_dev_pixelpipe_t *pipe)
Definition iop_profile.c:913
@ DT_REQUEST_ON
Definition pixelpipe.h:48
@ DT_REQUEST_ONLY_IN_GUI
Definition pixelpipe.h:49
void dt_dev_pixelpipe_cache_ref_count_entry(dt_dev_pixelpipe_cache_t *cache, const uint64_t hash, gboolean lock, dt_pixel_cache_entry_t *cache_entry)
Increase/Decrease the reference count on the cache line as to prevent LRU item removal....
Definition pixelpipe_cache.c:1473
gboolean dt_dev_pixelpipe_cache_peek(dt_dev_pixelpipe_cache_t *cache, const uint64_t hash, void **data, dt_iop_buffer_dsc_t **dsc, dt_pixel_cache_entry_t **entry)
Non-owning lookup of an existing cache line.
Definition pixelpipe_cache.c:1331
void dt_dev_pixelpipe_cache_rdlock_entry(dt_dev_pixelpipe_cache_t *cache, const uint64_t hash, gboolean lock, dt_pixel_cache_entry_t *cache_entry)
Lock or release the read lock on the entry.
Definition pixelpipe_cache.c:1501
size_t dt_pixel_cache_entry_get_size(dt_pixel_cache_entry_t *entry)
Peek the size (in bytes) reserved for the host buffer of a cache entry.
Definition pixelpipe_cache.c:925
Pixelpipe cache for storing intermediate results in the pixelpipe.
#define DT_PIXELPIPE_CACHE_HASH_INVALID
Definition pixelpipe_cache.h:41
static void _sample_gui(dt_dev_pixelpipe_t *pipe, dt_develop_t *dev, void *input, void **output, const dt_iop_roi_t roi_in, const dt_iop_roi_t roi_out, dt_iop_buffer_dsc_t *input_format, dt_iop_buffer_dsc_t **output_format, dt_iop_module_t *module, dt_dev_pixelpipe_iop_t *piece, const uint64_t input_hash, const uint64_t hash, const size_t in_bpp, const size_t bpp, dt_pixel_cache_entry_t *const input_entry, dt_pixel_cache_entry_t *const output_entry)
Sample all GUI observables for a processed module node.
Definition pixelpipe_gui.c:528
static int pixelpipe_picker_helper(dt_iop_module_t *module, const dt_iop_roi_t roi, dt_aligned_pixel_t picked_color, dt_aligned_pixel_t picked_color_min, dt_aligned_pixel_t picked_color_max, dt_pixelpipe_picker_source_t picker_source, int *box)
Compute the sampling box in module coordinates for the interactive color picker.
Definition pixelpipe_gui.c:300
static dt_iop_colorspace_type_t _transform_for_picker(dt_iop_module_t *self, const dt_iop_colorspace_type_t cst)
Select a safe colorspace for picker sampling.
Definition pixelpipe_gui.c:414
static void pixelpipe_picker(dt_iop_module_t *module, dt_dev_pixelpipe_iop_t *piece, dt_iop_buffer_dsc_t *dsc, const float *pixel, const dt_iop_roi_t roi, float *picked_color, float *picked_color_min, float *picked_color_max, const dt_iop_colorspace_type_t image_cst, dt_pixelpipe_picker_source_t picker_source)
Sample the color picker values (avg/min/max) from a pixel buffer.
Definition pixelpipe_gui.c:380
static gboolean _module_requests_input_histogram(const dt_develop_t *dev, const dt_dev_pixelpipe_iop_t *piece)
Definition pixelpipe_gui.c:177
static gboolean _module_exact_hit_must_recurse_for_picker(const dt_dev_pixelpipe_t *pipe, const dt_develop_t *dev, const dt_iop_module_t *module)
Tell whether an exact cache hit must still recurse to reach the active color picker module.
Definition pixelpipe_gui.c:236
dt_pixelpipe_picker_source_t
Identify whether the picker sampling is applied on the module input or output.
Definition pixelpipe_gui.c:105
@ PIXELPIPE_PICKER_INPUT
Definition pixelpipe_gui.c:106
@ PIXELPIPE_PICKER_OUTPUT
Definition pixelpipe_gui.c:107
static gboolean _pipe_needs_gui_sampling_traversal(const dt_dev_pixelpipe_t *pipe, const dt_develop_t *dev)
Definition pixelpipe_gui.c:210
static gboolean _resync_global_histograms(dt_dev_pixelpipe_t *pipe, dt_develop_t *dev)
Re-sync the global histogram cache references on a pure cache hit.
Definition pixelpipe_gui.c:588
static gboolean _module_needs_gui_output_backbuf_sync(const dt_dev_pixelpipe_t *pipe, const dt_develop_t *dev, const dt_iop_module_t *module)
Definition pixelpipe_gui.c:194
static gboolean _pipe_tracks_gui_observables(const dt_dev_pixelpipe_t *pipe, const dt_develop_t *dev)
Definition pixelpipe_gui.c:165
static void collect_histogram_on_CPU(dt_dev_pixelpipe_t *pipe, dt_develop_t *dev, float *input, const dt_iop_roi_t roi_in, dt_iop_buffer_dsc_t *input_format, dt_iop_module_t *module, dt_dev_pixelpipe_iop_t *piece)
Collect the per-module histogram on CPU for GUI display.
Definition pixelpipe_gui.c:445
static dt_backbuf_t * _get_backuf(dt_develop_t *dev, const char *op)
Map an op name to the corresponding global histogram backbuffer.
Definition pixelpipe_gui.c:150
static gboolean _module_needs_gui_host_input_sampling(const dt_dev_pixelpipe_t *pipe, const dt_develop_t *dev, const dt_iop_module_t *module, const dt_dev_pixelpipe_iop_t *piece)
Definition pixelpipe_gui.c:184
static void pixelpipe_get_histogram_backbuf(dt_develop_t *dev, const dt_iop_roi_t roi, dt_pixel_cache_entry_t *entry, dt_iop_module_t *module, const uint64_t hash)
Update the global histogram backbuffer to reference a specific cache entry.
Definition pixelpipe_gui.c:269
static gboolean _module_requests_color_picker(const dt_develop_t *dev, const dt_iop_module_t *module)
Definition pixelpipe_gui.c:170
static void histogram_collect(dt_dev_pixelpipe_iop_t *piece, const void *pixel, const dt_iop_roi_t roi, uint32_t **histogram, uint32_t *histogram_max)
Compute a histogram for a given module piece.
Definition pixelpipe_gui.c:117
static void _sync_module_output_backbuf_on_exact_hit(dt_dev_pixelpipe_t *pipe, dt_develop_t *dev, dt_iop_module_t *module, dt_dev_pixelpipe_iop_t *piece, dt_pixel_cache_entry_t *output_entry, const dt_iop_roi_t roi_out, const uint64_t hash)
Definition pixelpipe_gui.c:251
static void _sample_color_picker(dt_dev_pixelpipe_t *pipe, dt_develop_t *dev, float *input, dt_iop_buffer_dsc_t *input_format, const dt_iop_roi_t roi_in, void **output, dt_iop_buffer_dsc_t **out_format, const dt_iop_roi_t roi_out, dt_iop_module_t *module, dt_dev_pixelpipe_iop_t *piece)
Sample the interactive color picker for the currently edited module.
Definition pixelpipe_gui.c:483
static gboolean _module_needs_gui_input_backbuf_sync(const dt_dev_pixelpipe_t *pipe, const dt_develop_t *dev, const dt_iop_module_t *module)
Definition pixelpipe_gui.c:202
gboolean dt_dev_pixelpipe_get_realtime(const dt_dev_pixelpipe_t *pipe)
Definition pixelpipe_hb.c:590
static uint64_t dt_dev_backbuf_get_hash(const dt_backbuf_t *backbuf)
Definition pixelpipe_hb.h:158
#define DT_DEBUG_CONTROL_SIGNAL_RAISE(ctlsig, signal,...)
Definition signal.h:317
@ DT_SIGNAL_CONTROL_PICKERDATA_READY
This signal is raised when new color picker data are available in the pixelpipe. 1 module 2 piece no ...
Definition signal.h:266
unsigned __int64 uint64_t
Definition strptime.c:74
struct dt_lib_t * lib
Definition darktable.h:698
struct dt_dev_pixelpipe_cache_t * pixelpipe_cache
Definition darktable.h:717
struct dt_control_signal_t * signals
Definition darktable.h:701
struct dt_develop_t * develop
Definition darktable.h:697
Definition pixelpipe_hb.h:150
Definition colorpicker.h:53
dt_lib_colorpicker_size_t size
Definition colorpicker.h:60
dt_boundingbox_t box
Definition colorpicker.h:59
float point[2]
Definition colorpicker.h:58
Definition pixelpipe.h:54
const struct dt_histogram_roi_t * roi
Definition pixelpipe.h:56
uint32_t bins_count
Definition pixelpipe.h:67
Definition pixelpipe_hb.h:58
gboolean enabled
Definition pixelpipe_hb.h:74
uint32_t histogram_max[4]
Definition pixelpipe_hb.h:80
dt_dev_request_flags_t request_histogram
Definition pixelpipe_hb.h:76
struct dt_iop_module_t *struct dt_dev_pixelpipe_t * pipe
Definition pixelpipe_hb.h:60
uint64_t global_hash
Definition pixelpipe_hb.h:90
dt_iop_buffer_dsc_t dsc_in
Definition pixelpipe_hb.h:104
uint32_t * histogram
Definition pixelpipe_hb.h:78
dt_dev_histogram_stats_t histogram_stats
Definition pixelpipe_hb.h:79
dt_iop_roi_t planned_roi_out
Definition pixelpipe_hb.h:99
dt_dev_histogram_collection_params_t histogram_params
Definition pixelpipe_hb.h:77
void * data
Definition pixelpipe_hb.h:61
dt_iop_roi_t planned_roi_in
Definition pixelpipe_hb.h:99
Definition pixelpipe_hb.h:179
gboolean gui_observable_source
Definition pixelpipe_hb.h:255
GList * nodes
Definition pixelpipe_hb.h:204
dt_iop_buffer_dsc_t dsc
Definition pixelpipe_hb.h:192
Definition develop.h:151
int32_t gui_attached
Definition develop.h:154
dt_backbuf_t display_histogram
Definition develop.h:299
dt_backbuf_t output_histogram
Definition develop.h:298
struct dt_iop_module_t * gui_module
Definition develop.h:157
struct dt_dev_pixelpipe_t * preview_pipe
Definition develop.h:227
dt_backbuf_t raw_histogram
Definition develop.h:297
Definition histogram.h:42
int width
Definition histogram.h:43
Definition develop/format.h:48
int cst
Definition develop/format.h:74
Definition imageop.h:217
dt_dev_request_colorpick_flags_t request_color_pick
Definition imageop.h:235
dt_aligned_pixel_t picked_output_color_min
Definition imageop.h:247
GtkWidget * widget
Definition imageop.h:303
GModule *dt_dev_operation_t op
Definition imageop.h:227
dt_dev_request_flags_t request_histogram
Definition imageop.h:237
int iop_order
Definition imageop.h:231
dt_aligned_pixel_t picked_output_color_max
Definition imageop.h:247
uint32_t histogram_max[4]
Definition imageop.h:253
dt_aligned_pixel_t picked_output_color
Definition imageop.h:247
gboolean enabled
Definition imageop.h:264
dt_aligned_pixel_t picked_color_min
Definition imageop.h:245
dt_aligned_pixel_t picked_color_max
Definition imageop.h:245
uint32_t * histogram
Definition imageop.h:249
dt_aligned_pixel_t picked_color
Definition imageop.h:245
Definition iop_profile.h:52
Definition imageop.h:67
int x
Definition imageop.h:68
int width
Definition imageop.h:68
int height
Definition imageop.h:68
int y
Definition imageop.h:68
struct dt_iop_color_picker_t * picker_proxy
Definition libs/lib.h:74
struct dt_lib_module_t *struct dt_colorpicker_sample_t * primary_sample
Definition libs/lib.h:73
struct dt_lib_t::@57 proxy
struct dt_lib_t::@57::@58 colorpicker
Definition pixelpipe_cache.h:78
#define MIN(a, b)
Definition thinplate.c:32
#define MAX(a, b)
Definition thinplate.c:29