[x265] [PATCH 6 of 8] alignment large memory block to page bound

Min Chen chenm003 at 163.com
Thu Oct 1 02:48:46 CEST 2015


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

diff -r a9b46cf76b21 -r a5e787345396 source/common/common.cpp
--- a/source/common/common.cpp	Wed Sep 30 17:32:25 2015 -0500
+++ b/source/common/common.cpp	Wed Sep 30 17:32:27 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