...
 
Commits (72)
......@@ -159,7 +159,9 @@ Triangle : 1
IBC : 0 # turned off in CTC
AllowDisFracMMVD : 1
AffineAmvr : 1
LumaReshapeEnable : 1 # luma reshaping. 0: disable 1:enable
LMCSEnable : 1 # LMCS: 0: disable, 1:enable
LMCSSignalType : 0 # Input signal type: 0:SDR, 1:HDR-PQ, 2:HDR-HLG
LMCSUpdateCtrl : 0 # LMCS model update control: 0:RA, 1:AI, 2:LDB/LDP
MIP : 1
DMVR : 1
SMVD : 1
......
......@@ -161,7 +161,9 @@ Triangle : 1
IBC : 0 # turned off in CTC
AllowDisFracMMVD : 1
AffineAmvr : 1
LumaReshapeEnable : 1 # luma reshaping. 0: disable 1:enable
LMCSEnable : 1 # LMCS: 0: disable, 1:enable
LMCSSignalType : 0 # Input signal type: 0:SDR, 1:HDR-PQ, 2:HDR-HLG
LMCSUpdateCtrl : 0 # LMCS model update control: 0:RA, 1:AI, 2:LDB/LDP
MIP : 1
DMVR : 1
SMVD : 1
......
......@@ -161,7 +161,9 @@ Triangle : 1
IBC : 0 # turned off in CTC
AllowDisFracMMVD : 1
AffineAmvr : 1
LumaReshapeEnable : 1 # luma reshaping. 0: disable 1:enable
LMCSEnable : 1 # LMCS: 0: disable, 1:enable
LMCSSignalType : 0 # Input signal type: 0:SDR, 1:HDR-PQ, 2:HDR-HLG
LMCSUpdateCtrl : 0 # LMCS model update control: 0:RA, 1:AI, 2:LDB/LDP
MIP : 1
DMVR : 1
SMVD : 1
......
......@@ -863,7 +863,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
("BIO", m_BIO, false, "Enable bi-directional optical flow")
("IMV", m_ImvMode, 1, "Adaptive MV precision Mode (IMV)\n"
"\t0: disabled\n"
"\t1: enabled (Full-Pel and 4-PEL)\n")
"\t1: enabled (1/2-Pel, Full-Pel and 4-PEL)\n")
("IMV4PelFast", m_Imv4PelFast, 1, "Fast 4-Pel Adaptive MV precision Mode 0:disabled, 1:enabled) [default: 1]")
("LMChroma", m_LMChroma, 1, " LMChroma prediction "
"\t0: Disable LMChroma\n"
......@@ -942,7 +942,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
("UseNonLinearAlfChroma", m_useNonLinearAlfChroma, true, "Non-linear adaptive loop filters for Chroma Channels")
#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB
("MaxNumAlfAlternativesChroma", m_maxNumAlfAlternativesChroma,
(unsigned)MAX_NUM_ALF_ALTERNATIVES_CHROMA, "Maximum number of alternative Chroma filters (1-" MACRO_TO_STRING(MAX_NUM_ALF_ALTERNATIVES_CHROMA) ", inclusive)")
(unsigned)MAX_NUM_ALF_ALTERNATIVES_CHROMA, std::string("Maximum number of alternative Chroma filters (1-") + std::to_string(MAX_NUM_ALF_ALTERNATIVES_CHROMA) + std::string (", inclusive)") )
#endif
("MIP", m_MIP, true, "Enable MIP (matrix-based intra prediction)")
("FastMIP", m_useFastMIP, false, "Fast encoder search for MIP (matrix-based intra prediction)")
......@@ -1958,7 +1958,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB
if ( m_alf )
{
CHECK( m_maxNumAlfAlternativesChroma < 1 || m_maxNumAlfAlternativesChroma > MAX_NUM_ALF_ALTERNATIVES_CHROMA, "The maximum number of ALF Chroma filter alternatives must be in the range (1-" MACRO_TO_STRING(MAX_NUM_ALF_ALTERNATIVES_CHROMA) ", inclusive)" );
CHECK( m_maxNumAlfAlternativesChroma < 1 || m_maxNumAlfAlternativesChroma > MAX_NUM_ALF_ALTERNATIVES_CHROMA, std::string("The maximum number of ALF Chroma filter alternatives must be in the range (1-") + std::to_string(MAX_NUM_ALF_ALTERNATIVES_CHROMA) + std::string (", inclusive)") );
}
#endif
......@@ -2528,6 +2528,9 @@ bool EncAppCfg::xCheckParameter()
#if MAX_TB_SIZE_SIGNALLING
xConfirmPara( m_log2MaxTbSize > 6, "Log2MaxTbSize must be 6 or smaller." );
#endif
#if JVET_O0545_MAX_TB_SIGNALLING
xConfirmPara( m_log2MaxTbSize < 5, "Log2MaxTbSize must be 5 or greater." );
#endif
xConfirmPara( m_maxNumMergeCand < 1, "MaxNumMergeCand must be 1 or greater.");
xConfirmPara( m_maxNumMergeCand > MRG_MAX_NUM_CANDS, "MaxNumMergeCand must be no more than MRG_MAX_NUM_CANDS." );
......
......@@ -263,8 +263,13 @@ static const int FAST_UDI_MAX_RDMODE_NUM = (NUM_LUMA_MODE + MAX_NUM_MIP_MODE); /
static const int MAX_LFNST_COEF_NUM = 16;
#if JVET_O0472_LFNST_SIGNALLING_LAST_SCAN_POS
static const int LFNST_LAST_SIG_LUMA = 1;
static const int LFNST_LAST_SIG_CHROMA = 1;
#else
static const int LFNST_SIG_NZ_LUMA = 1;
static const int LFNST_SIG_NZ_CHROMA = 1;
#endif
static const int NUM_LFNST_NUM_PER_SET = 3;
......@@ -309,7 +314,12 @@ static const int MAX_CU_SIZE = 1<<MAX_CU_DEPTH;
static const int MIN_CU_LOG2 = 2;
static const int MIN_PU_SIZE = 4;
static const int MAX_NUM_PARTS_IN_CTU = ( ( MAX_CU_SIZE * MAX_CU_SIZE ) >> ( MIN_CU_LOG2 << 1 ) );
#if JVET_O0545_MAX_TB_SIGNALLING
static const int MAX_NUM_TUS = 16; ///< Maximum number of TUs within one CU. When max TB size is 32x32, up to 16 TUs within one CU (128x128) is supported
static const int MAX_LOG2_DIFF_CU_TR_SIZE = 3;
#else
static const int MAX_LOG2_DIFF_CU_TR_SIZE = 2;
#endif
static const int MAX_CU_TILING_PARTITIONS = 1 << ( MAX_LOG2_DIFF_CU_TR_SIZE << 1 );
static const int JVET_C0024_ZERO_OUT_TH = 32;
......
......@@ -329,6 +329,9 @@ void MergeCtx::setMergeInfo( PredictionUnit& pu, int candIdx )
pu.mergeFlag = true;
pu.mmvdMergeFlag = false;
pu.interDir = interDirNeighbours[candIdx];
#if JVET_O0057_ALTHPELIF
pu.cu->imv = (!pu.cu->triangle && useAltHpelIf[candIdx]) ? IMV_HPEL : 0;
#endif
pu.mergeIdx = candIdx;
pu.mergeType = mrgTypeNeighbours[candIdx];
pu.mv [REF_PIC_LIST_0] = mvFieldNeighbours[(candIdx << 1) + 0].mv;
......@@ -345,6 +348,9 @@ void MergeCtx::setMergeInfo( PredictionUnit& pu, int candIdx )
{
pu.bv = pu.mv[REF_PIC_LIST_0];
pu.bv.changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_INT); // used for only integer resolution
#if JVET_O0057_ALTHPELIF
pu.cu->imv = pu.cu->imv == IMV_HPEL ? 0 : pu.cu->imv;
#endif
}
pu.cu->GBiIdx = ( interDirNeighbours[candIdx] == 3 ) ? GBiIdx[candIdx] : GBI_DEFAULT;
......@@ -501,7 +507,11 @@ void MergeCtx::setMmvdMergeCandiInfo(PredictionUnit& pu, int candIdx)
pu.mmvdMergeFlag = true;
pu.mmvdMergeIdx = candIdx;
pu.mergeFlag = true;
#if JVET_O0249_MERGE_SYNTAX
pu.regularMergeFlag = true;
#else
pu.regularMergeFlag = false;
#endif
pu.mergeIdx = candIdx;
pu.mergeType = MRG_TYPE_DEFAULT_N;
pu.mvd[REF_PIC_LIST_0] = Mv();
......@@ -510,6 +520,9 @@ void MergeCtx::setMmvdMergeCandiInfo(PredictionUnit& pu, int candIdx)
pu.mvpIdx[REF_PIC_LIST_1] = NOT_VALID;
pu.mvpNum[REF_PIC_LIST_0] = NOT_VALID;
pu.mvpNum[REF_PIC_LIST_1] = NOT_VALID;
#if JVET_O0057_ALTHPELIF
pu.cu->imv = mmvdUseAltHpelIf[fPosBaseIdx] ? IMV_HPEL : 0;
#endif
pu.cu->GBiIdx = (interDirNeighbours[fPosBaseIdx] == 3) ? GBiIdx[fPosBaseIdx] : GBI_DEFAULT;
......
......@@ -427,6 +427,18 @@ class CUCtx
{
public:
CUCtx() : isDQPCoded(false), isChromaQpAdjCoded(false),
#if JVET_O0472_LFNST_SIGNALLING_LAST_SCAN_POS
qgStart(false)
{
#if JVET_O0094_LFNST_ZERO_PRIM_COEFFS
violatesLfnstConstrained[CHANNEL_TYPE_LUMA ] = false;
violatesLfnstConstrained[CHANNEL_TYPE_CHROMA] = false;
#endif
lastScanPos[COMPONENT_Y ] = -1;
lastScanPos[COMPONENT_Cb] = -1;
lastScanPos[COMPONENT_Cr] = -1;
}
#else
qgStart(false),
#if JVET_O0094_LFNST_ZERO_PRIM_COEFFS
numNonZeroCoeffNonTs(0)
......@@ -436,9 +448,22 @@ public:
}
#else
numNonZeroCoeffNonTs(0) {}
#endif
#endif
CUCtx(int _qp) : isDQPCoded(false), isChromaQpAdjCoded(false),
qgStart(false),
#if JVET_O0472_LFNST_SIGNALLING_LAST_SCAN_POS
qp(_qp)
{
#if JVET_O0094_LFNST_ZERO_PRIM_COEFFS
violatesLfnstConstrained[CHANNEL_TYPE_LUMA ] = false;
violatesLfnstConstrained[CHANNEL_TYPE_CHROMA] = false;
#endif
lastScanPos[COMPONENT_Y ] = -1;
lastScanPos[COMPONENT_Cb] = -1;
lastScanPos[COMPONENT_Cr] = -1;
}
#else
#if JVET_O0094_LFNST_ZERO_PRIM_COEFFS
numNonZeroCoeffNonTs(0), qp(_qp)
{
......@@ -447,13 +472,18 @@ public:
}
#else
numNonZeroCoeffNonTs(0), qp(_qp) {}
#endif
#endif
~CUCtx() {}
public:
bool isDQPCoded;
bool isChromaQpAdjCoded;
bool qgStart;
#if JVET_O0472_LFNST_SIGNALLING_LAST_SCAN_POS
int lastScanPos[MAX_NUM_COMPONENT];
#else
uint32_t numNonZeroCoeffNonTs;
#endif
int8_t qp; // used as a previous(last) QP and for QP prediction
#if JVET_O0094_LFNST_ZERO_PRIM_COEFFS
bool violatesLfnstConstrained[MAX_NUM_CHANNEL_TYPE];
......@@ -477,6 +507,10 @@ public:
MotionBuf subPuMvpExtMiBuf;
MvField mmvdBaseMv[MMVD_BASE_MV_NUM][2];
void setMmvdMergeCandiInfo(PredictionUnit& pu, int candIdx);
#if JVET_O0057_ALTHPELIF
bool mmvdUseAltHpelIf [ MMVD_BASE_MV_NUM ];
bool useAltHpelIf [ MRG_MAX_NUM_CANDS ];
#endif
void setMergeInfo( PredictionUnit& pu, int candIdx );
};
......
......@@ -258,10 +258,17 @@ const CtxSet ContextSetCfg::MergeFlag = ContextSetCfg::addCtxSet
const CtxSet ContextSetCfg::RegularMergeFlag = ContextSetCfg::addCtxSet
({
#if JVET_O0249_MERGE_SYNTAX
{ 159, 126 },
{ 143, 111 },
{ 154, 154 },
{ 6, 5 }
#else
{ 142, 125, },
{ 141, 110, },
{ CNU, CNU, },
{ 4, 4, },
#endif
});
const CtxSet ContextSetCfg::MergeIdx = ContextSetCfg::addCtxSet
......@@ -274,10 +281,17 @@ const CtxSet ContextSetCfg::MergeIdx = ContextSetCfg::addCtxSet
const CtxSet ContextSetCfg::MmvdFlag = ContextSetCfg::addCtxSet
({
#if JVET_O0249_MERGE_SYNTAX
{ 108, },
{ 108, },
{ 154, },
{ 5, },
#else
{ 109, },
{ 124, },
{ CNU, },
{ 5, },
#endif
});
const CtxSet ContextSetCfg::MmvdMergeIdx = ContextSetCfg::addCtxSet
......@@ -327,7 +341,22 @@ const CtxSet ContextSetCfg::IntraLumaPlanarFlag = ContextSetCfg::addCtxSet
{ 110, 154, },
{ 4, 5, },
});
#if JVET_O1153_INTRA_CHROMAMODE_CODING
const CtxSet ContextSetCfg::CclmModeFlag = ContextSetCfg::addCtxSet
({
{ 153,},
{ 168,},
{ 169,},
{ 4,},
});
const CtxSet ContextSetCfg::IntraChromaPredMode = ContextSetCfg::addCtxSet
({
{ 149,},
{ 166,},
{ 138,},
{ 5,},
});
#else
const CtxSet ContextSetCfg::IntraChromaPredMode = ContextSetCfg::addCtxSet
({
{ 137, 139, 140, },
......@@ -335,6 +364,7 @@ const CtxSet ContextSetCfg::IntraChromaPredMode = ContextSetCfg::addCtxSet
{ 154, 154, 154, },
{ 5, 8, 8, },
});
#endif
const CtxSet ContextSetCfg::MipFlag = ContextSetCfg::addCtxSet
({
......@@ -388,10 +418,17 @@ const CtxSet ContextSetCfg::SubblockMergeFlag = ContextSetCfg::addCtxSet
const CtxSet ContextSetCfg::AffineFlag = ContextSetCfg::addCtxSet
({
#if JVET_O0249_MERGE_SYNTAX
{ 180, 169, 186 },
{ 195, 168, 155 },
{ 154, 154, 154 },
{ 5, 4, 4 }
#else
{ 183, 185, 187, },
{ 168, 169, 171, },
{ CNU, CNU, CNU, },
{ 4, 4, 4, },
#endif
});
const CtxSet ContextSetCfg::AffineType = ContextSetCfg::addCtxSet
......@@ -767,6 +804,15 @@ const CtxSet ContextSetCfg::ChromaQpAdjIdc = ContextSetCfg::addCtxSet
{ DWS, },
});
#if JVET_O0057_ALTHPELIF
const CtxSet ContextSetCfg::ImvFlag = ContextSetCfg::addCtxSet
({
{ 212, 180, 183, 242, 242, },
{ 213, 166, 198, 244, 244, },
{ CNU, 182, CNU, CNU, CNU, },
{ 1, 5, 1, 0, 0, },
});
#else
const CtxSet ContextSetCfg::ImvFlag = ContextSetCfg::addCtxSet
({
{ 212, 180, 183, 242, },
......@@ -774,6 +820,7 @@ const CtxSet ContextSetCfg::ImvFlag = ContextSetCfg::addCtxSet
{ CNU, 182, CNU, CNU, },
{ 1, 5, 1, 0, },
});
#endif
const CtxSet ContextSetCfg::ctbAlfFlag = ContextSetCfg::addCtxSet
({
......@@ -811,10 +858,17 @@ const CtxSet ContextSetCfg::AlfUseTemporalFilt = ContextSetCfg::addCtxSet
const CtxSet ContextSetCfg::MHIntraFlag = ContextSetCfg::addCtxSet
({
#if JVET_O0249_MERGE_SYNTAX
{ 184, },
{ 184, },
{ 154, },
{ 1, },
#else
{ 184, },
{ 185, },
{ CNU, },
{ 0, },
#endif
});
......
......@@ -209,6 +209,9 @@ public:
static const CtxSet MultiRefLineIdx;
static const CtxSet IntraLumaMpmFlag;
static const CtxSet IntraLumaPlanarFlag;
#if JVET_O1153_INTRA_CHROMAMODE_CODING
static const CtxSet CclmModeFlag;
#endif
static const CtxSet IntraChromaPredMode;
static const CtxSet MipFlag;
static const CtxSet MipMode;
......
......@@ -710,13 +710,25 @@ void InterPrediction::xPredInterBlk ( const ComponentID& compID, const Predictio
dstBuf.buf = m_filteredBlockTmp[2 + m_iRefListIdx][compID] + 2 * dstBuf.stride + 2;
}
#if JVET_O0057_ALTHPELIF
bool useAltHpelIf = pu.cu->imv == IMV_HPEL;
#endif
if( yFrac == 0 )
{
#if JVET_O0057_ALTHPELIF
m_if.filterHor(compID, (Pel*)refBuf.buf, refBuf.stride, dstBuf.buf, dstBuf.stride, backupWidth, backupHeight, xFrac, rndRes, chFmt, clpRng, bilinearMC, bilinearMC, useAltHpelIf);
#else
m_if.filterHor(compID, (Pel*)refBuf.buf, refBuf.stride, dstBuf.buf, dstBuf.stride, backupWidth, backupHeight, xFrac, rndRes, chFmt, clpRng, bilinearMC, bilinearMC);
#endif
}
else if( xFrac == 0 )
{
#if JVET_O0057_ALTHPELIF
m_if.filterVer(compID, (Pel*)refBuf.buf, refBuf.stride, dstBuf.buf, dstBuf.stride, backupWidth, backupHeight, yFrac, true, rndRes, chFmt, clpRng, bilinearMC, bilinearMC, useAltHpelIf);
#else
m_if.filterVer(compID, (Pel*)refBuf.buf, refBuf.stride, dstBuf.buf, dstBuf.stride, backupWidth, backupHeight, yFrac, true, rndRes, chFmt, clpRng, bilinearMC, bilinearMC);
#endif
}
else
{
......@@ -729,9 +741,17 @@ void InterPrediction::xPredInterBlk ( const ComponentID& compID, const Predictio
{
vFilterSize = NTAPS_BILINEAR;
}
#if JVET_O0057_ALTHPELIF
m_if.filterHor(compID, (Pel*)refBuf.buf - ((vFilterSize >> 1) - 1) * refBuf.stride, refBuf.stride, tmpBuf.buf, tmpBuf.stride, backupWidth, backupHeight + vFilterSize - 1, xFrac, false, chFmt, clpRng, bilinearMC, bilinearMC, useAltHpelIf);
#else
m_if.filterHor(compID, (Pel*)refBuf.buf - ((vFilterSize >> 1) - 1) * refBuf.stride, refBuf.stride, tmpBuf.buf, tmpBuf.stride, backupWidth, backupHeight + vFilterSize - 1, xFrac, false, chFmt, clpRng, bilinearMC, bilinearMC);
#endif
JVET_J0090_SET_CACHE_ENABLE( false );
#if JVET_O0057_ALTHPELIF
m_if.filterVer(compID, (Pel*)tmpBuf.buf + ((vFilterSize >> 1) - 1) * tmpBuf.stride, tmpBuf.stride, dstBuf.buf, dstBuf.stride, backupWidth, backupHeight, yFrac, false, rndRes, chFmt, clpRng, bilinearMC, bilinearMC, useAltHpelIf);
#else
m_if.filterVer(compID, (Pel*)tmpBuf.buf + ((vFilterSize >> 1) - 1) * tmpBuf.stride, tmpBuf.stride, dstBuf.buf, dstBuf.stride, backupWidth, backupHeight, yFrac, false, rndRes, chFmt, clpRng, bilinearMC, bilinearMC);
#endif
}
JVET_J0090_SET_CACHE_ENABLE( srcPadStride == 0 ); // Enabled only in non-DMVR process, In DMVR process, srcPadStride is always non-zero
if (bioApplied && compID == COMPONENT_Y)
......@@ -1197,13 +1217,21 @@ void InterPrediction::xWeightedAverage(const PredictionUnit& pu, const CPelUnitB
if( iRefIdx0 >= 0 && iRefIdx1 >= 0 )
{
#if JVET_O0681_DIS_BPWA_CIIP
if( pu.cu->GBiIdx != GBI_DEFAULT && (yuvDstTmp || !pu.mhIntraFlag) )
#else
if( pu.cu->GBiIdx != GBI_DEFAULT )
#endif
{
CHECK(bioApplied, "GBi is disallowed with BIO");
pcYuvDst.addWeightedAvg(pcYuvSrc0, pcYuvSrc1, clpRngs, pu.cu->GBiIdx);
#if JVET_O0108_DIS_DMVR_BDOF_CIIP
if (yuvDstTmp)
#if JVET_O0681_DIS_BPWA_CIIP
yuvDstTmp->addAvg(pcYuvSrc0, pcYuvSrc1, clpRngs, false);
#else
yuvDstTmp->copyFrom(pcYuvDst);
#endif
#endif
return;
}
......
......@@ -94,6 +94,9 @@ const TFilterCoeff InterpolationFilter::m_lumaFilter[LUMA_INTERPOLATION_FILTER_S
{ 0, 1, -2, 4, 63, -3, 1, 0 }
};
#if JVET_O0057_ALTHPELIF
const TFilterCoeff InterpolationFilter::m_lumaAltHpelIFilter[NTAPS_LUMA] = { 0, 3, 9, 20, 20, 9, 3, 0 };
#endif
const TFilterCoeff InterpolationFilter::m_chromaFilter[CHROMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS][NTAPS_CHROMA] =
{
{ 0, 64, 0, 0 },
......@@ -577,7 +580,11 @@ void InterpolationFilter::filterVer(const ClpRng& clpRng, Pel const *src, int sr
* \param fmt Chroma format
* \param bitDepth Bit depth
*/
#if JVET_O0057_ALTHPELIF
void InterpolationFilter::filterHor(const ComponentID compID, Pel const *src, int srcStride, Pel *dst, int dstStride, int width, int height, int frac, bool isLast, const ChromaFormat fmt, const ClpRng& clpRng, int nFilterIdx, bool biMCForDMVR, bool useAltHpelIf)
#else
void InterpolationFilter::filterHor( const ComponentID compID, Pel const *src, int srcStride, Pel *dst, int dstStride, int width, int height, int frac, bool isLast, const ChromaFormat fmt, const ClpRng& clpRng, int nFilterIdx, bool biMCForDMVR)
#endif
{
if( frac == 0 )
{
......@@ -592,6 +599,14 @@ void InterpolationFilter::filterHor( const ComponentID compID, Pel const *src, i
}
else
{
#if JVET_O0057_ALTHPELIF
if (frac == 8 && useAltHpelIf)
{
filterHor<NTAPS_LUMA>(clpRng, src, srcStride, dst, dstStride, width, height, isLast, m_lumaAltHpelIFilter, biMCForDMVR);
}
else
#endif
{
if ((width == 4 && height == 4) || (width == 4 && height == (4 + NTAPS_LUMA - 1)))
{
filterHor<NTAPS_LUMA>(clpRng, src, srcStride, dst, dstStride, width, height, isLast, m_lumaFilter4x4[frac], biMCForDMVR);
......@@ -602,6 +617,7 @@ void InterpolationFilter::filterHor( const ComponentID compID, Pel const *src, i
}
}
}
}
else
{
const uint32_t csx = getComponentScaleX( compID, fmt );
......@@ -627,7 +643,11 @@ void InterpolationFilter::filterHor( const ComponentID compID, Pel const *src, i
* \param fmt Chroma format
* \param bitDepth Bit depth
*/
#if JVET_O0057_ALTHPELIF
void InterpolationFilter::filterVer(const ComponentID compID, Pel const *src, int srcStride, Pel *dst, int dstStride, int width, int height, int frac, bool isFirst, bool isLast, const ChromaFormat fmt, const ClpRng& clpRng, int nFilterIdx, bool biMCForDMVR, bool useAltHpelIf)
#else
void InterpolationFilter::filterVer( const ComponentID compID, Pel const *src, int srcStride, Pel *dst, int dstStride, int width, int height, int frac, bool isFirst, bool isLast, const ChromaFormat fmt, const ClpRng& clpRng, int nFilterIdx, bool biMCForDMVR)
#endif
{
if( frac == 0 )
{
......@@ -642,6 +662,14 @@ void InterpolationFilter::filterVer( const ComponentID compID, Pel const *src, i
}
else
{
#if JVET_O0057_ALTHPELIF
if (frac == 8 && useAltHpelIf)
{
filterVer<NTAPS_LUMA>(clpRng, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_lumaAltHpelIFilter, biMCForDMVR);
}
else
#endif
{
if (width == 4 && height == 4)
{
filterVer<NTAPS_LUMA>(clpRng, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_lumaFilter4x4[frac], biMCForDMVR);
......@@ -652,6 +680,7 @@ void InterpolationFilter::filterVer( const ComponentID compID, Pel const *src, i
}
}
}
}
else
{
const uint32_t csy = getComponentScaleY( compID, fmt );
......
......@@ -57,6 +57,9 @@ class InterpolationFilter
{
static const TFilterCoeff m_lumaFilter4x4[LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS][NTAPS_LUMA];
static const TFilterCoeff m_lumaFilter[LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS][NTAPS_LUMA]; ///< Luma filter taps
#if JVET_O0057_ALTHPELIF
static const TFilterCoeff m_lumaAltHpelIFilter[NTAPS_LUMA]; ///< Luma filter taps
#endif
static const TFilterCoeff m_chromaFilter[CHROMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS][NTAPS_CHROMA]; ///< Chroma filter taps
static const TFilterCoeff m_bilinearFilter[LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS][NTAPS_BILINEAR]; ///< bilinear filter taps
static const TFilterCoeff m_bilinearFilterPrec4[LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS][NTAPS_BILINEAR]; ///< bilinear filter taps
......@@ -96,8 +99,13 @@ public:
template <X86_VEXT vext>
void _initInterpolationFilterX86();
#endif
void filterHor(const ComponentID compID, Pel const* src, int srcStride, Pel *dst, int dstStride, int width, int height, int frac, bool isLast, const ChromaFormat fmt, const ClpRng& clpRng, int nFilterIdx = 0, bool biMCForDMVR = false);
#if JVET_O0057_ALTHPELIF
void filterHor(const ComponentID compID, Pel const* src, int srcStride, Pel *dst, int dstStride, int width, int height, int frac, bool isLast, const ChromaFormat fmt, const ClpRng& clpRng, int nFilterIdx = 0, bool biMCForDMVR = false, bool useAltHpelIf = false);
void filterVer(const ComponentID compID, Pel const* src, int srcStride, Pel *dst, int dstStride, int width, int height, int frac, bool isFirst, bool isLast, const ChromaFormat fmt, const ClpRng& clpRng, int nFilterIdx = 0, bool biMCForDMVR = false, bool useAltHpelIf = false);
#else
void filterHor(const ComponentID compID, Pel const* src, int srcStride, Pel *dst, int dstStride, int width, int height, int frac, bool isLast, const ChromaFormat fmt, const ClpRng& clpRng, int nFilterIdx = 0, bool biMCForDMVR = false);
void filterVer(const ComponentID compID, Pel const* src, int srcStride, Pel *dst, int dstStride, int width, int height, int frac, bool isFirst, bool isLast, const ChromaFormat fmt, const ClpRng& clpRng, int nFilterIdx = 0, bool biMCForDMVR = false);
#endif
#if JVET_J0090_MEMORY_BANDWITH_MEASURE
void cacheAssign( CacheModel *cache ) { m_cacheModel = cache; }
#endif
......
This diff is collapsed.
......@@ -63,12 +63,18 @@
// Tables
// ====================================================================================================================
#if JVET_O0159_10BITTCTABLE_DEBLOCKING
const uint16_t LoopFilter::sm_tcTable[MAX_QP + 1 + DEFAULT_INTRA_TC_OFFSET] =
{
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,4,4,4,4,5,5,5,5,7,7,8,9,10,10,11,13,14,15,17,19,21,24,25,29,33,36,41,45,51,57,64,71,80,89,100,112,125,141,157,177,198,222,250,280,314,352,395
};
#else
const uint8_t LoopFilter::sm_tcTable[MAX_QP + 1 + DEFAULT_INTRA_TC_OFFSET] =
{
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,5,5,6,6,7,8,9,10,11,13,14,16,18,20,22,25
, 28, 31, 35, 39, 44, 50, 56, 63, 70, 79, 88, 99
};
#endif
const uint8_t LoopFilter::sm_betaTable[MAX_QP + 1] =
{
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,8,9,10,11,12,13,14,15,16,17,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64
......@@ -364,6 +370,7 @@ void LoopFilter::xDeblockCU( CodingUnit& cu, const DeblockEdgeDir edgeDir )
}
}
#if !JVET_O0060_4x4_deblocking
if (edgeDir == EDGE_HOR)
{
if (!((cu.block(COMPONENT_Y).y % 8) == 0))
......@@ -374,7 +381,7 @@ void LoopFilter::xDeblockCU( CodingUnit& cu, const DeblockEdgeDir edgeDir )
if (!((cu.block(COMPONENT_Y).x % 8) == 0))
return;
}
#endif
std::sort( edgeIdx.begin(), edgeIdx.end() );
int prevEdgeIdx = -1;
......@@ -472,8 +479,22 @@ void LoopFilter::xSetMaxFilterLengthPQFromTransformSizes( const DeblockEdgeDir e
if ( comp == COMPONENT_Y )
{
#if JVET_O0060_4x4_deblocking
bool smallBlock = (sizePSide <= 4) || (sizeQSide <= 4);
if (smallBlock)
{
m_maxFilterLengthQ[cIdx][ctuXOff + x][ctuYOff] = 1;
m_maxFilterLengthP[cIdx][ctuXOff + x][ctuYOff] = 1;
}
else
{
m_maxFilterLengthQ[cIdx][ctuXOff + x][ctuYOff] = (sizeQSide >= 32) ? 7 : 3;
m_maxFilterLengthP[cIdx][ctuXOff + x][ctuYOff] = (sizePSide >= 32) ? 7 : 3;
}
#else
m_maxFilterLengthQ[cIdx][ctuXOff+x][ctuYOff] = ( sizeQSide >= 32 ) ? 7 : 3;
m_maxFilterLengthP[cIdx][ctuXOff+x][ctuYOff] = ( sizePSide >= 32 ) ? 7 : 3;
#endif
}
else
{
......@@ -508,8 +529,22 @@ void LoopFilter::xSetMaxFilterLengthPQFromTransformSizes( const DeblockEdgeDir e
if ( comp == COMPONENT_Y )
{
#if JVET_O0060_4x4_deblocking
bool smallBlock = (sizePSide <= 4) || (sizeQSide <= 4);
if (smallBlock)
{
m_maxFilterLengthQ[cIdx][ctuXOff][ctuYOff + y] = 1;
m_maxFilterLengthP[cIdx][ctuXOff][ctuYOff + y] = 1;
}
else
{
m_maxFilterLengthQ[cIdx][ctuXOff][ctuYOff + y] = (sizeQSide >= 32) ? 7 : 3;
m_maxFilterLengthP[cIdx][ctuXOff][ctuYOff + y] = (sizePSide >= 32) ? 7 : 3;
}
#else
m_maxFilterLengthQ[cIdx][ctuXOff][ctuYOff+y] = ( sizeQSide >= 32 ) ? 7 : 3;
m_maxFilterLengthP[cIdx][ctuXOff][ctuYOff+y] = ( sizePSide >= 32 ) ? 7 : 3;
#endif
}
else
{
......@@ -546,6 +581,13 @@ void LoopFilter::xSetMaxFilterLengthPQForCodingSubBlocks( const DeblockEdgeDir e
m_maxFilterLengthP[cIdx][ctuXOff+x][ctuYOff+y] = std::min<int>(m_maxFilterLengthP[cIdx][ctuXOff+x][ctuYOff+y], 5);
}
}
#if JVET_O0060_4x4_deblocking
else if (y > 0 && (m_transformEdge[cIdx][ctuXOff + x][ctuYOff + y - 4] || ((y + 4) >= areaPu.height) || m_transformEdge[cIdx][ctuXOff + x][ctuYOff + y + 4])) // adjacent to transform edge +/- 4
{
m_maxFilterLengthQ[cIdx][ctuXOff + x][ctuYOff + y] = 1;
m_maxFilterLengthP[cIdx][ctuXOff + x][ctuYOff + y] = 1;
}
#endif
else if (y > 0 && ( m_transformEdge[cIdx][ctuXOff+x][ctuYOff+y-8] || (( y + 8 ) >= areaPu.height) || m_transformEdge[cIdx][ctuXOff+x][ctuYOff+y+8] )) // adjacent to transform edge on 8x8 grid
{
m_maxFilterLengthQ[cIdx][ctuXOff+x][ctuYOff+y] = 2;
......@@ -573,6 +615,13 @@ void LoopFilter::xSetMaxFilterLengthPQForCodingSubBlocks( const DeblockEdgeDir e
m_maxFilterLengthP[cIdx][ctuXOff+x][ctuYOff+y] = std::min<int>(m_maxFilterLengthP[cIdx][ctuXOff+x][ctuYOff+y], 5);
}
}
#if JVET_O0060_4x4_deblocking
else if (x > 0 && (m_transformEdge[cIdx][ctuXOff + x - 4][ctuYOff + y] || ((x + 4) >= areaPu.width) || m_transformEdge[cIdx][ctuXOff + x + 4][ctuYOff + y])) // adjacent to transform edge +/- 4
{
m_maxFilterLengthQ[cIdx][ctuXOff + x][ctuYOff + y] = 1;
m_maxFilterLengthP[cIdx][ctuXOff + x][ctuYOff + y] = 1;
}
#endif
else if ( x > 0 && ( m_transformEdge[cIdx][ctuXOff+x-8][ctuYOff+y] || ( (x + 8) >= areaPu.width ) || m_transformEdge[cIdx][ctuXOff+x+8][ctuYOff+y] ) ) // adjacent to transform edge on 8x8 grid
{
m_maxFilterLengthQ[cIdx][ctuXOff+x][ctuYOff+y] = 2;
......@@ -722,7 +771,11 @@ unsigned LoopFilter::xGetBoundaryStrengthSingle ( const CodingUnit& cu, const De
if( 0 <= miQ.refIdx[0] ) { mvQ0 = miQ.mv[0]; }
if( 0 <= miQ.refIdx[1] ) { mvQ1 = miQ.mv[1]; }
#if JVET_O0061_MV_THR_DEBLOCKING
int nThreshold = (1 << MV_FRACTIONAL_BITS_INTERNAL) >> 1;
#else
int nThreshold = 1 << MV_FRACTIONAL_BITS_INTERNAL;
#endif
unsigned uiBs = 0;
//th can be optimized
......@@ -774,7 +827,11 @@ unsigned LoopFilter::xGetBoundaryStrengthSingle ( const CodingUnit& cu, const De
Mv mvP0 = miP.mv[0];
Mv mvQ0 = miQ.mv[0];
#if JVET_O0061_MV_THR_DEBLOCKING
int nThreshold = (1 << MV_FRACTIONAL_BITS_INTERNAL) >> 1;
#else
int nThreshold = 1 << MV_FRACTIONAL_BITS_INTERNAL;
#endif
return ( ( abs( mvQ0.getHor() - mvP0.getHor() ) >= nThreshold ) || ( abs( mvQ0.getVer() - mvP0.getVer() ) >= nThreshold ) ) ? (tmpBs + 1) : tmpBs;
}
......@@ -866,6 +923,17 @@ void LoopFilter::xEdgeFilterLuma( const CodingUnit& cu, const DeblockEdgeDir edg
pos.x += xoffset;
pos.y += yoffset;
#if JVET_O0060_4x4_deblocking
// Deblock luma boundaries on 4x4 grid only
if (edgeDir == EDGE_HOR && (pos.y % 4) != 0)
{
continue;
}
if (edgeDir == EDGE_VER && (pos.x % 4) != 0)
{
continue;
}
#else
// Deblock luma boundaries on 8x8 grid only
if ( edgeDir == EDGE_HOR && ( pos.y % 8 ) != 0 )
{
......@@ -875,7 +943,7 @@ void LoopFilter::xEdgeFilterLuma( const CodingUnit& cu, const DeblockEdgeDir edg
{
continue;
}
#endif
uiBsAbsIdx = getRasterIdx( pos, pcv );
uiBs = BsGet(m_aapucBS[edgeDir][uiBsAbsIdx], COMPONENT_Y);
......@@ -932,7 +1000,11 @@ void LoopFilter::xEdgeFilterLuma( const CodingUnit& cu, const DeblockEdgeDir edg
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));
#if JVET_O0159_10BITTCTABLE_DEBLOCKING
const int iTc = bitDepthLuma < 10 ? ((sm_tcTable[iIndexTC] + 2) >> (10 - bitDepthLuma)) : ((sm_tcTable[iIndexTC]) << (bitDepthLuma - 10));
#else
const int iTc = sm_tcTable [iIndexTC] * iBitdepthScale;
#endif
const int iBeta = sm_betaTable[iIndexB ] * iBitdepthScale;
const int iSideThreshold = ( iBeta + ( iBeta >> 1 ) ) >> 3;
const int iThrCut = iTc * 10;
......@@ -1032,8 +1104,18 @@ void LoopFilter::xEdgeFilterLuma( const CodingUnit& cu, const DeblockEdgeDir edg
if( d < iBeta )
{
#if JVET_O0060_4x4_deblocking
bool bFilterP = false;
bool bFilterQ = false;
if (maxFilterLengthP > 1 && maxFilterLengthQ > 1)
{
bFilterP = (dp < iSideThreshold);
bFilterQ = (dq < iSideThreshold);
}
#else
const bool bFilterP = (dp < iSideThreshold);
const bool bFilterQ = (dq < iSideThreshold);
#endif
bool sw = false;
if (maxFilterLengthP > 2 && maxFilterLengthQ > 2)
{
......@@ -1209,8 +1291,11 @@ void LoopFilter::xEdgeFilterChroma(const CodingUnit& cu, const DeblockEdgeDir ed
}
const int iIndexTC = Clip3<int>(0, MAX_QP + DEFAULT_INTRA_TC_OFFSET, iQP + DEFAULT_INTRA_TC_OFFSET * (bS[chromaIdx] - 1) + (tcOffsetDiv2 << 1));
#if JVET_O0159_10BITTCTABLE_DEBLOCKING
const int iTc = sps.getBitDepth(CHANNEL_TYPE_CHROMA) < 10 ? ((sm_tcTable[iIndexTC] + 2) >> (10 - sps.getBitDepth(CHANNEL_TYPE_CHROMA))) : ((sm_tcTable[iIndexTC]) << (sps.getBitDepth(CHANNEL_TYPE_CHROMA) - 10));
#else
const int iTc = sm_tcTable[iIndexTC] * iBitdepthScale;
#endif
bool useLongFilter = false;
if (largeBoundary)
{
......
......@@ -101,7 +101,11 @@ private:
inline int xCalcDP ( Pel* piSrc, const int iOffset ) const;
inline int xCalcDQ ( Pel* piSrc, const int iOffset ) const;
#if JVET_O0159_10BITTCTABLE_DEBLOCKING
static const uint16_t sm_tcTable[MAX_QP + 3];
#else
static const uint8_t sm_tcTable[MAX_QP + 3];
#endif
static const uint8_t sm_betaTable[MAX_QP + 1];
public:
......
......@@ -103,14 +103,25 @@ struct MotionInfo
bool isInter;
bool isIBCmot;
char interDir;
#if JVET_O0057_ALTHPELIF
bool useAltHpelIf;
#endif
uint16_t sliceIdx;
Mv mv [ NUM_REF_PIC_LIST_01 ];
int16_t refIdx [ NUM_REF_PIC_LIST_01 ];
uint8_t GBiIdx;
Mv bv;
#if JVET_O0057_ALTHPELIF
MotionInfo() : isInter(false), isIBCmot(false), interDir(0), useAltHpelIf(false), sliceIdx(0), refIdx{ NOT_VALID, NOT_VALID }, GBiIdx(0) { }
#else
MotionInfo() : isInter(false), isIBCmot(false), interDir(0), sliceIdx(0), refIdx{ NOT_VALID, NOT_VALID }, GBiIdx(0) { }
#endif
// ensure that MotionInfo(0) produces '\x000....' bit pattern - needed to work with AreaBuf - don't use this constructor for anything else
#if JVET_O0057_ALTHPELIF
MotionInfo(int i) : isInter(i != 0), isIBCmot(false), interDir(0), useAltHpelIf(false), sliceIdx(0), refIdx{ 0, 0 }, GBiIdx(0) { CHECKD(i != 0, "The argument for this constructor has to be '0'"); }
#else
MotionInfo(int i) : isInter(i != 0), isIBCmot(false), interDir(0), sliceIdx(0), refIdx{ 0, 0 }, GBiIdx(0) { CHECKD(i != 0, "The argument for this constructor has to be '0'"); }
#endif
bool operator==( const MotionInfo& mi ) const
{
......
......@@ -40,7 +40,11 @@
#include "Common.h"
#include "Slice.h"
#if JVET_O0057_ALTHPELIF
const MvPrecision Mv::m_amvrPrecision[4] = { MV_PRECISION_QUARTER, MV_PRECISION_INT, MV_PRECISION_4PEL, MV_PRECISION_HALF }; // for cu.imv=0, 1, 2 and 3
#else
const MvPrecision Mv::m_amvrPrecision[3] = { MV_PRECISION_QUARTER, MV_PRECISION_INT, MV_PRECISION_4PEL }; // for cu.imv=0, 1 and 2
#endif
const MvPrecision Mv::m_amvrPrecAffine[3] = { MV_PRECISION_QUARTER, MV_PRECISION_SIXTEENTH, MV_PRECISION_INT }; // for cu.imv=0, 1 and 2
const MvPrecision Mv::m_amvrPrecIbc[3] = { MV_PRECISION_INT, MV_PRECISION_INT, MV_PRECISION_4PEL }; // for cu.imv=0, 1 and 2
......
......@@ -61,7 +61,11 @@ enum MvPrecision
class Mv
{
private:
#if JVET_O0057_ALTHPELIF
static const MvPrecision m_amvrPrecision[4];
#else
static const MvPrecision m_amvrPrecision[3];
#endif
static const MvPrecision m_amvrPrecAffine[3];
static const MvPrecision m_amvrPrecIbc[3];
......
......@@ -1423,6 +1423,10 @@ SPS::SPS()
#if MAX_TB_SIZE_SIGNALLING
, m_log2MaxTbSize ( 6)
#endif
#if JVET_O0244_DELTA_POC
, m_useWeightPred (false)
, m_useWeightedBiPred (false)
#endif
, m_saoEnabledFlag (false)
, m_bTemporalIdNestingFlag (false)
, m_scalingListEnabledFlag (false)
......
......@@ -751,6 +751,10 @@ private:
#if MAX_TB_SIZE_SIGNALLING
uint32_t m_log2MaxTbSize;
#endif
#if JVET_O0244_DELTA_POC
bool m_useWeightPred; //!< Use of Weighting Prediction (P_SLICE)
bool m_useWeightedBiPred; //!< Use of Weighting Bi-Prediction (B_SLICE)
#endif
bool m_saoEnabledFlag;
......@@ -1050,6 +1054,13 @@ public:
bool getUseTriangle () const { return m_Triangle; }
void setUseMIP ( bool b ) { m_MIP = b; }
bool getUseMIP () const { return m_MIP; }
#if JVET_O0244_DELTA_POC
bool getUseWP () const { return m_useWeightPred; }
bool getUseWPBiPred () const { return m_useWeightedBiPred; }
void setUseWP ( bool b ) { m_useWeightPred = b; }
void setUseWPBiPred ( bool b ) { m_useWeightedBiPred = b; }
#endif
};
......
......@@ -1231,7 +1231,7 @@ void TrQuant::transformNxN( TransformUnit &tu, const ComponentID &compID, const
void TrQuant::xGetCoeffEnergy( TransformUnit &tu, const ComponentID &compID, const CoeffBuf& coeffs, double* diagRatio, double* horVerRatio )
{
if( nullptr == diagRatio || nullptr == horVerRatio ) return;
if( tu.cu->predMode == MODE_INTRA && !tu.cu->ispMode && isLuma( compID ) && tu.cs->sps->getUseISP() && CU::canUseISPSplit( *tu.cu, compID ) != NOT_INTRA_SUBPARTITIONS )
if( tu.cu->predMode == MODE_INTRA && !tu.cu->ispMode && isLuma( compID ) && tu.cs->sps->getUseISP() && CU::canUseISP( *tu.cu, compID ) )
{
const int width = tu.cu->blocks[compID].width;
const int height = tu.cu->blocks[compID].height;
......
......@@ -50,6 +50,32 @@
#include <assert.h>
#include <cassert>
#define JVET_O0213_RESTRICT_LFNST_TO_MAX_TB_SIZE 1 // JVET-O0213: Block size restriction of LFNST to maximum transform size
#define JVET_O0244_DELTA_POC 1 // JVET-O0244: weighted prediction in SPS and delta POC
#define JVET_O1153_INTRA_CHROMAMODE_CODING 1 //JVET-O1153: simplified intra chromamode coding
#define JVET_O0159_10BITTCTABLE_DEBLOCKING 1 // tc table for 10-bit video
#define JVET_O0061_MV_THR_DEBLOCKING 1 // a deblocking mv threshold of half pel
#define JVET_O0220_METHOD1_SUBBLK_FLAG_PARSING 1 // JVET-O0220 method-1: Parse merge_subblock_flag conditioned on MaxNumSubblockMergeCand
#define JVET_O0263_O0220_SUBBLOCK_SYNTAX_CLEANUP 1 // JVET-O0263/ JVET-O0220: Syntax cleanup on subblock merge
#define JVET_O0060_4x4_deblocking 1 // deblock on 4x4 grid
#define JVET_O0046_DQ_SIGNALLING 1 // JVET-O0046: Move delta-QP earlier for 64x64 VPDU processing, applied to CUs >64x64 only
#define JVET_O0616_400_CHROMA_SUPPORT 1 // JVET-O0616: Various chroma format support in VVC
#define JVET_O0265_TPM_SIMPLIFICATION 1 // JVET-O0265/JVET-O0629/JVET-O0418/JVET-O0329/JVET-O0378/JVET-O0411/JVET-O0279:Simplified motion field storage for TPM
#define JVET_O0409_EXCLUDE_CODED_SUB_BLK_FLAG_FROM_COUNT 1 // JVET-O0409: exclude coded_subblock_flag from counting context-coded bins in transform skip
#define JVET_O0057_ALTHPELIF 1 //AMVR_HPEL
#define JVET_O1136_TS_BDPCM_SIGNALLING 1 // JVET-O1136: Unified syntax for JVET-O0165/O0200/O0783 on TS and BDPCM signalling
#define JVET_O0219_LFNST_TRANSFORM_SET_FOR_LMCMODE 1
......@@ -112,6 +138,8 @@
#define JVET_O0669_REMOVE_ALF_COEFF_PRED 1 // JVET-O0425/O0427/O0669: remove prediction in ALF coefficients coding
#define JVET_O0545_MAX_TB_SIGNALLING 1 // JVET-O0545: Configurable maximum transform size
#define JVET_O0541_IMPLICIT_MTS_CONDITION 1 // JVET_O0541: Decouple the intra implicit transform selection from an inter MTS related SPS flag
#define JVET_O0163_REMOVE_SWITCHING_TMV 1 // JVET-O0163/JVET-O0588: Remove switching between L0 and L1 for temporal MV
#define JVET_O0655_422_CHROMA_DM_MAPPING_FIX 1 // JVET-O0655: modify chroma DM derivation table for 4:2:2 chroma format
......@@ -138,6 +166,9 @@
#define JVET_O0280_SIMD_TRIANGLE_WEIGHTING 1 // JVET-O0280: SIMD implementation for weighted sample prediction process of triangle prediction mode
#define JVET_O0379_SPEEDUP_TPM_ENCODER 1 // JVET_O0379: Speedup mode decision process for triangle prediction mode
#define JVET_O0364_PADDING 1 // JVET-O0364 Part 2: clean up padding process in intra prediction
#define JVET_O0364_PDPC_DC 1 // JVET-O0364 Part 4: align PDPC process for DC with the one for Planar
#define JVET_O0364_PDPC_ANGULAR 1 // JVET-O0364 Part 5: simplify PDPC process for angular modes
......@@ -161,9 +192,12 @@
#define JVET_O0596_CBF_SIG_ALIGN_TO_SPEC 1 // JVET-O0596 align cbf signaling with specification
#define JVET_O0193_REMOVE_TR_DEPTH_IN_CBF_CTX 1 // JVET-O0193/JVET-O0375: remove transform depth in cbf context modeling
#define JVET_O0681_DIS_BPWA_CIIP 1 // JVET-O0681 disable BCW for CIIP, method 2 inherit BCW index
#define JVET_O0249_MERGE_SYNTAX 1 // JVET-O0249: merge syntax change
#define JVET_O0594_BDOF_REF_SAMPLE_PADDING 1 // JVET-O0594/O0252/O0506/O0615/O0624: BDOF reference sample padding using the nearest integer sample position
#define JVET_O0472_LFNST_SIGNALLING_LAST_SCAN_POS 1 // JVET-O0472: LFNST index signalling depends on the position of last significant coefficient
#define FIX_DB_MAX_TRANSFORM_SIZE 1
#define MRG_SHARELIST_SHARSIZE 32
......@@ -173,7 +207,11 @@
#define APPLY_SBT_SL_ON_MTS 1 // apply save & load fast algorithm on inter MTS when SBT is on
#define FIX_PCM 1 // Fix PCM bugs in VTM3
#if JVET_O0545_MAX_TB_SIGNALLING
#define MAX_TB_SIZE_SIGNALLING 1
#else
#define MAX_TB_SIZE_SIGNALLING 0
#endif
#define EMULATION_PREVENTION_FIX 1 // fix for start code emulation reported in #270. Diverges from specification text
......@@ -186,8 +224,10 @@ typedef std::pair<int, int> TrCost;
#define REUSE_CU_RESULTS 1
#if REUSE_CU_RESULTS
#define REUSE_CU_RESULTS_WITH_MULTIPLE_TUS 1
#if !JVET_O0545_MAX_TB_SIGNALLING
#define MAX_NUM_TUS 4
#endif
#endif
// clang-format on
......@@ -426,8 +466,7 @@ enum ISPType
NOT_INTRA_SUBPARTITIONS = 0,
HOR_INTRA_SUBPARTITIONS = 1,
VER_INTRA_SUBPARTITIONS = 2,
NUM_INTRA_SUBPARTITIONS_MODES = 3,
CAN_USE_VER_AND_HORL_SPLITS = 4
NUM_INTRA_SUBPARTITIONS_MODES = 3
};
enum SbtIdx
......@@ -951,8 +990,14 @@ enum EncModeFeature
enum ImvMode
{
IMV_OFF = 0,
#if JVET_O0057_ALTHPELIF
IMV_FPEL,
IMV_4PEL,
IMV_HPEL,
#else
IMV_DEFAULT,
IMV_4PEL,
#endif
NUM_IMV_MODES
};
......
......@@ -1005,9 +1005,15 @@ static const int g_zScanToY[1 << ( g_maxRtGridSize << 1 )] =
0, 0, 1, 1, 0, 0, 1, 1,
2, 2, 3, 3, 2, 2, 3, 3,
4, 4, 5, 5, 4, 4, 5, 5,
#if JVET_O0545_MAX_TB_SIGNALLING
6, 6, 7, 7, 6, 6, 7, 7,
4, 4, 5, 5, 4, 4, 5, 5,
6, 6, 7, 7, 6, 6, 7, 7,
#else
6, 6, 7, 7, 6, 5, 7, 7,
4, 4, 5, 5, 4, 4, 5, 5,
6, 6, 7, 7, 6, 5, 7, 7,
#endif
};
static const int g_rsScanToZ[1 << ( g_maxRtGridSize << 1 )] =
{
......@@ -1025,11 +1031,16 @@ Partitioning PartitionerImpl::getMaxTuTiling( const UnitArea &cuArea, const Codi
{
static_assert( MAX_LOG2_DIFF_CU_TR_SIZE <= g_maxRtGridSize, "Z-scan tables are only provided for MAX_LOG2_DIFF_CU_TR_SIZE for up to 3 (8x8 tiling)!" );
#if JVET_O0545_MAX_TB_SIGNALLING
const Size area = cuArea.lumaSize();
const int maxTrSize = (area.width>64 || area.height>64) ? 64 : cs.sps->getMaxTbSize();
#else
const CompArea area = cuArea.Y().valid() ? cuArea.Y() : cuArea.Cb();
#if MAX_TB_SIZE_SIGNALLING
const int maxTrSize = cs.sps->getMaxTbSize() >> ( isLuma( area.compID ) ? 0 : 1 );
#else
const int maxTrSize = MAX_TB_SIZEY >> ( isLuma( area.compID ) ? 0 : 1 );
#endif
#endif
const int numTilesH = std::max<int>( 1, area.width / maxTrSize );
const int numTilesV = std::max<int>( 1, area.height / maxTrSize );
......
This diff is collapsed.
......@@ -78,7 +78,9 @@ namespace CU
PartSplit getSplitAtDepth (const CodingUnit& cu, const unsigned depth);
bool hasNonTsCodedBlock (const CodingUnit& cu);
#if !JVET_O0472_LFNST_SIGNALLING_LAST_SCAN_POS
uint32_t getNumNonZeroCoeffNonTs ( const CodingUnit& cu, const bool lumaFlag = true, const bool chromaFlag = true );
#endif
uint32_t getNumNonZeroCoeffNonTsCorner8x8( const CodingUnit& cu, const bool lumaFlag = true, const bool chromaFlag = true );
#if JVET_O0106_ISP_4xN_PREDREG_FOR_1xN_2xN
bool isPredRegDiffFromTB(const CodingUnit& cu, const ComponentID compID);
......@@ -98,8 +100,8 @@ namespace CU
PartSplit getISPType ( const CodingUnit &cu, const ComponentID compID );
bool isISPLast ( const CodingUnit &cu, const CompArea &tuArea, const ComponentID compID );
bool isISPFirst ( const CodingUnit &cu, const CompArea &tuArea, const ComponentID compID );
ISPType canUseISPSplit ( const CodingUnit &cu, const ComponentID compID );
ISPType canUseISPSplit ( const int width, const int height, const int maxTrSize = MAX_TB_SIZEY );
bool canUseISP ( const CodingUnit &cu, const ComponentID compID );
bool canUseISP ( const int width, const int height, const int maxTrSize = MAX_TB_SIZEY );
uint32_t getISPSplitDim ( const int width, const int height, const PartSplit ispType );
PUTraverser traversePUs ( CodingUnit& cu);
......@@ -127,7 +129,7 @@ namespace CU
// PU tools
namespace PU
{
int getLMSymbolList(const PredictionUnit &pu, int *pModeList);
int getLMSymbolList(const PredictionUnit &pu, int *modeList);
int getIntraMPMs(const PredictionUnit &pu, unsigned *mpm, const ChannelType &channelType = CHANNEL_TYPE_LUMA);
bool isMIP (const PredictionUnit &pu, const ChannelType &chType = CHANNEL_TYPE_LUMA);
int getMipMPMs (const PredictionUnit &pu, unsigned *mpm);
......@@ -209,7 +211,9 @@ namespace PU
// TU tools
namespace TU
{
#if !JVET_O0472_LFNST_SIGNALLING_LAST_SCAN_POS
uint32_t getNumNonZeroCoeffsNonTS (const TransformUnit &tu, const bool bLuma = true, const bool bChroma = true);
#endif
uint32_t getNumNonZeroCoeffsNonTSCorner8x8( const TransformUnit &tu, const bool bLuma = true, const bool bChroma = true );
bool isNonTransformedResidualRotated(const TransformUnit &tu, const ComponentID &compID);
bool getCbf (const TransformUnit &tu, const ComponentID &compID);
......
This diff is collapsed.
......@@ -137,13 +137,13 @@ public:
void cu_chroma_qp_offset ( CodingUnit& cu );
// residual coding (clause 7.3.8.11)
#if JVET_O0094_LFNST_ZERO_PRIM_COEFFS
#if JVET_O0094_LFNST_ZERO_PRIM_COEFFS || JVET_O0472_LFNST_SIGNALLING_LAST_SCAN_POS
void residual_coding ( TransformUnit& tu, ComponentID compID, CUCtx& cuCtx );
#else
void residual_coding ( TransformUnit& tu, ComponentID compID );
#endif
void mts_coding ( TransformUnit& tu, ComponentID compID );
#if JVET_O0094_LFNST_ZERO_PRIM_COEFFS
#if JVET_O0094_LFNST_ZERO_PRIM_COEFFS || JVET_O0472_LFNST_SIGNALLING_LAST_SCAN_POS
void residual_lfnst_mode ( CodingUnit& cu, CUCtx& cuCtx );
#else
void residual_lfnst_mode ( CodingUnit& cu );
......
......@@ -206,6 +206,10 @@ bool tryDecodePicture( Picture* pcEncPic, const int expectedPoc, const std::stri
{
std::copy( pic->getAlfCtuEnableFlag()[compIdx].begin(), pic->getAlfCtuEnableFlag()[compIdx].end(), pcEncPic->getAlfCtuEnableFlag()[compIdx].begin() );
}
#if JVET_N0415_CTB_ALF
pcEncPic->resizeAlfCtbFilterIndex(pic->cs->pcv->sizeInCtus);
memcpy( pcEncPic->getAlfCtbFilterIndex(), pic->getAlfCtbFilterIndex(), sizeof(short)*pic->cs->pcv->sizeInCtus );
#endif
#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB
std::copy( pic->getAlfCtuAlternative(COMPONENT_Cb).begin(), pic->getAlfCtuAlternative(COMPONENT_Cb).end(), pcEncPic->getAlfCtuAlternative(COMPONENT_Cb).begin() );
......@@ -955,6 +959,22 @@ void DecLib::xActivateParameterSets()
deleteSEIs(m_SEIs);
}
}
#if JVET_O0244_DELTA_POC
Slice *pSlice = m_pcPic->slices[m_uiSliceSegmentIdx];
const SPS *sps = pSlice->getSPS();
const PPS *pps = pSlice->getPPS();
if( !sps->getUseWP() )
{
CHECK( pps->getUseWP(), "When sps_weighted_pred_flag is equal to 0, the value of pps_weighted_pred_flag shall be equal to 0." );
}
if( !sps->getUseWPBiPred() )
{
CHECK( pps->getWPBiPred(), "When sps_weighted_bipred_flag is equal to 0, the value of pps_weighted_bipred_flag shall be equal to 0." );
}
#endif
}
......
......@@ -309,6 +309,12 @@ void HLSyntaxReader::parseRefPicList(SPS* sps, ReferencePictureList* rpl)
if (!isLongTerm)
{
READ_UVLC(code, "abs_delta_poc_st[ listIdx ][ rplsIdx ][ i ]");
#if JVET_O0244_DELTA_POC
if( !sps->getUseWP() && !sps->getUseWPBiPred() )
{
code++;
}
#endif
int readValue = code;
if (readValue > 0)
READ_FLAG(code, "strp_entry_sign_flag[ listIdx ][ rplsIdx ][ i ]");
......@@ -860,11 +866,11 @@ void HLSyntaxReader::parseAlfAps( APS* aps )
if (param.newFilterFlag[CHANNEL_TYPE_CHROMA])
{
#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB
#if MAX_NUM_ALF_ALTERNATIVES_CHROMA > 1
READ_UVLC( code, "alf_chroma_num_alts_minus1" );
#else
code = 0;
#endif
if( MAX_NUM_ALF_ALTERNATIVES_CHROMA > 1 )
READ_UVLC( code, "alf_chroma_num_alts_minus1" );
else
code = 0;
param.numAlternativesChroma = code + 1;
for( int altIdx=0; altIdx < param.numAlternativesChroma; ++altIdx )
......@@ -1215,8 +1221,16 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
#if MAX_TB_SIZE_SIGNALLING
#if JVET_O0545_MAX_TB_SIGNALLING
READ_UVLC( uiCode, "sps_max_luma_transform_size_64_flag"); pcSPS->setLog2MaxTbSize( uiCode + 5 );
#else
// KJS: Not in syntax
READ_UVLC( uiCode, "log2_max_luma_transform_block_size_minus2" ); pcSPS->setLog2MaxTbSize( uiCode + 2 );
#endif
#endif
#if JVET_O0244_DELTA_POC
READ_FLAG( uiCode, "sps_weighted_pred_flag" ); pcSPS->setUseWP( uiCode ? true : false );
READ_FLAG( uiCode, "sps_weighted_bipred_flag" ); pcSPS->setUseWPBiPred( uiCode ? true : false );
#endif
READ_FLAG( uiCode, "sps_sao_enabled_flag" ); pcSPS->setSAOEnabledFlag ( uiCode ? true : false );
READ_FLAG( uiCode, "sps_alf_enabled_flag" ); pcSPS->setALFEnabledFlag ( uiCode ? true : false );
......@@ -1319,7 +1333,11 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
READ_FLAG(uiCode, "sbt_enable_flag"); pcSPS->setUseSBT(uiCode != 0);
if( pcSPS->getUseSBT() )
{
#if JVET_O0545_MAX_TB_SIGNALLING
READ_FLAG(uiCode, "max_sbt_size_64_flag"); pcSPS->setMaxSbtSize(std::min((int)(1 << pcSPS->getLog2MaxTbSize()), uiCode != 0 ? 64 : 32));
#else
READ_FLAG(uiCode, "max_sbt_size_64_flag"); pcSPS->setMaxSbtSize(uiCode != 0 ? 64 : 32);
#endif
}
// KJS: not in draft yet
READ_FLAG(uiCode, "sps_reshaper_enable_flag"); pcSPS->setUseReshaper(uiCode == 1);
......@@ -1808,7 +1826,18 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para
pcSlice->setAlfAPSs(apsId);
alfChromaIdc = truncatedUnaryEqProb(3); //alf_chroma_idc
#if JVET_O0616_400_CHROMA_SUPPORT
if (bChroma)
{
#endif
alfChromaIdc = truncatedUnaryEqProb(3); //alf_chroma_idc
#if JVET_O0616_400_CHROMA_SUPPORT
}
else
{
alfChromaIdc = 0;
}
#endif
if (alfChromaIdc)
{
#if JVET_O0288_UNIFY_ALF_SLICE_TYPE_REMOVAL
......@@ -2026,12 +2055,19 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para
if (!pcSlice->isIntra())
{
#if JVET_O0263_O0220_SUBBLOCK_SYNTAX_CLEANUP
if (sps->getSBTMVPEnabledFlag() && pcSlice->getEnableTMVPFlag() && !sps->getUseAffine()) // ATMVP only
#else
if ( sps->getSBTMVPEnabledFlag() && !sps->getUseAffine() ) // ATMVP only
#endif
{
pcSlice->setMaxNumAffineMergeCand( 1 );
}
#if JVET_O0263_O0220_SUBBLOCK_SYNTAX_CLEANUP
else if (!(sps->getSBTMVPEnabledFlag() && pcSlice->getEnableTMVPFlag()) && !sps->getUseAffine())// both off