[x265-commits] [x265] picyuv: nits

Steve Borho steve at borho.org
Thu Feb 19 20:41:23 CET 2015


details:   http://hg.videolan.org/x265/rev/85ce349176e1
branches:  
changeset: 9377:85ce349176e1
user:      Steve Borho <steve at borho.org>
date:      Thu Feb 19 09:30:44 2015 -0600
description:
picyuv: nits
Subject: [x265] threading: white-space nits

details:   http://hg.videolan.org/x265/rev/94f5ea9803de
branches:  
changeset: 9378:94f5ea9803de
user:      Steve Borho <steve at borho.org>
date:      Thu Feb 19 09:31:10 2015 -0600
description:
threading: white-space nits
Subject: [x265] cmake: detect and link to libnuma on UNIX systems

details:   http://hg.videolan.org/x265/rev/c479ca761e87
branches:  
changeset: 9379:c479ca761e87
user:      Steve Borho <steve at borho.org>
date:      Thu Feb 19 09:29:24 2015 -0600
description:
cmake: detect and link to libnuma on UNIX systems
Subject: [x265] docs: fix warning for min-cu-size

details:   http://hg.videolan.org/x265/rev/51e1d13f96c4
branches:  
changeset: 9380:51e1d13f96c4
user:      Steve Borho <steve at borho.org>
date:      Thu Feb 19 11:18:02 2015 -0600
description:
docs: fix warning for min-cu-size
Subject: [x265] slice: move SET_WEIGHT from slicetype.h to slice.h

details:   http://hg.videolan.org/x265/rev/d34f9d23b370
branches:  
changeset: 9381:d34f9d23b370
user:      Steve Borho <steve at borho.org>
date:      Thu Feb 19 13:06:32 2015 -0600
description:
slice: move SET_WEIGHT from slicetype.h to slice.h

diffstat:

 doc/reST/cli.rst                    |   2 +-
 source/CMakeLists.txt               |   9 +++++++
 source/cmake/FindNuma.cmake         |  43 +++++++++++++++++++++++++++++++++++++
 source/common/picyuv.cpp            |   2 -
 source/common/slice.h               |   8 ++++++
 source/common/threading.h           |  36 +++++++++++++++---------------
 source/encoder/slicetype.h          |   8 ------
 source/encoder/weightPrediction.cpp |   2 +-
 8 files changed, 80 insertions(+), 30 deletions(-)

diffs (194 lines):

diff -r 039ea966d5eb -r d34f9d23b370 doc/reST/cli.rst
--- a/doc/reST/cli.rst	Wed Feb 18 19:04:02 2015 -0600
+++ b/doc/reST/cli.rst	Thu Feb 19 13:06:32 2015 -0600
@@ -477,7 +477,7 @@ the prediction quad-tree.
 	and less frame parallelism as well. Because of this the faster
 	presets use a CU size of 32. Default: 64
 
-.. option:: --min-cu-size, <64|32|16|8>
+.. option:: --min-cu-size <64|32|16|8>
 
 	Minimum CU size (width and height). By using 16 or 32 the encoder
 	will not analyze the cost of CUs below that minimum threshold,
diff -r 039ea966d5eb -r d34f9d23b370 source/CMakeLists.txt
--- a/source/CMakeLists.txt	Wed Feb 18 19:04:02 2015 -0600
+++ b/source/CMakeLists.txt	Thu Feb 19 13:06:32 2015 -0600
@@ -61,6 +61,15 @@ if(UNIX)
     if(LIBRT)
         list(APPEND PLATFORM_LIBS rt)
     endif()
+    find_package(Numa)
+    if(NUMA_FOUND)
+        add_definitions(-DHAVE_LIBNUMA)
+        message(STATUS "libnuma found, building with support for NUMA nodes")
+        set(PLATFORM_LIBS ${PLATFORM_LIBS} ${NUMA_LIBRARY})
+        link_directories(${NUMA_LIBRARY_DIR})
+        include_directories(${NUMA_INCLUDE_DIR})
+    endif()
+    mark_as_advanced(LIBRT NUMA_FOUND)
 endif(UNIX)
 
 if(X64 AND NOT WIN32)
diff -r 039ea966d5eb -r d34f9d23b370 source/cmake/FindNuma.cmake
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/source/cmake/FindNuma.cmake	Thu Feb 19 13:06:32 2015 -0600
@@ -0,0 +1,43 @@
+# Module for locating libnuma
+#
+# Read-only variables:
+#   NUMA_FOUND
+#     Indicates that the library has been found.
+#
+#   NUMA_INCLUDE_DIR
+#     Points to the libnuma include directory.
+#
+#   NUMA_LIBRARY_DIR
+#     Points to the directory that contains the libraries.
+#     The content of this variable can be passed to link_directories.
+#
+#   NUMA_LIBRARY
+#     Points to the libnuma that can be passed to target_link_libararies.
+#
+# Copyright (c) 2015 Steve Borho
+
+include(FindPackageHandleStandardArgs)
+
+find_path(NUMA_ROOT_DIR
+  NAMES include/numa.h
+  PATHS ENV NUMA_ROOT
+  DOC "NUMA root directory")
+
+find_path(NUMA_INCLUDE_DIR
+  NAMES numa.h
+  HINTS ${NUMA_ROOT_DIR}
+  PATH_SUFFIXES include
+  DOC "NUMA include directory")
+
+find_library(NUMA_LIBRARY
+  NAMES numa
+  HINTS ${NUMA_ROOT_DIR}
+  DOC "NUMA library")
+
+if (NUMA_LIBRARY)
+    get_filename_component(NUMA_LIBRARY_DIR ${NUMA_LIBRARY} PATH)
+endif()
+
+mark_as_advanced(NUMA_INCLUDE_DIR NUMA_LIBRARY_DIR NUMA_LIBRARY)
+
+find_package_handle_standard_args(NUMA REQUIRED_VARS NUMA_ROOT_DIR NUMA_INCLUDE_DIR NUMA_LIBRARY)
diff -r 039ea966d5eb -r d34f9d23b370 source/common/picyuv.cpp
--- a/source/common/picyuv.cpp	Wed Feb 18 19:04:02 2015 -0600
+++ b/source/common/picyuv.cpp	Thu Feb 19 13:06:32 2015 -0600
@@ -176,9 +176,7 @@ void PicYuv::copyFromPicture(const x265_
         for (int r = 0; r < height; r++)
         {
             for (int c = 0; c < width; c++)
-            {
                 yPixel[c] = (pixel)yChar[c];
-            }
 
             yPixel += m_stride;
             yChar += pic.stride[0] / sizeof(*yChar);
diff -r 039ea966d5eb -r d34f9d23b370 source/common/slice.h
--- a/source/common/slice.h	Wed Feb 18 19:04:02 2015 -0600
+++ b/source/common/slice.h	Thu Feb 19 13:06:32 2015 -0600
@@ -288,6 +288,14 @@ struct WeightParam
     }
 };
 
+#define SET_WEIGHT(w, b, s, d, o) \
+    { \
+        (w).inputWeight = (s); \
+        (w).log2WeightDenom = (d); \
+        (w).inputOffset = (o); \
+        (w).bPresentFlag = (b); \
+    }
+
 class Slice
 {
 public:
diff -r 039ea966d5eb -r d34f9d23b370 source/common/threading.h
--- a/source/common/threading.h	Wed Feb 18 19:04:02 2015 -0600
+++ b/source/common/threading.h	Thu Feb 19 13:06:32 2015 -0600
@@ -42,32 +42,32 @@
 #include <sys/sysctl.h>
 #endif
 
-#ifdef __GNUC__                         /* GCCs builtin atomics */
+#ifdef __GNUC__               /* GCCs builtin atomics */
 
 #include <sys/time.h>
 #include <unistd.h>
 
-#define CLZ(id, x)                          id = (unsigned long)__builtin_clz(x) ^ 31
-#define CTZ(id, x)                          id = (unsigned long)__builtin_ctz(x)
-#define ATOMIC_OR(ptr, mask)                __sync_fetch_and_or(ptr, mask)
-#define ATOMIC_AND(ptr, mask)               __sync_fetch_and_and(ptr, mask)
-#define ATOMIC_INC(ptr)                     __sync_add_and_fetch((volatile int32_t*)ptr, 1)
-#define ATOMIC_DEC(ptr)                     __sync_add_and_fetch((volatile int32_t*)ptr, -1)
-#define ATOMIC_ADD(ptr, value)              __sync_fetch_and_add((volatile int32_t*)ptr, value)
-#define GIVE_UP_TIME()                      usleep(0)
+#define CLZ(id, x)            id = (unsigned long)__builtin_clz(x) ^ 31
+#define CTZ(id, x)            id = (unsigned long)__builtin_ctz(x)
+#define ATOMIC_OR(ptr, mask)  __sync_fetch_and_or(ptr, mask)
+#define ATOMIC_AND(ptr, mask) __sync_fetch_and_and(ptr, mask)
+#define ATOMIC_INC(ptr)       __sync_add_and_fetch((volatile int32_t*)ptr, 1)
+#define ATOMIC_DEC(ptr)       __sync_add_and_fetch((volatile int32_t*)ptr, -1)
+#define ATOMIC_ADD(ptr, val)  __sync_fetch_and_add((volatile int32_t*)ptr, val)
+#define GIVE_UP_TIME()        usleep(0)
 
-#elif defined(_MSC_VER)                 /* Windows atomic intrinsics */
+#elif defined(_MSC_VER)       /* Windows atomic intrinsics */
 
 #include <intrin.h>
 
-#define CLZ(id, x)                          _BitScanReverse(&id, x)
-#define CTZ(id, x)                          _BitScanForward(&id, x)
-#define ATOMIC_INC(ptr)                     InterlockedIncrement((volatile LONG*)ptr)
-#define ATOMIC_DEC(ptr)                     InterlockedDecrement((volatile LONG*)ptr)
-#define ATOMIC_ADD(ptr, value)              InterlockedExchangeAdd((volatile LONG*)ptr, value)
-#define ATOMIC_OR(ptr, mask)                _InterlockedOr((volatile LONG*)ptr, (LONG)mask)
-#define ATOMIC_AND(ptr, mask)               _InterlockedAnd((volatile LONG*)ptr, (LONG)mask)
-#define GIVE_UP_TIME()                      Sleep(0)
+#define CLZ(id, x)            _BitScanReverse(&id, x)
+#define CTZ(id, x)            _BitScanForward(&id, x)
+#define ATOMIC_INC(ptr)       InterlockedIncrement((volatile LONG*)ptr)
+#define ATOMIC_DEC(ptr)       InterlockedDecrement((volatile LONG*)ptr)
+#define ATOMIC_ADD(ptr, val)  InterlockedExchangeAdd((volatile LONG*)ptr, val)
+#define ATOMIC_OR(ptr, mask)  _InterlockedOr((volatile LONG*)ptr, (LONG)mask)
+#define ATOMIC_AND(ptr, mask) _InterlockedAnd((volatile LONG*)ptr, (LONG)mask)
+#define GIVE_UP_TIME()        Sleep(0)
 
 #endif // ifdef __GNUC__
 
diff -r 039ea966d5eb -r d34f9d23b370 source/encoder/slicetype.h
--- a/source/encoder/slicetype.h	Wed Feb 18 19:04:02 2015 -0600
+++ b/source/encoder/slicetype.h	Thu Feb 19 13:06:32 2015 -0600
@@ -39,14 +39,6 @@ class Frame;
 #define LOWRES_COST_MASK  ((1 << 14) - 1)
 #define LOWRES_COST_SHIFT 14
 
-#define SET_WEIGHT(w, b, s, d, o) \
-    { \
-        (w).inputWeight = (s); \
-        (w).log2WeightDenom = (d); \
-        (w).inputOffset = (o); \
-        (w).bPresentFlag = b; \
-    }
-
 class EstimateRow
 {
 public:
diff -r 039ea966d5eb -r d34f9d23b370 source/encoder/weightPrediction.cpp
--- a/source/encoder/weightPrediction.cpp	Wed Feb 18 19:04:02 2015 -0600
+++ b/source/encoder/weightPrediction.cpp	Thu Feb 19 13:06:32 2015 -0600
@@ -27,8 +27,8 @@
 #include "frame.h"
 #include "picyuv.h"
 #include "lowres.h"
+#include "slice.h"
 #include "mv.h"
-#include "slicetype.h"
 #include "bitstream.h"
 
 using namespace x265;


More information about the x265-commits mailing list