The following is an analysis of tcomdatacu. cpp. This CPP is very important and should be analyzed several times. This is the analysis of tcomdatacu. cpp (1 ).
Void TComDataCU::getPartPosition( UInt partIdx, Int& xP, Int& yP, Int& nPSW, Int& nPSH){ UInt col = m_uiCUPelX; UInt row = m_uiCUPelY; switch ( m_pePartSize[0] ) { case SIZE_2NxN: nPSW = getWidth(0); nPSH = getHeight(0) >> 1; xP = col; yP = (partIdx ==0)? row: row + nPSH; break; case SIZE_Nx2N: nPSW = getWidth(0) >> 1; nPSH = getHeight(0); xP = (partIdx ==0)? col: col + nPSW; yP = row; break; case SIZE_NxN: nPSW = getWidth(0) >> 1; nPSH = getHeight(0) >> 1; xP = col + (partIdx&0x1)*nPSW; yP = row + (partIdx>>1)*nPSH; break; case SIZE_2NxnU: nPSW = getWidth(0); nPSH = ( partIdx == 0 ) ? getHeight(0) >> 2 : ( getHeight(0) >> 2 ) + ( getHeight(0) >> 1 ); xP = col; yP = (partIdx ==0)? row: row + getHeight(0) - nPSH; break; case SIZE_2NxnD: nPSW = getWidth(0); nPSH = ( partIdx == 0 ) ? ( getHeight(0) >> 2 ) + ( getHeight(0) >> 1 ) : getHeight(0) >> 2; xP = col; yP = (partIdx ==0)? row: row + getHeight(0) - nPSH; break; case SIZE_nLx2N: nPSW = ( partIdx == 0 ) ? getWidth(0) >> 2 : ( getWidth(0) >> 2 ) + ( getWidth(0) >> 1 ); nPSH = getHeight(0); xP = (partIdx ==0)? col: col + getWidth(0) - nPSW; yP = row; break; case SIZE_nRx2N: nPSW = ( partIdx == 0 ) ? ( getWidth(0) >> 2 ) + ( getWidth(0) >> 1 ) : getWidth(0) >> 2; nPSH = getHeight(0); xP = (partIdx ==0)? col: col + getWidth(0) - nPSW; yP = row; break; default: assert ( m_pePartSize[0] == SIZE_2Nx2N ); nPSW = getWidth(0); nPSH = getHeight(0); xP = col ; yP = row ; break; }}
In 2n * n, 2n * Nu, 2n * nd, the preceding partidx is 0, and the following part is 1;
In N * 2n, NL * 2n, NR * 2n, partidx on the left is 0, and 1 on the right;
In N * n, based on the quad-tree structure, partidx is 0, 1, 2, and 3, respectively;
In 2n * 2n, partidx can only be 0;
The value of XP and YP is the absolute position value in the upper left corner of the Cu block. npsw and npsh are the width and height of the current Cu block. Remember, Cu can be nested and Cu contains Cu, therefore, XP, YP, npsw, and npsh can uniquely determine the Cu block,
Limited by the time relationship, this is the first analysis today.