Commit 0f747e97 authored by xiuxx's avatar xiuxx

Merge branch 'master' of...

Merge branch 'master' of https://vcgit.hhi.fraunhofer.de/jamesxxiu/VVCSoftware_VTM into JVET_L0256_BIO

# Conflicts:
#	source/Lib/CommonLib/CommonDef.h
parents fe28cdb0 66ab3812
......@@ -30,7 +30,6 @@ endif()
set( EXTENSION_360_VIDEO OFF CACHE BOOL "If EXTENSION_360_VIDEO is on, 360Lib will be added" )
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" )
if( CMAKE_COMPILER_IS_GNUCC )
set( BUILD_STATIC OFF CACHE BOOL "Build static executables" )
......
......@@ -63,10 +63,6 @@ ifneq ($(verbose),)
CMAKE_OPTIONS += -DCMAKE_VERBOSE_MAKEFILE=ON
endif
ifneq ($(enable-vtm),)
CMAKE_OPTIONS += -DENABLE_VTM=ON
endif
ifneq ($(enable-tracing),)
CONFIG_OPTIONS += -DSET_ENABLE_TRACING=ON -DENABLE_TRACING=$(enable-tracing)
endif
......
......@@ -27,10 +27,6 @@ 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 )
if( ENABLE_VTM )
target_compile_definitions( ${EXE_NAME} PUBLIC BMS_TOOLS=0 )
endif()
if( SET_ENABLE_TRACING )
if( ENABLE_TRACING )
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_TRACING=1 )
......
......@@ -25,11 +25,6 @@ endif()
add_executable( ${EXE_NAME} ${SRC_FILES} ${INC_FILES} ${NATVIS_FILES} )
include_directories(${CMAKE_CURRENT_BINARY_DIR})
if( ENABLE_VTM )
target_compile_definitions( ${EXE_NAME} PUBLIC BMS_TOOLS=0 )
endif()
if( SET_ENABLE_TRACING )
if( ENABLE_TRACING )
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_TRACING=1 )
......
......@@ -54,7 +54,7 @@ int main(int argc, char* argv[])
// print information
fprintf( stdout, "\n" );
fprintf( stdout, "VVCSoftware: BMS Decoder Version %s ", NEXT_SOFTWARE_VERSION /*NV_VERSION*/ );
fprintf( stdout, "VVCSoftware: VTM Decoder Version %s ", NEXT_SOFTWARE_VERSION /*NV_VERSION*/ );
fprintf( stdout, NVM_ONOS );
fprintf( stdout, NVM_COMPILEDBY );
fprintf( stdout, NVM_BITS );
......
......@@ -27,10 +27,6 @@ endif()
add_executable( ${EXE_NAME} ${SRC_FILES} ${INC_FILES} ${NATVIS_FILES} )
include_directories(${CMAKE_CURRENT_BINARY_DIR})
if( ENABLE_VTM )
target_compile_definitions( ${EXE_NAME} PUBLIC BMS_TOOLS=0 )
endif()
if( SET_ENABLE_TRACING )
if( ENABLE_TRACING )
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_TRACING=1 )
......
......@@ -213,6 +213,9 @@ void EncApp::xInitLibCfg()
m_cEncLib.setRDpenalty ( m_rdPenalty );
m_cEncLib.setQTBT ( m_QTBT );
m_cEncLib.setCTUSize ( m_uiCTUSize );
#if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT
m_cEncLib.setUseSplitConsOverride ( m_SplitConsOverrideEnabledFlag );
#endif
m_cEncLib.setMinQTSizes ( m_uiMinQT );
m_cEncLib.setMaxBTDepth ( m_uiMaxBTDepth, m_uiMaxBTDepthI, m_uiMaxBTDepthIChroma );
m_cEncLib.setDualITree ( m_dualTree );
......@@ -245,6 +248,18 @@ void EncApp::xInitLibCfg()
#if JVET_L0646_GBI
m_cEncLib.setUseGBi ( m_GBi );
m_cEncLib.setUseGBiFast ( m_GBiFast );
#endif
#if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET
m_cEncLib.setUseLadf ( m_LadfEnabed );
if ( m_LadfEnabed )
{
m_cEncLib.setLadfNumIntervals ( m_LadfNumIntervals);
for ( int k = 0; k < m_LadfNumIntervals; k++ )
{
m_cEncLib.setLadfQpOffset( m_LadfQpOffset[k], k );
m_cEncLib.setLadfIntervalLowerBound(m_LadfIntervalLowerBound[k], k);
}
}
#endif
// ADD_NEW_TOOL : (encoder app) add setting of tool enabling flags and associated parameters here
......
......@@ -699,6 +699,12 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
SMultiValueInput<bool> cfg_timeCodeSeiHoursFlag (0, 1, 0, MAX_TIMECODE_SEI_SETS);
SMultiValueInput<int> cfg_timeCodeSeiTimeOffsetLength (0, 31, 0, MAX_TIMECODE_SEI_SETS);
SMultiValueInput<int> cfg_timeCodeSeiTimeOffsetValue (std::numeric_limits<int>::min(), std::numeric_limits<int>::max(), 0, MAX_TIMECODE_SEI_SETS);
#if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET
const int defaultLadfQpOffset[3] = { 1, 0, 1 };
const int defaultLadfIntervalLowerBound[2] = { 350, 833 };
SMultiValueInput<int> cfg_LadfQpOffset ( -MAX_QP, MAX_QP, 2, MAX_LADF_INTERVALS, defaultLadfQpOffset, 3 );
SMultiValueInput<int> cfg_LadfIntervalLowerBound ( 0, std::numeric_limits<int>::max(), 1, MAX_LADF_INTERVALS - 1, defaultLadfIntervalLowerBound, 2 );
#endif
int warnUnknowParameter = 0;
#if ENABLE_TRACING
......@@ -796,6 +802,9 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
("QTBT", m_QTBT, false, "Enable QTBT (0:off, 1:on) [default: off]")
("MTT", m_MTT, 0u, "Multi type tree type (0: off, 1:QTBT + triple split) [default: 0]")
("CTUSize", m_uiCTUSize, 128u, "CTUSize (specifies the CTU size if QTBT is on) [default: 128]")
#if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT
("EnablePartitionConstraintsOverride", m_SplitConsOverrideEnabledFlag, true, "Enable partition constraints override")
#endif
("MinQTISlice", m_uiMinQT[0], 8u, "MinQTISlice")
("MinQTLumaISlice", m_uiMinQT[0], 8u, "MinQTLumaISlice")
("MinQTChromaISlice", m_uiMinQT[2], 4u, "MinQTChromaISlice")
......@@ -850,6 +859,12 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
#if JVET_L0646_GBI
("GBi", m_GBi, false, "Enable Generalized Bi-prediction(GBi)")
("GBiFast", m_GBiFast, false, "Fast methods for Generalized Bi-prediction(GBi)\n")
#endif
#if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET
("LADF", m_LadfEnabed, false, "Luma adaptive deblocking filter QP Offset(L0414)")
("LadfNumIntervals", m_LadfNumIntervals, 3, "LADF number of intervals (2-5, inclusive)")
("LadfQpOffset", cfg_LadfQpOffset, cfg_LadfQpOffset, "LADF QP offset")
("LadfIntervalLowerBound", cfg_LadfIntervalLowerBound, cfg_LadfIntervalLowerBound, "LADF lower bound for 2nd lowest interval")
#endif
// ADD_NEW_TOOL : (encoder app) add parsing parameters here
......@@ -1686,6 +1701,19 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
}
#endif
#if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET
if ( m_LadfEnabed )
{
CHECK( m_LadfNumIntervals != cfg_LadfQpOffset.values.size(), "size of LadfQpOffset must be equal to LadfNumIntervals");
CHECK( m_LadfNumIntervals - 1 != cfg_LadfIntervalLowerBound.values.size(), "size of LadfIntervalLowerBound must be equal to LadfNumIntervals - 1");
m_LadfQpOffset = cfg_LadfQpOffset.values;
for (int k = 1; k < m_LadfNumIntervals; k++)
{
m_LadfIntervalLowerBound[k] = cfg_LadfIntervalLowerBound.values[k - 1];
}
}
#endif
// reading external dQP description from file
if ( !m_dQPFileName.empty() )
{
......@@ -1835,7 +1863,9 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
m_uiLog2DiffMaxMinCodingBlockSize = m_uiMaxCodingDepth;
m_uiMaxCUWidth = m_uiMaxCUHeight = m_uiCTUSize;
m_uiMaxCUDepth = m_uiMaxCodingDepth;
#if !JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT
m_uiLog2DiffMaxMinCodingBlockSize = m_uiMaxCUDepth - 1;
#endif
}
// check validity of input parameters
......@@ -1993,6 +2023,9 @@ bool EncAppCfg::xCheckParameter()
#endif
#if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT
xConfirmPara( m_useAMaxBT && !m_SplitConsOverrideEnabledFlag, "AMaxBt can only be used with PartitionConstriantsOverride enabled" );
#endif
xConfirmPara( m_useAMaxBT && !m_QTBT, "AMaxBT can only be used with QTBT!" );
......@@ -3131,6 +3164,9 @@ void EncAppCfg::xPrintParameter()
#if JVET_L0646_GBI
msg( VERBOSE, "GBi:%d ", m_GBi );
msg( VERBOSE, "GBiFast:%d ", m_GBiFast );
#endif
#if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET
msg( VERBOSE, "LADF:%d ", m_LadfEnabed );
#endif
}
// ADD_NEW_TOOL (add some output indicating the usage of tools)
......
......@@ -198,6 +198,9 @@ protected:
// coding unit (CU) definition
bool m_QTBT;
unsigned m_uiCTUSize;
#if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT
bool m_SplitConsOverrideEnabledFlag;
#endif
unsigned m_uiMinQT[3]; // 0: I slice luma; 1: P/B slice; 2: I slice chroma
unsigned m_uiMaxBTDepth;
unsigned m_uiMaxBTDepthI;
......@@ -227,6 +230,12 @@ protected:
#if JVET_L0646_GBI
bool m_GBi;
bool m_GBiFast;
#endif
#if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET
bool m_LadfEnabed;
int m_LadfNumIntervals;
std::vector<int> m_LadfQpOffset;
int m_LadfIntervalLowerBound[MAX_LADF_INTERVALS];
#endif
// ADD_NEW_TOOL : (encoder app) add tool enabling flags and associated parameters here
......
......@@ -84,7 +84,7 @@ int main(int argc, char* argv[])
{
// print information
fprintf( stdout, "\n" );
fprintf( stdout, "VVCSoftware: BMS Encoder Version %s ", NEXT_SOFTWARE_VERSION /*NV_VERSION*/ );
fprintf( stdout, "VVCSoftware: VTM Encoder Version %s ", NEXT_SOFTWARE_VERSION /*NV_VERSION*/ );
fprintf( stdout, NVM_ONOS );
fprintf( stdout, NVM_COMPILEDBY );
fprintf( stdout, NVM_BITS );
......
......@@ -54,7 +54,7 @@ int main(int argc, char* argv[])
// print information
fprintf( stdout, "\n" );
fprintf( stdout, "VVCSoftware: BMS Decoder Version %s ", NEXT_SOFTWARE_VERSION /*NV_VERSION*/ );
fprintf( stdout, "VVCSoftware: VTM Decoder Version %s ", NEXT_SOFTWARE_VERSION /*NV_VERSION*/ );
fprintf( stdout, NVM_ONOS );
fprintf( stdout, NVM_COMPILEDBY );
fprintf( stdout, NVM_BITS );
......
......@@ -48,10 +48,6 @@ set( INC_FILES ${BASE_INC_FILES} ${X86_INC_FILES} ${MD5_INC_FILES} )
add_library( ${LIB_NAME} STATIC ${SRC_FILES} ${INC_FILES} ${NATVIS_FILES} )
target_compile_definitions( ${LIB_NAME} PUBLIC RExt__DECODER_DEBUG_TOOL_STATISTICS=1 )
if( ENABLE_VTM )
target_compile_definitions( ${LIB_NAME} PUBLIC BMS_TOOLS=0 )
endif()
if( EXTENSION_360_VIDEO )
target_compile_definitions( ${LIB_NAME} PUBLIC EXTENSION_360_VIDEO=1 )
endif()
......
......@@ -47,10 +47,6 @@ set( INC_FILES ${BASE_INC_FILES} ${X86_INC_FILES} ${MD5_INC_FILES} )
# library
add_library( ${LIB_NAME} STATIC ${SRC_FILES} ${INC_FILES} ${NATVIS_FILES} )
if( ENABLE_VTM )
target_compile_definitions( ${LIB_NAME} PUBLIC BMS_TOOLS=0 )
endif()
if( EXTENSION_360_VIDEO )
target_compile_definitions( ${LIB_NAME} PUBLIC EXTENSION_360_VIDEO=1 )
endif()
......
......@@ -258,6 +258,9 @@ static const int MAX_TU_SIZE = 128;
static const int MAX_LOG2_TU_SIZE_PLUS_ONE = 8; ///< log2(MAX_TU_SIZE) + 1
static const int MAX_NUM_PARTS_IN_CTU = ( ( MAX_CU_SIZE * MAX_CU_SIZE ) >> ( MIN_CU_LOG2 << 1 ) );
static const int MAX_TR_SIZE = MAX_CU_SIZE;
#if JVET_L0081_VPDU_SPLIT_CONSTRAINTS
static const int MAX_TU_SIZE_FOR_PROFILE = 64;
#endif
#if ENABLE_BMS
static const int MAX_LOG2_DIFF_CU_TR_SIZE = 2;
static const int MAX_CU_TILING_PARTITIONS = 1 << ( MAX_LOG2_DIFF_CU_TR_SIZE << 1 );
......@@ -291,6 +294,16 @@ static const int AFFINE_MAX_NUM_V2 = 2; ///< max
static const int AFFINE_MAX_NUM_COMB = 12; ///< max number of combined motion candidates
static const int AFFINE_MIN_BLOCK_SIZE = 4; ///< Minimum affine MC block size
#if JVET_L0054_MMVD
static const int MMVD_REFINE_STEP = 8; ///< max number of distance step
static const int MMVD_MAX_REFINE_NUM = (MMVD_REFINE_STEP * 4); ///< max number of candidate from a base candidate
static const int MMVD_BASE_MV_NUM = 2; ///< max number of base candidate
static const int MMVD_ADD_NUM = (MMVD_MAX_REFINE_NUM * MMVD_BASE_MV_NUM);///< total number of mmvd candidate
static const int MMVD_MRG_MAX_RD_NUM = MRG_MAX_NUM_CANDS;
static const int MMVD_MRG_MAX_RD_BUF_NUM = (MMVD_MRG_MAX_RD_NUM + 1);///< increase buffer size by 1
#endif
#if JVET_L0274
static const int MAX_NUM_REG_BINS_4x4SUBBLOCK = 32; ///< max number of context-coded bins (incl. gt2 bins) per 4x4 subblock
static const int MAX_NUM_GT2_BINS_4x4SUBBLOCK = 4; ///< max number of gt2 bins per 4x4 subblock
......@@ -308,6 +321,10 @@ static const int GBI_NUM = 5; ///< the
static const int GBI_DEFAULT = ((uint8_t)(GBI_NUM >> 1)); ///< Default weighting index representing for w=0.5
static const int GBI_SIZE_CONSTRAINT = 256; ///< disabling GBi if cu size is smaller than 256
#endif
#if JVET_L0266_HMVP
static const int MAX_NUM_HMVP_CANDS = 6; ///< maximum number of HMVP candidates to be stored and used in merge list
static const int MAX_NUM_HMVP_AVMPCANDS = 4; ///< maximum number of HMVP candidates to be used in AMVP list
#endif
#if W0038_DB_OPT
static const int MAX_ENCODER_DEBLOCKING_QUALITY_LAYERS = 8 ;
......@@ -361,7 +378,11 @@ static const double AMAXBT_TH64 = 30.0;
static const int MAX_DELTA_QP = 7; ///< maximum supported delta QP value
static const int MAX_TESTED_QPs = ( 1 + 1 + ( MAX_DELTA_QP << 1 ) ); ///< dqp=0 +- max_delta_qp + lossless mode
#if JVET_L0285_8BIT_TRANSFORM_CORE
static const int COM16_C806_TRANS_PREC = 0;
#else
static const int COM16_C806_TRANS_PREC = 2;
#endif
static const int NUM_MERGE_IDX_EXT_CTX = 5;
static const unsigned E0104_ALF_MAX_TEMPLAYERID = 5; // define to zero to switch of code
......@@ -370,6 +391,10 @@ static const unsigned C806_ALF_TEMPPRED_NUM = 6;
static const int NTAPS_LUMA = 8; ///< Number of taps for luma
static const int NTAPS_CHROMA = 4; ///< Number of taps for chroma
#if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET
static const int MAX_LADF_INTERVALS = 5; /// max number of luma adaptive deblocking filter qp offset intervals
#endif
#if JVET_L0256_BIO
static const int NTAPS_BILINEAR = 2; ///< Number of taps for bilinear filter
#endif
......
......@@ -365,6 +365,9 @@ void MergeCtx::setMergeInfo( PredictionUnit& pu, int candIdx )
CHECK( candIdx >= numValidMergeCand, "Merge candidate does not exist" );
pu.mergeFlag = true;
#if JVET_L0054_MMVD
pu.mmvdMergeFlag = false;
#endif
pu.interDir = interDirNeighbours[candIdx];
pu.mergeIdx = candIdx;
pu.mergeType = mrgTypeNeighbours[candIdx];
......@@ -384,3 +387,209 @@ void MergeCtx::setMergeInfo( PredictionUnit& pu, int candIdx )
#endif
}
#if JVET_L0054_MMVD
void MergeCtx::setMmvdMergeCandiInfo(PredictionUnit& pu, int candIdx)
{
const Slice &slice = *pu.cs->slice;
const int mvShift = VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE;
const int refMvdCands[8] = { 1 << mvShift , 2 << mvShift , 4 << mvShift , 8 << mvShift , 16 << mvShift , 32 << mvShift, 64 << mvShift , 128 << mvShift };
int fPosGroup = 0;
int fPosBaseIdx = 0;
int fPosStep = 0;
int tempIdx = 0;
int fPosPosition = 0;
Mv tempMv[2];
tempIdx = candIdx;
fPosGroup = tempIdx / (MMVD_BASE_MV_NUM * MMVD_MAX_REFINE_NUM);
tempIdx = tempIdx - fPosGroup * (MMVD_BASE_MV_NUM * MMVD_MAX_REFINE_NUM);
fPosBaseIdx = tempIdx / MMVD_MAX_REFINE_NUM;
tempIdx = tempIdx - fPosBaseIdx * (MMVD_MAX_REFINE_NUM);
fPosStep = tempIdx / 4;
fPosPosition = tempIdx - fPosStep * (4);
const int offset = refMvdCands[fPosStep];
#if !REMOVE_MV_ADAPT_PREC
const int highPrecList0 = mmvdBaseMv[fPosBaseIdx][0].mv.highPrec;
const int highPrecList1 = mmvdBaseMv[fPosBaseIdx][1].mv.highPrec;
#endif
const int refList0 = mmvdBaseMv[fPosBaseIdx][0].refIdx;
const int refList1 = mmvdBaseMv[fPosBaseIdx][1].refIdx;
if ((refList0 != -1) && (refList1 != -1))
{
const int poc0 = slice.getRefPOC(REF_PIC_LIST_0, refList0);
const int poc1 = slice.getRefPOC(REF_PIC_LIST_1, refList1);
const int currPoc = slice.getPOC();
int refSign = 1;
if ((poc0 - currPoc) * (currPoc - poc1) > 0)
{
refSign = -1;
}
#if REMOVE_MV_ADAPT_PREC
if (fPosPosition == 0)
{
tempMv[0] = Mv(offset, 0);
tempMv[1] = Mv(offset * refSign, 0);
}
else if (fPosPosition == 1)
{
tempMv[0] = Mv(-offset, 0);
tempMv[1] = Mv(-offset * refSign, 0);
}
else if (fPosPosition == 2)
{
tempMv[0] = Mv(0, offset);
tempMv[1] = Mv(0, offset * refSign);
}
else
{
tempMv[0] = Mv(0, -offset);
tempMv[1] = Mv(0, -offset * refSign);
}
#else
if (fPosPosition == 0)
{
tempMv[0] = Mv(offset, 0, highPrecList0);
tempMv[1] = Mv(offset * refSign, 0, highPrecList1);
}
else if (fPosPosition == 1)
{
tempMv[0] = Mv(-offset, 0, highPrecList0);
tempMv[1] = Mv(-offset * refSign, 0, highPrecList1);
}
else if (fPosPosition == 2)
{
tempMv[0] = Mv(0, offset, highPrecList0);
tempMv[1] = Mv(0, offset * refSign, highPrecList1);
}
else
{
tempMv[0] = Mv(0, -offset, highPrecList0);
tempMv[1] = Mv(0, -offset * refSign, highPrecList1);
}
#endif
if (abs(poc1 - currPoc) > abs(poc0 - currPoc))
{
const int scale = PU::getDistScaleFactor(currPoc, poc0, currPoc, poc1);
if (scale != 4096)
{
tempMv[0] = tempMv[0].scaleMv(scale);
}
}
else if (abs(poc1 - currPoc) < abs(poc0 - currPoc))
{
const int scale = PU::getDistScaleFactor(currPoc, poc1, currPoc, poc0);
if (scale != 4096)
{
tempMv[1] = tempMv[1].scaleMv(scale);
}
}
pu.interDir = 3;
pu.mv[REF_PIC_LIST_0] = mmvdBaseMv[fPosBaseIdx][0].mv + tempMv[0];
pu.refIdx[REF_PIC_LIST_0] = refList0;
pu.mv[REF_PIC_LIST_1] = mmvdBaseMv[fPosBaseIdx][1].mv + tempMv[1];
pu.refIdx[REF_PIC_LIST_1] = refList1;
}
else if (refList0 != -1)
{
#if REMOVE_MV_ADAPT_PREC
if (fPosPosition == 0)
{
tempMv[0] = Mv(offset, 0);
}
else if (fPosPosition == 1)
{
tempMv[0] = Mv(-offset, 0);
}
else if (fPosPosition == 2)
{
tempMv[0] = Mv(0, offset);
}
else
{
tempMv[0] = Mv(0, -offset);
}
#else
if (fPosPosition == 0)
{
tempMv[0] = Mv(offset, 0, highPrecList0);
}
else if (fPosPosition == 1)
{
tempMv[0] = Mv(-offset, 0, highPrecList0);
}
else if (fPosPosition == 2)
{
tempMv[0] = Mv(0, offset, highPrecList0);
}
else
{
tempMv[0] = Mv(0, -offset, highPrecList0);
}
#endif
pu.interDir = 1;
pu.mv[REF_PIC_LIST_0] = mmvdBaseMv[fPosBaseIdx][0].mv + tempMv[0];
pu.refIdx[REF_PIC_LIST_0] = refList0;
pu.mv[REF_PIC_LIST_1] = Mv(0, 0);
pu.refIdx[REF_PIC_LIST_1] = -1;
}
else if (refList1 != -1)
{
#if REMOVE_MV_ADAPT_PREC
if (fPosPosition == 0)
{
tempMv[1] = Mv(offset, 0);
}
else if (fPosPosition == 1)
{
tempMv[1] = Mv(-offset, 0);
}
else if (fPosPosition == 2)
{
tempMv[1] = Mv(0, offset);
}
else
{
tempMv[1] = Mv(0, -offset);
}
#else
if (fPosPosition == 0)
{
tempMv[1] = Mv(offset, 0, highPrecList1);
}
else if (fPosPosition == 1)
{
tempMv[1] = Mv(-offset, 0, highPrecList1);
}
else if (fPosPosition == 2)
{
tempMv[1] = Mv(0, offset, highPrecList1);
}
else
{
tempMv[1] = Mv(0, -offset, highPrecList1);
}
#endif
pu.interDir = 2;
pu.mv[REF_PIC_LIST_0] = Mv(0, 0);
pu.refIdx[REF_PIC_LIST_0] = -1;
pu.mv[REF_PIC_LIST_1] = mmvdBaseMv[fPosBaseIdx][1].mv + tempMv[1];
pu.refIdx[REF_PIC_LIST_1] = refList1;
}
pu.mmvdMergeFlag = true;
pu.mmvdMergeIdx = candIdx;
pu.mergeFlag = true;
pu.mergeIdx = candIdx;
pu.mergeType = MRG_TYPE_DEFAULT_N;
pu.mvd[REF_PIC_LIST_0] = Mv();
pu.mvd[REF_PIC_LIST_1] = Mv();
pu.mvpIdx[REF_PIC_LIST_0] = NOT_VALID;
pu.mvpIdx[REF_PIC_LIST_1] = NOT_VALID;
pu.mvpNum[REF_PIC_LIST_0] = NOT_VALID;
pu.mvpNum[REF_PIC_LIST_1] = NOT_VALID;
}
#endif
\ No newline at end of file
......@@ -309,6 +309,10 @@ public:
MotionBuf subPuMvpMiBuf;
MotionBuf subPuMvpExtMiBuf;
#if JVET_L0054_MMVD
MvField mmvdBaseMv[MMVD_BASE_MV_NUM][2];
void setMmvdMergeCandiInfo(PredictionUnit& pu, int candIdx);
#endif
void setMergeInfo( PredictionUnit& pu, int candIdx );
};
......
......@@ -313,7 +313,28 @@ const CtxSet ContextSetCfg::MergeIdx = ContextSetCfg::addCtxSet
{ CNU, CNU, CNU, CNU, CNU,},
#endif
});
#if JVET_L0054_MMVD
const CtxSet ContextSetCfg::MmvdFlag = ContextSetCfg::addCtxSet
({
{ 151, },
{ CNU, },
{ CNU, },
});
const CtxSet ContextSetCfg::MmvdMergeIdx = ContextSetCfg::addCtxSet
({
{ CNU, },
{ CNU, },
{ CNU, },
});
const CtxSet ContextSetCfg::MmvdStepMvpIdx = ContextSetCfg::addCtxSet
({
{ 184, },
{ CNU, },
{ CNU, },
});
#endif
const CtxSet ContextSetCfg::PartSize = ContextSetCfg::addCtxSet
({
{ 154, 139, 154, 154,},
......
......@@ -166,6 +166,11 @@ public:
static const CtxSet DeltaQP;
static const CtxSet InterDir;
static const CtxSet RefPic;
#if JVET_L0054_MMVD
static const CtxSet MmvdFlag;
static const CtxSet MmvdMergeIdx;
static const CtxSet MmvdStepMvpIdx;
#endif
static const CtxSet AffineFlag;
static const CtxSet AffineType;
static const CtxSet Mvd;
......
......@@ -560,6 +560,36 @@ unsigned LoopFilter::xGetBoundaryStrengthSingle ( const CodingUnit& cu, const De
return ( ( abs( mvQ0.getHor() - mvP0.getHor() ) >= nThreshold ) || ( abs( mvQ0.getVer() - mvP0.getVer() ) >= nThreshold ) ) ? 1 : 0;
}
#if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET
void LoopFilter::deriveLADFShift( const Pel* src, const int stride, int& shift, const DeblockEdgeDir edgeDir, const SPS sps )
{
uint32_t lumaLevel = 0;
shift = sps.getSpsNext().getLadfQpOffset(0);
if (edgeDir == EDGE_VER)
{
lumaLevel = (src[0] + src[3*stride] + src[-1] + src[3*stride - 1]) >> 2;
}
else // (edgeDir == EDGE_HOR)
{
lumaLevel = (src[0] + src[3] + src[-stride] + src[-stride + 3]) >> 2;
}
for ( int k = 1; k < sps.getSpsNext().getLadfNumIntervals(); k++ )
{
const int th = sps.getSpsNext().getLadfIntervalLowerBound( k );
if ( lumaLevel > th )
{
shift = sps.getSpsNext().getLadfQpOffset( k );
}
else
{
break;
}
}
}
#endif
void LoopFilter::xEdgeFilterLuma(const CodingUnit& cu, const DeblockEdgeDir edgeDir, const int iEdge)
{
const CompArea& lumaArea = cu.block(COMPONENT_Y);
......@@ -645,6 +675,14 @@ void LoopFilter::xEdgeFilterLuma(const CodingUnit& cu, const DeblockEdgeDir edge
iQP = (cuP.qp + cuQ.qp + 1) >> 1;
#if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET
if ( sps.getSpsNext().getLadfEnabled() )
{
int iShift = 0;
deriveLADFShift( piTmpSrc + iSrcStep * (iIdx*pelsInPart), iStride, iShift, edgeDir, sps );
iQP += iShift;
}
#endif
const int iIndexTC = Clip3(0, MAX_QP + DEFAULT_INTRA_TC_OFFSET, int(iQP + DEFAULT_INTRA_TC_OFFSET*(uiBs - 1) + (tcOffsetDiv2 << 1)));
const int iIndexB = Clip3(0, MAX_QP, iQP + (betaOffsetDiv2 << 1));
......
......@@ -79,6 +79,9 @@ private:
void xEdgeFilterLuma ( const CodingUnit& cu, const DeblockEdgeDir edgeDir, const int iEdge );
void xEdgeFilterChroma ( const CodingUnit& cu, const DeblockEdgeDir edgeDir, const int iEdge );
#if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET
void deriveLADFShift( const Pel* src, const int stride, int& shift, const DeblockEdgeDir edgeDir, const SPS sps );
#endif
inline void xPelFilterLuma ( Pel* piSrc, const int iOffset, const int tc, const bool sw, const bool bPartPNoFilter, const bool bPartQNoFilter, const int iThrCut, const bool bFilterSecondP, const bool bFilterSecondQ, const ClpRng& clpRng ) const;
inline void xPelFilterChroma ( Pel* piSrc, const int iOffset, const int tc, const bool bPartPNoFilter, const bool bPartQNoFilter, const ClpRng& clpRng ) const;
......
......@@ -162,7 +162,7 @@ public:
}
Mv* pAffineMv = &(m_mvAffine[0][0][0][0]);
for (int ui = 0; ui < 2 * 2 * 33 * 3; ++ui, ++pMv)
for (int ui = 0; ui < 2 * 2 * 33 * 3; ++ui, ++pAffineMv)
{
pAffineMv->set(0, 0);
}
......@@ -208,5 +208,11 @@ public:
}
};
#endif
#if JVET_L0266_HMVP
struct LutMotionCand
{
MotionInfo* motionCand;
int currCnt;
};
#endif
#endif // __MOTIONINFO__
......@@ -317,7 +317,11 @@ uint32_t deriveWeightIdxBits(uint8_t gbiIdx) // Note: align this with TEncSbac::
// initialize ROM variables
void initROM()
{
#if JVET_L0285_8BIT_TRANSFORM_CORE
int c;
#else
int i, c;
#endif
#if RExt__HIGH_BIT_DEPTH_SUPPORT
{
......@@ -367,6 +371,7 @@ void initROM()
g_aucLog2 [i] = c;
}
#if !JVET_L0285_8BIT_TRANSFORM_CORE
c = 2; //for the 2x2 transforms if QTBT is on
const double PI = 3.14159265358979323846;
......@@ -410,6 +415,8 @@ void initROM()
}
c <<= 1;
}
#endif
gp_sizeIdxInfo = new SizeIndexInfoLog2();
gp_sizeIdxInfo->init(MAX_CU_SIZE);