[x265-commits] [x265] cmake: add parens to fix icpc builds of intrinsic primitives

Steve Borho steve at borho.org
Fri Oct 11 08:04:56 CEST 2013


details:   http://hg.videolan.org/x265/rev/7320ecd0901c
branches:  
changeset: 4375:7320ecd0901c
user:      Steve Borho <steve at borho.org>
date:      Thu Oct 10 22:11:58 2013 -0500
description:
cmake: add parens to fix icpc builds of intrinsic primitives
Subject: [x265] cmake: cleanup compiler determination

details:   http://hg.videolan.org/x265/rev/95f8e0c146b8
branches:  
changeset: 4376:95f8e0c146b8
user:      Steve Borho <steve at borho.org>
date:      Thu Oct 10 22:34:38 2013 -0500
description:
cmake: cleanup compiler determination
Subject: [x265] cmake: make intel C++ compiler detection independent of env vars

details:   http://hg.videolan.org/x265/rev/e282601b92d6
branches:  
changeset: 4377:e282601b92d6
user:      Steve Borho <steve at borho.org>
date:      Fri Oct 11 00:21:12 2013 -0500
description:
cmake: make intel C++ compiler detection independent of env vars
Subject: [x265] cmake: repair ICL nmake builds - do not use yasm custom rule with nmake

details:   http://hg.videolan.org/x265/rev/57e6b2cf633d
branches:  
changeset: 4378:57e6b2cf633d
user:      Steve Borho <steve at borho.org>
date:      Thu Oct 10 22:50:06 2013 -0500
description:
cmake: repair ICL nmake builds - do not use yasm custom rule with nmake
Subject: [x265] cmake: default value for X265_VERSION

details:   http://hg.videolan.org/x265/rev/b6756c2e6386
branches:  
changeset: 4379:b6756c2e6386
user:      Min Chen <chenm003 at 163.com>
date:      Fri Oct 11 13:12:21 2013 +0800
description:
cmake: default value for X265_VERSION
Subject: [x265] pixel: allow clang to build AVX2 pixel primitives functions

details:   http://hg.videolan.org/x265/rev/0fabe33e0448
branches:  
changeset: 4380:0fabe33e0448
user:      Steve Borho <steve at borho.org>
date:      Thu Oct 10 23:39:32 2013 -0500
description:
pixel: allow clang to build AVX2 pixel primitives functions
Subject: [x265] pixel: remove unreferenced sse_pp4 function

details:   http://hg.videolan.org/x265/rev/fa480d5c2166
branches:  
changeset: 4381:fa480d5c2166
user:      Steve Borho <steve at borho.org>
date:      Fri Oct 11 00:35:31 2013 -0500
description:
pixel: remove unreferenced sse_pp4 function
Subject: [x265] pixel: remove unreferenced cvt16to32_t and cvt32to16_t primitives

details:   http://hg.videolan.org/x265/rev/9bbaa60db38b
branches:  
changeset: 4382:9bbaa60db38b
user:      Steve Borho <steve at borho.org>
date:      Fri Oct 11 00:42:04 2013 -0500
description:
pixel: remove unreferenced cvt16to32_t and cvt32to16_t primitives
Subject: [x265] piclist: ensure a TComPic is not enqueued in two lists at once

details:   http://hg.videolan.org/x265/rev/7134a091a71d
branches:  
changeset: 4383:7134a091a71d
user:      Steve Borho <steve at borho.org>
date:      Thu Oct 10 17:21:36 2013 -0500
description:
piclist: ensure a TComPic is not enqueued in two lists at once

diffstat:

 source/CMakeLists.txt             |  24 ++++++++++++++-------
 source/cmake/version.cmake        |   4 +++
 source/common/CMakeLists.txt      |  28 +++++++++++++-------------
 source/common/piclist.cpp         |   2 +
 source/common/pixel.cpp           |  18 ----------------
 source/common/primitives.h        |   4 ---
 source/common/vec/pixel-avx2.cpp  |   2 +-
 source/common/vec/pixel-sse3.cpp  |  42 ---------------------------------------
 source/common/vec/pixel-sse41.cpp |  26 +----------------------
 9 files changed, 39 insertions(+), 111 deletions(-)

diffs (truncated from 361 to 300 lines):

diff -r 71fca64942a6 -r 7134a091a71d source/CMakeLists.txt
--- a/source/CMakeLists.txt	Thu Oct 10 15:36:31 2013 -0500
+++ b/source/CMakeLists.txt	Thu Oct 10 17:21:36 2013 -0500
@@ -22,7 +22,18 @@ if (APPLE)
   add_definitions(-DMACOS)
 endif()
 
-if("$ENV{CXX}" STREQUAL "icl")
+if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
+    set(CLANG 1)
+endif()
+if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel")
+    set(INTEL_CXX 1)
+endif()
+if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
+    set(GCC 1)
+endif()
+
+if(INTEL_CXX AND WIN32)
+    # treat icl roughly like MSVC
     set(MSVC 1)
 endif()
 if(MSVC)
@@ -41,15 +52,12 @@ if(MSVC)
     include_directories(compat/msvc)
 endif(MSVC)
 
-if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
-    set(CLANG 1)
-endif()
-if("$ENV{CXX}" STREQUAL "icpc")
+if(INTEL_CXX AND UNIX)
+    # treat icpc roughly like gcc
     set(GCC 1)
     add_definitions(-Wall -Wextra -Wshadow -no-vec)
 elseif(CMAKE_COMPILER_IS_GNUCXX)
     execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
-    set(GCC 1)
     add_definitions(-Wall -Wextra -Wshadow -mstackrealign -ffast-math)
     if(NOT GCC_VERSION VERSION_LESS 4.7)
         # this is necessary to avoid name conflicts in vector class
@@ -104,7 +112,7 @@ if(ENABLE_STLPORT)
     # STLPort headers must be included before system headers
     include_directories(BEFORE ${STLPORT_LOCATION}/stlport)
     link_directories(${STLPORT_LOCATION}/lib)
-    if("$ENV{CXX}" STREQUAL "icl")
+    if(INTEL_CXX)
         add_definitions(/Qwd1879)
     endif()
 endif(ENABLE_STLPORT)
@@ -141,7 +149,7 @@ add_subdirectory(encoder)
 
 add_library(x265-shared SHARED dllmain.cpp x265.def $<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common>)
 add_library(x265-static STATIC $<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common>)
-if(ENABLE_PRIMITIVES_ASM AND (MSVC OR XCODE))
+if(ENABLE_PRIMITIVES_ASM AND (MSVC_IDE OR XCODE))
     SET(EXTRA_LIBS ${EXTRA_LIBS} assembly)
 endif()
 target_link_libraries(x265-shared ${EXTRA_LIBS})
diff -r 71fca64942a6 -r 7134a091a71d source/cmake/version.cmake
--- a/source/cmake/version.cmake	Thu Oct 10 15:36:31 2013 -0500
+++ b/source/cmake/version.cmake	Thu Oct 10 17:21:36 2013 -0500
@@ -73,4 +73,8 @@ else()
     set(X265_VERSION "unknown")
 endif()
 
+if("${X265_VERSION}" STREQUAL "")
+    set(X265_VERSION "unknown"  CACHE STRING "x265 version string.")
+endif()
+
 message(STATUS "x265 version ${X265_VERSION}")
diff -r 71fca64942a6 -r 7134a091a71d source/common/CMakeLists.txt
--- a/source/common/CMakeLists.txt	Thu Oct 10 15:36:31 2013 -0500
+++ b/source/common/CMakeLists.txt	Thu Oct 10 17:21:36 2013 -0500
@@ -1,10 +1,3 @@
-if(GCC)
-    if (NOT X64)
-        # force gcc to generate code for sync primitives
-        set_source_files_properties(threadpool.cpp reference.cpp wavefront.cpp common.cpp PROPERTIES COMPILE_FLAGS -march=i686)
-    endif()
-endif(GCC)
-
 if(ENABLE_PRIMITIVES_VEC)
     add_definitions(-DENABLE_VECTOR_PRIMITIVES=1)
 endif(ENABLE_PRIMITIVES_VEC)
@@ -75,7 +68,7 @@ if(MSVC)
     # /wd4800 performance warning: bool coersion
     set_source_files_properties(${LIBCOMMON_SRC} PROPERTIES COMPILE_FLAGS 
         "/wd4244 /wd4512 /wd4127 /wd4389 /wd4018 /wd4800")
-    if ("$ENV{CXX}" STREQUAL "icl")
+    if (INTEL_CXX)
         add_definitions(/Qwd2557) # signed/unsigned mismatch
     endif()
 endif(MSVC)
@@ -84,7 +77,7 @@ if(ENABLE_PRIMITIVES_VEC)
     if (MSVC)
         add_definitions(/wd4127) # conditional expression is constant
         add_definitions(/wd4244) # 'argument' : conversion from 'int' to 'char', possible loss of data
-        if ("$ENV{CXX}" STREQUAL "icl")
+        if (INTEL_CXX)
             add_definitions(/Qwd111)    # statement is unreachable
             add_definitions(/Qwd128)    # loop is unreachable
             add_definitions(/Qwd177)    # declared function is unused
@@ -106,14 +99,14 @@ if(ENABLE_PRIMITIVES_VEC)
                 vec/intra-sse3.cpp vec/intra-sse41.cpp
                 PROPERTIES COMPILE_FLAGS /arch:SSE2)
         endif()
-        if (MSVC_VERSION EQUAL 1700 OR "$ENV{CXX}" STREQUAL "icl")
+        if (MSVC_VERSION EQUAL 1700 OR INTEL_CXX)
             set(PRIMITIVES ${PRIMITIVES} vec/blockcopy-avx2.cpp vec/pixel-avx2.cpp)
             set_source_files_properties(vec/blockcopy-avx2.cpp vec/pixel-avx2.cpp
                 PROPERTIES COMPILE_FLAGS /arch:AVX)
         endif()
     endif()
     if(GCC)
-        if("$ENV{CXX}" STREQUAL "icpc")
+        if(INTEL_CXX)
             add_definitions(-wd13200)  # function using MMX does not call EMMS
         endif()
         if(CLANG)
@@ -122,7 +115,7 @@ if(ENABLE_PRIMITIVES_VEC)
             # llvm reports these warnings for the vector class headers
             add_definitions(-Wno-shift-overflow -Wno-uninitialized)
         endif()
-        if("$ENV{CXX}" STREQUAL "icpc" OR CLANG OR NOT GCC_VERSION VERSION_LESS 4.3)
+        if(INTEL_CXX OR CLANG OR (NOT GCC_VERSION VERSION_LESS 4.3))
             set(PRIMITIVES vec/blockcopy-sse3.cpp
                 vec/pixel-sse3.cpp vec/pixel-ssse3.cpp vec/pixel-sse41.cpp
                 vec/ipfilter-ssse3.cpp vec/ipfilter-sse41.cpp
@@ -138,7 +131,7 @@ if(ENABLE_PRIMITIVES_VEC)
                 vec/pixel-sse41.cpp vec/ipfilter-sse41.cpp vec/dct-sse41.cpp vec/intra-sse41.cpp
                 PROPERTIES COMPILE_FLAGS "-msse4.1")
         endif()
-        if("$ENV{CXX}" STREQUAL "icpc" OR CLANG OR NOT GCC_VERSION VERSION_LESS 4.7)
+        if(INTEL_CXX OR CLANG OR (NOT GCC_VERSION VERSION_LESS 4.7))
             set(PRIMITIVES ${PRIMITIVES}
                 vec/blockcopy-avx2.cpp vec/pixel-avx2.cpp)
             set_source_files_properties(
@@ -189,7 +182,7 @@ if(ENABLE_PRIMITIVES_ASM)
                 DEPENDS ${ASM})
         endforeach()
         add_library(assembly STATIC x86/asm-primitives.cpp x86/pixel.h ${OBJS})
-    elseif(MSVC)
+    elseif(MSVC_IDE)
         # 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
@@ -217,6 +210,13 @@ if(ENABLE_PRIMITIVES_ASM)
     endif()
 endif(ENABLE_PRIMITIVES_ASM)
 
+if(GCC)
+    if (NOT X64)
+        # force gcc to generate code for sync primitives
+        set_source_files_properties(threadpool.cpp reference.cpp wavefront.cpp common.cpp PROPERTIES COMPILE_FLAGS -march=i686)
+    endif()
+endif(GCC)
+
 enable_language(ASM_YASM)
 add_library(common OBJECT
     ${LIBCOMMON_SRC} ${LIBCOMMON_HDR}
diff -r 71fca64942a6 -r 7134a091a71d source/common/piclist.cpp
--- a/source/common/piclist.cpp	Thu Oct 10 15:36:31 2013 -0500
+++ b/source/common/piclist.cpp	Thu Oct 10 17:21:36 2013 -0500
@@ -28,6 +28,7 @@ using namespace x265;
 
 void PicList::pushFront(TComPic& pic)
 {
+    assert(!pic.m_next && !pic.m_prev); // ensure pic is not in a list
     pic.m_next = m_start;
     pic.m_prev = NULL;
 
@@ -45,6 +46,7 @@ void PicList::pushFront(TComPic& pic)
 
 void PicList::pushBack(TComPic& pic)
 {
+    assert(!pic.m_next && !pic.m_prev); // ensure pic is not in a list
     pic.m_next = NULL;
     pic.m_prev = m_end;
 
diff -r 71fca64942a6 -r 7134a091a71d source/common/pixel.cpp
--- a/source/common/pixel.cpp	Thu Oct 10 15:36:31 2013 -0500
+++ b/source/common/pixel.cpp	Thu Oct 10 17:21:36 2013 -0500
@@ -428,14 +428,6 @@ void blockfil_s_c(short *dst, intptr_t d
     }
 }
 
-void convert16to32(short *src, int *dst, int num)
-{
-    for (int i = 0; i < num; i++)
-    {
-        dst[i] = (int)src[i];
-    }
-}
-
 void convert16to32_shl(int *dst, short *src, intptr_t stride, int shift, int size)
 {
     for (int i = 0; i < size; i++)
@@ -447,14 +439,6 @@ void convert16to32_shl(int *dst, short *
     }
 }
 
-void convert32to16(int *src, short *dst, int num)
-{
-    for (int i = 0; i < num; i++)
-    {
-        dst[i] = (short)src[i];
-    }
-}
-
 void convert32to16_shr(short *dst, int *src, int shift, int num)
 {
     int round = 1 << (shift - 1);
@@ -811,9 +795,7 @@ void Setup_C_PixelPrimitives(EncoderPrim
     p.blockfill_s[BLOCK_32x32] = blockfil_s_c<32>;
     p.blockfill_s[BLOCK_64x64] = blockfil_s_c<64>;
 
-    p.cvt16to32     = convert16to32;
     p.cvt16to32_shl = convert16to32_shl;
-    p.cvt32to16     = convert32to16;
     p.cvt32to16_shr = convert32to16_shr;
 
     p.sa8d[BLOCK_4x4]   = satd_4x4;
diff -r 71fca64942a6 -r 7134a091a71d source/common/primitives.h
--- a/source/common/primitives.h	Thu Oct 10 15:36:31 2013 -0500
+++ b/source/common/primitives.h	Thu Oct 10 17:21:36 2013 -0500
@@ -181,10 +181,8 @@ typedef void (*intra_planar_t)(pixel* ab
 typedef void (*intra_ang_t)(pixel* dst, int dstStride, int width, int dirMode, bool bFilter, pixel *refLeft, pixel *refAbove);
 typedef void (*intra_allangs_t)(pixel *dst, pixel *above0, pixel *left0, pixel *above1, pixel *left1, bool bLuma);
 
-typedef void (*cvt16to32_t)(short *src, int *dst, int);
 typedef void (*cvt16to32_shl_t)(int *dst, short *src, intptr_t, int, int);
 typedef void (*cvt16to16_shl_t)(short *dst, short *src, int, int, intptr_t, int);
-typedef void (*cvt32to16_t)(int *src, short *dst, int);
 typedef void (*cvt32to16_shr_t)(short *dst, int *src, int, int);
 
 typedef void (*dct_t)(short *src, int *dst, intptr_t stride);
@@ -225,10 +223,8 @@ struct EncoderPrimitives
     blockcpy_sp_t   blockcpy_sp;                // block copy short from pixel
     blockcpy_sc_t   blockcpy_sc;                // block copy short from unsigned char
     blockfill_s_t   blockfill_s[NUM_SQUARE_BLOCKS];  // block fill with value
-    cvt16to32_t     cvt16to32;
     cvt16to32_shl_t cvt16to32_shl;
     cvt16to16_shl_t cvt16to16_shl;
-    cvt32to16_t     cvt32to16;
     cvt32to16_shr_t cvt32to16_shr;
 
     ipfilter_pp_t   ipfilter_pp[NUM_IPFILTER_P_P];
diff -r 71fca64942a6 -r 7134a091a71d source/common/vec/pixel-avx2.cpp
--- a/source/common/vec/pixel-avx2.cpp	Thu Oct 10 15:36:31 2013 -0500
+++ b/source/common/vec/pixel-avx2.cpp	Thu Oct 10 17:21:36 2013 -0500
@@ -454,7 +454,7 @@ void Setup_Vec_PixelPrimitives_avx2(Enco
     p.sad_x4[PARTITION_##W##x##H] = sad_avx2_x4_##W<H>; \
 
 #if !HIGH_BIT_DEPTH 
-#if (defined(__GNUC__) || defined(__INTEL_COMPILER))
+#if (defined(__GNUC__) || defined(__INTEL_COMPILER)) || defined(__clang__)
     SET_SADS(32, 8);
     SET_SADS(32, 16);
     SET_SADS(32, 24);
diff -r 71fca64942a6 -r 7134a091a71d source/common/vec/pixel-sse3.cpp
--- a/source/common/vec/pixel-sse3.cpp	Thu Oct 10 15:36:31 2013 -0500
+++ b/source/common/vec/pixel-sse3.cpp	Thu Oct 10 17:21:36 2013 -0500
@@ -616,45 +616,6 @@ void calcRecons(pixel* pred, short* resi
 #include "vectorclass.h"
 
 namespace {
-void convert16to32(short *org, int *dst, int num)
-{
-    int i;
-
-    for (i = 0; i < num; i += 8)
-    {
-        Vec8s im16;
-        Vec4i im32L, im32H;
-
-        im16.load(org);
-        im32L = extend_low(im16);
-        im32H = extend_high(im16);
-        im32L.store(dst);
-        im32H.store(dst + 4);
-
-        org += 8;
-        dst += 8;
-    }
-}
-
-void convert32to16(int *org, short *dst, int num)
-{
-    int i;
-
-    for (i = 0; i < num; i += 8)
-    {
-        Vec4i im32L, im32H;
-        Vec8s im16;
-
-        im32L.load(org);
-        im32H.load(org + 4);
-        im16 = compress_saturated(im32L, im32H);
-        im16.store(dst);


More information about the x265-commits mailing list