Commit 019b4f56 authored by Karsten Suehring's avatar Karsten Suehring

update VTM with changes from BMS:

- remove HighPrecision MV option
- fixes for statistics output
- removal of SVN header integration (fixes issue with Xcode)
parent 0967091d
......@@ -28,7 +28,6 @@ if( CMAKE_SYSTEM_NAME STREQUAL "Linux" )
endif()
set( EXTENSION_360_VIDEO OFF CACHE BOOL "If EXTENSION_360_VIDEO is on, 360Lib will be added" )
set( SKIP_SVN_REVISION OFF CACHE BOOL "Don't add SVN path and revision info to the encoder and decoder output" )
set( SET_ENABLE_TRACING OFF CACHE BOOL "Set ENABLE_TRACING as a compiler flag" )
set( ENABLE_TRACING OFF CACHE BOOL "If SET_ENABLE_TRACING is on, it will be set to this value" )
set( ENABLE_VTM OFF CACHE BOOL "If ENABLE_VTM is on, the software will be compiled as VTM" )
......
......@@ -71,10 +71,6 @@ ifneq ($(enable-tracing),)
CONFIG_OPTIONS += -DSET_ENABLE_TRACING=ON -DENABLE_TRACING=$(enable-tracing)
endif
ifneq ($(skip-svn-info),)
CONFIG_OPTIONS += -DSKIP_SVN_REVISION=$(skip-svn-info)
endif
ifneq ($(parallel-split),)
CONFIG_OPTIONS += -DSET_ENABLE_SPLIT_PARALLELISM=ON -DENABLE_SPLIT_PARALLELISM=$(parallel-split)
endif
......
......@@ -105,7 +105,6 @@ MTT : 1
EMT : 1
EMTFast : 1
Affine : 1
HighPrecMv : 1
SubPuMvp : 1
MaxNumMergeCand : 6
LMChroma : 1 # use CCLM only
......@@ -121,3 +120,4 @@ AMaxBT : 1
### DO NOT ADD ANYTHING BELOW THIS LINE ###
### DO NOT DELETE THE EMPTY LINE BELOW ###
......@@ -121,7 +121,6 @@ MTT : 1
EMT : 1
EMTFast : 1
Affine : 1
HighPrecMv : 1
SubPuMvp : 1
MaxNumMergeCand : 6
LMChroma : 1 # use CCLM only
......@@ -137,3 +136,4 @@ AMaxBT : 1
### DO NOT ADD ANYTHING BELOW THIS LINE ###
### DO NOT DELETE THE EMPTY LINE BELOW ###
......@@ -121,7 +121,6 @@ MTT : 1
EMT : 1
EMTFast : 1
Affine : 1
HighPrecMv : 1
SubPuMvp : 1
MaxNumMergeCand : 6
LMChroma : 1 # use CCLM only
......@@ -137,3 +136,4 @@ AMaxBT : 1
### DO NOT ADD ANYTHING BELOW THIS LINE ###
### DO NOT DELETE THE EMPTY LINE BELOW ###
......@@ -135,7 +135,6 @@ MTT : 1
EMT : 1
EMTFast : 1
Affine : 1
HighPrecMv : 1
SubPuMvp : 1
MaxNumMergeCand : 6
LMChroma : 1 # use CCLM only
......@@ -151,3 +150,4 @@ AMaxBT : 1
### DO NOT ADD ANYTHING BELOW THIS LINE ###
### DO NOT DELETE THE EMPTY LINE BELOW ###
......@@ -22,8 +22,7 @@ if( MSVC )
endif()
# add executable
add_executable( ${EXE_NAME} ${SRC_FILES} ${INC_FILES} ${NATVIS_FILES} ${CMAKE_CURRENT_BINARY_DIR}/svnheader.h )
# include the output directory, where the svnrevision.h file is generated
add_executable( ${EXE_NAME} ${SRC_FILES} ${INC_FILES} ${NATVIS_FILES} )
include_directories(${CMAKE_CURRENT_BINARY_DIR})
target_compile_definitions( ${EXE_NAME} PUBLIC RExt__DECODER_DEBUG_BIT_STATISTICS=1 )
target_compile_definitions( ${EXE_NAME} PUBLIC RExt__DECODER_DEBUG_TOOL_STATISTICS=1 )
......@@ -67,17 +66,6 @@ endif()
target_link_libraries( ${EXE_NAME} CommonAnalyserLib DecoderAnalyserLib Utilities Threads::Threads ${ADDITIONAL_LIBS} )
# Add a SVN revision generator
# a custom target that is always built
add_custom_target( DecAnalyserSvnHeader ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/svnheader.h )
# creates svnrevision.h using cmake script
add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/svnheader.h COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${CMAKE_SOURCE_DIR} -DGENERATE_DUMMY=${SKIP_SVN_REVISION} -P ${CMAKE_SOURCE_DIR}/cmake/modules/GetSVN.cmake )
# svnrevision.h is a generated file
set_source_files_properties( ${CMAKE_CURRENT_BINARY_DIR}/svnrevision.h PROPERTIES GENERATED TRUE HEADER_FILE_ONLY TRUE )
# explicitly say that the executable depends on the EncSvnHeader
add_dependencies( ${EXE_NAME} DecAnalyserSvnHeader )
# lldb custom data formatters
if( XCODE )
add_dependencies( ${EXE_NAME} Install${PROJECT_NAME}LldbFiles )
......@@ -100,4 +88,3 @@ source_group( "Natvis Files" FILES ${NATVIS_FILES} )
# set the folder where to place the projects
set_target_properties( ${EXE_NAME} PROPERTIES FOLDER app LINKER_LANGUAGE CXX )
set_target_properties( DecAnalyserSvnHeader PROPERTIES FOLDER svn )
......@@ -22,8 +22,7 @@ if( MSVC )
endif()
# add executable
add_executable( ${EXE_NAME} ${SRC_FILES} ${INC_FILES} ${NATVIS_FILES} ${CMAKE_CURRENT_BINARY_DIR}/svnheader.h )
# include the output directory, where the svnrevision.h file is generated
add_executable( ${EXE_NAME} ${SRC_FILES} ${INC_FILES} ${NATVIS_FILES} )
include_directories(${CMAKE_CURRENT_BINARY_DIR})
if( ENABLE_VTM )
......@@ -66,17 +65,6 @@ endif()
target_link_libraries( ${EXE_NAME} CommonLib DecoderLib Utilities Threads::Threads ${ADDITIONAL_LIBS} )
# Add a SVN revision generator
# a custom target that is always built
add_custom_target( DecSvnHeader ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/svnheader.h )
# creates svnrevision.h using cmake script
add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/svnheader.h COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${CMAKE_SOURCE_DIR} -DGENERATE_DUMMY=${SKIP_SVN_REVISION} -P ${CMAKE_SOURCE_DIR}/cmake/modules/GetSVN.cmake )
# svnrevision.h is a generated file
set_source_files_properties( ${CMAKE_CURRENT_BINARY_DIR}/svnrevision.h PROPERTIES GENERATED TRUE HEADER_FILE_ONLY TRUE )
# explicitly say that the executable depends on the EncSvnHeader
add_dependencies( ${EXE_NAME} DecSvnHeader )
# lldb custom data formatters
if( XCODE )
add_dependencies( ${EXE_NAME} Install${PROJECT_NAME}LldbFiles )
......@@ -99,4 +87,3 @@ source_group( "Natvis Files" FILES ${NATVIS_FILES} )
# set the folder where to place the projects
set_target_properties( ${EXE_NAME} PROPERTIES FOLDER app LINKER_LANGUAGE CXX )
set_target_properties( DecSvnHeader PROPERTIES FOLDER svn )
......@@ -41,8 +41,6 @@
#include "DecApp.h"
#include "program_options_lite.h"
#include "svnrevision.h"
//! \ingroup DecoderApp
//! \{
......@@ -56,11 +54,7 @@ int main(int argc, char* argv[])
// print information
fprintf( stdout, "\n" );
#ifdef SVNREVISION
fprintf( stdout, "VVCSoftware: VTM Decoder Version %s (%s@r%s) ", NEXT_SOFTWARE_VERSION, SVNRELATIVEURL, SVNREVISION /*NV_VERSION*/ );
#else
fprintf( stdout, "VVCSoftware: VTM Decoder Version %s ", NEXT_SOFTWARE_VERSION /*NV_VERSION*/ );
#endif
fprintf( stdout, "VVCSoftware: BMS Decoder Version %s ", NEXT_SOFTWARE_VERSION /*NV_VERSION*/ );
fprintf( stdout, NVM_ONOS );
fprintf( stdout, NVM_COMPILEDBY );
fprintf( stdout, NVM_BITS );
......
......@@ -24,8 +24,7 @@ if( MSVC )
endif()
# add executable
add_executable( ${EXE_NAME} ${SRC_FILES} ${INC_FILES} ${NATVIS_FILES} ${CMAKE_CURRENT_BINARY_DIR}/svnheader.h )
# include the output directory, where the svnrevision.h file is generated
add_executable( ${EXE_NAME} ${SRC_FILES} ${INC_FILES} ${NATVIS_FILES} )
include_directories(${CMAKE_CURRENT_BINARY_DIR})
if( ENABLE_VTM )
......@@ -71,17 +70,6 @@ if( EXTENSION_360_VIDEO )
target_link_libraries( ${EXE_NAME} Lib360 AppEncHelper360 )
endif()
# Add a SVN revision generator
# a custom target that is always built
add_custom_target( EncSvnHeader ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/svnheader.h )
# creates svnrevision.h using cmake script
add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/svnheader.h COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${CMAKE_SOURCE_DIR} -DGENERATE_DUMMY=${SKIP_SVN_REVISION} -P ${CMAKE_SOURCE_DIR}/cmake/modules/GetSVN.cmake )
# svnrevision.h is a generated file
set_source_files_properties( ${CMAKE_CURRENT_BINARY_DIR}/svnrevision.h PROPERTIES GENERATED TRUE HEADER_FILE_ONLY TRUE )
# explicitly say that the executable depends on the EncSvnHeader
add_dependencies( ${EXE_NAME} EncSvnHeader )
# lldb custom data formatters
if( XCODE )
add_dependencies( ${EXE_NAME} Install${PROJECT_NAME}LldbFiles )
......@@ -104,5 +92,4 @@ source_group( "Natvis Files" FILES ${NATVIS_FILES} )
# set the folder where to place the projects
set_target_properties( ${EXE_NAME} PROPERTIES FOLDER app LINKER_LANGUAGE CXX )
set_target_properties( EncSvnHeader PROPERTIES FOLDER svn )
......@@ -231,7 +231,7 @@ void EncApp::xInitLibCfg()
m_cEncLib.setAffineType ( m_AffineType );
#endif
#endif
#if JVET_K0346 || JVET_K_AFFINE
#if (JVET_K0346 || JVET_K_AFFINE) && !REMOVE_MV_ADAPT_PREC
m_cEncLib.setHighPrecisionMv (m_highPrecisionMv);
#endif
m_cEncLib.setDisableMotionCompression ( m_DisableMotionCompression );
......
......@@ -813,10 +813,14 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
("SubPuMvp", m_SubPuMvpMode, 0, "Enable Sub-PU temporal motion vector prediction (0:off, 1:on) [default: off]")
#endif
("SubPuMvpLog2Size", m_SubPuMvpLog2Size, 2u, "Sub-PU TMVP size index: 2^n")
("HighPrecMv", m_highPrecisionMv, false, "High precision motion vectors for temporal merging (0:off, 1:on) [default: off]")
#if !REMOVE_MV_ADAPT_PREC
("HighPrecMv", m_highPrecisionMv, false, "High precision motion vectors for temporal merging (0:off, 1:on) [default: off]")
#endif
#endif
#if JVET_K_AFFINE
("HighPrecMv", m_highPrecisionMv, false, "High precision motion vectors for temporal merging (0:off, 1:on) [default: off]")
#if !REMOVE_MV_ADAPT_PREC
("HighPrecMv", m_highPrecisionMv, false, "High precision motion vectors for temporal merging (0:off, 1:on) [default: off]")
#endif
("Affine", m_Affine, false, "Enable affine prediction (0:off, 1:on) [default: off]")
#if JVET_K0337_AFFINE_6PARA
( "AffineType", m_AffineType, true, "Enable affine type prediction (0:off, 1:on) [default: on]" )
......@@ -1935,11 +1939,11 @@ bool EncAppCfg::xCheckParameter()
#if JVET_K0346
xConfirmPara( m_SubPuMvpMode != 0, "Sub-PU motion vector prediction is only allowed with NEXT profile" );
#endif
#if JVET_K_AFFINE
#if JVET_K_AFFINE && !REMOVE_MV_ADAPT_PREC
xConfirmPara( m_highPrecisionMv, "High precision MV for temporal merging can only be used with NEXT profile" );
xConfirmPara( m_Affine, "Affine is only allowed with NEXT profile" );
#endif
#if JVET_K0346 && !JVET_K_AFFINE
#if JVET_K0346 && !JVET_K_AFFINE && !REMOVE_MV_ADAPT_PREC
xConfirmPara(m_highPrecisionMv, "High precision MV for temporal merging can only be used with NEXT profile");
#endif
xConfirmPara( m_DisableMotionCompression, "Disable motion data compression only allowed with NEXT profile" );
......@@ -1992,7 +1996,9 @@ bool EncAppCfg::xCheckParameter()
#endif
#if JVET_K_AFFINE
xConfirmPara( m_Affine && !m_highPrecisionMv, "Affine is not yet implemented for HighPrecMv off." );
#if !REMOVE_MV_ADAPT_PREC
xConfirmPara(m_Affine && !m_highPrecisionMv, "Affine is not yet implemented for HighPrecMv off.");
#endif
#endif
}
......@@ -3208,7 +3214,9 @@ void EncAppCfg::xPrintParameter()
#else
#endif
#if JVET_K0346 || JVET_K_AFFINE
#if !REMOVE_MV_ADAPT_PREC
msg(VERBOSE, "HighPrecMv:%d ", m_highPrecisionMv);
#endif
#endif
msg( VERBOSE, "DisMDC:%d ", m_DisableMotionCompression );
msg( VERBOSE, "MTT:%d ", m_MTT );
......
......@@ -214,7 +214,7 @@ protected:
bool m_AffineType;
#endif
#endif
#if JVET_K0346 || JVET_K_AFFINE
#if (JVET_K0346 || JVET_K_AFFINE) && !REMOVE_MV_ADAPT_PREC
bool m_highPrecisionMv;
#endif
bool m_DisableMotionCompression;
......
......@@ -43,8 +43,6 @@
#include "EncApp.h"
#include "Utilities/program_options_lite.h"
#include "svnrevision.h"
//! \ingroup EncoderApp
//! \{
......@@ -86,11 +84,7 @@ int main(int argc, char* argv[])
{
// print information
fprintf( stdout, "\n" );
#ifdef SVNREVISION
fprintf( stdout, "VVCSoftware: VTM Encoder Version %s (%s@r%s) ", NEXT_SOFTWARE_VERSION, SVNRELATIVEURL, SVNREVISION /*NV_VERSION*/ );
#else
fprintf( stdout, "VVCSoftware: VTM Encoder Version %s ", NEXT_SOFTWARE_VERSION /*NV_VERSION*/ );
#endif
fprintf( stdout, "VVCSoftware: BMS Encoder Version %s ", NEXT_SOFTWARE_VERSION /*NV_VERSION*/ );
fprintf( stdout, NVM_ONOS );
fprintf( stdout, NVM_COMPILEDBY );
fprintf( stdout, NVM_BITS );
......
......@@ -22,8 +22,7 @@ if( MSVC )
endif()
# add executable
add_executable( ${EXE_NAME} ${SRC_FILES} ${INC_FILES} ${NATVIS_FILES} ${CMAKE_CURRENT_BINARY_DIR}/svnheader.h )
# include the output directory, where the svnrevision.h file is generated
add_executable( ${EXE_NAME} ${SRC_FILES} ${INC_FILES} ${NATVIS_FILES} )
include_directories(${CMAKE_CURRENT_BINARY_DIR})
if( SET_ENABLE_TRACING )
......@@ -61,17 +60,6 @@ endif()
target_link_libraries( ${EXE_NAME} CommonLib DecoderLib Utilities Threads::Threads ${ADDITIONAL_LIBS} )
# Add a SVN revision generator
# a custom target that is always built
add_custom_target( SeiRemovalSvnHeader ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/svnheader.h )
# creates svnrevision.h using cmake script
add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/svnheader.h COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${CMAKE_SOURCE_DIR} -DGENERATE_DUMMY=${SKIP_SVN_REVISION} -P ${CMAKE_SOURCE_DIR}/cmake/modules/GetSVN.cmake )
# svnrevision.h is a generated file
set_source_files_properties( ${CMAKE_CURRENT_BINARY_DIR}/svnrevision.h PROPERTIES GENERATED TRUE HEADER_FILE_ONLY TRUE )
# explicitly say that the executable depends on the EncSvnHeader
add_dependencies( ${EXE_NAME} SeiRemovalSvnHeader )
# lldb custom data formatters
if( XCODE )
add_dependencies( ${EXE_NAME} Install${PROJECT_NAME}LldbFiles )
......@@ -94,4 +82,3 @@ source_group( "Natvis Files" FILES ${NATVIS_FILES} )
# set the folder where to place the projects
set_target_properties( ${EXE_NAME} PROPERTIES FOLDER app LINKER_LANGUAGE CXX )
set_target_properties( SeiRemovalSvnHeader PROPERTIES FOLDER svn )
......@@ -41,8 +41,6 @@
#include "SEIRemovalApp.h"
#include "program_options_lite.h"
#include "svnrevision.h"
//! \ingroup DecoderApp
//! \{
......@@ -56,11 +54,7 @@ int main(int argc, char* argv[])
// print information
fprintf( stdout, "\n" );
#ifdef SVNREVISION
fprintf( stdout, "VVCSoftware: VTM Decoder Version %s (%s@r%s) ", NEXT_SOFTWARE_VERSION, SVNRELATIVEURL, SVNREVISION /*NV_VERSION*/ );
#else
fprintf( stdout, "VVCSoftware: VTM Decoder Version %s ", NEXT_SOFTWARE_VERSION /*NV_VERSION*/ );
#endif
fprintf( stdout, "VVCSoftware: BMS Decoder Version %s ", NEXT_SOFTWARE_VERSION /*NV_VERSION*/ );
fprintf( stdout, NVM_ONOS );
fprintf( stdout, NVM_COMPILEDBY );
fprintf( stdout, NVM_BITS );
......
......@@ -557,9 +557,7 @@ cTUTraverser CodingStructure::traverseTUs( const UnitArea& unit, const ChannelTy
void CodingStructure::allocateVectorsAtPicLevel()
{
const int twice = (
!pcv->ISingleTree && slice->isIntra()
&& pcv->chrFormat != CHROMA_400 ) ? 2 : 1;
const int twice = ( !pcv->ISingleTree && slice->isIRAP() && pcv->chrFormat != CHROMA_400 ) ? 2 : 1;
size_t allocSize = twice * unitScale[0].scale( area.blocks[0].size() ).area();
cus.reserve( allocSize );
......
......@@ -487,12 +487,15 @@ void InterPrediction::xPredInterBlk ( const ComponentID& compID, const Predictio
int iAddPrecShift = 0;
#if !REMOVE_MV_ADAPT_PREC
if (_mv.highPrec)
{
CHECKD(!pu.cs->sps->getSpsNext().getUseHighPrecMv(), "Found a high-precision motion vector, but the high-precision MV extension is disabled!");
#endif
iAddPrecShift = VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE;
#if !REMOVE_MV_ADAPT_PREC
}
#endif
int shiftHor = 2 + iAddPrecShift + ::getComponentScaleX(compID, chFmt);
int shiftVer = 2 + iAddPrecShift + ::getComponentScaleY(compID, chFmt);
......@@ -502,9 +505,10 @@ void InterPrediction::xPredInterBlk ( const ComponentID& compID, const Predictio
xFrac <<= VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE - iAddPrecShift;
yFrac <<= VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE - iAddPrecShift;
#if !REMOVE_MV_ADAPT_PREC
CHECKD(!pu.cs->sps->getSpsNext().getUseHighPrecMv() && ((xFrac & 3) != 0), "Invalid fraction");
CHECKD(!pu.cs->sps->getSpsNext().getUseHighPrecMv() && ((yFrac & 3) != 0), "Invalid fraction");
#endif
#else
const ChromaFormat chFmt = pu.chromaFormat;
const bool rndRes = !bi;
......@@ -576,9 +580,11 @@ void InterPrediction::xPredAffineBlk( const ComponentID& compID, const Predictio
Mv mvRT =_mv[1];
Mv mvLB =_mv[2];
#if !REMOVE_MV_ADAPT_PREC
mvLT.setHighPrec();
mvRT.setHighPrec();
mvLB.setHighPrec();
#endif
// get affine sub-block width and height
const int width = pu.Y().width;
......
......@@ -467,14 +467,18 @@ unsigned LoopFilter::xGetBoundaryStrengthSingle ( const CodingUnit& cu, const De
int nThreshold = 4;
#if JVET_K0346 || JVET_K_AFFINE
if( cu.cs->sps->getSpsNext().getUseHighPrecMv() )
#if !REMOVE_MV_ADAPT_PREC
if (cu.cs->sps->getSpsNext().getUseHighPrecMv())
{
mvP0.setHighPrec();
mvP1.setHighPrec();
mvQ0.setHighPrec();
mvQ1.setHighPrec();
#endif
nThreshold = 4 << VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE;
}
#if !REMOVE_MV_ADAPT_PREC
}
#endif
#endif
unsigned uiBs = 0;
......@@ -530,12 +534,16 @@ unsigned LoopFilter::xGetBoundaryStrengthSingle ( const CodingUnit& cu, const De
int nThreshold = 4;
#if JVET_K0346 || JVET_K_AFFINE
if( cu.cs->sps->getSpsNext().getUseHighPrecMv() )
#if !REMOVE_MV_ADAPT_PREC
if (cu.cs->sps->getSpsNext().getUseHighPrecMv())
{
mvP0.setHighPrec();
mvQ0.setHighPrec();
#endif
nThreshold = 4 << VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE;
#if !REMOVE_MV_ADAPT_PREC
}
#endif
#endif
return ( ( abs( mvQ0.getHor() - mvP0.getHor() ) >= nThreshold ) || ( abs( mvQ0.getVer() - mvP0.getVer() ) >= nThreshold ) ) ? 1 : 0;
}
......
......@@ -44,7 +44,9 @@
void roundMV( Mv & rMV, unsigned imvShift )
{
CHECK( imvShift == 0, "roundMV called for imvShift=0" );
if( rMV.highPrec ) imvShift += VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE;
#if !REMOVE_MV_ADAPT_PREC
if (rMV.highPrec) imvShift += VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE;
#endif
int offset = 1 << ( imvShift - 1 );
rMV.setHor( ( ( rMV.getHor() + offset ) >> imvShift ) << imvShift );
......@@ -63,10 +65,13 @@ void roundAffineMv( int& mvx, int& mvy, int nShift )
void clipMv( Mv& rcMv, const Position& pos, const SPS& sps )
{
#if JVET_K0346 || JVET_K_AFFINE
int iMvShift = 2 + ( rcMv.highPrec ? VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE : 0 );
#if ( JVET_K0346 || JVET_K_AFFINE) && !REMOVE_MV_ADAPT_PREC
int iMvShift = 2 + (rcMv.highPrec ? VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE : 0);
#else
int iMvShift = 2;
#endif
#if REMOVE_MV_ADAPT_PREC
iMvShift += VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE;
#endif
int iOffset = 8;
int iHorMax = ( sps.getPicWidthInLumaSamples() + iOffset - ( int ) pos.x - 1 ) << iMvShift;
......
......@@ -53,7 +53,7 @@ class Mv
public:
int hor; ///< horizontal component of motion vector
int ver; ///< vertical component of motion vector
#if JVET_K0346 || JVET_K_AFFINE
#if ( JVET_K0346 || JVET_K_AFFINE) && !REMOVE_MV_ADAPT_PREC
bool highPrec;///< true if the vector is high precision
#endif
......@@ -61,7 +61,7 @@ public:
// constructors
// ------------------------------------------------------------------------------------------------------------------
#if JVET_K0346 || JVET_K_AFFINE
#if ( JVET_K0346 || JVET_K_AFFINE) && !REMOVE_MV_ADAPT_PREC
Mv( ) : hor( 0 ), ver( 0 ), highPrec( false ) {}
Mv( int iHor, int iVer, bool _highPrec = false ) : hor( iHor ), ver( iVer ), highPrec( _highPrec ) {}
#else
......@@ -93,7 +93,7 @@ public:
const Mv& operator += (const Mv& _rcMv)
{
#if JVET_K0346 || JVET_K_AFFINE
#if ( JVET_K0346 || JVET_K_AFFINE) && !REMOVE_MV_ADAPT_PREC
if( highPrec == _rcMv.highPrec )
{
hor += _rcMv.hor;
......@@ -104,7 +104,7 @@ public:
{
Mv rcMv = _rcMv;
#if JVET_K0346 || JVET_K_AFFINE
#if ( JVET_K0346 || JVET_K_AFFINE) && !REMOVE_MV_ADAPT_PREC
if( highPrec && !rcMv.highPrec ) rcMv.setHighPrec();
if( !highPrec && rcMv.highPrec ) setHighPrec();
#endif
......@@ -116,7 +116,7 @@ public:
const Mv& operator-= (const Mv& _rcMv)
{
#if JVET_K0346 || JVET_K_AFFINE
#if ( JVET_K0346 || JVET_K_AFFINE) && !REMOVE_MV_ADAPT_PREC
if( highPrec == _rcMv.highPrec )
{
hor -= _rcMv.hor;
......@@ -127,7 +127,7 @@ public:
{
Mv rcMv = _rcMv;
#if JVET_K0346 || JVET_K_AFFINE
#if ( JVET_K0346 || JVET_K_AFFINE) && !REMOVE_MV_ADAPT_PREC
if( highPrec && !rcMv.highPrec ) rcMv.setHighPrec();
if( !highPrec && rcMv.highPrec ) setHighPrec();
#endif
......@@ -166,7 +166,7 @@ public:
const Mv operator - ( const Mv& rcMv ) const
{
#if JVET_K0346 || JVET_K_AFFINE
#if ( JVET_K0346 || JVET_K_AFFINE) && !REMOVE_MV_ADAPT_PREC
if( rcMv.highPrec == highPrec )
{
return Mv( hor - rcMv.hor, ver - rcMv.ver, highPrec );
......@@ -185,7 +185,7 @@ public:
const Mv operator + ( const Mv& rcMv ) const
{
#if JVET_K0346 || JVET_K_AFFINE
#if ( JVET_K0346 || JVET_K_AFFINE) && !REMOVE_MV_ADAPT_PREC
if( rcMv.highPrec == highPrec )
{
return Mv( hor + rcMv.hor, ver + rcMv.ver, highPrec );
......@@ -204,7 +204,7 @@ public:
bool operator== ( const Mv& rcMv ) const
{
#if JVET_K0346 || JVET_K_AFFINE
#if ( JVET_K0346 || JVET_K_AFFINE) && !REMOVE_MV_ADAPT_PREC
if( rcMv.highPrec == highPrec )
{
return ( hor == rcMv.hor && ver == rcMv.ver );
......@@ -231,7 +231,7 @@ public:
{
const int mvx = Clip3( -32768, 32767, (iScale * getHor() + 127 + (iScale * getHor() < 0)) >> 8 );
const int mvy = Clip3( -32768, 32767, (iScale * getVer() + 127 + (iScale * getVer() < 0)) >> 8 );
#if JVET_K0346 || JVET_K_AFFINE
#if ( JVET_K0346 || JVET_K_AFFINE) && !REMOVE_MV_ADAPT_PREC
return Mv( mvx, mvy, highPrec );
#else
return Mv( mvx, mvy );
......@@ -241,11 +241,20 @@ public:
#if JVET_K0346 || JVET_K_AFFINE
void roundMV2SignalPrecision()
{
#if REMOVE_MV_ADAPT_PREC
const int nShift = VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE;
const int nOffset = 1 << (nShift - 1);
hor = hor >= 0 ? (hor + nOffset) >> nShift : -((-hor + nOffset) >> nShift);
ver = ver >= 0 ? (ver + nOffset) >> nShift : -((-ver + nOffset) >> nShift);
hor = hor >= 0 ? (hor) << VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE : -((-hor) << VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE);
ver = ver >= 0 ? (ver) << VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE : -((-ver) << VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE);
#else
const bool isHP = highPrec;
setLowPrec();
if( isHP ) setHighPrec();
#endif
}
#if !REMOVE_MV_ADAPT_PREC
void setLowPrec()
{
if( !highPrec ) return;
......@@ -264,6 +273,7 @@ public:
highPrec = true;
}
#endif
#endif
};// END CLASS DEFINITION MV
#if JVET_K0357_AMVR
void roundMV( Mv& rcMv, unsigned imvShift );
......
......@@ -793,8 +793,7 @@ void Quant::quant(TransformUnit &tu, const ComponentID &compID, const CCoeffBuf
const int iQBits = QUANT_SHIFT + cQP.per + iTransformShift;
// QBits will be OK for any internal bit depth as the reduction in transform shift is balanced by an increase in Qp_per due to QpBDOffset
const int64_t iAdd = int64_t(tu.cs->slice->getSliceType() == I_SLICE
? 171 : 85) << int64_t(iQBits - 9);
const int64_t iAdd = int64_t(tu.cs->slice->isIRAP() ? 171 : 85) << int64_t(iQBits - 9);
#if HEVC_USE_SIGN_HIDING
const int qBits8 = iQBits - 8;
#endif
......
......@@ -161,7 +161,7 @@ public:
void setPredictor ( const Mv& rcMv )
{
m_mvPredictor = rcMv;
#if JVET_K0346 || JVET_K_AFFINE
#if ( JVET_K0346 || JVET_K_AFFINE) && !REMOVE_MV_ADAPT_PREC
if( m_mvPredictor.highPrec )
{
m_mvPredictor = Mv( m_mvPredictor.hor >> VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE, m_mvPredictor.ver >> VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE, false );
......
......@@ -1658,7 +1658,9 @@ SPSNext::SPSNext( SPS& sps )
#else
#endif
#if JVET_K0346 || JVET_K_AFFINE
#if !REMOVE_MV_ADAPT_PREC