Skip to content

Commit

Permalink
Minor clean-up, remove traling while spaces.
Browse files Browse the repository at this point in the history
  • Loading branch information
TurboGit committed Dec 15, 2021
1 parent aa1e413 commit 36c7493
Show file tree
Hide file tree
Showing 32 changed files with 121 additions and 121 deletions.
2 changes: 1 addition & 1 deletion cmake/modules/sse_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ int main (int argc, char **argv)
fprintf(stdout,"%s", (ecx>>19)&1?"SSE4.1 ":"");
fprintf(stdout,"%s", (ecx>>20)&1?"SSE4.2 ":"");
fprintf(stdout,"\n");
}
}
6 changes: 3 additions & 3 deletions src/common/collection.c
Original file line number Diff line number Diff line change
Expand Up @@ -1540,16 +1540,16 @@ static gchar *get_query_string(const dt_collection_properties_t property, const
const gboolean no_location = strcmp(escaped_text, _("tagged")) == 0;
const gboolean all_tagged = strcmp(escaped_text, _("tagged*")) == 0;
char *escaped_text2 = g_strstr_len(escaped_text, -1, "|");
char *name_clause = g_strdup_printf("t.name LIKE \'%s\' || \'%s\'",
char *name_clause = g_strdup_printf("t.name LIKE \'%s\' || \'%s\'",
dt_map_location_data_tag_root(), escaped_text2 ? escaped_text2 : "%");

if (escaped_text2 && (escaped_text2[strlen(escaped_text2)-1] == '*'))
{
escaped_text2[strlen(escaped_text2)-1] = '\0';
name_clause = g_strdup_printf("(t.name LIKE \'%s\' || \'%s\' OR t.name LIKE \'%s\' || \'%s|%%\')",
name_clause = g_strdup_printf("(t.name LIKE \'%s\' || \'%s\' OR t.name LIKE \'%s\' || \'%s|%%\')",
dt_map_location_data_tag_root(), escaped_text2 , dt_map_location_data_tag_root(), escaped_text2);
}

if(not_tagged || all_tagged)
query = g_strdup_printf("(id %s IN (SELECT id AS imgid FROM main.images "
"WHERE (longitude IS NOT NULL AND latitude IS NOT NULL))) ",
Expand Down
10 changes: 5 additions & 5 deletions src/common/distance_transform.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@
*/

/*
eucledian distance transform for darktable Hanno Schwalm ([email protected]) 2021/09
eucledian distance transform for darktable Hanno Schwalm ([email protected]) 2021/09
- adopted to C
- omp support
- reduced alloc/free using dt_alloc_align variants for better debug support
- reduced alloc/free using dt_alloc_align variants for better debug support
- tuned for performance in collaboration with Ingo Weyrich ([email protected]) from rawtherapee
The original code is from:
*** Original copyright note ***
Implementation of the distance transform algorithm described in:
Distance Transforms of Sampled Functions
Pedro F. Felzenszwalb and Daniel P. Huttenlocher
Cornell Computing and Information Science TR2004-1963
Cornell Computing and Information Science TR2004-1963
Copyright (C) 2006 Pedro Felzenszwalb
This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -129,7 +129,7 @@ float dt_image_distance_transform(float *const restrict src, float *const restri
#endif
{
float *f = dt_alloc_align_float(maxdim);
float *z = dt_alloc_align_float(maxdim + 1);
float *z = dt_alloc_align_float(maxdim + 1);
float *d = dt_alloc_align_float(maxdim);
int *v = dt_alloc_align(64, maxdim * sizeof (int));

Expand Down
18 changes: 9 additions & 9 deletions src/common/file_location.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ gchar *dt_loc_init_generic(const char *absolute_value, const char *application_d
{
gchar *result = NULL;
gchar *path = NULL;

if(absolute_value)
{
// the only adjustment the absolute path needs is transforming the possible tilde '~' to an absolute path
Expand All @@ -128,7 +128,7 @@ gchar *dt_loc_init_generic(const char *absolute_value, const char *application_d
{
// the default_value could be absolute or relative. we decide upon presence of the application_directory.
if(application_directory)
{
{
// default_value is relative.
// combine basename (application_directory) and relative path (default_value).
gchar complete_path[PATH_MAX] = { 0 };
Expand All @@ -144,9 +144,9 @@ gchar *dt_loc_init_generic(const char *absolute_value, const char *application_d
// <bundleroot>/Contents/Resources/lib
// <bundleroot>/Contents/Resources/share
// so the relative path from the binary directory to the other directories differs to the non-bundle version by
// ../etc -> ../Resources/etc,
// ../lib -> ../Resources/lib,
// ../share -> ../Resources/share,
// ../etc -> ../Resources/etc,
// ../lib -> ../Resources/lib,
// ../share -> ../Resources/share,
// So we have to modify the relative default value

// +2: removes the two dots '..'
Expand All @@ -171,7 +171,7 @@ gchar *dt_loc_init_generic(const char *absolute_value, const char *application_d

// create file if it does not exist
if(g_file_test(path, G_FILE_TEST_EXISTS) == FALSE) g_mkdir_with_parents(path, 0700);

// removes '.', '..', and extra '/' characters.
result = g_realpath(path);

Expand Down Expand Up @@ -213,7 +213,7 @@ void dt_check_opendir(const char* context, const char* directory)
{
fprintf(stderr, "directory for %s has not been set.\n", context);
exit(EXIT_FAILURE);
}
}

#if _WIN32
wchar_t *wdirectory = g_utf8_to_utf16 (directory, -1, NULL, NULL, NULL);
Expand All @@ -235,8 +235,8 @@ void dt_check_opendir(const char* context, const char* directory)
{
dt_print(DT_DEBUG_DEV, "%s: %s\n", context, directory);
closedir(dir);
}
else
}
else
{
fprintf(stderr, "opendir '%s' fails with: '%s'\n", directory, strerror(errno));
exit(EXIT_FAILURE);
Expand Down
6 changes: 3 additions & 3 deletions src/common/grealpath.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ static inline gchar *g_realpath(const char *path)

char* res = realpath(path, buffer);

if(res)
if(res)
{
return g_strdup(buffer);
}
else
{
else
{
fprintf(stderr, "path lookup '%s' fails with: '%s'\n", path, strerror(errno));
exit(EXIT_FAILURE);
}
Expand Down
2 changes: 1 addition & 1 deletion src/common/imagebuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ gboolean dt_iop_alloc_image_buffers(struct dt_iop_module_t *const module,
if (size & DT_IMGSZ_PERTHREAD)
(void)va_arg(args,size_t*); // skip the extra pointer for per-thread allocations
if (size == 0 || !bufptr) // end of arg list?
break;
break;
*bufptr = NULL;
}
va_end(args);
Expand Down
2 changes: 1 addition & 1 deletion src/common/imagebuf.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ void dt_iop_image_add_image(float *const buf, const float *const other_buf, cons
void dt_iop_image_sub_image(float *const buf, const float *const other_buf, const size_t width, const size_t height,
const size_t ch);

// Subtract each element of the image buffer from the given constant value
// Subtract each element of the image buffer from the given constant value
void dt_iop_image_invert(float *const buf, const float max_value, const size_t width, const size_t height,
const size_t ch);

Expand Down
4 changes: 2 additions & 2 deletions src/common/math.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ union float_int {

// a faster, vectorizable version of hypotf() when we know that there won't be overflow, NaNs, or infinities
#ifdef _OPENMP
#pragma omp declare simd
#pragma omp declare simd
#endif
static inline float dt_fast_hypotf(const float x, const float y)
{
Expand All @@ -250,7 +250,7 @@ static inline float dt_fast_hypotf(const float x, const float y)
// fast approximation of expf()
/****** if you change this function, you need to make the same change in data/kernels/{basecurve,basic}.cl ***/
#ifdef _OPENMP
#pragma omp declare simd
#pragma omp declare simd
#endif
static inline float dt_fast_expf(const float x)
{
Expand Down
18 changes: 9 additions & 9 deletions src/develop/blend.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ static void _refine_with_detail_mask(struct dt_iop_module_t *self, struct dt_dev

const gboolean detail = (level > 0.0f);
const float threshold = _detail_mask_threshold(level, detail);

float *tmp = NULL;
float *lum = NULL;
float *warp_mask = NULL;
Expand All @@ -259,7 +259,7 @@ static void _refine_with_detail_mask(struct dt_iop_module_t *self, struct dt_dev
if(info) fprintf(stderr, "[_refine_with_detail_mask] in module %s %ix%i --> %ix%i\n", self->op, iwidth, iheight, owidth, oheight);

const int bufsize = MAX(iwidth * iheight, owidth * oheight);

tmp = dt_alloc_align_float(bufsize);
lum = dt_alloc_align_float(bufsize);
if((tmp == NULL) || (lum == NULL)) goto error;
Expand All @@ -279,7 +279,7 @@ static void _refine_with_detail_mask(struct dt_iop_module_t *self, struct dt_dev
#ifdef _OPENMP
#pragma omp parallel for simd default(none) \
dt_omp_firstprivate(mask, warp_mask, msize) \
schedule(simd:static) aligned(mask, warp_mask : 64)
schedule(simd:static) aligned(mask, warp_mask : 64)
#endif
for(int idx =0; idx < msize; idx++)
{
Expand Down Expand Up @@ -678,7 +678,7 @@ static void _refine_with_detail_mask_cl(struct dt_iop_module_t *self, struct dt_
const gboolean info = ((darktable.unmuted & DT_DEBUG_MASKS) && (piece->pipe->type == DT_DEV_PIXELPIPE_FULL));

const int detail = (level > 0.0f);
const float threshold = _detail_mask_threshold(level, detail);
const float threshold = _detail_mask_threshold(level, detail);
float *lum = NULL;
cl_mem tmp = NULL;
cl_mem blur = NULL;
Expand Down Expand Up @@ -716,7 +716,7 @@ static void _refine_with_detail_mask_cl(struct dt_iop_module_t *self, struct dt_
dt_opencl_set_kernel_arg(devid, kernel, 3, sizeof(int), &iheight);
const int err = dt_opencl_enqueue_kernel_2d(devid, kernel, sizes);
if(err != CL_SUCCESS) goto error;
}
}

{
size_t sizes[3] = { ROUNDUPWD(iwidth), ROUNDUPHT(iheight), 1 };
Expand All @@ -729,7 +729,7 @@ static void _refine_with_detail_mask_cl(struct dt_iop_module_t *self, struct dt_
dt_opencl_set_kernel_arg(devid, kernel, 5, sizeof(int), &detail);
const int err = dt_opencl_enqueue_kernel_2d(devid, kernel, sizes);
if(err != CL_SUCCESS) goto error;
}
}

{
float blurmat[13];
Expand Down Expand Up @@ -765,7 +765,7 @@ static void _refine_with_detail_mask_cl(struct dt_iop_module_t *self, struct dt_
dt_opencl_set_kernel_arg(devid, kernel, 3, sizeof(int), &iheight);
const int err = dt_opencl_enqueue_kernel_2d(devid, kernel, sizes);
if(err != CL_SUCCESS) goto error;
}
}

{
const int err = dt_opencl_read_host_from_device(devid, lum, tmp, iwidth, iheight, sizeof(float));
Expand All @@ -787,15 +787,15 @@ static void _refine_with_detail_mask_cl(struct dt_iop_module_t *self, struct dt_
#ifdef _OPENMP
#pragma omp parallel for simd default(none) \
dt_omp_firstprivate(mask, warp_mask, msize) \
schedule(simd:static) aligned(mask, warp_mask : 64)
schedule(simd:static) aligned(mask, warp_mask : 64)
#endif
for(int idx = 0; idx < msize; idx++)
{
mask[idx] = mask[idx] * warp_mask[idx];
}
dt_free_align(warp_mask);
return;

error:
dt_control_log(_("detail mask CL blending problem"));
dt_free_align(lum);
Expand Down
26 changes: 13 additions & 13 deletions src/develop/masks/detail.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
The detail masks (DM) are used by the dual demosaicer and as a further refinement step for
shape / parametric masks.
They contain threshold weighed values of pixel-wise local signal changes so they can be
understood as "areas with or without local detail".
understood as "areas with or without local detail".
As the DM using algorithms (like dual demosaicing, sharpening ...) are all pixel peeping we
want the "original data" from the sensor to calculate it.
(Calculating the mask from the modules roi might not detect such regions at all because of
Expand All @@ -33,15 +33,15 @@
Positive values will select regions with lots of local detail, negatives select for flat areas.
(The dual demosaicer only wants positives as we always look for high frequency content.)
A threshold value of 0.0 means bypassing.
So the first important point is:
We make sure taking the input data for the DM right from the demosaicer for normal raws
or from rawprepare in case of monochromes. This means some additional housekeeping for the
pixelpipe.
If any mask in any module selects a threshold of != 0.0 we leave a flag in the pipe struct
telling a) we want a DM and b) we want it from either demosaic or from rawprepare.
If such a flag has not been previously set we will force a pipeline reprocessing.
gboolean dt_dev_write_rawdetail_mask(dt_dev_pixelpipe_iop_t *piece, float *const rgb, const dt_iop_roi_t *const roi_in, const int mode, const dt_aligned_pixel_t wb);
or it's _cl equivalent write a preliminary mask holding signal-change values for every pixel.
These mask values are calculated as
Expand All @@ -53,11 +53,11 @@
The pipe gets roi copy of the writing module so we can later scale/distort the LM.
Calculating the RM is done for performance and lower mem pressure reasons, so we don't have to
pass full data to the module. Also the RM can be used by other modules.
pass full data to the module. Also the RM can be used by other modules.
If a mask uses the details refinement step it takes the raw details mask RM and calculates an
intermediate mask (IM) which is still not scaled but has the roi of the writing module.
For every pixel we calculate the IM value via a sigmoid function with the threshold and RM as parameters.
At last the IM is slightly blurred to avoid hard transitions, as there still is no scaling we can use
Expand Down Expand Up @@ -337,7 +337,7 @@ int dt_masks_blur_fast(float *const restrict src, float *const restrict out, con
#endif
for(int i = 0; i < width * height; i++)
out[i] = fmaxf(0.0f, fminf(clip, gain * src[i]));
return 0;
return 0;
}
else if(sigma <= 0.8f)
{
Expand Down Expand Up @@ -397,11 +397,11 @@ void dt_masks_blur_approx_weighed(float *const restrict src, float *const restri
float coeffs[maxmat][20];

for(int i = 1; i < 9; i++)
_masks_blur_5x5_coeff(coeffs[i-1], 0.1f * (float) (i));
_masks_blur_5x5_coeff(coeffs[i-1], 0.1f * (float) (i));
for(int i = 9; i < 16; i++)
dt_masks_blur_9x9_coeff(coeffs[i-1], 0.1f * (float) (i));
dt_masks_blur_9x9_coeff(coeffs[i-1], 0.1f * (float) (i));
for(int i = 16; i <= maxmat; i++)
_masks_blur_13x13_coeff(coeffs[i-1], 0.1f * (float) (i));
_masks_blur_13x13_coeff(coeffs[i-1], 0.1f * (float) (i));

const int w1 = width;
const int w2 = 2*width;
Expand All @@ -421,12 +421,12 @@ void dt_masks_blur_approx_weighed(float *const restrict src, float *const restri
for(int col = 6; col < width - 6; col++)
{
const int i = row * width + col;
const int d = MIN(maxmat, MAX(0, ((int) (10.0f * weight[i])))) ;
const int d = MIN(maxmat, MAX(0, ((int) (10.0f * weight[i])))) ;
float *blurmat = coeffs[d-1];
if(d == 0) out[i] = src[i];
else if(d < 9) out[i] = FAST_BLUR_5;
else if(d < 16) out[i] = FAST_BLUR_9;
else out[i] = FAST_BLUR_13;
else out[i] = FAST_BLUR_13;
}
}
}
Expand Down
Loading

0 comments on commit 36c7493

Please sign in to comment.