[x265] [PATCH 06 of 16] alignment large memory block to page bound

Min Chen chenm003 at 163.com
Wed Oct 7 00:55:17 CEST 2015


# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1444148064 18000
# Node ID 24e006acb915c3be393e8294c93f94f3e014267d
# Parent  74e5bb1a31958d8bab0cf7820f7635ed6aed91bc
alignment large memory block to page bound
---
 source/common/common.cpp |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff -r 74e5bb1a3195 -r 24e006acb915 source/common/common.cpp
--- a/source/common/common.cpp	Tue Oct 06 11:14:22 2015 -0500
+++ b/source/common/common.cpp	Tue Oct 06 11:14:24 2015 -0500
@@ -52,7 +52,8 @@
 #endif
 }
 
-#define X265_ALIGNBYTES 32
+#define X265_ALIGNBYTES (32)
+#define PAGE_SIZE       (4096)
 
 #if _WIN32
 #if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)
@@ -63,7 +64,7 @@
 
 void *x265_malloc(size_t size)
 {
-    return _aligned_malloc(size, X265_ALIGNBYTES);
+    return _aligned_malloc(size, (size <= 2 * PAGE_SIZE ? X265_ALIGNBYTES : PAGE_SIZE));
 }
 
 void x265_free(void *ptr)



More information about the x265-devel mailing list