xDeriveCUMV函数获取到了skip、merge一类模式、以及inter_ME与Affine_ME模式的mv,xReconInter函数则由得到的mv重建cu的reco像素。
首先由得到的mv,经过运动补偿MC,得到预测像素pred;
再调用xDecodeInterTexture函数将coeff经过反变换,得到残差像素resi;
pred像素和resi像素相加,即得到cu的重建像素reco。
当然,这只是大致的流程,具体的三角预测模式、MHIntra模式的过程有差别,在代码中有注释。
void DecCu::xReconInter(CodingUnit &cu)
{
#if JVET_L0124_L0208_TRIANGLE
if( cu.triangle ) //三角预测
{
//三角预测模式的候选列表已经在xDeriveCUMV函数中构建好
const uint8_t mergeIdx = cu.firstPU->mergeIdx; //三角预测的idx
const bool splitDir = g_triangleCombination[mergeIdx][0]; //三角预测的划分方向,以及两个模式
const uint8_t candIdx0 = g_triangleCombination[mergeIdx][1];
const uint8_t candIdx1 = g_triangleCombination[mergeIdx][2];
m_pcInterPred->motionCompensation4Triangle( cu, m_triangleMrgCtx, splitDir, candIdx0, candIdx1 ); //三角预测的MC
PU::spanTriangleMotionInfo( *cu.firstPU, m_triangleMrgCtx, mergeIdx, splitDir, candIdx0, candIdx1 );
}
else //MHIntra模式
{
#endif
#if JVET_L0100_MULTI_HYPOTHESIS_INTRA
m_pcIntraPred->geneIntrainterPred(cu); //MHIntra模式首先恢复得到intra的pred像素
#endif
// inter prediction
#if JVET_L0293_CPR
#if JVET_L0100_MULTI_HYPOTHESIS_INTRA
CHECK(cu.cpr && cu.firstPU->mhIntraFlag, "CPR and MHIntra cannot be used together");
#endif
CHECK(cu.cpr && cu.affine, "CPR and Affine cannot be used together");
#if JVET_L0124_L0208_TRIANGLE
CHECK(cu.cpr && cu.triangle, "CPR and triangle cannot be used together");
#endif
#if