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()
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." );
#if JVET_L0369_SUBBLOCK_MERGE
if ( m_Affine == 0 )
{
m_maxNumAffineMergeCand = m_SubPuMvpMode;
}
#endif
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" );
......
......@@ -287,10 +287,8 @@ public:
int numValidMergeCand;
int maxNumMergeCand;
#if JVET_L0369_SUBBLOCK_MERGE
MergeCtx *mrgCtx;
MergeType mergeType[AFFINE_MRG_MAX_NUM_CANDS];
#endif
};
......
......@@ -290,10 +290,8 @@ void InterPrediction::xSubPuMC( PredictionUnit& pu, PelUnitBuf& predBuf, const R
subPu.cu = pu.cu;
subPu.mergeType = MRG_TYPE_DEFAULT_N;
#if JVET_L0369_SUBBLOCK_MERGE
bool isAffine = pu.cu->affine;
subPu.cu->affine = false;
#endif
// join sub-pus containing the same motion
bool verMC = puSize.height > puSize.width;
......@@ -343,9 +341,7 @@ void InterPrediction::xSubPuMC( PredictionUnit& pu, PelUnitBuf& predBuf, const R
}
m_subPuMC = false;
#if JVET_L0369_SUBBLOCK_MERGE
pu.cu->affine = isAffine;
#endif
}
#if JVET_L0293_CPR
......
......@@ -82,7 +82,6 @@
#define JVET_L0369_SUBBLOCK_MERGE 1 // Moving ATMVP into the sub-block merge list
#define REUSE_CU_RESULTS 1
......
......@@ -816,9 +816,6 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx,
#if JVET_L0293_CPR
int mrgCandIdxCPR = mrgCandIdx;
#endif
#if JVET_L0293_CPR && !JVET_L0369_SUBBLOCK_MERGE
int cntCPR = 0;
#endif
const Position posLT = pu.Y().topLeft();
const Position posRT = pu.Y().topRight();
......@@ -847,10 +844,6 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx,
if (puLeft->cu->cpr)
{
mrgCtx.mrgTypeNeighbours[cnt] = MRG_TYPE_CPR;
#if !JVET_L0369_SUBBLOCK_MERGE
cntCPR++;
#endif
#if JVET_L0293_CPR
if (mmvdList != 0 && mrgCandIdx != -1)
mrgCandIdxCPR++;
......@@ -905,10 +898,6 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx,
if (puAbove->cu->cpr)
{
mrgCtx.mrgTypeNeighbours[cnt] = MRG_TYPE_CPR;
#if !JVET_L0369_SUBBLOCK_MERGE
cntCPR++;
#endif
#if JVET_L0293_CPR
if (mmvdList != 0 && mrgCandIdx != -1)
mrgCandIdxCPR++;
......@@ -967,10 +956,6 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx,
if (puAboveRight->cu->cpr)
{
mrgCtx.mrgTypeNeighbours[cnt] = MRG_TYPE_CPR;
#if !JVET_L0369_SUBBLOCK_MERGE
cntCPR++;
#endif
#if JVET_L0293_CPR
if (mmvdList != 0 && mrgCandIdx != -1)
mrgCandIdxCPR++;
......@@ -1029,10 +1014,6 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx,
if (puLeftBottom->cu->cpr)
{
mrgCtx.mrgTypeNeighbours[cnt] = MRG_TYPE_CPR;
#if !JVET_L0369_SUBBLOCK_MERGE
cntCPR++;
#endif
#if JVET_L0293_CPR
if (mmvdList != 0 && mrgCandIdx != -1)
mrgCandIdxCPR++;
......@@ -1064,71 +1045,9 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx,
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
#if JVET_L0369_SUBBLOCK_MERGE
if ( cnt < 4 )
#else
if( cnt < ( enableSubPuMvp ? 6 : 4 ) )
#endif
{
const PredictionUnit *puAboveLeft = cs.getPURestricted( posLT.offset( -1, -1 ), pu, pu.chType );
......@@ -1156,10 +1075,6 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx,
if (puAboveLeft->cu->cpr)
{
mrgCtx.mrgTypeNeighbours[cnt] = MRG_TYPE_CPR;
#if !JVET_L0369_SUBBLOCK_MERGE
cntCPR++;
#endif
#if JVET_L0293_CPR
if (mmvdList != 0 && mrgCandIdx != -1)
mrgCandIdxCPR++;
......@@ -1259,38 +1174,9 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx,
if( dir != 0 )
{
#if JVET_L0369_SUBBLOCK_MERGE
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 JVET_L0369_SUBBLOCK_MERGE
int iSpanCand = cnt;
#else
int iSpanCand = isAvailableSubPu ? cnt - 1 : cnt;
#endif
for( int i = 0; i < iSpanCand; i++ )
{
if( mrgCtx.interDirNeighbours[ i ] == dir &&
......@@ -1331,10 +1217,8 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx,
int maxNumMergeCandMin1 = maxNumMergeCand - 1;
if (cnt != maxNumMergeCandMin1)
{
#if JVET_L0369_SUBBLOCK_MERGE
bool isAvailableSubPu = false;
unsigned subPuMvpPos = 0;
#endif
#if JVET_L0090_PAIR_AVG
bool bFound = addMergeHMVPCand(slice, mrgCtx, canFastExit
#if JVET_L0293_CPR
......@@ -2117,9 +2001,7 @@ bool PU::addAffineMVPCandUnscaled( const PredictionUnit &pu, const RefPicList &r
neibPU = cs.getPURestricted( neibPos, pu, pu.chType );
if ( neibPU == NULL || !CU::isInter( *neibPU->cu ) || !neibPU->cu->affine
#if JVET_L0369_SUBBLOCK_MERGE
|| neibPU->mergeType != MRG_TYPE_DEFAULT_N
#endif
)
{
return false;
......@@ -2765,9 +2647,7 @@ const int getAvailableAffineNeighboursForLeftPredictor( const PredictionUnit &pu
const PredictionUnit *puLeftBottom = pu.cs->getPURestricted( posLB.offset( -1, 1 ), pu, pu.chType );
if ( puLeftBottom && puLeftBottom->cu->affine
#if JVET_L0369_SUBBLOCK_MERGE
&& puLeftBottom->mergeType == MRG_TYPE_DEFAULT_N
#endif
)
{
npu[num++] = puLeftBottom;
......@@ -2776,9 +2656,7 @@ const int getAvailableAffineNeighboursForLeftPredictor( const PredictionUnit &pu
const PredictionUnit* puLeft = pu.cs->getPURestricted( posLB.offset( -1, 0 ), pu, pu.chType );
if ( puLeft && puLeft->cu->affine
#if JVET_L0369_SUBBLOCK_MERGE
&& puLeft->mergeType == MRG_TYPE_DEFAULT_N
#endif
)
{
npu[num++] = puLeft;
......@@ -2796,9 +2674,7 @@ const int getAvailableAffineNeighboursForAbovePredictor( const PredictionUnit &p
const PredictionUnit* puAboveRight = pu.cs->getPURestricted( posRT.offset( 1, -1 ), pu, pu.chType );
if ( puAboveRight && puAboveRight->cu->affine
#if JVET_L0369_SUBBLOCK_MERGE
&& puAboveRight->mergeType == MRG_TYPE_DEFAULT_N
#endif
)
{
npu[num++] = puAboveRight;
......@@ -2807,9 +2683,7 @@ const int getAvailableAffineNeighboursForAbovePredictor( const PredictionUnit &p
const PredictionUnit* puAbove = pu.cs->getPURestricted( posRT.offset( 0, -1 ), pu, pu.chType );
if ( puAbove && puAbove->cu->affine
#if JVET_L0369_SUBBLOCK_MERGE
&& puAbove->mergeType == MRG_TYPE_DEFAULT_N
#endif
)
{
npu[num++] = puAbove;
......@@ -2818,9 +2692,7 @@ const int getAvailableAffineNeighboursForAbovePredictor( const PredictionUnit &p
const PredictionUnit *puAboveLeft = pu.cs->getPURestricted( posLT.offset( -1, -1 ), pu, pu.chType );
if ( puAboveLeft && puAboveLeft->cu->affine
#if JVET_L0369_SUBBLOCK_MERGE
&& puAboveLeft->mergeType == MRG_TYPE_DEFAULT_N
#endif
)
{
npu[num++] = puAboveLeft;
......@@ -2845,16 +2717,13 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx
}
affMrgCtx.interDirNeighbours[i] = 0;
affMrgCtx.affineType[i] = AFFINEMODEL_4PARAM;
#if JVET_L0369_SUBBLOCK_MERGE
affMrgCtx.mergeType[i] = MRG_TYPE_DEFAULT_N;
#endif
affMrgCtx.GBiIdx[i] = GBI_DEFAULT;
}
affMrgCtx.numValidMergeCand = 0;
affMrgCtx.maxNumMergeCand = maxNumAffineMergeCand;
#if JVET_L0369_SUBBLOCK_MERGE ///> insert ATMVP candidate
#if JVET_L0293_CPR
bool enableSubPuMvp = slice.getSPS()->getSpsNext().getUseSubPuMvp() && !(slice.getPOC() == slice.getRefPic(REF_PIC_LIST_0, 0)->getPOC() && slice.isIRAP());
#else
......@@ -3029,12 +2898,9 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx
}
}
}
#endif
#if JVET_L0369_SUBBLOCK_MERGE
if ( slice.getSPS()->getSpsNext().getUseAffine() )
{
#endif
///> Start: inherited affine candidates
const PredictionUnit* npu[5];
int numAffNeighLeft = getAvailableAffineNeighboursForLeftPredictor( pu, npu );
......@@ -3237,9 +3103,7 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx
}
}
///> End: Constructed affine candidates
#if JVET_L0369_SUBBLOCK_MERGE
}
#endif
///> zero padding
int cnt = affMrgCtx.numValidMergeCand;
......
......@@ -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);
}
#if JVET_L0369_SUBBLOCK_MERGE
if (!cu.cs->slice->isIntra() && cu.cs->sps->getSpsNext().getUseAffine() && cu.lumaSize().width >= 8 && cu.lumaSize().height >= 8
&& !pu.mmvdMergeFlag && !cu.mmvdSkip
)
{
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)
&& !pu.mmvdMergeFlag
)
......
......@@ -1207,11 +1207,7 @@ void CABACReader::prediction_unit( PredictionUnit& pu, MergeCtx& mrgCtx )
}
if( pu.mergeFlag )
{
#if JVET_L0369_SUBBLOCK_MERGE
subblock_merge_flag( *pu.cu );
#else
affine_flag ( *pu.cu );
#endif
MHIntra_flag(pu);
if (pu.mhIntraFlag)
{
......@@ -1287,7 +1283,6 @@ void CABACReader::prediction_unit( PredictionUnit& pu, MergeCtx& mrgCtx )
PU::spanMotionInfo( pu, mrgCtx );
}
#if JVET_L0369_SUBBLOCK_MERGE
void CABACReader::subblock_merge_flag( CodingUnit& cu )
{
if ( cu.firstPU->mergeFlag && (cu.firstPU->mmvdMergeFlag || cu.mmvdSkip) )
......@@ -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 );
}
}
#endif
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 )
{
RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__AFFINE_FLAG );
......@@ -1328,44 +1321,6 @@ void CABACReader::affine_flag( CodingUnit& cu )
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 )
......
......@@ -95,9 +95,7 @@ public:
void merge_flag ( PredictionUnit& pu );
void merge_data ( PredictionUnit& pu );
void affine_flag ( CodingUnit& cu );
#if JVET_L0369_SUBBLOCK_MERGE
void subblock_merge_flag ( CodingUnit& cu );
#endif
void merge_idx ( PredictionUnit& pu );
void mmvd_merge_idx(PredictionUnit& pu);
void imv_mode ( CodingUnit& cu, MergeCtx& mrgCtx );
......
......@@ -497,22 +497,17 @@ void DecCu::xDeriveCUMV( CodingUnit &cu )
if( pu.cu->affine )
{
AffineMergeCtx affineMergeCtx;
#if JVET_L0369_SUBBLOCK_MERGE
if ( pu.cs->sps->getSpsNext().getUseSubPuMvp() )
{
Size bufSize = g_miScaling.scale( pu.lumaSize() );
mrgCtx.subPuMvpMiBuf = MotionBuf( m_SubPuMiBuf, bufSize );
affineMergeCtx.mrgCtx = &mrgCtx;
}
#endif
PU::getAffineMergeCand( pu, affineMergeCtx, pu.mergeIdx );
pu.interDir = affineMergeCtx.interDirNeighbours[pu.mergeIdx];
pu.cu->affineType = affineMergeCtx.affineType[pu.mergeIdx];
pu.cu->GBiIdx = affineMergeCtx.GBiIdx[pu.mergeIdx];
#if JVET_L0369_SUBBLOCK_MERGE
pu.mergeType = affineMergeCtx.mergeType[pu.mergeIdx];
#endif
#if JVET_L0369_SUBBLOCK_MERGE
if ( pu.mergeType == MRG_TYPE_SUBPU_ATMVP )
{
pu.refIdx[0] = affineMergeCtx.mvFieldNeighbours[(pu.mergeIdx << 1) + 0][0].refIdx;
......@@ -520,7 +515,6 @@ void DecCu::xDeriveCUMV( CodingUnit &cu )
}
else
{
#endif
for( int i = 0; i < 2; ++i )
{
if( pu.cs->slice->getNumRefIdx( RefPicList( i ) ) > 0 )
......@@ -532,20 +526,11 @@ void DecCu::xDeriveCUMV( CodingUnit &cu )
PU::setAllAffineMvField( pu, mvField, RefPicList( i ) );
}
}
#if JVET_L0369_SUBBLOCK_MERGE
}
#endif
PU::spanMotionInfo( pu, mrgCtx );
}
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::restrictBiPredMergeCands(pu, mrgCtx);
......
......@@ -1887,15 +1887,9 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para
#endif
if (!pcSlice->isIntra())
{
#if JVET_L0369_SUBBLOCK_MERGE
READ_UVLC(uiCode, "six_minus_max_num_merge_cand");
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
if ( sps->getSpsNext().getUseSubPuMvp() && !sps->getSpsNext().getUseAffine() ) // ATMVP only
{
pcSlice->setMaxNumAffineMergeCand( 1 );
......@@ -1905,7 +1899,6 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para
pcSlice->setMaxNumAffineMergeCand( 0 );
}
else
#endif
if ( sps->getSpsNext().getUseAffine() )
{
READ_UVLC( uiCode, "five_minus_max_num_affine_merge_cand" );
......
......@@ -1209,11 +1209,7 @@ void CABACWriter::prediction_unit( const PredictionUnit& pu )
}
if( pu.mergeFlag )
{
#if JVET_L0369_SUBBLOCK_MERGE
subblock_merge_flag( *pu.cu );
#else
affine_flag ( *pu.cu );
#endif
MHIntra_flag( pu );
if ( pu.mhIntraFlag )
{
......@@ -1273,7 +1269,6 @@ void CABACWriter::prediction_unit( const PredictionUnit& pu )
}
}
#if JVET_L0369_SUBBLOCK_MERGE
void CABACWriter::subblock_merge_flag( const CodingUnit& cu )
{
if ( cu.firstPU->mergeFlag && (cu.firstPU->mmvdMergeFlag || cu.mmvdSkip) )
......@@ -1288,11 +1283,9 @@ void CABACWriter::subblock_merge_flag( const 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 );
}
}
#endif
void CABACWriter::affine_flag( const 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 )
{
unsigned ctxId = DeriveCtx::CtxAffineFlag( cu );
......@@ -1306,41 +1299,6 @@ void CABACWriter::affine_flag( const CodingUnit& cu )
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
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;
}
unsigned ctxId = DeriveCtx::CtxAffineFlag( cu );
m_BinEncoder.encodeBin( cu.affine, Ctx::AffineFlag( ctxId ) );
DTRACE( g_trace_ctx, D_COMMON, " (%d) affine_flag() affine=%d\n", DTRACE_GET_COUNTER(g_trace_ctx, D_COMMON), cu.affine ? 1 : 0 );
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() )
{
unsigned ctxId = 0;
m_BinEncoder.encodeBin( cu.affineType, Ctx::AffineType( ctxId ) );
DTRACE( g_trace_ctx, D_COMMON, " (%d) affine_type() affine_type=%d\n", DTRACE_GET_COUNTER( g_trace_ctx, D_COMMON ), cu.affineType ? 1 : 0 );
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 );
}
#endif
}
void CABACWriter::merge_flag( const PredictionUnit& pu )
......
......@@ -109,9 +109,7 @@ public:
void prediction_unit ( const PredictionUnit& pu );
void merge_flag ( const PredictionUnit& pu );
void affine_flag ( const CodingUnit& cu );
#if JVET_L0369_SUBBLOCK_MERGE
void subblock_merge_flag ( const CodingUnit& cu );
#endif
void merge_idx ( const PredictionUnit& pu );
void mmvd_merge_idx(const PredictionUnit& pu);
void imv_mode ( const CodingUnit& cu );
......
......@@ -2420,7 +2420,6 @@ void EncCu::xCheckRDCostAffineMerge2Nx2N( CodingStructure *&tempCS, CodingStruct
AffineMergeCtx affineMergeCtx;
const SPS &sps = *tempCS->sps;
#if JVET_L0369_SUBBLOCK_MERGE
MergeCtx mrgCtx;
if ( sps.getSpsNext().getUseSubPuMvp() )
{
......@@ -2428,7 +2427,6 @@ void EncCu::xCheckRDCostAffineMerge2Nx2N( CodingStructure *&tempCS, CodingStruct
mrgCtx.subPuMvpMiBuf = MotionBuf( m_SubPuMiBuf, bufSize );
affineMergeCtx.mrgCtx = &mrgCtx;
}
#endif
{
// first get merge candidates
......@@ -2522,7 +2520,6 @@ void EncCu::xCheckRDCostAffineMerge2Nx2N( CodingStructure *&tempCS, CodingStruct
cu.affineType = affineMergeCtx.affineType[uiMergeCand];
cu.GBiIdx = affineMergeCtx.GBiIdx[uiMergeCand];
#if JVET_L0369_SUBBLOCK_MERGE
pu.mergeType = affineMergeCtx.mergeType[uiMergeCand];
if ( pu.mergeType == MRG_TYPE_SUBPU_ATMVP )
{
......@@ -2532,14 +2529,11 @@ void EncCu::xCheckRDCostAffineMerge2Nx2N( CodingStructure *&tempCS, CodingStruct
}
else
{
#endif
PU::setAllAffineMvField( pu, affineMergeCtx.mvFieldNeighbours[(uiMergeCand << 1) + 0], REF_PIC_LIST_0 );
PU::setAllAffineMvField( pu, affineMergeCtx.mvFieldNeighbours[(uiMergeCand << 1) + 1], REF_PIC_LIST_1 );
PU::spanMotionInfo( pu );
#if JVET_L0369_SUBBLOCK_MERGE
}
#endif
distParam.cur = acMergeBuffer[uiMergeCand].Y();
......@@ -2616,7 +2610,6 @@ void EncCu::xCheckRDCostAffineMerge2Nx2N( CodingStructure *&tempCS, CodingStruct
cu.affineType = affineMergeCtx.affineType[uiMergeCand];
cu.GBiIdx = affineMergeCtx.GBiIdx[uiMergeCand];
#if JVET_L0369_SUBBLOCK_MERGE
pu.mergeType = affineMergeCtx.mergeType[uiMergeCand];
if ( pu.mergeType == MRG_TYPE_SUBPU_ATMVP )
{
......@@ -2626,14 +2619,11 @@ void EncCu::xCheckRDCostAffineMerge2Nx2N( CodingStructure *&tempCS, CodingStruct
}
else
{
#endif
PU::setAllAffineMvField( pu, affineMergeCtx.mvFieldNeighbours[(uiMergeCand << 1) + 0], REF_PIC_LIST_0 );
PU::setAllAffineMvField( pu, affineMergeCtx.mvFieldNeighbours[(uiMergeCand << 1) + 1], REF_PIC_LIST_1 );
PU::spanMotionInfo( pu );
#if JVET_L0369_SUBBLOCK_MERGE
}
#endif
if ( mrgTempBufSet )
{
......
......@@ -1141,11 +1141,7 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru
m_ComprCUCtxList.back().testModes.push_back( { ETM_MERGE_TRIANGLE, ETO_STANDARD, qp, lossless } );
}
m_ComprCUCtxList.back().testModes.push_back( { ETM_MERGE_SKIP, ETO_STANDARD, qp, lossless } );
#if JVET_L0369_SUBBLOCK_MERGE
if ( cs.sps->getSpsNext().getUseAffine() || cs.sps->getSpsNext().getUseSubPuMvp() )
#else
if( cs.sps->getSpsNext().getUseAffine() )
#endif
{
m_ComprCUCtxList.back().testModes.push_back( { ETM_AFFINE, ETO_STANDARD, qp, lossless } );
}
......@@ -1159,11 +1155,7 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru
m_ComprCUCtxList.back().testModes.push_back( { ETM_MERGE_TRIANGLE, ETO_STANDARD, qp, lossless } );
}
m_ComprCUCtxList.back().testModes.push_back( { ETM_MERGE_SKIP, ETO_STANDARD, qp, lossless } );
#if JVET_L0369_SUBBLOCK_MERGE
if ( cs.sps->getSpsNext().getUseAffine() || cs.sps->getSpsNext().getUseSubPuMvp() )
#else
if( cs.sps->getSpsNext().getUseAffine() )
#endif
{
m_ComprCUCtxList.back().testModes.push_back( { ETM_AFFINE, ETO_STANDARD, qp, lossless } );
}
......
......@@ -5260,11 +5260,7 @@ void InterSearch::encodeResAndCalcRdInterCU(CodingStructure &cs, Partitioner &pa
PredictionUnit &pu = *cs.getPU( partitioner.chType );
m_CABACEstimator->cu_skip_flag ( cu );
#if JVET_L0369_SUBBLOCK_MERGE
m_CABACEstimator->subblock_merge_flag( cu );
#else
m_CABACEstimator->affine_flag( cu );
#endif
m_CABACEstimator->triangle_mode ( cu );
if (cu.mmvdSkip)
{
......@@ -5453,11 +5449,7 @@ uint64_t InterSearch::xGetSymbolFracBitsInter(CodingStructure &cs, Partitioner &
}
m_CABACEstimator->cu_skip_flag ( cu );
#if JVET_L0369_SUBBLOCK_MERGE
m_CABACEstimator->subblock_merge_flag( cu );
#else
m_CABACEstimator->affine_flag ( cu );
#endif
m_CABACEstimator->triangle_mode ( cu );
if (cu.mmvdSkip)
{
......
......@@ -1358,15 +1358,9 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice )
#endif
if( !pcSlice->isIntra() )
{
#if JVET_L0369_SUBBLOCK_MERGE
CHECK( pcSlice->getMaxNumMergeCand() > MRG_MAX_NUM_CANDS, "More merge candidates signalled than supported" );
WRITE_UVLC( MRG_MAX_NUM_CANDS - pcSlice->getMaxNumMergeCand(), "six_minus_max_num_merge_cand" );
#else
CHECK( pcSlice->getMaxNumMergeCand() > ( MRG_MAX_NUM_CANDS - ( pcSlice->getSPS()->getSpsNext().getUseSubPuMvp() ? 0 : 2 ) ), "More merge candidates signalled than supported" );