From a87fb34edaf1a10f5527b6dc8a506a1c9ecbc683 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Sat, 14 Jun 2014 00:30:13 +0600 Subject: Use advantage of SSE2 instructions in gaussian blur node This gives around 30% of speedup for gaussian blur node. Pretty much straightforward implementation inside the node itself, but needed to implement some additional things: - Aligned malloc. It's needed to load data onto SSE registers faster. based on the aligned_malloc() from Libmv with some additional trickery going on to support arbitrary alignment (this magic is needed because of MemHead). In the practice only 16bit alignment is supported because of the lack of aligned malloc with arbitrary alignment for OSX. Not a bit deal for now because we need 16 bytes alignment at this moment only. Could be tweaked further later. - Memory buffers in compositor are now aligned to 16 bytes. Should be harmless for non-SSE cases too. just mentioning. Reviewers: campbellbarton, lukastoenne, jbakker Reviewed By: campbellbarton CC: lockal Differential Revision: https://developer.blender.org/D564 --- intern/guardedalloc/MEM_guardedalloc.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'intern/guardedalloc/MEM_guardedalloc.h') diff --git a/intern/guardedalloc/MEM_guardedalloc.h b/intern/guardedalloc/MEM_guardedalloc.h index 4fb68965338..8c5ad77b8b6 100644 --- a/intern/guardedalloc/MEM_guardedalloc.h +++ b/intern/guardedalloc/MEM_guardedalloc.h @@ -119,6 +119,12 @@ extern "C" { * */ extern void *(*MEM_mallocN)(size_t len, const char *str) /* ATTR_MALLOC */ ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2); + /** + * Allocate an aligned block of memory of size len, with tag name str. The + * name must be a static, because only a pointer to it is stored ! + * */ + extern void *(*MEM_mallocN_aligned)(size_t len, size_t alignment, const char *str) /* ATTR_MALLOC */ ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(3); + /** * Same as callocN, clears memory and uses mmap (disk cached) if supported. * Can be free'd with MEM_freeN as usual. -- cgit v1.2.3