Commit 18b80dd0 authored by Frank Bossen's avatar Frank Bossen

Merge branch 'master' into 'JVET-O0590-DMVR-Refinement'

# Conflicts:
#   source/Lib/CommonLib/TypeDef.h
parents cf74dbe4 cdf3f9b5
......@@ -52,7 +52,9 @@
#define JVET_O0590_REDUCE_DMVR_ORIG_MV_COST 1 // Reduce the DMVR cost of the original MV
#define JVET_O0429_CRS_LAMBDA_FIX 1 // JVET-O0429: fix encoder lambda rounding used in CRS
#define JVET_O0164_REMOVE_AMVP_SPATIAL_SCALING 1 // JVET-O0164/JVET-O0587: remove spatial AMVP candidate scaling
......
......@@ -2098,6 +2098,7 @@ void PU::fillMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, const in
Position posRT = pu.Y().topRight();
Position posLB = pu.Y().bottomLeft();
#if !JVET_O0164_REMOVE_AMVP_SPATIAL_SCALING
bool isScaledFlagLX = false; /// variable name from specification; true when the PUs below left or left are available (availableA0 || availableA1).
{
......@@ -2113,6 +2114,7 @@ void PU::fillMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, const in
// Left predictor search
if( isScaledFlagLX )
#endif
{
bool bAdded = addMVPCandUnscaled( pu, eRefPicList, refIdx, posLB, MD_BELOW_LEFT, *pInfo );
......@@ -2120,6 +2122,7 @@ void PU::fillMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, const in
{
bAdded = addMVPCandUnscaled( pu, eRefPicList, refIdx, posLB, MD_LEFT, *pInfo );
#if !JVET_O0164_REMOVE_AMVP_SPATIAL_SCALING
if( !bAdded )
{
bAdded = addMVPCandWithScaling( pu, eRefPicList, refIdx, posLB, MD_BELOW_LEFT, *pInfo );
......@@ -2129,6 +2132,7 @@ void PU::fillMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, const in
addMVPCandWithScaling( pu, eRefPicList, refIdx, posLB, MD_LEFT, *pInfo );
}
}
#endif
}
}
......@@ -2147,6 +2151,7 @@ void PU::fillMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, const in
}
}
#if !JVET_O0164_REMOVE_AMVP_SPATIAL_SCALING
if( !isScaledFlagLX )
{
bool bAdded = addMVPCandWithScaling( pu, eRefPicList, refIdx, posRT, MD_ABOVE_RIGHT, *pInfo );
......@@ -2161,6 +2166,7 @@ void PU::fillMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, const in
}
}
}
#endif
for( int i = 0; i < pInfo->numCand; i++ )
{
......@@ -2638,6 +2644,7 @@ bool PU::addMVPCandUnscaled( const PredictionUnit &pu, const RefPicList &eRefPic
return false;
}
#if !JVET_O0164_REMOVE_AMVP_SPATIAL_SCALING
/**
* \param pInfo
* \param eRefPicList
......@@ -2721,6 +2728,7 @@ bool PU::addMVPCandWithScaling( const PredictionUnit &pu, const RefPicList &eRef
return false;
}
#endif
void PU::addAMVPHMVPCand(const PredictionUnit &pu, const RefPicList eRefPicList, const RefPicList eRefPicList2nd, const int currRefPOC, AMVPInfo &info, uint8_t imv)
{
......
......@@ -145,7 +145,9 @@ namespace PU
bool addIBCMVPCand (const PredictionUnit &pu, const Position &pos, const MvpDir &eDir, AMVPInfo &amvpInfo);
void fillAffineMvpCand ( PredictionUnit &pu, const RefPicList &eRefPicList, const int &refIdx, AffineAMVPInfo &affiAMVPInfo);
bool addMVPCandUnscaled (const PredictionUnit &pu, const RefPicList &eRefPicList, const int &iRefIdx, const Position &pos, const MvpDir &eDir, AMVPInfo &amvpInfo);
#if !JVET_O0164_REMOVE_AMVP_SPATIAL_SCALING
bool addMVPCandWithScaling (const PredictionUnit &pu, const RefPicList &eRefPicList, const int &iRefIdx, const Position &pos, const MvpDir &eDir, AMVPInfo &amvpInfo);
#endif
void xInheritedAffineMv ( const PredictionUnit &pu, const PredictionUnit* puNeighbour, RefPicList eRefPicList, Mv rcMv[3] );
bool xCheckSimilarMotion(const int mergeCandIndex, const int prevCnt, const MergeCtx mergeCandList, bool hasPruned[MRG_MAX_NUM_CANDS]);
#if JVET_L0090_PAIR_AVG
......
......@@ -1492,7 +1492,7 @@ void CABACReader::prediction_unit( PredictionUnit& pu, MergeCtx& mrgCtx )
}
else
{
pu.cu->triangle = pu.cu->cs->slice->getSPS()->getUseTriangle() && pu.cu->cs->slice->isInterB() && !pu.cu->affine && !pu.mmvdMergeFlag && !pu.cu->mmvdSkip;
pu.cu->triangle = pu.cu->cs->slice->getSPS()->getUseTriangle() && pu.cu->cs->slice->isInterB() && !pu.cu->affine && !pu.mmvdMergeFlag && !pu.cu->mmvdSkip && pu.cs->slice->getMaxNumTriangleCand() >= 2;
}
if (pu.mmvdMergeFlag)
{
......
......@@ -6399,7 +6399,11 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par
#endif
if (slice.getLmcsEnabledFlag() && m_pcReshape->getCTUFlag() && isChroma(compID) && slice.getLmcsChromaResidualScaleFlag())
{
#if JVET_O0429_CRS_LAMBDA_FIX
double cRescale = (double)(1 << CSCALE_FP_PREC) / (double)(tu.getChromaAdj());
#else
double cRescale = round((double)(1 << CSCALE_FP_PREC) / (double)(tu.getChromaAdj()));
#endif
m_pcTrQuant->setLambda(m_pcTrQuant->getLambda() / (cRescale*cRescale));
}
TCoeff currAbsSum = 0;
......@@ -6635,7 +6639,11 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par
if ( reshape )
{
#if JVET_O0429_CRS_LAMBDA_FIX
double cRescale = (double)(1 << CSCALE_FP_PREC) / (double)(tu.getChromaAdj());
#else
double cRescale = round((double)(1 << CSCALE_FP_PREC) / (double)(tu.getChromaAdj()));
#endif
m_pcTrQuant->setLambda(m_pcTrQuant->getLambda() / (cRescale*cRescale));
cbResi.scaleSignal(tu.getChromaAdj(), 1, tu.cu->cs->slice->clpRng(COMPONENT_Cb));
......
......@@ -1890,7 +1890,11 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp
if (flag && isChroma(compID) && slice.getLmcsChromaResidualScaleFlag() )
{
int cResScaleInv = tu.getChromaAdj();
#if JVET_O0429_CRS_LAMBDA_FIX
double cResScale = (double)(1 << CSCALE_FP_PREC) / (double)cResScaleInv;
#else
double cResScale = round((double)(1 << CSCALE_FP_PREC) / (double)cResScaleInv);
#endif
m_pcTrQuant->setLambda(m_pcTrQuant->getLambda() / (cResScale*cResScale));
if ( !jointCbCr ) // Joint CbCr signal is to be scaled in the case of joint chroma
piResi.scaleSignal(cResScaleInv, 1, tu.cu->cs->slice->clpRng(compID));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment