[x265-commits] [x265] cmake: link cli app to shared library on POSIX systems (c...

Steve Borho steve at borho.org
Wed Mar 19 03:42:31 CET 2014


details:   http://hg.videolan.org/x265/rev/f91b930aea7e
branches:  
changeset: 6540:f91b930aea7e
user:      Steve Borho <steve at borho.org>
date:      Tue Mar 18 15:10:08 2014 -0500
description:
cmake: link cli app to shared library on POSIX systems (closes #37)

If you want the CLI to link against the static library on POSIX, just disable
the generation of the shared library.
Subject: [x265] cmake: fix uninstall target warnings from shell quote escaping issues

details:   http://hg.videolan.org/x265/rev/6a77b52eddcb
branches:  
changeset: 6541:6a77b52eddcb
user:      Steve Borho <steve at borho.org>
date:      Tue Mar 18 17:27:58 2014 -0500
description:
cmake: fix uninstall target warnings from shell quote escaping issues
Subject: [x265] cmake: make lib and bin install folders user configurable (closes #40)

details:   http://hg.videolan.org/x265/rev/a02a4ba9629e
branches:  
changeset: 6542:a02a4ba9629e
user:      Steve Borho <steve at borho.org>
date:      Tue Mar 18 17:29:08 2014 -0500
description:
cmake: make lib and bin install folders user configurable (closes #40)
Subject: [x265] cmake: remove /Oi build flag for Visual C++ builds

details:   http://hg.videolan.org/x265/rev/2a63de6cbb11
branches:  
changeset: 6543:2a63de6cbb11
user:      Steve Borho <steve at borho.org>
date:      Tue Mar 18 19:19:03 2014 -0500
description:
cmake: remove /Oi build flag for Visual C++ builds

This flag was actually never necessary for use of SIMD intrinsics, but it was
forcing VC to use intrinsic versions of math functions, and for some versions
of VC this caused odd stack corruption in Win32 debug builds.

https://connect.microsoft.com/VisualStudio/feedback/details/776885/possible-bug-in-visual-studio-2012-c-compiler-related-to-intrinsic-math-functions
Subject: [x265] frameencoder: clean up slice qp clipping

details:   http://hg.videolan.org/x265/rev/9167d2441670
branches:  
changeset: 6544:9167d2441670
user:      Deepthi Nandakumar <deepthi at multicorewareinc.com>
date:      Tue Mar 18 14:36:16 2014 +0530
description:
frameencoder: clean up slice qp clipping
Subject: [x265] intraPred: remove qp resets

details:   http://hg.videolan.org/x265/rev/d8d41f4cf354
branches:  
changeset: 6545:d8d41f4cf354
user:      Deepthi Nandakumar <deepthi at multicorewareinc.com>
date:      Tue Mar 18 16:43:00 2014 +0530
description:
intraPred: remove qp resets
Subject: [x265] TComDataCU: QP for a CU always stored in TComDataCU::m_qp.

details:   http://hg.videolan.org/x265/rev/591bceb1b87a
branches:  
changeset: 6546:591bceb1b87a
user:      Deepthi Nandakumar <deepthi at multicorewareinc.com>
date:      Wed Mar 19 06:53:32 2014 +0530
description:
TComDataCU: QP for a CU always stored in TComDataCU::m_qp.
Subject: [x265] cmake: fix MinGW build by forcing Vista as minimum target O/S (fixes #44)

details:   http://hg.videolan.org/x265/rev/45af76338c8e
branches:  
changeset: 6547:45af76338c8e
user:      Steve Borho <steve at borho.org>
date:      Tue Mar 18 21:35:37 2014 -0500
description:
cmake: fix MinGW build by forcing Vista as minimum target O/S (fixes #44)

This removes the WINXP_SUPPORT option; XP cannot be supported until someone
contributes a version of ThreadSafeInteger that is functional on XP

diffstat:

 source/CMakeLists.txt                 |  38 +++++++++++++++++++---------------
 source/Lib/TLibCommon/TComDataCU.cpp  |   4 +-
 source/Lib/TLibEncoder/TEncSearch.cpp |  10 ---------
 source/cmake/cmake_uninstall.cmake.in |   8 +++---
 source/encoder/frameencoder.cpp       |   3 +-
 5 files changed, 29 insertions(+), 34 deletions(-)

diffs (184 lines):

diff -r dc700298419d -r 45af76338c8e source/CMakeLists.txt
--- a/source/CMakeLists.txt	Tue Mar 18 08:46:15 2014 -0500
+++ b/source/CMakeLists.txt	Tue Mar 18 21:35:37 2014 -0500
@@ -86,7 +86,6 @@ if(MSVC)
     endif (STATIC_LINK_CRT)
     add_definitions(/W4)  # Full warnings
     add_definitions(/Ob2) # always inline
-    add_definitions(/Oi)  # enable intrinsics
     add_definitions(/MP)  # multithreaded build
 
     # disable Microsofts suggestions for proprietary secure APIs
@@ -115,7 +114,7 @@ elseif(CMAKE_COMPILER_IS_GNUCXX)
     endif()
     execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
 endif()
-if (GCC)
+if(GCC)
     if(X64 AND NOT WIN32)
         add_definitions(-fPIC)
     endif(X64 AND NOT WIN32)
@@ -139,6 +138,8 @@ if(YASM_FOUND AND X86)
 endif()
 
 # Build options
+set(LIB_INSTALL_DIR lib CACHE STRING "Install location of libraries")
+set(BIN_INSTALL_DIR bin CACHE STRING "Install location of executables")
 
 if(X64)
     # NOTE: We only officially support 16bit-per-pixel compiles of x265
@@ -190,11 +191,10 @@ if (WIN32)
         set(PLATFORM_LIBS ${PLATFORM_LIBS} ${VLD_LIBRARIES})
         link_directories(${VLD_LIBRARY_DIRS})
     endif()
-    option(WINXP_SUPPORT "Make binaries compatible with Windows XP" OFF)
-    if(WINXP_SUPPORT)
-        # force workarounds for atomic intrinsics introduced after XP
-        add_definitions(-D_WIN32_WINNT=_WIN32_WINNT_WINXP)
-    endif(WINXP_SUPPORT)
+    if(MINGW)
+        # MinGW requires a forced Windows version in order to use CONDITION_VARIABLE
+        add_definitions(-D_WIN32_WINNT=_WIN32_WINNT_VISTA)
+    endif(MINGW)
 endif()
 
 include(version) # determine X265_VERSION and X265_LATEST_TAG
@@ -245,9 +245,8 @@ if(NOT MSVC)
     set_target_properties(x265-static PROPERTIES OUTPUT_NAME x265)
 endif()
 install(TARGETS x265-static
-        RUNTIME DESTINATION bin
-        LIBRARY DESTINATION lib
-        ARCHIVE DESTINATION lib)
+    LIBRARY DESTINATION ${LIB_INSTALL_DIR}
+    ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
 install(FILES x265.h "${PROJECT_BINARY_DIR}/x265_config.h" DESTINATION include)
 
 if(CMAKE_RC_COMPILER)
@@ -283,9 +282,8 @@ if(ENABLE_SHARED)
         # shared library is not installed if a tag is not found
         set_target_properties(x265-shared PROPERTIES VERSION ${X265_LATEST_TAG} SOVERSION ${X265_BUILD})
         install(TARGETS x265-shared
-                RUNTIME DESTINATION bin
-                LIBRARY DESTINATION lib
-                ARCHIVE DESTINATION lib)
+                LIBRARY DESTINATION ${LIB_INSTALL_DIR}
+                ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
     endif()
 endif()
 
@@ -334,16 +332,22 @@ if(ENABLE_CLI)
     endif(NOT HAVE_GETOPT_H)
 
     if(XCODE)
+        # Xcode seems unable to link the CLI with libs, so link as one targget
         add_executable(cli ../COPYING ${InputFiles} ${OutputFiles} ${GETOPT} x265.cpp x265.h
                            $<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common> ${YASM_OBJS} ${YASM_SRCS})
     else()
-        add_executable(cli ../COPYING ${InputFiles} ${OutputFiles} ${GETOPT} ${X265_RC_FILE}
-                           x265.cpp x265.h)
-        target_link_libraries(cli x265-static ${PLATFORM_LIBS})
+        add_executable(cli ../COPYING ${InputFiles} ${OutputFiles} ${GETOPT} ${X265_RC_FILE} x265.cpp x265.h)
+        if(WIN32 OR NOT ENABLE_SHARED)
+            # The CLI cannot link to the shared library on Windows, it
+            # requires internal APIs not exported from the DLL
+            target_link_libraries(cli x265-static ${PLATFORM_LIBS})
+        else()
+            target_link_libraries(cli x265-shared ${PLATFORM_LIBS})
+        endif()
     endif()
     set_target_properties(cli PROPERTIES OUTPUT_NAME x265)
 
-    install(TARGETS cli DESTINATION bin)
+    install(TARGETS cli DESTINATION ${BIN_INSTALL_DIR})
 endif(ENABLE_CLI)
 
 if(ENABLE_ASSEMBLY AND NOT XCODE)
diff -r dc700298419d -r 45af76338c8e source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp	Tue Mar 18 08:46:15 2014 -0500
+++ b/source/Lib/TLibCommon/TComDataCU.cpp	Tue Mar 18 21:35:37 2014 -0500
@@ -227,7 +227,7 @@ void TComDataCU::initCU(TComPic* pic, ui
     m_totalDistortion  = 0;
     m_totalBits        = 0;
     m_numPartitions    = pic->getNumPartInCU();
-    int qp             = pic->m_lowres.invQscaleFactor ? pic->getCU(getAddr())->getQP(0) : m_slice->getSliceQp();
+    char* qp           = pic->getCU(getAddr())->getQP();
     m_baseQp           = pic->getCU(getAddr())->m_baseQp;
     for (int i = 0; i < 4; i++)
     {
@@ -249,7 +249,7 @@ void TComDataCU::initCU(TComPic* pic, ui
         memset(m_transformSkip[1],   0,             numElements * sizeof(*m_transformSkip[1]));
         memset(m_transformSkip[2],   0,             numElements * sizeof(*m_transformSkip[2]));
         memset(m_cuSize,             g_maxCUSize,   numElements * sizeof(*m_cuSize));
-        memset(m_qp,                 qp,            numElements * sizeof(*m_qp));
+        memcpy(m_qp,                 qp,            numElements * sizeof(*m_qp));
         memset(m_bMergeFlags,        false,         numElements * sizeof(*m_bMergeFlags));
         memset(m_lumaIntraDir,       DC_IDX,        numElements * sizeof(*m_lumaIntraDir));
         memset(m_chromaIntraDir,     0,             numElements * sizeof(*m_chromaIntraDir));
diff -r dc700298419d -r 45af76338c8e source/Lib/TLibEncoder/TEncSearch.cpp
--- a/source/Lib/TLibEncoder/TEncSearch.cpp	Tue Mar 18 08:46:15 2014 -0500
+++ b/source/Lib/TLibEncoder/TEncSearch.cpp	Tue Mar 18 21:35:37 2014 -0500
@@ -1480,16 +1480,6 @@ void TEncSearch::estIntraPredQT(TComData
     uint32_t puSizeIdx    = g_convertToBit[puSize]; // log2(puSize) - 2
     static const uint8_t intraModeNumFast[] = { 8, 8, 3, 3, 3 }; // 4x4, 8x8, 16x16, 32x32, 64x64
 
-    //===== set QP and clear Cbf =====
-    if (cu->getSlice()->getPPS()->getUseDQP() == true)
-    {
-        cu->setQPSubParts(cu->getQP(0), 0, depth);
-    }
-    else
-    {
-        cu->setQPSubParts(cu->getSlice()->getSliceQp(), 0, depth);
-    }
-
     //===== loop over partitions =====
     uint32_t partOffset = 0;
     for (uint32_t pu = 0; pu < numPU; pu++, partOffset += qNumParts)
diff -r dc700298419d -r 45af76338c8e source/cmake/cmake_uninstall.cmake.in
--- a/source/cmake/cmake_uninstall.cmake.in	Tue Mar 18 08:46:15 2014 -0500
+++ b/source/cmake/cmake_uninstall.cmake.in	Tue Mar 18 21:35:37 2014 -0500
@@ -1,5 +1,5 @@
 if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
-    message(FATAL_ERROR "Cannot find install manifest: "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt"")
+    message(FATAL_ERROR "Cannot find install manifest: '@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt'")
 endif()
 
 file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
@@ -7,13 +7,13 @@ string(REGEX REPLACE "\n" ";" files "${f
 foreach(file ${files})
     message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
     if(EXISTS "$ENV{DESTDIR}${file}" OR IS_SYMLINK "$ENV{DESTDIR}${file}")
-        exec_program("@CMAKE_COMMAND@" ARGS "-E remove "$ENV{DESTDIR}${file}""
+        exec_program("@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
                      OUTPUT_VARIABLE rm_out
                      RETURN_VALUE rm_retval)
         if(NOT "${rm_retval}" STREQUAL 0)
-            message(FATAL_ERROR "Problem when removing "$ENV{DESTDIR}${file}"")
+            message(FATAL_ERROR "Problem when removing '$ENV{DESTDIR}${file}'")
         endif(NOT "${rm_retval}" STREQUAL 0)
     else()
-        message(STATUS "File "$ENV{DESTDIR}${file}" does not exist.")
+        message(STATUS "File '$ENV{DESTDIR}${file}' does not exist.")
     endif()
 endforeach(file)
diff -r dc700298419d -r 45af76338c8e source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp	Tue Mar 18 08:46:15 2014 -0500
+++ b/source/encoder/frameencoder.cpp	Tue Mar 18 21:35:37 2014 -0500
@@ -413,7 +413,7 @@ void FrameEncoder::compressFrame()
     }
 
     /* Clip qps back to 0-51 range before encoding */
-    qp = X265_MIN(qp, MAX_QP);
+    qp = Clip3(-QP_BD_OFFSET, MAX_QP, qp);
     slice->setSliceQp(qp);
     m_pic->m_avgQpAq = qp;
     slice->setSliceQpDelta(0);
@@ -1028,6 +1028,7 @@ void FrameEncoder::processRowEncoder(int
         const uint32_t cuAddr = lineStartCUAddr + col;
         TComDataCU* cu = m_pic->getCU(cuAddr);
         cu->initCU(m_pic, cuAddr);
+        cu->setQPSubParts(m_pic->getSlice()->getSliceQp(), 0, 0);
 
         codeRow.m_entropyCoder.setEntropyCoder(&m_sbacCoder, m_pic->getSlice());
         codeRow.m_entropyCoder.resetEntropy();


More information about the x265-commits mailing list