42#define gbuf(BUF, A, B) ((BUF)[4 * (width * ((B)) + ((A))) + ch])
48 return (uint8_t)CLAMP(
i + 127, 0, 255);
58 const int step = 1 << l;
59 const int st = step / 2;
61 for(
int j = 0; j <
height; j++)
66 for(;
i <
width - st;
i += step)
73 for(
i = step;
i <
width - st;
i += step)
84 for(; j <
height - st; j += step)
91 for(j = step; j <
height - st; j += step)
104 int fx =
i / (float)wd * fcols;
105 int fy = j / (float)ht * frows;
106 int fi = fcols * fy +
fx;
118 f[fi].x2 += (float)
i *
i;
122 f[fi].y2 += (float)j * j;
137 int buffer_width,
int buffer_height)
140 const int wd = buffer_width;
141 const int ht = buffer_height;
142 const int fs = frows * fcols;
150#pragma omp parallel for default(shared)
152 for(
int j = 0; j < ht - 1; j += 4)
153 for(
int i = 0;
i < wd - 1;
i += 4)
162 int num_clusters = 0;
163 for(
int k = 0;
k < fs;
k++)
164 if(focus[
k].
n * 4 > wd * ht / (
float)fs * 0.01f) num_clusters++;
170#pragma omp parallel for default(shared)
172 for(
int j = 0; j < ht - 1; j += 8)
174 for(
int i = 0;
i < wd - 1;
i += 8)
183 for(
int k = 0;
k < fs;
k++)
185 if(focus[
k].
n * 6.0f > wd * ht / (
float)fs * 0.01f)
198#pragma omp parallel for default(shared)
200 for(
int j=1;j<ht-1;j++)
202 int index = 4*j*wd+4;
203 for(
int i=1;
i<wd-1;
i++)
205 int32_t diff = 4*buffer[index+1]
208 - buffer[index-4*wd+1]
209 - buffer[index+4*wd+1];
216 for(
int k = 0;
k < fs;
k++)
218 focus[
k].
thrs /= fabsf((
float)focus[
k].
n);
219 focus[
k].
x /= fabsf((
float)focus[
k].
n);
220 focus[
k].
x2 /= fabsf((
float)focus[
k].
n);
221 focus[
k].
y /= fabsf((
float)focus[
k].
n);
222 focus[
k].
y2 /= fabsf((
float)focus[
k].
n);
228 float full_zoom,
float full_x,
float full_y)
230 const int fs = frows * fcols;
239 int wd = buffer_width + image.
crop_x;
240 int ht = buffer_height + image.
crop_y;
243 float *pos = malloc(fs * 6 *
sizeof(
float));
244 float *offx = pos + fs * 2, *offy = pos + fs * 4;
246 for(
int k = 0;
k < fs;
k++)
248 const float stddevx = sqrtf(focus[
k].x2 - focus[
k].
x * focus[
k].
x);
249 const float stddevy = sqrtf(focus[
k].y2 - focus[
k].y * focus[
k].y);
252 const float x = focus[
k].
x + image.
crop_x;
253 const float y = focus[
k].
y + image.
crop_y;
257 offx[2 *
k + 0] =
x + stddevx;
260 offy[2 *
k + 1] = y + stddevy;
287 const float scale = fminf((
width - 2 * tb) / (
float)wd, (
height - 2 * tb) / (
float)ht) * full_zoom;
288 cairo_scale(cr, scale, scale);
294 fx = fminf((wd * scale -
width) / 2, fabsf(full_x));
295 if(full_x < 0)
fx = -
fx;
296 if(wd * scale <=
width)
fx = 0;
297 fy = fminf((ht * scale -
height) / 2, fabsf(full_y));
298 if(full_y < 0) fy = -fy;
299 if(ht * scale <=
height) fy = 0;
304 cairo_rectangle(cr, 0, 0, wd, ht);
308 const int ndash =
sizeof(dashes) /
sizeof(dashes[0]);
309 double offset = 0.0f;
310 cairo_set_dash(cr, dashes, ndash, offset);
313 for(
int k = 0;
k < fs;
k++)
316 const float col = fminf(1.0f, intens);
318 if(focus[
k].
n * 4.0f > buffer_width * buffer_height / (
float)fs * 0.01f)
320 else if(-focus[
k].
n * 6.0f > buffer_width * buffer_height / (
float)fs * 0.01f)
324 for(
int i = 0;
i < 2;
i++)
329 cairo_set_source_rgb(cr, .1f, .1f, col);
331 cairo_set_source_rgb(cr, col, .1f, .1f);
332 cairo_set_dash(cr, dashes, ndash, dashes[0]);
336 cairo_set_source_rgb(cr, .1f, .1f, .1f);
337 cairo_set_dash(cr, dashes, ndash, 0);
339 cairo_move_to(cr, offx[2 *
k + 0], offx[2 *
k + 1]);
340 cairo_curve_to(cr, -pos[2 *
k + 0] + offx[2 *
k + 0] + offy[2 *
k + 0],
341 -pos[2 *
k + 1] + offx[2 *
k + 1] + offy[2 *
k + 1],
342 -pos[2 *
k + 0] + offx[2 *
k + 0] + offy[2 *
k + 0],
343 -pos[2 *
k + 1] + offx[2 *
k + 1] + offy[2 *
k + 1], offy[2 *
k + 0], offy[2 *
k + 1]);
344 cairo_curve_to(cr, pos[2 *
k + 0] - offx[2 *
k + 0] + offy[2 *
k + 0],
345 pos[2 *
k + 1] - offx[2 *
k + 1] + offy[2 *
k + 1],
346 pos[2 *
k + 0] - offx[2 *
k + 0] + offy[2 *
k + 0],
347 pos[2 *
k + 1] - offx[2 *
k + 1] + offy[2 *
k + 1],
348 2 * pos[2 *
k + 0] - offx[2 *
k + 0], 2 * pos[2 *
k + 1] - offx[2 *
k + 1]);
349 cairo_curve_to(cr, 3 * pos[2 *
k + 0] - offx[2 *
k + 0] - offy[2 *
k + 0],
350 3 * pos[2 *
k + 1] - offx[2 *
k + 1] - offy[2 *
k + 1],
351 3 * pos[2 *
k + 0] - offx[2 *
k + 0] - offy[2 *
k + 0],
352 3 * pos[2 *
k + 1] - offx[2 *
k + 1] - offy[2 *
k + 1],
353 2 * pos[2 *
k + 0] - offy[2 *
k + 0], 2 * pos[2 *
k + 1] - offy[2 *
k + 1]);
354 cairo_curve_to(cr, pos[2 *
k + 0] + offx[2 *
k + 0] - offy[2 *
k + 0],
355 pos[2 *
k + 1] + offx[2 *
k + 1] - offy[2 *
k + 1],
356 pos[2 *
k + 0] + offx[2 *
k + 0] - offy[2 *
k + 0],
357 pos[2 *
k + 1] + offx[2 *
k + 1] - offy[2 *
k + 1], offx[2 *
k + 0], offx[2 *
k + 1]);
360 cairo_scale(cr, 1. / scale, 1. / scale);
int width
Definition bilateral.h:1
int height
Definition bilateral.h:1
const double thrs
Definition chart/main.c:54
const float i
Definition colorspaces_inline_conversions.h:440
const float fx
Definition colorspaces_inline_conversions.h:100
const dt_aligned_pixel_t f
Definition colorspaces_inline_conversions.h:102
const float n
Definition colorspaces_inline_conversions.h:678
darktable_t darktable
Definition darktable.c:173
#define UNKNOWN_IMAGE
Definition darktable.h:182
#define dt_free(ptr)
Definition darktable.h:456
#define __OMP_PARALLEL_FOR__(...)
Definition darktable.h:258
void dt_dev_pixelpipe_get_roi_out(dt_dev_pixelpipe_t *pipe, const int width_in, const int height_in, int *width, int *height)
Definition dev_pixelpipe.c:355
void dt_dev_cleanup(dt_develop_t *dev)
Definition develop.c:187
int dt_dev_distort_transform_plus(const dt_dev_pixelpipe_t *pipe, const double iop_order, const int transf_direction, float *points, size_t points_count)
Definition develop.c:1419
dt_dev_image_storage_t dt_dev_load_image(dt_develop_t *dev, const int32_t imgid)
Definition develop.c:764
void dt_dev_init(dt_develop_t *dev, int32_t gui_attached)
Definition develop.c:128
@ DT_DEV_TRANSFORM_DIR_ALL
Definition develop.h:102
static void dt_focus_draw_clusters(cairo_t *cr, int width, int height, int32_t imgid, int buffer_width, int buffer_height, dt_focus_cluster_t *focus, int frows, int fcols, float full_zoom, float full_x, float full_y)
Definition focus.h:226
static void dt_focus_create_clusters(dt_focus_cluster_t *focus, int frows, int fcols, uint8_t *buffer, int buffer_width, int buffer_height)
Definition focus.h:136
#define gbuf(BUF, A, B)
Definition focus.h:42
static void _dt_focus_cdf22_wtf(uint8_t *buf, const int l, const int width, const int height)
Definition focus.h:54
static void _dt_focus_update(dt_focus_cluster_t *f, int frows, int fcols, int i, int j, int wd, int ht, int diff)
Definition focus.h:98
#define CHANNEL
Definition focus.h:44
#define FOCUS_THRS
Definition focus.h:43
static int _from_uint8(uint8_t i)
Definition focus.h:50
static uint8_t _to_uint8(int i)
Definition focus.h:46
#define DT_PIXEL_APPLY_DPI(value)
Definition gtk.h:75
void dt_image_cache_read_release(dt_image_cache_t *cache, const dt_image_t *img)
Definition image_cache.c:508
dt_image_t * dt_image_cache_get(dt_image_cache_t *cache, const int32_t imgid, char mode)
Definition image_cache.c:398
static const float x
Definition iop_profile.h:235
float *const restrict const size_t k
Definition luminance_mask.h:78
float *const restrict const size_t const size_t ch
Definition luminance_mask.h:78
@ DT_MIPMAP_NONE
Definition mipmap_cache.h:53
void dt_dev_pixelpipe_set_input(dt_dev_pixelpipe_t *pipe, int32_t imgid, int width, int height, float iscale, dt_mipmap_size_t size)
Definition pixelpipe_hb.c:466
int dt_dev_pixelpipe_init_dummy(dt_dev_pixelpipe_t *pipe, dt_develop_t *dev)
Definition pixelpipe_hb.c:392
void dt_dev_pixelpipe_create_nodes(dt_dev_pixelpipe_t *pipe)
Definition pixelpipe_hb.c:591
void dt_dev_pixelpipe_cleanup(dt_dev_pixelpipe_t *pipe)
Definition pixelpipe_hb.c:486
#define dt_dev_pixelpipe_synch_all(pipe)
Definition pixelpipe_hb.h:482
struct dt_gui_gtk_t * gui
Definition darktable.h:774
struct dt_image_cache_t * image_cache
Definition darktable.h:776
struct dt_develop_t * develop
Definition darktable.h:769
Definition pixelpipe_hb.h:218
int iwidth
Definition pixelpipe_hb.h:227
int processed_width
Definition pixelpipe_hb.h:235
int processed_height
Definition pixelpipe_hb.h:235
int iheight
Definition pixelpipe_hb.h:227
int32_t border_size
Definition develop.h:189
struct dt_develop_t::@18 roi
float y
Definition focus.h:38
float x
Definition focus.h:38
float y2
Definition focus.h:38
float x2
Definition focus.h:38
int64_t n
Definition focus.h:37
float thrs
Definition focus.h:39
double ppd
Definition gtk.h:162
int32_t crop_y
Definition image.h:282
int32_t crop_x
Definition image.h:282