Skip to content

Commit

Permalink
Always use cacheline size as alignment for dt_alloc_align
Browse files Browse the repository at this point in the history
Apple Silicon has a larger cache line, with this we can use different
size for different platforms.

Based on following darktable commits:

- <darktable-org@3b85164>
- <darktable-org@0e55871>
- <darktable-org@5a16b1e>
  • Loading branch information
AlynxZhou authored and aurelienpierre committed Sep 29, 2024
1 parent 85f2b8b commit f846787
Show file tree
Hide file tree
Showing 45 changed files with 106 additions and 105 deletions.
2 changes: 1 addition & 1 deletion src/common/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ dt_cache_entry_t *dt_cache_get_with_caller(dt_cache_t *cache, const uint32_t key
if(cache->allocate)
cache->allocate(cache->allocate_data, entry);
else
entry->data = dt_alloc_align(64, entry->data_size);
entry->data = dt_alloc_align(entry->data_size);

assert(entry->data_size);
ASAN_POISON_MEMORY_REGION(entry->data, entry->data_size);
Expand Down
3 changes: 2 additions & 1 deletion src/common/darktable.c
Original file line number Diff line number Diff line change
Expand Up @@ -1524,8 +1524,9 @@ void dt_vprint(dt_debug_thread_t thread, const char *msg, ...)
}
}

void *dt_alloc_align(size_t alignment, size_t size)
void *dt_alloc_align(size_t size)
{
const size_t alignment = DT_CACHELINE_BYTES;
const size_t aligned_size = dt_round_size(size, alignment);
#if defined(__FreeBSD_version) && __FreeBSD_version < 700013
return malloc(aligned_size);
Expand Down
28 changes: 14 additions & 14 deletions src/common/darktable.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ typedef unsigned int u_int;
#define __DT_CLONE_TARGETS__
#endif

/* Helper to force stack vectors to be aligned on 64 bits blocks to enable AVX2 */
#define DT_IS_ALIGNED(x) __builtin_assume_aligned(x, 64)
/* Helper to force stack vectors to be aligned on DT_CACHELINE_BYTES blocks to enable AVX2 */
#define DT_IS_ALIGNED(x) __builtin_assume_aligned(x, DT_CACHELINE_BYTES)

#ifndef _RELEASE
#include "common/poison.h"
Expand Down Expand Up @@ -392,22 +392,22 @@ static inline void memset_zero(void *const buffer, size_t size)
}
}

void *dt_alloc_align(size_t alignment, size_t size);
static inline void* dt_calloc_align(size_t alignment, size_t size)
void *dt_alloc_align(size_t size);
static inline void* dt_calloc_align(size_t size)
{
void *buf = dt_alloc_align(alignment, size);
void *buf = dt_alloc_align(size);
if(buf) memset(buf, 0, size);
return buf;
}
static inline float *dt_alloc_align_float(size_t pixels)
{
return (float*)__builtin_assume_aligned(dt_alloc_align(64, pixels * sizeof(float)), 64);
return (float*)__builtin_assume_aligned(dt_alloc_align(pixels * sizeof(float)), DT_CACHELINE_BYTES);
}
static inline float *dt_calloc_align_float(size_t pixels)
{
float *const buf = (float*)dt_alloc_align(64, pixels * sizeof(float));
float *const buf = (float*)dt_alloc_align(pixels * sizeof(float));
if(buf) memset(buf, 0, pixels * sizeof(float));
return (float*)__builtin_assume_aligned(buf, 64);
return (float*)__builtin_assume_aligned(buf, DT_CACHELINE_BYTES);
}
size_t dt_round_size(const size_t size, const size_t alignment);
size_t dt_round_size_sse(const size_t size);
Expand Down Expand Up @@ -449,13 +449,13 @@ static inline gboolean dt_is_aligned(const void *pointer, size_t byte_count)

static inline void * dt_alloc_sse_ps(size_t pixels)
{
return __builtin_assume_aligned(dt_alloc_align(64, pixels * sizeof(float)), 64);
return __builtin_assume_aligned(dt_alloc_align(pixels * sizeof(float)), DT_CACHELINE_BYTES);
}

static inline void * dt_check_sse_aligned(void * pointer)
{
if(dt_is_aligned(pointer, 64))
return __builtin_assume_aligned(pointer, 64);
if(dt_is_aligned(pointer, DT_CACHELINE_BYTES))
return __builtin_assume_aligned(pointer, DT_CACHELINE_BYTES);
else
return NULL;
}
Expand Down Expand Up @@ -515,9 +515,9 @@ static inline int dt_get_thread_num()
static inline void *dt_alloc_perthread(const size_t n, const size_t objsize, size_t* padded_size)
{
const size_t alloc_size = n * objsize;
const size_t cache_lines = (alloc_size+63)/64;
*padded_size = 64 * cache_lines / objsize;
return __builtin_assume_aligned(dt_alloc_align(64, 64 * cache_lines * dt_get_num_threads()), 64);
const size_t cache_lines = (alloc_size + DT_CACHELINE_BYTES - 1) / DT_CACHELINE_BYTES;
*padded_size = DT_CACHELINE_BYTES * cache_lines / objsize;
return __builtin_assume_aligned(dt_alloc_align(DT_CACHELINE_BYTES * cache_lines * dt_get_num_threads()), DT_CACHELINE_BYTES);
}
static inline void *dt_calloc_perthread(const size_t n, const size_t objsize, size_t* padded_size)
{
Expand Down
2 changes: 1 addition & 1 deletion src/common/distance_transform.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ float dt_image_distance_transform(float *const restrict src, float *const restri
float *f = dt_alloc_align_float(maxdim);
float *z = dt_alloc_align_float(maxdim + 1);
float *d = dt_alloc_align_float(maxdim);
int *v = dt_alloc_align(64, maxdim * sizeof (int));
int *v = dt_alloc_align(maxdim * sizeof(int));

// transform along columns
#ifdef _OPENMP
Expand Down
2 changes: 1 addition & 1 deletion src/common/dttypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
// Helper to force heap vectors to be aligned on 64 byte blocks to enable AVX2
// If this is applied to a struct member and the struct is allocated on the heap, then it must be allocated
// on a 64 byte boundary to avoid crashes or undefined behavior because of unaligned memory access.
#define DT_ALIGNED_ARRAY __attribute__((aligned(64)))
#define DT_ALIGNED_ARRAY __attribute__((aligned(DT_CACHELINE_BYTES)))
#define DT_ALIGNED_PIXEL __attribute__((aligned(16)))

// utility type to ease declaration of aligned small arrays to hold a pixel (and document their purpose)
Expand Down
2 changes: 1 addition & 1 deletion src/common/focus_peaking.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static inline void dt_focuspeaking(cairo_t *cr, int width, int height,
const int buf_width, const int buf_height)
{
float *const restrict luma = dt_alloc_align_float((size_t)buf_width * buf_height);
uint8_t *const restrict focus_peaking = dt_alloc_align(64, sizeof(uint8_t) * buf_width * buf_height * 4);
uint8_t *const restrict focus_peaking = dt_alloc_align(sizeof(uint8_t) * buf_width * buf_height * 4);

const size_t npixels = (size_t)buf_height * buf_width;
// Create a luma buffer as the euclidian norm of RGB channels
Expand Down
6 changes: 3 additions & 3 deletions src/common/guided_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -664,9 +664,9 @@ static void guided_filter_cl_fallback(int devid, cl_mem guide, cl_mem in, cl_mem
{
// fall-back implementation: copy data from device memory to host memory and perform filter
// by CPU until there is a proper OpenCL implementation
float *guide_host = dt_alloc_align(64, sizeof(*guide_host) * width * height * ch);
float *in_host = dt_alloc_align(64, sizeof(*in_host) * width * height);
float *out_host = dt_alloc_align(64, sizeof(*out_host) * width * height);
float *guide_host = dt_alloc_align(sizeof(*guide_host) * width * height * ch);
float *in_host = dt_alloc_align(sizeof(*in_host) * width * height);
float *out_host = dt_alloc_align(sizeof(*out_host) * width * height);
int err;
err = dt_opencl_read_host_from_device(devid, guide_host, guide, width, height, ch * sizeof(float));
if(err != CL_SUCCESS) goto error;
Expand Down
2 changes: 1 addition & 1 deletion src/common/guided_filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ typedef struct gray_image
// allocate space for 1-component image of size width x height
static inline gray_image new_gray_image(int width, int height)
{
return (gray_image){ dt_alloc_align(64, sizeof(float) * width * height), width, height };
return (gray_image){ dt_alloc_align(sizeof(float) * width * height), width, height };
}


Expand Down
4 changes: 2 additions & 2 deletions src/common/heal.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,8 @@ static void _heal_laplace_loop(float *const restrict red_pixels, float *const re
// a handful of runs in each row of pixels.
// Note that using `unsigned` instead of size_t, the stamp is limited to ~8 gigapixels (the main image can be larger)
const size_t subwidth = (width+1)/2; // round up to be able to handle odd widths
unsigned *const restrict red_runs = dt_alloc_align(64, sizeof(unsigned) * subwidth * (height + 2));
unsigned *const restrict black_runs = dt_alloc_align(64, sizeof(unsigned) * subwidth * (height + 2));
unsigned *const restrict red_runs = dt_alloc_align(sizeof(unsigned) * subwidth * (height + 2));
unsigned *const restrict black_runs = dt_alloc_align(sizeof(unsigned) * subwidth * (height + 2));
if(!red_runs || !black_runs)
{
fprintf(stderr, "_heal_laplace_loop: error allocating memory for healing\n");
Expand Down
4 changes: 2 additions & 2 deletions src/common/imageio.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ int dt_imageio_large_thumbnail(const char *filename, uint8_t **buffer, int32_t *
// Decompress the JPG into our own memory format
dt_imageio_jpeg_t jpg;
if(dt_imageio_jpeg_decompress_header(buf, bufsize, &jpg)) goto error;
*buffer = (uint8_t *)dt_alloc_align(64, sizeof(uint8_t) * 4 * jpg.width * jpg.height);
*buffer = (uint8_t *)dt_alloc_align(sizeof(uint8_t) * 4 * jpg.width * jpg.height);
if(!*buffer) goto error;

*width = jpg.width;
Expand Down Expand Up @@ -181,7 +181,7 @@ int dt_imageio_large_thumbnail(const char *filename, uint8_t **buffer, int32_t *
*height = image->rows;
*color_space = DT_COLORSPACE_SRGB; // FIXME: this assumes that embedded thumbnails are always srgb

*buffer = (uint8_t *)dt_alloc_align(64, sizeof(uint8_t) * 4 * image->columns * image->rows);
*buffer = (uint8_t *)dt_alloc_align(sizeof(uint8_t) * 4 * image->columns * image->rows);
if(!*buffer) goto error_gm;

for(uint32_t row = 0; row < image->rows; row++)
Expand Down
12 changes: 6 additions & 6 deletions src/common/imageio_jpeg.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ static int decompress_jsc(dt_imageio_jpeg_t *jpg, uint8_t *out)
static int decompress_plain(dt_imageio_jpeg_t *jpg, uint8_t *out)
{
JSAMPROW row_pointer[1];
row_pointer[0] = (uint8_t *)dt_alloc_align(64, (size_t)jpg->dinfo.output_width * jpg->dinfo.num_components);
row_pointer[0] = (uint8_t *)dt_alloc_align((size_t)jpg->dinfo.output_width * jpg->dinfo.num_components);
uint8_t *tmp = out;
while(jpg->dinfo.output_scanline < jpg->dinfo.image_height)
{
Expand Down Expand Up @@ -291,7 +291,7 @@ int dt_imageio_jpeg_compress(const uint8_t *in, uint8_t *out, const int width, c
if(quality > 90) jpg.cinfo.comp_info[0].v_samp_factor = 1;
if(quality > 92) jpg.cinfo.comp_info[0].h_samp_factor = 1;
jpeg_start_compress(&(jpg.cinfo), TRUE);
uint8_t *row = dt_alloc_align(64, sizeof(uint8_t) * 3 * width);
uint8_t *row = dt_alloc_align(sizeof(uint8_t) * 3 * width);
const uint8_t *buf;
while(jpg.cinfo.next_scanline < jpg.cinfo.image_height)
{
Expand Down Expand Up @@ -531,7 +531,7 @@ int dt_imageio_jpeg_write_with_icc_profile(const char *filename, const uint8_t *
cmsSaveProfileToMem(out_profile, 0, &len);
if(len > 0)
{
unsigned char *buf = dt_alloc_align(64, sizeof(unsigned char) * len);
unsigned char *buf = dt_alloc_align(sizeof(unsigned char) * len);
cmsSaveProfileToMem(out_profile, buf, &len);
write_icc_profile(&(jpg.cinfo), buf, len);
dt_free_align(buf);
Expand All @@ -540,7 +540,7 @@ int dt_imageio_jpeg_write_with_icc_profile(const char *filename, const uint8_t *

if(exif && exif_len > 0 && exif_len < 65534) jpeg_write_marker(&(jpg.cinfo), JPEG_APP0 + 1, exif, exif_len);

uint8_t *row = dt_alloc_align(64, sizeof(uint8_t) * 3 * width);
uint8_t *row = dt_alloc_align(sizeof(uint8_t) * 3 * width);
const uint8_t *buf;
while(jpg.cinfo.next_scanline < jpg.cinfo.image_height)
{
Expand Down Expand Up @@ -615,7 +615,7 @@ static int read_jsc(dt_imageio_jpeg_t *jpg, uint8_t *out)
static int read_plain(dt_imageio_jpeg_t *jpg, uint8_t *out)
{
JSAMPROW row_pointer[1];
row_pointer[0] = (uint8_t *)dt_alloc_align(64, (size_t)jpg->dinfo.output_width * jpg->dinfo.num_components);
row_pointer[0] = (uint8_t *)dt_alloc_align((size_t)jpg->dinfo.output_width * jpg->dinfo.num_components);
uint8_t *tmp = out;
while(jpg->dinfo.output_scanline < jpg->dinfo.image_height)
{
Expand Down Expand Up @@ -739,7 +739,7 @@ dt_imageio_retval_t dt_imageio_open_jpeg(dt_image_t *img, const char *filename,
img->width = jpg.width;
img->height = jpg.height;

uint8_t *tmp = (uint8_t *)dt_alloc_align(64, sizeof(uint8_t) * 4 * jpg.width * jpg.height);
uint8_t *tmp = (uint8_t *)dt_alloc_align(sizeof(uint8_t) * 4 * jpg.width * jpg.height);
if(dt_imageio_jpeg_read(&jpg, tmp))
{
dt_free_align(tmp);
Expand Down
2 changes: 1 addition & 1 deletion src/common/imageio_png.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ dt_imageio_retval_t dt_imageio_open_png(dt_image_t *img, const char *filename, d
return DT_IMAGEIO_CACHE_FULL;
}

buf = dt_alloc_align(64, (size_t)image.height * png_get_rowbytes(image.png_ptr, image.info_ptr));
buf = dt_alloc_align((size_t)image.height * png_get_rowbytes(image.png_ptr, image.info_ptr));

if(!buf)
{
Expand Down
2 changes: 1 addition & 1 deletion src/common/interpolation.c
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@ static gboolean _prepare_resampling_plan(const struct dt_interpolation *itor,
const size_t metareq = dt_round_size(pmeta ? 4 * sizeof(int) * out : 0, DT_CACHELINE_BYTES);

const size_t totalreq = kernelreq + lengthreq + indexreq + scratchreq + metareq;
void *blob = dt_alloc_align(DT_CACHELINE_BYTES, totalreq);
void *blob = dt_alloc_align(totalreq);
if(!blob) return TRUE;

int *lengths = (int *)blob;
Expand Down
2 changes: 1 addition & 1 deletion src/common/iop_profile.c
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ dt_ioppr_add_profile_info_to_list(struct dt_develop_t *dev,
dt_iop_order_iccprofile_info_t *profile_info = dt_ioppr_get_profile_info_from_list(dev, profile_type, profile_filename);
if(profile_info == NULL)
{
profile_info = dt_alloc_align(64, sizeof(dt_iop_order_iccprofile_info_t));
profile_info = dt_alloc_align(sizeof(dt_iop_order_iccprofile_info_t));
dt_ioppr_init_profile_info(profile_info, 0);
const int err = dt_ioppr_generate_profile_info(profile_info, profile_type, profile_filename, intent);
if(err == 0)
Expand Down
14 changes: 7 additions & 7 deletions src/common/mipmap_cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ struct dt_mipmap_buffer_dsc
#endif

/* NB: sizeof must be a multiple of 4*sizeof(float) */
} __attribute__((packed, aligned(64)));
} __attribute__((packed, aligned(DT_CACHELINE_BYTES)));

#if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__)
static const size_t dt_mipmap_buffer_dsc_size __attribute__((unused))
Expand All @@ -109,7 +109,7 @@ static const size_t dt_mipmap_buffer_dsc_size __attribute__((unused)) = sizeof(s
// last resort mem alloc for dead images. sizeof(dt_mipmap_buffer_dsc) + dead image pixels (8x8)
// Must be alignment to 4 * sizeof(float).
static float dt_mipmap_cache_static_dead_image[sizeof(struct dt_mipmap_buffer_dsc) / sizeof(float) + 64 * 4]
__attribute__((aligned(64)));
__attribute__((aligned(DT_CACHELINE_BYTES)));

static inline void dead_image_8(dt_mipmap_buffer_t *buf)
{
Expand Down Expand Up @@ -267,7 +267,7 @@ void *dt_mipmap_cache_alloc(dt_mipmap_buffer_t *buf, const dt_image_t *img)

entry->data_size = 0;

entry->data = dt_alloc_align(64, buffer_size);
entry->data = dt_alloc_align(buffer_size);

if(!entry->data)
{
Expand Down Expand Up @@ -335,7 +335,7 @@ void dt_mipmap_cache_allocate_dynamic(void *data, dt_cache_entry_t *entry)
entry->data_size = sizeof(*dsc) + sizeof(float) * 4 * 64;
}

entry->data = dt_alloc_align(64, entry->data_size);
entry->data = dt_alloc_align(entry->data_size);

// fprintf(stderr, "[mipmap cache] alloc dynamic for key %u %p\n", key, *buf);
if(!(entry->data))
Expand Down Expand Up @@ -383,7 +383,7 @@ void dt_mipmap_cache_allocate_dynamic(void *data, dt_cache_entry_t *entry)
fseek(f, 0, SEEK_END);
const long len = ftell(f);
if(len <= 0) goto read_error; // coverity madness
blob = (uint8_t *)dt_alloc_align(64, len);
blob = (uint8_t *)dt_alloc_align(len);
if(!blob) goto read_error;
fseek(f, 0, SEEK_SET);
const int rd = fread(blob, sizeof(uint8_t), len, f);
Expand Down Expand Up @@ -1209,7 +1209,7 @@ static void _init_8(uint8_t *buf, uint32_t *width, uint32_t *height, float *isca
dt_imageio_jpeg_t jpg;
if(!dt_imageio_jpeg_read_header(filename, &jpg))
{
uint8_t *tmp = (uint8_t *)malloc(sizeof(uint8_t) * jpg.width * jpg.height * 4);
uint8_t *tmp = (uint8_t *)dt_alloc_align(sizeof(uint8_t) * jpg.width * jpg.height * 4);
*color_space = dt_imageio_jpeg_read_color_space(&jpg);
if(!dt_imageio_jpeg_read(&jpg, tmp))
{
Expand All @@ -1218,7 +1218,7 @@ static void _init_8(uint8_t *buf, uint32_t *width, uint32_t *height, float *isca
dt_iop_flip_and_zoom_8(tmp, jpg.width, jpg.height, buf, wd, ht, orientation, width, height);
res = 0;
}
free(tmp);
dt_free_align(tmp);
}
}
else
Expand Down
2 changes: 1 addition & 1 deletion src/common/nlmeans_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ define_patches(const dt_nlmeans_param_t *const params, const int stride, int *nu
n_patches = (n_patches + 1) / 2;
*num_patches = n_patches ;
// allocate a cacheline-aligned buffer
struct patch_t* patches = dt_alloc_align(64, sizeof(struct patch_t) * n_patches);
struct patch_t* patches = dt_alloc_align(sizeof(struct patch_t) * n_patches);
// set up the patch offsets
int patch_num = 0;
int shift = 0;
Expand Down
4 changes: 2 additions & 2 deletions src/common/opencl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1286,7 +1286,7 @@ static float dt_opencl_benchmark_gpu(const int devid, const size_t width, const

unsigned int *const tea_states = alloc_tea_states(dt_get_num_threads());

buf = dt_alloc_align(64, width * height * bpp);
buf = dt_alloc_align(width * height * bpp);
if(buf == NULL) goto error;

#ifdef _OPENMP
Expand Down Expand Up @@ -1361,7 +1361,7 @@ static float dt_opencl_benchmark_cpu(const size_t width, const size_t height, co

unsigned int *const tea_states = alloc_tea_states(dt_get_num_threads());

buf = dt_alloc_align(64, width * height * bpp);
buf = dt_alloc_align(width * height * bpp);
if(buf == NULL) goto error;

#ifdef _OPENMP
Expand Down
2 changes: 1 addition & 1 deletion src/common/points.h
Original file line number Diff line number Diff line change
Expand Up @@ -1127,7 +1127,7 @@ void init_by_array(sfmt_state_t *s, uint32_t *init_key, int key_length)

static inline void dt_points_init(dt_points_t *p, const unsigned int num_threads)
{
sfmt_state_t *states = (sfmt_state_t *)dt_alloc_align(64, sizeof(sfmt_state_t) * num_threads);
sfmt_state_t *states = (sfmt_state_t *)dt_alloc_align(sizeof(sfmt_state_t) * num_threads);
p->s = (sfmt_state_t **)calloc(num_threads, sizeof(sfmt_state_t *));
p->num = num_threads;

Expand Down
4 changes: 2 additions & 2 deletions src/common/tea.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
// cache line will be running in lock-step as the cache line bounces back and forth between them, effectively
// cutting throughput by a factor equal to the number of threads sharing a cache line (8 with a 64-byte cache
// line and 32-bit ints)
#define TEA_STATE_SIZE (MAX(64, 2*sizeof(unsigned int)))
#define TEA_STATE_SIZE (MAX(DT_CACHELINE_BYTES, 2*sizeof(unsigned int)))
static inline unsigned int* alloc_tea_states(size_t numthreads)
{
unsigned int* states = dt_alloc_align(64, numthreads * TEA_STATE_SIZE);
unsigned int* states = dt_alloc_align(numthreads * TEA_STATE_SIZE);
if (states) memset(states, 0, numthreads * TEA_STATE_SIZE);
return states;
}
Expand Down
2 changes: 1 addition & 1 deletion src/develop/imageop.h
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ const char **dt_iop_set_description(dt_iop_module_t *module, const char *main_te
static inline dt_iop_gui_data_t *_iop_gui_alloc(dt_iop_module_t *module, size_t size)
{
// Align so that DT_ALIGNED_ARRAY may be used within gui_data struct
module->gui_data = (dt_iop_gui_data_t*)dt_calloc_align(64, size);
module->gui_data = (dt_iop_gui_data_t*)dt_calloc_align(size);
dt_pthread_mutex_init(&module->gui_lock,NULL);
return module->gui_data;
}
Expand Down
4 changes: 2 additions & 2 deletions src/develop/masks/path.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ static int _path_find_self_intersection(dt_masks_dynbuf_t *inter, int nb_corners
const size_t ss = (size_t)hb * wb;
if(ss < 10 || hb < 0 || wb < 0) return 0;

int *binter = dt_alloc_align(64, sizeof(int) * ss);
int *binter = dt_alloc_align(sizeof(int) * ss);
if(binter == NULL) return 0;
memset(binter, 0, sizeof(int) * ss);

Expand Down Expand Up @@ -3038,7 +3038,7 @@ static int _path_get_mask_roi(const dt_iop_module_t *const module, const dt_dev_
// deal with feather if it does not lie outside of roi
if(!path_encircles_roi)
{
int *dpoints = dt_alloc_align(64, sizeof(int) * 4 * border_count);
int *dpoints = dt_alloc_align(sizeof(int) * 4 * border_count);
if(dpoints == NULL)
{
dt_free_align(points);
Expand Down
Loading

0 comments on commit f846787

Please sign in to comment.