Commit 3d31e775 authored by Yu Han's avatar Yu Han Committed by Xiang Li
Browse files

JVET-N0843 BV simplification

parent cb812080
......@@ -50,6 +50,8 @@
#include <assert.h>
#include <cassert>
#define JVET_N0843_BVP_SIMPLIFICATION 1
#define JVET_N0448_N0380 1 // When MaxNumMergeCand is 1, MMVD_BASE_MV_NUM is inferred to be 1.
#define JVET_N0054_JOINT_CHROMA 1 // Joint chroma residual coding mode
......
......@@ -1069,7 +1069,11 @@ bool PU::addMergeHMVPCand(const CodingStructure &cs, MergeCtx& mrgCtx, bool isCa
{
mrgCtx.mvFieldNeighbours[(cnt << 1) + 1].setMvField(miNeighbor.mv[1], miNeighbor.refIdx[1]);
}
#if JVET_N0843_BVP_SIMPLIFICATION
if (mrgIdx > 2 || (mrgIdx > 1 && ibcFlag) || !xCheckSimilarMotion(cnt, prevCnt, mrgCtx, hasPruned))
#else
if (mrgIdx > 2 || !xCheckSimilarMotion(cnt, prevCnt, mrgCtx, hasPruned))
#endif
{
#if !JVET_L0090_PAIR_AVG
isCandInter[cnt] = true;
......@@ -1110,7 +1114,9 @@ void PU::getIBCMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, const
int cnt = 0;
#if JVET_N0843_BVP_SIMPLIFICATION==0
const Position posLT = pu.shareParentPos;
#endif
const Position posRT = pu.shareParentPos.offset(pu.shareParentSize.width - 1, 0);
const Position posLB = pu.shareParentPos.offset(0, pu.shareParentSize.height - 1);
......@@ -1171,6 +1177,7 @@ void PU::getIBCMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, const
int spatialCandPos = cnt;
#if JVET_N0843_BVP_SIMPLIFICATION==0
// above right
const PredictionUnit *puAboveRight = cs.getPURestricted(posRT.offset(1, -1), pu, pu.chType);
bool isAvailableB0 = puAboveRight && isDiffMER(pu, *puAboveRight) && CU::isIBC(*puAboveRight->cu);
......@@ -1265,8 +1272,13 @@ void PU::getIBCMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, const
{
return;
}
#endif
#if JVET_N0843_BVP_SIMPLIFICATION
int maxNumMergeCandMin1 = maxNumMergeCand;
#else
int maxNumMergeCandMin1 = maxNumMergeCand - 1;
#endif
if (cnt != maxNumMergeCandMin1)
{
bool isAvailableSubPu = false;
......@@ -1295,7 +1307,7 @@ void PU::getIBCMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, const
}
}
#if JVET_L0090_PAIR_AVG
#if JVET_L0090_PAIR_AVG && JVET_N0843_BVP_SIMPLIFICATION==0
// pairwise-average candidates
if (cnt>1 && cnt <maxNumMergeCand)
{
......@@ -2431,12 +2443,15 @@ bool PU::getDerivedBV(PredictionUnit &pu, const Mv& currentMv, Mv& derivedMv)
*/
void PU::fillIBCMvpCand(PredictionUnit &pu, AMVPInfo &amvpInfo)
{
#if JVET_N0843_BVP_SIMPLIFICATION==0
CodingStructure &cs = *pu.cs;
#endif
AMVPInfo *pInfo = &amvpInfo;
pInfo->numCand = 0;
#if JVET_N0843_BVP_SIMPLIFICATION==0
//-- Get Spatial MV
Position posLT = pu.Y().topLeft();
Position posRT = pu.Y().topRight();
......@@ -2504,10 +2519,26 @@ void PU::fillIBCMvpCand(PredictionUnit &pu, AMVPInfo &amvpInfo)
pInfo->mvCand[pInfo->numCand] = Mv(0, 0);
pInfo->numCand++;
}
#endif
#if JVET_N0843_BVP_SIMPLIFICATION
MergeCtx mergeCtx;
PU::getIBCMergeCandidates(pu, mergeCtx, AMVP_MAX_NUM_CANDS - 1);
int candIdx = 0;
while (pInfo->numCand < AMVP_MAX_NUM_CANDS)
{
pInfo->mvCand[pInfo->numCand] = mergeCtx.mvFieldNeighbours[(candIdx << 1) + 0].mv;;
pInfo->numCand++;
candIdx++;
}
#endif
for (Mv &mv : pInfo->mvCand)
{
mv.changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER);
#if JVET_N0843_BVP_SIMPLIFICATION
mv.roundToAmvrSignalPrecision(MV_PRECISION_QUARTER, pu.cu->imv);
#endif
}
}
......
......@@ -713,6 +713,10 @@ void DecCu::xDeriveCUMV( CodingUnit &cu )
}
else
{
#if JVET_N0843_BVP_SIMPLIFICATION
pu.shareParentPos = cu.shareParentPos;
pu.shareParentSize = cu.shareParentSize;
#endif
#if REUSE_CU_RESULTS
if ( cu.imv && !pu.cu->affine && !cu.cs->pcv->isEncoder )
#else
......
......@@ -3121,6 +3121,11 @@ void EncCu::xCheckRDCostIBCMode(CodingStructure *&tempCS, CodingStructure *&best
cu.mmvdSkip = false;
pu.mmvdMergeFlag = false;
#if JVET_N0843_BVP_SIMPLIFICATION
pu.shareParentPos = tempCS->sharedBndPos;
pu.shareParentSize = tempCS->sharedBndSize;
#endif
pu.intraDir[0] = DC_IDX; // set intra pred for ibc block
pu.intraDir[1] = PLANAR_IDX; // set intra pred for ibc block
......
Supports Markdown
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