Skip to content

Commit

Permalink
Merge commit '09265145041bee53ade04a47f23b1a7c232007fb'
Browse files Browse the repository at this point in the history
  • Loading branch information
Sibras committed Feb 25, 2018
2 parents e892e0a + 0926514 commit 51a6124
Show file tree
Hide file tree
Showing 62 changed files with 39,191 additions and 38,189 deletions.
1 change: 1 addition & 0 deletions .hgtags
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ be14a7e9755e54f0fd34911c72bdfa66981220bc 2.2
3037c1448549ca920967831482c653e5892fa8ed 2.3
e7a4dd48293b7956d4a20df257d23904cc78e376 2.4
64b2d0bf45a52511e57a6b7299160b961ca3d51c 2.5
0e9ea76945c89962cd46cee6537586e2054b2935 2.6
21 changes: 20 additions & 1 deletion build/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ Note: MSVC12 requires cmake 2.8.11 or later

= Optional Prerequisites =

1. Yasm 1.2.0 or later, to compile assembly primitives (performance)
1. To compile assembly primitives (performance)
a) If you are using release 2.6 or older, download and install Yasm 1.2.0 or later,

For Windows, download the latest yasm executable
http://yasm.tortall.net/Download.html and copy the EXE into
Expand All @@ -33,6 +34,24 @@ Note: MSVC12 requires cmake 2.8.11 or later
If cpu capabilities line says 'none!', then the encoder was built
without yasm.

b) If you are building from the default branch after release 2.6, download and install nasm 2.13 or newer

For windows and linux, you can download the nasm installer from http://www.nasm.us/pub/nasm/releasebuilds/?C=M;O=D.
Make sure that it is in your PATH environment variable (%PATH% in windows, and $PATH in linux) so that cmake
can find it.

Once NASM is properly installed, run cmake to regenerate projects. If you
do not see the below line in the cmake output, NASM is not in the PATH.

-- Found Nasm 2.13 to build assembly primitives

Now build the encoder and run x265 -V:

x265 [info]: using cpu capabilities: MMX, SSE2, ...

If cpu capabilities line says 'none!', then the encoder was built
without nasm and will be considerably slower for performance.

2. VisualLeakDetector (Windows Only)

Download from https://vld.codeplex.com/releases and install. May need
Expand Down
2 changes: 1 addition & 1 deletion doc/reST/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ changes made to the parameters for auto-detection and other reasons::
/* x265_get_ref_frame_list:
* returns negative on error, 0 when access unit were output.
* This API must be called after(poc >= lookaheadDepth + bframes + 2) condition check */
int x265_get_ref_frame_list(x265_encoder *encoder, x265_picyuv**, x265_picyuv**, int, int);
int x265_get_ref_frame_list(x265_encoder *encoder, x265_picyuv**, x265_picyuv**, int, int, int*, int*);
**x265_encoder_ctu_info** may be used to provide additional CTU-specific information to the encoder::

Expand Down
50 changes: 37 additions & 13 deletions doc/reST/cli.rst
Original file line number Diff line number Diff line change
Expand Up @@ -863,21 +863,22 @@ Analysis re-use options, to improve performance when encoding the same
sequence multiple times (presumably at varying bitrates). The encoder
will not reuse analysis if slice type parameters do not match.

.. option:: --analysis-reuse-mode <string|int>
.. option:: --analysis-save <filename>

This option allows reuse of analysis information from first pass to second pass.
:option:`--analysis-reuse-mode save` specifies that encoder outputs analysis information of each frame.
:option:`--analysis-reuse-mode load` specifies that encoder reuses analysis information from first pass.
There is no benefit using load mode without running encoder in save mode. Analysis data from save mode is
written to a file specified by :option:`--analysis-reuse-file`. The amount of analysis data stored/reused
is determined by :option:`--analysis-reuse-level`. By reading the analysis data writen by an earlier encode
of the same sequence, substantial redundant work may be avoided. Requires cutree, pmode to be off. Default 0.
Encoder outputs analysis information of each frame. Analysis data from save mode is
written to the file specified. Requires cutree, pmode to be off. Default disabled.

.. option:: --analysis-load <filename>

Encoder reuses analysis information from the file specified. By reading the analysis data writen by
an earlier encode of the same sequence, substantial redundant work may be avoided. Requires cutree, pmode
to be off. Default disabled.

**Values:** off(0), save(1): dump analysis data, load(2): read analysis data
The amount of analysis data stored/reused is determined by :option:`--analysis-reuse-level`.

.. option:: --analysis-reuse-file <filename>

Specify a filename for analysis data (see :option:`--analysis-reuse-mode`)
Specify a filename for `multi-pass-opt-analysis` and `multi-pass-opt-distortion`.
If no filename is specified, x265_analysis.dat is used.

.. option:: --analysis-reuse-level <1..10>
Expand Down Expand Up @@ -1028,7 +1029,13 @@ as the residual quad-tree (RQT).
Level 4 - uses the depth of the neighbouring/ co-located CUs TU depth
to limit the 1st subTU depth. The 1st subTU depth is taken as the
limiting depth for the other subTUs.


Enabling levels 3 or 4 may cause a mismatch in the output bitstreams
between option:`--analysis-save` and option:`--analysis-load`
as all neighbouring CUs TU depth may not be available in the
option:`--analysis-load` run as only the best mode's information is
available to it.

Default: 0

.. option:: --nr-intra <integer>, --nr-inter <integer>
Expand Down Expand Up @@ -1344,7 +1351,14 @@ Slice decision options
This value represents the percentage difference between the inter cost and
intra cost of a frame used in scenecut detection. For example, a value of 5 indicates,
if the inter cost of a frame is greater than or equal to 95 percent of the intra cost of the frame,
then detect this frame as scenecut. Values between 5 and 15 are recommended. Default 5.
then detect this frame as scenecut. Values between 5 and 15 are recommended. Default 5.

.. option:: --radl <integer>

Number of RADL pictures allowed infront of IDR. Requires fixed keyframe interval.
Recommended value is 2-3. Default 0 (disabled).

**Range of values: Between 0 and `--bframes`
.. option:: --ctu-info <0, 1, 2, 4, 6>

Expand Down Expand Up @@ -1373,6 +1387,16 @@ Slice decision options
Default 20

**Range of values:** Between the maximum consecutive bframe count (:option:`--bframes`) and 250
.. option:: --gop-lookahead <integer>

Number of frames for GOP boundary decision lookahead. If a scenecut frame is found
within this from the gop boundary set by `--keyint`, the GOP will be extented until such a point,
otherwise the GOP will be terminated as set by `--keyint`. Default 0.

**Range of values:** Between 0 and (`--rc-lookahead` - mini-GOP length)

It is recommended to have `--gop-lookahaed` less than `--min-keyint` as scenecuts beyond
`--min-keyint` are already being coded as keyframes.

.. option:: --lookahead-slices <0..16>

Expand Down Expand Up @@ -2040,7 +2064,7 @@ VUI fields must be manually specified.
Example for MaxCLL=1000 candela per square meter, MaxFALL=400
candela per square meter:

--max-cll “1000,400”
--max-cll "1000,400"

Note that this string value will need to be escaped or quoted to
protect against shell expansion on many platforms. No default.
Expand Down
26 changes: 26 additions & 0 deletions doc/reST/releasenotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,32 @@
Release Notes
*************

Version 2.7
===========

Release date - 21st Feb, 2018.

New features
------------
1. :option:`--gop-lookahead` can be used to extend the gop boundary(set by `--keyint`). The GOP will be extended, if a scene-cut frame is found within this many number of frames.
2. Support for RADL pictures added in x265.
:option:`--radl` can be used to decide number of RADL pictures preceding the IDR picture.

Encoder enhancements
--------------------
1. Moved from YASM to NASM assembler. Supports NASM assembler version 2.13 and greater.
2. Enable analysis save and load in a single run. Introduces two new cli options `--analysis-save <filename>` and `--analysis-load <filename>`.
3. Comply to HDR10+ LLC specification.
4. Reduced x265 build time by more than 50% by re-factoring ipfilter.asm.

Bug fixes
---------
1. Fixed inconsistent output issue in deblock filter and --const-vbv.
2. Fixed Mac OS build warnings.
3. Fixed inconsistency in pass-2 when weightp and cutree are enabled.
4. Fixed deadlock issue due to dropping of BREF frames, while forcing slice types through qp file.


Version 2.6
===========

Expand Down
43 changes: 25 additions & 18 deletions source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ option(NATIVE_BUILD "Target the build CPU" OFF)
option(STATIC_LINK_CRT "Statically link C runtime for release builds" OFF)
mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)
# X265_BUILD must be incremented each time the public API is changed
set(X265_BUILD 146)
set(X265_BUILD 151)
configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
"${PROJECT_BINARY_DIR}/x265.def")
configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
Expand Down Expand Up @@ -323,15 +323,15 @@ if(GCC)
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE CC_VERSION)
endif(GCC)

find_package(Yasm)
find_package(Nasm)
if(ARM OR CROSS_COMPILE_ARM)
option(ENABLE_ASSEMBLY "Enable use of assembly coded primitives" ON)
elseif(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")
elseif(NASM_FOUND AND X86)
if (NASM_VERSION_STRING VERSION_LESS "2.13.0")
message(STATUS "Nasm version ${NASM_VERSION_STRING} is too old. 2.13.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")
message(STATUS "Found Nasm ${NASM_VERSION_STRING} to build assembly primitives")
option(ENABLE_ASSEMBLY "Enable use of assembly coded primitives" ON)
endif()
else()
Expand Down Expand Up @@ -517,18 +517,18 @@ if((MSVC_IDE OR XCODE OR GCC) AND ENABLE_ASSEMBLY)
list(APPEND ASM_OBJS ${ASM}.${SUFFIX})
add_custom_command(
OUTPUT ${ASM}.${SUFFIX}
COMMAND ${YASM_EXECUTABLE} ARGS ${YASM_FLAGS} ${ASM_SRC} -o ${ASM}.${SUFFIX}
COMMAND ${NASM_EXECUTABLE} ARGS ${NASM_FLAGS} ${ASM_SRC} -o ${ASM}.${SUFFIX}
DEPENDS ${ASM_SRC})
endforeach()
endif()
endif()
source_group(ASM FILES ${ASM_SRCS})
if(ENABLE_HDR10_PLUS)
add_library(x265-static STATIC $<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common> $<TARGET_OBJECTS:dynamicHDR10> ${ASM_OBJS} ${ASM_SRCS})
add_library(x265-static STATIC $<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common> $<TARGET_OBJECTS:dynamicHDR10> ${ASM_OBJS})
add_library(hdr10plus-static STATIC $<TARGET_OBJECTS:dynamicHDR10>)
set_target_properties(hdr10plus-static PROPERTIES OUTPUT_NAME hdr10plus)
else()
add_library(x265-static STATIC $<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common> ${ASM_OBJS} ${ASM_SRCS})
add_library(x265-static STATIC $<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common> ${ASM_OBJS})
endif()
if(NOT MSVC)
set_target_properties(x265-static PROPERTIES OUTPUT_NAME x265)
Expand All @@ -546,14 +546,19 @@ if(ENABLE_HDR10_PLUS)
ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
endif()
install(FILES x265.h "${PROJECT_BINARY_DIR}/x265_config.h" DESTINATION include)

if(WIN32)
install(FILES "${PROJECT_BINARY_DIR}/Debug/x265.pdb" DESTINATION ${BIN_INSTALL_DIR} CONFIGURATIONS Debug)
install(FILES "${PROJECT_BINARY_DIR}/RelWithDebInfo/x265.pdb" DESTINATION ${BIN_INSTALL_DIR} CONFIGURATIONS RelWithDebInfo)
install(FILES "${PROJECT_BINARY_DIR}/Debug/libx265.pdb" DESTINATION ${BIN_INSTALL_DIR} CONFIGURATIONS Debug OPTIONAL NAMELINK_ONLY)
install(FILES "${PROJECT_BINARY_DIR}/RelWithDebInfo/libx265.pdb" DESTINATION ${BIN_INSTALL_DIR} CONFIGURATIONS RelWithDebInfo OPTIONAL NAMELINK_ONLY)
if(MSVC_IDE)
install(FILES "${PROJECT_BINARY_DIR}/Debug/x265.pdb" DESTINATION ${BIN_INSTALL_DIR} CONFIGURATIONS Debug)
install(FILES "${PROJECT_BINARY_DIR}/RelWithDebInfo/x265.pdb" DESTINATION ${BIN_INSTALL_DIR} CONFIGURATIONS RelWithDebInfo)
install(FILES "${PROJECT_BINARY_DIR}/Debug/libx265.pdb" DESTINATION ${BIN_INSTALL_DIR} CONFIGURATIONS Debug OPTIONAL NAMELINK_ONLY)
install(FILES "${PROJECT_BINARY_DIR}/RelWithDebInfo/libx265.pdb" DESTINATION ${BIN_INSTALL_DIR} CONFIGURATIONS RelWithDebInfo OPTIONAL NAMELINK_ONLY)
else()
install(FILES "${PROJECT_BINARY_DIR}/x265.pdb" DESTINATION ${BIN_INSTALL_DIR} CONFIGURATIONS Debug)
install(FILES "${PROJECT_BINARY_DIR}/x265.pdb" DESTINATION ${BIN_INSTALL_DIR} CONFIGURATIONS RelWithDebInfo)
install(FILES "${PROJECT_BINARY_DIR}/libx265.pdb" DESTINATION ${BIN_INSTALL_DIR} CONFIGURATIONS Debug OPTIONAL NAMELINK_ONLY)
install(FILES "${PROJECT_BINARY_DIR}/libx265.pdb" DESTINATION ${BIN_INSTALL_DIR} CONFIGURATIONS RelWithDebInfo OPTIONAL NAMELINK_ONLY)
endif()
endif()

if(CMAKE_RC_COMPILER)
# The resource compiler does not need CFLAGS or macro defines. It
# often breaks them
Expand Down Expand Up @@ -642,7 +647,9 @@ if(X265_LATEST_TAG)
endforeach()
if(PLIBLIST)
# blacklist of libraries that should not be in Libs.private
list(REMOVE_ITEM PLIBLIST "-lc" "-lpthread")
list(REMOVE_ITEM PLIBLIST "-lc" "-lpthread" "-lmingwex" "-lmingwthrd"
"-lmingw32" "-lmoldname" "-lmsvcrt" "-ladvapi32" "-lshell32"
"-luser32" "-lkernel32")
string(REPLACE ";" " " PRIVATE_LIBS "${PLIBLIST}")
else()
set(PRIVATE_LIBS "")
Expand Down Expand Up @@ -686,11 +693,11 @@ if(ENABLE_CLI)
if(ENABLE_HDR10_PLUS)
add_executable(cli ../COPYING ${InputFiles} ${OutputFiles} ${GETOPT}
x265.cpp x265.h x265cli.h
$<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common> $<TARGET_OBJECTS:dynamicHDR10> ${ASM_OBJS} ${ASM_SRCS})
$<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common> $<TARGET_OBJECTS:dynamicHDR10> ${ASM_OBJS})
else()
add_executable(cli ../COPYING ${InputFiles} ${OutputFiles} ${GETOPT}
x265.cpp x265.h x265cli.h
$<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common> ${ASM_OBJS} ${ASM_SRCS})
$<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common> ${ASM_OBJS})
endif()
else()
add_executable(cli ../COPYING ${InputFiles} ${OutputFiles} ${GETOPT} ${X265_RC_FILE}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
set(ASM_DIALECT "_YASM")
set(ASM_DIALECT "_NASM")
set(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS asm)

if(X64)
list(APPEND ASM_FLAGS -DARCH_X86_64=1)
list(APPEND ASM_FLAGS -DARCH_X86_64=1 -I ${CMAKE_CURRENT_SOURCE_DIR}/../common/x86/)
if(ENABLE_PIC)
list(APPEND ASM_FLAGS -DPIC)
endif()
if(APPLE)
set(ARGS -f macho64 -m amd64 -DPREFIX)
set(ARGS -f macho64 -DPREFIX)
elseif(UNIX AND NOT CYGWIN)
set(ARGS -f elf64 -m amd64)
set(ARGS -f elf64)
else()
set(ARGS -f win64 -m amd64)
set(ARGS -f win64)
endif()
else()
list(APPEND ASM_FLAGS -DARCH_X86_64=0)
list(APPEND ASM_FLAGS -DARCH_X86_64=0 -I ${CMAKE_CURRENT_SOURCE_DIR}/../common/x86/)
if(APPLE)
set(ARGS -f macho -DPREFIX)
set(ARGS -f macho32 -DPREFIX)
elseif(UNIX AND NOT CYGWIN)
set(ARGS -f elf32)
else()
Expand All @@ -40,25 +40,25 @@ else()
list(APPEND ASM_FLAGS -DHIGH_BIT_DEPTH=0 -DBIT_DEPTH=8 -DX265_NS=${X265_NS})
endif()

list(APPEND ASM_FLAGS "${CMAKE_ASM_YASM_FLAGS}")
list(APPEND ASM_FLAGS "${CMAKE_ASM_NASM_FLAGS}")

if(CMAKE_BUILD_TYPE MATCHES Release)
list(APPEND ASM_FLAGS "${CMAKE_ASM_YASM_FLAGS_RELEASE}")
list(APPEND ASM_FLAGS "${CMAKE_ASM_NASM_FLAGS_RELEASE}")
elseif(CMAKE_BUILD_TYPE MATCHES Debug)
list(APPEND ASM_FLAGS "${CMAKE_ASM_YASM_FLAGS_DEBUG}")
list(APPEND ASM_FLAGS "${CMAKE_ASM_NASM_FLAGS_DEBUG}")
elseif(CMAKE_BUILD_TYPE MATCHES MinSizeRel)
list(APPEND ASM_FLAGS "${CMAKE_ASM_YASM_FLAGS_MINSIZEREL}")
list(APPEND ASM_FLAGS "${CMAKE_ASM_NASM_FLAGS_MINSIZEREL}")
elseif(CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
list(APPEND ASM_FLAGS "${CMAKE_ASM_YASM_FLAGS_RELWITHDEBINFO}")
list(APPEND ASM_FLAGS "${CMAKE_ASM_NASM_FLAGS_RELWITHDEBINFO}")
endif()

set(YASM_FLAGS ${ARGS} ${ASM_FLAGS} PARENT_SCOPE)
string(REPLACE ";" " " CMAKE_ASM_YASM_COMPILER_ARG1 "${ARGS}")
set(NASM_FLAGS ${ARGS} ${ASM_FLAGS} PARENT_SCOPE)
string(REPLACE ";" " " CMAKE_ASM_NASM_COMPILER_ARG1 "${ARGS}")

# This section exists to override the one in CMakeASMInformation.cmake
# (the default Information file). This removes the <FLAGS>
# thing so that your C compiler flags that have been set via
# set_target_properties don't get passed to yasm and confuse it.
# set_target_properties don't get passed to nasm and confuse it.
if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT)
string(REPLACE ";" " " STR_ASM_FLAGS "${ASM_FLAGS}")
set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> ${STR_ASM_FLAGS} -o <OBJECT> <SOURCE>")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
set(ASM_DIALECT "_YASM")
set(CMAKE_ASM${ASM_DIALECT}_COMPILER ${YASM_EXECUTABLE})
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT ${_CMAKE_TOOLCHAIN_PREFIX}yasm)
set(ASM_DIALECT "_NASM")
set(CMAKE_ASM${ASM_DIALECT}_COMPILER ${NASM_EXECUTABLE})
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT ${_CMAKE_TOOLCHAIN_PREFIX}nasm)
include(CMakeDetermineASMCompiler)
set(ASM_DIALECT)
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
set(ASM_DIALECT "_YASM")
set(ASM_DIALECT "_NASM")
include(CMakeTestASMCompiler)
set(ASM_DIALECT)
25 changes: 25 additions & 0 deletions source/cmake/FindNasm.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
include(FindPackageHandleStandardArgs)

# Simple path search with YASM_ROOT environment variable override
find_program(NASM_EXECUTABLE
NAMES nasm nasm-2.13.0-win32 nasm-2.13.0-win64 nasm nasm-2.13.0-win32 nasm-2.13.0-win64
HINTS $ENV{NASM_ROOT} ${NASM_ROOT}
PATH_SUFFIXES bin
)

if(NASM_EXECUTABLE)
execute_process(COMMAND ${NASM_EXECUTABLE} -version
OUTPUT_VARIABLE nasm_version
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(nasm_version MATCHES "^NASM version ([0-9\\.]*)")
set(NASM_VERSION_STRING "${CMAKE_MATCH_1}")
endif()
unset(nasm_version)
endif()

# Provide standardized success/failure messages
find_package_handle_standard_args(nasm
REQUIRED_VARS NASM_EXECUTABLE
VERSION_VAR NASM_VERSION_STRING)
Loading

0 comments on commit 51a6124

Please sign in to comment.