Projects
Essentials
x265
Sign Up
Log In
Username
Password
We truncated the diff of some files because they were too big. If you want to see the full diff for every file,
click here
.
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 32
View file
x265.changes
Changed
@@ -1,4 +1,41 @@ ------------------------------------------------------------------- +Thu Jul 18 13:17:22 UTC 2019 - enzokiel@kabelmail.de + +- Update to version 3.1.1 + - No changelog available. + +- Version 3.1 + New features + * x265 can invoke SVT-HEVC library for encoding through --svt. + * x265 can now accept interlaced inputs directly (no need to + separate fields), and sends it to the encoder with proper fps + and frame-size through --field. + * --fades can detect and handle fade-in regions. This option will + force I-slice and initialize RC history for the brightest frame + after fade-in. + API changes + * A new flag to signal MasterDisplayParams and maxCll/Fall + separately + Encoder enhancements + * Improved the performance of inter-refine level 1 by skipping + the evaluation of smaller CUs when the current block is decided + as “skip” by the save mode. + * New AVX2 primitives to improve the performance of encodes that + enable --ssim-rd. + * Improved performance in medium preset with negligible loss in + quality. + Bug fixes + * Bug fixes for zones. + * Fixed wrap-around from MV structure overflow occurred around 8K + pixels or over. + * Fixed issues in configuring cbQpOffset and crQpOffset for 444 + input + * Fixed cutree offset computation in 2nd pass encodes. + Known issues + * AVX512 main12 asm disabling. + * Inconsistent output with 2-pass due to cutree offset sharing. + +------------------------------------------------------------------- Fri Feb 1 00:32:50 UTC 2019 - antonio.larrosa@gmail.com - Support 10 and 12 bit color depths
View file
x265.spec
Changed
@@ -1,10 +1,10 @@ # based on the spec file from https://build.opensuse.org/package/view_file/home:Simmphonie/libx265/ Name: x265 -%define soname 169 +%define soname 176 %define libname lib%{name} %define libsoname %{libname}-%{soname} -Version: 3.0 +Version: 3.1.1 Release: 0 License: GPL-2.0+ Summary: A free h265/HEVC encoder - encoder binary
View file
baselibs.conf
Changed
@@ -1,1 +1,1 @@ -libx265-169 +libx265-176
View file
x265_3.0.tar.gz/.hg_archival.txt -> x265_3.1.1.tar.gz/.hg_archival.txt
Changed
@@ -1,4 +1,5 @@ repo: 09fe40627f03a0f9c3e6ac78b22ac93da23f9fdf -node: 72188bd2f03447e71e789a5fd2f10364bb232c2c -branch: stable -tag: 3.0 +node: 04b37fdfd2dcde24da4d47ced91dddc10ffe0cbf +branch: Release_3.1 +latesttag: 3.1.1 +latesttagdistance: 1
View file
x265_3.0.tar.gz/.hgtags -> x265_3.1.1.tar.gz/.hgtags
Changed
@@ -32,3 +32,8 @@ bad4e598cac7cdd3df4623c68c91299c620471bd 3.0-rc 0000000000000000000000000000000000000000 3.0-rc 1307fd7b2b9984f45179db01432305a416713049 3.0_RC +72188bd2f03447e71e789a5fd2f10364bb232c2c 3.0 +113518629fa54ffb491dd479e15c1f00dd39d376 3.1_RC1 +b4e38ce16d7c4b37a6482dc7ae61fd31071b6ff1 3.1_RC2 +acce27790559b68f93319cd21b588f90aa93c0b1 3.1 +6f7c2ae0d5bd46506b7a772abebd7eff3fa3bbcb 3.1.1
View file
x265_3.0.tar.gz/doc/reST/cli.rst -> x265_3.1.1.tar.gz/doc/reST/cli.rst
Changed
@@ -551,6 +551,10 @@ This feature can be enabled only in closed GOP structures. Default 0 (disabled). +.. option:: --field, --no-field + + Enable or disable field coding. Default disabled. + Profile, Level, Tier ==================== @@ -1333,6 +1337,10 @@ judder is happening, and allow the encoder to use some blur in these areas of high motion. +In 444, chroma gets twice as much resolution, so halve the quality when psy-rd is enabled. +So when psy-rd is enabled for 444 videos, cbQpOffset and crQpOffset are set to value 6, +if they are not explicitly set. + .. option:: --psy-rd <float> Influence rate distortion optimizated mode decision to preserve the @@ -1516,6 +1524,10 @@ slicetype decision may change with this option. 2 - flush the slicetype decided frames only. +.. option:: --fades, --no-fades + + Detect and handle fade-in regions. Default disabled. + Quality, rate control and rate distortion options ================================================= @@ -2142,6 +2154,12 @@ Note that this string value will need to be escaped or quoted to protect against shell expansion on many platforms. No default. +.. option:: --cll, --no-cll + + Emit content light level SEI. Enabled automatically when :option:`--dolby-vision-profile` 8.1 + is specified. When enabled, signals max-cll and max-fall as 0 if :option:`max-cll` is unspecified. + Default enabled. + .. option:: --hdr, --no-hdr Force signalling of HDR parameters in SEI packets. Enabled @@ -2384,4 +2402,108 @@ **CLI ONLY** +SVT-HEVC Encoder Options +======================== +This section lists options which are SVT-HEVC encoder specific. +See section :ref:`svthevc <SvtHevc>` for more details. + +.. option:: --svt, --no-svt + + Enable SVT-HEVC encoder if x265 is built with SVT-HEVC library. Default + disabled. + +.. option:: --svt-hme, --no-svt-hme + + Enable Hierarchical Motion Estimation(HME) in SVT-HEVC. Default enabled. + + **CLI_ONLY** + +.. option:: --svt-search-width <integer> + + Search Area Width used during motion estimation. It depends on input resolution. + Values: [1-256] + + **CLI_ONLY** + +.. option:: --svt-search-height <integer> + + Search Area Height used during motion estimation. It depends on input resolution. + Values: [1-256] + + **CLI_ONLY** + +.. option:: --svt-compressed-ten-bit-format, --no-svt-compressed-ten-bit-format + + In order to reduce the size of input YUV and to increase channel density, + SVT-HEVC accetps inputs in compressed-ten-bit-format. The conversion between + yuv420p10le and compressed ten bit format is a lossless operation. For more + details about the conversion refer + `here<https://github.com/intel/SVT-HEVC/blob/master/Docs/SVT-HEVC_Encoder_User_Guide.pdf>'_. + + **CLI_ONLY** + +.. option:: --svt-speed-control, --no-svt-speed-control + + Enable speed control functionality to achieve real time encoding speed defined + by :option:`--fps`. Default disabled. + + **CLI_ONLY** + +.. option:: --svt-preset-tuner <integer> + + SVT-HEVC exposes 13 presets. Presets [3-12] of SVT-HEVC is mapped to x265's + presets [placebo-ultrafast]. Ultrafast is mapped to preset(12) of SVT-HEVC, + superfast to preset(11), placebo to preset(3) and so on. svt-preset-tuner works + only on top of placebo preset and maps to presets (0-2) of SVT-HEVC. + + Values: [0-2] + + **CLI_ONLY** + +.. option:: --svt-hierarchical-level <integer> + + Enables multiple hierarchical levels in SVT-HEVC. Accepts values in the range [0-3]. + 0 - Flat + 1 - 2-Level Hierarchy + 2 - 3-Level Hierarchy + 3 - 4-Level Hierarchy + + Default: 3 + + **CLI_ONLY** + +.. option:: --svt-base-layer-switch-mode <integer> + + Choose type of slices to be in base layer. Accepts values 0,1. + 0 - Use B-frames in the base layer + 1 - Use P-frames in the base layer + + Default: 0 + + **CLI_ONLY** + +.. option:: --svt-pred-struct <integer> + + Prediction structure forms the basis in deciding the GOP structure. SVT-HEVC + supports Low delay(P/B) and random access prediction structure. In a low delay + structure, pictures within a mini-gop can only refer to the previous pictures + in display order. In other words, picture with display order N can only refer + to pictures of display order lower than N. In random acccess method, pictures + can be referenced from both the directions. It accepts values in the range + [0-2] + + 0 - Low Delay P + 1 - Low Delay B + 2 - Random Access + + Default: 2 + + **CLI_ONLY** + +.. option:: --svt-fps-in-vps, --no-svt-fps-in-vps + + Enable sending timing info in VPS. Default disabled. + + **CLI_ONLY** + .. vim: noet
View file
x265_3.0.tar.gz/doc/reST/index.rst -> x265_3.1.1.tar.gz/doc/reST/index.rst
Changed
@@ -9,4 +9,5 @@ threading presets lossless + svthevc releasenotes
View file
x265_3.0.tar.gz/doc/reST/releasenotes.rst -> x265_3.1.1.tar.gz/doc/reST/releasenotes.rst
Changed
@@ -1,6 +1,40 @@ ************* Release Notes ************* + +Version 3.1 +=========== + +Release date - 18th June, 2019. + +New features +---------------- +1. x265 can invoke SVT-HEVC library for encoding through :option:`--svt`. +2. x265 can now accept interlaced inputs directly (no need to separate fields), and sends it to the encoder with proper fps and frame-size through :option:`--field`. +3. :option:`--fades` can detect and handle fade-in regions. This option will force I-slice and initialize RC history for the brightest frame after fade-in. + +API changes +----------- +1. A new flag to signal MasterDisplayParams and maxCll/Fall separately + +Encoder enhancements +-------------------- +1. Improved the performance of inter-refine level 1 by skipping the evaluation of smaller CUs when the current block is decided as "skip" by the save mode. +2. New AVX2 primitives to improve the performance of encodes that enable :option:`--ssim-rd`. +3. Improved performance in medium preset with negligible loss in quality. + +Bug fixes +--------- +1. Bug fixes for zones. +2. Fixed wrap-around from MV structure overflow occurred around 8K pixels or over. +3. Fixed issues in configuring cbQpOffset and crQpOffset for 444 input +4. Fixed cutree offset computation in 2nd pass encodes. + +Known issues +------------ +1. AVX512 main12 asm disabling. +2. Inconsistent output with 2-pass due to cutree offset sharing. + Version 3.0 ===========
View file
x265_3.1.1.tar.gz/doc/reST/svthevc.rst
Added
@@ -0,0 +1,202 @@ +SVT-HEVC +-------- + +.. _SvtHevc: + +x265 has support for open source HEVC encoder `SVT-HEVC <https://01.org/svt>`_ +and can generate SVT-HEVC compliant bitstreams. SVT-HEVC encoder can be enabled at run time +using :option:`--svt`. Since SVT-HEVC params/CLI are not exposed outside, it has to be +configured only via x265 CLI options. The API's of SVT-HEVC are accessed through x265's API +so even library users of x265 can avail this feature, under the condition that x265_param_parse() +API should be used for all param assignment. Params assigned outside of x265_param_parse() API +wont't be mapped to SVT-HEVC. This document describes the steps needed to compile x265 +with SVT-HEVC and CLI options mapping between x265 and SVT-HEVC. + +Build Steps +=========== +This section describes the build steps to be followed to link SVT-HEVC with x265. + +**SVT-HEVC** + +1. Clone `SVT-HEVC <https://github.com/intel/SVT-HEVC>`_ (say at path "/home/app/") and build it (follow the build steps in its README file) +2. Once build is successful, binaries can be found inside the *Bin* folder at its root directory ("/home/app/SVT-HEVC/Bin/Release/") + +**x265** + +1. Set environmental variables SVT_HEVC_INCLUDE_DIR and SVT_HEVC_LIBRARY_DIR to help x265 locate SVT-HEVC. For example: + * export SVT_HEVC_INCLUDE_DIR = /home/app/SVT-HEVC/Source/API/ + * export SVT_HEVC_LIBRARY_DIR = /home/app/SVT-HEVC/Bin/Release/ +2. Enable the cmake option ENABLE_SVT_HEVC and continue the normal build process + +CLI options Mapping +=================== +Once x265 is compiled with SVT-HEVC, SVT-HEVC encoder can be invoked at run time using +:option:`--svt`. :option:`--svt` can be added anywhere in the command line, x265 application will automatically +parse it first and maps all other x265 CLI's present in the command line to SVT-HEVC encoder options +internally and configures the same. Below table shows the actual mapping of x265 CLI options to +SVT-HEVC encoder options (Name as shown in SVT-HEVC's sample configuration file) + ++-------------------------------------------+------------------------------+------------------------------+ +| x265 CLI option | SVT-HEVC Encoder Option | Range | ++===========================================+==============================+==============================+ +| :option:`--input` | InputFile | Any String | ++-------------------------------------------+------------------------------+------------------------------+ +| :option:`--output` | StreamFile | Any String | ++-------------------------------------------+------------------------------+------------------------------+ +| :option:`--input-depth` | EncoderBitDepth | [8, 10] | ++-------------------------------------------+------------------------------+------------------------------+ +| | SourceWidth | [64 - 8192] | +| :option:`--input-res` +------------------------------+------------------------------+ +| | SourceHeight | [64 - 8192] | ++-------------------------------------------+------------------------------+------------------------------+ +| :option:`--frames` | FrameToBeEncoded | Any Positive Integer | ++-------------------------------------------+------------------------------+------------------------------+ +| | FrameRateNumerator | Any Positive Integer | +| :option:`--fps` +------------------------------+------------------------------+ +| | FrameRateDenominator | Any Positive Integer | ++-------------------------------------------+------------------------------+------------------------------+ +| :option:`--profile` | Profile | [main, main10] | ++-------------------------------------------+------------------------------+------------------------------+ +| :option:`--level-idc` | Level | [1, 2, 2.1, 3, 3.1, 4, 4.1, | +| | | 5, 5.1, 5.2, 6, 6.1, 6.2] | ++-------------------------------------------+------------------------------+------------------------------+ +| :option:`--high-tier` | Tier | | ++-------------------------------------------+------------------------------+------------------------------+ +| :option:`--qpmin` | MinQpAllowed | [0 - 50] | ++-------------------------------------------+------------------------------+------------------------------+ +| :option:`--qpmax` | MaxQpAllowed | [0 - 51] | ++-------------------------------------------+------------------------------+------------------------------+ +| :option:`--rc-lookahead` | LookAheadDistance | [0 - 250] | ++-------------------------------------------+------------------------------+------------------------------+ +| :option:`--scenecut` | SceneChangeDetection | Any Positive Integer | ++-------------------------------------------+------------------------------+------------------------------+ +| :option:`--open-gop` | IntraRefreshType | | ++-------------------------------------------+------------------------------+------------------------------+ +| :option:`--deblock` | LoopFilterDisable | Any Integer | ++-------------------------------------------+------------------------------+------------------------------+ +| :option:`--sao` | SAO | | ++-------------------------------------------+------------------------------+------------------------------+ +| :option:`--keyint` | IntraPeriod | [(-2) - 255] | ++-------------------------------------------+------------------------------+------------------------------+ +| :option:`--constrained-intra` | ConstrainedIntra | | ++-------------------------------------------+------------------------------+------------------------------+ +| :option:`--vui-timing-info` | VideoUsabilityInfo | | ++-------------------------------------------+------------------------------+------------------------------+ +| :option:`--hdr` | HighDynamicRangeInput | | ++-------------------------------------------+------------------------------+------------------------------+ +| :option:`--aud` | AccessUnitDelimeter | | ++-------------------------------------------+------------------------------+------------------------------+ +| | RateControlMode | RateControlMode = 0 | +| :option:`--qp` +------------------------------+------------------------------+ +| | QP | [0 - 51] | ++-------------------------------------------+------------------------------+------------------------------+ +| | RateControlMode | RateControlMode = 1 | +| :option:`--bitrate` +------------------------------+------------------------------+ +| | TargetBitrate | Any Positive Integer | ++-------------------------------------------+------------------------------+------------------------------+ +| :option:`--interlace` | InterlacedVideo | [0 - 2] | ++-------------------------------------------+------------------------------+------------------------------+ +| :option:`--pools` | TargetSocket, | Maximum NUMA Nodes = 2 | +| | LogicalProcessors | | ++-------------------------------------------+------------------------------+------------------------------+ +| :option:`--master-display` | MasteringDisplayColorVolume | Any String | ++-------------------------------------------+------------------------------+------------------------------+ +| :option:`--max-cll` | maxCLL, maxFALL | Any Positve Integer | ++-------------------------------------------+------------------------------+------------------------------+ +| :option:`--dolby-vision-profile` | DolbyVisionProfile | [8.1] | ++-------------------------------------------+------------------------------+------------------------------+ +| :option:`--dolby-vision-rpu` | DolbyVisionRpuFile | Any String | ++-------------------------------------------+------------------------------+------------------------------+ +| :option:`--nalu-file` | NaluFile | Any String | ++-------------------------------------------+------------------------------+------------------------------+ +| :option:`--tune` zerolatency | LatencyMode | | ++-------------------------------------------+------------------------------+------------------------------+ +| :option:`--svt-search-width` | SearchAreaWidth | [1 - 256] | ++-------------------------------------------+------------------------------+------------------------------+ +| :option:`--svt-search-height` | SearchAreaHeight | [1 - 256] | ++-------------------------------------------+------------------------------+------------------------------+ +| :option:`--svt-hierarchical-level` | HierarchicalLevels | [0 - 3] | ++-------------------------------------------+------------------------------+------------------------------+ +| :option:`--svt-base-layer-switch-mode` | BaseLayerSwitchMode | [0, 1] | +| | | | ++-------------------------------------------+------------------------------+------------------------------+ +| :option:`--svt-pred-struct` | PredStructure | [0 - 2] | ++-------------------------------------------+------------------------------+------------------------------+ +| :option:`--svt-hme` | HME, UseDefaultMeHme | | ++-------------------------------------------+------------------------------+------------------------------+ +| :option:`--svt-compressed-ten-bit-format` | CompressedTenBitFormat | | +| | | | ++-------------------------------------------+------------------------------+------------------------------+ +| :option:`--svt-speed-control` | SpeedControlFlag | | ++-------------------------------------------+------------------------------+------------------------------+ +| :option:`--svt-fps-in-vps` | FpsInVps | | ++-------------------------------------------+------------------------------+------------------------------+ + +x265 CLI options which are not present in the above table will have no effect if SVT-HEVC is enabled +and would be ignored silently with a warning. If SVT-HEVC is enabled, accepted input range of x265 CLI +options will change, because it follows SVT-HEVC encoder's specs, which are mentioned in the Range +section in the above table. Options starting with prefix "--svt-" are newly added to +fecilitate access to the features of SVT-HEVC which couldn't be mapped to the existing x265 CLI's. +So these options will have effect only if SVT-HEVC is enabled and would be ignored with default x265 encode. + +Preset & Tune Options Mapping +============================= +x265 has 10 presets from ultrafast to placebo whereas SVT-HEVC has 13 presets. Use :option:`--svt-preset-tuner` +with Placebo preset to access the additional 3 presets of SVT-HEVC. Note that :option:`--svt-preset-tuner` should be +used only if SVT-HEVC is enabled and only with Placebo preset, would be ignored otherwise. +Below table shows the actual mapping of presets, + ++----------------------------------------+------------------------------+ +| x265 Preset | SVT-HEVC Preset | ++========================================+==============================+ +| Ultrafast | 12 | ++----------------------------------------+------------------------------+ +| Superfast | 11 | ++----------------------------------------+------------------------------+ +| Veryfast | 10 | ++----------------------------------------+------------------------------+ +| Faster | 9 | ++----------------------------------------+------------------------------+ +| Fast | 8 | ++----------------------------------------+------------------------------+ +| Medium | 7 | ++----------------------------------------+------------------------------+ +| Slow | 6 | ++----------------------------------------+------------------------------+ +| Slower | 5 | ++----------------------------------------+------------------------------+ +| Veryslow | 4 | ++----------------------------------------+------------------------------+ +| Placebo | 3 | ++----------------------------------------+------------------------------+ +| Placebo :option:`--svt-preset-tuner` 0 | 0 | ++----------------------------------------+------------------------------+ +| Placebo :option:`--svt-preset-tuner` 1 | 1 | ++----------------------------------------+------------------------------+ +| Placebo :option:`--svt-preset-tuner` 2 | 2 | ++----------------------------------------+------------------------------+ + +x265 has 5 tune modes (psnr, ssim, grain, zero-latency, animation) whereas SVT-HEVC +has only 3 tune modes (0 - visual quality, 1 - PSNR / SSIM and 2 - VMAF). Below +table shows the mapping of tune modes, + ++-----------------------+---------------------------+ +| x265 Tune Modes | SVT-HEVC Tune Modes | ++=======================+===========================+ +| vmaf | 2 | ++-----------------------+---------------------------+ +| psnr | 1 | ++-----------------------+---------------------------+ +| ssim | 1 | ++-----------------------+---------------------------+ +| grain | 0 | ++-----------------------+---------------------------+ +| fastdecode | 0 | ++-----------------------+---------------------------+ +| zerolatency | 0 | ++-----------------------+---------------------------+ +| animation | 0 | ++-----------------------+---------------------------+
View file
x265_3.0.tar.gz/source/CMakeLists.txt -> x265_3.1.1.tar.gz/source/CMakeLists.txt
Changed
@@ -29,7 +29,7 @@ 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 169) +set(X265_BUILD 176) configure_file("${PROJECT_SOURCE_DIR}/x265.def.in" "${PROJECT_BINARY_DIR}/x265.def") configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in" @@ -392,6 +392,16 @@ add_subdirectory(dynamicHDR10) add_definitions(-DENABLE_HDR10_PLUS) endif(ENABLE_HDR10_PLUS) + +option(ENABLE_SVT_HEVC "Enable SVT HEVC Encoder" OFF) +if(ENABLE_SVT_HEVC) + find_package(svthevc) + if(SVTHEVC_FOUND) + add_definitions(-DSVT_HEVC) + include_directories(${SVT_HEVC_INCLUDE_DIR}) + endif(SVTHEVC_FOUND) +endif(ENABLE_SVT_HEVC) + # this option can only be used when linking multiple libx265 libraries # together, and some alternate API access method is implemented. option(EXPORT_C_API "Implement public C programming interface" ON) @@ -547,6 +557,9 @@ if(ENABLE_LIBVMAF) target_link_libraries(x265-static ${VMAF}) endif() +if(SVTHEVC_FOUND) + target_link_libraries(x265-static ${SVT_HEVC_LIBRARY}) +endif() install(TARGETS x265-static LIBRARY DESTINATION ${LIB_INSTALL_DIR} ARCHIVE DESTINATION ${LIB_INSTALL_DIR}) @@ -556,6 +569,14 @@ LIBRARY DESTINATION ${LIB_INSTALL_DIR} ARCHIVE DESTINATION ${LIB_INSTALL_DIR}) endif() + +if(SVTHEVC_FOUND) + install(FILES "${SVT_HEVC_INCLUDE_DIR}/EbApi.h" DESTINATION include) + install(FILES "${SVT_HEVC_INCLUDE_DIR}/EbErrorCodes.h" DESTINATION include) + install(FILES "${SVT_HEVC_INCLUDE_DIR}/EbTime.h" DESTINATION include) + install(FILES "${SVT_HEVC_LIBRARY}" DESTINATION ${BIN_INSTALL_DIR}) +endif() + install(FILES x265.h "${PROJECT_BINARY_DIR}/x265_config.h" DESTINATION include) if((WIN32 AND ENABLE_CLI) OR (WIN32 AND ENABLE_SHARED)) if(MSVC_IDE) @@ -607,7 +628,10 @@ if(EXTRA_LIB) target_link_libraries(x265-shared ${EXTRA_LIB}) endif() - target_link_libraries(x265-shared ${PLATFORM_LIBS}) + target_link_libraries(x265-shared ${PLATFORM_LIBS}) + if(SVTHEVC_FOUND) + target_link_libraries(x265-shared ${SVT_HEVC_LIBRARY}) + endif(SVTHEVC_FOUND) if(MSVC) set_target_properties(x265-shared PROPERTIES OUTPUT_NAME libx265) else()
View file
x265_3.1.1.tar.gz/source/cmake/Findsvthevc.cmake
Added
@@ -0,0 +1,60 @@ +# Module for locating SVT-HEVC Library +# +# SVT_HEVC_INCLUDE_DIR +# Points to the SVT-HEVC include directory. +# +# SVT_HEVC_LIBRARY +# Points to the SVT-HEVC library +# Copyright (c) 2013-2018 MulticoreWare, Inc + +include(FindPackageHandleStandardArgs) + +if(UNIX) +SET(CMAKE_FIND_LIBRARY_SUFFIXES ".so") +else() +SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib") +endif() + +set(SVT_VERSION_MAJOR_REQUIRED 1) +set(SVT_VERSION_MINOR_REQUIRED 3) +set(SVT_VERSION_PATCHLEVEL_REQUIRED 0) + +find_path(SVT_HEVC_INCLUDE_DIR + NAMES EbApi.h EbErrorCodes.h EbTime.h + HINTS $ENV{SVT_HEVC_INCLUDE_DIR} + PATHS ENV + DOC "SVT-HEVC include directory") + +if(SVT_HEVC_INCLUDE_DIR) +file(READ "${SVT_HEVC_INCLUDE_DIR}/EbApi.h" version) + +string(REGEX MATCH "SVT_VERSION_MAJOR ([0-9]*)" _ ${version}) +set(SVT_VERSION_MAJOR ${CMAKE_MATCH_1}) + +string(REGEX MATCH "SVT_VERSION_MINOR ([0-9]*)" _ ${version}) +set(SVT_VERSION_MINOR ${CMAKE_MATCH_1}) + +string(REGEX MATCH "SVT_VERSION_PATCHLEVEL ([0-9]*)" _ ${version}) +set(SVT_VERSION_PATCHLEVEL ${CMAKE_MATCH_1}) + +if(NOT ${SVT_VERSION_MAJOR} EQUAL "1" OR NOT ${SVT_VERSION_MINOR} EQUAL "3" OR NOT ${SVT_VERSION_PATCHLEVEL} EQUAL "0") + message (SEND_ERROR "-- Found SVT-HEVC Lib Version: ${SVT_VERSION_MAJOR}.${SVT_VERSION_MINOR}.${SVT_VERSION_PATCHLEVEL} which doesn't match the required version: ${SVT_VERSION_MAJOR_REQUIRED}.${SVT_VERSION_MINOR_REQUIRED}.${SVT_VERSION_PATCHLEVEL_REQUIRED}; Aborting configure ") +else() + message(STATUS "-- Found SVT-HEVC Lib Version: ${SVT_VERSION_MAJOR}.${SVT_VERSION_MINOR}.${SVT_VERSION_PATCHLEVEL}") +endif() + +endif() + +find_library(SVT_HEVC_LIBRARY +if(UNIX) + NAMES SvtHevcEnc +else() + NAMES SvtHevcEnc +endif() + HINTS $ENV{SVT_HEVC_LIBRARY_DIR} + PATHS ENV + DOC "SVT-HEVC library") + + +mark_as_advanced(SVT_HEVC_LIBRARY SVT_HEVC_INCLUDE_DIR SVT_HEVC_LIBRARY_DIR) +find_package_handle_standard_args(SVTHEVC REQUIRED_VARS SVT_HEVC_LIBRARY SVT_HEVC_INCLUDE_DIR)
View file
x265_3.0.tar.gz/source/common/cudata.cpp -> x265_3.1.1.tar.gz/source/common/cudata.cpp
Changed
@@ -106,7 +106,7 @@ int mvx = x265_clip3(-32768, 32767, (scale * mv.x + 127 + (scale * mv.x < 0)) >> 8); int mvy = x265_clip3(-32768, 32767, (scale * mv.y + 127 + (scale * mv.y < 0)) >> 8); - return MV((int16_t)mvx, (int16_t)mvy); + return MV((int32_t)mvx, (int32_t)mvy); } } @@ -1917,11 +1917,11 @@ const uint32_t mvshift = 2; uint32_t offset = 8; - int16_t xmax = (int16_t)((m_slice->m_sps->picWidthInLumaSamples + offset - m_cuPelX - 1) << mvshift); - int16_t xmin = -(int16_t)((m_encData->m_param->maxCUSize + offset + m_cuPelX - 1) << mvshift); + int32_t xmax = (int32_t)((m_slice->m_sps->picWidthInLumaSamples + offset - m_cuPelX - 1) << mvshift); + int32_t xmin = -(int32_t)((m_encData->m_param->maxCUSize + offset + m_cuPelX - 1) << mvshift); - int16_t ymax = (int16_t)((m_slice->m_sps->picHeightInLumaSamples + offset - m_cuPelY - 1) << mvshift); - int16_t ymin = -(int16_t)((m_encData->m_param->maxCUSize + offset + m_cuPelY - 1) << mvshift); + int32_t ymax = (int32_t)((m_slice->m_sps->picHeightInLumaSamples + offset - m_cuPelY - 1) << mvshift); + int32_t ymin = -(int32_t)((m_encData->m_param->maxCUSize + offset + m_cuPelY - 1) << mvshift); outMV.x = X265_MIN(xmax, X265_MAX(xmin, outMV.x)); outMV.y = X265_MIN(ymax, X265_MAX(ymin, outMV.y));
View file
x265_3.0.tar.gz/source/common/frame.cpp -> x265_3.1.1.tar.gz/source/common/frame.cpp
Changed
@@ -56,6 +56,7 @@ m_addOnCtuInfo = NULL; m_addOnPrevChange = NULL; m_classifyFrame = false; + m_fieldNum = 0; } bool Frame::create(x265_param *param, float* quantOffsets)
View file
x265_3.0.tar.gz/source/common/frame.h -> x265_3.1.1.tar.gz/source/common/frame.h
Changed
@@ -129,6 +129,7 @@ uint32_t* m_classifyCount; bool m_classifyFrame; + int m_fieldNum; Frame();
View file
x265_3.0.tar.gz/source/common/lowres.cpp -> x265_3.1.1.tar.gz/source/common/lowres.cpp
Changed
@@ -71,7 +71,7 @@ size_t planesize = lumaStride * (lines + 2 * origPic->m_lumaMarginY); size_t padoffset = lumaStride * origPic->m_lumaMarginY + origPic->m_lumaMarginX; - if (!!param->rc.aqMode || !!param->rc.hevcAq) + if (!!param->rc.aqMode || !!param->rc.hevcAq || !!param->bAQMotion) { CHECKED_MALLOC_ZERO(qpAqOffset, double, cuCountFullRes); CHECKED_MALLOC_ZERO(invQscaleFactor, int, cuCountFullRes); @@ -82,7 +82,7 @@ if (origPic->m_param->bAQMotion) CHECKED_MALLOC_ZERO(qpAqMotionOffset, double, cuCountFullRes); - if (origPic->m_param->bDynamicRefine) + if (origPic->m_param->bDynamicRefine || origPic->m_param->bEnableFades) CHECKED_MALLOC_ZERO(blockVariance, uint32_t, cuCountFullRes); if (!!param->rc.hevcAq) @@ -217,6 +217,7 @@ { bLastMiniGopBFrame = false; bKeyframe = false; // Not a keyframe unless identified by lookahead + bIsFadeEnd = false; frameNum = poc; leadingBframes = 0; indB = 0;
View file
x265_3.0.tar.gz/source/common/lowres.h -> x265_3.1.1.tar.gz/source/common/lowres.h
Changed
@@ -160,6 +160,7 @@ bool bScenecut; // Set to false if the frame cannot possibly be part of a real scenecut. bool bKeyframe; bool bLastMiniGopBFrame; + bool bIsFadeEnd; double ipCostRatio; @@ -195,6 +196,7 @@ uint32_t* blockVariance; uint64_t wp_ssd[3]; // This is different than SSDY, this is sum(pixel^2) - sum(pixel)^2 for entire frame uint64_t wp_sum[3]; + double frameVariance; /* cutree intermediate data */ PicQPAdaptationLayer* pAQLayer;
View file
x265_3.0.tar.gz/source/common/mv.h -> x265_3.1.1.tar.gz/source/common/mv.h
Changed
@@ -39,16 +39,16 @@ public: union { - struct { int16_t x, y; }; + struct { int32_t x, y; }; - int32_t word; + int64_t word; }; MV() {} - MV(int32_t w) : word(w) {} - MV(int16_t _x, int16_t _y) : x(_x), y(_y) {} + MV(int64_t w) : word(w) {} + MV(int32_t _x, int32_t _y) : x(_x), y(_y) {} - MV& operator =(uint32_t w) { word = w; return *this; } + MV& operator =(uint64_t w) { word = w; return *this; } MV& operator +=(const MV& other) { x += other.x; y += other.y; return *this; } @@ -67,7 +67,7 @@ MV operator >>(int i) const { return MV(x >> i, y >> i); } - MV operator *(int16_t i) const { return MV(x * i, y * i); } + MV operator *(int32_t i) const { return MV(x * i, y * i); } MV operator -(const MV& other) const { return MV(x - other.x, y - other.y); } @@ -87,7 +87,7 @@ bool inline notZero() const { return this->word != 0; } - bool inline isSubpel() const { return (this->word & 0x00030003) != 0; } + bool inline isSubpel() const { return (this->word & 0x0000000300000003ll) != 0; } MV mvmin(const MV& m) const { return MV(x > m.x ? m.x : x, y > m.y ? m.y : y); }
View file
x265_3.0.tar.gz/source/common/param.cpp -> x265_3.1.1.tar.gz/source/common/param.cpp
Changed
@@ -28,6 +28,7 @@ #include "param.h" #include "cpu.h" #include "x265.h" +#include "svt.h" #if _MSC_VER #pragma warning(disable: 4996) // POSIX functions are just fine, thanks @@ -92,16 +93,28 @@ x265_param *x265_param_alloc() { - return (x265_param*)x265_malloc(sizeof(x265_param)); + x265_param* param = (x265_param*)x265_malloc(sizeof(x265_param)); +#ifdef SVT_HEVC + param->svtHevcParam = (EB_H265_ENC_CONFIGURATION*)x265_malloc(sizeof(EB_H265_ENC_CONFIGURATION)); +#endif + return param; } void x265_param_free(x265_param* p) { + x265_zone_free(p); +#ifdef SVT_HEVC + x265_free(p->svtHevcParam); +#endif x265_free(p); } void x265_param_default(x265_param* param) { +#ifdef SVT_HEVC + EB_H265_ENC_CONFIGURATION* svtParam = (EB_H265_ENC_CONFIGURATION*)param->svtHevcParam; +#endif + memset(param, 0, sizeof(x265_param)); /* Applying default values to all elements in the param structure */ @@ -127,6 +140,7 @@ param->uhdBluray = 0; param->bHighTier = 1; //Allow high tier by default param->interlaceMode = 0; + param->bField = 0; param->bAnnexB = 1; param->bRepeatHeaders = 0; param->bEnableAccessUnitDelimiters = 0; @@ -159,6 +173,7 @@ param->chunkStart = 0; param->chunkEnd = 0; param->bEnableHRDConcatFlag = 0; + param->bEnableFades = 0; /* Intra Coding Tools */ param->bEnableConstrainedIntra = 0; @@ -170,12 +185,12 @@ param->searchMethod = X265_HEX_SEARCH; param->subpelRefine = 2; param->searchRange = 57; - param->maxNumMergeCand = 2; - param->limitReferences = 3; + param->maxNumMergeCand = 3; + param->limitReferences = 1; param->limitModes = 0; param->bEnableWeightedPred = 1; param->bEnableWeightedBiPred = 0; - param->bEnableEarlySkip = 0; + param->bEnableEarlySkip = 1; param->bEnableRecursionSkip = 1; param->bEnableAMP = 0; param->bEnableRectInter = 0; @@ -210,7 +225,7 @@ param->analysisReuseFileName = NULL; param->analysisSave = NULL; param->analysisLoad = NULL; - param->bIntraInBFrames = 0; + param->bIntraInBFrames = 1; param->bLossless = 0; param->bCULossless = 0; param->bEnableTemporalSubLayers = 0; @@ -317,6 +332,16 @@ /* SEI messages */ param->preferredTransferCharacteristics = -1; param->pictureStructure = -1; + param->bEmitCLL = 1; + + /* SVT Hevc Encoder specific params */ + param->bEnableSvtHevc = 0; + param->svtHevcParam = NULL; + +#ifdef SVT_HEVC + param->svtHevcParam = svtParam; + svt_param_default(param); +#endif } int x265_param_default_preset(x265_param* param, const char* preset, const char* tune) @@ -336,6 +361,8 @@ if (!strcmp(preset, "ultrafast")) { + param->maxNumMergeCand = 2; + param->bIntraInBFrames = 0; param->lookaheadDepth = 5; param->scenecutThreshold = 0; // disable lookahead param->maxCUSize = 32; @@ -344,7 +371,6 @@ param->bFrameAdaptive = 0; param->subpelRefine = 0; param->searchMethod = X265_DIA_SEARCH; - param->bEnableEarlySkip = 1; param->bEnableSAO = 0; param->bEnableSignHiding = 0; param->bEnableWeightedPred = 0; @@ -359,12 +385,13 @@ } else if (!strcmp(preset, "superfast")) { + param->maxNumMergeCand = 2; + param->bIntraInBFrames = 0; param->lookaheadDepth = 10; param->maxCUSize = 32; param->bframes = 3; param->bFrameAdaptive = 0; param->subpelRefine = 1; - param->bEnableEarlySkip = 1; param->bEnableWeightedPred = 0; param->rdLevel = 2; param->maxNumReferences = 1; @@ -378,10 +405,12 @@ } else if (!strcmp(preset, "veryfast")) { + param->maxNumMergeCand = 2; + param->limitReferences = 3; + param->bIntraInBFrames = 0; param->lookaheadDepth = 15; param->bFrameAdaptive = 0; param->subpelRefine = 1; - param->bEnableEarlySkip = 1; param->rdLevel = 2; param->maxNumReferences = 2; param->rc.qgSize = 32; @@ -389,15 +418,21 @@ } else if (!strcmp(preset, "faster")) { + param->maxNumMergeCand = 2; + param->limitReferences = 3; + param->bIntraInBFrames = 0; param->lookaheadDepth = 15; param->bFrameAdaptive = 0; - param->bEnableEarlySkip = 1; param->rdLevel = 2; param->maxNumReferences = 2; param->bEnableFastIntra = 1; } else if (!strcmp(preset, "fast")) { + param->maxNumMergeCand = 2; + param->limitReferences = 3; + param->bEnableEarlySkip = 0; + param->bIntraInBFrames = 0; param->lookaheadDepth = 15; param->bFrameAdaptive = 0; param->rdLevel = 2; @@ -410,13 +445,15 @@ } else if (!strcmp(preset, "slow")) { + param->limitReferences = 3; + param->bEnableEarlySkip = 0; + param->bIntraInBFrames = 0; param->bEnableRectInter = 1; param->lookaheadDepth = 25; param->rdLevel = 4; param->rdoqLevel = 2; param->psyRdoq = 1.0; param->subpelRefine = 3; - param->maxNumMergeCand = 3; param->searchMethod = X265_STAR_SEARCH; param->maxNumReferences = 4; param->limitModes = 1; @@ -424,6 +461,7 @@ } else if (!strcmp(preset, "slower")) { + param->bEnableEarlySkip = 0; param->bEnableWeightedBiPred = 1; param->bEnableAMP = 1; param->bEnableRectInter = 1; @@ -438,14 +476,13 @@ param->maxNumMergeCand = 4; param->searchMethod = X265_STAR_SEARCH; param->maxNumReferences = 5; - param->limitReferences = 1; param->limitModes = 1; - param->bIntraInBFrames = 1; param->lookaheadSlices = 0; // disabled for best quality param->limitTU = 4; }
View file
x265_3.0.tar.gz/source/common/param.h -> x265_3.1.1.tar.gz/source/common/param.h
Changed
@@ -37,6 +37,7 @@ void setParamAspectRatio(x265_param *p, int width, int height); void getParamAspectRatio(x265_param *p, int& width, int& height); bool parseLambdaFile(x265_param *param); +void x265_copy_params(x265_param* dst, x265_param* src); /* this table is kept internal to avoid confusion, since log level indices start at -1 */ static const char * const logLevelNames[] = { "none", "error", "warning", "info", "debug", "full", 0 };
View file
x265_3.0.tar.gz/source/common/pixel.cpp -> x265_3.1.1.tar.gz/source/common/pixel.cpp
Changed
@@ -934,6 +934,44 @@ } } +template<int log2TrSize> +static void ssimDist_c(const pixel* fenc, uint32_t fStride, const pixel* recon, intptr_t rstride, uint64_t *ssBlock, int shift, uint64_t *ac_k) +{ + *ssBlock = 0; + int trSize = 1 << log2TrSize; + for (int y = 0; y < trSize; y++) + { + for (int x = 0; x < trSize; x++) + { + int temp = fenc[y * fStride + x] - recon[y * rstride + x]; // copy of residual coeff + *ssBlock += temp * temp; + } + } + + *ac_k = 0; + for (int block_yy = 0; block_yy < trSize; block_yy += 1) + { + for (int block_xx = 0; block_xx < trSize; block_xx += 1) + { + uint32_t temp = fenc[block_yy * fStride + block_xx] >> shift; + *ac_k += temp * temp; + } + } +} + +static void normFact_c(const pixel* src, uint32_t blockSize, int shift, uint64_t *z_k) +{ + *z_k = 0; + for (uint32_t block_yy = 0; block_yy < blockSize; block_yy += 1) + { + for (uint32_t block_xx = 0; block_xx < blockSize; block_xx += 1) + { + uint32_t temp = src[block_yy * blockSize + block_xx] >> shift; + *z_k += temp * temp; + } + } +} + #if HIGH_BIT_DEPTH static pixel planeClipAndMax_c(pixel *src, intptr_t stride, int width, int height, uint64_t *outsum, const pixel minPix, const pixel maxPix) @@ -1283,5 +1321,16 @@ p.propagateCost = estimateCUPropagateCost; p.fix8Unpack = cuTreeFix8Unpack; p.fix8Pack = cuTreeFix8Pack; + + p.cu[BLOCK_4x4].ssimDist = ssimDist_c<2>; + p.cu[BLOCK_8x8].ssimDist = ssimDist_c<3>; + p.cu[BLOCK_16x16].ssimDist = ssimDist_c<4>; + p.cu[BLOCK_32x32].ssimDist = ssimDist_c<5>; + p.cu[BLOCK_64x64].ssimDist = ssimDist_c<6>; + + p.cu[BLOCK_8x8].normFact = normFact_c; + p.cu[BLOCK_16x16].normFact = normFact_c; + p.cu[BLOCK_32x32].normFact = normFact_c; + p.cu[BLOCK_64x64].normFact = normFact_c; } }
View file
x265_3.0.tar.gz/source/common/primitives.h -> x265_3.1.1.tar.gz/source/common/primitives.h
Changed
@@ -227,6 +227,8 @@ typedef void(*psyRdoQuant_t)(int16_t *m_resiDctCoeff, int16_t *m_fencDctCoeff, int64_t *costUncoded, int64_t *totalUncodedCost, int64_t *totalRdCost, int64_t *psyScale, uint32_t blkPos); typedef void(*psyRdoQuant_t1)(int16_t *m_resiDctCoeff, int64_t *costUncoded, int64_t *totalUncodedCost, int64_t *totalRdCost,uint32_t blkPos); typedef void(*psyRdoQuant_t2)(int16_t *m_resiDctCoeff, int16_t *m_fencDctCoeff, int64_t *costUncoded, int64_t *totalUncodedCost, int64_t *totalRdCost, int64_t *psyScale, uint32_t blkPos); +typedef void(*ssimDistortion_t)(const pixel *fenc, uint32_t fStride, const pixel *recon, intptr_t rstride, uint64_t *ssBlock, int shift, uint64_t *ac_k); +typedef void(*normFactor_t)(const pixel *src, uint32_t blockSize, int shift, uint64_t *z_k); /* Function pointers to optimized encoder primitives. Each pointer can reference * either an assembly routine, a SIMD intrinsic primitive, or a C function */ struct EncoderPrimitives @@ -303,6 +305,8 @@ psyRdoQuant_t psyRdoQuant; psyRdoQuant_t1 psyRdoQuant_1p; psyRdoQuant_t2 psyRdoQuant_2p; + ssimDistortion_t ssimDist; + normFactor_t normFact; } cu[NUM_CU_SIZES]; /* These remaining primitives work on either fixed block sizes or take
View file
x265_3.0.tar.gz/source/common/quant.cpp -> x265_3.1.1.tar.gz/source/common/quant.cpp
Changed
@@ -501,15 +501,8 @@ // Calculation of (X(k) - Y(k)) * (X(k) - Y(k)), AC ssBlock = 0; - for (int y = 0; y < trSize; y++) - { - for (int x = 0; x < trSize; x++) - { - int temp = fenc[y * fStride + x] - recon[y * rstride + x]; // copy of residual coeff - ssBlock += temp * temp; - } - } - + uint64_t ac_k = 0; + primitives.cu[log2TrSize - 2].ssimDist(fenc, fStride, recon, rstride, &ssBlock, shift, &ac_k); ssAc = ssBlock - ssDc; // 1. Calculation of fdc' @@ -535,15 +528,6 @@ uint64_t fAc_num = 0; // 2. Calculate ac component - uint64_t ac_k = 0; - for (int block_yy = 0; block_yy < trSize; block_yy += 1) - { - for (int block_xx = 0; block_xx < trSize; block_xx += 1) - { - uint32_t temp = fenc[block_yy * fStride + block_xx] >> shift; - ac_k += temp * temp; - } - } ac_k -= dc_k; double s = 1 + 0.005 * cu.m_qp[absPartIdx];
View file
x265_3.0.tar.gz/source/common/slice.h -> x265_3.1.1.tar.gz/source/common/slice.h
Changed
@@ -361,6 +361,7 @@ int numRefIdxDefault[2]; int m_iNumRPSInSPS; const x265_param *m_param; + int m_fieldNum; Slice() { @@ -376,6 +377,7 @@ numRefIdxDefault[1] = 1; m_rpsIdx = -1; m_chromaQpOffset[0] = m_chromaQpOffset[1] = 0; + m_fieldNum = 0; } void disableWeights();
View file
x265_3.0.tar.gz/source/common/x86/asm-primitives.cpp -> x265_3.1.1.tar.gz/source/common/x86/asm-primitives.cpp
Changed
@@ -2319,6 +2319,17 @@ p.cu[BLOCK_16x16].psyRdoQuant_1p = PFX(psyRdoQuant_1p16_avx2); p.cu[BLOCK_32x32].psyRdoQuant_1p = PFX(psyRdoQuant_1p32_avx2); + p.cu[BLOCK_4x4].ssimDist = PFX(ssimDist4_avx2); + p.cu[BLOCK_8x8].ssimDist = PFX(ssimDist8_avx2); + p.cu[BLOCK_16x16].ssimDist = PFX(ssimDist16_avx2); + p.cu[BLOCK_32x32].ssimDist = PFX(ssimDist32_avx2); + p.cu[BLOCK_64x64].ssimDist = PFX(ssimDist64_avx2); + + p.cu[BLOCK_8x8].normFact = PFX(normFact8_avx2); + p.cu[BLOCK_16x16].normFact = PFX(normFact16_avx2); + p.cu[BLOCK_32x32].normFact = PFX(normFact32_avx2); + p.cu[BLOCK_64x64].normFact = PFX(normFact64_avx2); + /* TODO: This kernel needs to be modified to work with HIGH_BIT_DEPTH only p.planeClipAndMax = PFX(planeClipAndMax_avx2); */ @@ -2526,7 +2537,7 @@ p.pu[LUMA_32x24].pixelavg_pp[ALIGNED] = PFX(pixel_avg_aligned_32x24_avx512); p.pu[LUMA_32x32].pixelavg_pp[ALIGNED] = PFX(pixel_avg_aligned_32x32_avx512); p.pu[LUMA_32x64].pixelavg_pp[ALIGNED] = PFX(pixel_avg_aligned_32x64_avx512); - p.pu[LUMA_48x64].pixelavg_pp[ALIGNED] = PFX(pixel_avg_aligned_48x64_avx512); + //p.pu[LUMA_48x64].pixelavg_pp[ALIGNED] = PFX(pixel_avg_aligned_48x64_avx512); p.pu[LUMA_64x16].pixelavg_pp[ALIGNED] = PFX(pixel_avg_aligned_64x16_avx512); p.pu[LUMA_64x32].pixelavg_pp[ALIGNED] = PFX(pixel_avg_aligned_64x32_avx512); p.pu[LUMA_64x48].pixelavg_pp[ALIGNED] = PFX(pixel_avg_aligned_64x48_avx512); @@ -4706,6 +4717,17 @@ p.cu[BLOCK_16x16].psyRdoQuant_1p = PFX(psyRdoQuant_1p16_avx2); p.cu[BLOCK_32x32].psyRdoQuant_1p = PFX(psyRdoQuant_1p32_avx2); + p.cu[BLOCK_4x4].ssimDist = PFX(ssimDist4_avx2); + p.cu[BLOCK_8x8].ssimDist = PFX(ssimDist8_avx2); + p.cu[BLOCK_16x16].ssimDist = PFX(ssimDist16_avx2); + p.cu[BLOCK_32x32].ssimDist = PFX(ssimDist32_avx2); + p.cu[BLOCK_64x64].ssimDist = PFX(ssimDist64_avx2); + + p.cu[BLOCK_8x8].normFact = PFX(normFact8_avx2); + p.cu[BLOCK_16x16].normFact = PFX(normFact16_avx2); + p.cu[BLOCK_32x32].normFact = PFX(normFact32_avx2); + p.cu[BLOCK_64x64].normFact = PFX(normFact64_avx2); + } if (cpuMask & X265_CPU_AVX512) {
View file
x265_3.0.tar.gz/source/common/x86/pixel-a.asm -> x265_3.1.1.tar.gz/source/common/x86/pixel-a.asm
Changed
@@ -73,6 +73,16 @@ cextern pb_movemask_32 cextern pw_pixel_max +%if BIT_DEPTH == 12 + %define SSIMRD_SHIFT 4 +%elif BIT_DEPTH == 10 + %define SSIMRD_SHIFT 2 +%elif BIT_DEPTH == 8 + %define SSIMRD_SHIFT 0 +%else + %error Unsupported BIT_DEPTH! +%endif + ;============================================================================= ; SATD ;============================================================================= @@ -360,6 +370,51 @@ RET %endmacro +%macro SSIM_DIST_HIGH 2 + vpsrld m6, m0, SSIMRD_SHIFT + vpsubd m0, m1 + + vpmuldq m2, m0, m0 + vpsrldq m0, m0, 4 + vpmuldq m0, m0, m0 + vpaddq m0, m2 + + vpmuldq m2, m6, m6 + vpsrldq m6, m6, 4 + vpmuldq m6, m6, m6 + vpaddq m6, m2 + + vpaddq m4, m0 + vpaddq m7, m6 +%endmacro + +%macro NORM_FACT_HIGH 1 + vpsrld m1, m0, SSIMRD_SHIFT + vpmuldq m2, m1, m1 + vpsrldq m1, m1, 4 + vpmuldq m1, m1, m1 + + vpaddq m1, m2 + vpaddq m3, m1 +%endmacro + +%macro SSIM_DIST_LOW 2 + vpsrlw m6, m0, SSIMRD_SHIFT + vpsubw m0, m1 + + vpmaddwd m0, m0, m0 + vpmaddwd m6, m6, m6 + + vpaddd m4, m0 + vpaddd m7, m6 +%endmacro + +%macro NORM_FACT_LOW 1 + vpsrlw m1, m0, SSIMRD_SHIFT + vpmaddwd m1, m1, m1 + vpaddd m3, m1 +%endmacro + ; FIXME avoid the spilling of regs to hold 3*stride. ; for small blocks on x86_32, modify pixel pointer instead. @@ -15883,3 +15938,646 @@ RET %endif %endif ; HIGH_BIT_DEPTH == 1 && BIT_DEPTH == 10 + +;template<int log2TrSize> +;static void ssimDist_c(const pixel* fenc, uint32_t fStride, const pixel* recon, intptr_t rstride, uint64_t *ssBlock, int shift, uint64_t *ac_k) +;{ +; *ssBlock = 0; +; const uint32_t trSize = 1 << log2TrSize; +; for (int y = 0; y < trSize; y++) +; { +; for (int x = 0; x < trSize; x++) +; { +; int temp = fenc[y * fStride + x] - recon[y * rstride + x]; // copy of residual coeff +; *ssBlock += temp * temp; +; } +; } +; +; *ac_k = 0; +; for (int block_yy = 0; block_yy < trSize; block_yy += 1) +; { +; for (int block_xx = 0; block_xx < trSize; block_xx += 1) +; { +; uint32_t temp = fenc[block_yy * fStride + block_xx] >> shift; +; *ac_k += temp * temp; +; } +; } +;} +;----------------------------------------------------------------------------------------------------------------- +; void ssimDist_c(const pixel* fenc, uint32_t fStride, const pixel* recon, intptr_t rstride, uint64_t *ssBlock, int shift, uint64_t *ac_k) +;----------------------------------------------------------------------------------------------------------------- + +INIT_YMM avx2 +cglobal ssimDist4, 7, 8, 8 + mov r5d, 4 + vpxor m4, m4 ;ssBlock + vpxor m3, m3 + vpxor m7, m7 ;ac_k +.row: +%if HIGH_BIT_DEPTH + vpmovzxwq m0, [r0] ;fenc + vpmovzxwq m1, [r2] ;recon +%elif BIT_DEPTH == 8 + vpmovzxbq m0, [r0] + vpmovzxbq m1, [r2] +%else + %error Unsupported BIT_DEPTH! +%endif + vpsrlq m6, m0, SSIMRD_SHIFT + vpsubq m0, m1 + vpmuldq m0, m0, m0 + vpmuldq m6, m6, m6 + vpaddq m4, m0 + vpaddq m7, m6 + +%if HIGH_BIT_DEPTH + lea r0, [r0 + 2 * r1] + lea r2, [r2 + 2 * r3] +%else + lea r0, [r0 + r1] + lea r2, [r2 + r3] +%endif + dec r5d + jnz .row + vextracti128 xm5, m4, 1 + vpaddq xm4, xm5 + punpckhqdq xm2, xm4, xm3 + paddq xm4, xm2 + + vextracti128 xm5, m7, 1 + vpaddq xm7, xm5 + punpckhqdq xm2, xm7, xm3 + paddq xm7, xm2 + + movq [r4], xm4 + movq [r6], xm7 + RET + + +INIT_YMM avx2 +cglobal ssimDist8, 7, 8, 8 + mov r5d, 8 + vpxor m4, m4 ;ssBlock + vpxor m3, m3 + vpxor m7, m7 ;ac_k +.row: +%if HIGH_BIT_DEPTH + vpmovzxwd m0, [r0] ;fenc + vpmovzxwd m1, [r2] ;recon +%elif BIT_DEPTH == 8 + vpmovzxbd m0, [r0] + vpmovzxbd m1, [r2] +%else + %error Unsupported BIT_DEPTH! +%endif + + SSIM_DIST_HIGH m0, m1 + +%if HIGH_BIT_DEPTH + lea r0, [r0 + 2 * r1] + lea r2, [r2 + 2 * r3] +%else + lea r0, [r0 + r1] + lea r2, [r2 + r3] +%endif + dec r5d + jnz .row + vextracti128 xm5, m4, 1 + vpaddq xm4, xm5 + punpckhqdq xm2, xm4, xm3 + paddq xm4, xm2 + + vextracti128 xm5, m7, 1 + vpaddq xm7, xm5 + punpckhqdq xm2, xm7, xm3 + paddq xm7, xm2 + + movq [r4], xm4 + movq [r6], xm7 + RET + + +INIT_YMM avx2 +cglobal ssimDist16, 7, 8, 8 + mov r5d, 16 + vpxor m4, m4 ;ssBlock + vpxor m3, m3 + vpxor m7, m7 ;ac_k +.row: +%if HIGH_BIT_DEPTH
View file
x265_3.0.tar.gz/source/common/x86/pixel.h -> x265_3.1.1.tar.gz/source/common/x86/pixel.h
Changed
@@ -60,7 +60,9 @@ FUNCDEF_TU_S(sse_t, pixel_ssd_s_aligned, cpu, const int16_t*, intptr_t); \ FUNCDEF_TU(uint64_t, pixel_var, cpu, const pixel*, intptr_t); \ FUNCDEF_TU(int, psyCost_pp, cpu, const pixel* source, intptr_t sstride, const pixel* recon, intptr_t rstride); \ - FUNCDEF_TU(int, psyCost_ss, cpu, const int16_t* source, intptr_t sstride, const int16_t* recon, intptr_t rstride) + FUNCDEF_TU(int, psyCost_ss, cpu, const int16_t* source, intptr_t sstride, const int16_t* recon, intptr_t rstride); \ + FUNCDEF_TU_S2(void, ssimDist, cpu, const pixel *fenc, uint32_t fStride, const pixel *recon, intptr_t rstride, uint64_t *ssBlock, int shift, uint64_t *ac_k); \ + FUNCDEF_TU_S2(void, normFact, cpu, const pixel *src, uint32_t blockSize, int shift, uint64_t *z_k) DECL_PIXELS(mmx); DECL_PIXELS(mmx2);
View file
x265_3.0.tar.gz/source/dynamicHDR10/metadataFromJson.cpp -> x265_3.1.1.tar.gz/source/dynamicHDR10/metadataFromJson.cpp
Changed
@@ -404,7 +404,12 @@ const uint16_t terminalProviderCode = 0x003C; const uint16_t terminalProviderOrientedCode = 0x0001; const uint8_t applicationIdentifier = 4; - const uint8_t applicationVersion = 1; + uint8_t applicationVersion = 0; + + if (jsonType & LLC) + { + applicationVersion = 1; + } mPimpl->appendBits(metadata, countryCode, 8); mPimpl->appendBits(metadata, terminalProviderCode, 16);
View file
x265_3.0.tar.gz/source/encoder/CMakeLists.txt -> x265_3.1.1.tar.gz/source/encoder/CMakeLists.txt
Changed
@@ -43,4 +43,4 @@ reference.cpp reference.h encoder.cpp encoder.h api.cpp - weightPrediction.cpp) + weightPrediction.cpp svt.h)
View file
x265_3.0.tar.gz/source/encoder/analysis.cpp -> x265_3.1.1.tar.gz/source/encoder/analysis.cpp
Changed
@@ -2412,6 +2412,7 @@ bool mightSplit = !(cuGeom.flags & CUGeom::LEAF); bool mightNotSplit = !(cuGeom.flags & CUGeom::SPLIT_MANDATORY); bool bDecidedDepth = parentCTU.m_cuDepth[cuGeom.absPartIdx] == depth; + int split = 0; TrainingData td; td.init(parentCTU, cuGeom); @@ -2420,8 +2421,13 @@ m_refineLevel = m_param->interRefine; else m_refineLevel = m_frame->m_classifyFrame ? 1 : 3; - int split = (m_param->scaleFactor && bDecidedDepth && (!mightNotSplit || - (m_refineLevel && cuGeom.log2CUSize == (uint32_t)(g_log2Size[m_param->minCUSize] + 1)))); + + if (m_param->interRefine == 1) + split = (m_param->scaleFactor && bDecidedDepth && parentCTU.m_predMode[cuGeom.absPartIdx] == MODE_SKIP && (!mightNotSplit || + (m_refineLevel && cuGeom.log2CUSize == (uint32_t)(g_log2Size[m_param->minCUSize] + 1)))); + else + split = (m_param->scaleFactor && bDecidedDepth && (!mightNotSplit || + (m_refineLevel && cuGeom.log2CUSize == (uint32_t)(g_log2Size[m_param->minCUSize] + 1)))); td.split = split; if ((bDecidedDepth && mightNotSplit) || (m_param->bAnalysisType == HEVC_INFO && parentCTU.m_cuDepth[cuGeom.absPartIdx] == 4)) @@ -3696,14 +3702,8 @@ // 2. Calculate ac component uint64_t z_k = 0; - for (uint32_t block_yy = 0; block_yy < blockSize; block_yy += 1) - { - for (uint32_t block_xx = 0; block_xx < blockSize; block_xx += 1) - { - uint32_t temp = src[block_yy * blockSize + block_xx] >> shift; - z_k += temp * temp; - } - } + int block = (int)(((log(blockSize) / log(2)) - 2) + 0.5); + primitives.cu[block].normFact(src, blockSize, shift, &z_k); // Remove the DC part z_k -= z_o;
View file
x265_3.0.tar.gz/source/encoder/api.cpp -> x265_3.1.1.tar.gz/source/encoder/api.cpp
Changed
@@ -30,6 +30,7 @@ #include "level.h" #include "nal.h" #include "bitcost.h" +#include "svt.h" #if ENABLE_LIBVMAF #include "libvmaf.h" @@ -97,17 +98,71 @@ x265_param* zoneParam = PARAM_NS::x265_param_alloc(); if (!param || !latestParam) goto fail; + if (p->rc.zoneCount || p->rc.zonefileCount) + { + int zoneCount = p->rc.zonefileCount ? p->rc.zonefileCount : p->rc.zoneCount; + param->rc.zones = x265_zone_alloc(zoneCount, !!p->rc.zonefileCount); + latestParam->rc.zones = x265_zone_alloc(zoneCount, !!p->rc.zonefileCount); + } - memcpy(param, p, sizeof(x265_param)); + x265_copy_params(param, p); x265_log(param, X265_LOG_INFO, "HEVC encoder version %s\n", PFX(version_str)); x265_log(param, X265_LOG_INFO, "build info %s\n", PFX(build_info_str)); + encoder = new Encoder; + +#ifdef SVT_HEVC + + if (param->bEnableSvtHevc) + { + EB_ERRORTYPE return_error = EB_ErrorNone; + int ret = 0; + + svt_initialise_app_context(encoder); + ret = svt_initialise_input_buffer(encoder); + if (!ret) + { + x265_log(param, X265_LOG_ERROR, "SVT-HEVC Encoder: Unable to allocate input buffer \n"); + goto fail; + } + + // Create Encoder Handle + return_error = EbInitHandle(&encoder->m_svtAppData->svtEncoderHandle, encoder->m_svtAppData, encoder->m_svtAppData->svtHevcParams); + if (return_error != EB_ErrorNone) + { + x265_log(param, X265_LOG_ERROR, "SVT-HEVC Encoder: Unable to initialise encoder handle \n"); + goto fail; + } + + memcpy(encoder->m_svtAppData->svtHevcParams, param->svtHevcParam, sizeof(EB_H265_ENC_CONFIGURATION)); + + // Send over all configuration parameters + return_error = EbH265EncSetParameter(encoder->m_svtAppData->svtEncoderHandle, encoder->m_svtAppData->svtHevcParams); + if (return_error != EB_ErrorNone) + { + x265_log(param, X265_LOG_ERROR, "SVT-HEVC Encoder: Error while configuring encoder parameters \n"); + goto fail; + } + + // Init Encoder + return_error = EbInitEncoder(encoder->m_svtAppData->svtEncoderHandle); + if (return_error != EB_ErrorNone) + { + x265_log(param, X265_LOG_ERROR, "SVT-HEVC Encoder: Encoder init failed \n"); + goto fail; + } + + memcpy(param->svtHevcParam, encoder->m_svtAppData->svtHevcParams, sizeof(EB_H265_ENC_CONFIGURATION)); + encoder->m_param = param; + return encoder; + } +#endif + x265_setup_primitives(param); if (x265_check_params(param)) goto fail; - encoder = new Encoder; if (!param->rc.bEnableSlowFirstPass) PARAM_NS::x265_param_apply_fastfirstpass(param); @@ -146,7 +201,7 @@ } encoder->m_latestParam = latestParam; - memcpy(latestParam, param, sizeof(x265_param)); + x265_copy_params(latestParam, param); if (encoder->m_aborted) goto fail; @@ -165,6 +220,33 @@ if (pp_nal && enc) { Encoder *encoder = static_cast<Encoder*>(enc); +#ifdef SVT_HEVC + if (encoder->m_param->bEnableSvtHevc) + { + EB_ERRORTYPE return_error; + EB_BUFFERHEADERTYPE* outputPtr; + return_error = EbH265EncStreamHeader(encoder->m_svtAppData->svtEncoderHandle, &outputPtr); + if (return_error != EB_ErrorNone) + { + x265_log(encoder->m_param, X265_LOG_ERROR, "SVT HEVC encoder: Error while generating stream headers \n"); + encoder->m_aborted = true; + return -1; + } + + //Copy data from output packet to NAL + encoder->m_nalList.m_nal[0].payload = outputPtr->pBuffer; + encoder->m_nalList.m_nal[0].sizeBytes = outputPtr->nFilledLen; + *pp_nal = &encoder->m_nalList.m_nal[0]; + *pi_nal = 1; + encoder->m_svtAppData->byteCount += outputPtr->nFilledLen; + + // Release the output buffer + EbH265ReleaseOutBuffer(&outputPtr); + + return pp_nal[0]->sizeBytes; + } +#endif + Entropy sbacCoder; Bitstream bs; if (encoder->m_param->rc.bStatRead && encoder->m_param->bMultiPassOptRPS) @@ -194,7 +276,7 @@ if (enc && out) { Encoder *encoder = static_cast<Encoder*>(enc); - memcpy(out, encoder->m_param, sizeof(x265_param)); + x265_copy_params(out, encoder->m_param); } } @@ -211,12 +293,17 @@ bool isReconfigureRc = encoder->isReconfigureRc(encoder->m_latestParam, param_in); if ((encoder->m_reconfigure && !isReconfigureRc) || (encoder->m_reconfigureRc && isReconfigureRc)) /* Reconfigure in progress */ return 1; - memcpy(&save, encoder->m_latestParam, sizeof(x265_param)); + if (encoder->m_latestParam->rc.zoneCount || encoder->m_latestParam->rc.zonefileCount) + { + int zoneCount = encoder->m_latestParam->rc.zonefileCount ? encoder->m_latestParam->rc.zonefileCount : encoder->m_latestParam->rc.zoneCount; + save.rc.zones = x265_zone_alloc(zoneCount, !!encoder->m_latestParam->rc.zonefileCount); + } + x265_copy_params(&save, encoder->m_latestParam); int ret = encoder->reconfigureParam(encoder->m_latestParam, param_in); if (ret) { /* reconfigure failed, recover saved param set */ - memcpy(encoder->m_latestParam, &save, sizeof(x265_param)); + x265_copy_params(encoder->m_latestParam, &save); ret = -1; } else @@ -228,7 +315,7 @@ { if (encoder->m_scalingList.parseScalingList(encoder->m_latestParam->scalingLists)) { - memcpy(encoder->m_latestParam, &save, sizeof(x265_param)); + x265_copy_params(encoder->m_latestParam, &save); return -1; } encoder->m_scalingList.setupQuantMatrices(encoder->m_param->internalCsp); @@ -236,7 +323,7 @@ else { x265_log(encoder->m_param, X265_LOG_ERROR, "Repeat headers is turned OFF, cannot reconfigure scalinglists\n"); - memcpy(encoder->m_latestParam, &save, sizeof(x265_param)); + x265_copy_params(encoder->m_latestParam, &save); return -1; } } @@ -253,7 +340,7 @@ x265_log(encoder->m_param, X265_LOG_WARNING, "Profile/Level/Tier has changed from %d/%d/%s to %d/%d/%s.Cannot reconfigure rate-control.\n", saveVPS.ptl.profileIdc, saveVPS.ptl.levelIdc, saveVPS.ptl.tierFlag ? "High" : "Main", encoder->m_vps.ptl.profileIdc, encoder->m_vps.ptl.levelIdc, encoder->m_vps.ptl.tierFlag ? "High" : "Main"); - memcpy(encoder->m_latestParam, &save, sizeof(x265_param)); + x265_copy_params(encoder->m_latestParam, &save); memcpy(&encoder->m_vps.ptl, &saveVPS.ptl, sizeof(saveVPS.ptl)); encoder->m_reconfigureRc = false; } @@ -274,6 +361,166 @@ Encoder *encoder = static_cast<Encoder*>(enc); int numEncoded; +#ifdef SVT_HEVC + EB_ERRORTYPE return_error; + static unsigned char picSendDone = 0; + numEncoded = 0; + static int codedNal = 0, eofReached = 0; + EB_H265_ENC_CONFIGURATION* svtParam = (EB_H265_ENC_CONFIGURATION*)encoder->m_svtAppData->svtHevcParams; + if (encoder->m_param->bEnableSvtHevc) + { + if (pic_in) + { + if (pic_in->colorSpace == X265_CSP_I420) // SVT-HEVC supports only yuv420p color space + { + EB_BUFFERHEADERTYPE *inputPtr = encoder->m_svtAppData->inputPictureBuffer; + + if (pic_in->framesize) inputPtr->nFilledLen = (uint32_t)pic_in->framesize;
View file
x265_3.0.tar.gz/source/encoder/dpb.cpp -> x265_3.1.1.tar.gz/source/encoder/dpb.cpp
Changed
@@ -127,6 +127,7 @@ { Slice* slice = newFrame->m_encData->m_slice; slice->m_poc = newFrame->m_poc; + slice->m_fieldNum = newFrame->m_fieldNum; int pocCurr = slice->m_poc; int type = newFrame->m_lowres.sliceType;
View file
x265_3.0.tar.gz/source/encoder/encoder.cpp -> x265_3.1.1.tar.gz/source/encoder/encoder.cpp
Changed
@@ -80,6 +80,7 @@ * TODO: come up an algorithm for adoptive threshold */ #define MVTHRESHOLD (10*10) #define PU_2Nx2N 1 +#define MAX_CHROMA_QP_OFFSET 12 static const char* defaultAnalysisFileName = "x265_analysis.dat"; using namespace X265_NS; @@ -124,6 +125,10 @@ m_cim = NULL; #endif +#if SVT_HEVC + m_svtAppData = NULL; +#endif + m_prevTonemapPayload.payload = NULL; m_startPoint = 0; m_saveCTUSize = 0; @@ -439,8 +444,6 @@ m_nalList.m_annexB = !!m_param->bAnnexB; - m_emitCLLSEI = p->maxCLL || p->maxFALL || (p->dolbyProfile == 81); - if (m_param->naluFile) { m_naluFile = x265_fopen(m_param->naluFile, "r"); @@ -827,6 +830,10 @@ } if (m_naluFile) fclose(m_naluFile); + +#ifdef SVT_HEVC + X265_FREE(m_svtAppData); +#endif if (m_param) { if (m_param->csvfpt) @@ -1098,6 +1105,8 @@ inFrame->m_pts = pic_in->pts; inFrame->m_forceqp = pic_in->forceqp; inFrame->m_param = (m_reconfigure || m_reconfigureRc) ? m_latestParam : m_param; + if (m_param->bField && m_param->interlaceMode) + inFrame->m_fieldNum = pic_in->fieldNum; copyUserSEIMessages(inFrame, pic_in); @@ -1471,7 +1480,7 @@ if (frameEnc->m_reconfigureRc && m_reconfigureRc) { - memcpy(m_param, m_latestParam, sizeof(x265_param)); + x265_copy_params(m_param, m_latestParam); m_rateControl->reconfigureRC(); m_reconfigureRc = false; } @@ -1483,7 +1492,7 @@ /* Safe to copy m_latestParam to Encoder::m_param, encoder reconfigure complete */ for (int frameEncId = 0; frameEncId < m_param->frameNumThreads; frameEncId++) m_frameEncoder[frameEncId]->m_reconfigure = false; - memcpy (m_param, m_latestParam, sizeof(x265_param)); + x265_copy_params(m_param, m_latestParam); m_reconfigure = false; } @@ -1632,7 +1641,7 @@ int Encoder::reconfigureParam(x265_param* encParam, x265_param* param) { - if (isReconfigureRc(encParam, param)) + if (isReconfigureRc(encParam, param) && !param->rc.zonefileCount) { /* VBV can't be turned ON if it wasn't ON to begin with and can't be turned OFF if it was ON to begin with*/ if (param->rc.vbvMaxBitrate > 0 && param->rc.vbvBufferSize > 0 && @@ -2451,7 +2460,7 @@ if (m_param->bEmitHDRSEI) { - if (m_emitCLLSEI) + if (m_param->bEmitCLL) { SEIContentLightLevel cllsei; cllsei.max_content_light_level = m_param->maxCLL; @@ -2651,7 +2660,8 @@ p->bEnableRectInter = zone->bEnableRectInter; p->maxNumMergeCand = zone->maxNumMergeCand; p->bIntraInBFrames = zone->bIntraInBFrames; - p->scalingLists = strdup(zone->scalingLists); + if(zone->scalingLists) + p->scalingLists = strdup(zone->scalingLists); p->rc.aqMode = zone->rc.aqMode; p->rc.aqStrength = zone->rc.aqStrength; @@ -2702,10 +2712,10 @@ p->vui.matrixCoeffs = dovi[doviProfile].matrixCoeffs; if (dovi[doviProfile].doviProfileId == 81) - p->bEmitHDRSEI = 1; + p->bEmitHDRSEI = p->bEmitCLL = 1; - if (dovi[doviProfile].doviProfileId == 50 && p->noiseReductionIntra && p->noiseReductionInter) - p->crQpOffset = 4; + if (dovi[doviProfile].doviProfileId == 50) + p->crQpOffset = 3; } void Encoder::configure(x265_param *p) @@ -2796,8 +2806,13 @@ /* In 444, chroma gets twice as much resolution, so halve quality when psy-rd is enabled */ if (p->internalCsp == X265_CSP_I444 && p->psyRd) { - p->cbQpOffset += 6; - p->crQpOffset += 6; + if (!p->cbQpOffset && !p->crQpOffset) + { + p->cbQpOffset = MAX_CHROMA_QP_OFFSET / 2; + p->crQpOffset = MAX_CHROMA_QP_OFFSET / 2; + x265_log(p, X265_LOG_WARNING, "halving the quality when psy-rd is enabled for 444 input." + " Setting cbQpOffset = %d and crQpOffset = %d\n", p->cbQpOffset, p->crQpOffset); + } } if (p->bLossless) @@ -3347,6 +3362,12 @@ if (p->dolbyProfile) // Default disabled. configureDolbyVisionParams(p); + if (p->rc.zonefileCount && p->rc.zoneCount) + { + p->rc.zoneCount = 0; + x265_log(p, X265_LOG_WARNING, "Only zone or zonefile can be used. Enabling only zonefile\n"); + } + if (m_param->rc.zonefileCount && p->bOpenGOP) { p->bOpenGOP = 0; @@ -3619,8 +3640,8 @@ (analysis->interData)->refIdx[i][count + pu] = refIdx[i][d]; if (m_param->scaleFactor) { - mv[i][d].x *= (int16_t)m_param->scaleFactor; - mv[i][d].y *= (int16_t)m_param->scaleFactor; + mv[i][d].x *= (int32_t)m_param->scaleFactor; + mv[i][d].y *= (int32_t)m_param->scaleFactor; } memcpy(&(analysis->interData)->mv[i][count + pu], &mv[i][d], sizeof(MV)); } @@ -4002,8 +4023,8 @@ { (analysis->interData)->mvpIdx[i][count + pu] = mvpIdx[i][d]; (analysis->interData)->refIdx[i][count + pu] = refIdx[i][d]; - mvCopy[i].x = mv[i][d].x * (int16_t)m_param->scaleFactor; - mvCopy[i].y = mv[i][d].y * (int16_t)m_param->scaleFactor; + mvCopy[i].x = mv[i][d].x * (int32_t)m_param->scaleFactor; + mvCopy[i].y = mv[i][d].y * (int32_t)m_param->scaleFactor; memcpy(&(analysis->interData)->mv[i][count + pu], &mvCopy[i], sizeof(MV)); } }
View file
x265_3.0.tar.gz/source/encoder/encoder.h -> x265_3.1.1.tar.gz/source/encoder/encoder.h
Changed
@@ -31,6 +31,7 @@ #include "x265.h" #include "nal.h" #include "framedata.h" +#include "svt.h" #ifdef ENABLE_HDR10_PLUS #include "dynamicHDR10/hdr10plus.h" #endif @@ -41,6 +42,20 @@ class Entropy; +#ifdef SVT_HEVC +typedef struct SvtAppContext +{ + EB_COMPONENTTYPE* svtEncoderHandle; + EB_H265_ENC_CONFIGURATION* svtHevcParams; + + // Buffer Pools + EB_BUFFERHEADERTYPE* inputPictureBuffer; + uint64_t byteCount; + uint64_t outFrameCount; + +}SvtAppContext; +#endif + struct EncStats { double m_psnrSumY; @@ -188,7 +203,6 @@ ScalingList m_scalingList; // quantization matrix information Window m_conformanceWindow; - bool m_emitCLLSEI; bool m_bZeroLatency; // x265_encoder_encode() returns NALs for the input picture, zero lag bool m_aborted; // fatal error detected bool m_reconfigure; // Encoder reconfigure in progress @@ -224,6 +238,10 @@ int m_numCimInfo; #endif +#ifdef SVT_HEVC + SvtAppContext* m_svtAppData; +#endif + x265_sei_payload m_prevTonemapPayload; /* Collect frame level feature data */
View file
x265_3.0.tar.gz/source/encoder/frameencoder.cpp -> x265_3.1.1.tar.gz/source/encoder/frameencoder.cpp
Changed
@@ -686,10 +686,25 @@ if (vui->frameFieldInfoPresentFlag) { - if (m_param->interlaceMode == 2) - sei->m_picStruct = (poc & 1) ? 1 /* top */ : 2 /* bottom */; - else if (m_param->interlaceMode == 1) - sei->m_picStruct = (poc & 1) ? 2 /* bottom */ : 1 /* top */; + if (m_param->interlaceMode > 0) + { + if( m_param->interlaceMode == 2 ) + { + // m_picStruct should be set to 3 or 4 when field feature is enabled + if (m_param->bField) + // 3: Top field, bottom field, in that order; 4: Bottom field, top field, in that order + sei->m_picStruct = (slice->m_fieldNum == 1) ? 4 : 3; + else + sei->m_picStruct = (poc & 1) ? 1 /* top */ : 2 /* bottom */; + } + else if (m_param->interlaceMode == 1) + { + if (m_param->bField) + sei->m_picStruct = (slice->m_fieldNum == 1) ? 3: 4; + else + sei->m_picStruct = (poc & 1) ? 2 /* bottom */ : 1 /* top */; + } + } else sei->m_picStruct = m_param->pictureStructure; @@ -1406,8 +1421,8 @@ } // Initialize restrict on MV range in slices - tld.analysis.m_sliceMinY = -(int16_t)(rowInSlice * m_param->maxCUSize * 4) + 3 * 4; - tld.analysis.m_sliceMaxY = (int16_t)((endRowInSlicePlus1 - 1 - row) * (m_param->maxCUSize * 4) - 4 * 4); + tld.analysis.m_sliceMinY = -(int32_t)(rowInSlice * m_param->maxCUSize * 4) + 3 * 4; + tld.analysis.m_sliceMaxY = (int32_t)((endRowInSlicePlus1 - 1 - row) * (m_param->maxCUSize * 4) - 4 * 4); // Handle single row slice if (tld.analysis.m_sliceMaxY < tld.analysis.m_sliceMinY)
View file
x265_3.0.tar.gz/source/encoder/level.cpp -> x265_3.1.1.tar.gz/source/encoder/level.cpp
Changed
@@ -25,6 +25,7 @@ #include "common.h" #include "slice.h" #include "level.h" +#include "svt.h" namespace X265_NS { typedef struct @@ -435,6 +436,21 @@ if (!param || !profile) return 0; +#ifdef SVT_HEVC + if (param->bEnableSvtHevc) + { + EB_H265_ENC_CONFIGURATION* svtParam = (EB_H265_ENC_CONFIGURATION*)param->svtHevcParam; + if (!strcmp(profile, "main")) svtParam->profile = 1; + else if (!strcmp(profile, "main10")) svtParam->profile = 2; + else + { + x265_log(param, X265_LOG_ERROR, "SVT-HEVC encoder: Unsupported profile %s \n", profile); + return -1; + } + return 0; + } +#endif + /* Check if profile bit-depth requirement is exceeded by internal bit depth */ bool bInvalidDepth = false; #if X265_DEPTH > 8
View file
x265_3.0.tar.gz/source/encoder/motion.cpp -> x265_3.1.1.tar.gz/source/encoder/motion.cpp
Changed
@@ -382,10 +382,10 @@ 4 * 5 7 */ - const int16_t top = omv.y - dist; - const int16_t bottom = omv.y + dist; - const int16_t left = omv.x - dist; - const int16_t right = omv.x + dist; + const int32_t top = omv.y - dist; + const int32_t bottom = omv.y + dist; + const int32_t left = omv.x - dist; + const int32_t right = omv.x + dist; if (top >= mvmin.y && left >= mvmin.x && right <= mvmax.x && bottom <= mvmax.y) { @@ -430,14 +430,14 @@ Points 2, 4, 5, 7 are dist Points 1, 3, 6, 8 are dist>>1 */ - const int16_t top = omv.y - dist; - const int16_t bottom = omv.y + dist; - const int16_t left = omv.x - dist; - const int16_t right = omv.x + dist; - const int16_t top2 = omv.y - (dist >> 1); - const int16_t bottom2 = omv.y + (dist >> 1); - const int16_t left2 = omv.x - (dist >> 1); - const int16_t right2 = omv.x + (dist >> 1); + const int32_t top = omv.y - dist; + const int32_t bottom = omv.y + dist; + const int32_t left = omv.x - dist; + const int32_t right = omv.x + dist; + const int32_t top2 = omv.y - (dist >> 1); + const int32_t bottom2 = omv.y + (dist >> 1); + const int32_t left2 = omv.x - (dist >> 1); + const int32_t right2 = omv.x + (dist >> 1); saved = bcost; if (top >= mvmin.y && left >= mvmin.x && @@ -502,10 +502,10 @@ for (int16_t dist = 16; dist <= (int16_t)merange; dist <<= 1) { - const int16_t top = omv.y - dist; - const int16_t bottom = omv.y + dist; - const int16_t left = omv.x - dist; - const int16_t right = omv.x + dist; + const int32_t top = omv.y - dist; + const int32_t bottom = omv.y + dist; + const int32_t left = omv.x - dist; + const int32_t right = omv.x + dist; saved = bcost; if (top >= mvmin.y && left >= mvmin.x && @@ -530,10 +530,10 @@ for (int16_t index = 1; index < 4; index++) { - int16_t posYT = top + ((dist >> 2) * index); - int16_t posYB = bottom - ((dist >> 2) * index); - int16_t posXL = omv.x - ((dist >> 2) * index); - int16_t posXR = omv.x + ((dist >> 2) * index); + int32_t posYT = top + ((dist >> 2) * index); + int32_t posYB = bottom - ((dist >> 2) * index); + int32_t posXL = omv.x - ((dist >> 2) * index); + int32_t posXR = omv.x + ((dist >> 2) * index); COST_MV_PT_DIST_X4(posXL, posYT, 0, dist, posXR, posYT, 0, dist, @@ -561,10 +561,10 @@ } for (int16_t index = 1; index < 4; index++) { - int16_t posYT = top + ((dist >> 2) * index); - int16_t posYB = bottom - ((dist >> 2) * index); - int16_t posXL = omv.x - ((dist >> 2) * index); - int16_t posXR = omv.x + ((dist >> 2) * index); + int32_t posYT = top + ((dist >> 2) * index); + int32_t posYB = bottom - ((dist >> 2) * index); + int32_t posXL = omv.x - ((dist >> 2) * index); + int32_t posXR = omv.x + ((dist >> 2) * index); if (posYT >= mvmin.y) // check top { @@ -1235,10 +1235,10 @@ case X265_SEA: { // Successive Elimination Algorithm - const int16_t minX = X265_MAX(omv.x - (int16_t)merange, mvmin.x); - const int16_t minY = X265_MAX(omv.y - (int16_t)merange, mvmin.y); - const int16_t maxX = X265_MIN(omv.x + (int16_t)merange, mvmax.x); - const int16_t maxY = X265_MIN(omv.y + (int16_t)merange, mvmax.y); + const int32_t minX = X265_MAX(omv.x - (int32_t)merange, mvmin.x); + const int32_t minY = X265_MAX(omv.y - (int32_t)merange, mvmin.y); + const int32_t maxX = X265_MIN(omv.x + (int32_t)merange, mvmax.x); + const int32_t maxY = X265_MIN(omv.y + (int32_t)merange, mvmax.y); const uint16_t *p_cost_mvx = m_cost_mvx - qmvp.x; const uint16_t *p_cost_mvy = m_cost_mvy - qmvp.y; int16_t* meScratchBuffer = NULL;
View file
x265_3.0.tar.gz/source/encoder/ratecontrol.cpp -> x265_3.1.1.tar.gz/source/encoder/ratecontrol.cpp
Changed
@@ -1262,6 +1262,7 @@ } rce->isActive = true; rce->scenecut = false; + rce->isFadeEnd = curFrame->m_lowres.bIsFadeEnd; bool isRefFrameScenecut = m_sliceType!= I_SLICE && m_curSlice->m_refFrameList[0][0]->m_lowres.bScenecut; m_isFirstMiniGop = m_sliceType == I_SLICE ? true : m_isFirstMiniGop; if (curFrame->m_lowres.bScenecut) @@ -1373,6 +1374,8 @@ m_numBframesInPattern++; } } + if (rce->isFadeEnd) + m_isPatternPresent = true; } /* For a scenecut that occurs within the mini-gop, enable scene transition * switch until the next mini-gop to ensure a min qp for all the frames within @@ -2097,7 +2100,7 @@ double abrBuffer = 2 * m_rateTolerance * m_bitrate; // Check if current Slice is a scene cut that follows low detailed/blank frames - if (rce->lastSatd > 4 * rce->movingAvgSum || rce->scenecut) + if (rce->lastSatd > 4 * rce->movingAvgSum || rce->scenecut || rce->isFadeEnd) { if (!m_isAbrReset && rce->movingAvgSum > 0 && (m_isPatternPresent || !m_param->bframes)) @@ -2110,7 +2113,7 @@ shrtTermTotalBitsSum += m_encodedBitsWindow[i]; double underflow = (shrtTermTotalBitsSum - shrtTermWantedBits) / abrBuffer; const double epsilon = 0.0001f; - if (underflow < epsilon && !isFrameDone) + if ((underflow < epsilon || rce->isFadeEnd) && !isFrameDone) { init(*m_curSlice->m_sps); m_shortTermCplxSum = rce->lastSatd / (CLIP_DURATION(m_frameDuration) / BASE_FRAME_DURATION); @@ -2970,8 +2973,7 @@ X265_FREE(m_encOrder); for (int i = 0; i < 2; i++) X265_FREE(m_cuTreeStats.qpBuffer[i]); - - X265_FREE(m_param->rc.zones); + } void RateControl::splitdeltaPOC(char deltapoc[], RateControlEntry *rce)
View file
x265_3.0.tar.gz/source/encoder/ratecontrol.h -> x265_3.1.1.tar.gz/source/encoder/ratecontrol.h
Changed
@@ -115,6 +115,7 @@ HRDTiming *hrdTiming; int rpsIdx; RPS rpsData; + bool isFadeEnd; }; class RateControl
View file
x265_3.0.tar.gz/source/encoder/search.cpp -> x265_3.1.1.tar.gz/source/encoder/search.cpp
Changed
@@ -2633,7 +2633,7 @@ void Search::setSearchRange(const CUData& cu, const MV& mvp, int merange, MV& mvmin, MV& mvmax) const { - MV dist((int16_t)merange << 2, (int16_t)merange << 2); + MV dist((int32_t)merange << 2, (int32_t)merange << 2); mvmin = mvp - dist; mvmax = mvp + dist; @@ -2670,8 +2670,8 @@ mvmax >>= 2; /* conditional clipping for frame parallelism */ - mvmin.y = X265_MIN(mvmin.y, (int16_t)m_refLagPixels); - mvmax.y = X265_MIN(mvmax.y, (int16_t)m_refLagPixels); + mvmin.y = X265_MIN(mvmin.y, (int32_t)m_refLagPixels); + mvmax.y = X265_MIN(mvmax.y, (int32_t)m_refLagPixels); /* conditional clipping for negative mv range */ mvmax.y = X265_MAX(mvmax.y, mvmin.y);
View file
x265_3.0.tar.gz/source/encoder/search.h -> x265_3.1.1.tar.gz/source/encoder/search.h
Changed
@@ -283,8 +283,8 @@ int32_t m_maxTUDepth; uint16_t m_limitTU; - int16_t m_sliceMaxY; - int16_t m_sliceMinY; + int32_t m_sliceMaxY; + int32_t m_sliceMinY; #if DETAILED_CU_STATS /* Accumulate CU statistics separately for each frame encoder */
View file
x265_3.0.tar.gz/source/encoder/slicetype.cpp -> x265_3.1.1.tar.gz/source/encoder/slicetype.cpp
Changed
@@ -459,17 +459,21 @@ } } - if (param->bDynamicRefine) + if (param->bDynamicRefine || param->bEnableFades) { - int blockXY = 0; + uint64_t blockXY = 0, rowVariance = 0; + curFrame->m_lowres.frameVariance = 0; for (int blockY = 0; blockY < maxRow; blockY += loopIncr) { for (int blockX = 0; blockX < maxCol; blockX += loopIncr) { curFrame->m_lowres.blockVariance[blockXY] = acEnergyCu(curFrame, blockX, blockY, param->internalCsp, param->rc.qgSize); + rowVariance += curFrame->m_lowres.blockVariance[blockXY]; blockXY++; } + curFrame->m_lowres.frameVariance += (rowVariance / maxCol); } + curFrame->m_lowres.frameVariance /= maxRow; } } @@ -757,6 +761,9 @@ m_8x8Width = ((m_param->sourceWidth / 2) + X265_LOWRES_CU_SIZE - 1) >> X265_LOWRES_CU_BITS; m_cuCount = m_8x8Width * m_8x8Height; m_8x8Blocks = m_8x8Width > 2 && m_8x8Height > 2 ? (m_cuCount + 4 - 2 * (m_8x8Width + m_8x8Height)) : m_cuCount; + m_isFadeIn = false; + m_fadeCount = 0; + m_fadeStart = -1; /* Allow the strength to be adjusted via qcompress, since the two concepts * are very similar. */ @@ -1165,7 +1172,9 @@ ProfileScopeEvent(prelookahead); m_lock.release(); preFrame->m_lowres.init(preFrame->m_fencPic, preFrame->m_poc); - if (m_lookahead.m_bAdaptiveQuant) + if (m_lookahead.m_param->rc.bStatRead && m_lookahead.m_param->rc.cuTree && IS_REFERENCED(preFrame)) + /* cu-tree offsets were read from stats file */; + else if (m_lookahead.m_bAdaptiveQuant) tld.calcAdaptiveQuantFrame(preFrame, m_lookahead.m_param); tld.lowresIntraEstimate(preFrame->m_lowres, m_lookahead.m_param->rc.qgSize); preFrame->m_lowresInit = true; @@ -1179,7 +1188,6 @@ void Lookahead::slicetypeDecide() { PreLookaheadGroup pre(*this); - Lowres* frames[X265_LOOKAHEAD_MAX + X265_BFRAME_MAX + 4]; Frame* list[X265_BFRAME_MAX + 4]; memset(frames, 0, sizeof(frames)); @@ -1224,6 +1232,54 @@ pre.waitForExit(); } + if(m_param->bEnableFades) + { + int j, endIndex = 0, length = X265_BFRAME_MAX + 4; + for (j = 0; j < length; j++) + m_frameVariance[j] = -1; + for (j = 0; list[j] != NULL; j++) + m_frameVariance[list[j]->m_poc % length] = list[j]->m_lowres.frameVariance; + for (int k = list[0]->m_poc % length; k <= list[j - 1]->m_poc % length; k++) + { + if (m_frameVariance[k] == -1) + break; + if((k > 0 && m_frameVariance[k] >= m_frameVariance[k - 1]) || + (k == 0 && m_frameVariance[k] >= m_frameVariance[length - 1])) + { + m_isFadeIn = true; + if (m_fadeCount == 0 && m_fadeStart == -1) + { + for(int temp = list[0]->m_poc; temp <= list[j - 1]->m_poc; temp++) + if (k == temp % length) { + m_fadeStart = temp ? temp - 1 : 0; + break; + } + } + m_fadeCount = list[endIndex]->m_poc > m_fadeStart ? list[endIndex]->m_poc - m_fadeStart : 0; + endIndex++; + } + else + { + if (m_isFadeIn && m_fadeCount >= m_param->fpsNum / m_param->fpsDenom) + { + for (int temp = 0; list[temp] != NULL; temp++) + { + if (list[temp]->m_poc == m_fadeStart + (int)m_fadeCount) + { + list[temp]->m_lowres.bIsFadeEnd = true; + break; + } + } + } + m_isFadeIn = false; + m_fadeCount = 0; + m_fadeStart = -1; + } + if (k == length - 1) + k = -1; + } + } + if (m_lastNonB && !m_param->rc.bStatRead && ((m_param->bFrameAdaptive && m_param->bframes) || m_param->rc.cuTree || m_param->scenecutThreshold || @@ -1283,6 +1339,9 @@ frm.sliceType = m_param->bOpenGOP && m_lastKeyframe >= 0 ? X265_TYPE_I : X265_TYPE_IDR; } } + if (frm.bIsFadeEnd){ + frm.sliceType = m_param->bOpenGOP && m_lastKeyframe >= 0 ? X265_TYPE_I : X265_TYPE_IDR; + } for (int i = 0; i < m_param->rc.zonefileCount; i++) { int curZoneStart = m_param->rc.zones[i].startFrame; @@ -2860,10 +2919,10 @@ // TODO: restrict to slices boundaries // establish search bounds that don't cross extended frame boundaries - mvmin.x = (int16_t)(-cuX * cuSize - 8); - mvmin.y = (int16_t)(-cuY * cuSize - 8); - mvmax.x = (int16_t)((widthInCU - cuX - 1) * cuSize + 8); - mvmax.y = (int16_t)((heightInCU - cuY - 1) * cuSize + 8); + mvmin.x = (int32_t)(-cuX * cuSize - 8); + mvmin.y = (int32_t)(-cuY * cuSize - 8); + mvmax.x = (int32_t)((widthInCU - cuX - 1) * cuSize + 8); + mvmax.y = (int32_t)((heightInCU - cuY - 1) * cuSize + 8); for (int i = 0; i < 1 + bBidir; i++) {
View file
x265_3.0.tar.gz/source/encoder/slicetype.h -> x265_3.1.1.tar.gz/source/encoder/slicetype.h
Changed
@@ -134,6 +134,10 @@ bool m_isSceneTransition; int m_numPools; bool m_extendGopBoundary; + double m_frameVariance[X265_BFRAME_MAX + 4]; + bool m_isFadeIn; + uint64_t m_fadeCount; + int m_fadeStart; Lookahead(x265_param *param, ThreadPool *pool); #if DETAILED_CU_STATS int64_t m_slicetypeDecideElapsedTime;
View file
x265_3.1.1.tar.gz/source/encoder/svt.h
Added
@@ -0,0 +1,52 @@ +/***************************************************************************** +* Copyright (C) 2013-2018 MulticoreWare, Inc +* +* Authors: Radhakrishnan <radhakrishnan@multicorewareinc.com> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. +* +* This program is also available under a commercial proprietary license. +* For more information, contact us at license @ x265.com. +*****************************************************************************/ + + +#ifndef SVT_H +#define SVT_H + +#ifdef SVT_HEVC + +#include "EbApi.h" +#include "EbErrorCodes.h" +#include "EbTime.h" + +namespace X265_NS { + +#define INPUT_SIZE_576p_TH 0x90000 // 0.58 Million +#define INPUT_SIZE_1080i_TH 0xB71B0 // 0.75 Million +#define INPUT_SIZE_1080p_TH 0x1AB3F0 // 1.75 Million +#define INPUT_SIZE_4K_TH 0x29F630 // 2.75 Million + +#define EB_OUTPUTSTREAMBUFFERSIZE_MACRO(ResolutionSize) ((ResolutionSize) < (INPUT_SIZE_1080i_TH) ? 0x1E8480 : (ResolutionSize) < (INPUT_SIZE_1080p_TH) ? 0x2DC6C0 : (ResolutionSize) < (INPUT_SIZE_4K_TH) ? 0x2DC6C0 : 0x2DC6C0) + +void svt_param_default(x265_param* param); +int svt_set_preset_tune(x265_param* param, const char* preset, const char* tune); +int svt_param_parse(x265_param* param, const char* name, const char* value); +void svt_initialise_app_context(x265_encoder *enc); +int svt_initialise_input_buffer(x265_encoder *enc); +} + +#endif // ifdef SVT_HEVC + +#endif // ifndef SVT_H \ No newline at end of file
View file
x265_3.0.tar.gz/source/encoder/weightPrediction.cpp -> x265_3.1.1.tar.gz/source/encoder/weightPrediction.cpp
Changed
@@ -69,15 +69,15 @@ for (int y = 0; y < ref.lines; y += cuSize) { intptr_t pixoff = y * stride; - mvmin.y = (int16_t)((-y - 8) * mvshift); - mvmax.y = (int16_t)((ref.lines - y - 1 + 8) * mvshift); + mvmin.y = (int32_t)((-y - 8) * mvshift); + mvmax.y = (int32_t)((ref.lines - y - 1 + 8) * mvshift); for (int x = 0; x < ref.width; x += cuSize, pixoff += cuSize, cu++) { ALIGN_VAR_16(pixel, buf8x8[8 * 8]); intptr_t bstride = 8; - mvmin.x = (int16_t)((-x - 8) * mvshift); - mvmax.x = (int16_t)((ref.width - x - 1 + 8) * mvshift); + mvmin.x = (int32_t)((-x - 8) * mvshift); + mvmax.x = (int32_t)((ref.width - x - 1 + 8) * mvshift); /* clip MV to available pixels */ MV mv = mvs[cu]; @@ -113,8 +113,8 @@ * into the lowres structures */ int cu = y * cache.lowresWidthInCU; intptr_t pixoff = y * stride; - mvmin.y = (int16_t)((-y - 8) * mvshift); - mvmax.y = (int16_t)((height - y - 1 + 8) * mvshift); + mvmin.y = (int32_t)((-y - 8) * mvshift); + mvmax.y = (int32_t)((height - y - 1 + 8) * mvshift); for (int x = 0; x < width; x += bw, cu++, pixoff += bw) { @@ -126,8 +126,8 @@ mv.y >>= cache.vshift; /* clip MV to available pixels */ - mvmin.x = (int16_t)((-x - 8) * mvshift); - mvmax.x = (int16_t)((width - x - 1 + 8) * mvshift); + mvmin.x = (int32_t)((-x - 8) * mvshift); + mvmax.x = (int32_t)((width - x - 1 + 8) * mvshift); mv = mv.clipped(mvmin, mvmax); intptr_t fpeloffset = (mv.y >> 2) * stride + (mv.x >> 2);
View file
x265_3.0.tar.gz/source/test/pixelharness.cpp -> x265_3.1.1.tar.gz/source/test/pixelharness.cpp
Changed
@@ -2270,6 +2270,56 @@ return true; } +bool PixelHarness::check_ssimDist(ssimDistortion_t ref, ssimDistortion_t opt) +{ + uint32_t srcStride[5] = { 4, 8, 16, 32, 64 }; + intptr_t dstStride[5] = { 4, 8, 16, 32, 64 }; + int shift = X265_DEPTH - 8; + uint64_t opt_dest1 = 0, ref_dest1 = 0, opt_dest2 = 0, ref_dest2 = 0; + int j = 0; + + for (int i = 0; i < ITERS; i++) + { + int index = i % TEST_CASES; + int k1 = rand() % 5, k2 = rand() % 5; + ref(pixel_test_buff[index] + j, srcStride[k1], pixel_test_buff[index + 10] + j, dstStride[k2], &ref_dest1, shift, &ref_dest2); + opt(pixel_test_buff[index] + j, srcStride[k1], pixel_test_buff[index + 10] + j, dstStride[k2], &opt_dest1, shift, &opt_dest2); + + if (opt_dest1 != ref_dest1 && opt_dest2 != ref_dest2) + { + return false; + } + + reportfail() + j += INCR; + } + return true; +} + +bool PixelHarness::check_normFact(normFactor_t ref, normFactor_t opt, int block) +{ + int shift = X265_DEPTH - 8; + uint64_t opt_dest = 0, ref_dest = 0; + int j = 0; + int blockSize = 4 << block; + + for (int i = 0; i < ITERS; i++) + { + int index = i % TEST_CASES; + ref(pixel_test_buff[index] + j, blockSize, shift, &ref_dest); + opt(pixel_test_buff[index] + j, blockSize, shift, &opt_dest); + + if (opt_dest != ref_dest) + { + return false; + } + + reportfail() + j += INCR; + } + return true; +} + bool PixelHarness::testPU(int part, const EncoderPrimitives& ref, const EncoderPrimitives& opt) { if (opt.pu[part].satd) @@ -2607,6 +2657,15 @@ } } + if (opt.cu[i].ssimDist) + { + if (!check_ssimDist(ref.cu[i].ssimDist, opt.cu[i].ssimDist)) + { + printf("\nssimDist[%dx%d] failed!\n", 4 << i, 4 << i); + return false; + } + } + if (i < BLOCK_64x64) { /* TU only primitives */ @@ -3093,6 +3152,19 @@ return false; } } + + for (int i = BLOCK_8x8; i < NUM_CU_SIZES; i++) + { + if (opt.cu[i].normFact) + { + if (!check_normFact(ref.cu[i].normFact, opt.cu[i].normFact, i)) + { + printf("\nnormFact[%dx%d] failed!\n", 4 << i, 4 << i); + return false; + } + } + } + return true; } @@ -3392,6 +3464,14 @@ HEADER("psy_cost_pp[%dx%d]", 4 << i, 4 << i); REPORT_SPEEDUP(opt.cu[i].psy_cost_pp, ref.cu[i].psy_cost_pp, pbuf1, STRIDE, pbuf2, STRIDE); } + + if (opt.cu[i].ssimDist) + { + uint64_t dst1 = 0, dst2 = 0; + int shift = X265_DEPTH - 8; + printf("ssimDist[%dx%d]", 4 << i, 4 << i); + REPORT_SPEEDUP(opt.cu[i].ssimDist, ref.cu[i].ssimDist, pixel_test_buff[0], 32, pixel_test_buff[5], 64, &dst1, shift, &dst2); + } } if (opt.weight_pp) @@ -3725,4 +3805,16 @@ REPORT_SPEEDUP(opt.integral_inith[k], ref.integral_inith[k], dst_buf, pbuf1, STRIDE); } } + + for (int i = BLOCK_8x8; i < NUM_CU_SIZES; i++) + { + if (opt.cu[i].normFact) + { + uint64_t dst = 0; + int blockSize = 4 << i; + int shift = X265_DEPTH - 8; + printf("normFact[%dx%d]", blockSize, blockSize); + REPORT_SPEEDUP(opt.cu[i].normFact, ref.cu[i].normFact, pixel_test_buff[0], blockSize, shift, &dst); + } + } }
View file
x265_3.0.tar.gz/source/test/pixelharness.h -> x265_3.1.1.tar.gz/source/test/pixelharness.h
Changed
@@ -136,6 +136,8 @@ bool check_pelFilterChroma_H(pelFilterChroma_t ref, pelFilterChroma_t opt); bool check_integral_initv(integralv_t ref, integralv_t opt); bool check_integral_inith(integralh_t ref, integralh_t opt); + bool check_ssimDist(ssimDistortion_t ref, ssimDistortion_t opt); + bool check_normFact(normFactor_t ref, normFactor_t opt, int block); public:
View file
x265_3.0.tar.gz/source/test/regression-tests.txt -> x265_3.1.1.tar.gz/source/test/regression-tests.txt
Changed
@@ -84,6 +84,7 @@ ParkScene_1920x1080_24.y4m,--preset medium --qp 40 --rdpenalty 2 --tu-intra-depth 3 ParkScene_1920x1080_24.y4m,--preset medium --pme --tskip-fast --tskip --min-keyint 48 --weightb --limit-refs 3 ParkScene_1920x1080_24.y4m,--preset slower --no-weightp +ParkScene_1920x1080_24.y4m,--tune grain --aq-motion RaceHorses_416x240_30.y4m,--preset superfast --no-cutree RaceHorses_416x240_30.y4m,--preset medium --tskip-fast --tskip RaceHorses_416x240_30.y4m,--preset slower --keyint -1 --rdoq-level 0 --limit-tu 2 @@ -151,6 +152,7 @@ Kimono1_1920x1080_24_400.yuv,--preset placebo --ctu 32 --max-tu-size 8 --limit-tu 2 big_buck_bunny_360p24.y4m, --keyint 60 --min-keyint 40 --gop-lookahead 14 BasketballDrive_1920x1080_50.y4m, --preset medium --no-open-gop --keyint 50 --min-keyint 50 --radl 2 --vbv-maxrate 5000 --vbv-bufsize 5000 +big_buck_bunny_360p24.y4m, --bitrate 500 --fades # Main12 intraCost overflow bug test 720p50_parkrun_ter.y4m,--preset medium
View file
x265_3.0.tar.gz/source/x265.cpp -> x265_3.1.1.tar.gz/source/x265.cpp
Changed
@@ -31,6 +31,7 @@ #include "input/input.h" #include "output/output.h" #include "output/reconplay.h" +#include "svt.h" #if HAVE_VLD /* Visual Leak Detector */ @@ -287,6 +288,7 @@ const char *preset = NULL; const char *tune = NULL; const char *profile = NULL; + int svtEnabled = 0; if (argc <= 1) { @@ -297,7 +299,8 @@ /* Presets are applied before all other options. */ for (optind = 0;; ) { - int c = getopt_long(argc, argv, short_options, long_options, NULL); + int optionsIndex = -1; + int c = getopt_long(argc, argv, short_options, long_options, &optionsIndex); if (c == -1) break; else if (c == 'p') @@ -310,6 +313,8 @@ profile = optarg; else if (c == '?') bShowHelp = true; + else if (!c && !strcmp(long_options[optionsIndex].name, "svt")) + svtEnabled = 1; } if (!outputBitDepth && profile) @@ -357,6 +362,9 @@ showHelp(param); } + //Set enable SVT-HEVC encoder first if found in the command line + if (svtEnabled) api->param_parse(param, "svt", NULL); + for (optind = 0;; ) { int long_options_index = -1; @@ -423,6 +431,7 @@ OPT("tune") /* handled above */; OPT("output-depth") /* handled above */; OPT("recon-y4m-exec") reconPlayCmd = optarg; + OPT("svt") /* handled above */; OPT("qpfile") { this->qpfile = x265_fopen(optarg, "rb"); @@ -492,6 +501,18 @@ return true; } +#ifdef SVT_HEVC + if (svtEnabled) + { + EB_H265_ENC_CONFIGURATION* svtParam = (EB_H265_ENC_CONFIGURATION*)param->svtHevcParam; + param->sourceWidth = svtParam->sourceWidth; + param->sourceHeight = svtParam->sourceHeight; + param->fpsNum = svtParam->frameRateNumerator; + param->fpsDenom = svtParam->frameRateDenominator; + svtParam->encoderBitDepth = inputBitDepth; + } +#endif + InputFileInfo info; info.filename = inputfn; info.depth = inputBitDepth; @@ -536,11 +557,33 @@ if (this->framesToBeEncoded == 0 && info.frameCount > (int)seek) this->framesToBeEncoded = info.frameCount - seek; param->totalFrames = this->framesToBeEncoded; + +#ifdef SVT_HEVC + if (svtEnabled) + { + EB_H265_ENC_CONFIGURATION* svtParam = (EB_H265_ENC_CONFIGURATION*)param->svtHevcParam; + svtParam->sourceWidth = param->sourceWidth; + svtParam->sourceHeight = param->sourceHeight; + svtParam->frameRateNumerator = param->fpsNum; + svtParam->frameRateDenominator = param->fpsDenom; + svtParam->framesToBeEncoded = param->totalFrames; + svtParam->encoderColorFormat = (EB_COLOR_FORMAT)param->internalCsp; + } +#endif /* Force CFR until we have support for VFR */ info.timebaseNum = param->fpsDenom; info.timebaseDenom = param->fpsNum; + if (param->bField && param->interlaceMode) + { // Field FPS + param->fpsNum *= 2; + // Field height + param->sourceHeight = param->sourceHeight >> 1; + // Number of fields to encode + param->totalFrames *= 2; + } + if (api->param_apply_profile(param, profile)) return true; @@ -880,10 +923,12 @@ uint32_t nal; int16_t *errorBuf = NULL; bool bDolbyVisionRPU = false; + uint8_t *rpuPayload = NULL; int ret = 0; + int inputPicNum = 1; + x265_picture picField1, picField2; - - if (!param->bRepeatHeaders) + if (!param->bRepeatHeaders && !param->bEnableSvtHevc) { if (api->encoder_headers(encoder, &p_nal, &nal) < 0) { @@ -895,11 +940,21 @@ cliopt.totalbytes += cliopt.output->writeHeaders(p_nal, nal); } - api->picture_init(param, pic_in); + if (param->bField && param->interlaceMode) + { + api->picture_init(param, &picField1); + api->picture_init(param, &picField2); + // return back the original height of input + param->sourceHeight *= 2; + api->picture_init(param, pic_in); + } + else + api->picture_init(param, pic_in); if (param->dolbyProfile && cliopt.dolbyVisionRpu) { - pic_in->rpu.payload = X265_MALLOC(uint8_t, 1024); + rpuPayload = X265_MALLOC(uint8_t, 1024); + pic_in->rpu.payload = rpuPayload; if (pic_in->rpu.payload) bDolbyVisionRPU = true; } @@ -916,7 +971,7 @@ // main encoder loop while (pic_in && !b_ctrl_c) { - pic_orig.poc = inFrameCount; + pic_orig.poc = (param->bField && param->interlaceMode) ? inFrameCount * 2 : inFrameCount; if (cliopt.qpfile) { if (!cliopt.parseQPFile(pic_orig)) @@ -944,39 +999,129 @@ /* Overwrite PTS */ pic_in->pts = pic_in->poc; + // convert to field + if (param->bField && param->interlaceMode) + { + int height = pic_in->height >> 1; + + int static bCreated = 0; + if (bCreated == 0) + { + bCreated = 1; + inputPicNum = 2; + picField1.fieldNum = 1; + picField2.fieldNum = 2; + + picField1.bitDepth = picField2.bitDepth = pic_in->bitDepth; + picField1.colorSpace = picField2.colorSpace = pic_in->colorSpace; + picField1.height = picField2.height = pic_in->height >> 1; + picField1.framesize = picField2.framesize = pic_in->framesize >> 1; + + size_t fieldFrameSize = (size_t)pic_in->framesize >> 1; + char* field1Buf = X265_MALLOC(char, fieldFrameSize); + char* field2Buf = X265_MALLOC(char, fieldFrameSize); + + int stride = picField1.stride[0] = picField2.stride[0] = pic_in->stride[0]; + uint64_t framesize = stride * (height >> x265_cli_csps[pic_in->colorSpace].height[0]); + picField1.planes[0] = field1Buf; + picField2.planes[0] = field2Buf; + for (int i = 1; i < x265_cli_csps[pic_in->colorSpace].planes; i++) + { + picField1.planes[i] = field1Buf + framesize; + picField2.planes[i] = field2Buf + framesize; + + stride = picField1.stride[i] = picField2.stride[i] = pic_in->stride[i]; + framesize += (stride * (height >> x265_cli_csps[pic_in->colorSpace].height[i])); + } + assert(framesize == picField1.framesize); + } + + picField1.pts = picField1.poc = pic_in->poc; + picField2.pts = picField2.poc = pic_in->poc + 1; + + picField1.userSEI = picField2.userSEI = pic_in->userSEI; +
View file
x265_3.0.tar.gz/source/x265.h -> x265_3.1.1.tar.gz/source/x265.h
Changed
@@ -147,9 +147,9 @@ typedef struct x265_analysis_MV { union{ - struct { int16_t x, y; }; + struct { int32_t x, y; }; - int32_t word; + int64_t word; }; }x265_analysis_MV; @@ -464,6 +464,8 @@ //Dolby Vision RPU metadata x265_dolby_vision_rpu rpu; + + int fieldNum; } x265_picture; typedef enum @@ -1765,6 +1767,22 @@ * 0 - Disabled. 1 - Save/Load ctu distortion to/from the file specified * analysis-save/load. Default 0. */ int ctuDistortionRefine; + + /* Enable SVT HEVC Encoder */ + int bEnableSvtHevc; + + /* SVT-HEVC param structure. For internal use when SVT HEVC encoder is enabled */ + void* svtHevcParam; + + /* Detect fade-in regions. Enforces I-slice for the brightest point. + Re-init RC history at that point in ABR mode. Default is disabled. */ + int bEnableFades; + + /* Enable field coding */ + int bField; + + /*Emit content light level info SEI*/ + int bEmitCLL; } x265_param; /* x265_param_alloc: * Allocates an x265_param instance. The returned param structure is not @@ -1792,6 +1810,10 @@ #define X265_PARAM_BAD_VALUE (-2) int x265_param_parse(x265_param *p, const char *name, const char *value); +x265_zone *x265_zone_alloc(int zoneCount, int isZoneFile); + +void x265_zone_free(x265_param *param); + int x265_zone_param_parse(x265_param* p, const char* name, const char* value); static const char * const x265_profile_names[] = { @@ -1840,7 +1862,7 @@ * 100 times faster than placebo! * * Currently available tunings are: */ -static const char * const x265_tune_names[] = { "psnr", "ssim", "grain", "zerolatency", "fastdecode", 0 }; +static const char * const x265_tune_names[] = { "psnr", "ssim", "grain", "zerolatency", "fastdecode", "animation", 0 }; /* returns 0 on success, negative on failure (e.g. invalid preset/tune name). */ int x265_param_default_preset(x265_param *, const char *preset, const char *tune);
View file
x265_3.0.tar.gz/source/x265cli.h -> x265_3.1.1.tar.gz/source/x265cli.h
Changed
@@ -73,6 +73,8 @@ { "input-csp", required_argument, NULL, 0 }, { "interlace", required_argument, NULL, 0 }, { "no-interlace", no_argument, NULL, 0 }, + { "field", no_argument, NULL, 0 }, + { "no-field", no_argument, NULL, 0 }, { "fps", required_argument, NULL, 0 }, { "seek", required_argument, NULL, 0 }, { "frame-skip", required_argument, NULL, 0 }, @@ -124,6 +126,8 @@ { "scenecut", required_argument, NULL, 0 }, { "no-scenecut", no_argument, NULL, 0 }, { "scenecut-bias", required_argument, NULL, 0 }, + { "fades", no_argument, NULL, 0 }, + { "no-fades", no_argument, NULL, 0 }, { "radl", required_argument, NULL, 0 }, { "ctu-info", required_argument, NULL, 0 }, { "intra-refresh", no_argument, NULL, 0 }, @@ -314,6 +318,26 @@ { "hevc-aq", no_argument, NULL, 0 }, { "no-hevc-aq", no_argument, NULL, 0 }, { "qp-adaptation-range", required_argument, NULL, 0 }, +#ifdef SVT_HEVC + { "svt", no_argument, NULL, 0 }, + { "no-svt", no_argument, NULL, 0 }, + { "svt-hme", no_argument, NULL, 0 }, + { "no-svt-hme", no_argument, NULL, 0 }, + { "svt-search-width", required_argument, NULL, 0 }, + { "svt-search-height", required_argument, NULL, 0 }, + { "svt-compressed-ten-bit-format", no_argument, NULL, 0 }, + { "no-svt-compressed-ten-bit-format", no_argument, NULL, 0 }, + { "svt-speed-control", no_argument , NULL, 0 }, + { "no-svt-speed-control", no_argument , NULL, 0 }, + { "svt-preset-tuner", required_argument , NULL, 0 }, + { "svt-hierarchical-level", required_argument , NULL, 0 }, + { "svt-base-layer-switch-mode", required_argument , NULL, 0 }, + { "svt-pred-struct", required_argument , NULL, 0 }, + { "svt-fps-in-vps", no_argument , NULL, 0 }, + { "no-svt-fps-in-vps", no_argument , NULL, 0 }, +#endif + { "cll", no_argument, NULL, 0 }, + { "no-cll", no_argument, NULL, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, @@ -371,6 +395,7 @@ H0("-f/--frames <integer> Maximum number of frames to encode. Default all\n"); H0(" --seek <integer> First frame to encode\n"); H1(" --[no-]interlace <bff|tff> Indicate input pictures are interlace fields in temporal order. Default progressive\n"); + H0(" --[no-]field Enable or disable field coding. Default %s\n", OPT( param->bField)); H1(" --dither Enable dither if downscaling to 8 bit pixels. Default disabled\n"); H0(" --[no-]copy-pic Copy buffers of input picture in frame. Default %s\n", OPT(param->bCopyPicToFrame)); H0("\nQuality reporting metrics:\n"); @@ -453,6 +478,7 @@ H0(" --no-scenecut Disable adaptive I-frame decision\n"); H0(" --scenecut <integer> How aggressively to insert extra I-frames. Default %d\n", param->scenecutThreshold); H1(" --scenecut-bias <0..100.0> Bias for scenecut detection. Default %.2f\n", param->scenecutBias); + H0(" --[no-]fades Enable detection and handling of fade-in regions. Default %s\n", OPT(param->bEnableFades)); H0(" --radl <integer> Number of RADL pictures allowed in front of IDR. Default %d\n", param->radl); H0(" --intra-refresh Use Periodic Intra Refresh instead of IDR frames\n"); H0(" --rc-lookahead <integer> Number of frames for frame-type lookahead (determines encoder latency) Default %d\n", param->lookaheadDepth); @@ -578,7 +604,8 @@ H1(" --chromaloc <integer> Specify chroma sample location (0 to 5). Default of %d\n", param->vui.chromaSampleLocTypeTopField); H0(" --master-display <string> SMPTE ST 2086 master display color volume info SEI (HDR)\n"); H0(" format: G(x,y)B(x,y)R(x,y)WP(x,y)L(max,min)\n"); - H0(" --max-cll <string> Emit content light level info SEI as \"cll,fall\" (HDR)\n"); + H0(" --max-cll <string> Specify content light level info SEI as \"cll,fall\" (HDR).\n"); + H0(" --[no-]cll Emit content light level info SEI. Default %s\n", OPT(param->bEmitCLL)); H0(" --[no-]hdr Control dumping of HDR SEI packet. If max-cll or master-display has non-zero values, this is enabled. Default %s\n", OPT(param->bEmitHDRSEI)); H0(" --[no-]hdr-opt Add luma and chroma offsets for HDR/WCG content. Default %s\n", OPT(param->bHDROpt)); H0(" --min-luma <integer> Minimum luma plane value of input source picture\n"); @@ -605,6 +632,19 @@ H1(" --recon-depth <integer> Bit-depth of reconstructed raw image file. Defaults to input bit depth, or 8 if Y4M\n"); H1(" --recon-y4m-exec <string> pipe reconstructed frames to Y4M viewer, ex:\"ffplay -i pipe:0 -autoexit\"\n"); H0(" --lowpass-dct Use low-pass subband dct approximation. Default %s\n", OPT(param->bLowPassDct)); +#ifdef SVT_HEVC + H0(" --[no]svt Enable SVT HEVC encoder %s\n", OPT(param->bEnableSvtHevc)); + H0(" --[no-]svt-hme Enable Hierarchial motion estimation(HME) in SVT HEVC encoder \n"); + H0(" --svt-search-width Motion estimation search area width for SVT HEVC encoder \n"); + H0(" --svt-search-height Motion estimation search area height for SVT HEVC encoder \n"); + H0(" --[no-]svt-compressed-ten-bit-format Enable 8+2 encoding mode for 10bit input in SVT HEVC encoder \n"); + H0(" --[no-]svt-speed-control Enable speed control functionality to achieve real time encoding speed for SVT HEVC encoder \n"); + H0(" --svt-preset-tuner Enable additional faster presets of SVT; This only has to be used on top of x265's ultrafast preset. Accepts values in the range of 0-2 \n"); + H0(" --svt-hierarchical-level Hierarchical layer for SVT-HEVC encoder; Accepts inputs in the range 0-3 \n"); + H0(" --svt-base-layer-switch-mode Select whether B/P slice should be used in base layer for SVT-HEVC encoder. 0-Use B-frames; 1-Use P frames in the base layer \n"); + H0(" --svt-pred-struct Select pred structure for SVT HEVC encoder; Accepts inputs in the range 0-2 \n"); + H0(" --[no-]svt-fps-in-vps Enable VPS timing info for SVT HEVC encoder \n"); +#endif H1("\nExecutable return codes:\n"); H1(" 0 - encode successful\n"); H1(" 1 - unable to parse command line\n");
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.