HMエンコーダコード読解(13)——フレーム間予測の一つinterモード


入口関数xCheckRDCostInter.
主なプロセスは次のとおりです.
(1)現在の深さを得る.
(2)predInterSearchを呼び出し,ME(動き推定)とMC(動き補償)を行う.
(3)encodeResAndCalcrdInterCUを呼び出し,予測値から残差を求めてTUの分割を行い,変換,量子化などの操作およびRDコストの計算を行う.
(4)xCheckBestModeを呼び出して最適なモードを選択する.
#if AMP_MRG
Void TEncCu::xCheckRDCostInter( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize, Bool bUseMRG)
#else
Void TEncCu::xCheckRDCostInter( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize )
#endif
{
	//   
	UChar uhDepth = rpcTempCU->getDepth( 0 );

	rpcTempCU->setDepthSubParts( uhDepth, 0 );

	rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth );

	rpcTempCU->setPartSizeSubParts  ( ePartSize,  0, uhDepth );
	rpcTempCU->setPredModeSubParts  ( MODE_INTER, 0, uhDepth );

    //       ,                  ,      
    //              
#if AMP_MRG
	rpcTempCU->setMergeAMP (true);
	m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth], false, bUseMRG );
#else  
	m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth] );
#endif

#if AMP_MRG
	if ( !rpcTempCU->getMergeAMP() )
	{
		return;
	}
#endif

    //       
	m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcResiYuvBest[uhDepth], m_ppcRecoYuvTemp[uhDepth], false );
	rpcTempCU->getTotalCost()  = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );

	xCheckDQP( rpcTempCU );
	xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth);
}