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;
62#pragma omp parallel for default(none) \
63 dt_omp_firstprivate(height, st, step, width, ch) \
67 for(
int j = 0; j <
height; j++)
72 for(;
i <
width - st;
i += step)
79 for(
i = step;
i <
width - st;
i += step)
85#pragma omp parallel for default(none) \
86 dt_omp_firstprivate(height, st, step, width, ch) \
95 for(; j <
height - st; j += step)
102 for(j = step; j <
height - st; j += step)
115 int fx =
i / (float)wd * fcols;
116 int fy = j / (float)ht * frows;
117 int fi = fcols * fy +
fx;
129 f[fi].x2 += (float)
i *
i;
133 f[fi].y2 += (float)j * j;
148 int buffer_width,
int buffer_height)
151 const int wd = buffer_width;
152 const int ht = buffer_height;
153 const int fs = frows * fcols;
161#pragma omp parallel for schedule(static) default(shared)
163 for(
int j = 0; j < ht - 1; j += 4)
164 for(
int i = 0;
i < wd - 1;
i += 4)
173 int num_clusters = 0;
174 for(
int k = 0; k < fs; k++)
175 if(focus[k].
n * 4 > wd * ht / (
float)fs * 0.01f) num_clusters++;
181#pragma omp parallel for schedule(static) default(shared)
183 for(
int j = 0; j < ht - 1; j += 8)
185 for(
int i = 0;
i < wd - 1;
i += 8)
194 for(
int k = 0; k < fs; k++)
196 if(focus[k].
n * 6.0f > wd * ht / (
float)fs * 0.01f)
209#pragma omp parallel for schedule(static) default(shared)
211 for(
int j=1;j<ht-1;j++)
213 int index = 4*j*wd+4;
214 for(
int i=1;
i<wd-1;
i++)
216 int32_t diff = 4*buffer[index+1]
219 - buffer[index-4*wd+1]
220 - buffer[index+4*wd+1];
227 for(
int k = 0; k < fs; k++)
229 focus[k].
thrs /= fabsf((
float)focus[k].
n);
230 focus[k].
x /= fabsf((
float)focus[k].
n);
231 focus[k].
x2 /= fabsf((
float)focus[k].
n);
232 focus[k].
y /= fabsf((
float)focus[k].
n);
233 focus[k].
y2 /= fabsf((
float)focus[k].
n);
239 float full_zoom,
float full_x,
float full_y)
241 const int fs = frows * fcols;
250 int wd = buffer_width + image.
crop_x;
251 int ht = buffer_height + image.
crop_y;
254 float *pos = malloc(fs * 6 *
sizeof(
float));
255 float *offx = pos + fs * 2, *offy = pos + fs * 4;
257 for(
int k = 0; k < fs; k++)
259 const float stddevx = sqrtf(focus[k].x2 - focus[k].
x * focus[k].
x);
260 const float stddevy = sqrtf(focus[k].y2 - focus[k].y * focus[k].y);
263 const float x = focus[k].
x + image.
crop_x;
264 const float y = focus[k].
y + image.
crop_y;
268 offx[2 * k + 0] =
x + stddevx;
271 offy[2 * k + 1] = y + stddevy;
298 const float scale = fminf((
width - 2 * tb) / (
float)wd, (
height - 2 * tb) / (
float)ht) * full_zoom;
299 cairo_scale(cr, scale, scale);
305 fx = fminf((wd * scale -
width) / 2, fabsf(full_x));
306 if(full_x < 0)
fx = -
fx;
307 if(wd * scale <=
width)
fx = 0;
308 fy = fminf((ht * scale -
height) / 2, fabsf(full_y));
309 if(full_y < 0) fy = -fy;
310 if(ht * scale <=
height) fy = 0;
315 cairo_rectangle(cr, 0, 0, wd, ht);
319 const int ndash =
sizeof(dashes) /
sizeof(dashes[0]);
320 double offset = 0.0f;
321 cairo_set_dash(cr, dashes, ndash, offset);
324 for(
int k = 0; k < fs; k++)
327 const float col = fminf(1.0f, intens);
329 if(focus[k].
n * 4.0f > buffer_width * buffer_height / (
float)fs * 0.01f)
331 else if(-focus[k].
n * 6.0f > buffer_width * buffer_height / (
float)fs * 0.01f)
335 for(
int i = 0;
i < 2;
i++)
340 cairo_set_source_rgb(cr, .1f, .1f, col);
342 cairo_set_source_rgb(cr, col, .1f, .1f);
343 cairo_set_dash(cr, dashes, ndash, dashes[0]);
347 cairo_set_source_rgb(cr, .1f, .1f, .1f);
348 cairo_set_dash(cr, dashes, ndash, 0);
350 cairo_move_to(cr, offx[2 * k + 0], offx[2 * k + 1]);
351 cairo_curve_to(cr, -pos[2 * k + 0] + offx[2 * k + 0] + offy[2 * k + 0],
352 -pos[2 * k + 1] + offx[2 * k + 1] + offy[2 * k + 1],
353 -pos[2 * k + 0] + offx[2 * k + 0] + offy[2 * k + 0],
354 -pos[2 * k + 1] + offx[2 * k + 1] + offy[2 * k + 1], offy[2 * k + 0], offy[2 * k + 1]);
355 cairo_curve_to(cr, pos[2 * k + 0] - offx[2 * k + 0] + offy[2 * k + 0],
356 pos[2 * k + 1] - offx[2 * k + 1] + offy[2 * k + 1],
357 pos[2 * k + 0] - offx[2 * k + 0] + offy[2 * k + 0],
358 pos[2 * k + 1] - offx[2 * k + 1] + offy[2 * k + 1],
359 2 * pos[2 * k + 0] - offx[2 * k + 0], 2 * pos[2 * k + 1] - offx[2 * k + 1]);
360 cairo_curve_to(cr, 3 * pos[2 * k + 0] - offx[2 * k + 0] - offy[2 * k + 0],
361 3 * pos[2 * k + 1] - offx[2 * k + 1] - offy[2 * k + 1],
362 3 * pos[2 * k + 0] - offx[2 * k + 0] - offy[2 * k + 0],
363 3 * pos[2 * k + 1] - offx[2 * k + 1] - offy[2 * k + 1],
364 2 * pos[2 * k + 0] - offy[2 * k + 0], 2 * pos[2 * k + 1] - offy[2 * k + 1]);
365 cairo_curve_to(cr, pos[2 * k + 0] + offx[2 * k + 0] - offy[2 * k + 0],
366 pos[2 * k + 1] + offx[2 * k + 1] - offy[2 * k + 1],
367 pos[2 * k + 0] + offx[2 * k + 0] - offy[2 * k + 0],
368 pos[2 * k + 1] + offx[2 * k + 1] - offy[2 * k + 1], offx[2 * k + 0], offx[2 * k + 1]);
371 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:669
const float fx
Definition colorspaces_inline_conversions.h:254
const dt_aligned_pixel_t f
Definition colorspaces_inline_conversions.h:256
const float n
Definition colorspaces_inline_conversions.h:929
darktable_t darktable
Definition darktable.c:178
#define UNKNOWN_IMAGE
Definition darktable.h:181
#define dt_free(ptr)
Definition darktable.h:380
void dt_dev_pixelpipe_get_roi_out(dt_dev_pixelpipe_t *pipe, struct dt_develop_t *dev, const int width_in, const int height_in, int *width, int *height)
Definition dev_pixelpipe.c:226
void dt_dev_cleanup(dt_develop_t *dev)
Definition develop.c:189
dt_dev_image_storage_t dt_dev_load_image(dt_develop_t *dev, const int32_t imgid)
Definition develop.c:782
void dt_dev_init(dt_develop_t *dev, int32_t gui_attached)
Definition develop.c:129
int dt_dev_distort_transform_plus(dt_develop_t *dev, const dt_dev_pixelpipe_t *pipe, const double iop_order, const int transf_direction, float *points, size_t points_count)
Definition develop.c:1417
@ 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:237
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:147
#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:109
#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
static gboolean draw(GtkWidget *widget, cairo_t *cr, dt_iop_module_t *self)
Definition hotpixels.c:398
void dt_image_cache_read_release(dt_image_cache_t *cache, const dt_image_t *img)
Definition image_cache.c:451
dt_image_t * dt_image_cache_get(dt_image_cache_t *cache, const int32_t imgid, char mode)
Definition image_cache.c:341
static const float x
Definition iop_profile.h:239
@ DT_MIPMAP_NONE
Definition mipmap_cache.h:52
void dt_dev_pixelpipe_set_input(dt_dev_pixelpipe_t *pipe, dt_develop_t *dev, int32_t imgid, int width, int height, dt_mipmap_size_t size)
Definition pixelpipe_hb.c:482
int dt_dev_pixelpipe_init_dummy(dt_dev_pixelpipe_t *pipe)
Definition pixelpipe_hb.c:414
void dt_dev_pixelpipe_create_nodes(dt_dev_pixelpipe_t *pipe, dt_develop_t *dev)
Definition pixelpipe_hb.c:593
void dt_dev_pixelpipe_cleanup(dt_dev_pixelpipe_t *pipe)
Definition pixelpipe_hb.c:501
#define dt_dev_pixelpipe_synch_all(pipe, dev)
Definition pixelpipe_hb.h:427
struct dt_gui_gtk_t * gui
Definition darktable.h:703
struct dt_image_cache_t * image_cache
Definition darktable.h:705
struct dt_develop_t * develop
Definition darktable.h:698
Definition pixelpipe_hb.h:216
int iwidth
Definition pixelpipe_hb.h:222
int processed_width
Definition pixelpipe_hb.h:225
int processed_height
Definition pixelpipe_hb.h:225
int iheight
Definition pixelpipe_hb.h:222
int32_t border_size
Definition develop.h:184
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
Definition common/image.h:247
int32_t crop_y
Definition common/image.h:282
int32_t crop_x
Definition common/image.h:282