[x265-commits] [x265] Merge with default (prep for 0.8)

Steve Borho steve at borho.org
Fri Feb 28 02:08:14 CET 2014


details:   http://hg.videolan.org/x265/rev/0a6dd816d2e2
branches:  stable
changeset: 6314:0a6dd816d2e2
user:      Steve Borho <steve at borho.org>
date:      Thu Feb 27 00:43:21 2014 -0600
description:
Merge with default (prep for 0.8)
Subject: [x265] ratecontrol: fix bitrate issue in 10-bit CRF mode

details:   http://hg.videolan.org/x265/rev/2fb85daef8af
branches:  stable
changeset: 6315:2fb85daef8af
user:      Deepthi Nandakumar <deepthi at multicorewareinc.com>
date:      Thu Feb 27 18:09:41 2014 +0530
description:
ratecontrol: fix bitrate issue in 10-bit CRF mode
Subject: [x265] Merge from stable

details:   http://hg.videolan.org/x265/rev/b92f341688c4
branches:  
changeset: 6316:b92f341688c4
user:      Deepthi Nandakumar <deepthi at multicorewareinc.com>
date:      Thu Feb 27 19:03:48 2014 +0530
description:
Merge from stable
Subject: [x265] all_angs_pred_32x32, asm code improvement

details:   http://hg.videolan.org/x265/rev/63aadc802f18
branches:  
changeset: 6317:63aadc802f18
user:      Praveen Tiwari
date:      Thu Feb 27 16:25:51 2014 +0530
description:
all_angs_pred_32x32, asm code improvement
Subject: [x265] fix typo problem on HIGH_BIT_DEPTH with non-PIC mode

details:   http://hg.videolan.org/x265/rev/52a47362c5c3
branches:  stable
changeset: 6318:52a47362c5c3
user:      Min Chen <chenm003 at 163.com>
date:      Thu Feb 27 12:32:31 2014 -0800
description:
fix typo problem on HIGH_BIT_DEPTH with non-PIC mode
Subject: [x265] fix Issue #30, disable stack execute on gcc

details:   http://hg.videolan.org/x265/rev/8e8328cad1be
branches:  stable
changeset: 6319:8e8328cad1be
user:      Min Chen <chenm003 at 163.com>
date:      Thu Feb 27 12:33:25 2014 -0800
description:
fix Issue #30, disable stack execute on gcc
Subject: [x265] threading: on linux gettimeofday() requires <sys/time.h>, UINT32_MAX is C only

details:   http://hg.videolan.org/x265/rev/bbe3f479c41f
branches:  stable
changeset: 6320:bbe3f479c41f
user:      Steve Borho <steve at borho.org>
date:      Thu Feb 27 13:16:50 2014 -0600
description:
threading: on linux gettimeofday() requires <sys/time.h>, UINT32_MAX is C only
Subject: [x265] Merge with stable

details:   http://hg.videolan.org/x265/rev/8a84c10e5116
branches:  
changeset: 6321:8a84c10e5116
user:      Steve Borho <steve at borho.org>
date:      Thu Feb 27 13:20:04 2014 -0600
description:
Merge with stable
Subject: [x265] vbv: bug fixes to stop mid frame qp adjustments to increase erratically.

details:   http://hg.videolan.org/x265/rev/875566aed8b1
branches:  stable
changeset: 6322:875566aed8b1
user:      Aarthi Thirumalai
date:      Thu Feb 27 20:20:54 2014 +0530
description:
vbv: bug fixes to stop mid frame qp adjustments to increase erratically.

maintain bufferFill for each FrameEncoder context and use that in rowWise qp adjustments for vbv.
also fixes bugs in predicting row wise bits from satd costs.
Subject: [x265] asm: 10bpp code for vertical luma interpolation filters.

details:   http://hg.videolan.org/x265/rev/89a2d8780835
branches:  
changeset: 6323:89a2d8780835
user:      Nabajit Deka
date:      Thu Feb 27 17:17:37 2014 +0530
description:
asm: 10bpp code for vertical luma interpolation filters.
Subject: [x265] param: add more validation checks to prevent encoder crashes

details:   http://hg.videolan.org/x265/rev/013589124615
branches:  stable
changeset: 6324:013589124615
user:      Sagar Kotecha <sagar at multicorewareinc.com>
date:      Thu Feb 27 12:16:16 2014 +0530
description:
param: add more validation checks to prevent encoder crashes
Subject: [x265] Merge with stable

details:   http://hg.videolan.org/x265/rev/a892e66d5738
branches:  
changeset: 6325:a892e66d5738
user:      Steve Borho <steve at borho.org>
date:      Thu Feb 27 15:44:23 2014 -0600
description:
Merge with stable
Subject: [x265] api: expose X265_BFRAME_MAX to the user

details:   http://hg.videolan.org/x265/rev/83859780b174
branches:  
changeset: 6326:83859780b174
user:      Steve Borho <steve at borho.org>
date:      Thu Feb 27 18:04:37 2014 -0600
description:
api: expose X265_BFRAME_MAX to the user
Subject: [x265] log: report consecutive B-frame histogram, as x264 does

details:   http://hg.videolan.org/x265/rev/b70a88e210f1
branches:  
changeset: 6327:b70a88e210f1
user:      Steve Borho <steve at borho.org>
date:      Thu Feb 27 18:32:28 2014 -0600
description:
log: report consecutive B-frame histogram, as x264 does
Subject: [x265] asm: cleanup 444 chroma primitive setup, and other primitve reuse

details:   http://hg.videolan.org/x265/rev/8189f9e9a39f
branches:  
changeset: 6328:8189f9e9a39f
user:      Steve Borho <steve at borho.org>
date:      Thu Feb 27 19:05:54 2014 -0600
description:
asm: cleanup 444 chroma primitive setup, and other primitve reuse

diffstat:

 build/msys/make-Makefiles.sh                        |      6 +-
 build/msys/make-x86_64-w64-mingw32-Makefiles.sh     |      8 +
 build/msys/toolchain-x86_64-w64-mingw32.cmake       |      6 +
 source/CMakeLists.txt                               |    153 +-
 source/Lib/TLibCommon/CommonDef.h                   |      8 +-
 source/Lib/TLibCommon/ContextTables.h               |     74 +-
 source/Lib/TLibCommon/NAL.h                         |     31 +-
 source/Lib/TLibCommon/TComBitStream.cpp             |     77 +-
 source/Lib/TLibCommon/TComBitStream.h               |      4 +-
 source/Lib/TLibCommon/TComDataCU.cpp                |    633 +-
 source/Lib/TLibCommon/TComDataCU.h                  |     52 +-
 source/Lib/TLibCommon/TComLoopFilter.cpp            |     17 +-
 source/Lib/TLibCommon/TComMotionInfo.cpp            |      5 -
 source/Lib/TLibCommon/TComMotionInfo.h              |      5 +-
 source/Lib/TLibCommon/TComPattern.cpp               |    177 +-
 source/Lib/TLibCommon/TComPattern.h                 |     64 +-
 source/Lib/TLibCommon/TComPic.cpp                   |     94 +-
 source/Lib/TLibCommon/TComPic.h                     |     34 +-
 source/Lib/TLibCommon/TComPicSym.cpp                |     16 +-
 source/Lib/TLibCommon/TComPicSym.h                  |      2 +-
 source/Lib/TLibCommon/TComPicYuv.cpp                |    300 +-
 source/Lib/TLibCommon/TComPicYuv.h                  |      6 +-
 source/Lib/TLibCommon/TComPicYuvMD5.cpp             |      3 +
 source/Lib/TLibCommon/TComPrediction.cpp            |    423 +-
 source/Lib/TLibCommon/TComPrediction.h              |     42 +-
 source/Lib/TLibCommon/TComRom.cpp                   |    377 +-
 source/Lib/TLibCommon/TComRom.h                     |     47 +-
 source/Lib/TLibCommon/TComSampleAdaptiveOffset.cpp  |     58 +-
 source/Lib/TLibCommon/TComSampleAdaptiveOffset.h    |      5 +-
 source/Lib/TLibCommon/TComSlice.cpp                 |     60 +-
 source/Lib/TLibCommon/TComSlice.h                   |     47 +-
 source/Lib/TLibCommon/TComTrQuant.cpp               |    374 +-
 source/Lib/TLibCommon/TComTrQuant.h                 |     26 +-
 source/Lib/TLibCommon/TComYuv.cpp                   |    346 +-
 source/Lib/TLibCommon/TComYuv.h                     |     31 +-
 source/Lib/TLibCommon/TypeDef.h                     |     72 +-
 source/Lib/TLibEncoder/NALwrite.cpp                 |     30 +-
 source/Lib/TLibEncoder/NALwrite.h                   |     24 +-
 source/Lib/TLibEncoder/SyntaxElementWriter.cpp      |      8 +-
 source/Lib/TLibEncoder/TEncBinCoderCABAC.cpp        |      7 +-
 source/Lib/TLibEncoder/TEncBinCoderCABAC.h          |      1 -
 source/Lib/TLibEncoder/TEncCfg.h                    |     27 +
 source/Lib/TLibEncoder/TEncCu.cpp                   |     87 +-
 source/Lib/TLibEncoder/TEncCu.h                     |      6 +-
 source/Lib/TLibEncoder/TEncEntropy.cpp              |     90 +-
 source/Lib/TLibEncoder/TEncEntropy.h                |     13 +-
 source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp |     50 +-
 source/Lib/TLibEncoder/TEncSbac.cpp                 |    613 +-
 source/Lib/TLibEncoder/TEncSbac.h                   |    121 +-
 source/Lib/TLibEncoder/TEncSearch.cpp               |   1093 +-
 source/Lib/TLibEncoder/TEncSearch.h                 |     57 +-
 source/Lib/TLibEncoder/WeightPredAnalysis.cpp       |    495 -
 source/Lib/TLibEncoder/WeightPredAnalysis.h         |     76 -
 source/cmake/version.cmake                          |     63 +-
 source/common/CMakeLists.txt                        |     44 +-
 source/common/TShortYUV.cpp                         |      7 +-
 source/common/TShortYUV.h                           |      5 +-
 source/common/common.cpp                            |    712 +-
 source/common/common.h                              |     10 +-
 source/common/cpu.cpp                               |     90 +-
 source/common/dct.cpp                               |     20 +-
 source/common/intrapred.cpp                         |      8 +-
 source/common/ipfilter.cpp                          |    267 +-
 source/common/lowres.cpp                            |     54 +-
 source/common/lowres.h                              |      8 +-
 source/common/param.cpp                             |   1076 +
 source/common/param.h                               |     38 +
 source/common/pixel.cpp                             |    139 +-
 source/common/primitives.cpp                        |     48 +-
 source/common/primitives.h                          |     39 +-
 source/common/threading.cpp                         |      2 -
 source/common/threading.h                           |    261 +-
 source/common/threadpool.cpp                        |    170 +-
 source/common/threadpool.h                          |      2 +
 source/common/vec/intra-sse41.cpp                   |   8147 -----
 source/common/vec/intra-ssse3.cpp                   |   3206 --
 source/common/vec/ipfilter-sse41.cpp                |    257 -
 source/common/vec/vec-primitives.cpp                |     16 +-
 source/common/version.cpp                           |      2 +-
 source/common/wavefront.cpp                         |     40 +-
 source/common/wavefront.h                           |     32 +-
 source/common/x86/asm-primitives.cpp                |    684 +-
 source/common/x86/blockcopy8.asm                    |    222 +-
 source/common/x86/blockcopy8.h                      |      2 +-
 source/common/x86/const-a.asm                       |      7 +-
 source/common/x86/dct8.asm                          |    145 +-
 source/common/x86/intrapred.h                       |    102 +-
 source/common/x86/intrapred16.asm                   |  11446 +++++++-
 source/common/x86/intrapred8.asm                    |  28465 +++++++++++++++++-
 source/common/x86/ipfilter16.asm                    |   2697 +
 source/common/x86/ipfilter8.asm                     |   2352 +-
 source/common/x86/ipfilter8.h                       |    214 +-
 source/common/x86/mc-a.asm                          |   1894 +
 source/common/x86/pixel-a.asm                       |     70 +-
 source/common/x86/pixel-util.h                      |      1 +
 source/common/x86/pixel-util8.asm                   |    415 +-
 source/common/x86/pixel.h                           |     34 +
 source/common/x86/pixeladd8.asm                     |     86 +-
 source/common/x86/sad-a.asm                         |     18 +-
 source/common/x86/sad16-a.asm                       |     14 +-
 source/common/x86/x86inc.asm                        |     58 +-
 source/encoder/CMakeLists.txt                       |     29 +-
 source/encoder/api.cpp                              |    191 +
 source/encoder/compress.cpp                         |    235 +-
 source/encoder/cturow.h                             |      2 +-
 source/encoder/dpb.cpp                              |      5 +-
 source/encoder/encoder.cpp                          |    729 +-
 source/encoder/encoder.h                            |     17 +-
 source/encoder/frameencoder.cpp                     |    197 +-
 source/encoder/frameencoder.h                       |      4 +-
 source/encoder/framefilter.cpp                      |     35 +-
 source/encoder/framefilter.h                        |      2 +
 source/encoder/motion.cpp                           |      2 +-
 source/encoder/ratecontrol.cpp                      |    622 +-
 source/encoder/ratecontrol.h                        |     37 +-
 source/encoder/reference.cpp                        |     13 +-
 source/encoder/reference.h                          |      3 +-
 source/encoder/slicetype.cpp                        |    749 +-
 source/encoder/slicetype.h                          |     16 +-
 source/encoder/weightPrediction.cpp                 |    587 +-
 source/encoder/weightPrediction.h                   |     89 -
 source/input/input.cpp                              |      8 +-
 source/input/input.h                                |     38 +-
 source/input/y4m.cpp                                |    225 +-
 source/input/y4m.h                                  |     40 +-
 source/input/yuv.cpp                                |    140 +-
 source/input/yuv.h                                  |     32 +-
 source/output/output.cpp                            |      4 +-
 source/output/output.h                              |      5 +-
 source/output/y4m.cpp                               |     28 +-
 source/output/y4m.h                                 |      4 +-
 source/output/yuv.h                                 |      2 +
 source/test/CMakeLists.txt                          |      3 +
 source/test/intrapredharness.cpp                    |     15 +-
 source/test/ipfilterharness.cpp                     |    749 +-
 source/test/ipfilterharness.h                       |      7 +-
 source/test/mbdstharness.cpp                        |    193 +-
 source/test/mbdstharness.h                          |      6 +-
 source/test/pixelharness.cpp                        |    359 +-
 source/test/pixelharness.h                          |     10 +-
 source/test/testbench.cpp                           |      4 -
 source/test/testharness.h                           |      1 +
 source/test/testpool.cpp                            |    241 +
 source/x265.cpp                                     |    266 +-
 source/x265.h                                       |    294 +-
 source/x265.rc.in                                   |     32 +
 146 files changed, 55223 insertions(+), 21217 deletions(-)

diffs (truncated from 88749 to 300 lines):

diff -r 4b8901ae94ec -r 8189f9e9a39f build/msys/make-Makefiles.sh
--- a/build/msys/make-Makefiles.sh	Mon Feb 03 23:32:00 2014 -0600
+++ b/build/msys/make-Makefiles.sh	Thu Feb 27 19:05:54 2014 -0600
@@ -1,3 +1,3 @@
-#!/bin/sh
-# Run this from within an MSYS bash shell
-cmake -G "MSYS Makefiles" ../../source && cmake-gui ../../source
+#!/bin/sh
+# Run this from within an MSYS bash shell
+cmake -G "MSYS Makefiles" ../../source && cmake-gui ../../source
diff -r 4b8901ae94ec -r 8189f9e9a39f build/msys/make-x86_64-w64-mingw32-Makefiles.sh
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/build/msys/make-x86_64-w64-mingw32-Makefiles.sh	Thu Feb 27 19:05:54 2014 -0600
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+# This will generate a cross-compile environment, compiling an x86_64
+# Win64 target from a 32bit MinGW32 host environment.  If your MinGW
+# install is 64bit, you can use the native compiler batch file:
+# make-Makefiles.sh
+
+cmake -G "MSYS Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain-x86_64-w64-mingw32.cmake ../../source && cmake-gui ../../source
diff -r 4b8901ae94ec -r 8189f9e9a39f build/msys/toolchain-x86_64-w64-mingw32.cmake
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/build/msys/toolchain-x86_64-w64-mingw32.cmake	Thu Feb 27 19:05:54 2014 -0600
@@ -0,0 +1,6 @@
+SET(CMAKE_SYSTEM_NAME Windows)
+SET(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc)
+SET(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++)
+SET(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres)
+SET(CMAKE_RANLIB x86_64-w64-mingw32-ranlib)
+SET(CMAKE_ASM_YASM_COMPILER yasm)
diff -r 4b8901ae94ec -r 8189f9e9a39f source/CMakeLists.txt
--- a/source/CMakeLists.txt	Mon Feb 03 23:32:00 2014 -0600
+++ b/source/CMakeLists.txt	Thu Feb 27 19:05:54 2014 -0600
@@ -5,6 +5,10 @@ if(NOT CMAKE_BUILD_TYPE)
         "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel."
         FORCE)
 endif()
+message(STATUS "cmake version ${CMAKE_VERSION}")
+if(NOT CMAKE_VERSION VERSION_LESS "2.8.12.20131121")
+    cmake_policy(SET CMP0025 OLD) # report Apple's Clang as just Clang
+endif()
 
 project (x265)
 cmake_minimum_required (VERSION 2.8.8) # OBJECT libraries require 2.8.8
@@ -13,7 +17,7 @@ include(CheckFunctionExists)
 include(CheckCXXCompilerFlag)
 
 # X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 4)
+set(X265_BUILD 7)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
                "${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
@@ -21,25 +25,49 @@ configure_file("${PROJECT_SOURCE_DIR}/x2
 
 SET(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" "${CMAKE_MODULE_PATH}")
 
-if ("${CMAKE_SIZEOF_VOID_P}" MATCHES 8)
-    set(X64 1)
-    add_definitions(-DX86_64=1)
+# System architecture detection
+string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" SYSPROC)
+if("${SYSPROC}" STREQUAL "i386"   OR "${SYSPROC}" STREQUAL "amd64" OR
+   "${SYSPROC}" STREQUAL "x86_64" OR "${SYSPROC}" STREQUAL "x86"   OR
+   "${SYSPROC}" STREQUAL "")
+    message(STATUS "Detected x86 system processor")
+    set(X86 1)
+    add_definitions(-DX265_ARCH_X86=1)
+    if("${CMAKE_SIZEOF_VOID_P}" MATCHES 8)
+        set(X64 1)
+        add_definitions(-DX86_64=1)
+    endif()
+elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "armv6l")
+    message(STATUS "Detected ARM system processor")
+    set(ARM 1)
+    add_definitions(-DX265_ARCH_ARM=1 -DHAVE_ARMV6=1)
+else()
+    message(STATUS "CMAKE_SYSTEM_PROCESSOR value `${CMAKE_SYSTEM_PROCESSOR}` is unknown")
+    message(STATUS "Please add this value near ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE}")
 endif()
 
-if (CMAKE_GENERATOR STREQUAL "Xcode")
+if(UNIX)
+    SET(PLATFORM_LIBS pthread)
+    if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+        SET(PLATFORM_LIBS ${PLATFORM_LIBS} rt)
+    endif(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+endif(UNIX)
+
+# Compiler detection
+if(CMAKE_GENERATOR STREQUAL "Xcode")
   set(XCODE 1)
 endif()
 if (APPLE)
   add_definitions(-DMACOS)
 endif()
 
-if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
+if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
     set(CLANG 1)
 endif()
-if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel")
+if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
     set(INTEL_CXX 1)
 endif()
-if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
+if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
     set(GCC 1)
 endif()
 
@@ -55,12 +83,14 @@ if(MSVC)
             string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
         endforeach()
     endif (STATIC_LINK_CRT)
-    # Enforce coding standards.  Full warnings and warnings as errors
-    add_definitions(/W4 /WX /D_CRT_SECURE_NO_WARNINGS)
+    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
+    add_definitions(/D_CRT_SECURE_NO_WARNINGS)
+
     check_include_files(stdint.h HAVE_STDINT_H)
     if(NOT HAVE_STDINT_H)
         include_directories(compat/msvc)
@@ -85,22 +115,54 @@ elseif(CMAKE_COMPILER_IS_GNUCXX)
     execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
 endif()
 if (GCC)
-    option(WARNINGS_AS_ERRORS "Stop compiles on first warning" OFF)
-    if(WARNINGS_AS_ERRORS)
-        add_definitions(-Werror)
-    endif(WARNINGS_AS_ERRORS)
     if(X64 AND NOT WIN32)
         add_definitions(-fPIC)
     endif(X64 AND NOT WIN32)
+    if(X86 AND NOT X64)
+        add_definitions(-march=i686)
+    endif()
+    if(ARM)
+        add_definitions(-march=armv6 -mfloat-abi=hard -mfpu=vfp)
+    endif()
 endif(GCC)
 
-option(HIGH_BIT_DEPTH "Use 16bit pixels internally" OFF)
+find_package(Yasm)
+if(YASM_FOUND AND X86)
+    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_ASSEMBLY "Enable use of assembly coded primitives" OFF)
+    else()
+        message(STATUS "Found Yasm ${YASM_VERSION_STRING} to build assembly primitives")
+        option(ENABLE_ASSEMBLY "Enable use of assembly coded primitives" ON)
+    endif()
+endif()
+
+# Build options
+
+if(X64)
+    # NOTE: We only officially support 16bit-per-pixel compiles of x265
+    # on 64bit architectures. 16bpp plus large resolution plus slow
+    # preset plus 32bit address space usually means malloc failure.  You
+    # can disable this if(X64) check if you desparately need a 32bit
+    # build with 10bit/12bit support, but this violates the "shrink wrap
+    # license" so to speak.  If it breaks you get to keep both halves.
+    option(HIGH_BIT_DEPTH "Store pixels as 16bit values" OFF)
+endif(X64)
 if(HIGH_BIT_DEPTH)
     add_definitions(-DHIGH_BIT_DEPTH=1)
 else(HIGH_BIT_DEPTH)
     add_definitions(-DHIGH_BIT_DEPTH=0)
 endif(HIGH_BIT_DEPTH)
 
+option(WARNINGS_AS_ERRORS "Stop compiles on first warning" OFF)
+if(WARNINGS_AS_ERRORS)
+    if(GCC)
+        add_definitions(-Werror)
+    elseif(MSVC)
+        add_definitions(/WX)
+    endif()
+endif(WARNINGS_AS_ERRORS)
+
 option(LOG_CU_STATISTICS "Log Mode Decision Statistics at the CU Level" OFF)
 if(LOG_CU_STATISTICS)
     add_definitions(-DLOG_CU_STATISTICS=1)
@@ -108,24 +170,6 @@ else(LOG_CU_STATISTICS)
     add_definitions(-DLOG_CU_STATISTICS=0)
 endif(LOG_CU_STATISTICS)
 
-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_ASSEMBLY "Enable use of assembly coded primitives" OFF)
-    else()
-        message(STATUS "Found Yasm ${YASM_VERSION_STRING} to build assembly primitives")
-        option(ENABLE_ASSEMBLY "Enable use of assembly coded primitives" ON)
-    endif()
-endif(YASM_FOUND)
-
-if(UNIX)
-    SET(PLATFORM_LIBS pthread)
-    if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
-        SET(PLATFORM_LIBS ${PLATFORM_LIBS} rt)
-    endif(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
-endif(UNIX)
-
 option(ENABLE_PPA "Enable PPA profiling instrumentation" OFF)
 if(ENABLE_PPA)
     add_definitions(-DENABLE_PPA)
@@ -138,7 +182,7 @@ endif(ENABLE_PPA)
 
 if (WIN32)
     # Visual leak detector
-    find_package(VLD)
+    find_package(VLD QUIET)
     if(VLD_FOUND)
         add_definitions(-DHAVE_VLD)
         include_directories(${VLD_INCLUDE_DIRS})
@@ -154,8 +198,8 @@ endif()
 
 include(version) # determine X265_VERSION and X265_LATEST_TAG
 include_directories(. Lib common encoder "${PROJECT_BINARY_DIR}")
+add_subdirectory(encoder)
 add_subdirectory(common)
-add_subdirectory(encoder)
 
 if((MSVC_IDE OR XCODE) AND ENABLE_ASSEMBLY)
     # this is horrible. ugly, and hacky, and it reproduces logic found
@@ -205,14 +249,34 @@ install(TARGETS x265-static
         ARCHIVE DESTINATION lib)
 install(FILES x265.h "${PROJECT_BINARY_DIR}/x265_config.h" DESTINATION include)
 
+if(CMAKE_RC_COMPILER)
+    # The resource compiler does not need CFLAGS or macro defines. It
+    # often breaks them
+    string(REPLACE "<FLAGS>" "" CMAKE_RC_COMPILE_OBJECT "${CMAKE_RC_COMPILE_OBJECT}")
+    string(REPLACE "<DEFINES>" "" CMAKE_RC_COMPILE_OBJECT "${CMAKE_RC_COMPILE_OBJECT}")
+
+    # convert X265_LATEST_TAG (ex: 0.7) and X265_TAG_DISTANCE (ex: 103) to
+    # @X265_VERSION_MAJOR@, at X265_VERSION_MINOR@, at X265_BRANCH_ID@, at X265_TAG_DISTANCE@
+    string(REPLACE "." ";" VERSION_LIST "${X265_LATEST_TAG}")
+    list(GET VERSION_LIST 0 X265_VERSION_MAJOR)
+    list(GET VERSION_LIST 1 X265_VERSION_MINOR)
+    set(X265_BRANCH_ID 0) # TODO: 0 - stable, 1 - default or other
+    set(X265_RC_FILE "${CMAKE_CURRENT_BINARY_DIR}/x265.rc")
+    configure_file("${CMAKE_CURRENT_SOURCE_DIR}/x265.rc.in" "${X265_RC_FILE}" @ONLY)
+endif()
+
 option(ENABLE_SHARED "Build shared library" ON)
 if(ENABLE_SHARED)
     add_library(x265-shared SHARED dllmain.cpp "${PROJECT_BINARY_DIR}/x265.def" ${YASM_OBJS}
-                                   $<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common>)
+                ${X265_RC_FILE} $<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common>)
     target_link_libraries(x265-shared ${PLATFORM_LIBS})
-    set_target_properties(x265-shared PROPERTIES OUTPUT_NAME x265)
+    if(MSVC)
+        set_target_properties(x265-shared PROPERTIES OUTPUT_NAME libx265)
+    else()
+        set_target_properties(x265-shared PROPERTIES OUTPUT_NAME x265)
+    endif()
     if(UNIX AND NOT APPLE)
-        set_target_properties(x265-shared PROPERTIES LINK_FLAGS "-Wl,-Bsymbolic")
+        set_target_properties(x265-shared PROPERTIES LINK_FLAGS "-Wl,-Bsymbolic,-znoexecstack")
     endif()
     if(X265_LATEST_TAG)
         # shared library is not installed if a tag is not found
@@ -227,8 +291,16 @@ endif()
 if(X265_LATEST_TAG)
     # convert lists of link libraries into -lstdc++ -lm etc..
     foreach(LIB ${CMAKE_CXX_IMPLICIT_LINK_LIBRARIES} ${PLATFORM_LIBS})
-        set(PRIVATE_LIBS "${PRIVATE_LIBS} -l${LIB}")
+        list(APPEND PLIBLIST "-l${LIB}")
     endforeach()
+    if(PLIBLIST)
+        # blacklist of libraries that should not be in Libs.private
+        list(REMOVE_ITEM PLIBLIST "-lc" "-lpthread")
+        string(REPLACE ";" " " PRIVATE_LIBS "${PLIBLIST}")
+    else()
+        set(PRIVATE_LIBS "")
+    endif(PLIBLIST)
+
     # Produce a pkg-config file
     configure_file("x265.pc.in" "x265.pc" @ONLY)
     install(FILES       "${CMAKE_CURRENT_BINARY_DIR}/x265.pc"
@@ -264,7 +336,8 @@ if(ENABLE_CLI)
         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.cpp x265.h)
+        add_executable(cli ../COPYING ${InputFiles} ${OutputFiles} ${GETOPT} ${X265_RC_FILE}
+                           x265.cpp x265.h)
         target_link_libraries(cli x265-static ${PLATFORM_LIBS})
     endif()
     set_target_properties(cli PROPERTIES OUTPUT_NAME x265)
diff -r 4b8901ae94ec -r 8189f9e9a39f source/Lib/TLibCommon/CommonDef.h


More information about the x265-commits mailing list