[x265-commits] [x265] cmake: fix warning about ASM_YASM compiler being unknown

Steve Borho steve at borho.org
Fri Nov 1 19:11:36 CET 2013


details:   http://hg.videolan.org/x265/rev/1c5122851247
branches:  
changeset: 4812:1c5122851247
user:      Steve Borho <steve at borho.org>
date:      Thu Oct 31 19:33:03 2013 -0500
description:
cmake: fix warning about ASM_YASM compiler being unknown
Subject: [x265] cmake: remove assembly library to fix MSVC static lib

details:   http://hg.videolan.org/x265/rev/3716c9f588df
branches:  
changeset: 4813:3716c9f588df
user:      Steve Borho <steve at borho.org>
date:      Thu Oct 31 20:37:38 2013 -0500
description:
cmake: remove assembly library to fix MSVC static lib

This fixes the static library built by VisualStudio to include the assembly
objects.  It has the side effect of causing the assembly objects to be built
once for the static lib and once for the shared lib, which can be avoided by
unloading the shared lib project while you are working on assembly within
VisualStudio
Subject: [x265] cmake: remove obsolete build flags

details:   http://hg.videolan.org/x265/rev/a1502a1f1fa2
branches:  
changeset: 4814:a1502a1f1fa2
user:      Steve Borho <steve at borho.org>
date:      Fri Nov 01 12:01:13 2013 -0500
description:
cmake: remove obsolete build flags
Subject: [x265] cmake: add Visual Studio 2013 build folder

details:   http://hg.videolan.org/x265/rev/d7986ac66bc1
branches:  
changeset: 4815:d7986ac66bc1
user:      Neil Piken <neilpiken at gmail.com>
date:      Sun Oct 27 06:15:32 2013 +0800
description:
cmake: add Visual Studio 2013 build folder
Subject: [x265] cmake: drop STLport support, it is no longer necessary

details:   http://hg.videolan.org/x265/rev/a3d07bee1316
branches:  
changeset: 4816:a3d07bee1316
user:      Steve Borho <steve at borho.org>
date:      Fri Nov 01 12:05:31 2013 -0500
description:
cmake: drop STLport support, it is no longer necessary
Subject: [x265] rc: replace tabs with spaces

details:   http://hg.videolan.org/x265/rev/0d79e31728a4
branches:  
changeset: 4817:0d79e31728a4
user:      Steve Borho <steve at borho.org>
date:      Fri Nov 01 13:05:34 2013 -0500
description:
rc: replace tabs with spaces

diffstat:

 build/vc12-x86/build-all.bat                      |  14 ++++
 build/vc12-x86/make-solutions.bat                 |   6 ++
 build/vc12-x86_64/build-all.bat                   |  14 ++++
 build/vc12-x86_64/make-solutions.bat              |   6 ++
 source/CMakeLists.txt                             |  47 +++++++++------
 source/cmake/CMakeDetermineASM_YASMCompiler.cmake |   1 +
 source/common/CMakeLists.txt                      |  66 +++-------------------
 source/encoder/ratecontrol.cpp                    |  46 ++++++++--------
 8 files changed, 101 insertions(+), 99 deletions(-)

diffs (truncated from 314 to 300 lines):

diff -r bd53cb226710 -r 0d79e31728a4 build/vc12-x86/build-all.bat
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/build/vc12-x86/build-all.bat	Fri Nov 01 13:05:34 2013 -0500
@@ -0,0 +1,14 @@
+ at echo off
+if "%VS120COMNTOOLS%" == "" (
+  msg "%username%" "Visual Studio 12 not detected"
+  exit 1
+)
+if not exist x265.sln (
+  call make-solutions.bat
+)
+if exist x265.sln (
+  call "%VS120COMNTOOLS%\..\..\VC\vcvarsall.bat"
+  MSBuild /property:Configuration="Release" x265.sln
+  MSBuild /property:Configuration="Debug" x265.sln
+  MSBuild /property:Configuration="RelWithDebInfo" x265.sln
+)
diff -r bd53cb226710 -r 0d79e31728a4 build/vc12-x86/make-solutions.bat
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/build/vc12-x86/make-solutions.bat	Fri Nov 01 13:05:34 2013 -0500
@@ -0,0 +1,6 @@
+ at echo off
+::
+:: run this batch file to create a Visual Studio solution file for this project.
+:: See the cmake documentation for other generator targets
+::
+cmake -G "Visual Studio 12" ..\..\source && cmake-gui ..\..\source
diff -r bd53cb226710 -r 0d79e31728a4 build/vc12-x86_64/build-all.bat
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/build/vc12-x86_64/build-all.bat	Fri Nov 01 13:05:34 2013 -0500
@@ -0,0 +1,14 @@
+ at echo off
+if "%VS120COMNTOOLS%" == "" (
+  msg "%username%" "Visual Studio 12 not detected"
+  exit 1
+)
+if not exist x265.sln (
+  call make-solutions.bat
+)
+if exist x265.sln (
+  call "%VS120COMNTOOLS%\..\..\VC\vcvarsall.bat"
+  MSBuild /property:Configuration="Release" x265.sln
+  MSBuild /property:Configuration="Debug" x265.sln
+  MSBuild /property:Configuration="RelWithDebInfo" x265.sln
+)
diff -r bd53cb226710 -r 0d79e31728a4 build/vc12-x86_64/make-solutions.bat
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/build/vc12-x86_64/make-solutions.bat	Fri Nov 01 13:05:34 2013 -0500
@@ -0,0 +1,6 @@
+ at echo off
+::
+:: run this batch file to create a Visual Studio solution file for this project.
+:: See the cmake documentation for other generator targets
+::
+cmake -G "Visual Studio 12 Win64" ..\..\source && cmake-gui ..\..\source
diff -r bd53cb226710 -r 0d79e31728a4 source/CMakeLists.txt
--- a/source/CMakeLists.txt	Thu Oct 31 17:33:31 2013 -0500
+++ b/source/CMakeLists.txt	Fri Nov 01 13:05:34 2013 -0500
@@ -120,22 +120,11 @@ if(UNIX)
     endif(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
 endif(UNIX)
 
-option(ENABLE_STLPORT "Enable use of STLPort STL replacement library" OFF)
-if(ENABLE_STLPORT)
-    set(STLPORT_LOCATION "${STLPORT_INCLUDE_DIR}" CACHE PATH "Location of STLPort sources")
-    # STLPort headers must be included before system headers
-    include_directories(BEFORE ${STLPORT_LOCATION}/stlport)
-    link_directories(${STLPORT_LOCATION}/lib)
-    if(INTEL_CXX)
-        add_definitions(/Qwd1879)
-    endif()
-endif(ENABLE_STLPORT)
-
 option(ENABLE_PPA "Enable PPA profiling instrumentation" OFF)
 if(ENABLE_PPA)
     add_definitions(-DENABLE_PPA)
     add_subdirectory(PPA)
-    SET(EXTRA_LIBS ${EXTRA_LIBS} PPA)
+    SET(PLATFORM_LIBS ${PLATFORM_LIBS} PPA)
     if(UNIX)
         SET(PLATFORM_LIBS ${PLATFORM_LIBS} dl)
     endif(UNIX)
@@ -162,14 +151,34 @@ include_directories(. Lib common encoder
 add_subdirectory(common)
 add_subdirectory(encoder)
 
-add_library(x265-static STATIC $<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common>)
-add_library(x265-shared SHARED dllmain.cpp "${PROJECT_BINARY_DIR}/x265.def"
+if(MSVC_IDE AND ENABLE_PRIMITIVES_ASM)
+    # 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
+    if (X64)
+        set(FLAGS -f win64 -m amd64 -DARCH_X86_64=1 -DHAVE_ALIGNED_STACK=0)
+    else()
+        set(FLAGS -f win32 -DARCH_X86_64=0 -DHAVE_ALIGNED_STACK=0 -DPREFIX)
+    endif()
+    if (HIGH_BIT_DEPTH)
+        set(FLAGS ${FLAGS} -DHIGH_BIT_DEPTH=1 -DBIT_DEPTH=10)
+    else()
+        set(FLAGS ${FLAGS} -DHIGH_BIT_DEPTH=0 -DBIT_DEPTH=8)
+    endif()
+    foreach(ASM ${MSVC_ASMS})
+        set(YASM_SRC ${CMAKE_CURRENT_SOURCE_DIR}/common/x86/${ASM})
+        set(YASM_SRCS ${YASM_SRCS} ${YASM_SRC})
+        set(YASM_OBJS ${YASM_OBJS} ${ASM}.obj)
+        add_custom_command(
+            OUTPUT ${ASM}.obj
+            COMMAND ${YASM_EXECUTABLE} ARGS ${FLAGS} ${YASM_SRC} -o ${ASM}.obj
+            DEPENDS ${YASM_SRC})
+    endforeach()
+endif()
+
+add_library(x265-static STATIC $<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common> ${YASM_OBJS} ${YASM_SRCS})
+add_library(x265-shared SHARED dllmain.cpp "${PROJECT_BINARY_DIR}/x265.def" ${YASM_OBJS}
                                $<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common>)
-if(ENABLE_PRIMITIVES_ASM AND (MSVC_IDE OR XCODE))
-    SET(EXTRA_LIBS ${EXTRA_LIBS} assembly)
-endif()
-target_link_libraries(x265-shared ${EXTRA_LIBS})
-target_link_libraries(x265-static ${EXTRA_LIBS})
 set_target_properties(x265-shared PROPERTIES OUTPUT_NAME x265)
 if(NOT MSVC)
     set_target_properties(x265-static PROPERTIES OUTPUT_NAME x265)
diff -r bd53cb226710 -r 0d79e31728a4 source/cmake/CMakeDetermineASM_YASMCompiler.cmake
--- a/source/cmake/CMakeDetermineASM_YASMCompiler.cmake	Thu Oct 31 17:33:31 2013 -0500
+++ b/source/cmake/CMakeDetermineASM_YASMCompiler.cmake	Fri Nov 01 13:05:34 2013 -0500
@@ -1,4 +1,5 @@
 set(ASM_DIALECT "_YASM")
+set(CMAKE_ASM${ASM_DIALECT}_COMPILER yasm)
 set(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT ${_CMAKE_TOOLCHAIN_PREFIX}yasm)
 include(CMakeDetermineASMCompiler)
 set(ASM_DIALECT)
diff -r bd53cb226710 -r 0d79e31728a4 source/common/CMakeLists.txt
--- a/source/common/CMakeLists.txt	Thu Oct 31 17:33:31 2013 -0500
+++ b/source/common/CMakeLists.txt	Fri Nov 01 13:05:34 2013 -0500
@@ -69,7 +69,9 @@ if(MSVC)
 endif(MSVC)
 
 if(ENABLE_PRIMITIVES_VEC)
-    include_directories(../VectorClass)
+    if(HIGH_BIT_DEPTH)
+        include_directories(../VectorClass)
+    endif()
     if (MSVC)
         add_definitions(/wd4127) # conditional expression is constant
         add_definitions(/wd4244) # 'argument' : conversion from 'int' to 'char', possible loss of data
@@ -79,7 +81,6 @@ if(ENABLE_PRIMITIVES_VEC)
             add_definitions(/Qwd177)    # declared function is unused
             add_definitions(/Qwd185)    # dynamic initialization in unreachable code
             add_definitions(/Qwd280)    # conditional expression is constant
-            add_definitions(/Qwd13200)  # function using MMX does not call EMMS
         endif()
         set(PRIMITIVES vec/blockcopy-sse3.cpp
             vec/pixel-sse3.cpp vec/pixel-ssse3.cpp vec/pixel-sse41.cpp
@@ -102,9 +103,6 @@ if(ENABLE_PRIMITIVES_VEC)
         endif()
     endif()
     if(GCC)
-        if(INTEL_CXX)
-            add_definitions(-wd13200)  # function using MMX does not call EMMS
-        endif()
         if(CLANG)
             # llvm intrinsic headers trigger this warning
             add_definitions(-Wno-shadow)
@@ -140,13 +138,6 @@ if(ENABLE_PRIMITIVES_VEC)
 endif(ENABLE_PRIMITIVES_VEC)
 
 if(ENABLE_PRIMITIVES_ASM)
-    if (GCC)
-        add_definitions(-DHAVE_ALIGNED_STACK=1)
-        add_definitions(-Wno-error=unused-parameter)
-    else()
-        add_definitions(-DHAVE_ALIGNED_STACK=0)
-    endif()
-
     set(ASMS pixel-a.asm const-a.asm cpu-a.asm sad-a.asm mc-a.asm mc-a2.asm ipfilter8.asm pixel-util.asm)
     if (X64)
         add_definitions(-DARCH_X86_64=1)
@@ -154,54 +145,16 @@ if(ENABLE_PRIMITIVES_ASM)
         add_definitions(-DARCH_X86_64=0)
         set(ASMS ${ASMS} pixel-32.asm)
     endif()
-    foreach(ASM ${ASMS})
-        set(FULLPATHASM ${FULLPATHASM} x86/${ASM})
-    endforeach()
 
-    if(XCODE)
-        if (X64)
-            set(FLAGS -f macho64 -m amd64 -DPREFIX -DPIC -DARCH_X86_64=1 -DHAVE_ALIGNED_STACK=1)
-        else()
-            set(FLAGS -f macho -DPREFIX -DPIC -DARCH_X86_64=0 -DHAVE_ALIGNED_STACK=1)
-        endif()
-        if (HIGH_BIT_DEPTH)
-            set(FLAGS ${FLAGS} -DHIGH_BIT_DEPTH=1 -DBIT_DEPTH=10)
-        else()
-            set(FLAGS ${FLAGS} -DHIGH_BIT_DEPTH=0 -DBIT_DEPTH=8)
-        endif()
+    set(ASM_PRIMITIVES x86/asm-primitives.cpp x86/pixel.h x86/mc.h x86/ipfilter8.h)
+    if(MSVC_IDE)
+        set(MSVC_ASMS "${ASMS}" CACHE INTERNAL "yasm sources")
+        source_group(Assembly FILES ${ASM_PRIMITIVES})
+    else()
         foreach(ASM ${ASMS})
-            set(OBJS ${OBJS} ${ASM}.o)
-            add_custom_command(
-                OUTPUT ${ASM}.o
-                COMMAND ${YASM_EXECUTABLE} ARGS ${FLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/x86/${ASM} -o ${ASM}.o
-                DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/x86/${ASM})
+            set(ASM_PRIMITIVES ${ASM_PRIMITIVES} x86/${ASM})
         endforeach()
-        add_library(assembly STATIC x86/asm-primitives.cpp x86/pixel.h x86/mc.h x86/ipfilter8.h ${OBJS})
-    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
-        if (X64)
-            set(FLAGS -f win64 -m amd64 -DARCH_X86_64=1 -DHAVE_ALIGNED_STACK=0)
-        else()
-            set(FLAGS -f win32 -DARCH_X86_64=0 -DHAVE_ALIGNED_STACK=0 -DPREFIX)
-        endif()
-        if (HIGH_BIT_DEPTH)
-            set(FLAGS ${FLAGS} -DHIGH_BIT_DEPTH=1 -DBIT_DEPTH=10)
-        else()
-            set(FLAGS ${FLAGS} -DHIGH_BIT_DEPTH=0 -DBIT_DEPTH=8)
-        endif()
-        foreach(ASM ${ASMS})
-            set(OBJS ${OBJS} ${ASM}.obj)
-            add_custom_command(
-                OUTPUT ${ASM}.obj
-                COMMAND ${YASM_EXECUTABLE} ARGS ${FLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/x86/${ASM} -o ${ASM}.obj
-                DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/x86/${ASM})
-        endforeach()
-        add_library(assembly STATIC x86/asm-primitives.cpp x86/pixel.h x86/mc.h x86/ipfilter8.h ${FULLPATHASM} ${OBJS})
-    else()
         enable_language(ASM_YASM)
-        set(ASM_PRIMITIVES x86/asm-primitives.cpp x86/pixel.h x86/mc.h x86/ipfilter8.h ${FULLPATHASM})
     endif()
 endif(ENABLE_PRIMITIVES_ASM)
 
@@ -214,7 +167,6 @@ if(GCC)
 endif(GCC)
 set_source_files_properties(version.cpp PROPERTIES COMPILE_FLAGS -DX265_VERSION=${X265_VERSION})
 
-enable_language(ASM_YASM)
 add_library(common OBJECT
     ${LIBCOMMON_SRC} ${LIBCOMMON_HDR}
     ${ASM_PRIMITIVES} ${VEC_PRIMITIVES}
diff -r bd53cb226710 -r 0d79e31728a4 source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cpp	Thu Oct 31 17:33:31 2013 -0500
+++ b/source/encoder/ratecontrol.cpp	Fri Nov 01 13:05:34 2013 -0500
@@ -246,7 +246,7 @@ double RateControl::rateEstimateQscale(R
     }
     else
     {
-		double abrBuffer = 2 * cfg->param.rc.rateTolerance * bitrate;
+        double abrBuffer = 2 * cfg->param.rc.rateTolerance * bitrate;
 
         /* 1pass ABR */
 
@@ -292,30 +292,30 @@ double RateControl::rateEstimateQscale(R
             q = qp2qScale(accumPQp / accumPNorm);
             q /= fabs(cfg->param.rc.ipFactor);
         }
-		else if (framesDone>0)
-		{
-			 if (cfg->param.rc.rateControlMode != X265_RC_CRF)
-			 {
-				double lqmin = 0, lqmax = 0;
-				if (totalBits == 0)
-				{
-					lqmin = qp2qScale(ABR_INIT_QP_MIN) / lstep;
-					lqmax = qp2qScale(ABR_INIT_QP_MAX) * lstep;
-				}
-				else
-				{
-					lqmin = lastQScaleFor[sliceType] / lstep;
-					lqmax = lastQScaleFor[sliceType] * lstep;
-				}
+        else if (framesDone>0)
+        {
+            if (cfg->param.rc.rateControlMode != X265_RC_CRF)
+            {
+                double lqmin = 0, lqmax = 0;
+                if (totalBits == 0)
+                {
+                    lqmin = qp2qScale(ABR_INIT_QP_MIN) / lstep;
+                    lqmax = qp2qScale(ABR_INIT_QP_MAX) * lstep;
+                }
+                else
+                {
+                    lqmin = lastQScaleFor[sliceType] / lstep;
+                    lqmax = lastQScaleFor[sliceType] * lstep;
+                }
 
-				if (overflow > 1.1 && framesDone > 3)
-					lqmax *= lstep;
-				else if (overflow <0.9)
-					lqmin /= lstep;


More information about the x265-commits mailing list