Commit 694008b4 authored by Shelly Chiang's avatar Shelly Chiang

update the codebase

parents 0ac16832 e9bf7ed5
......@@ -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
......
......@@ -142,7 +142,8 @@ DepQuant : 1
IMV : 2
ALF : 1
GBi : 1
GBiFast : 1
GBiFast : 1
BIO : 1
MHIntra : 1
# Fast tools
......
......@@ -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 );
......@@ -227,6 +230,9 @@ void EncApp::xInitLibCfg()
m_cEncLib.setAffineType ( m_AffineType );
#if !REMOVE_MV_ADAPT_PREC
m_cEncLib.setHighPrecisionMv (m_highPrecisionMv);
#endif
#if JVET_L0256_BIO
m_cEncLib.setBIO (m_BIO);
#endif
m_cEncLib.setDisableMotionCompression ( m_DisableMotionCompression );
m_cEncLib.setMTTMode ( m_MTT );
......@@ -243,6 +249,18 @@ void EncApp::xInitLibCfg()
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
#if JVET_L0100_MULTI_HYPOTHESIS_INTRA
m_cEncLib.setUseMHIntra ( m_MHIntra );
#endif
......
......@@ -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")
......@@ -818,8 +827,11 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
#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]")
( "AffineType", m_AffineType, true, "Enable affine type prediction (0:off, 1:on) [default: on]" )
("Affine", m_Affine, false, "Enable affine prediction (0:off, 1:on) [default: off]")
("AffineType", m_AffineType, true, "Enable affine type prediction (0:off, 1:on) [default: on]" )
#if JVET_L0256_BIO
("BIO", m_BIO, false, "Enable bi-directional optical flow")
#endif
("DisableMotCompression", m_DisableMotionCompression, false, "Disable motion data compression for all modes")
("IMV", m_ImvMode, 2, "Adaptive MV precision Mode (IMV)\n"
"\t0: disabled IMV\n"
......@@ -848,6 +860,12 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
("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
#if JVET_L0100_MULTI_HYPOTHESIS_INTRA
("MHIntra", m_MHIntra, false, "Enable MHIntra mode")
#endif
......@@ -1686,6 +1704,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 +1866,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
......@@ -1916,6 +1949,9 @@ bool EncAppCfg::xCheckParameter()
#if !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_L0256_BIO
xConfirmPara( m_BIO, "BIO only allowed with NEXT profile" );
#endif
xConfirmPara( m_DisableMotionCompression, "Disable motion data compression only allowed with NEXT profile" );
xConfirmPara( m_MTT, "Multi type tree is only allowed with NEXT profile" );
......@@ -1990,6 +2026,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!" );
......@@ -3113,6 +3152,9 @@ void EncAppCfg::xPrintParameter()
if( !m_QTBT ) msg( VERBOSE, "IMVMaxCand:%d ", m_ImvMaxCand );
#if !REMOVE_MV_ADAPT_PREC
msg(VERBOSE, "HighPrecMv:%d ", m_highPrecisionMv);
#endif
#if JVET_L0256_BIO
msg( VERBOSE, "BIO:%d ", m_BIO );
#endif
msg( VERBOSE, "DisMDC:%d ", m_DisableMotionCompression );
msg( VERBOSE, "MTT:%d ", m_MTT );
......@@ -3126,6 +3168,9 @@ void EncAppCfg::xPrintParameter()
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
#if JVET_L0100_MULTI_HYPOTHESIS_INTRA
msg(VERBOSE, "MHIntra:%d ", m_MHIntra);
#endif
......
......@@ -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;
......@@ -210,6 +213,9 @@ protected:
bool m_AffineType;
#if !REMOVE_MV_ADAPT_PREC
bool m_highPrecisionMv;
#endif
#if JVET_L0256_BIO
bool m_BIO;
#endif
bool m_DisableMotionCompression;
unsigned m_MTT;
......@@ -225,6 +231,12 @@ protected:
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
#if JVET_L0100_MULTI_HYPOTHESIS_INTRA
bool m_MHIntra;
......
......@@ -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()
......
......@@ -62,6 +62,138 @@ void addAvgCore( const T* src1, int src1Stride, const T* src2, int src2Stride, T
#undef ADD_AVG_CORE_INC
}
#if JVET_L0256_BIO
void addBIOAvgCore(const Pel* src0, int src0Stride, const Pel* src1, int src1Stride, Pel *dst, int dstStride, const Pel *gradX0, const Pel *gradX1, const Pel *gradY0, const Pel*gradY1, int gradStride, int width, int height, int tmpx, int tmpy, int shift, int offset, const ClpRng& clpRng)
{
int b = 0;
for (int y = 0; y < height; y++)
{
for (int x = 0; x < width; x += 4)
{
b = tmpx * (gradX0[x] - gradX1[x]) + tmpy * (gradY0[x] - gradY1[x]);
b = ((b + 1) >> 1);
dst[x] = ClipPel((int16_t)rightShift((src0[x] + src1[x] + b + offset), shift), clpRng);
b = tmpx * (gradX0[x + 1] - gradX1[x + 1]) + tmpy * (gradY0[x + 1] - gradY1[x + 1]);
b = ((b + 1) >> 1);
dst[x + 1] = ClipPel((int16_t)rightShift((src0[x + 1] + src1[x + 1] + b + offset), shift), clpRng);
b = tmpx * (gradX0[x + 2] - gradX1[x + 2]) + tmpy * (gradY0[x + 2] - gradY1[x + 2]);
b = ((b + 1) >> 1);
dst[x + 2] = ClipPel((int16_t)rightShift((src0[x + 2] + src1[x + 2] + b + offset), shift), clpRng);
b = tmpx * (gradX0[x + 3] - gradX1[x + 3]) + tmpy * (gradY0[x + 3] - gradY1[x + 3]);
b = ((b + 1) >> 1);
dst[x + 3] = ClipPel((int16_t)rightShift((src0[x + 3] + src1[x + 3] + b + offset), shift), clpRng);
}
dst += dstStride; src0 += src0Stride; src1 += src1Stride;
gradX0 += gradStride; gradX1 += gradStride; gradY0 += gradStride; gradY1 += gradStride;
}
}
void gradFilterCore(Pel* pSrc, int srcStride, int width, int height, int gradStride, Pel* gradX, Pel* gradY)
{
Pel* srcTmp = pSrc + srcStride + 1;
Pel* gradXTmp = gradX + gradStride + 1;
Pel* gradYTmp = gradY + gradStride + 1;
for (int y = 0; y < (height - 2 * BIO_EXTEND_SIZE); y++)
{
for (int x = 0; x < (width - 2 * BIO_EXTEND_SIZE); x++)
{
gradYTmp[x] = (srcTmp[x + srcStride] - srcTmp[x - srcStride]) >> 4;
gradXTmp[x] = (srcTmp[x + 1] - srcTmp[x - 1]) >> 4;
}
gradXTmp += gradStride;
gradYTmp += gradStride;
srcTmp += srcStride;
}
gradXTmp = gradX + gradStride + 1;
gradYTmp = gradY + gradStride + 1;
for (int y = 0; y < (height - 2 * BIO_EXTEND_SIZE); y++)
{
gradXTmp[-1] = gradXTmp[0];
gradXTmp[width - 2 * BIO_EXTEND_SIZE] = gradXTmp[width - 2 * BIO_EXTEND_SIZE - 1];
gradXTmp += gradStride;
gradYTmp[-1] = gradYTmp[0];
gradYTmp[width - 2 * BIO_EXTEND_SIZE] = gradYTmp[width - 2 * BIO_EXTEND_SIZE - 1];
gradYTmp += gradStride;
}
gradXTmp = gradX + gradStride;
gradYTmp = gradY + gradStride;
::memcpy(gradXTmp - gradStride, gradXTmp, sizeof(Pel)*(width));
::memcpy(gradXTmp + (height - 2 * BIO_EXTEND_SIZE)*gradStride, gradXTmp + (height - 2 * BIO_EXTEND_SIZE - 1)*gradStride, sizeof(Pel)*(width));
::memcpy(gradYTmp - gradStride, gradYTmp, sizeof(Pel)*(width));
::memcpy(gradYTmp + (height - 2 * BIO_EXTEND_SIZE)*gradStride, gradYTmp + (height - 2 * BIO_EXTEND_SIZE - 1)*gradStride, sizeof(Pel)*(width));
}
void calcBIOParCore(const Pel* srcY0Temp, const Pel* srcY1Temp, const Pel* gradX0, const Pel* gradX1, const Pel* gradY0, const Pel* gradY1, int* dotProductTemp1, int* dotProductTemp2, int* dotProductTemp3, int* dotProductTemp5, int* dotProductTemp6, const int src0Stride, const int src1Stride, const int gradStride, const int widthG, const int heightG)
{
for (int y = 0; y < heightG; y++)
{
for (int x = 0; x < widthG; x++)
{
int temp = (srcY0Temp[x] >> 6) - (srcY1Temp[x] >> 6);
int tempX = (gradX0[x] + gradX1[x]) >> 3;
int tempY = (gradY0[x] + gradY1[x]) >> 3;
dotProductTemp1[x] = tempX * tempX;
dotProductTemp2[x] = tempX * tempY;
dotProductTemp3[x] = -tempX * temp;
dotProductTemp5[x] = tempY * tempY;
dotProductTemp6[x] = -tempY * temp;
}
srcY0Temp += src0Stride;
srcY1Temp += src1Stride;
gradX0 += gradStride;
gradX1 += gradStride;
gradY0 += gradStride;
gradY1 += gradStride;
dotProductTemp1 += widthG;
dotProductTemp2 += widthG;
dotProductTemp3 += widthG;
dotProductTemp5 += widthG;
dotProductTemp6 += widthG;
}
}
void calcBlkGradientCore(int sx, int sy, int *arraysGx2, int *arraysGxGy, int *arraysGxdI, int *arraysGy2, int *arraysGydI, int &sGx2, int &sGy2, int &sGxGy, int &sGxdI, int &sGydI, int width, int height, int unitSize)
{
int *Gx2 = arraysGx2;
int *Gy2 = arraysGy2;
int *GxGy = arraysGxGy;
int *GxdI = arraysGxdI;
int *GydI = arraysGydI;
// set to the above row due to JVET_K0485_BIO_EXTEND_SIZE
Gx2 -= (BIO_EXTEND_SIZE*width);
Gy2 -= (BIO_EXTEND_SIZE*width);
GxGy -= (BIO_EXTEND_SIZE*width);
GxdI -= (BIO_EXTEND_SIZE*width);
GydI -= (BIO_EXTEND_SIZE*width);
for (int y = -BIO_EXTEND_SIZE; y < unitSize + BIO_EXTEND_SIZE; y++)
{
for (int x = -BIO_EXTEND_SIZE; x < unitSize + BIO_EXTEND_SIZE; x++)
{
sGx2 += Gx2[x];
sGy2 += Gy2[x];
sGxGy += GxGy[x];
sGxdI += GxdI[x];
sGydI += GydI[x];
}
Gx2 += width;
Gy2 += width;
GxGy += width;
GxdI += width;
GydI += width;
}
}
#endif
#if ENABLE_SIMD_OPT_GBI && JVET_L0646_GBI
void removeWeightHighFreq(int16_t* dst, int dstStride, const int16_t* src, int srcStride, int width, int height, int shift, int gbiWeight)
{
......@@ -138,6 +270,13 @@ PelBufferOps::PelBufferOps()
linTf4 = linTfCore<Pel>;
linTf8 = linTfCore<Pel>;
#if JVET_L0256_BIO
addBIOAvg4 = addBIOAvgCore;
bioGradFilter = gradFilterCore;
calcBIOPar = calcBIOParCore;
calcBlkGradient = calcBlkGradientCore;
#endif
#if ENABLE_SIMD_OPT_GBI
removeWeightHighFreq8 = removeWeightHighFreq;
removeWeightHighFreq4 = removeWeightHighFreq;
......
......@@ -68,6 +68,12 @@ struct PelBufferOps
void ( *reco8 ) ( const Pel* src0, int src0Stride, const Pel* src1, int src1Stride, Pel *dst, int dstStride, int width, int height, const ClpRng& clpRng );
void ( *linTf4 ) ( const Pel* src0, int src0Stride, Pel *dst, int dstStride, int width, int height, int scale, int shift, int offset, const ClpRng& clpRng, bool bClip );
void ( *linTf8 ) ( const Pel* src0, int src0Stride, Pel *dst, int dstStride, int width, int height, int scale, int shift, int offset, const ClpRng& clpRng, bool bClip );
#if JVET_L0256_BIO
void(*addBIOAvg4) (const Pel* src0, int src0Stride, const Pel* src1, int src1Stride, Pel *dst, int dstStride, const Pel *gradX0, const Pel *gradX1, const Pel *gradY0, const Pel*gradY1, int gradStride, int width, int height, int tmpx, int tmpy, int shift, int offset, const ClpRng& clpRng);
void(*bioGradFilter) (Pel* pSrc, int srcStride, int width, int height, int gradStride, Pel* gradX, Pel* gradY);
void(*calcBIOPar) (const Pel* srcY0Temp, const Pel* srcY1Temp, const Pel* gradX0, const Pel* gradX1, const Pel* gradY0, const Pel* gradY1, int* dotProductTemp1, int* dotProductTemp2, int* dotProductTemp3, int* dotProductTemp5, int* dotProductTemp6, const int src0Stride, const int src1Stride, const int gradStride, const int widthG, const int heightG);
void(*calcBlkGradient)(int sx, int sy, int *arraysGx2, int *arraysGxGy, int *arraysGxdI, int *arraysGy2, int *arraysGydI, int &sGx2, int &sGy2, int &sGxGy, int &sGxdI, int &sGydI, int width, int height, int unitSize);
#endif
#if ENABLE_SIMD_OPT_GBI
void ( *removeWeightHighFreq8) ( Pel* src0, int src0Stride, const Pel* src1, int src1Stride, int width, int height, int shift, int gbiWeight);
void ( *removeWeightHighFreq4) ( Pel* src0, int src0Stride, const Pel* src1, int src1Stride, int width, int height, int shift, int gbiWeight);
......
......@@ -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()
......
......@@ -188,7 +188,11 @@ static const int ADJ_DEQUANT_SHIFT = ( ADJ_QUANT_SHIFT + 1 );
static const int RVM_VCEGAM10_M = 4;
static const int NUM_LUMA_MODE = 67; ///< Planar + DC + 65 directional mode (4*16 + 1)
#if JVET_L0338_MDLM
static const int NUM_LMC_MODE = 1 + 2; ///< LMC + MDLM_T + MDLM_L
#else
static const int NUM_LMC_MODE = 1; ///< LMC
#endif
static const int NUM_INTRA_MODE = (NUM_LUMA_MODE + NUM_LMC_MODE);
static const int NUM_DIR = (((NUM_LUMA_MODE - 3) >> 2) + 1);
......@@ -202,6 +206,10 @@ static const int NOMODE_IDX = MAX_UCHAR; ///< indi
static const int NUM_CHROMA_MODE = (5 + NUM_LMC_MODE); ///< total number of chroma modes
static const int LM_CHROMA_IDX = NUM_LUMA_MODE; ///< chroma mode index for derived from LM mode
#if JVET_L0338_MDLM
static const int MDLM_L_IDX = LM_CHROMA_IDX + 1; ///< MDLM_L
static const int MDLM_T_IDX = LM_CHROMA_IDX + 2; ///< MDLM_T
#endif
static const int DM_CHROMA_IDX = NUM_INTRA_MODE; ///< chroma mode index for derived from luma intra mode
static const uint8_t INTER_MODE_IDX = 255; ///< index for inter modes
......@@ -258,6 +266,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,17 +302,37 @@ 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
static const int MAX_NUM_REG_BINS_2x2SUBBLOCK = 8; ///< max number of context-coded bins (incl. gt2 bins) per 2x2 subblock (chroma)
static const int MAX_NUM_GT2_BINS_2x2SUBBLOCK = 2; ///< max number of gt2 bins per 2x2 subblock (chroma)
#endif
#if JVET_L0256_BIO
static const int BIO_EXTEND_SIZE = 1;
static const int BIO_TEMP_BUFFER_SIZE = (MAX_CU_SIZE + 2 * BIO_EXTEND_SIZE) * (MAX_CU_SIZE + 2 * BIO_EXTEND_SIZE);
#endif
#if JVET_L0646_GBI
static const int GBI_NUM = 5; ///< the number of weight options
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 ;
......@@ -355,7 +386,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
......@@ -364,6 +399,14 @@ 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
// ====================================================================================================================
// Macro functions
// ====================================================================================================================
......
......@@ -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,213 @@ 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);