Commit 0fb3764e authored by Frank Bossen's avatar Frank Bossen

Merge branch 'M0409_ATMVP_FIX' into 'master'

integrated M0409 on ATMVP fix when IBC is on

See merge request jvet/VVCSoftware_VTM!172
parents 607e3ee3 9abcf641
Pipeline #572 passed with stage
......@@ -93,6 +93,8 @@ typedef std::pair<int, int> TrCost;
// clang-format off
#define JVET_M0453_CABAC_ENGINE 1
#define JVET_M0409_ATMVP_FIX 1
#define JVET_L0090_PAIR_AVG 1 // Add pairwise average candidates, replace HEVC combined candidates
#define REUSE_CU_RESULTS 1
// clang-format on
......
......@@ -2730,7 +2730,9 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx
bool isAvailableSubPu = false;
if ( enableSubPuMvp && slice.getEnableTMVPFlag() )
{
#if !JVET_M0409_ATMVP_FIX
int cntIBC = 0;
#endif
MergeCtx mrgCtx = *affMrgCtx.mrgCtx;
bool tmpLICFlag = false;
......@@ -2753,10 +2755,12 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx
mrgCtx.interDirNeighbours[pos] = miLeft.interDir;
// get Mv from Left
#if !JVET_M0409_ATMVP_FIX
if (puLeft->cu->ibc)
{
cntIBC++;
}
#endif
mrgCtx.mvFieldNeighbours[pos << 1].setMvField( miLeft.mv[0], miLeft.refIdx[0] );
if ( slice.isInterB() )
......@@ -2778,10 +2782,12 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx
// get Inter Dir
mrgCtx.interDirNeighbours[pos] = miAbove.interDir;
// get Mv from Left
#if !JVET_M0409_ATMVP_FIX
if (puAbove->cu->ibc)
{
cntIBC++;
}
#endif
mrgCtx.mvFieldNeighbours[pos << 1].setMvField( miAbove.mv[0], miAbove.refIdx[0] );
if ( slice.isInterB() )
......@@ -2809,10 +2815,12 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx
// get Inter Dir
mrgCtx.interDirNeighbours[pos] = miAboveRight.interDir;
// get Mv from Left
#if !JVET_M0409_ATMVP_FIX
if (puAboveRight->cu->ibc)
{
cntIBC++;
}
#endif
mrgCtx.mvFieldNeighbours[pos << 1].setMvField( miAboveRight.mv[0], miAboveRight.refIdx[0] );
if ( slice.isInterB() )
......@@ -2840,10 +2848,12 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx
// get Inter Dir
mrgCtx.interDirNeighbours[pos] = miBelowLeft.interDir;
// get Mv from Bottom-Left
#if !JVET_M0409_ATMVP_FIX
if (puLeftBottom->cu->ibc)
{
cntIBC++;
}
#endif
mrgCtx.mvFieldNeighbours[pos << 1].setMvField( miBelowLeft.mv[0], miBelowLeft.refIdx[0] );
if ( slice.isInterB() )
......@@ -2857,7 +2867,9 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx
isAvailableSubPu = getInterMergeSubPuMvpCand( pu, mrgCtx, tmpLICFlag, pos
, 0
#if !JVET_M0409_ATMVP_FIX
, cntIBC
#endif
);
if ( isAvailableSubPu )
{
......@@ -3280,11 +3292,15 @@ void clipColPos(int& posX, int& posY, const PredictionUnit& pu)
bool PU::getInterMergeSubPuMvpCand(const PredictionUnit &pu, MergeCtx& mrgCtx, bool& LICFlag, const int count
, int mmvdList
#if !JVET_M0409_ATMVP_FIX
, const int countIBC
#endif
)
{
#if !JVET_M0409_ATMVP_FIX
if (count == countIBC && pu.cs->slice->getSPS()->getSpsNext().getIBCMode())
return false;
#endif
const Slice &slice = *pu.cs->slice;
const unsigned scale = 4 * std::max<int>(1, 4 * AMVP_DECIMATION_FACTOR / 4);
const unsigned mask = ~(scale - 1);
......
......@@ -142,7 +142,9 @@ namespace PU
);
bool getInterMergeSubPuMvpCand(const PredictionUnit &pu, MergeCtx &mrgCtx, bool& LICFlag, const int count
, int mmvdList
#if !JVET_M0409_ATMVP_FIX
, const int countIBC
#endif
);
bool getInterMergeSubPuRecurCand(const PredictionUnit &pu, MergeCtx &mrgCtx, const int count);
bool isBiPredFromDifferentDir (const PredictionUnit &pu);
......
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