[x265-commits] [x265] cmake: move asm-primitives.cpp and asm headers into VS so...

Steve Borho steve at borho.org
Fri Dec 6 03:14:26 CET 2013


details:   http://hg.videolan.org/x265/rev/41e80c591116
branches:  
changeset: 5546:41e80c591116
user:      Steve Borho <steve at borho.org>
date:      Thu Dec 05 14:56:24 2013 -0600
description:
cmake: move asm-primitives.cpp and asm headers into VS source group

A cosmetic change only
Subject: [x265] primitives: cleanup intra prediction table dimensions

details:   http://hg.videolan.org/x265/rev/49c0408febfd
branches:  
changeset: 5547:49c0408febfd
user:      Steve Borho <steve at borho.org>
date:      Thu Dec 05 14:59:22 2013 -0600
description:
primitives: cleanup intra prediction table dimensions
Subject: [x265] cmake: remove ENABLE_PRIMITIVES_VEC build option

details:   http://hg.videolan.org/x265/rev/a458b8d6b476
branches:  
changeset: 5548:a458b8d6b476
user:      Steve Borho <steve at borho.org>
date:      Thu Dec 05 15:42:38 2013 -0600
description:
cmake: remove ENABLE_PRIMITIVES_VEC build option

The use of the few remaining compiler intrinsic functions is now unconditional.
Compiler detection will remove them cleanly in case they cannot be compiled, so
there is no reason to make them a top level build option
Subject: [x265] cmake: rename ENABLE_PRIMITIVES_ASM to ENABLE_ASSEMBLY

details:   http://hg.videolan.org/x265/rev/f321d4a467fb
branches:  
changeset: 5549:f321d4a467fb
user:      Steve Borho <steve at borho.org>
date:      Thu Dec 05 15:56:50 2013 -0600
description:
cmake: rename ENABLE_PRIMITIVES_ASM to ENABLE_ASSEMBLY

And use the same name for the build define.  Also, rename
Setup_Vector_Primitives() to Setup_Instrinsic_Primitives()
Subject: [x265] cmake: bump X265_BUILD post 0.6, since x265_param has changed

details:   http://hg.videolan.org/x265/rev/6ed44381cb6c
branches:  
changeset: 5550:6ed44381cb6c
user:      Steve Borho <steve at borho.org>
date:      Thu Dec 05 16:05:53 2013 -0600
description:
cmake: bump X265_BUILD post 0.6, since x265_param has changed
Subject: [x265] TEncCu: coding style, lower case initial letter for totalCu

details:   http://hg.videolan.org/x265/rev/97e917c4a923
branches:  
changeset: 5551:97e917c4a923
user:      Steve Borho <steve at borho.org>
date:      Thu Dec 05 20:13:39 2013 -0600
description:
TEncCu: coding style, lower case initial letter for totalCu

diffstat:

 source/CMakeLists.txt                |  18 ++----
 source/Lib/TLibCommon/CommonDef.h    |   2 -
 source/Lib/TLibEncoder/TEncCu.cpp    |   4 +-
 source/Lib/TLibEncoder/TEncCu.h      |   2 +-
 source/common/CMakeLists.txt         |  91 +++++++++++++++++------------------
 source/common/cpu.cpp                |   4 +-
 source/common/intrapred.cpp          |   2 +-
 source/common/primitives.cpp         |  19 +-----
 source/common/primitives.h           |  10 +-
 source/common/vec/intra-ssse3.cpp    |   2 +-
 source/common/vec/vec-primitives.cpp |   2 +-
 source/encoder/encoder.cpp           |  10 +-
 source/test/intrapredharness.cpp     |   6 +-
 source/test/intrapredharness.h       |   2 +-
 source/test/testbench.cpp            |  15 +---
 15 files changed, 82 insertions(+), 107 deletions(-)

diffs (truncated from 471 to 300 lines):

diff -r 67d755e2a30c -r 97e917c4a923 source/CMakeLists.txt
--- a/source/CMakeLists.txt	Thu Dec 05 13:51:59 2013 -0600
+++ b/source/CMakeLists.txt	Thu Dec 05 20:13:39 2013 -0600
@@ -13,7 +13,7 @@ include(CheckFunctionExists)
 include(CheckCXXCompilerFlag)
 
 # X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 3)
+set(X265_BUILD 4)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
                "${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
@@ -101,15 +101,14 @@ else(HIGH_BIT_DEPTH)
     add_definitions(-DHIGH_BIT_DEPTH=0)
 endif(HIGH_BIT_DEPTH)
 
-option(ENABLE_PRIMITIVES_VEC "Enable use of SIMD vector class primitives" ON)
 find_package(Yasm)
 if(YASM_FOUND)
     if (YASM_VERSION_STRING VERSION_LESS "1.2.0")
         message(STATUS "Yasm version ${YASM_VERSION_STRING} is too old. 1.2.0 or later required")
-        option(ENABLE_PRIMITIVES_ASM "Enable use of assembly coded primitives" OFF)
+        option(ENABLE_ASSEMBLY "Enable use of assembly coded primitives" OFF)
     else()
         message(STATUS "Found Yasm ${YASM_VERSION_STRING} to build assembly primitives")
-        option(ENABLE_PRIMITIVES_ASM "Enable use of assembly coded primitives" ON)
+        option(ENABLE_ASSEMBLY "Enable use of assembly coded primitives" ON)
     endif()
 endif(YASM_FOUND)
 
@@ -151,7 +150,7 @@ include_directories(. Lib common encoder
 add_subdirectory(common)
 add_subdirectory(encoder)
 
-if((MSVC_IDE OR XCODE) AND ENABLE_PRIMITIVES_ASM)
+if((MSVC_IDE OR XCODE) AND ENABLE_ASSEMBLY)
     # this is horrible. ugly, and hacky, and it reproduces logic found
     # in the yasm CMake modules, but this is required because of this cmake bug
     # http://www.cmake.org/Bug/print_bug_page.php?bug_id=8170
@@ -267,11 +266,8 @@ endif(ENABLE_CLI)
 # Test applications
 option(ENABLE_TESTS "Enable Unit Tests" OFF)
 if(ENABLE_TESTS)
-    if(ENABLE_PRIMITIVES_VEC)
-        add_definitions(-DENABLE_VECTOR_PRIMITIVES=1)
-    endif(ENABLE_PRIMITIVES_VEC)
-    if(ENABLE_PRIMITIVES_ASM)
-        add_definitions(-DENABLE_ASM_PRIMITIVES=1)
-    endif(ENABLE_PRIMITIVES_ASM)
+    if(ENABLE_ASSEMBLY)
+        add_definitions(-DENABLE_ASSEMBLY=1)
+    endif(ENABLE_ASSEMBLY)
     add_subdirectory(test)
 endif(ENABLE_TESTS)
diff -r 67d755e2a30c -r 97e917c4a923 source/Lib/TLibCommon/CommonDef.h
--- a/source/Lib/TLibCommon/CommonDef.h	Thu Dec 05 13:51:59 2013 -0600
+++ b/source/Lib/TLibCommon/CommonDef.h	Thu Dec 05 20:13:39 2013 -0600
@@ -98,8 +98,6 @@
 
 #define FAST_UDI_MAX_RDMODE_NUM     35 ///< maximum number of RD comparison in fast-UDI estimation loop
 
-#define NUM_INTRA_MODE 36
-
 #define PLANAR_IDX                  0
 #define VER_IDX                     26 // index for intra VERTICAL   mode
 #define HOR_IDX                     10 // index for intra HORIZONTAL mode
diff -r 67d755e2a30c -r 97e917c4a923 source/Lib/TLibEncoder/TEncCu.cpp
--- a/source/Lib/TLibEncoder/TEncCu.cpp	Thu Dec 05 13:51:59 2013 -0600
+++ b/source/Lib/TLibEncoder/TEncCu.cpp	Thu Dec 05 20:13:39 2013 -0600
@@ -364,7 +364,7 @@ void TEncCu::compressCU(TComDataCU* cu)
         part = m_bestCU[0]->getDepth(i);
         do
         {
-            m_log->TotalCu++;
+            m_log->totalCu++;
             int next = m_bestCU[0]->getTotalNumPart() >> (part * 2);
             if (part == g_maxCUDepth - 1 && m_bestCU[0]->getPartitionSize(i) != SIZE_2Nx2N)
             {
@@ -407,7 +407,7 @@ void TEncCu::compressCU(TComDataCU* cu)
             }
             else
             {
-                m_log->TotalCu++;
+                m_log->totalCu++;
                 if (cu->getPredictionMode(0) == MODE_INTER)
                 {
                     m_log->cntInter[part]++;
diff -r 67d755e2a30c -r 97e917c4a923 source/Lib/TLibEncoder/TEncCu.h
--- a/source/Lib/TLibEncoder/TEncCu.h	Thu Dec 05 13:51:59 2013 -0600
+++ b/source/Lib/TLibEncoder/TEncCu.h	Thu Dec 05 20:13:39 2013 -0600
@@ -65,7 +65,7 @@ struct StatisticLog
     uint64_t cntIntraNxN;
     uint64_t cntSkipCu[4];
     uint64_t cntTotalCu[4];
-    uint64_t TotalCu;
+    uint64_t totalCu;
 
     StatisticLog()
     {
diff -r 67d755e2a30c -r 97e917c4a923 source/common/CMakeLists.txt
--- a/source/common/CMakeLists.txt	Thu Dec 05 13:51:59 2013 -0600
+++ b/source/common/CMakeLists.txt	Thu Dec 05 20:13:39 2013 -0600
@@ -1,10 +1,7 @@
 # vim: syntax=cmake
-if(ENABLE_PRIMITIVES_VEC)
-    add_definitions(-DENABLE_VECTOR_PRIMITIVES=1)
-endif(ENABLE_PRIMITIVES_VEC)
-if(ENABLE_PRIMITIVES_ASM)
-    add_definitions(-DENABLE_ASM_PRIMITIVES=1)
-endif(ENABLE_PRIMITIVES_ASM)
+if(ENABLE_ASSEMBLY)
+    add_definitions(-DENABLE_ASSEMBLY=1)
+endif(ENABLE_ASSEMBLY)
 
 set(LIBCOMMON_HDR
     ../Lib/TLibCommon/CommonDef.h
@@ -68,51 +65,48 @@ if(MSVC)
     endif()
 endif(MSVC)
 
-if(ENABLE_PRIMITIVES_VEC)
-    set(SSE3  vec/dct-sse3.cpp  vec/blockcopy-sse3.cpp)
-    set(SSSE3 vec/dct-ssse3.cpp vec/ipfilter-ssse3.cpp vec/intra-ssse3.cpp)
-    set(SSE41 vec/dct-sse41.cpp vec/ipfilter-sse41.cpp vec/intra-sse41.cpp)
+set(SSE3  vec/dct-sse3.cpp  vec/blockcopy-sse3.cpp)
+set(SSSE3 vec/dct-ssse3.cpp vec/ipfilter-ssse3.cpp vec/intra-ssse3.cpp)
+set(SSE41 vec/dct-sse41.cpp vec/ipfilter-sse41.cpp vec/intra-sse41.cpp)
 
-    if (MSVC)
+if (MSVC)
+    set(PRIMITIVES ${SSE3} ${SSSE3} ${SSE41})
+    # wd4127 conditional expression is constant
+    # wd4244 'argument' : conversion from 'int' to 'char', possible loss of data
+    # wd4100 unreferenced formal parameter
+    set(WARNDISABLE "/wd4244 /wd4127 /wd4100")
+    if (INTEL_CXX)
+        add_definitions(/Qwd111) # statement is unreachable
+        add_definitions(/Qwd128) # loop is unreachable
+        add_definitions(/Qwd177) # declared function is unused
+        add_definitions(/Qwd185) # dynamic initialization in unreachable code
+        add_definitions(/Qwd280) # conditional expression is constant
+    endif()
+    if (X64)
+        set_source_files_properties(${SSE3} ${SSSE3} ${SSE41} PROPERTIES COMPILE_FLAGS "${WARNDISABLE}")
+    else()
+        # x64 implies SSE4, so only add /arch:SSE2 if building for Win32
+        set_source_files_properties(${SSE3} ${SSSE3} ${SSE41} PROPERTIES COMPILE_FLAGS "${WARNDISABLE} /arch:SSE2")
+    endif()
+endif()
+if(GCC)
+    if(CLANG)
+        # llvm intrinsic headers cause shadow warnings
+        set(WARNDISABLE "-Wno-shadow -Wno-unused-parameter")
+    else()
+        set(WARNDISABLE "-Wno-unused-parameter")
+    endif()
+    if(INTEL_CXX OR CLANG OR (NOT GCC_VERSION VERSION_LESS 4.3))
         set(PRIMITIVES ${SSE3} ${SSSE3} ${SSE41})
-        # wd4127 conditional expression is constant
-        # wd4244 'argument' : conversion from 'int' to 'char', possible loss of data
-        # wd4100 unreferenced formal parameter
-        set(WARNDISABLE "/wd4244 /wd4127 /wd4100")
-        if (INTEL_CXX)
-            add_definitions(/Qwd111) # statement is unreachable
-            add_definitions(/Qwd128) # loop is unreachable
-            add_definitions(/Qwd177) # declared function is unused
-            add_definitions(/Qwd185) # dynamic initialization in unreachable code
-            add_definitions(/Qwd280) # conditional expression is constant
-        endif()
-        if (X64)
-            set_source_files_properties(${SSE3} ${SSSE3} ${SSE41} PROPERTIES COMPILE_FLAGS "${WARNDISABLE}")
-        else()
-            # x64 implies SSE4, so only add /arch:SSE2 if building for Win32
-            set_source_files_properties(${SSE3} ${SSSE3} ${SSE41} PROPERTIES COMPILE_FLAGS "${WARNDISABLE} /arch:SSE2")
-        endif()
+        set_source_files_properties(${SSE3}  PROPERTIES COMPILE_FLAGS "${WARNDISABLE} -msse3")
+        set_source_files_properties(${SSSE3} PROPERTIES COMPILE_FLAGS "${WARNDISABLE} -mssse3")
+        set_source_files_properties(${SSE41} PROPERTIES COMPILE_FLAGS "${WARNDISABLE} -msse4.1")
     endif()
-    if(GCC)
-        if(CLANG)
-            # llvm intrinsic headers cause shadow warnings
-            set(WARNDISABLE "-Wno-shadow -Wno-unused-parameter")
-        else()
-            set(WARNDISABLE "-Wno-unused-parameter")
-        endif()
-        if(INTEL_CXX OR CLANG OR (NOT GCC_VERSION VERSION_LESS 4.3))
-            set(PRIMITIVES ${SSE3} ${SSSE3} ${SSE41})
-            set_source_files_properties(${SSE3}  PROPERTIES COMPILE_FLAGS "${WARNDISABLE} -msse3")
-            set_source_files_properties(${SSSE3} PROPERTIES COMPILE_FLAGS "${WARNDISABLE} -mssse3")
-            set_source_files_properties(${SSE41} PROPERTIES COMPILE_FLAGS "${WARNDISABLE} -msse4.1")
-        endif()
-    endif(GCC)
+endif(GCC)
+set(VEC_PRIMITIVES vec/vec-primitives.cpp ${PRIMITIVES})
+source_group(Intrinsics FILES ${VEC_PRIMITIVES})
 
-    set(VEC_PRIMITIVES vec/vec-primitives.cpp ${PRIMITIVES})
-    source_group(Intrinsics FILES ${VEC_PRIMITIVES})
-endif(ENABLE_PRIMITIVES_VEC)
-
-if(ENABLE_PRIMITIVES_ASM)
+if(ENABLE_ASSEMBLY)
     set(C_SRCS asm-primitives.cpp pixel.h mc.h ipfilter8.h blockcopy8.h dct8.h)
     set(A_SRCS pixel-a.asm const-a.asm cpu-a.asm ssd-a.asm mc-a.asm
                mc-a2.asm ipfilter8.asm pixel-util8.asm blockcopy8.asm intrapred8.asm
@@ -138,7 +132,8 @@ if(ENABLE_PRIMITIVES_ASM)
     foreach(SRC ${A_SRCS} ${C_SRCS})
         set(ASM_PRIMITIVES ${ASM_PRIMITIVES} x86/${SRC})
     endforeach()
-endif(ENABLE_PRIMITIVES_ASM)
+    source_group(Assembly FILES ${ASM_PRIMITIVES})
+endif(ENABLE_ASSEMBLY)
 
 if(GCC)
     if (NOT X64)
diff -r 67d755e2a30c -r 97e917c4a923 source/common/cpu.cpp
--- a/source/common/cpu.cpp	Thu Dec 05 13:51:59 2013 -0600
+++ b/source/common/cpu.cpp	Thu Dec 05 20:13:39 2013 -0600
@@ -290,7 +290,7 @@ uint32_t cpu_detect(void)
 }
 }
 
-#if !ENABLE_ASM_PRIMITIVES
+#if !ENABLE_ASSEMBLY
 
 #if defined(_MSC_VER)
 #include <intrin.h>
@@ -349,4 +349,4 @@ void x265_cpu_xgetbv(uint32_t op, uint32
     *edx = (uint32_t)(out >> 32);
 }
 }
-#endif // if !ENABLE_ASM_PRIMITIVES
+#endif // if !ENABLE_ASSEMBLY
diff -r 67d755e2a30c -r 97e917c4a923 source/common/intrapred.cpp
--- a/source/common/intrapred.cpp	Thu Dec 05 13:51:59 2013 -0600
+++ b/source/common/intrapred.cpp	Thu Dec 05 20:13:39 2013 -0600
@@ -306,7 +306,7 @@ void Setup_C_IPredPrimitives(EncoderPrim
     p.intra_pred[BLOCK_8x8][1] = intra_pred_dc_c<8>;
     p.intra_pred[BLOCK_16x16][1] = intra_pred_dc_c<16>;
     p.intra_pred[BLOCK_32x32][1] = intra_pred_dc_c<32>;
-    for (int i = 2; i < NUM_INTRA_MODE - 1; i++)
+    for (int i = 2; i < NUM_INTRA_MODE; i++)
     {
         p.intra_pred[BLOCK_4x4][i] = intra_pred_ang_c<4>;
         p.intra_pred[BLOCK_8x8][i] = intra_pred_ang_c<8>;
diff -r 67d755e2a30c -r 97e917c4a923 source/common/primitives.cpp
--- a/source/common/primitives.cpp	Thu Dec 05 13:51:59 2013 -0600
+++ b/source/common/primitives.cpp	Thu Dec 05 20:13:39 2013 -0600
@@ -122,11 +122,9 @@ void x265_setup_primitives(x265_param *p
     }
 
     Setup_C_Primitives(primitives);
+    Setup_Instrinsic_Primitives(primitives, cpuid);
 
-#if ENABLE_VECTOR_PRIMITIVES
-    Setup_Vector_Primitives(primitives, cpuid);
-#endif
-#if ENABLE_ASM_PRIMITIVES
+#if ENABLE_ASSEMBLY
     Setup_Assembly_Primitives(primitives, cpuid);
 #endif
 
@@ -145,20 +143,13 @@ void x265_setup_primitives(x265_param *p
     primitives.sa8d_inter[LUMA_16x12] = primitives.satd[LUMA_16x12];
     primitives.sa8d_inter[LUMA_12x16] = primitives.satd[LUMA_12x16];
 
-#if ENABLE_VECTOR_PRIMITIVES && ENABLE_ASM_PRIMITIVES
-    /* no logging if full optimizations are enabled */
-#elif ENABLE_ASM_PRIMITIVES
-    x265_log(param, X265_LOG_INFO, "performance primitives: only assembly\n");
-#elif ENABLE_VECTOR_PRIMITIVES
-    x265_log(param, X265_LOG_INFO, "performance primitives: only intrinsics\n");
-#else
-    x265_log(param, X265_LOG_INFO, "performance primitives: none\n");
+#if !ENABLE_ASSEMBLY
+    x265_log(param, X265_LOG_WARNING, "Assembly not supported in this binary\n");
 #endif
 }
 
-#if !defined(ENABLE_ASM_PRIMITIVES)
+#if !defined(ENABLE_ASSEMBLY)
 // the intrinsic primitives will not use MMX instructions, so if assembly
 // is disabled there should be no reason to use EMMS.
 extern "C" void x265_cpu_emms(void) {}
-
 #endif
diff -r 67d755e2a30c -r 97e917c4a923 source/common/primitives.h
--- a/source/common/primitives.h	Thu Dec 05 13:51:59 2013 -0600
+++ b/source/common/primitives.h	Thu Dec 05 20:13:39 2013 -0600
@@ -35,7 +35,7 @@
 
 #define FENC_STRIDE 64
 
-#define NUM_INTRA_MODE 36   // copy from CommonDef.h
+#define NUM_INTRA_MODE 35
 
 #if defined(__GNUC__)
 #define ALIGN_VAR_8(T, var)  T var __attribute__((aligned(8)))
@@ -250,9 +250,9 @@ struct EncoderPrimitives


More information about the x265-commits mailing list