Commit 3726e7bb authored by Karsten Suehring's avatar Karsten Suehring

remove macro JVET_L0369_SUBBLOCK_MERGE

parent 910aaf87
...@@ -2271,12 +2271,10 @@ bool EncAppCfg::xCheckParameter() ...@@ -2271,12 +2271,10 @@ bool EncAppCfg::xCheckParameter()
xConfirmPara( m_maxNumAffineMergeCand < 1, "MaxNumAffineMergeCand must be 1 or greater." ); xConfirmPara( m_maxNumAffineMergeCand < 1, "MaxNumAffineMergeCand must be 1 or greater." );
xConfirmPara( m_maxNumAffineMergeCand > AFFINE_MRG_MAX_NUM_CANDS, "MaxNumAffineMergeCand must be no more than AFFINE_MRG_MAX_NUM_CANDS." ); xConfirmPara( m_maxNumAffineMergeCand > AFFINE_MRG_MAX_NUM_CANDS, "MaxNumAffineMergeCand must be no more than AFFINE_MRG_MAX_NUM_CANDS." );
#if JVET_L0369_SUBBLOCK_MERGE
if ( m_Affine == 0 ) if ( m_Affine == 0 )
{ {
m_maxNumAffineMergeCand = m_SubPuMvpMode; m_maxNumAffineMergeCand = m_SubPuMvpMode;
} }
#endif
xConfirmPara( m_EMT < 0 || m_EMT >3, "EMT must be 0, 1, 2 or 3" ); xConfirmPara( m_EMT < 0 || m_EMT >3, "EMT must be 0, 1, 2 or 3" );
xConfirmPara( m_FastEMT < 0 || m_FastEMT >3, "FEMT must be 0, 1, 2 or 3" ); xConfirmPara( m_FastEMT < 0 || m_FastEMT >3, "FEMT must be 0, 1, 2 or 3" );
......
...@@ -287,10 +287,8 @@ public: ...@@ -287,10 +287,8 @@ public:
int numValidMergeCand; int numValidMergeCand;
int maxNumMergeCand; int maxNumMergeCand;
#if JVET_L0369_SUBBLOCK_MERGE
MergeCtx *mrgCtx; MergeCtx *mrgCtx;
MergeType mergeType[AFFINE_MRG_MAX_NUM_CANDS]; MergeType mergeType[AFFINE_MRG_MAX_NUM_CANDS];
#endif
}; };
......
...@@ -290,10 +290,8 @@ void InterPrediction::xSubPuMC( PredictionUnit& pu, PelUnitBuf& predBuf, const R ...@@ -290,10 +290,8 @@ void InterPrediction::xSubPuMC( PredictionUnit& pu, PelUnitBuf& predBuf, const R
subPu.cu = pu.cu; subPu.cu = pu.cu;
subPu.mergeType = MRG_TYPE_DEFAULT_N; subPu.mergeType = MRG_TYPE_DEFAULT_N;
#if JVET_L0369_SUBBLOCK_MERGE
bool isAffine = pu.cu->affine; bool isAffine = pu.cu->affine;
subPu.cu->affine = false; subPu.cu->affine = false;
#endif
// join sub-pus containing the same motion // join sub-pus containing the same motion
bool verMC = puSize.height > puSize.width; bool verMC = puSize.height > puSize.width;
...@@ -343,9 +341,7 @@ void InterPrediction::xSubPuMC( PredictionUnit& pu, PelUnitBuf& predBuf, const R ...@@ -343,9 +341,7 @@ void InterPrediction::xSubPuMC( PredictionUnit& pu, PelUnitBuf& predBuf, const R
} }
m_subPuMC = false; m_subPuMC = false;
#if JVET_L0369_SUBBLOCK_MERGE
pu.cu->affine = isAffine; pu.cu->affine = isAffine;
#endif
} }
#if JVET_L0293_CPR #if JVET_L0293_CPR
......
...@@ -82,7 +82,6 @@ ...@@ -82,7 +82,6 @@
#define JVET_L0369_SUBBLOCK_MERGE 1 // Moving ATMVP into the sub-block merge list
#define REUSE_CU_RESULTS 1 #define REUSE_CU_RESULTS 1
......
...@@ -816,9 +816,6 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, ...@@ -816,9 +816,6 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx,
#if JVET_L0293_CPR #if JVET_L0293_CPR
int mrgCandIdxCPR = mrgCandIdx; int mrgCandIdxCPR = mrgCandIdx;
#endif #endif
#if JVET_L0293_CPR && !JVET_L0369_SUBBLOCK_MERGE
int cntCPR = 0;
#endif
const Position posLT = pu.Y().topLeft(); const Position posLT = pu.Y().topLeft();
const Position posRT = pu.Y().topRight(); const Position posRT = pu.Y().topRight();
...@@ -847,10 +844,6 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, ...@@ -847,10 +844,6 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx,
if (puLeft->cu->cpr) if (puLeft->cu->cpr)
{ {
mrgCtx.mrgTypeNeighbours[cnt] = MRG_TYPE_CPR; mrgCtx.mrgTypeNeighbours[cnt] = MRG_TYPE_CPR;
#if !JVET_L0369_SUBBLOCK_MERGE
cntCPR++;
#endif
#if JVET_L0293_CPR #if JVET_L0293_CPR
if (mmvdList != 0 && mrgCandIdx != -1) if (mmvdList != 0 && mrgCandIdx != -1)
mrgCandIdxCPR++; mrgCandIdxCPR++;
...@@ -905,10 +898,6 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, ...@@ -905,10 +898,6 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx,
if (puAbove->cu->cpr) if (puAbove->cu->cpr)
{ {
mrgCtx.mrgTypeNeighbours[cnt] = MRG_TYPE_CPR; mrgCtx.mrgTypeNeighbours[cnt] = MRG_TYPE_CPR;
#if !JVET_L0369_SUBBLOCK_MERGE
cntCPR++;
#endif
#if JVET_L0293_CPR #if JVET_L0293_CPR
if (mmvdList != 0 && mrgCandIdx != -1) if (mmvdList != 0 && mrgCandIdx != -1)
mrgCandIdxCPR++; mrgCandIdxCPR++;
...@@ -967,10 +956,6 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, ...@@ -967,10 +956,6 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx,
if (puAboveRight->cu->cpr) if (puAboveRight->cu->cpr)
{ {
mrgCtx.mrgTypeNeighbours[cnt] = MRG_TYPE_CPR; mrgCtx.mrgTypeNeighbours[cnt] = MRG_TYPE_CPR;
#if !JVET_L0369_SUBBLOCK_MERGE
cntCPR++;
#endif
#if JVET_L0293_CPR #if JVET_L0293_CPR
if (mmvdList != 0 && mrgCandIdx != -1) if (mmvdList != 0 && mrgCandIdx != -1)
mrgCandIdxCPR++; mrgCandIdxCPR++;
...@@ -1029,10 +1014,6 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, ...@@ -1029,10 +1014,6 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx,
if (puLeftBottom->cu->cpr) if (puLeftBottom->cu->cpr)
{ {
mrgCtx.mrgTypeNeighbours[cnt] = MRG_TYPE_CPR; mrgCtx.mrgTypeNeighbours[cnt] = MRG_TYPE_CPR;
#if !JVET_L0369_SUBBLOCK_MERGE
cntCPR++;
#endif
#if JVET_L0293_CPR #if JVET_L0293_CPR
if (mmvdList != 0 && mrgCandIdx != -1) if (mmvdList != 0 && mrgCandIdx != -1)
mrgCandIdxCPR++; mrgCandIdxCPR++;
...@@ -1064,71 +1045,9 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, ...@@ -1064,71 +1045,9 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx,
return; return;
} }
#if !JVET_L0369_SUBBLOCK_MERGE
#if JVET_L0293_CPR
bool enableSubPuMvp = slice.getSPS()->getSpsNext().getUseSubPuMvp() && !(slice.getPOC() == slice.getRefPic(REF_PIC_LIST_0, 0)->getPOC() && slice.isIRAP());
#else
bool enableSubPuMvp = slice.getSPS()->getSpsNext().getUseSubPuMvp();
#endif
bool isAvailableSubPu = false;
unsigned subPuMvpPos = 0;
if( enableSubPuMvp )
{
CHECK( mrgCtx.subPuMvpMiBuf .area() == 0 || !mrgCtx.subPuMvpMiBuf .buf, "Buffer not initialized" );
mrgCtx.subPuMvpMiBuf .fill( MotionInfo() );
}
if( enableSubPuMvp && slice.getEnableTMVPFlag() )
{
#if JVET_L0293_CPR
bool bMrgIdxMatchATMVPCan = (mrgCandIdxCPR == cnt);
#else
bool bMrgIdxMatchATMVPCan = ( mrgCandIdx == cnt );
#endif
bool tmpLICFlag = false;
isAvailableSubPu = cs.sps->getSpsNext().getUseATMVP() &&
getInterMergeSubPuMvpCand( pu, mrgCtx, tmpLICFlag, cnt
, mmvdList
#if JVET_L0293_CPR
, cntCPR
#endif
);
if( isAvailableSubPu )
{
#if !JVET_L0090_PAIR_AVG
isCandInter[cnt] = true;
#endif
mrgCtx.mrgTypeNeighbours[cnt] = MRG_TYPE_SUBPU_ATMVP;
if( bMrgIdxMatchATMVPCan )
{
return;
}
subPuMvpPos = cnt;
cnt++;
if( cnt == maxNumMergeCand )
{
return;
}
}
}
#endif
// above left // above left
#if JVET_L0369_SUBBLOCK_MERGE
if ( cnt < 4 ) if ( cnt < 4 )
#else
if( cnt < ( enableSubPuMvp ? 6 : 4 ) )
#endif
{ {
const PredictionUnit *puAboveLeft = cs.getPURestricted( posLT.offset( -1, -1 ), pu, pu.chType ); const PredictionUnit *puAboveLeft = cs.getPURestricted( posLT.offset( -1, -1 ), pu, pu.chType );
...@@ -1156,10 +1075,6 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, ...@@ -1156,10 +1075,6 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx,
if (puAboveLeft->cu->cpr) if (puAboveLeft->cu->cpr)
{ {
mrgCtx.mrgTypeNeighbours[cnt] = MRG_TYPE_CPR; mrgCtx.mrgTypeNeighbours[cnt] = MRG_TYPE_CPR;
#if !JVET_L0369_SUBBLOCK_MERGE
cntCPR++;
#endif
#if JVET_L0293_CPR #if JVET_L0293_CPR
if (mmvdList != 0 && mrgCandIdx != -1) if (mmvdList != 0 && mrgCandIdx != -1)
mrgCandIdxCPR++; mrgCandIdxCPR++;
...@@ -1259,38 +1174,9 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, ...@@ -1259,38 +1174,9 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx,
if( dir != 0 ) if( dir != 0 )
{ {
#if JVET_L0369_SUBBLOCK_MERGE
bool addTMvp = true; bool addTMvp = true;
#else
bool addTMvp = !( cs.sps->getSpsNext().getUseSubPuMvp() && isAvailableSubPu );
if( !addTMvp )
{
if ( dir != mrgCtx.interDirNeighbours[subPuMvpPos] )
{
addTMvp = true;
}
else
{
for( unsigned refList = 0; refList < NUM_REF_PIC_LIST_01; refList++ )
{
if( dir & ( 1 << refList ) )
{
if( mrgCtx.mvFieldNeighbours[( cnt << 1 ) + refList] != mrgCtx.mvFieldNeighbours[(subPuMvpPos << 1) + refList] )
{
addTMvp = true;
break;
}
}
}
}
}
#endif
#if HM_JEM_MERGE_CANDS #if HM_JEM_MERGE_CANDS
#if JVET_L0369_SUBBLOCK_MERGE
int iSpanCand = cnt; int iSpanCand = cnt;
#else
int iSpanCand = isAvailableSubPu ? cnt - 1 : cnt;
#endif
for( int i = 0; i < iSpanCand; i++ ) for( int i = 0; i < iSpanCand; i++ )
{ {
if( mrgCtx.interDirNeighbours[ i ] == dir && if( mrgCtx.interDirNeighbours[ i ] == dir &&
...@@ -1331,10 +1217,8 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, ...@@ -1331,10 +1217,8 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx,
int maxNumMergeCandMin1 = maxNumMergeCand - 1; int maxNumMergeCandMin1 = maxNumMergeCand - 1;
if (cnt != maxNumMergeCandMin1) if (cnt != maxNumMergeCandMin1)
{ {
#if JVET_L0369_SUBBLOCK_MERGE
bool isAvailableSubPu = false; bool isAvailableSubPu = false;
unsigned subPuMvpPos = 0; unsigned subPuMvpPos = 0;
#endif
#if JVET_L0090_PAIR_AVG #if JVET_L0090_PAIR_AVG
bool bFound = addMergeHMVPCand(slice, mrgCtx, canFastExit bool bFound = addMergeHMVPCand(slice, mrgCtx, canFastExit
#if JVET_L0293_CPR #if JVET_L0293_CPR
...@@ -2117,9 +2001,7 @@ bool PU::addAffineMVPCandUnscaled( const PredictionUnit &pu, const RefPicList &r ...@@ -2117,9 +2001,7 @@ bool PU::addAffineMVPCandUnscaled( const PredictionUnit &pu, const RefPicList &r
neibPU = cs.getPURestricted( neibPos, pu, pu.chType ); neibPU = cs.getPURestricted( neibPos, pu, pu.chType );
if ( neibPU == NULL || !CU::isInter( *neibPU->cu ) || !neibPU->cu->affine if ( neibPU == NULL || !CU::isInter( *neibPU->cu ) || !neibPU->cu->affine
#if JVET_L0369_SUBBLOCK_MERGE
|| neibPU->mergeType != MRG_TYPE_DEFAULT_N || neibPU->mergeType != MRG_TYPE_DEFAULT_N
#endif
) )
{ {
return false; return false;
...@@ -2765,9 +2647,7 @@ const int getAvailableAffineNeighboursForLeftPredictor( const PredictionUnit &pu ...@@ -2765,9 +2647,7 @@ const int getAvailableAffineNeighboursForLeftPredictor( const PredictionUnit &pu
const PredictionUnit *puLeftBottom = pu.cs->getPURestricted( posLB.offset( -1, 1 ), pu, pu.chType ); const PredictionUnit *puLeftBottom = pu.cs->getPURestricted( posLB.offset( -1, 1 ), pu, pu.chType );
if ( puLeftBottom && puLeftBottom->cu->affine if ( puLeftBottom && puLeftBottom->cu->affine
#if JVET_L0369_SUBBLOCK_MERGE
&& puLeftBottom->mergeType == MRG_TYPE_DEFAULT_N && puLeftBottom->mergeType == MRG_TYPE_DEFAULT_N
#endif
) )
{ {
npu[num++] = puLeftBottom; npu[num++] = puLeftBottom;
...@@ -2776,9 +2656,7 @@ const int getAvailableAffineNeighboursForLeftPredictor( const PredictionUnit &pu ...@@ -2776,9 +2656,7 @@ const int getAvailableAffineNeighboursForLeftPredictor( const PredictionUnit &pu
const PredictionUnit* puLeft = pu.cs->getPURestricted( posLB.offset( -1, 0 ), pu, pu.chType ); const PredictionUnit* puLeft = pu.cs->getPURestricted( posLB.offset( -1, 0 ), pu, pu.chType );
if ( puLeft && puLeft->cu->affine if ( puLeft && puLeft->cu->affine
#if JVET_L0369_SUBBLOCK_MERGE
&& puLeft->mergeType == MRG_TYPE_DEFAULT_N && puLeft->mergeType == MRG_TYPE_DEFAULT_N
#endif
) )
{ {
npu[num++] = puLeft; npu[num++] = puLeft;
...@@ -2796,9 +2674,7 @@ const int getAvailableAffineNeighboursForAbovePredictor( const PredictionUnit &p ...@@ -2796,9 +2674,7 @@ const int getAvailableAffineNeighboursForAbovePredictor( const PredictionUnit &p
const PredictionUnit* puAboveRight = pu.cs->getPURestricted( posRT.offset( 1, -1 ), pu, pu.chType ); const PredictionUnit* puAboveRight = pu.cs->getPURestricted( posRT.offset( 1, -1 ), pu, pu.chType );
if ( puAboveRight && puAboveRight->cu->affine if ( puAboveRight && puAboveRight->cu->affine
#if JVET_L0369_SUBBLOCK_MERGE
&& puAboveRight->mergeType == MRG_TYPE_DEFAULT_N && puAboveRight->mergeType == MRG_TYPE_DEFAULT_N
#endif
) )
{ {
npu[num++] = puAboveRight; npu[num++] = puAboveRight;
...@@ -2807,9 +2683,7 @@ const int getAvailableAffineNeighboursForAbovePredictor( const PredictionUnit &p ...@@ -2807,9 +2683,7 @@ const int getAvailableAffineNeighboursForAbovePredictor( const PredictionUnit &p
const PredictionUnit* puAbove = pu.cs->getPURestricted( posRT.offset( 0, -1 ), pu, pu.chType ); const PredictionUnit* puAbove = pu.cs->getPURestricted( posRT.offset( 0, -1 ), pu, pu.chType );
if ( puAbove && puAbove->cu->affine if ( puAbove && puAbove->cu->affine
#if JVET_L0369_SUBBLOCK_MERGE
&& puAbove->mergeType == MRG_TYPE_DEFAULT_N && puAbove->mergeType == MRG_TYPE_DEFAULT_N
#endif
) )
{ {
npu[num++] = puAbove; npu[num++] = puAbove;
...@@ -2818,9 +2692,7 @@ const int getAvailableAffineNeighboursForAbovePredictor( const PredictionUnit &p ...@@ -2818,9 +2692,7 @@ const int getAvailableAffineNeighboursForAbovePredictor( const PredictionUnit &p
const PredictionUnit *puAboveLeft = pu.cs->getPURestricted( posLT.offset( -1, -1 ), pu, pu.chType ); const PredictionUnit *puAboveLeft = pu.cs->getPURestricted( posLT.offset( -1, -1 ), pu, pu.chType );
if ( puAboveLeft && puAboveLeft->cu->affine if ( puAboveLeft && puAboveLeft->cu->affine
#if JVET_L0369_SUBBLOCK_MERGE
&& puAboveLeft->mergeType == MRG_TYPE_DEFAULT_N && puAboveLeft->mergeType == MRG_TYPE_DEFAULT_N
#endif
) )
{ {
npu[num++] = puAboveLeft; npu[num++] = puAboveLeft;
...@@ -2845,16 +2717,13 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx ...@@ -2845,16 +2717,13 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx
} }
affMrgCtx.interDirNeighbours[i] = 0; affMrgCtx.interDirNeighbours[i] = 0;
affMrgCtx.affineType[i] = AFFINEMODEL_4PARAM; affMrgCtx.affineType[i] = AFFINEMODEL_4PARAM;
#if JVET_L0369_SUBBLOCK_MERGE
affMrgCtx.mergeType[i] = MRG_TYPE_DEFAULT_N; affMrgCtx.mergeType[i] = MRG_TYPE_DEFAULT_N;
#endif
affMrgCtx.GBiIdx[i] = GBI_DEFAULT; affMrgCtx.GBiIdx[i] = GBI_DEFAULT;
} }
affMrgCtx.numValidMergeCand = 0; affMrgCtx.numValidMergeCand = 0;
affMrgCtx.maxNumMergeCand = maxNumAffineMergeCand; affMrgCtx.maxNumMergeCand = maxNumAffineMergeCand;
#if JVET_L0369_SUBBLOCK_MERGE ///> insert ATMVP candidate
#if JVET_L0293_CPR #if JVET_L0293_CPR
bool enableSubPuMvp = slice.getSPS()->getSpsNext().getUseSubPuMvp() && !(slice.getPOC() == slice.getRefPic(REF_PIC_LIST_0, 0)->getPOC() && slice.isIRAP()); bool enableSubPuMvp = slice.getSPS()->getSpsNext().getUseSubPuMvp() && !(slice.getPOC() == slice.getRefPic(REF_PIC_LIST_0, 0)->getPOC() && slice.isIRAP());
#else #else
...@@ -3029,12 +2898,9 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx ...@@ -3029,12 +2898,9 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx
} }
} }
} }
#endif
#if JVET_L0369_SUBBLOCK_MERGE
if ( slice.getSPS()->getSpsNext().getUseAffine() ) if ( slice.getSPS()->getSpsNext().getUseAffine() )
{ {
#endif
///> Start: inherited affine candidates ///> Start: inherited affine candidates
const PredictionUnit* npu[5]; const PredictionUnit* npu[5];
int numAffNeighLeft = getAvailableAffineNeighboursForLeftPredictor( pu, npu ); int numAffNeighLeft = getAvailableAffineNeighboursForLeftPredictor( pu, npu );
...@@ -3237,9 +3103,7 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx ...@@ -3237,9 +3103,7 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx
} }
} }
///> End: Constructed affine candidates ///> End: Constructed affine candidates
#if JVET_L0369_SUBBLOCK_MERGE
} }
#endif
///> zero padding ///> zero padding
int cnt = affMrgCtx.numValidMergeCand; int cnt = affMrgCtx.numValidMergeCand;
......
...@@ -848,14 +848,12 @@ void writeAllCodedData(const CodingStructure & cs, const UnitArea & ctuArea) ...@@ -848,14 +848,12 @@ void writeAllCodedData(const CodingStructure & cs, const UnitArea & ctuArea)
{ {
DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_CODED, pu, GetBlockStatisticName(BlockStatistic::MMVDMergeIdx), pu.mmvdMergeIdx); DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_CODED, pu, GetBlockStatisticName(BlockStatistic::MMVDMergeIdx), pu.mmvdMergeIdx);
} }
#if JVET_L0369_SUBBLOCK_MERGE
if (!cu.cs->slice->isIntra() && cu.cs->sps->getSpsNext().getUseAffine() && cu.lumaSize().width >= 8 && cu.lumaSize().height >= 8 if (!cu.cs->slice->isIntra() && cu.cs->sps->getSpsNext().getUseAffine() && cu.lumaSize().width >= 8 && cu.lumaSize().height >= 8
&& !pu.mmvdMergeFlag && !cu.mmvdSkip && !pu.mmvdMergeFlag && !cu.mmvdSkip
) )
{ {
DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_CODED, pu, GetBlockStatisticName(BlockStatistic::AffineFlag), pu.cu->affine); DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_CODED, pu, GetBlockStatisticName(BlockStatistic::AffineFlag), pu.cu->affine);
} }
#endif
if (pu.cs->sps->getSpsNext().getUseMHIntra() && !pu.cu->skip && !pu.cu->affine && !(pu.cu->lwidth() * pu.cu->lheight() < 64 || pu.cu->lwidth() >= MAX_CU_SIZE || pu.cu->lheight() >= MAX_CU_SIZE) if (pu.cs->sps->getSpsNext().getUseMHIntra() && !pu.cu->skip && !pu.cu->affine && !(pu.cu->lwidth() * pu.cu->lheight() < 64 || pu.cu->lwidth() >= MAX_CU_SIZE || pu.cu->lheight() >= MAX_CU_SIZE)
&& !pu.mmvdMergeFlag && !pu.mmvdMergeFlag
) )
......
...@@ -1207,11 +1207,7 @@ void CABACReader::prediction_unit( PredictionUnit& pu, MergeCtx& mrgCtx ) ...@@ -1207,11 +1207,7 @@ void CABACReader::prediction_unit( PredictionUnit& pu, MergeCtx& mrgCtx )
} }
if( pu.mergeFlag ) if( pu.mergeFlag )
{ {
#if JVET_L0369_SUBBLOCK_MERGE
subblock_merge_flag( *pu.cu ); subblock_merge_flag( *pu.cu );
#else
affine_flag ( *pu.cu );
#endif
MHIntra_flag(pu); MHIntra_flag(pu);
if (pu.mhIntraFlag) if (pu.mhIntraFlag)
{ {
...@@ -1287,7 +1283,6 @@ void CABACReader::prediction_unit( PredictionUnit& pu, MergeCtx& mrgCtx ) ...@@ -1287,7 +1283,6 @@ void CABACReader::prediction_unit( PredictionUnit& pu, MergeCtx& mrgCtx )
PU::spanMotionInfo( pu, mrgCtx ); PU::spanMotionInfo( pu, mrgCtx );
} }
#if JVET_L0369_SUBBLOCK_MERGE
void CABACReader::subblock_merge_flag( CodingUnit& cu ) void CABACReader::subblock_merge_flag( CodingUnit& cu )
{ {
if ( cu.firstPU->mergeFlag && (cu.firstPU->mmvdMergeFlag || cu.mmvdSkip) ) if ( cu.firstPU->mergeFlag && (cu.firstPU->mmvdMergeFlag || cu.mmvdSkip) )
...@@ -1304,11 +1299,9 @@ void CABACReader::subblock_merge_flag( CodingUnit& cu ) ...@@ -1304,11 +1299,9 @@ void CABACReader::subblock_merge_flag( CodingUnit& cu )
DTRACE( g_trace_ctx, D_SYNTAX, "subblock_merge_flag() subblock_merge_flag=%d ctx=%d pos=(%d,%d)\n", cu.affine ? 1 : 0, ctxId, cu.Y().x, cu.Y().y ); DTRACE( g_trace_ctx, D_SYNTAX, "subblock_merge_flag() subblock_merge_flag=%d ctx=%d pos=(%d,%d)\n", cu.affine ? 1 : 0, ctxId, cu.Y().x, cu.Y().y );
} }
} }
#endif
void CABACReader::affine_flag( CodingUnit& cu ) void CABACReader::affine_flag( CodingUnit& cu )
{ {
#if JVET_L0369_SUBBLOCK_MERGE
if ( !cu.cs->slice->isIntra() && cu.cs->sps->getSpsNext().getUseAffine() && cu.lumaSize().width > 8 && cu.lumaSize().height > 8 ) if ( !cu.cs->slice->isIntra() && cu.cs->sps->getSpsNext().getUseAffine() && cu.lumaSize().width > 8 && cu.lumaSize().height > 8 )
{ {
RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__AFFINE_FLAG ); RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__AFFINE_FLAG );
...@@ -1328,44 +1321,6 @@ void CABACReader::affine_flag( CodingUnit& cu ) ...@@ -1328,44 +1321,6 @@ void CABACReader::affine_flag( CodingUnit& cu )
cu.affineType = AFFINEMODEL_4PARAM; cu.affineType = AFFINEMODEL_4PARAM;
} }
} }
#else
if( cu.cs->slice->isIntra() || !cu.cs->sps->getSpsNext().getUseAffine() )
{
return;
}
if( !cu.firstPU->mergeFlag && !( cu.lumaSize().width > 8 && cu.lumaSize().height > 8 ) )
{
return;
}
if ( cu.firstPU->mergeFlag && !(cu.lumaSize().width >= 8 && cu.lumaSize().height >= 8) )
{
return;
}
if (cu.firstPU->mergeFlag && (cu.firstPU->mmvdMergeFlag || cu.mmvdSkip))
{
return;
}
RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__AFFINE_FLAG );
unsigned ctxId = DeriveCtx::CtxAffineFlag( cu );
cu.affine = m_BinDecoder.decodeBin( Ctx::AffineFlag( ctxId ) );
DTRACE( g_trace_ctx, D_SYNTAX, "affine_flag() affine=%d ctx=%d pos=(%d,%d)\n", cu.affine ? 1 : 0, ctxId, cu.Y().x, cu.Y().y );
if ( cu.affine && !cu.firstPU->mergeFlag && cu.cs->sps->getSpsNext().getUseAffineType() )
{
ctxId = 0;
cu.affineType = m_BinDecoder.decodeBin( Ctx::AffineType( ctxId ) );
DTRACE( g_trace_ctx, D_SYNTAX, "affine_type() affine_type=%d ctx=%d pos=(%d,%d)\n", cu.affineType ? 1 : 0, ctxId, cu.Y().x, cu.Y().y );
}
else
{
cu.affineType = AFFINEMODEL_4PARAM;
}
#endif
} }
void CABACReader::merge_flag( PredictionUnit& pu ) void CABACReader::merge_flag( PredictionUnit& pu )
......
...@@ -95,9 +95,7 @@ public: ...@@ -95,9 +95,7 @@ public:
void merge_flag ( PredictionUnit& pu ); void merge_flag ( PredictionUnit& pu );
void merge_data ( PredictionUnit& pu ); void merge_data ( PredictionUnit& pu );
void affine_flag ( CodingUnit& cu ); void affine_flag ( CodingUnit& cu );
#if JVET_L0369_SUBBLOCK_MERGE
void subblock_merge_flag ( CodingUnit& cu ); void subblock_merge_flag ( CodingUnit& cu );
#endif
void merge_idx ( PredictionUnit& pu ); void merge_idx ( PredictionUnit& pu );
void mmvd_merge_idx(PredictionUnit& pu); void mmvd_merge_idx(PredictionUnit& pu);
void imv_mode ( CodingUnit& cu, MergeCtx& mrgCtx ); void imv_mode ( CodingUnit& cu, MergeCtx& mrgCtx );
......
...@@ -497,22 +497,17 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) ...@@ -497,22 +497,17 @@ void DecCu::xDeriveCUMV( CodingUnit &cu )
if( pu.cu->affine ) if( pu.cu->affine )
{ {
AffineMergeCtx affineMergeCtx; AffineMergeCtx affineMergeCtx;
#if JVET_L0369_SUBBLOCK_MERGE
if ( pu.cs->sps->getSpsNext().getUseSubPuMvp() ) if ( pu.cs->sps->getSpsNext().getUseSubPuMvp() )
{ {
Size bufSize = g_miScaling.scale( pu.lumaSize() ); Size bufSize = g_miScaling.scale( pu.lumaSize() );
mrgCtx.subPuMvpMiBuf = MotionBuf( m_SubPuMiBuf, bufSize ); mrgCtx.subPuMvpMiBuf = MotionBuf( m_SubPuMiBuf, bufSize );
affineMergeCtx.mrgCtx = &mrgCtx; affineMergeCtx.mrgCtx = &mrgCtx;
} }
#endif
PU::getAffineMergeCand( pu, affineMergeCtx, pu.mergeIdx ); PU::getAffineMergeCand( pu, affineMergeCtx, pu.mergeIdx );
pu.interDir = affineMergeCtx.interDirNeighbours[pu.mergeIdx]; pu.interDir = affineMergeCtx.interDirNeighbours[pu.mergeIdx];
pu.cu->affineType = affineMergeCtx.affineType[pu.mergeIdx]; pu.cu->affineType = affineMergeCtx.affineType[pu.mergeIdx];
pu.cu->GBiIdx = affineMergeCtx.GBiIdx[pu.mergeIdx]; pu.cu->GBiIdx = affineMergeCtx.GBiIdx[pu.mergeIdx];
#if JVET_L0369_SUBBLOCK_MERGE
pu.mergeType = affineMergeCtx.mergeType[pu.mergeIdx]; pu.mergeType = affineMergeCtx.mergeType[pu.mergeIdx];
#endif
#if JVET_L0369_SUBBLOCK_MERGE
if ( pu.mergeType == MRG_TYPE_SUBPU_ATMVP ) if ( pu.mergeType == MRG_TYPE_SUBPU_ATMVP )
{ {
pu.refIdx[0] = affineMergeCtx.mvFieldNeighbours[(pu.mergeIdx << 1) + 0][0].refIdx; pu.refIdx[0] = affineMergeCtx.mvFieldNeighbours[(pu.mergeIdx << 1) + 0][0].refIdx;
...@@ -520,7 +515,6 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) ...@@ -520,7 +515,6 @@ void DecCu::xDeriveCUMV( CodingUnit &cu )
} }
else else
{ {
#endif
for( int i = 0; i < 2; ++i ) for( int i = 0; i < 2; ++i )
{ {
if( pu.cs->slice->getNumRefIdx( RefPicList( i ) ) > 0 ) if( pu.cs->slice->getNumRefIdx( RefPicList( i ) ) > 0 )
...@@ -532,20 +526,11 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) ...@@ -532,20 +526,11 @@ void DecCu::xDeriveCUMV( CodingUnit &cu )
PU::setAllAffineMvField( pu, mvField, RefPicList( i ) ); PU::setAllAffineMvField( pu, mvField, RefPicList( i ) );
} }
} }
#if JVET_L0369_SUBBLOCK_MERGE
} }
#endif
PU::spanMotionInfo( pu, mrgCtx ); PU::spanMotionInfo( pu, mrgCtx );
} }
else else
{ {
#if !JVET_L0369_SUBBLOCK_MERGE
if( pu.cs->sps->getSpsNext().getUseSubPuMvp() )
{
Size bufSize = g_miScaling.scale( pu.lumaSize() );
mrgCtx.subPuMvpMiBuf = MotionBuf( m_SubPuMiBuf, bufSize );
}
#endif
PU::getInterMergeCandidates(pu, mrgCtx, 0, pu.mergeIdx); PU::getInterMergeCandidates(pu, mrgCtx, 0, pu.mergeIdx);
PU::restrictBiPredMergeCands(pu, mrgCtx); PU::restrictBiPredMergeCands(pu, mrgCtx);
......
...@@ -1887,15 +1887,9 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para ...@@ -1887,15 +1887,9 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para
#endif #endif
if (!pcSlice->isIntra()) if (!pcSlice->isIntra())
{ {
#if JVET_L0369_SUBBLOCK_MERGE
READ_UVLC(uiCode, "six_minus_max_num_merge_cand"); READ_UVLC(uiCode, "six_minus_max_num_merge_cand");
pcSlice->setMaxNumMergeCand(MRG_MAX_NUM_CANDS - uiCode); pcSlice->setMaxNumMergeCand(MRG_MAX_NUM_CANDS - uiCode);
#else
READ_UVLC( uiCode, sps->getSpsNext().getUseSubPuMvp() ? "seven_minus_max_num_merge_cand" : "five_minus_max_num_merge_cand");
pcSlice->setMaxNumMergeCand(MRG_MAX_NUM_CANDS - uiCode - ( sps->getSpsNext().getUseSubPuMvp() ? 0 : 2 ) );
#endif
#if JVET_L0369_SUBBLOCK_MERGE