Skip to content

Commit

Permalink
Merge pull request #100 from adamjw24/develop_1.2
Browse files Browse the repository at this point in the history
Changes for 1.2.0 (5% BD-rate improvement for faster)
  • Loading branch information
jbrdbg authored Oct 13, 2021
2 parents 786e8b5 + 845f62e commit 24b980d
Show file tree
Hide file tree
Showing 65 changed files with 32,590 additions and 725 deletions.
1 change: 0 additions & 1 deletion .github/workflows/Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ jobs:
strategy:
matrix:
include:
- os: ubuntu-16.04
- os: ubuntu-18.04
- os: ubuntu-20.04
- os: macos-10.15
Expand Down
42 changes: 29 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if( NOT CMAKE_VERSION VERSION_LESS 3.13.0 )
endif()

# project name
project( vvenc VERSION 1.1.0 )
project( vvenc VERSION 1.2.0 )

set( VVENC_ENABLE_X86_SIMD TRUE )
set( VVENC_ENABLE_ARM_SIMD FALSE )
Expand Down Expand Up @@ -54,10 +54,10 @@ if( NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
if( MSVC )
add_compile_options( "/EHsc" )
endif()

list( FIND ${PROJECT_NAME}_ADD_SUBDIRECTORIES "source/App/vvencFFapp" vvEncFfAppFound )
list( FIND ${PROJECT_NAME}_ADD_SUBDIRECTORIES "source/App/vvencapp" vvEncAppFound )

if( vvEncFfAppFound GREATER_EQUAL 0 OR vvEncAppFound GREATER_EQUAL 0 )
list( PREPEND ${PROJECT_NAME}_ADD_SUBDIRECTORIES "source/Lib/apputils" )
endif()
Expand All @@ -75,19 +75,20 @@ endif()

# enable install target
set( VVENC_ENABLE_INSTALL ON CACHE BOOL "Enable or disable install target" )

# enable postfix
set( VVENC_ENABLE_BUILD_TYPE_POSTFIX OFF CACHE BOOL "Enable or disable build type postfix for apps and libs" )

set( VVENC_ENABLE_LINK_TIME_OPT ON CACHE BOOL "Enable link time optimization for release and profile builds" )

set( VVENC_ENABLE_THIRDPARTY_JSON ON CACHE BOOL "Enable use of thirdparty json library" )

if( CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR
CMAKE_CXX_COMPILER_ID STREQUAL "Clang" )

# enable address sanitizer
set( VVENC_USE_ADDRESS_SANITIZER OFF CACHE BOOL "Enable or disable address sanitizer" )

# add -march=native

set( VVENC_OPT_TARGET_ARCH "" CACHE STRING "Enable or disable building with architecture specific optimization" )
endif()

Expand Down Expand Up @@ -146,9 +147,6 @@ if( NOT CMAKE_BUILD_TYPE )
set( CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE )
endif()

#set( ENABLE_LINK_TIME_OPT ON CACHE BOOL "Enable link time optimization for release and profile builds" )
#set( OPT_TARGET_ARCH "native" CACHE STRING "Create code and optimize for this architecture (default native)" )

# set c++11
set( CMAKE_CXX_STANDARD 14 )
set( CMAKE_CXX_STANDARD_REQUIRED ON )
Expand Down Expand Up @@ -343,8 +341,26 @@ add_test( NAME Test_compare_output-medium_noqpa_0thr COMMAND ${CMAKE_COMMAND} -E
add_test( NAME Test_vvencFFapp-lowdelay_medium_enc COMMAND vvencFFapp -c ../../cfg/experimental/lowdelay_medium.cfg -c ../../test/data/RTn23.cfg --IntraPeriod=-1 -dph 1 -f 8 -b outf.vvc )
add_test( NAME Test_vvencFFapp-lowdelay_medium_dec COMMAND vvencFFapp --decode -b outf.vvc )

add_test( NAME Test_remove_temp_files COMMAND ${CMAKE_COMMAND} -E remove out.vvc tout.vvc rec.yuv outf.vvc )

add_test( NAME Test_vvencapp-medium_rc2p COMMAND vvencapp --preset medium -s 80x44 -r 15 -i ../../test/data/RTn23_80x44p15_f15.yuv -f 5 --Bitrate=10000 --Passes=2 -o out.vvc )
set_tests_properties( Test_vvencapp-medium_rc2p PROPERTIES TIMEOUT 30 )
add_test( NAME Test_vvencFFapp-medium_rc2p COMMAND vvencFFapp -c ../../cfg/randomaccess_medium.cfg -c ../../test/data/RTn23.cfg -f 5 --TargetBitrate=10000 --Passes=2 -b outf.vvc )
set_tests_properties( Test_vvencFFapp-medium_rc2p PROPERTIES TIMEOUT 30 )
add_test( NAME Test_compare_output-medium_rc2p COMMAND ${CMAKE_COMMAND} -E compare_files out.vvc outf.vvc )

add_test( NAME Test_vvencFFapp-medium_rc2p_statsFile1_exp COMMAND vvencFFapp -c ../../cfg/randomaccess_medium.cfg -c ../../test/data/RTn23.cfg -f 5 --TargetBitrate=10000 --Pass=1 --RCStatsFile=stats.json -b outf.vvc )
set_tests_properties( Test_vvencFFapp-medium_rc2p_statsFile1_exp PROPERTIES TIMEOUT 30 )
add_test( NAME Test_vvencFFapp-medium_rc2p_statsFile2_exp COMMAND vvencFFapp -c ../../cfg/randomaccess_medium.cfg -c ../../test/data/RTn23.cfg -f 5 --TargetBitrate=10000 --Pass=2 --RCStatsFile=stats.json -b outf.vvc )
set_tests_properties( Test_vvencFFapp-medium_rc2p_statsFile2_exp PROPERTIES TIMEOUT 30 )
add_test( NAME Test_compare_output-medium_rc2p_statsFile_exp COMMAND ${CMAKE_COMMAND} -E compare_files out.vvc outf.vvc )

add_test( NAME Test_vvencapp-medium_rc2p_statsFile1_easy COMMAND vvencapp --preset medium -s 80x44 -r 15 -i ../../test/data/RTn23_80x44p15_f15.yuv -f 5 --Bitrate=10000 --Pass=1 --RCStatsFile=stats.json -o out.vvc )
set_tests_properties( Test_vvencapp-medium_rc2p_statsFile1_easy PROPERTIES TIMEOUT 30 )
add_test( NAME Test_vvencapp-medium_rc2p_statsFile2_easy COMMAND vvencapp --preset medium -s 80x44 -r 15 -i ../../test/data/RTn23_80x44p15_f15.yuv -f 5 --Bitrate=10000 --Pass=2 --RCStatsFile=stats.json -o out.vvc )
set_tests_properties( Test_vvencapp-medium_rc2p_statsFile2_easy PROPERTIES TIMEOUT 30 )
add_test( NAME Test_compare_output-medium_rc2p_statsFile_easy COMMAND ${CMAKE_COMMAND} -E compare_files out.vvc outf.vvc )

add_test( NAME Test_remove_temp_files COMMAND ${CMAKE_COMMAND} -E remove out.vvc tout.vvc rec.yuv outf.vvc stats.json )


if( VVENC_ENABLE_INSTALL )
# include installer
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ ifneq ($(disable-lto),)
CONFIG_OPTIONS += -DVVENC_ENABLE_LINK_TIME_OPT=OFF
endif

ifneq ($(disable-json),)
CONFIG_OPTIONS += -DVVENC_ENABLE_THIRDPARTY_JSON=OFF
endif

ifneq ($(enable-build-type-postfix),)
CONFIG_OPTIONS += -DVVENC_ENABLE_BUILD_TYPE_POSTFIX=ON
endif
Expand Down
30 changes: 24 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ The standard encoder (**vvencapp**) can be used in one of five predefined preset
| --qp,-q <int> | 32 | Quantization parameter (0..63) |
| --bitrate,-b <int> | 0 | Bitrate for rate control (0: constant-QP encoding without rate control, otherwise bits per second). <br> Rate control requires correct `--framerate` (see option above). |
| --passes,-p <int> | -1 | Number of rate control passes (1: single-pass rate control, 2: two-pass rate control) |
| --pass <int> | not set | Set current rate control pass. If not set, encoder will run both passes. If set to [1,2], <br> encoder will execute first or second pass only. Requires `--rcstatsfile` to be set (see below). |
| --rcstatsfile <str> | not set | Rate control statistics file, to store or load first pass rate control statistics data. |
| --qpa <int> | 1 | Perceptual QP adaptation (QPA) to improve subjective video quality (0: off, 1: on) |
| --refreshsec,-rs <int> | 1 | Intra period/refresh in seconds |
| --threads,-t <int> | size >= 1280x720: <br> 8, else: 4 | Number of threads (1-N) |
Expand All @@ -72,7 +74,7 @@ The expert mode encoder (**vvencFFapp**) is based on the [VVC test model (VTM)](
**Example usage:** In order to start your first experiments with the expert mode encoder, adapt the sequence.cfg configuration file to your input YUV source file and use the following command:

vvencFFapp -c randomaccess_medium.cfg -c sequence.cfg

## How to map command line parameters of the standard encoder into the full featured expert mode encoder?
The export mode encoder (**vvencFFapp**) can be used in the same manner as the standard encoder (**vvencapp**) by using the adapted expert option names.
Be aware of that some options have different default values. The following table shows only expert options that differs from the standard encoder:
Expand All @@ -91,7 +93,9 @@ Be aware of that some options have different default values. The following table
| --output,-o <str> | not set | --BitstreamFile,-b <str> | not set |
| --qp,-q <int> | 32 | --QP <int> | 32 |
| --bitrate,-b <int> | 0 | --TargetBitrate <int> | 0 |
| --passes,-p <int> | -1 | --NumPasses <int> | -1 |
| --passes,-p <int> | -1 | --NumPasses <int> | -1 |
| --pass <int> | -1 | --Pass <int> | -1 |
| --rcstatsfile <str> | - | --RCStatsFile <str> | - |
| --qpa <int> | 1 | --PerceptQPA,-qpa <int> | 0 |
| --refreshtype,-rt <str> | cra | --DecodingRefreshType <str> | cra |
| --refreshsec,rs <int> | 1 | --RefreshSec <int> | 1 |
Expand All @@ -104,20 +108,20 @@ Be aware of that some options have different default values. The following table
| --accessunitdelimiter,-aud <int> | auto | --AccessUnitDelimiter,-aud <int> | auto |
| --vuiparameterspresent,-vui <int> | auto | --VuiParametersPresent,-vui <int> | auto |
| --hrdparameterspresent,-hrd <int> | auto | --HrdParametersPresent,-hrd <int> | auto |
| --decodedpicturehash,-dph <int> | off | --SEIDecodedPictureHash,-dph <int> | auto |
| --decodedpicturehash,-dph <int> | off | --SEIDecodedPictureHash,-dph <int> | off |

**Example usage:** Given a YUV 4:2:0 input file with a bit-depth of 8bit and a resolution of 176x144 pixels,
the following calls will encode the input file with the medium speedup preset with 1Mbit/s by using Two pass rate control.
Both calls will produce the same output.

**standard encoder:**
**standard encoder:**

vvencapp --preset medium -i BUS_176x144_75@15.yuv -s 176x144 -r 15 -b 1000000 -p 2 -o str.266

**full featured expert mode encoder:**
**full featured expert mode encoder:**

vvencFFapp --preset medium --InputFile BUS_176x144_75@15.yuv -s 176x144 -fr 15 -TargetBitrate 1000000 --NumPasses 2 -qpa 1 -t -1 -b str.266

# Contributing

Feel free to contribute. To do so:
Expand All @@ -126,6 +130,20 @@ Feel free to contribute. To do so:
* Apply the desired changes
* Create a pull-request to the upstream repository

# Third party tools

## nlohmann/json: JSON for Modern C++

JSON serialization is used for writing / reading rate control statistics. The external library is available under
MIT license at https://github.com/nlohmann/json. Please see [LICENSE.MIT](./thirdparty/nlohmann_json/LICENSE.MIT) for
the terms of use of the contents of this library.

In case you don't want to include the external nlohmann/json library, please compile with

make install-release disable-json=1

In this case writing / reading rate control statistic files is not supported by the VVenC encoders.

# License

Please see [LICENSE.txt](./LICENSE.txt) file for the terms of use of the contents of this repository.
Expand Down
12 changes: 7 additions & 5 deletions cfg/experimental/lowdelay_fast.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ MaxNumMergeCand : 6 # Maximum number of merge candidates
# Tools configuration
Affine : 2 # Affine prediction: 0: disabled, 1: vtm, 2: fast
ALF : 1 # Adpative Loop Filter: 0: disabled, 1: enabled
ALFSpeed : 0 # ALF speed (skip filtering of non-referenced frames) [0-1]
AllowDisFracMMVD : 0 # Disable fractional MVD in MMVD mode adaptively
ALFSpeed : 1 # ALF speed (skip filtering of non-referenced frames) [0-1]
AllowDisFracMMVD : 1 # Disable fractional MVD in MMVD mode adaptively
BCW : 0 # Enable Generalized Bi-prediction(Bcw) 0: disabled, 1: enabled, 2: fast
BIO : 1 # Bi-directional optical flow: 0: disabled, 1: enabled
CCALF : 1 # Cross-component Adaptive Loop Filter: 0: disabled, 1: enabled
Expand All @@ -86,7 +86,7 @@ EncDbOpt : 0 # Encoder optimization with deblocking fi
Geo : 0 # Geometric partitioning mode: 0: disabled, 1: vtm, 2: good quality, 3: fast
IMV : 5 # Adaptive MV precision Mode (IMV): 0: disabled, 1:vtm, 2-7: fast modes
ISP : 0 # Intra subpartitions: 0: disabled, 1: enabled, 2: fast, 3: faster
JointCbCr : 0 # Joint coding of chroma residuals: 0: disabled, 1: enabled
JointCbCr : 1 # Joint coding of chroma residuals: 0: disabled, 1: enabled
LFNST : 1 # LFNST: 0: disabled, 1: enabled
LMChroma : 1 # LMChroma prediction: 0: disabled, 1: enabled
LMCSEnable : 2 # LMCS: 0: disable, 1:enable, 2: use SCC detection to disable for screen coded content
Expand Down Expand Up @@ -121,7 +121,7 @@ ChromaTS : 0 # Chroma transform skip: 0: disabled, 1:
TransformSkipLog2MaxSize : 4

# Fast options
QtbttExtraFast : 2 # Non-VTM compatible QTBTT speed-ups: 0: disabled, 1: enabled
QtbttExtraFast : 3 # Non-VTM compatible QTBTT speed-ups: 0: disabled, 1: enabled
ContentBasedFastQtbt : 1 # Signal based QTBT speed-up: 0: disabled, 1: enabled
PBIntraFast : 1 # Fast assertion if the intra mode is probable: 0: disabled, 1: enabled
FastMrg : 2 # Fast methods for inter merge: 0: disabled, 1: vtm, 2: fast
Expand All @@ -131,6 +131,8 @@ FastIntraTools : 0 # Speedup intra tools: LFNST, ISP, MTS
FastInferMerge : 2 # Fast method to skip Inter/Intra modes. 0: off, [1..4] speedups
ECU : 1 # Early CU setting
IntegerET : 0 # Enable early termination for integer motion search
IntraEstDecBit : 3 # Test every eight intra directional mode in the first pass
IntraEstDecBit : 2 # Test every eight intra directional mode in the first pass
NumIntraModesFullRD : -1 # Number modes for full RD intra search
ReduceIntraChromaModesFullRD : 1 # Reduce modes for chroma full RD intra search


10 changes: 6 additions & 4 deletions cfg/experimental/lowdelay_faster.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ MaxNumMergeCand : 6 # Maximum number of merge candidates

# Tools configuration
Affine : 0 # Affine prediction: 0: disabled, 1: vtm, 2: fast
ALF : 0 # Adpative Loop Filter: 0: disabled, 1: enabled
ALFSpeed : 0 # ALF speed (skip filtering of non-referenced frames) [0-1]
ALF : 1 # Adpative Loop Filter: 0: disabled, 1: enabled
ALFSpeed : 1 # ALF speed (skip filtering of non-referenced frames) [0-1]
AllowDisFracMMVD : 0 # Disable fractional MVD in MMVD mode adaptively
BCW : 0 # Enable Generalized Bi-prediction(Bcw) 0: disabled, 1: enabled, 2: fast
BIO : 0 # Bi-directional optical flow: 0: disabled, 1: enabled
CCALF : 0 # Cross-component Adaptive Loop Filter: 0: disabled, 1: enabled
CCALF : 1 # Cross-component Adaptive Loop Filter: 0: disabled, 1: enabled
CIIP : 0 # CIIP mode: 0: disable, 1: vtm, 2: fast, 3: faster
DepQuant : 0 # Dependent quantization: 0: disabled, 1: enabled
DMVR : 1 # Decoder-side Motion Vector Refinement: 0: disabled, 1: enabled
Expand Down Expand Up @@ -121,7 +121,7 @@ ChromaTS : 0 # Chroma transform skip: 0: disabled, 1:
TransformSkipLog2MaxSize : 3

# Fast options
QtbttExtraFast : 3 # Non-VTM compatible QTBTT speed-ups: 0: disabled, 1: enabled
QtbttExtraFast : 7 # Non-VTM compatible QTBTT speed-ups: 0: disabled, 1: enabled
ContentBasedFastQtbt : 1 # Signal based QTBT speed-up: 0: disabled, 1: enabled
PBIntraFast : 1 # Fast assertion if the intra mode is probable: 0: disabled, 1: enabled
FastMrg : 2 # Fast methods for inter merge: 0: disabled, 1: vtm, 2: fast
Expand All @@ -132,5 +132,7 @@ FastInferMerge : 4 # Fast method to skip Inter/Intra modes.
ECU : 1 # Early CU setting
IntegerET : 1 # Enable early termination for integer motion search
IntraEstDecBit : 3 # Test every eight intra directional mode in the first pass
NumIntraModesFullRD : 1 # Number modes for full RD intra search
ReduceIntraChromaModesFullRD : 1 # Reduce modes for chroma full RD intra search


6 changes: 4 additions & 2 deletions cfg/experimental/lowdelay_medium.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ ChromaTS : 0 # Chroma transform skip: 0: disabled, 1:
TransformSkipLog2MaxSize : 4

# Fast options
QtbttExtraFast : 2 # Non-VTM compatible QTBTT speed-ups: 0: disabled, 1: enabled
ContentBasedFastQtbt : 1 # Signal based QTBT speed-up: 0: disabled, 1: enabled
QtbttExtraFast : 3 # Non-VTM compatible QTBTT speed-ups: 0: disabled, 1: enabled
ContentBasedFastQtbt : 0 # Signal based QTBT speed-up: 0: disabled, 1: enabled
PBIntraFast : 1 # Fast assertion if the intra mode is probable: 0: disabled, 1: enabled
FastMrg : 2 # Fast methods for inter merge: 0: disabled, 1: vtm, 2: fast
FastLocalDualTreeMode : 2 # Fast intra pass coding for local dual-tree in intra coding region: 0: disable, 1: use threshold, 2: one intra mode only
Expand All @@ -132,5 +132,7 @@ FastInferMerge : 0 # Fast method to skip Inter/Intra modes.
ECU : 0 # Early CU setting
IntegerET : 0 # Enable early termination for integer motion search
IntraEstDecBit : 2 # Test every fourth intra directional mode in the first pass
NumIntraModesFullRD : -1 # Number modes for full RD intra search
ReduceIntraChromaModesFullRD : 0 # Reduce modes for chroma full RD intra search


Loading

0 comments on commit 24b980d

Please sign in to comment.