ttom
UInt uiPartIdxRB;
Int uiLCUIdx = getAddr();
deriveRightBottomIdx( uiPUIdx, uiPartIdxRB ); //!< 当前PU的右下部的地址
UInt uiAbsPartIdxTmp = g_auiZscanToRaster[uiPartIdxRB];
UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth(); //!< CU以partition为单位的宽度
TComMv cColMv;
Int iRefIdx;
if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() ) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples() ) // image boundary check
{
uiLCUIdx = -1;
}//!< 横坐标超出图像边界
else if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples() )
{
uiLCUIdx = -1;
}//!< 纵坐标超出图像边界
else
{
if ( ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) && // is not at the last column of LCU
( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) ) // is not at the last row of LCU
{//!< 不在LCU的最后一列且不在LCU的最后一行,SIZE_NxN的第1个PU
uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + uiNumPartInCUWidth + 1 ]; //!< 下一行+1
uiLCUIdx = getAddr(); //!< 与当前PU属于相同的CU
}
else if ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) // is not at the last column of LCU But is last row of LCU
{//!< 不在LCU的最后一列但在LCU的最后一行,SIZE_Nx2N的第1个PU,SIZE_NxN的第3个PU,SIZE_nLx2N的第1个PU,SIZE_nRx2N的第1个PU
uiAbsPartAddr = g_auiRasterToZscan[ (uiAbsPartIdxTmp + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ];
uiLCUIdx = -1 ;
}
else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU
{//!< 不在LCU的最后一行但在LCU的最后一列,SIZE_2NxN的第1个PU,SIZE_NxN的第2个PU,SIZE_2NxnU的第1个PU,SIZE_2NxnD的第1个PU
uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + 1 ];
uiLCUIdx = getAddr() + 1;
}
else //is the right bottom corner of LCU,SIZE_2Nx2N
{
uiAbsPartAddr = 0;
uiLCUIdx = -1 ;
}
}
iRefIdx = 0;
Bool bExistMV = false;
UInt uiPartIdxCenter;
UInt uiCurLCUIdx = getAddr();
xDeriveCenterIdx( uiPUIdx, uiPartIdxCenter ); //!< 根据uiPUIdx计算PU的中心地址uiPartIdxCenter
//! 获取colocated CU的mv,并经scaled过的。
bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_0, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx );
if( bExistMV == false )
{
bExistMV = xGetColMVP( REF_PIC_LIST_0, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx );
}
if( bExistMV )
{
UInt uiArrayAddr = iCount;
abCandIsInter[uiArrayAddr] = true;
pcMvFieldNeighbours[uiArrayAddr << 1].setMvField( cColMv, iRefIdx );
if ( getSlice()->isInterB() )
{
iRefIdx = 0;
bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_1, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx);
if( bExistMV == false )
{
bExistMV = xGetColMVP( REF_PIC_LIST_1, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx );
}
if( bExistMV )
{
pcMvFieldNeighbours[ ( uiArrayAddr << 1 ) + 1 ].setMvField( cColMv, iRefIdx );
puhInterDirNeighbours[uiArrayAddr] = 3; //!< Bi
}
else
{
puhInterDirNeighbours[uiArrayAddr] = 1; //!< L0
}
}
else
{
puhInterDirNeighbours[uiArrayAddr] = 1; //!< L0
}
if ( mrgCandIdx == iCount )
{
return;
}
iCount++;
}
uiIdx++;
}
// early termination
if (iCount == getSlice()->getMaxNumMergeCand())
{
return;
}
UInt uiArrayAddr = iCount;
UInt uiCutoff = uiArrayAddr;
if ( getSlice()->isInterB())
{//! 参考draft Table 8-6 ---- Specification of l0CandIdx and l1CandIdx