Changeset 1465 in SHVCSoftware
- Timestamp:
- 25 Aug 2015, 20:07:48 (9 years ago)
- Location:
- branches/SHM-dev/source/Lib
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-dev/source/Lib/TLibCommon/CommonDef.h
r1432 r1465 139 139 140 140 static const Int AMVP_MAX_NUM_CANDS = 2; ///< AMVP: advanced motion vector prediction - max number of final candidates 141 static const Int AMVP_MAX_NUM_CANDS_MEM = 3; ///< AMVP: advanced motion vector prediction - max number of candidates142 141 static const Int AMVP_DECIMATION_FACTOR = 4; 143 142 static const Int MRG_MAX_NUM_CANDS = 5; ///< MERGE -
branches/SHM-dev/source/Lib/TLibCommon/TComDataCU.cpp
r1442 r1465 407 407 } 408 408 409 Bool TComDataCU::isLastSubCUOfCtu(const UInt absPartIdx) 409 Bool TComDataCU::isLastSubCUOfCtu(const UInt absPartIdx) const 410 410 { 411 411 const TComSPS &sps=*(getSlice()->getSPS()); … … 1036 1036 // -------------------------------------------------------------------------------------------------------------------- 1037 1037 1038 TComDataCU* TComDataCU::getPULeft( UInt& uiLPartUnitIdx,1039 UInt uiCurrPartUnitIdx,1040 Bool bEnforceSliceRestriction,1041 Bool bEnforceTileRestriction )1038 const TComDataCU* TComDataCU::getPULeft( UInt& uiLPartUnitIdx, 1039 UInt uiCurrPartUnitIdx, 1040 Bool bEnforceSliceRestriction, 1041 Bool bEnforceTileRestriction ) const 1042 1042 { 1043 1043 UInt uiAbsPartIdx = g_auiZscanToRaster[uiCurrPartUnitIdx]; … … 1068 1068 1069 1069 1070 TComDataCU* TComDataCU::getPUAbove( UInt& uiAPartUnitIdx,1071 UInt uiCurrPartUnitIdx,1072 Bool bEnforceSliceRestriction,1073 Bool planarAtCtuBoundary,1074 Bool bEnforceTileRestriction )1070 const TComDataCU* TComDataCU::getPUAbove( UInt& uiAPartUnitIdx, 1071 UInt uiCurrPartUnitIdx, 1072 Bool bEnforceSliceRestriction, 1073 Bool planarAtCtuBoundary, 1074 Bool bEnforceTileRestriction ) const 1075 1075 { 1076 1076 UInt uiAbsPartIdx = g_auiZscanToRaster[uiCurrPartUnitIdx]; … … 1106 1106 } 1107 1107 1108 TComDataCU* TComDataCU::getPUAboveLeft( UInt& uiALPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction ) 1108 const TComDataCU* TComDataCU::getPUAboveLeft( UInt& uiALPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction ) const 1109 1109 { 1110 1110 UInt uiAbsPartIdx = g_auiZscanToRaster[uiCurrPartUnitIdx]; … … 1153 1153 } 1154 1154 1155 TComDataCU* TComDataCU::getPUBelowLeft(UInt& uiBLPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset, Bool bEnforceSliceRestriction) 1155 const TComDataCU* TComDataCU::getPUBelowLeft(UInt& uiBLPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset, Bool bEnforceSliceRestriction) const 1156 1156 { 1157 1157 UInt uiAbsPartIdxLB = g_auiZscanToRaster[uiCurrPartUnitIdx]; … … 1201 1201 } 1202 1202 1203 TComDataCU* TComDataCU::getPUAboveRight(UInt& uiARPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset, Bool bEnforceSliceRestriction) 1203 const TComDataCU* TComDataCU::getPUAboveRight(UInt& uiARPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset, Bool bEnforceSliceRestriction) const 1204 1204 { 1205 1205 UInt uiAbsPartIdxRT = g_auiZscanToRaster[uiCurrPartUnitIdx]; … … 1265 1265 *\returns TComDataCU* point of TComDataCU of left QpMinCu 1266 1266 */ 1267 TComDataCU* TComDataCU::getQpMinCuLeft( UInt& uiLPartUnitIdx, UInt uiCurrAbsIdxInCtu ) 1267 const TComDataCU* TComDataCU::getQpMinCuLeft( UInt& uiLPartUnitIdx, UInt uiCurrAbsIdxInCtu ) const 1268 1268 { 1269 1269 const UInt numPartInCtuWidth = m_pcPic->getNumPartInCtuWidth(); … … 1292 1292 *\returns TComDataCU* point of TComDataCU of above QpMinCu 1293 1293 */ 1294 TComDataCU* TComDataCU::getQpMinCuAbove( UInt& uiAPartUnitIdx, UInt uiCurrAbsIdxInCtu ) 1294 const TComDataCU* TComDataCU::getQpMinCuAbove( UInt& uiAPartUnitIdx, UInt uiCurrAbsIdxInCtu ) const 1295 1295 { 1296 1296 const UInt numPartInCtuWidth = m_pcPic->getNumPartInCtuWidth(); … … 1320 1320 *\returns SChar reference QP value 1321 1321 */ 1322 SChar TComDataCU::getRefQP( UInt uiCurrAbsIdxInCtu ) 1322 SChar TComDataCU::getRefQP( UInt uiCurrAbsIdxInCtu ) const 1323 1323 { 1324 1324 UInt lPartIdx = MAX_UINT; 1325 1325 UInt aPartIdx = MAX_UINT; 1326 TComDataCU* cULeft = getQpMinCuLeft ( lPartIdx, m_absZIdxInCtu + uiCurrAbsIdxInCtu );1327 TComDataCU* cUAbove = getQpMinCuAbove( aPartIdx, m_absZIdxInCtu + uiCurrAbsIdxInCtu );1326 const TComDataCU* cULeft = getQpMinCuLeft ( lPartIdx, m_absZIdxInCtu + uiCurrAbsIdxInCtu ); 1327 const TComDataCU* cUAbove = getQpMinCuAbove( aPartIdx, m_absZIdxInCtu + uiCurrAbsIdxInCtu ); 1328 1328 return (((cULeft? cULeft->getQP( lPartIdx ): getLastCodedQP( uiCurrAbsIdxInCtu )) + (cUAbove? cUAbove->getQP( aPartIdx ): getLastCodedQP( uiCurrAbsIdxInCtu )) + 1) >> 1); 1329 1329 } 1330 1330 1331 Int TComDataCU::getLastValidPartIdx( Int iAbsPartIdx ) 1331 Int TComDataCU::getLastValidPartIdx( Int iAbsPartIdx ) const 1332 1332 { 1333 1333 Int iLastValidPartIdx = iAbsPartIdx-1; … … 1341 1341 } 1342 1342 1343 SChar TComDataCU::getLastCodedQP( UInt uiAbsPartIdx ) 1343 SChar TComDataCU::getLastCodedQP( UInt uiAbsPartIdx ) const 1344 1344 { 1345 1345 UInt uiQUPartIdxMask = ~((1<<((getSlice()->getSPS()->getMaxTotalCUDepth() - getSlice()->getPPS()->getMaxCuDQPDepth())<<1))-1); … … 1381 1381 * \returns true if the CU is coded in lossless coding mode; false if otherwise 1382 1382 */ 1383 Bool TComDataCU::isLosslessCoded(UInt absPartIdx) 1383 Bool TComDataCU::isLosslessCoded(UInt absPartIdx) const 1384 1384 { 1385 1385 return (getSlice()->getPPS()->getTransquantBypassEnableFlag() && getCUTransquantBypass (absPartIdx)); … … 1393 1393 *\param [out] uiModeList pointer to chroma intra modes array 1394 1394 */ 1395 Void TComDataCU::getAllowedChromaDir( UInt uiAbsPartIdx, UInt uiModeList[NUM_CHROMA_MODE] ) 1395 Void TComDataCU::getAllowedChromaDir( UInt uiAbsPartIdx, UInt uiModeList[NUM_CHROMA_MODE] ) const 1396 1396 { 1397 1397 uiModeList[0] = PLANAR_IDX; … … 1421 1421 *\returns Number of MPM 1422 1422 */ 1423 Void TComDataCU::getIntraDirPredictor( UInt uiAbsPartIdx, Int uiIntraDirPred[NUM_MOST_PROBABLE_MODES], const ComponentID compID, Int* piMode ) 1424 { 1425 TComDataCU* pcCULeft, *pcCUAbove; 1423 Void TComDataCU::getIntraDirPredictor( UInt uiAbsPartIdx, Int uiIntraDirPred[NUM_MOST_PROBABLE_MODES], const ComponentID compID, Int* piMode ) const 1424 { 1426 1425 UInt LeftPartIdx = MAX_UINT; 1427 1426 UInt AbovePartIdx = MAX_UINT; … … 1433 1432 const ChromaFormat chForm = getPic()->getChromaFormat(); 1434 1433 // Get intra direction of left PU 1435 pcCULeft = getPULeft( LeftPartIdx, m_absZIdxInCtu + uiAbsPartIdx );1434 const TComDataCU *pcCULeft = getPULeft( LeftPartIdx, m_absZIdxInCtu + uiAbsPartIdx ); 1436 1435 1437 1436 if (isChroma(compID)) … … 1442 1441 1443 1442 // Get intra direction of above PU 1444 pcCUAbove = getPUAbove( AbovePartIdx, m_absZIdxInCtu + uiAbsPartIdx, true, true );1443 const TComDataCU *pcCUAbove = getPUAbove( AbovePartIdx, m_absZIdxInCtu + uiAbsPartIdx, true, true ); 1445 1444 1446 1445 if (isChroma(compID)) … … 1507 1506 } 1508 1507 1509 UInt TComDataCU::getCtxSplitFlag( UInt uiAbsPartIdx, UInt uiDepth ) 1510 { 1511 TComDataCU* pcTempCU;1512 UInt uiTempPartIdx;1513 UInt uiCtx;1508 UInt TComDataCU::getCtxSplitFlag( UInt uiAbsPartIdx, UInt uiDepth ) const 1509 { 1510 const TComDataCU* pcTempCU; 1511 UInt uiTempPartIdx; 1512 UInt uiCtx; 1514 1513 // Get left split flag 1515 1514 pcTempCU = getPULeft( uiTempPartIdx, m_absZIdxInCtu + uiAbsPartIdx ); … … 1523 1522 } 1524 1523 1525 UInt TComDataCU::getCtxQtCbf( TComTU &rTu, const ChannelType chType ) 1524 UInt TComDataCU::getCtxQtCbf( TComTU &rTu, const ChannelType chType ) const 1526 1525 { 1527 1526 const UInt transformDepth = rTu.GetTransformDepthRel(); … … 1538 1537 } 1539 1538 1540 UInt TComDataCU::getQuadtreeTULog2MinSizeInCU( UInt absPartIdx ) 1539 UInt TComDataCU::getQuadtreeTULog2MinSizeInCU( UInt absPartIdx ) const 1541 1540 { 1542 1541 UInt log2CbSize = g_aucConvertToBit[getWidth( absPartIdx )] + 2; … … 1565 1564 } 1566 1565 1567 UInt TComDataCU::getCtxSkipFlag( UInt uiAbsPartIdx ) 1568 { 1569 TComDataCU* pcTempCU;1570 UInt uiTempPartIdx;1571 UInt uiCtx = 0;1566 UInt TComDataCU::getCtxSkipFlag( UInt uiAbsPartIdx ) const 1567 { 1568 const TComDataCU* pcTempCU; 1569 UInt uiTempPartIdx; 1570 UInt uiCtx = 0; 1572 1571 1573 1572 // Get BCBP of left PU … … 1582 1581 } 1583 1582 1584 UInt TComDataCU::getCtxInterDir( UInt uiAbsPartIdx ) 1583 UInt TComDataCU::getCtxInterDir( UInt uiAbsPartIdx ) const 1585 1584 { 1586 1585 return getDepth( uiAbsPartIdx ); … … 1588 1587 1589 1588 1590 UChar TComDataCU::getQtRootCbf( UInt uiIdx ) 1589 UChar TComDataCU::getQtRootCbf( UInt uiIdx ) const 1591 1590 { 1592 1591 const UInt numberValidComponents = getPic()->getNumberValidComponents(); … … 1644 1643 } 1645 1644 1646 Bool TComDataCU::isFirstAbsZorderIdxInDepth (UInt uiAbsPartIdx, UInt uiDepth) 1645 Bool TComDataCU::isFirstAbsZorderIdxInDepth (UInt uiAbsPartIdx, UInt uiDepth) const 1647 1646 { 1648 1647 UInt uiPartNumb = m_pcPic->getNumPartitionsInCtu() >> (uiDepth << 1); … … 1892 1891 } 1893 1892 1894 UChar TComDataCU::getNumPartitions(const UInt uiAbsPartIdx) 1893 UChar TComDataCU::getNumPartitions(const UInt uiAbsPartIdx) const 1895 1894 { 1896 1895 UChar iNumPart = 0; … … 1913 1912 1914 1913 // This is for use by a leaf/sub CU object only, with no additional AbsPartIdx 1915 Void TComDataCU::getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight ) 1914 Void TComDataCU::getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight ) const 1916 1915 { 1917 1916 switch ( m_pePartSize[0] ) … … 1953 1952 } 1954 1953 1955 1956 Void TComDataCU::getMvField ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList, TComMvField& rcMvField )1954 // static member function 1955 Void TComDataCU::getMvField ( const TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList, TComMvField& rcMvField ) 1957 1956 { 1958 1957 if ( pcCU == NULL ) // OUT OF BOUNDARY … … 1963 1962 } 1964 1963 1965 TComCUMvField* pcCUMvField = pcCU->getCUMvField( eRefPicList );1964 const TComCUMvField* pcCUMvField = pcCU->getCUMvField( eRefPicList ); 1966 1965 rcMvField.setMvField( pcCUMvField->getMv( uiAbsPartIdx ), pcCUMvField->getRefIdx( uiAbsPartIdx ) ); 1967 1966 } 1968 1967 1969 Void TComDataCU::deriveLeftRightTopIdxGeneral ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ) 1968 Void TComDataCU::deriveLeftRightTopIdxGeneral ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ) const 1970 1969 { 1971 1970 ruiPartIdxLT = m_absZIdxInCtu + uiAbsPartIdx; … … 2016 2015 } 2017 2016 2018 Void TComDataCU::deriveLeftBottomIdxGeneral( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLB ) 2017 Void TComDataCU::deriveLeftBottomIdxGeneral( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLB ) const 2019 2018 { 2020 2019 UInt uiPUHeight = 0; … … 2063 2062 } 2064 2063 2065 Void TComDataCU::deriveLeftRightTopIdx ( UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ) 2064 Void TComDataCU::deriveLeftRightTopIdx ( UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ) const 2066 2065 { 2067 2066 ruiPartIdxLT = m_absZIdxInCtu; … … 2103 2102 } 2104 2103 2105 Void TComDataCU::deriveLeftBottomIdx( UInt uiPartIdx, UInt& ruiPartIdxLB ) 2104 Void TComDataCU::deriveLeftBottomIdx( UInt uiPartIdx, UInt& ruiPartIdxLB ) const 2106 2105 { 2107 2106 ruiPartIdxLB = g_auiRasterToZscan [g_auiZscanToRaster[ m_absZIdxInCtu ] + ( ((m_puhHeight[0] / m_pcPic->getMinCUHeight())>>1) - 1)*m_pcPic->getNumPartInCtuWidth()]; … … 2143 2142 * \param [out] ruiPartIdxRB partition index of neighbouring bottom right block 2144 2143 */ 2145 Void TComDataCU::deriveRightBottomIdx( UInt uiPartIdx, UInt &ruiPartIdxRB ) 2144 Void TComDataCU::deriveRightBottomIdx( UInt uiPartIdx, UInt &ruiPartIdxRB ) const 2146 2145 { 2147 2146 ruiPartIdxRB = g_auiRasterToZscan [g_auiZscanToRaster[ m_absZIdxInCtu ] + ( ((m_puhHeight[0] / m_pcPic->getMinCUHeight())>>1) - 1)*m_pcPic->getNumPartInCtuWidth() + m_puhWidth[0] / m_pcPic->getMinCUWidth() - 1]; … … 2179 2178 } 2180 2179 2181 Bool TComDataCU::hasEqualMotion( UInt uiAbsPartIdx, TComDataCU* pcCandCU, UInt uiCandAbsPartIdx )2180 Bool TComDataCU::hasEqualMotion( UInt uiAbsPartIdx, const TComDataCU* pcCandCU, UInt uiCandAbsPartIdx ) const 2182 2181 { 2183 2182 if ( getInterDir( uiAbsPartIdx ) != pcCandCU->getInterDir( uiCandAbsPartIdx ) ) … … 2202 2201 2203 2202 //! Construct a list of merging candidates 2204 Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx ) 2203 Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx ) const 2205 2204 { 2206 2205 UInt uiAbsPartAddr = m_absZIdxInCtu + uiAbsPartIdx; … … 2226 2225 //left 2227 2226 UInt uiLeftPartIdx = 0; 2228 TComDataCU* pcCULeft = 0; 2229 pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB ); 2227 const TComDataCU *pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB ); 2230 2228 2231 2229 Bool isAvailableA1 = pcCULeft && … … 2240 2238 puhInterDirNeighbours[iCount] = pcCULeft->getInterDir( uiLeftPartIdx ); 2241 2239 // get Mv from Left 2242 pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );2240 TComDataCU::getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 2243 2241 if ( getSlice()->isInterB() ) 2244 2242 { 2245 pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );2243 TComDataCU::getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 2246 2244 } 2247 2245 if ( mrgCandIdx == iCount ) … … 2259 2257 // above 2260 2258 UInt uiAbovePartIdx = 0; 2261 TComDataCU* pcCUAbove = 0; 2262 pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT ); 2259 const TComDataCU *pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT ); 2263 2260 2264 2261 Bool isAvailableB1 = pcCUAbove && … … 2273 2270 puhInterDirNeighbours[iCount] = pcCUAbove->getInterDir( uiAbovePartIdx ); 2274 2271 // get Mv from Left 2275 pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );2272 TComDataCU::getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 2276 2273 if ( getSlice()->isInterB() ) 2277 2274 { 2278 pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );2275 TComDataCU::getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 2279 2276 } 2280 2277 if ( mrgCandIdx == iCount ) … … 2292 2289 // above right 2293 2290 UInt uiAboveRightPartIdx = 0; 2294 TComDataCU* pcCUAboveRight = 0; 2295 pcCUAboveRight = getPUAboveRight( uiAboveRightPartIdx, uiPartIdxRT ); 2291 const TComDataCU *pcCUAboveRight = getPUAboveRight( uiAboveRightPartIdx, uiPartIdxRT ); 2296 2292 2297 2293 Bool isAvailableB0 = pcCUAboveRight && … … 2305 2301 puhInterDirNeighbours[iCount] = pcCUAboveRight->getInterDir( uiAboveRightPartIdx ); 2306 2302 // get Mv from Left 2307 pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );2303 TComDataCU::getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 2308 2304 if ( getSlice()->isInterB() ) 2309 2305 { 2310 pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );2306 TComDataCU::getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 2311 2307 } 2312 2308 if ( mrgCandIdx == iCount ) … … 2324 2320 //left bottom 2325 2321 UInt uiLeftBottomPartIdx = 0; 2326 TComDataCU* pcCULeftBottom = 0; 2327 pcCULeftBottom = this->getPUBelowLeft( uiLeftBottomPartIdx, uiPartIdxLB ); 2322 const TComDataCU *pcCULeftBottom = this->getPUBelowLeft( uiLeftBottomPartIdx, uiPartIdxLB ); 2328 2323 2329 2324 Bool isAvailableA0 = pcCULeftBottom && … … 2337 2332 puhInterDirNeighbours[iCount] = pcCULeftBottom->getInterDir( uiLeftBottomPartIdx ); 2338 2333 // get Mv from Left 2339 pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );2334 TComDataCU::getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 2340 2335 if ( getSlice()->isInterB() ) 2341 2336 { 2342 pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );2337 TComDataCU::getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 2343 2338 } 2344 2339 if ( mrgCandIdx == iCount ) … … 2358 2353 { 2359 2354 UInt uiAboveLeftPartIdx = 0; 2360 TComDataCU* pcCUAboveLeft = 0; 2361 pcCUAboveLeft = getPUAboveLeft( uiAboveLeftPartIdx, uiAbsPartAddr ); 2355 const TComDataCU *pcCUAboveLeft = getPUAboveLeft( uiAboveLeftPartIdx, uiAbsPartAddr ); 2362 2356 2363 2357 Bool isAvailableB2 = pcCUAboveLeft && … … 2372 2366 puhInterDirNeighbours[iCount] = pcCUAboveLeft->getInterDir( uiAboveLeftPartIdx ); 2373 2367 // get Mv from Left 2374 pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );2368 TComDataCU::getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 2375 2369 if ( getSlice()->isInterB() ) 2376 2370 { 2377 pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );2371 TComDataCU::getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 2378 2372 } 2379 2373 if ( mrgCandIdx == iCount ) … … 2560 2554 * \param xP, yP location of the upper-left corner pixel of the current PU 2561 2555 */ 2562 Bool TComDataCU::isDiffMER(Int xN, Int yN, Int xP, Int yP) 2556 Bool TComDataCU::isDiffMER(Int xN, Int yN, Int xP, Int yP) const 2563 2557 { 2564 2558 … … 2580 2574 * \param nPSW, nPSH size of the current PU 2581 2575 */ 2582 Void TComDataCU::getPartPosition( UInt partIdx, Int& xP, Int& yP, Int& nPSW, Int& nPSH) 2576 Void TComDataCU::getPartPosition( UInt partIdx, Int& xP, Int& yP, Int& nPSW, Int& nPSH) const 2583 2577 { 2584 2578 UInt col = m_uiCUPelX; … … 2641 2635 } 2642 2636 2643 /** Constructs a list of candidates for AMVP 2637 /** Constructs a list of candidates for AMVP (See specification, section "Derivation process for motion vector predictor candidates") 2644 2638 * \param uiPartIdx 2645 2639 * \param uiPartAddr … … 2648 2642 * \param pInfo 2649 2643 */ 2650 Void TComDataCU::fillMvpCand ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo ) 2651 { 2652 TComMv cMvPred; 2653 Bool bAddedSmvp = false; 2654 2644 Void TComDataCU::fillMvpCand ( const UInt partIdx, const UInt partAddr, const RefPicList eRefPicList, const Int refIdx, AMVPInfo* pInfo ) const 2645 { 2655 2646 pInfo->iN = 0; 2656 if ( iRefIdx < 0)2647 if (refIdx < 0) 2657 2648 { 2658 2649 return; … … 2660 2651 2661 2652 //-- Get Spatial MV 2662 UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB; 2663 const UInt numPartInCtuWidth = m_pcPic->getNumPartInCtuWidth(); 2664 const UInt numPartInCtuHeight = m_pcPic->getNumPartInCtuHeight(); 2665 Bool bAdded = false; 2666 2667 deriveLeftRightTopIdx( uiPartIdx, uiPartIdxLT, uiPartIdxRT ); 2668 deriveLeftBottomIdx( uiPartIdx, uiPartIdxLB ); 2669 2670 TComDataCU* tmpCU = NULL; 2671 UInt idx; 2672 tmpCU = getPUBelowLeft(idx, uiPartIdxLB); 2673 bAddedSmvp = (tmpCU != NULL) && (tmpCU->isInter(idx)); 2674 2675 if (!bAddedSmvp) 2676 { 2677 tmpCU = getPULeft(idx, uiPartIdxLB); 2678 bAddedSmvp = (tmpCU != NULL) && (tmpCU->isInter(idx)); 2653 UInt partIdxLT, partIdxRT, partIdxLB; 2654 deriveLeftRightTopIdx( partIdx, partIdxLT, partIdxRT ); 2655 deriveLeftBottomIdx( partIdx, partIdxLB ); 2656 2657 Bool isScaledFlagLX = false; /// variable name from specification; true when the PUs below left or left are available (availableA0 || availableA1). 2658 { 2659 UInt idx; 2660 const TComDataCU* tmpCU = getPUBelowLeft(idx, partIdxLB); 2661 isScaledFlagLX = (tmpCU != NULL) && (tmpCU->isInter(idx)); 2662 if (!isScaledFlagLX) 2663 { 2664 tmpCU = getPULeft(idx, partIdxLB); 2665 isScaledFlagLX = (tmpCU != NULL) && (tmpCU->isInter(idx)); 2666 } 2679 2667 } 2680 2668 2681 2669 // Left predictor search 2682 bAdded = xAddMVPCand( pInfo, eRefPicList, iRefIdx, uiPartIdxLB, MD_BELOW_LEFT); 2683 if (!bAdded) 2684 { 2685 bAdded = xAddMVPCand( pInfo, eRefPicList, iRefIdx, uiPartIdxLB, MD_LEFT ); 2686 } 2687 2688 if(!bAdded) 2689 { 2690 bAdded = xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxLB, MD_BELOW_LEFT); 2670 if (isScaledFlagLX) 2671 { 2672 Bool bAdded = xAddMVPCandUnscaled( *pInfo, eRefPicList, refIdx, partIdxLB, MD_BELOW_LEFT); 2691 2673 if (!bAdded) 2692 2674 { 2693 xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxLB, MD_LEFT ); 2675 bAdded = xAddMVPCandUnscaled( *pInfo, eRefPicList, refIdx, partIdxLB, MD_LEFT ); 2676 if(!bAdded) 2677 { 2678 bAdded = xAddMVPCandWithScaling( *pInfo, eRefPicList, refIdx, partIdxLB, MD_BELOW_LEFT); 2679 if (!bAdded) 2680 { 2681 xAddMVPCandWithScaling( *pInfo, eRefPicList, refIdx, partIdxLB, MD_LEFT ); 2682 } 2683 } 2694 2684 } 2695 2685 } 2696 2686 2697 2687 // Above predictor search 2698 bAdded = xAddMVPCand( pInfo, eRefPicList, iRefIdx, uiPartIdxRT, MD_ABOVE_RIGHT); 2699 2700 if (!bAdded) 2701 { 2702 bAdded = xAddMVPCand( pInfo, eRefPicList, iRefIdx, uiPartIdxRT, MD_ABOVE); 2703 } 2704 2705 if(!bAdded) 2706 { 2707 xAddMVPCand( pInfo, eRefPicList, iRefIdx, uiPartIdxLT, MD_ABOVE_LEFT); 2708 } 2709 2710 if(!bAddedSmvp) 2711 { 2712 bAdded = xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxRT, MD_ABOVE_RIGHT); 2688 { 2689 Bool bAdded = xAddMVPCandUnscaled( *pInfo, eRefPicList, refIdx, partIdxRT, MD_ABOVE_RIGHT); 2713 2690 if (!bAdded) 2714 2691 { 2715 bAdded = xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxRT, MD_ABOVE); 2716 } 2717 2718 if(!bAdded) 2719 { 2720 xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxLT, MD_ABOVE_LEFT); 2692 bAdded = xAddMVPCandUnscaled( *pInfo, eRefPicList, refIdx, partIdxRT, MD_ABOVE); 2693 if(!bAdded) 2694 { 2695 xAddMVPCandUnscaled( *pInfo, eRefPicList, refIdx, partIdxLT, MD_ABOVE_LEFT); 2696 } 2697 } 2698 } 2699 2700 if(!isScaledFlagLX) 2701 { 2702 Bool bAdded = xAddMVPCandWithScaling( *pInfo, eRefPicList, refIdx, partIdxRT, MD_ABOVE_RIGHT); 2703 if (!bAdded) 2704 { 2705 bAdded = xAddMVPCandWithScaling( *pInfo, eRefPicList, refIdx, partIdxRT, MD_ABOVE); 2706 if(!bAdded) 2707 { 2708 xAddMVPCandWithScaling( *pInfo, eRefPicList, refIdx, partIdxLT, MD_ABOVE_LEFT); 2709 } 2721 2710 } 2722 2711 } … … 2730 2719 } 2731 2720 2732 if ( getSlice()->getEnableTMVPFlag() )2721 if (pInfo->iN < AMVP_MAX_NUM_CANDS && getSlice()->getEnableTMVPFlag() ) 2733 2722 { 2734 2723 // Get Temporal Motion Predictor 2735 Int iRefIdx_Col = iRefIdx; 2724 const UInt numPartInCtuWidth = m_pcPic->getNumPartInCtuWidth(); 2725 const UInt numPartInCtuHeight = m_pcPic->getNumPartInCtuHeight(); 2726 const Int refIdx_Col = refIdx; 2736 2727 TComMv cColMv; 2737 UInt uiPartIdxRB; 2738 UInt uiAbsPartIdx; 2739 UInt uiAbsPartAddr; 2740 2741 deriveRightBottomIdx( uiPartIdx, uiPartIdxRB ); 2742 uiAbsPartAddr = m_absZIdxInCtu + uiPartAddr; 2728 UInt partIdxRB; 2729 UInt absPartIdx; 2730 2731 deriveRightBottomIdx( partIdx, partIdxRB ); 2732 UInt absPartAddr = m_absZIdxInCtu + partAddr; 2743 2733 2744 2734 //---- co-located RightBottom Temporal Predictor (H) ---// 2745 uiAbsPartIdx = g_auiZscanToRaster[uiPartIdxRB];2735 absPartIdx = g_auiZscanToRaster[partIdxRB]; 2746 2736 Int ctuRsAddr = -1; 2747 2737 2748 2738 #if SVC_EXTENSION 2749 if ( ( ( m_pcPic->getCtu(m_ctuRsAddr)->getCUPelX() + g_auiRasterToPelX[ uiAbsPartIdx] + m_pcPic->getMinCUWidth () ) < m_pcSlice->getPicWidthInLumaSamples()) // image boundary check2750 && ( ( m_pcPic->getCtu(m_ctuRsAddr)->getCUPelY() + g_auiRasterToPelY[ uiAbsPartIdx] + m_pcPic->getMinCUHeight() ) < m_pcSlice->getPicHeightInLumaSamples() ) )2739 if ( ( ( m_pcPic->getCtu(m_ctuRsAddr)->getCUPelX() + g_auiRasterToPelX[absPartIdx] + m_pcPic->getMinCUWidth () ) < m_pcSlice->getPicWidthInLumaSamples()) // image boundary check 2740 && ( ( m_pcPic->getCtu(m_ctuRsAddr)->getCUPelY() + g_auiRasterToPelY[absPartIdx] + m_pcPic->getMinCUHeight() ) < m_pcSlice->getPicHeightInLumaSamples() ) ) 2751 2741 #else 2752 if ( ( ( m_pcPic->getCtu(m_ctuRsAddr)->getCUPelX() + g_auiRasterToPelX[ uiAbsPartIdx] + m_pcPic->getMinCUWidth () ) < m_pcSlice->getSPS()->getPicWidthInLumaSamples () ) // image boundary check2753 && ( ( m_pcPic->getCtu(m_ctuRsAddr)->getCUPelY() + g_auiRasterToPelY[ uiAbsPartIdx] + m_pcPic->getMinCUHeight() ) < m_pcSlice->getSPS()->getPicHeightInLumaSamples() ) )2742 if ( ( ( m_pcPic->getCtu(m_ctuRsAddr)->getCUPelX() + g_auiRasterToPelX[absPartIdx] + m_pcPic->getMinCUWidth () ) < m_pcSlice->getSPS()->getPicWidthInLumaSamples () ) // image boundary check 2743 && ( ( m_pcPic->getCtu(m_ctuRsAddr)->getCUPelY() + g_auiRasterToPelY[absPartIdx] + m_pcPic->getMinCUHeight() ) < m_pcSlice->getSPS()->getPicHeightInLumaSamples() ) ) 2754 2744 #endif 2755 2745 { 2756 if ( ( uiAbsPartIdx % numPartInCtuWidth < numPartInCtuWidth - 1 ) && // is not at the last column of CTU2757 ( uiAbsPartIdx / numPartInCtuWidth < numPartInCtuHeight - 1 ) ) // is not at the last row of CTU2758 { 2759 uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdx + numPartInCtuWidth + 1 ];2746 if ( ( absPartIdx % numPartInCtuWidth < numPartInCtuWidth - 1 ) && // is not at the last column of CTU 2747 ( absPartIdx / numPartInCtuWidth < numPartInCtuHeight - 1 ) ) // is not at the last row of CTU 2748 { 2749 absPartAddr = g_auiRasterToZscan[ absPartIdx + numPartInCtuWidth + 1 ]; 2760 2750 ctuRsAddr = getCtuRsAddr(); 2761 2751 } 2762 else if ( uiAbsPartIdx % numPartInCtuWidth < numPartInCtuWidth - 1 ) // is not at the last column of CTU But is last row of CTU2763 { 2764 uiAbsPartAddr = g_auiRasterToZscan[ (uiAbsPartIdx + numPartInCtuWidth + 1) % m_pcPic->getNumPartitionsInCtu() ];2765 } 2766 else if ( uiAbsPartIdx / numPartInCtuWidth < numPartInCtuHeight - 1 ) // is not at the last row of CTU But is last column of CTU2767 { 2768 uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdx + 1 ];2752 else if ( absPartIdx % numPartInCtuWidth < numPartInCtuWidth - 1 ) // is not at the last column of CTU But is last row of CTU 2753 { 2754 absPartAddr = g_auiRasterToZscan[ (absPartIdx + numPartInCtuWidth + 1) % m_pcPic->getNumPartitionsInCtu() ]; 2755 } 2756 else if ( absPartIdx / numPartInCtuWidth < numPartInCtuHeight - 1 ) // is not at the last row of CTU But is last column of CTU 2757 { 2758 absPartAddr = g_auiRasterToZscan[ absPartIdx + 1 ]; 2769 2759 ctuRsAddr = getCtuRsAddr() + 1; 2770 2760 } 2771 2761 else //is the right bottom corner of CTU 2772 2762 { 2773 uiAbsPartAddr = 0;2774 } 2775 } 2776 if ( ctuRsAddr >= 0 && xGetColMVP( eRefPicList, ctuRsAddr, uiAbsPartAddr, cColMv, iRefIdx_Col ) )2763 absPartAddr = 0; 2764 } 2765 } 2766 if ( ctuRsAddr >= 0 && xGetColMVP( eRefPicList, ctuRsAddr, absPartAddr, cColMv, refIdx_Col ) ) 2777 2767 { 2778 2768 pInfo->m_acMvCand[pInfo->iN++] = cColMv; … … 2781 2771 { 2782 2772 UInt uiPartIdxCenter; 2783 xDeriveCenterIdx( uiPartIdx, uiPartIdxCenter );2784 if (xGetColMVP( eRefPicList, getCtuRsAddr(), uiPartIdxCenter, cColMv, iRefIdx_Col ))2773 xDeriveCenterIdx( partIdx, uiPartIdxCenter ); 2774 if (xGetColMVP( eRefPicList, getCtuRsAddr(), uiPartIdxCenter, cColMv, refIdx_Col )) 2785 2775 { 2786 2776 pInfo->m_acMvCand[pInfo->iN++] = cColMv; … … 2788 2778 } 2789 2779 //---- co-located RightBottom Temporal Predictor ---// 2790 }2791 2792 if (pInfo->iN > AMVP_MAX_NUM_CANDS)2793 {2794 pInfo->iN = AMVP_MAX_NUM_CANDS;2795 2780 } 2796 2781 … … 2804 2789 2805 2790 2806 Bool TComDataCU::isBipredRestriction(UInt puIdx) 2791 Bool TComDataCU::isBipredRestriction(UInt puIdx) const 2807 2792 { 2808 2793 Int width = 0; … … 2830 2815 #endif 2831 2816 Int iHorMin = ( -(Int)sps.getMaxCUWidth() - iOffset - (Int)m_uiCUPelX + 1 ) << iMvShift; 2832 2817 2833 2818 #if SVC_EXTENSION 2834 2819 Int iVerMax = ( m_pcSlice->getPicHeightInLumaSamples() + iOffset - (Int)m_uiCUPelY - 1 ) << iMvShift; … … 2843 2828 2844 2829 2845 UInt TComDataCU::getIntraSizeIdx(UInt uiAbsPartIdx) 2830 UInt TComDataCU::getIntraSizeIdx(UInt uiAbsPartIdx) const 2846 2831 { 2847 2832 UInt uiShift = ( m_pePartSize[uiAbsPartIdx]==SIZE_NxN ? 1 : 0 ); … … 2880 2865 * \returns true if the current the block is skipped 2881 2866 */ 2882 Bool TComDataCU::isSkipped( UInt uiPartIdx ) 2867 Bool TComDataCU::isSkipped( UInt uiPartIdx ) const 2883 2868 { 2884 2869 return ( getSkipFlag( uiPartIdx ) ); … … 2889 2874 // ==================================================================================================================== 2890 2875 2891 Bool TComDataCU::xAddMVPCand ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir )2892 { 2893 TComDataCU* pcTmpCU = NULL;2894 UInt uiIdx;2876 Bool TComDataCU::xAddMVPCandUnscaled( AMVPInfo &info, const RefPicList eRefPicList, const Int iRefIdx, const UInt uiPartUnitIdx, const MVP_DIR eDir ) const 2877 { 2878 const TComDataCU* neibCU = NULL; 2879 UInt neibPUPartIdx; 2895 2880 switch( eDir ) 2896 2881 { 2897 2882 case MD_LEFT: 2898 2883 { 2899 pcTmpCU = getPULeft(uiIdx, uiPartUnitIdx);2884 neibCU = getPULeft(neibPUPartIdx, uiPartUnitIdx); 2900 2885 break; 2901 2886 } 2902 2887 case MD_ABOVE: 2903 2888 { 2904 pcTmpCU = getPUAbove(uiIdx, uiPartUnitIdx);2889 neibCU = getPUAbove(neibPUPartIdx, uiPartUnitIdx); 2905 2890 break; 2906 2891 } 2907 2892 case MD_ABOVE_RIGHT: 2908 2893 { 2909 pcTmpCU = getPUAboveRight(uiIdx, uiPartUnitIdx);2894 neibCU = getPUAboveRight(neibPUPartIdx, uiPartUnitIdx); 2910 2895 break; 2911 2896 } 2912 2897 case MD_BELOW_LEFT: 2913 2898 { 2914 pcTmpCU = getPUBelowLeft(uiIdx, uiPartUnitIdx);2899 neibCU = getPUBelowLeft(neibPUPartIdx, uiPartUnitIdx); 2915 2900 break; 2916 2901 } 2917 2902 case MD_ABOVE_LEFT: 2918 2903 { 2919 pcTmpCU = getPUAboveLeft(uiIdx, uiPartUnitIdx);2904 neibCU = getPUAboveLeft(neibPUPartIdx, uiPartUnitIdx); 2920 2905 break; 2921 2906 } … … 2926 2911 } 2927 2912 2928 if ( pcTmpCU == NULL )2913 if ( neibCU == NULL ) 2929 2914 { 2930 2915 return false; 2931 2916 } 2932 2917 2933 if ( pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) >= 0 && m_pcSlice->getRefPic( eRefPicList, iRefIdx)->getPOC() == pcTmpCU->getSlice()->getRefPOC( eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) )) 2934 { 2935 TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx); 2936 2937 pInfo->m_acMvCand[ pInfo->iN++] = cMvPred; 2938 return true; 2939 } 2940 2941 RefPicList eRefPicList2nd = REF_PIC_LIST_0; 2942 if( eRefPicList == REF_PIC_LIST_0 ) 2943 { 2944 eRefPicList2nd = REF_PIC_LIST_1; 2945 } 2946 else if ( eRefPicList == REF_PIC_LIST_1) 2947 { 2948 eRefPicList2nd = REF_PIC_LIST_0; 2949 } 2950 2951 2952 Int iCurrRefPOC = m_pcSlice->getRefPic( eRefPicList, iRefIdx)->getPOC(); 2953 Int iNeibRefPOC; 2954 2955 2956 if( pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) >= 0 ) 2957 { 2958 iNeibRefPOC = pcTmpCU->getSlice()->getRefPOC( eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) ); 2959 if( iNeibRefPOC == iCurrRefPOC ) // Same Reference Frame But Diff List// 2960 { 2961 TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList2nd)->getMv(uiIdx); 2962 pInfo->m_acMvCand[ pInfo->iN++] = cMvPred; 2918 const Int currRefPOC = m_pcSlice->getRefPic( eRefPicList, iRefIdx)->getPOC(); 2919 const RefPicList eRefPicList2nd = (eRefPicList == REF_PIC_LIST_0) ? REF_PIC_LIST_1 : REF_PIC_LIST_0; 2920 2921 for(Int predictorSource=0; predictorSource<2; predictorSource++) // examine the indicated reference picture list, then if not available, examine the other list. 2922 { 2923 const RefPicList eRefPicListIndex = (predictorSource==0) ? eRefPicList : eRefPicList2nd; 2924 const Int neibRefIdx = neibCU->getCUMvField(eRefPicListIndex)->getRefIdx(neibPUPartIdx); 2925 2926 if ( neibRefIdx >= 0 && currRefPOC == neibCU->getSlice()->getRefPOC( eRefPicListIndex, neibRefIdx )) 2927 { 2928 info.m_acMvCand[info.iN++] = neibCU->getCUMvField(eRefPicListIndex)->getMv(neibPUPartIdx); 2963 2929 return true; 2964 2930 } 2965 2931 } 2932 2966 2933 return false; 2967 2934 } … … 2975 2942 * \returns Bool 2976 2943 */ 2977 Bool TComDataCU::xAddMVPCand Order( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir )2978 { 2979 TComDataCU* pcTmpCU = NULL;2980 UInt uiIdx;2944 Bool TComDataCU::xAddMVPCandWithScaling( AMVPInfo &info, const RefPicList eRefPicList, const Int iRefIdx, const UInt uiPartUnitIdx, const MVP_DIR eDir ) const 2945 { 2946 const TComDataCU* neibCU = NULL; 2947 UInt neibPUPartIdx; 2981 2948 switch( eDir ) 2982 2949 { 2983 2950 case MD_LEFT: 2984 2951 { 2985 pcTmpCU = getPULeft(uiIdx, uiPartUnitIdx);2952 neibCU = getPULeft(neibPUPartIdx, uiPartUnitIdx); 2986 2953 break; 2987 2954 } 2988 2955 case MD_ABOVE: 2989 2956 { 2990 pcTmpCU = getPUAbove(uiIdx, uiPartUnitIdx);2957 neibCU = getPUAbove(neibPUPartIdx, uiPartUnitIdx); 2991 2958 break; 2992 2959 } 2993 2960 case MD_ABOVE_RIGHT: 2994 2961 { 2995 pcTmpCU = getPUAboveRight(uiIdx, uiPartUnitIdx);2962 neibCU = getPUAboveRight(neibPUPartIdx, uiPartUnitIdx); 2996 2963 break; 2997 2964 } 2998 2965 case MD_BELOW_LEFT: 2999 2966 { 3000 pcTmpCU = getPUBelowLeft(uiIdx, uiPartUnitIdx);2967 neibCU = getPUBelowLeft(neibPUPartIdx, uiPartUnitIdx); 3001 2968 break; 3002 2969 } 3003 2970 case MD_ABOVE_LEFT: 3004 2971 { 3005 pcTmpCU = getPUAboveLeft(uiIdx, uiPartUnitIdx);2972 neibCU = getPUAboveLeft(neibPUPartIdx, uiPartUnitIdx); 3006 2973 break; 3007 2974 } … … 3012 2979 } 3013 2980 3014 if ( pcTmpCU == NULL )2981 if ( neibCU == NULL ) 3015 2982 { 3016 2983 return false; 3017 2984 } 3018 2985 3019 RefPicList eRefPicList2nd = REF_PIC_LIST_0; 3020 if( eRefPicList == REF_PIC_LIST_0 ) 3021 { 3022 eRefPicList2nd = REF_PIC_LIST_1; 3023 } 3024 else if ( eRefPicList == REF_PIC_LIST_1) 3025 { 3026 eRefPicList2nd = REF_PIC_LIST_0; 3027 } 3028 3029 Int iCurrPOC = m_pcSlice->getPOC(); 3030 Int iCurrRefPOC = m_pcSlice->getRefPic( eRefPicList, iRefIdx)->getPOC(); 3031 Int iNeibPOC = iCurrPOC; 3032 Int iNeibRefPOC; 3033 Bool bIsCurrRefLongTerm = m_pcSlice->getRefPic( eRefPicList, iRefIdx)->getIsLongTerm(); 3034 Bool bIsNeibRefLongTerm = false; 3035 3036 //--------------- V1 (END) ------------------// 3037 if( pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) >= 0) 3038 { 3039 iNeibRefPOC = pcTmpCU->getSlice()->getRefPOC( eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ); 3040 TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx); 3041 TComMv rcMv; 3042 3043 bIsNeibRefLongTerm = pcTmpCU->getSlice()->getRefPic( eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) )->getIsLongTerm(); 3044 if ( bIsCurrRefLongTerm == bIsNeibRefLongTerm ) 3045 { 3046 if ( bIsCurrRefLongTerm || bIsNeibRefLongTerm ) 3047 { 3048 rcMv = cMvPred; 3049 } 3050 else 3051 { 3052 Int iScale = xGetDistScaleFactor( iCurrPOC, iCurrRefPOC, iNeibPOC, iNeibRefPOC ); 3053 if ( iScale == 4096 ) 2986 const RefPicList eRefPicList2nd = (eRefPicList == REF_PIC_LIST_0) ? REF_PIC_LIST_1 : REF_PIC_LIST_0; 2987 2988 const Int currPOC = m_pcSlice->getPOC(); 2989 const Int currRefPOC = m_pcSlice->getRefPic( eRefPicList, iRefIdx)->getPOC(); 2990 const Bool bIsCurrRefLongTerm = m_pcSlice->getRefPic( eRefPicList, iRefIdx)->getIsLongTerm(); 2991 const Int neibPOC = currPOC; 2992 2993 for(Int predictorSource=0; predictorSource<2; predictorSource++) // examine the indicated reference picture list, then if not available, examine the other list. 2994 { 2995 const RefPicList eRefPicListIndex = (predictorSource==0) ? eRefPicList : eRefPicList2nd; 2996 const Int neibRefIdx = neibCU->getCUMvField(eRefPicListIndex)->getRefIdx(neibPUPartIdx); 2997 if( neibRefIdx >= 0) 2998 { 2999 const Bool bIsNeibRefLongTerm = neibCU->getSlice()->getRefPic( eRefPicListIndex, neibRefIdx )->getIsLongTerm(); 3000 3001 if ( bIsCurrRefLongTerm == bIsNeibRefLongTerm ) 3002 { 3003 const TComMv &cMvPred = neibCU->getCUMvField(eRefPicListIndex)->getMv(neibPUPartIdx); 3004 TComMv rcMv; 3005 if ( bIsCurrRefLongTerm /* || bIsNeibRefLongTerm*/ ) 3054 3006 { 3055 3007 rcMv = cMvPred; … … 3057 3009 else 3058 3010 { 3059 rcMv = cMvPred.scaleMv( iScale ); 3011 const Int neibRefPOC = neibCU->getSlice()->getRefPOC( eRefPicListIndex, neibRefIdx ); 3012 const Int scale = xGetDistScaleFactor( currPOC, currRefPOC, neibPOC, neibRefPOC ); 3013 if ( scale == 4096 ) 3014 { 3015 rcMv = cMvPred; 3016 } 3017 else 3018 { 3019 rcMv = cMvPred.scaleMv( scale ); 3020 } 3060 3021 } 3061 } 3062 3063 pInfo->m_acMvCand[ pInfo->iN++] = rcMv; 3064 return true; 3065 } 3066 } 3067 //---------------------- V2(END) --------------------// 3068 if( pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) >= 0) 3069 { 3070 iNeibRefPOC = pcTmpCU->getSlice()->getRefPOC( eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) ); 3071 TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList2nd)->getMv(uiIdx); 3072 TComMv rcMv; 3073 3074 bIsNeibRefLongTerm = pcTmpCU->getSlice()->getRefPic( eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) )->getIsLongTerm(); 3075 if ( bIsCurrRefLongTerm == bIsNeibRefLongTerm ) 3076 { 3077 if ( bIsCurrRefLongTerm || bIsNeibRefLongTerm ) 3078 { 3079 rcMv = cMvPred; 3080 } 3081 else 3082 { 3083 Int iScale = xGetDistScaleFactor( iCurrPOC, iCurrRefPOC, iNeibPOC, iNeibRefPOC ); 3084 if ( iScale == 4096 ) 3085 { 3086 rcMv = cMvPred; 3087 } 3088 else 3089 { 3090 rcMv = cMvPred.scaleMv( iScale ); 3091 } 3092 } 3093 3094 pInfo->m_acMvCand[ pInfo->iN++] = rcMv; 3095 return true; 3096 } 3097 } 3098 //---------------------- V3(END) --------------------// 3022 3023 info.m_acMvCand[info.iN++] = rcMv; 3024 return true; 3025 } 3026 } 3027 } 3099 3028 return false; 3100 3029 } 3101 3030 3102 Bool TComDataCU::xGetColMVP( RefPicList eRefPicList, Int ctuRsAddr, Int uiPartUnitIdx, TComMv& rcMv, Int& riRefIdx ) 3103 { 3104 UInt uiAbsPartAddr = uiPartUnitIdx; 3105 3106 RefPicList eColRefPicList; 3107 Int iColPOC, iColRefPOC, iCurrPOC, iCurrRefPOC, iScale; 3108 TComMv cColMv; 3031 Bool TComDataCU::xGetColMVP( const RefPicList eRefPicList, const Int ctuRsAddr, const Int partUnitIdx, TComMv& rcMv, const Int refIdx ) const 3032 { 3033 const UInt absPartAddr = partUnitIdx; 3109 3034 3110 3035 // use coldir. 3111 TComPic *pColPic = getSlice()->getRefPic( RefPicList(getSlice()->isInterB() ? 1-getSlice()->getColFromL0Flag() : 0), getSlice()->getColRefIdx());3112 TComDataCU *pColCtu = pColPic->getCtu( ctuRsAddr );3113 if(pColCtu->getPic()==0 ||pColCtu->getPartitionSize(uiPartUnitIdx)==NUMBER_OF_PART_SIZES)3036 const TComPic * const pColPic = getSlice()->getRefPic( RefPicList(getSlice()->isInterB() ? 1-getSlice()->getColFromL0Flag() : 0), getSlice()->getColRefIdx()); 3037 const TComDataCU * const pColCtu = pColPic->getCtu( ctuRsAddr ); 3038 if(pColCtu->getPic()==0 || pColCtu->getPartitionSize(partUnitIdx)==NUMBER_OF_PART_SIZES) 3114 3039 { 3115 3040 return false; 3116 3041 } 3117 iCurrPOC = m_pcSlice->getPOC(); 3118 iColPOC = pColCtu->getSlice()->getPOC(); 3119 3120 if (!pColCtu->isInter(uiAbsPartAddr)) 3042 3043 if (!pColCtu->isInter(absPartAddr)) 3121 3044 { 3122 3045 return false; 3123 3046 } 3124 3047 3125 eColRefPicList = getSlice()->getCheckLDC() ? eRefPicList : RefPicList(getSlice()->getColFromL0Flag()); 3126 3127 Int iColRefIdx = pColCtu->getCUMvField(RefPicList(eColRefPicList))->getRefIdx(uiAbsPartAddr); 3048 RefPicList eColRefPicList = getSlice()->getCheckLDC() ? eRefPicList : RefPicList(getSlice()->getColFromL0Flag()); 3049 Int iColRefIdx = pColCtu->getCUMvField(RefPicList(eColRefPicList))->getRefIdx(absPartAddr); 3128 3050 3129 3051 if (iColRefIdx < 0 ) 3130 3052 { 3131 3053 eColRefPicList = RefPicList(1 - eColRefPicList); 3132 iColRefIdx = pColCtu->getCUMvField(RefPicList(eColRefPicList))->getRefIdx( uiAbsPartAddr);3054 iColRefIdx = pColCtu->getCUMvField(RefPicList(eColRefPicList))->getRefIdx(absPartAddr); 3133 3055 3134 3056 if (iColRefIdx < 0 ) … … 3138 3060 } 3139 3061 3062 const Bool bIsCurrRefLongTerm = m_pcSlice->getRefPic(eRefPicList, refIdx)->getIsLongTerm(); 3063 const Bool bIsColRefLongTerm = pColCtu->getSlice()->getIsUsedAsLongTerm(eColRefPicList, iColRefIdx); 3064 3065 if ( bIsCurrRefLongTerm != bIsColRefLongTerm ) 3066 { 3067 return false; 3068 } 3069 3140 3070 // Scale the vector. 3141 iColRefPOC = pColCtu->getSlice()->getRefPOC(eColRefPicList, iColRefIdx); 3142 cColMv = pColCtu->getCUMvField(eColRefPicList)->getMv(uiAbsPartAddr); 3143 3144 iCurrRefPOC = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getPOC(); 3145 3146 Bool bIsCurrRefLongTerm = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getIsLongTerm(); 3147 Bool bIsColRefLongTerm = pColCtu->getSlice()->getIsUsedAsLongTerm(eColRefPicList, iColRefIdx); 3148 3149 if ( bIsCurrRefLongTerm != bIsColRefLongTerm ) 3150 { 3151 return false; 3152 } 3153 3154 if ( bIsCurrRefLongTerm || bIsColRefLongTerm ) 3071 const TComMv &cColMv = pColCtu->getCUMvField(eColRefPicList)->getMv(absPartAddr); 3072 if ( bIsCurrRefLongTerm /*|| bIsColRefLongTerm*/ ) 3155 3073 { 3156 3074 rcMv = cColMv; … … 3158 3076 else 3159 3077 { 3160 iScale = xGetDistScaleFactor(iCurrPOC, iCurrRefPOC, iColPOC, iColRefPOC); 3161 if ( iScale == 4096 ) 3078 const Int currPOC = m_pcSlice->getPOC(); 3079 const Int colPOC = pColCtu->getSlice()->getPOC(); 3080 const Int colRefPOC = pColCtu->getSlice()->getRefPOC(eColRefPicList, iColRefIdx); 3081 const Int currRefPOC = m_pcSlice->getRefPic(eRefPicList, refIdx)->getPOC(); 3082 const Int scale = xGetDistScaleFactor(currPOC, currRefPOC, colPOC, colRefPOC); 3083 if ( scale == 4096 ) 3162 3084 { 3163 3085 rcMv = cColMv; … … 3165 3087 else 3166 3088 { 3167 rcMv = cColMv.scaleMv( iScale );3089 rcMv = cColMv.scaleMv( scale ); 3168 3090 } 3169 3091 } … … 3172 3094 } 3173 3095 3096 // Static member 3174 3097 Int TComDataCU::xGetDistScaleFactor(Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC) 3175 3098 { … … 3191 3114 } 3192 3115 3193 Void TComDataCU::xDeriveCenterIdx( UInt uiPartIdx, UInt& ruiPartIdxCenter ) 3116 Void TComDataCU::xDeriveCenterIdx( UInt uiPartIdx, UInt& ruiPartIdxCenter ) const 3194 3117 { 3195 3118 UInt uiPartAddr; … … 3486 3409 3487 3410 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI 3488 Bool TComDataCU::isInterLayerReference(UChar uhInterDir, TComMvField& cMvFieldL0, TComMvField& cMvFieldL1) 3411 Bool TComDataCU::isInterLayerReference(UChar uhInterDir, TComMvField& cMvFieldL0, TComMvField& cMvFieldL1) const 3489 3412 { 3490 3413 Bool checkILR = false; -
branches/SHM-dev/source/Lib/TLibCommon/TComDataCU.h
r1442 r1465 70 70 // ------------------------------------------------------------------------------------------------------------------- 71 71 72 TComPic* m_pcPic; ///< picture class pointer73 TComSlice* m_pcSlice; ///< slice header pointer72 TComPic* m_pcPic; ///< picture class pointer 73 TComSlice* m_pcSlice; ///< slice header pointer 74 74 75 75 // ------------------------------------------------------------------------------------------------------------------- … … 77 77 // ------------------------------------------------------------------------------------------------------------------- 78 78 79 UInt m_ctuRsAddr; ///< CTU (also known as LCU) address in a slice (Raster-scan address, as opposed to tile-scan/encoding order).80 UInt m_absZIdxInCtu; ///< absolute address in a CTU. It's Z scan order81 UInt m_uiCUPelX; ///< CU position in a pixel (X)82 UInt m_uiCUPelY; ///< CU position in a pixel (Y)83 UInt m_uiNumPartition; ///< total number of minimum partitions in a CU84 UChar* m_puhWidth; ///< array of widths85 UChar* m_puhHeight; ///< array of heights86 UChar* m_puhDepth; ///< array of depths87 Int m_unitSize; ///< size of a "minimum partition"79 UInt m_ctuRsAddr; ///< CTU (also known as LCU) address in a slice (Raster-scan address, as opposed to tile-scan/encoding order). 80 UInt m_absZIdxInCtu; ///< absolute address in a CTU. It's Z scan order 81 UInt m_uiCUPelX; ///< CU position in a pixel (X) 82 UInt m_uiCUPelY; ///< CU position in a pixel (Y) 83 UInt m_uiNumPartition; ///< total number of minimum partitions in a CU 84 UChar* m_puhWidth; ///< array of widths 85 UChar* m_puhHeight; ///< array of heights 86 UChar* m_puhDepth; ///< array of depths 87 Int m_unitSize; ///< size of a "minimum partition" 88 88 89 89 #if SVC_EXTENSION 90 UInt m_layerId; ///< layer id90 UInt m_layerId; ///< layer id 91 91 #if FAST_INTRA_SHVC 92 92 UChar m_reducedSetIntraModes[NUM_INTRA_MODE-1]; … … 98 98 // ------------------------------------------------------------------------------------------------------------------- 99 99 100 Bool* m_skipFlag;///< array of skip flags101 SChar* m_pePartSize;///< array of partition sizes102 SChar* m_pePredMode;///< array of prediction modes103 SChar* 104 Bool* m_CUTransquantBypass;///< array of cu_transquant_bypass flags105 SChar* m_phQP;///< array of QP values106 UChar* m_ChromaQpAdj;///< array of chroma QP adjustments (indexed). when value = 0, cu_chroma_qp_offset_flag=0; when value>0, indicates cu_chroma_qp_offset_flag=1 and cu_chroma_qp_offset_idx=value-1107 UInt 108 UChar* m_puhTrIdx;///< array of transform indices109 UChar* m_puhTransformSkip[MAX_NUM_COMPONENT];///< array of transform skipping flags110 UChar* m_puhCbf[MAX_NUM_COMPONENT];///< array of coded block flags (CBF)111 TComCUMvField m_acCUMvField[NUM_REF_PIC_LIST_01];///< array of motion vectors.112 TCoeff* m_pcTrCoeff[MAX_NUM_COMPONENT];///< array of transform coefficient buffers (0->Y, 1->Cb, 2->Cr)100 Bool* m_skipFlag; ///< array of skip flags 101 SChar* m_pePartSize; ///< array of partition sizes 102 SChar* m_pePredMode; ///< array of prediction modes 103 SChar* m_crossComponentPredictionAlpha[MAX_NUM_COMPONENT]; ///< array of cross-component prediction alpha values 104 Bool* m_CUTransquantBypass; ///< array of cu_transquant_bypass flags 105 SChar* m_phQP; ///< array of QP values 106 UChar* m_ChromaQpAdj; ///< array of chroma QP adjustments (indexed). when value = 0, cu_chroma_qp_offset_flag=0; when value>0, indicates cu_chroma_qp_offset_flag=1 and cu_chroma_qp_offset_idx=value-1 107 UInt m_codedChromaQpAdj; 108 UChar* m_puhTrIdx; ///< array of transform indices 109 UChar* m_puhTransformSkip[MAX_NUM_COMPONENT]; ///< array of transform skipping flags 110 UChar* m_puhCbf[MAX_NUM_COMPONENT]; ///< array of coded block flags (CBF) 111 TComCUMvField m_acCUMvField[NUM_REF_PIC_LIST_01]; ///< array of motion vectors. 112 TCoeff* m_pcTrCoeff[MAX_NUM_COMPONENT]; ///< array of transform coefficient buffers (0->Y, 1->Cb, 2->Cr) 113 113 #if ADAPTIVE_QP_SELECTION 114 TCoeff* m_pcArlCoeff[MAX_NUM_COMPONENT]; //ARL coefficient buffer (0->Y, 1->Cb, 2->Cr)115 Bool m_ArlCoeffIsAliasedAllocation;///< ARL coefficient buffer is an alias of the global buffer and must not be free()'d116 #endif 117 118 Pel* m_pcIPCMSample[MAX_NUM_COMPONENT];///< PCM sample buffer (0->Y, 1->Cb, 2->Cr)114 TCoeff* m_pcArlCoeff[MAX_NUM_COMPONENT]; ///< ARL coefficient buffer (0->Y, 1->Cb, 2->Cr) 115 Bool m_ArlCoeffIsAliasedAllocation; ///< ARL coefficient buffer is an alias of the global buffer and must not be free()'d 116 #endif 117 118 Pel* m_pcIPCMSample[MAX_NUM_COMPONENT]; ///< PCM sample buffer (0->Y, 1->Cb, 2->Cr) 119 119 120 120 // ------------------------------------------------------------------------------------------------------------------- … … 122 122 // ------------------------------------------------------------------------------------------------------------------- 123 123 124 TComDataCU* m_pCtuAboveLeft; ///< pointer of above-left CTU.125 TComDataCU* m_pCtuAboveRight; ///< pointer of above-right CTU.126 TComDataCU* m_pCtuAbove; ///< pointer of above CTU.127 TComDataCU* m_pCtuLeft; ///< pointer of left CTU124 TComDataCU* m_pCtuAboveLeft; ///< pointer of above-left CTU. 125 TComDataCU* m_pCtuAboveRight; ///< pointer of above-right CTU. 126 TComDataCU* m_pCtuAbove; ///< pointer of above CTU. 127 TComDataCU* m_pCtuLeft; ///< pointer of left CTU 128 128 TComDataCU* m_apcCUColocated[NUM_REF_PIC_LIST_01]; ///< pointer of temporally colocated CU's for both directions 129 TComMvField m_cMvFieldA; ///< motion vector of position A130 TComMvField m_cMvFieldB; ///< motion vector of position B131 TComMvField m_cMvFieldC; ///< motion vector of position C132 TComMv m_cMvPred; ///< motion vector predictor129 TComMvField m_cMvFieldA; ///< motion vector of position A 130 TComMvField m_cMvFieldB; ///< motion vector of position B 131 TComMvField m_cMvFieldC; ///< motion vector of position C 132 TComMv m_cMvPred; ///< motion vector predictor 133 133 134 134 // ------------------------------------------------------------------------------------------------------------------- … … 136 136 // ------------------------------------------------------------------------------------------------------------------- 137 137 138 Bool* m_pbMergeFlag; ///< array of merge flags139 UChar* m_puhMergeIndex; ///< array of merge candidate indices138 Bool* m_pbMergeFlag; ///< array of merge flags 139 UChar* m_puhMergeIndex; ///< array of merge candidate indices 140 140 #if AMP_MRG 141 141 Bool m_bIsMergeAMP; 142 142 #endif 143 UChar* m_puhIntraDir[MAX_NUM_CHANNEL_TYPE]; // 0-> Luma, 1-> Chroma144 UChar* m_puhInterDir; ///< array of inter directions143 UChar* m_puhIntraDir[MAX_NUM_CHANNEL_TYPE]; 144 UChar* m_puhInterDir; ///< array of inter directions 145 145 SChar* m_apiMVPIdx[NUM_REF_PIC_LIST_01]; ///< array of motion vector predictor candidates 146 146 SChar* m_apiMVPNum[NUM_REF_PIC_LIST_01]; ///< array of number of possible motion vectors predictors 147 Bool* m_pbIPCMFlag; ///< array of intra_pcm flags147 Bool* m_pbIPCMFlag; ///< array of intra_pcm flags 148 148 149 149 // ------------------------------------------------------------------------------------------------------------------- … … 151 151 // ------------------------------------------------------------------------------------------------------------------- 152 152 153 Bool m_bDecSubCu; ///< indicates decoder-mode154 Double m_dTotalCost; ///< sum of partition RD costs155 Distortion m_uiTotalDistortion; ///< sum of partition distortion156 UInt m_uiTotalBits; ///< sum of partition bits157 UInt m_uiTotalBins; ///< sum of partition bins153 Bool m_bDecSubCu; ///< indicates decoder-mode 154 Double m_dTotalCost; ///< sum of partition RD costs 155 Distortion m_uiTotalDistortion; ///< sum of partition distortion 156 UInt m_uiTotalBits; ///< sum of partition bits 157 UInt m_uiTotalBins; ///< sum of partition bins 158 158 SChar m_codedQP; 159 159 UChar* m_explicitRdpcmMode[MAX_NUM_COMPONENT]; ///< Stores the explicit RDPCM mode for all TUs belonging to this CU … … 161 161 protected: 162 162 163 /// add possible motion vector predictor candidates164 Bool xAddMVPCand ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir );165 Bool xAddMVPCand Order ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir );166 167 Void deriveRightBottomIdx ( UInt uiPartIdx, UInt& ruiPartIdxRB );168 Bool xGetColMVP ( RefPicList eRefPicList, Int ctuRsAddr, Int uiPartUnitIdx, TComMv& rcMv, Int& riRefIdx );163 /// adds a single possible motion vector predictor candidate 164 Bool xAddMVPCandUnscaled ( AMVPInfo &info, const RefPicList eRefPicList, const Int iRefIdx, const UInt uiPartUnitIdx, const MVP_DIR eDir ) const; 165 Bool xAddMVPCandWithScaling ( AMVPInfo &info, const RefPicList eRefPicList, const Int iRefIdx, const UInt uiPartUnitIdx, const MVP_DIR eDir ) const; 166 167 Void deriveRightBottomIdx ( UInt uiPartIdx, UInt& ruiPartIdxRB ) const; 168 Bool xGetColMVP ( const RefPicList eRefPicList, const Int ctuRsAddr, const Int partUnitIdx, TComMv& rcMv, const Int refIdx ) const; 169 169 170 170 /// compute scaling factor from POC difference 171 Int xGetDistScaleFactor( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC );172 173 Void xDeriveCenterIdx( UInt uiPartIdx, UInt& ruiPartIdxCenter );171 static Int xGetDistScaleFactor ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC ); 172 173 Void xDeriveCenterIdx ( UInt uiPartIdx, UInt& ruiPartIdxCenter ) const; 174 174 175 175 public: 176 TComDataCU();177 virtual ~TComDataCU();176 TComDataCU(); 177 virtual ~TComDataCU(); 178 178 179 179 // ------------------------------------------------------------------------------------------------------------------- … … 181 181 // ------------------------------------------------------------------------------------------------------------------- 182 182 183 Void create ( ChromaFormat chromaFormatIDC, UInt uiNumPartition, UInt uiWidth, UInt uiHeight, Bool bDecSubCu, Int unitSize183 Void create ( ChromaFormat chromaFormatIDC, UInt uiNumPartition, UInt uiWidth, UInt uiHeight, Bool bDecSubCu, Int unitSize 184 184 #if ADAPTIVE_QP_SELECTION 185 , TCoeff *pParentARLBuffer = 0186 #endif 187 );188 Void destroy ();189 190 Void initCtu ( TComPic* pcPic, UInt ctuRsAddr );191 Void initEstData ( const UInt uiDepth, const Int qp, const Bool bTransquantBypass );192 Void initSubCU ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, Int qp );193 Void setOutsideCUPart ( UInt uiAbsPartIdx, UInt uiDepth );194 195 Void copySubCU ( TComDataCU* pcCU, UInt uiPartUnitIdx );196 Void copyInterPredInfoFrom ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList );197 Void copyPartFrom ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth );198 199 Void copyToPic ( UChar uiDepth );185 , TCoeff *pParentARLBuffer = 0 186 #endif 187 ); 188 Void destroy ( ); 189 190 Void initCtu ( TComPic* pcPic, UInt ctuRsAddr ); 191 Void initEstData ( const UInt uiDepth, const Int qp, const Bool bTransquantBypass ); 192 Void initSubCU ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, Int qp ); 193 Void setOutsideCUPart ( UInt uiAbsPartIdx, UInt uiDepth ); 194 195 Void copySubCU ( TComDataCU* pcCU, UInt uiPartUnitIdx ); 196 Void copyInterPredInfoFrom ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList ); 197 Void copyPartFrom ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth ); 198 199 Void copyToPic ( UChar uiDepth ); 200 200 201 201 // ------------------------------------------------------------------------------------------------------------------- … … 203 203 // ------------------------------------------------------------------------------------------------------------------- 204 204 205 TComPic* getPic () { return m_pcPic;}206 const TComPic* getPic () const { return m_pcPic;}207 TComSlice* getSlice () { return m_pcSlice;}208 const TComSlice* getSlice () const { return m_pcSlice;}209 UInt& getCtuRsAddr () { return m_ctuRsAddr;}210 UInt getCtuRsAddr () const { return m_ctuRsAddr;}211 UInt getZorderIdxInCtu () const { return m_absZIdxInCtu;}212 UInt getCUPelX () const { return m_uiCUPelX;}213 UInt getCUPelY () const { return m_uiCUPelY;}214 215 UChar* getDepth () { return m_puhDepth;}216 UChar getDepth ( UInt uiIdx ) const { return m_puhDepth[uiIdx];}217 Void setDepth ( UInt uiIdx, UChar uh ) { m_puhDepth[uiIdx] = uh;}218 219 Void setDepthSubParts ( UInt uiDepth, UInt uiAbsPartIdx );205 TComPic* getPic ( ) { return m_pcPic; } 206 const TComPic* getPic ( ) const { return m_pcPic; } 207 TComSlice* getSlice ( ) { return m_pcSlice; } 208 const TComSlice* getSlice ( ) const { return m_pcSlice; } 209 UInt& getCtuRsAddr ( ) { return m_ctuRsAddr; } 210 UInt getCtuRsAddr ( ) const { return m_ctuRsAddr; } 211 UInt getZorderIdxInCtu ( ) const { return m_absZIdxInCtu; } 212 UInt getCUPelX ( ) const { return m_uiCUPelX; } 213 UInt getCUPelY ( ) const { return m_uiCUPelY; } 214 215 UChar* getDepth ( ) { return m_puhDepth; } 216 UChar getDepth ( UInt uiIdx ) const { return m_puhDepth[uiIdx]; } 217 Void setDepth ( UInt uiIdx, UChar uh ) { m_puhDepth[uiIdx] = uh; } 218 219 Void setDepthSubParts ( UInt uiDepth, UInt uiAbsPartIdx ); 220 220 221 221 // ------------------------------------------------------------------------------------------------------------------- … … 223 223 // ------------------------------------------------------------------------------------------------------------------- 224 224 225 SChar* getPartitionSize () { return m_pePartSize;}226 PartSize getPartitionSize ( UInt uiIdx ){ return static_cast<PartSize>( m_pePartSize[uiIdx] ); }227 Void setPartitionSize ( UInt uiIdx, PartSize uh){ m_pePartSize[uiIdx] = uh;}228 Void setPartSizeSubParts ( PartSize eMode, UInt uiAbsPartIdx, UInt uiDepth );229 Void setCUTransquantBypassSubParts ( Bool flag, UInt uiAbsPartIdx, UInt uiDepth );230 231 Bool* getSkipFlag () { return m_skipFlag;}232 Bool getSkipFlag (UInt idx) { return m_skipFlag[idx];}233 Void setSkipFlag ( UInt idx, Bool skip) { m_skipFlag[idx] = skip;}234 Void setSkipFlagSubParts ( Bool skip, UInt absPartIdx, UInt depth );235 236 SChar* getPredictionMode () { return m_pePredMode;}237 PredMode getPredictionMode ( UInt uiIdx ){ return static_cast<PredMode>( m_pePredMode[uiIdx] ); }238 Void setPredictionMode ( UInt uiIdx, PredMode uh){ m_pePredMode[uiIdx] = uh;}239 Void setPredModeSubParts ( PredMode eMode, UInt uiAbsPartIdx, UInt uiDepth );240 241 SChar* getCrossComponentPredictionAlpha( ComponentID compID ) { return m_crossComponentPredictionAlpha[compID];}242 SChar getCrossComponentPredictionAlpha( UInt uiIdx, ComponentID compID ) { return m_crossComponentPredictionAlpha[compID][uiIdx];}243 244 Bool* getCUTransquantBypass () { return m_CUTransquantBypass;}245 Bool getCUTransquantBypass ( UInt uiIdx ) { return m_CUTransquantBypass[uiIdx];}246 247 UChar* getWidth () { return m_puhWidth;}248 UChar getWidth ( UInt uiIdx ) { return m_puhWidth[uiIdx];}249 Void setWidth ( UInt uiIdx, UChar uh ) { m_puhWidth[uiIdx] = uh;}250 251 UChar* getHeight () { return m_puhHeight;}252 UChar getHeight ( UInt uiIdx ) { return m_puhHeight[uiIdx];}253 Void setHeight ( UInt uiIdx, UChar uh ) { m_puhHeight[uiIdx] = uh;}254 255 Void setSizeSubParts ( UInt uiWidth, UInt uiHeight, UInt uiAbsPartIdx, UInt uiDepth );256 257 SChar* getQP () { return m_phQP;}258 SChar getQP ( UInt uiIdx ) const { return m_phQP[uiIdx];}259 Void setQP ( UInt uiIdx, SChar value){ m_phQP[uiIdx] = value;}260 Void setQPSubParts ( Int qp, UInt uiAbsPartIdx, UInt uiDepth );261 Int getLastValidPartIdx ( Int iAbsPartIdx );262 SChar getLastCodedQP ( UInt uiAbsPartIdx );263 Void setQPSubCUs ( Int qp, UInt absPartIdx, UInt depth, Bool &foundNonZeroCbf );264 Void setCodedQP ( SChar qp ) { m_codedQP = qp;}265 SChar getCodedQP () { return m_codedQP;}266 267 UChar* getChromaQpAdj () { return m_ChromaQpAdj;} ///< array of chroma QP adjustments (indexed). when value = 0, cu_chroma_qp_offset_flag=0; when value>0, indicates cu_chroma_qp_offset_flag=1 and cu_chroma_qp_offset_idx=value-1268 UChar getChromaQpAdj (Int idx) const { return m_ChromaQpAdj[idx];} ///< When value = 0, cu_chroma_qp_offset_flag=0; when value>0, indicates cu_chroma_qp_offset_flag=1 and cu_chroma_qp_offset_idx=value-1269 Void setChromaQpAdj (Int idx, UChar val) { m_ChromaQpAdj[idx] = val;} ///< When val = 0, cu_chroma_qp_offset_flag=0; when val>0, indicates cu_chroma_qp_offset_flag=1 and cu_chroma_qp_offset_idx=val-1270 Void setChromaQpAdjSubParts ( UChar val, Int absPartIdx, Int depth );271 Void setCodedChromaQpAdj ( SChar qp ) { m_codedChromaQpAdj = qp;}272 SChar getCodedChromaQpAdj () { return m_codedChromaQpAdj;}273 274 Bool isLosslessCoded ( UInt absPartIdx );275 276 UChar* getTransformIdx () { return m_puhTrIdx;}277 UChar getTransformIdx ( UInt uiIdx ) { return m_puhTrIdx[uiIdx];}278 Void setTrIdxSubParts ( UInt uiTrIdx, UInt uiAbsPartIdx, UInt uiDepth );279 280 UChar* getTransformSkip ( ComponentID compID ) { return m_puhTransformSkip[compID];}281 UChar getTransformSkip ( UInt uiIdx, ComponentID compID) { return m_puhTransformSkip[compID][uiIdx];}282 Void setTransformSkipSubParts ( UInt useTransformSkip, ComponentID compID, UInt uiAbsPartIdx, UInt uiDepth);283 Void setTransformSkipSubParts ( const UInt useTransformSkip[MAX_NUM_COMPONENT], UInt uiAbsPartIdx, UInt uiDepth );284 285 UChar* getExplicitRdpcmMode ( ComponentID component ) { return m_explicitRdpcmMode[component];}286 UChar getExplicitRdpcmMode ( ComponentID component, UInt partIdx ) {return m_explicitRdpcmMode[component][partIdx]; }225 SChar* getPartitionSize ( ) { return m_pePartSize; } 226 PartSize getPartitionSize ( UInt uiIdx ) const { return static_cast<PartSize>( m_pePartSize[uiIdx] ); } 227 Void setPartitionSize ( UInt uiIdx, PartSize uh ) { m_pePartSize[uiIdx] = uh; } 228 Void setPartSizeSubParts ( PartSize eMode, UInt uiAbsPartIdx, UInt uiDepth ); 229 Void setCUTransquantBypassSubParts ( Bool flag, UInt uiAbsPartIdx, UInt uiDepth ); 230 231 Bool* getSkipFlag ( ) { return m_skipFlag; } 232 Bool getSkipFlag ( UInt idx ) const { return m_skipFlag[idx]; } 233 Void setSkipFlag ( UInt idx, Bool skip ) { m_skipFlag[idx] = skip; } 234 Void setSkipFlagSubParts ( Bool skip, UInt absPartIdx, UInt depth ); 235 236 SChar* getPredictionMode ( ) { return m_pePredMode; } 237 PredMode getPredictionMode ( UInt uiIdx ) const { return static_cast<PredMode>( m_pePredMode[uiIdx] ); } 238 Void setPredictionMode ( UInt uiIdx, PredMode uh ) { m_pePredMode[uiIdx] = uh; } 239 Void setPredModeSubParts ( PredMode eMode, UInt uiAbsPartIdx, UInt uiDepth ); 240 241 SChar* getCrossComponentPredictionAlpha( ComponentID compID ) { return m_crossComponentPredictionAlpha[compID]; } 242 SChar getCrossComponentPredictionAlpha( UInt uiIdx, ComponentID compID ) { return m_crossComponentPredictionAlpha[compID][uiIdx]; } 243 244 Bool* getCUTransquantBypass ( ) { return m_CUTransquantBypass; } 245 Bool getCUTransquantBypass ( UInt uiIdx ) const { return m_CUTransquantBypass[uiIdx]; } 246 247 UChar* getWidth ( ) { return m_puhWidth; } 248 UChar getWidth ( UInt uiIdx ) const { return m_puhWidth[uiIdx]; } 249 Void setWidth ( UInt uiIdx, UChar uh ) { m_puhWidth[uiIdx] = uh; } 250 251 UChar* getHeight ( ) { return m_puhHeight; } 252 UChar getHeight ( UInt uiIdx ) const { return m_puhHeight[uiIdx]; } 253 Void setHeight ( UInt uiIdx, UChar uh ) { m_puhHeight[uiIdx] = uh; } 254 255 Void setSizeSubParts ( UInt uiWidth, UInt uiHeight, UInt uiAbsPartIdx, UInt uiDepth ); 256 257 SChar* getQP ( ) { return m_phQP; } 258 SChar getQP ( UInt uiIdx ) const { return m_phQP[uiIdx]; } 259 Void setQP ( UInt uiIdx, SChar value ) { m_phQP[uiIdx] = value; } 260 Void setQPSubParts ( Int qp, UInt uiAbsPartIdx, UInt uiDepth ); 261 Int getLastValidPartIdx ( Int iAbsPartIdx ) const; 262 SChar getLastCodedQP ( UInt uiAbsPartIdx ) const; 263 Void setQPSubCUs ( Int qp, UInt absPartIdx, UInt depth, Bool &foundNonZeroCbf ); 264 Void setCodedQP ( SChar qp ) { m_codedQP = qp; } 265 SChar getCodedQP ( ) const { return m_codedQP; } 266 267 UChar* getChromaQpAdj ( ) { return m_ChromaQpAdj; } ///< array of chroma QP adjustments (indexed). when value = 0, cu_chroma_qp_offset_flag=0; when value>0, indicates cu_chroma_qp_offset_flag=1 and cu_chroma_qp_offset_idx=value-1 268 UChar getChromaQpAdj ( Int idx ) const { return m_ChromaQpAdj[idx]; } ///< When value = 0, cu_chroma_qp_offset_flag=0; when value>0, indicates cu_chroma_qp_offset_flag=1 and cu_chroma_qp_offset_idx=value-1 269 Void setChromaQpAdj ( Int idx, UChar val ) { m_ChromaQpAdj[idx] = val; } ///< When val = 0, cu_chroma_qp_offset_flag=0; when val>0, indicates cu_chroma_qp_offset_flag=1 and cu_chroma_qp_offset_idx=val-1 270 Void setChromaQpAdjSubParts ( UChar val, Int absPartIdx, Int depth ); 271 Void setCodedChromaQpAdj ( SChar qp ) { m_codedChromaQpAdj = qp; } 272 SChar getCodedChromaQpAdj ( ) const { return m_codedChromaQpAdj; } 273 274 Bool isLosslessCoded ( UInt absPartIdx ) const; 275 276 UChar* getTransformIdx ( ) { return m_puhTrIdx; } 277 UChar getTransformIdx ( UInt uiIdx ) const { return m_puhTrIdx[uiIdx]; } 278 Void setTrIdxSubParts ( UInt uiTrIdx, UInt uiAbsPartIdx, UInt uiDepth ); 279 280 UChar* getTransformSkip ( ComponentID compID ) { return m_puhTransformSkip[compID]; } 281 UChar getTransformSkip ( UInt uiIdx, ComponentID compID ) const { return m_puhTransformSkip[compID][uiIdx]; } 282 Void setTransformSkipSubParts ( UInt useTransformSkip, ComponentID compID, UInt uiAbsPartIdx, UInt uiDepth ); 283 Void setTransformSkipSubParts ( const UInt useTransformSkip[MAX_NUM_COMPONENT], UInt uiAbsPartIdx, UInt uiDepth ); 284 285 UChar* getExplicitRdpcmMode ( ComponentID component ) { return m_explicitRdpcmMode[component]; } 286 UChar getExplicitRdpcmMode ( ComponentID component, UInt partIdx ) const { return m_explicitRdpcmMode[component][partIdx]; } 287 287 Void setExplicitRdpcmModePartRange ( UInt rdpcmMode, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes ); 288 288 289 Bool isRDPCMEnabled ( UInt uiAbsPartIdx ) { return getSlice()->getSPS()->getSpsRangeExtension().getRdpcmEnabledFlag(isIntra(uiAbsPartIdx) ? RDPCM_SIGNAL_IMPLICIT : RDPCM_SIGNAL_EXPLICIT); } 290 291 Void setCrossComponentPredictionAlphaPartRange ( SChar alphaValue, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes ); 292 Void setTransformSkipPartRange ( UInt useTransformSkip, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes ); 293 294 UInt getQuadtreeTULog2MinSizeInCU( UInt uiIdx ); 295 296 TComCUMvField* getCUMvField ( RefPicList e ) { return &m_acCUMvField[e]; } 297 298 TCoeff* getCoeff (ComponentID component) { return m_pcTrCoeff[component]; } 289 Bool isRDPCMEnabled ( UInt uiAbsPartIdx ) const { return getSlice()->getSPS()->getSpsRangeExtension().getRdpcmEnabledFlag(isIntra(uiAbsPartIdx) ? RDPCM_SIGNAL_IMPLICIT : RDPCM_SIGNAL_EXPLICIT); } 290 291 Void setCrossComponentPredictionAlphaPartRange ( SChar alphaValue, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes ); 292 Void setTransformSkipPartRange ( UInt useTransformSkip, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes ); 293 294 UInt getQuadtreeTULog2MinSizeInCU ( UInt uiIdx ) const; 295 296 TComCUMvField* getCUMvField ( RefPicList e ) { return &m_acCUMvField[e]; } 297 const TComCUMvField* getCUMvField ( RefPicList e ) const { return &m_acCUMvField[e]; } 298 299 TCoeff* getCoeff ( ComponentID component ) { return m_pcTrCoeff[component]; } 299 300 300 301 #if ADAPTIVE_QP_SELECTION 301 TCoeff* getArlCoeff ( ComponentID component ) { return m_pcArlCoeff[component];}302 #endif 303 Pel* getPCMSample ( ComponentID component ) { return m_pcIPCMSample[component];}304 305 UChar getCbf ( UInt uiIdx, ComponentID eType ) { return m_puhCbf[eType][uiIdx];}306 UChar* getCbf ( ComponentID eType ) { return m_puhCbf[eType];}307 UChar getCbf ( UInt uiIdx, ComponentID eType, UInt uiTrDepth ){ return ( ( getCbf( uiIdx, eType ) >> uiTrDepth ) & 0x1 ); }308 Void setCbf ( UInt uiIdx, ComponentID eType, UChar uh ) { m_puhCbf[eType][uiIdx] = uh;}309 Void clearCbf ( UInt uiIdx, ComponentID eType, UInt uiNumParts );310 UChar getQtRootCbf ( UInt uiIdx );311 312 Void setCbfSubParts ( const UInt uiCbf[MAX_NUM_COMPONENT], UInt uiAbsPartIdx, UInt uiDepth);313 Void setCbfSubParts ( UInt uiCbf, ComponentID compID, UInt uiAbsPartIdx, UInt uiDepth);314 Void setCbfSubParts ( UInt uiCbf, ComponentID compID, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth);315 316 Void setCbfPartRange ( UInt uiCbf, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes);317 Void bitwiseOrCbfPartRange ( UInt uiCbf, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes);302 TCoeff* getArlCoeff ( ComponentID component ) { return m_pcArlCoeff[component]; } 303 #endif 304 Pel* getPCMSample ( ComponentID component ) { return m_pcIPCMSample[component]; } 305 306 UChar getCbf ( UInt uiIdx, ComponentID eType ) const { return m_puhCbf[eType][uiIdx]; } 307 UChar* getCbf ( ComponentID eType ) { return m_puhCbf[eType]; } 308 UChar getCbf ( UInt uiIdx, ComponentID eType, UInt uiTrDepth ) const { return ( ( getCbf( uiIdx, eType ) >> uiTrDepth ) & 0x1 ); } 309 Void setCbf ( UInt uiIdx, ComponentID eType, UChar uh ) { m_puhCbf[eType][uiIdx] = uh; } 310 Void clearCbf ( UInt uiIdx, ComponentID eType, UInt uiNumParts ); 311 UChar getQtRootCbf ( UInt uiIdx ) const; 312 313 Void setCbfSubParts ( const UInt uiCbf[MAX_NUM_COMPONENT], UInt uiAbsPartIdx, UInt uiDepth ); 314 Void setCbfSubParts ( UInt uiCbf, ComponentID compID, UInt uiAbsPartIdx, UInt uiDepth ); 315 Void setCbfSubParts ( UInt uiCbf, ComponentID compID, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); 316 317 Void setCbfPartRange ( UInt uiCbf, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes ); 318 Void bitwiseOrCbfPartRange ( UInt uiCbf, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes ); 318 319 319 320 // ------------------------------------------------------------------------------------------------------------------- … … 321 322 // ------------------------------------------------------------------------------------------------------------------- 322 323 323 Bool* getMergeFlag () { return m_pbMergeFlag;}324 Bool getMergeFlag ( UInt uiIdx ) { return m_pbMergeFlag[uiIdx];}325 Void setMergeFlag ( UInt uiIdx, Bool b ) { m_pbMergeFlag[uiIdx] = b;}326 Void setMergeFlagSubParts ( Bool bMergeFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );327 328 UChar* getMergeIndex () { return m_puhMergeIndex;}329 UChar getMergeIndex ( UInt uiIdx ) { return m_puhMergeIndex[uiIdx];}330 Void setMergeIndex ( UInt uiIdx, UInt uiMergeIndex ) { m_puhMergeIndex[uiIdx] = uiMergeIndex;}331 Void setMergeIndexSubParts ( UInt uiMergeIndex, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );324 Bool* getMergeFlag ( ) { return m_pbMergeFlag; } 325 Bool getMergeFlag ( UInt uiIdx ) const { return m_pbMergeFlag[uiIdx]; } 326 Void setMergeFlag ( UInt uiIdx, Bool b ) { m_pbMergeFlag[uiIdx] = b; } 327 Void setMergeFlagSubParts ( Bool bMergeFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); 328 329 UChar* getMergeIndex ( ) { return m_puhMergeIndex; } 330 UChar getMergeIndex ( UInt uiIdx ) const { return m_puhMergeIndex[uiIdx]; } 331 Void setMergeIndex ( UInt uiIdx, UInt uiMergeIndex ) { m_puhMergeIndex[uiIdx] = uiMergeIndex; } 332 Void setMergeIndexSubParts ( UInt uiMergeIndex, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); 332 333 template <typename T> 333 Void setSubPart ( T bParameter, T* pbBaseCtu, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx );334 Void setSubPart ( T bParameter, T* pbBaseCtu, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx ); 334 335 335 336 #if AMP_MRG 336 Void setMergeAMP ( Bool b ) { m_bIsMergeAMP = b;}337 Bool getMergeAMP ( ) { return m_bIsMergeAMP;}338 #endif 339 340 UChar* getIntraDir ( const ChannelType channelType ) const{ return m_puhIntraDir[channelType]; }341 UChar getIntraDir ( const ChannelType channelType, const UInt uiIdx ) const{ return m_puhIntraDir[channelType][uiIdx]; }342 343 Void setIntraDirSubParts ( const ChannelType channelType,344 const UInt uiDir,345 const UInt uiAbsPartIdx,346 const UInt uiDepth );347 348 UChar* getInterDir () { return m_puhInterDir;}349 UChar getInterDir ( UInt uiIdx ) { return m_puhInterDir[uiIdx];}350 Void setInterDir ( UInt uiIdx, UChar uh ) { m_puhInterDir[uiIdx] = uh;}351 Void setInterDirSubParts ( UInt uiDir, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );352 Bool* getIPCMFlag () { return m_pbIPCMFlag;}353 Bool getIPCMFlag (UInt uiIdx ) { return m_pbIPCMFlag[uiIdx];}354 Void setIPCMFlag (UInt uiIdx, Bool b ) { m_pbIPCMFlag[uiIdx] = b;}355 Void setIPCMFlagSubParts (Bool bIpcmFlag, UInt uiAbsPartIdx, UInt uiDepth);337 Void setMergeAMP ( Bool b ) { m_bIsMergeAMP = b; } 338 Bool getMergeAMP ( ) const { return m_bIsMergeAMP; } 339 #endif 340 341 UChar* getIntraDir ( const ChannelType channelType ) const { return m_puhIntraDir[channelType]; } 342 UChar getIntraDir ( const ChannelType channelType, const UInt uiIdx ) const { return m_puhIntraDir[channelType][uiIdx]; } 343 344 Void setIntraDirSubParts ( const ChannelType channelType, 345 const UInt uiDir, 346 const UInt uiAbsPartIdx, 347 const UInt uiDepth ); 348 349 UChar* getInterDir ( ) { return m_puhInterDir; } 350 UChar getInterDir ( UInt uiIdx ) const { return m_puhInterDir[uiIdx]; } 351 Void setInterDir ( UInt uiIdx, UChar uh ) { m_puhInterDir[uiIdx] = uh; } 352 Void setInterDirSubParts ( UInt uiDir, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); 353 Bool* getIPCMFlag ( ) { return m_pbIPCMFlag; } 354 Bool getIPCMFlag ( UInt uiIdx ) const { return m_pbIPCMFlag[uiIdx]; } 355 Void setIPCMFlag ( UInt uiIdx, Bool b ) { m_pbIPCMFlag[uiIdx] = b; } 356 Void setIPCMFlagSubParts ( Bool bIpcmFlag, UInt uiAbsPartIdx, UInt uiDepth ); 356 357 357 358 // ------------------------------------------------------------------------------------------------------------------- … … 359 360 // ------------------------------------------------------------------------------------------------------------------- 360 361 361 Void getPartIndexAndSize ( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight ); // This is for use by a leaf/sub CU object only, with no additional AbsPartIdx362 UChar getNumPartitions ( const UInt uiAbsPartIdx = 0 );363 Bool isFirstAbsZorderIdxInDepth (UInt uiAbsPartIdx, UInt uiDepth);362 Void getPartIndexAndSize ( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight ) const; // This is for use by a leaf/sub CU object only, with no additional AbsPartIdx 363 UChar getNumPartitions ( const UInt uiAbsPartIdx = 0 ) const; 364 Bool isFirstAbsZorderIdxInDepth ( UInt uiAbsPartIdx, UInt uiDepth ) const; 364 365 365 366 // ------------------------------------------------------------------------------------------------------------------- … … 367 368 // ------------------------------------------------------------------------------------------------------------------- 368 369 369 Void getMvField (TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList, TComMvField& rcMvField );370 371 Void fillMvpCand ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo );372 Bool isDiffMER ( Int xN, Int yN, Int xP, Int yP);373 Void getPartPosition ( UInt partIdx, Int& xP, Int& yP, Int& nPSW, Int& nPSH);374 375 Void setMVPIdx ( RefPicList eRefPicList, UInt uiIdx, Int iMVPIdx) { m_apiMVPIdx[eRefPicList][uiIdx] = iMVPIdx;}376 Int getMVPIdx ( RefPicList eRefPicList, UInt uiIdx) { return m_apiMVPIdx[eRefPicList][uiIdx];}377 SChar* getMVPIdx ( RefPicList eRefPicList ) { return m_apiMVPIdx[eRefPicList];}378 379 Void setMVPNum ( RefPicList eRefPicList, UInt uiIdx, Int iMVPNum ) { m_apiMVPNum[eRefPicList][uiIdx] = iMVPNum;}380 Int getMVPNum ( RefPicList eRefPicList, UInt uiIdx ) { return m_apiMVPNum[eRefPicList][uiIdx];}381 SChar* getMVPNum ( RefPicList eRefPicList ) { return m_apiMVPNum[eRefPicList];}382 383 Void setMVPIdxSubParts ( Int iMVPIdx, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );384 Void setMVPNumSubParts ( Int iMVPNum, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );385 386 Void clipMv ( TComMv& rcMv ) const;387 Void getMvPredLeft ( TComMv& rcMvPred ) const { rcMvPred = m_cMvFieldA.getMv();}388 Void getMvPredAbove ( TComMv& rcMvPred ) const { rcMvPred = m_cMvFieldB.getMv();}389 Void getMvPredAboveRight ( TComMv& rcMvPred ) const { rcMvPred = m_cMvFieldC.getMv();}390 391 Void compressMV ();370 static Void getMvField ( const TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList, TComMvField& rcMvField ); 371 372 Void fillMvpCand ( const UInt uiPartIdx, const UInt uiPartAddr, const RefPicList eRefPicList, const Int iRefIdx, AMVPInfo* pInfo ) const; 373 Bool isDiffMER ( Int xN, Int yN, Int xP, Int yP ) const; 374 Void getPartPosition ( UInt partIdx, Int& xP, Int& yP, Int& nPSW, Int& nPSH ) const; 375 376 Void setMVPIdx ( RefPicList eRefPicList, UInt uiIdx, Int iMVPIdx) { m_apiMVPIdx[eRefPicList][uiIdx] = iMVPIdx; } 377 Int getMVPIdx ( RefPicList eRefPicList, UInt uiIdx) const { return m_apiMVPIdx[eRefPicList][uiIdx]; } 378 SChar* getMVPIdx ( RefPicList eRefPicList ) { return m_apiMVPIdx[eRefPicList]; } 379 380 Void setMVPNum ( RefPicList eRefPicList, UInt uiIdx, Int iMVPNum ) { m_apiMVPNum[eRefPicList][uiIdx] = iMVPNum; } 381 Int getMVPNum ( RefPicList eRefPicList, UInt uiIdx ) const { return m_apiMVPNum[eRefPicList][uiIdx]; } 382 SChar* getMVPNum ( RefPicList eRefPicList ) { return m_apiMVPNum[eRefPicList]; } 383 384 Void setMVPIdxSubParts ( Int iMVPIdx, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); 385 Void setMVPNumSubParts ( Int iMVPNum, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); 386 387 Void clipMv ( TComMv& rcMv ) const; 388 Void getMvPredLeft ( TComMv& rcMvPred ) const { rcMvPred = m_cMvFieldA.getMv(); } 389 Void getMvPredAbove ( TComMv& rcMvPred ) const { rcMvPred = m_cMvFieldB.getMv(); } 390 Void getMvPredAboveRight ( TComMv& rcMvPred ) const { rcMvPred = m_cMvFieldC.getMv(); } 391 392 Void compressMV (); 392 393 393 394 // ------------------------------------------------------------------------------------------------------------------- … … 395 396 // ------------------------------------------------------------------------------------------------------------------- 396 397 397 TComDataCU* getCtuLeft () { return m_pCtuLeft; } 398 TComDataCU* getCtuAbove () { return m_pCtuAbove; } 399 TComDataCU* getCtuAboveLeft () { return m_pCtuAboveLeft; } 400 TComDataCU* getCtuAboveRight () { return m_pCtuAboveRight; } 401 TComDataCU* getCUColocated ( RefPicList eRefPicList ) { return m_apcCUColocated[eRefPicList]; } 402 Bool CUIsFromSameSlice ( const TComDataCU *pCU /* Can be NULL */) const { return ( pCU!=NULL && pCU->getSlice()->getSliceCurStartCtuTsAddr() == getSlice()->getSliceCurStartCtuTsAddr() ); } 403 Bool CUIsFromSameTile ( const TComDataCU *pCU /* Can be NULL */) const; 404 Bool CUIsFromSameSliceAndTile ( const TComDataCU *pCU /* Can be NULL */) const; 405 Bool CUIsFromSameSliceTileAndWavefrontRow( const TComDataCU *pCU /* Can be NULL */) const; 406 Bool isLastSubCUOfCtu(const UInt absPartIdx); 407 408 409 TComDataCU* getPULeft ( UInt& uiLPartUnitIdx, 410 UInt uiCurrPartUnitIdx, 411 Bool bEnforceSliceRestriction=true, 412 Bool bEnforceTileRestriction=true ); 413 TComDataCU* getPUAbove ( UInt& uiAPartUnitIdx, 414 UInt uiCurrPartUnitIdx, 415 Bool bEnforceSliceRestriction=true, 416 Bool planarAtCTUBoundary = false, 417 Bool bEnforceTileRestriction=true ); 418 TComDataCU* getPUAboveLeft ( UInt& uiALPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true ); 419 420 TComDataCU* getQpMinCuLeft ( UInt& uiLPartUnitIdx , UInt uiCurrAbsIdxInCtu ); 421 TComDataCU* getQpMinCuAbove ( UInt& uiAPartUnitIdx , UInt uiCurrAbsIdxInCtu ); 422 SChar getRefQP ( UInt uiCurrAbsIdxInCtu ); 398 TComDataCU* getCtuLeft ( ) { return m_pCtuLeft; } 399 TComDataCU* getCtuAbove ( ) { return m_pCtuAbove; } 400 TComDataCU* getCtuAboveLeft ( ) { return m_pCtuAboveLeft; } 401 TComDataCU* getCtuAboveRight ( ) { return m_pCtuAboveRight; } 402 TComDataCU* getCUColocated ( RefPicList eRefPicList ) { return m_apcCUColocated[eRefPicList]; } 403 Bool CUIsFromSameSlice ( const TComDataCU *pCU /* Can be NULL */ ) const { return ( pCU!=NULL && pCU->getSlice()->getSliceCurStartCtuTsAddr() == getSlice()->getSliceCurStartCtuTsAddr() ); } 404 Bool CUIsFromSameTile ( const TComDataCU *pCU /* Can be NULL */ ) const; 405 Bool CUIsFromSameSliceAndTile ( const TComDataCU *pCU /* Can be NULL */ ) const; 406 Bool CUIsFromSameSliceTileAndWavefrontRow( const TComDataCU *pCU /* Can be NULL */ ) const; 407 Bool isLastSubCUOfCtu ( const UInt absPartIdx ) const; 408 409 410 const TComDataCU* getPULeft ( UInt& uiLPartUnitIdx, 411 UInt uiCurrPartUnitIdx, 412 Bool bEnforceSliceRestriction=true, 413 Bool bEnforceTileRestriction=true ) const; 414 415 const TComDataCU* getPUAbove ( UInt& uiAPartUnitIdx, 416 UInt uiCurrPartUnitIdx, 417 Bool bEnforceSliceRestriction=true, 418 Bool planarAtCTUBoundary = false, 419 Bool bEnforceTileRestriction=true ) const; 420 421 const TComDataCU* getPUAboveLeft ( UInt& uiALPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true ) const; 422 423 const TComDataCU* getQpMinCuLeft ( UInt& uiLPartUnitIdx, UInt uiCurrAbsIdxInCtu ) const; 424 const TComDataCU* getQpMinCuAbove ( UInt& uiAPartUnitIdx, UInt uiCurrAbsIdxInCtu ) const; 423 425 424 426 /// returns CU and part index of the PU above the top row of the current uiCurrPartUnitIdx of the CU, at a horizontal offset (to the right) of uiPartUnitOffset (in parts) 425 TComDataCU* getPUAboveRight ( UInt& uiARPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true );427 const TComDataCU* getPUAboveRight ( UInt& uiARPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true ) const; 426 428 /// returns CU and part index of the PU left of the lefthand column of the current uiCurrPartUnitIdx of the CU, at a vertical offset (below) of uiPartUnitOffset (in parts) 427 TComDataCU* getPUBelowLeft ( UInt& uiBLPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true ); 428 429 Void deriveLeftRightTopIdx ( UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ); 430 Void deriveLeftBottomIdx ( UInt uiPartIdx, UInt& ruiPartIdxLB ); 431 432 Bool hasEqualMotion ( UInt uiAbsPartIdx, TComDataCU* pcCandCU, UInt uiCandAbsPartIdx ); 433 Void getInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx = -1 ); 434 435 Void deriveLeftRightTopIdxGeneral ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ); 436 Void deriveLeftBottomIdxGeneral ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLB ); 429 const TComDataCU* getPUBelowLeft ( UInt& uiBLPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true ) const; 430 431 SChar getRefQP ( UInt uiCurrAbsIdxInCtu ) const; 432 433 Void deriveLeftRightTopIdx ( UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ) const; 434 Void deriveLeftBottomIdx ( UInt uiPartIdx, UInt& ruiPartIdxLB ) const; 435 436 Bool hasEqualMotion ( UInt uiAbsPartIdx, const TComDataCU* pcCandCU, UInt uiCandAbsPartIdx ) const; 437 Void getInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx = -1 ) const; 438 439 Void deriveLeftRightTopIdxGeneral ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ) const; 440 Void deriveLeftBottomIdxGeneral ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLB ) const; 437 441 438 442 // ------------------------------------------------------------------------------------------------------------------- … … 440 444 // ------------------------------------------------------------------------------------------------------------------- 441 445 442 Bool isIntra ( UInt uiPartIdx ) const { return m_pePredMode[ uiPartIdx ] == MODE_INTRA;}443 Bool isInter ( UInt uiPartIdx ) const { return m_pePredMode[ uiPartIdx ] == MODE_INTER;}444 Bool isSkipped ( UInt uiPartIdx );///< returns true, if the partiton is skipped445 Bool isBipredRestriction ( UInt puIdx );446 Bool isIntra ( UInt uiPartIdx ) const { return m_pePredMode[ uiPartIdx ] == MODE_INTRA; } 447 Bool isInter ( UInt uiPartIdx ) const { return m_pePredMode[ uiPartIdx ] == MODE_INTER; } 448 Bool isSkipped ( UInt uiPartIdx ) const; ///< returns true, if the partiton is skipped 449 Bool isBipredRestriction ( UInt puIdx ) const; 446 450 447 451 // ------------------------------------------------------------------------------------------------------------------- … … 449 453 // ------------------------------------------------------------------------------------------------------------------- 450 454 451 UInt getIntraSizeIdx ( UInt uiAbsPartIdx );452 453 Void getAllowedChromaDir ( UInt uiAbsPartIdx, UInt* uiModeList );454 Void getIntraDirPredictor ( UInt uiAbsPartIdx, Int uiIntraDirPred[NUM_MOST_PROBABLE_MODES], const ComponentID compID, Int* piMode = NULL );455 UInt getIntraSizeIdx ( UInt uiAbsPartIdx ) const; 456 457 Void getAllowedChromaDir ( UInt uiAbsPartIdx, UInt* uiModeList ) const; 458 Void getIntraDirPredictor ( UInt uiAbsPartIdx, Int uiIntraDirPred[NUM_MOST_PROBABLE_MODES], const ComponentID compID, Int* piMode = NULL ) const; 455 459 456 460 // ------------------------------------------------------------------------------------------------------------------- … … 458 462 // ------------------------------------------------------------------------------------------------------------------- 459 463 460 UInt getCtxSplitFlag ( UInt uiAbsPartIdx, UInt uiDepth );461 UInt getCtxQtCbf ( TComTU &rTu, const ChannelType chType );462 463 UInt getCtxSkipFlag ( UInt uiAbsPartIdx );464 UInt getCtxInterDir ( UInt uiAbsPartIdx );465 466 UInt& getTotalBins () { return m_uiTotalBins;}464 UInt getCtxSplitFlag ( UInt uiAbsPartIdx, UInt uiDepth ) const; 465 UInt getCtxQtCbf ( TComTU &rTu, const ChannelType chType ) const; 466 467 UInt getCtxSkipFlag ( UInt uiAbsPartIdx ) const; 468 UInt getCtxInterDir ( UInt uiAbsPartIdx ) const; 469 470 UInt& getTotalBins ( ) { return m_uiTotalBins; } 467 471 // ------------------------------------------------------------------------------------------------------------------- 468 472 // member functions for RD cost storage 469 473 // ------------------------------------------------------------------------------------------------------------------- 470 474 471 Double& getTotalCost (){ return m_dTotalCost; }472 Distortion& getTotalDistortion (){ return m_uiTotalDistortion; }473 UInt& getTotalBits (){ return m_uiTotalBits; }474 UInt& getTotalNumPart (){ return m_uiNumPartition; }475 476 UInt getCoefScanIdx (const UInt uiAbsPartIdx, const UInt uiWidth, const UInt uiHeight, const ComponentID compID) const ;475 Double& getTotalCost ( ) { return m_dTotalCost; } 476 Distortion& getTotalDistortion ( ) { return m_uiTotalDistortion; } 477 UInt& getTotalBits ( ) { return m_uiTotalBits; } 478 UInt& getTotalNumPart ( ) { return m_uiNumPartition; } 479 480 UInt getCoefScanIdx ( const UInt uiAbsPartIdx, const UInt uiWidth, const UInt uiHeight, const ComponentID compID ) const ; 477 481 478 482 #if SVC_EXTENSION 479 Void setLayerId (UInt layerId) { m_layerId = layerId;}480 UInt getLayerId () { return m_layerId;}481 UInt getLayerIdx (){ return m_pcSlice->getVPS()->getLayerIdxInVps(m_layerId); }483 Void setLayerId ( UInt layerId ) { m_layerId = layerId; } 484 UInt getLayerId ( ) const { return m_layerId; } 485 UInt getLayerIdx ( ) const { return m_pcSlice->getVPS()->getLayerIdxInVps(m_layerId); } 482 486 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI 483 Bool isInterLayerReference (UChar uhInterDir, TComMvField& cMvFieldL0, TComMvField& cMvFieldL1);487 Bool isInterLayerReference ( UChar uhInterDir, TComMvField& cMvFieldL0, TComMvField& cMvFieldL1 ) const; 484 488 #endif 485 489 #if FAST_INTRA_SHVC 486 Int reduceSetOfIntraModes (UInt uiAbsPartIdx, Int* uiIntraDirPred, Int** posScalingFactor, Int &fullSetOfModes );490 Int reduceSetOfIntraModes ( UInt uiAbsPartIdx, Int* uiIntraDirPred, Int** posScalingFactor, Int &fullSetOfModes ); 487 491 #endif 488 492 #if REF_IDX_ME_ZEROMV 489 Bool xCheckZeroMVILRMerge (UChar uhInterDir, TComMvField& cMvFieldL0, TComMvField& cMvFieldL1);490 Bool xCheckZeroMVILRMvdL1Zero (Int iRefList, Int iRefIdx, Int MvpIdx);491 #endif 492 TComDataCU* getBaseColCU ( UInt refLayerIdc, UInt uiCuAbsPartIdx, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase, Int** posScalingFactor, Bool motionMapping = false );493 TComDataCU* getBaseColCU ( UInt refLayerIdc, UInt pelX, UInt pelY, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase, Int** posScalingFactor, Bool motionMapping = false );494 Void scaleBaseMV ( UInt refLayerIdc, TComMvField& rcMvFieldEnhance, TComMvField& rcMvFieldBase, Int** mvScalingFactor );493 Bool xCheckZeroMVILRMerge ( UChar uhInterDir, TComMvField& cMvFieldL0, TComMvField& cMvFieldL1); 494 Bool xCheckZeroMVILRMvdL1Zero ( Int iRefList, Int iRefIdx, Int MvpIdx); 495 #endif 496 TComDataCU* getBaseColCU ( UInt refLayerIdc, UInt uiCuAbsPartIdx, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase, Int** posScalingFactor, Bool motionMapping = false ); 497 TComDataCU* getBaseColCU ( UInt refLayerIdc, UInt pelX, UInt pelY, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase, Int** posScalingFactor, Bool motionMapping = false ); 498 Void scaleBaseMV ( UInt refLayerIdc, TComMvField& rcMvFieldEnhance, TComMvField& rcMvFieldBase, Int** mvScalingFactor ); 495 499 #if FAST_INTRA_SHVC 496 UChar getReducedSetIntraModes (UChar idx){ assert( idx < NUM_INTRA_MODE-1 ); return m_reducedSetIntraModes[idx]; }500 UChar getReducedSetIntraModes ( UChar idx ) const { assert( idx < NUM_INTRA_MODE-1 ); return m_reducedSetIntraModes[idx]; } 497 501 #endif 498 502 #endif -
branches/SHM-dev/source/Lib/TLibCommon/TComLoopFilter.cpp
r1305 r1465 369 369 UInt uiY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[ uiAbsZorderIdx ] ]; 370 370 371 TComDataCU* pcTempCU;372 371 UInt uiTempPartIdx; 373 372 … … 384 383 if ( m_stLFCUParam.bLeftEdge ) 385 384 { 386 pcTempCU = pcCU->getPULeft( uiTempPartIdx, uiAbsZorderIdx, !pcCU->getSlice()->getLFCrossSliceBoundaryFlag(), !m_bLFCrossTileBoundary);385 const TComDataCU* pcTempCU = pcCU->getPULeft( uiTempPartIdx, uiAbsZorderIdx, !pcCU->getSlice()->getLFCrossSliceBoundaryFlag(), !m_bLFCrossTileBoundary); 387 386 388 387 if ( pcTempCU != NULL ) … … 406 405 if ( m_stLFCUParam.bTopEdge ) 407 406 { 408 pcTempCU = pcCU->getPUAbove( uiTempPartIdx, uiAbsZorderIdx, !pcCU->getSlice()->getLFCrossSliceBoundaryFlag(), false, !m_bLFCrossTileBoundary);407 const TComDataCU* pcTempCU = pcCU->getPUAbove( uiTempPartIdx, uiAbsZorderIdx, !pcCU->getSlice()->getLFCrossSliceBoundaryFlag(), false, !m_bLFCrossTileBoundary); 409 408 410 409 if ( pcTempCU != NULL ) … … 429 428 430 429 UInt uiPartP; 431 TComDataCU* pcCUP;430 const TComDataCU* pcCUP; 432 431 UInt uiBs = 0; 433 432 … … 463 462 { 464 463 Int iRefIdx; 465 TComPic *piRefP0, *piRefP1, *piRefQ0, *piRefQ1;466 464 iRefIdx = pcCUP->getCUMvField(REF_PIC_LIST_0)->getRefIdx(uiPartP); 467 piRefP0 = (iRefIdx < 0) ? NULL : pcCUP->getSlice()->getRefPic(REF_PIC_LIST_0, iRefIdx);465 const TComPic *piRefP0 = (iRefIdx < 0) ? NULL : pcCUP->getSlice()->getRefPic(REF_PIC_LIST_0, iRefIdx); 468 466 iRefIdx = pcCUP->getCUMvField(REF_PIC_LIST_1)->getRefIdx(uiPartP); 469 piRefP1 = (iRefIdx < 0) ? NULL : pcCUP->getSlice()->getRefPic(REF_PIC_LIST_1, iRefIdx);467 const TComPic *piRefP1 = (iRefIdx < 0) ? NULL : pcCUP->getSlice()->getRefPic(REF_PIC_LIST_1, iRefIdx); 470 468 iRefIdx = pcCUQ->getCUMvField(REF_PIC_LIST_0)->getRefIdx(uiPartQ); 471 piRefQ0 = (iRefIdx < 0) ? NULL : pcSlice->getRefPic(REF_PIC_LIST_0, iRefIdx);469 const TComPic *piRefQ0 = (iRefIdx < 0) ? NULL : pcSlice->getRefPic(REF_PIC_LIST_0, iRefIdx); 472 470 iRefIdx = pcCUQ->getCUMvField(REF_PIC_LIST_1)->getRefIdx(uiPartQ); 473 piRefQ1 = (iRefIdx < 0) ? NULL : pcSlice->getRefPic(REF_PIC_LIST_1, iRefIdx);471 const TComPic *piRefQ1 = (iRefIdx < 0) ? NULL : pcSlice->getRefPic(REF_PIC_LIST_1, iRefIdx); 474 472 475 473 TComMv pcMvP0 = pcCUP->getCUMvField(REF_PIC_LIST_0)->getMv(uiPartP); … … 534 532 { 535 533 Int iRefIdx; 536 TComPic *piRefP0, *piRefQ0;537 534 iRefIdx = pcCUP->getCUMvField(REF_PIC_LIST_0)->getRefIdx(uiPartP); 538 piRefP0 = (iRefIdx < 0) ? NULL : pcCUP->getSlice()->getRefPic(REF_PIC_LIST_0, iRefIdx);535 const TComPic *piRefP0 = (iRefIdx < 0) ? NULL : pcCUP->getSlice()->getRefPic(REF_PIC_LIST_0, iRefIdx); 539 536 iRefIdx = pcCUQ->getCUMvField(REF_PIC_LIST_0)->getRefIdx(uiPartQ); 540 piRefQ0 = (iRefIdx < 0) ? NULL : pcSlice->getRefPic(REF_PIC_LIST_0, iRefIdx);537 const TComPic *piRefQ0 = (iRefIdx < 0) ? NULL : pcSlice->getRefPic(REF_PIC_LIST_0, iRefIdx); 541 538 TComMv pcMvP0 = pcCUP->getCUMvField(REF_PIC_LIST_0)->getMv(uiPartP); 542 539 TComMv pcMvQ0 = pcCUQ->getCUMvField(REF_PIC_LIST_0)->getMv(uiPartQ); … … 593 590 UInt uiPartPIdx = 0; 594 591 UInt uiPartQIdx = 0; 595 TComDataCU* pcCUP = pcCU;592 const TComDataCU* pcCUP = pcCU; 596 593 TComDataCU* pcCUQ = pcCU; 597 594 Int betaOffsetDiv2 = pcCUQ->getSlice()->getDeblockingFilterBetaOffsetDiv2(); … … 776 773 UInt uiPartQIdx = uiBsAbsIdx; 777 774 // Derive neighboring PU index 778 TComDataCU* pcCUP;775 const TComDataCU* pcCUP; 779 776 UInt uiPartPIdx; 780 777 -
branches/SHM-dev/source/Lib/TLibCommon/TComMotionInfo.h
r1442 r1465 54 54 typedef struct _AMVPInfo 55 55 { 56 TComMv m_acMvCand[ AMVP_MAX_NUM_CANDS _MEM]; ///< array of motion vector predictor candidates56 TComMv m_acMvCand[ AMVP_MAX_NUM_CANDS ]; ///< array of motion vector predictor candidates 57 57 Int iN; ///< number of motion vector predictor candidates 58 58 } AMVPInfo; -
branches/SHM-dev/source/Lib/TLibCommon/TComPattern.cpp
r1368 r1465 66 66 67 67 /// constrained intra prediction 68 Bool isAboveLeftAvailable ( TComDataCU* pcCU, UInt uiPartIdxLT );69 Int isAboveAvailable ( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxRT, Bool* bValidFlags );70 Int isLeftAvailable ( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxLB, Bool* bValidFlags );71 Int isAboveRightAvailable ( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxRT, Bool* bValidFlags );72 Int isBelowLeftAvailable ( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxLB, Bool* bValidFlags );68 Bool isAboveLeftAvailable ( const TComDataCU* pcCU, UInt uiPartIdxLT ); 69 Int isAboveAvailable ( const TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxRT, Bool* bValidFlags ); 70 Int isLeftAvailable ( const TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxLB, Bool* bValidFlags ); 71 Int isAboveRightAvailable ( const TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxRT, Bool* bValidFlags ); 72 Int isBelowLeftAvailable ( const TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxLB, Bool* bValidFlags ); 73 73 74 74 … … 570 570 } 571 571 572 Bool isAboveLeftAvailable( TComDataCU* pcCU, UInt uiPartIdxLT )572 Bool isAboveLeftAvailable( const TComDataCU* pcCU, UInt uiPartIdxLT ) 573 573 { 574 574 Bool bAboveLeftFlag; 575 575 UInt uiPartAboveLeft; 576 TComDataCU* pcCUAboveLeft = pcCU->getPUAboveLeft( uiPartAboveLeft, uiPartIdxLT );576 const TComDataCU* pcCUAboveLeft = pcCU->getPUAboveLeft( uiPartAboveLeft, uiPartIdxLT ); 577 577 if(pcCU->getSlice()->getPPS()->getConstrainedIntraPred()) 578 578 { … … 586 586 } 587 587 588 Int isAboveAvailable( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxRT, Bool *bValidFlags )588 Int isAboveAvailable( const TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxRT, Bool *bValidFlags ) 589 589 { 590 590 const UInt uiRasterPartBegin = g_auiZscanToRaster[uiPartIdxLT]; … … 597 597 { 598 598 UInt uiPartAbove; 599 TComDataCU* pcCUAbove = pcCU->getPUAbove( uiPartAbove, g_auiRasterToZscan[uiRasterPart] );599 const TComDataCU* pcCUAbove = pcCU->getPUAbove( uiPartAbove, g_auiRasterToZscan[uiRasterPart] ); 600 600 if(pcCU->getSlice()->getPPS()->getConstrainedIntraPred()) 601 601 { … … 627 627 } 628 628 629 Int isLeftAvailable( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxLB, Bool *bValidFlags )629 Int isLeftAvailable( const TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxLB, Bool *bValidFlags ) 630 630 { 631 631 const UInt uiRasterPartBegin = g_auiZscanToRaster[uiPartIdxLT]; … … 638 638 { 639 639 UInt uiPartLeft; 640 TComDataCU* pcCULeft = pcCU->getPULeft( uiPartLeft, g_auiRasterToZscan[uiRasterPart] );640 const TComDataCU* pcCULeft = pcCU->getPULeft( uiPartLeft, g_auiRasterToZscan[uiRasterPart] ); 641 641 if(pcCU->getSlice()->getPPS()->getConstrainedIntraPred()) 642 642 { … … 669 669 } 670 670 671 Int isAboveRightAvailable( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxRT, Bool *bValidFlags )671 Int isAboveRightAvailable( const TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxRT, Bool *bValidFlags ) 672 672 { 673 673 const UInt uiNumUnitsInPU = g_auiZscanToRaster[uiPartIdxRT] - g_auiZscanToRaster[uiPartIdxLT] + 1; … … 678 678 { 679 679 UInt uiPartAboveRight; 680 TComDataCU* pcCUAboveRight = pcCU->getPUAboveRight( uiPartAboveRight, uiPartIdxRT, uiOffset );680 const TComDataCU* pcCUAboveRight = pcCU->getPUAboveRight( uiPartAboveRight, uiPartIdxRT, uiOffset ); 681 681 if(pcCU->getSlice()->getPPS()->getConstrainedIntraPred()) 682 682 { … … 709 709 } 710 710 711 Int isBelowLeftAvailable( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxLB, Bool *bValidFlags )711 Int isBelowLeftAvailable( const TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxLB, Bool *bValidFlags ) 712 712 { 713 713 const UInt uiNumUnitsInPU = (g_auiZscanToRaster[uiPartIdxLB] - g_auiZscanToRaster[uiPartIdxLT]) / pcCU->getPic()->getNumPartInCtuWidth() + 1; … … 718 718 { 719 719 UInt uiPartBelowLeft; 720 TComDataCU* pcCUBelowLeft = pcCU->getPUBelowLeft( uiPartBelowLeft, uiPartIdxLB, uiOffset );720 const TComDataCU* pcCUBelowLeft = pcCU->getPUBelowLeft( uiPartBelowLeft, uiPartIdxLB, uiOffset ); 721 721 if(pcCU->getSlice()->getPPS()->getConstrainedIntraPred()) 722 722 { -
branches/SHM-dev/source/Lib/TLibCommon/TComPic.h
r1419 r1465 84 84 85 85 SEIMessages m_SEIs; ///< Any SEI messages that have been received. If !NULL we own the object. 86 86 87 #if SVC_EXTENSION 87 88 UInt m_layerId; // Layer ID … … 119 120 120 121 TComPicSym* getPicSym() { return &m_picSym; } 122 const TComPicSym* getPicSym() const { return &m_picSym; } 121 123 TComSlice* getSlice(Int i) { return m_picSym.getSlice(i); } 122 124 Int getPOC() const { return m_picSym.getSlice(m_uiCurrSliceIdx)->getPOC(); } … … 192 194 #if SVC_EXTENSION 193 195 Void setLayerId(UInt layerId) { m_layerId = layerId; } 194 UInt getLayerId() 195 UInt getLayerIdx() { return getSlice(0)->getVPS()->getLayerIdxInVps(m_layerId);}196 Bool isSpatialEnhLayer(UInt refLayerIdc) 196 UInt getLayerId() const { return m_layerId; } 197 UInt getLayerIdx() const { return m_picSym.getSlice(0)->getVPS()->getLayerIdxInVps(m_layerId); } 198 Bool isSpatialEnhLayer(UInt refLayerIdc) const { return m_bSpatialEnhLayer[refLayerIdc]; } 197 199 Void setSpatialEnhLayerFlag (UInt refLayerIdc, Bool b) { m_bSpatialEnhLayer[refLayerIdc] = b; } 198 200 Void setFullPelBaseRec (UInt refLayerIdc, TComPicYuv* p) { m_pcFullPelBaseRec[refLayerIdc] = p; } 199 TComPicYuv* getFullPelBaseRec (UInt refLayerIdc) 200 Bool isILR( UInt currLayerId ) 201 Bool equalPictureSizeAndOffsetFlag(UInt refLayerIdc) 201 TComPicYuv* getFullPelBaseRec (UInt refLayerIdc) const { return m_pcFullPelBaseRec[refLayerIdc]; } 202 Bool isILR( UInt currLayerId ) const { return ( m_bIsLongTerm && m_layerId < currLayerId ); } 203 Bool equalPictureSizeAndOffsetFlag(UInt refLayerIdc) const { return m_equalPictureSizeAndOffsetFlag[refLayerIdc]; } 202 204 Void setEqualPictureSizeAndOffsetFlag(UInt refLayerIdc, Bool b) { m_equalPictureSizeAndOffsetFlag[refLayerIdc] = b; } 203 205 Void copyUpsampledMvField(UInt refLayerIdc, Int** mvScalingFactor, Int** posScalingFactor); … … 215 217 #if CGS_3D_ASYMLUT 216 218 Void setFrameBit( Int n ) { m_nFrameBit = n; } 217 Int getFrameBit() 218 #endif 219 Bool isCurrAu() 219 Int getFrameBit() const { return m_nFrameBit; } 220 #endif 221 Bool isCurrAu() const { return m_currAuFlag; } 220 222 Void setCurrAuFlag(Bool x) { m_currAuFlag = x; } 221 223 #endif //SVC_EXTENSION -
branches/SHM-dev/source/Lib/TLibCommon/TComSlice.h
r1464 r1465 464 464 } u; 465 465 }; 466 467 466 468 467 class Window … … 2203 2202 TComPic* getPic() { return m_pcPic; } 2204 2203 TComPic* getRefPic( RefPicList e, Int iRefIdx) { return m_apcRefPicList[e][iRefIdx]; } 2205 Int getRefPOC( RefPicList e, Int iRefIdx) { return m_aiRefPOCList[e][iRefIdx]; } 2204 const TComPic* getRefPic( RefPicList e, Int iRefIdx) const { return m_apcRefPicList[e][iRefIdx]; } 2205 Int getRefPOC( RefPicList e, Int iRefIdx) const { return m_aiRefPOCList[e][iRefIdx]; } 2206 2206 Int getDepth() const { return m_iDepth; } 2207 2207 Bool getColFromL0Flag() const { return m_colFromL0Flag; } … … 2385 2385 2386 2386 Void setEnableTMVPFlag( Bool b ) { m_enableTMVPFlag = b; } 2387 Bool getEnableTMVPFlag() 2387 Bool getEnableTMVPFlag() const { return m_enableTMVPFlag; } 2388 2388 2389 2389 Void setEncCABACTableIdx( SliceType idx ) { m_encCABACTableIdx = idx; } -
branches/SHM-dev/source/Lib/TLibEncoder/TEncSearch.cpp
r1444 r1465 3529 3529 // save ME result. 3530 3530 uiMEInterDir = pcCU->getInterDir( uiPartAddr ); 3531 pcCU->getMvField( pcCU, uiPartAddr, REF_PIC_LIST_0, cMEMvField[0] );3532 pcCU->getMvField( pcCU, uiPartAddr, REF_PIC_LIST_1, cMEMvField[1] );3531 TComDataCU::getMvField( pcCU, uiPartAddr, REF_PIC_LIST_0, cMEMvField[0] ); 3532 TComDataCU::getMvField( pcCU, uiPartAddr, REF_PIC_LIST_1, cMEMvField[1] ); 3533 3533 3534 3534 // find Merge result
Note: See TracChangeset for help on using the changeset viewer.