Changeset 1386 in 3DVCSoftware for trunk/source/Lib/TLibCommon/TComDataCU.cpp
- Timestamp:
- 13 Nov 2015, 16:29:39 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/Lib/TLibCommon/TComDataCU.cpp
r1356 r1386 160 160 if ( !bDecSubCu ) 161 161 { 162 m_phQP = ( Char* )xMalloc(Char,uiNumPartition);162 m_phQP = (SChar* )xMalloc(SChar, uiNumPartition); 163 163 m_puhDepth = (UChar* )xMalloc(UChar, uiNumPartition); 164 164 m_puhWidth = (UChar* )xMalloc(UChar, uiNumPartition); … … 171 171 m_ucDISType = (UChar*)xMalloc(UChar, uiNumPartition); 172 172 #endif 173 m_pePartSize = new Char[ uiNumPartition ];173 m_pePartSize = new SChar[ uiNumPartition ]; 174 174 memset( m_pePartSize, NUMBER_OF_PART_SIZES,uiNumPartition * sizeof( *m_pePartSize ) ); 175 m_pePredMode = new Char[ uiNumPartition ];175 m_pePredMode = new SChar[ uiNumPartition ]; 176 176 m_CUTransquantBypass = new Bool[ uiNumPartition ]; 177 177 … … 179 179 m_puhMergeIndex = (UChar* )xMalloc(UChar, uiNumPartition); 180 180 #if NH_3D_VSP 181 m_piVSPFlag = ( Char* )xMalloc(Char,uiNumPartition);181 m_piVSPFlag = (SChar* )xMalloc(SChar, uiNumPartition); 182 182 #endif 183 183 #if NH_3D_SPIVMP … … 196 196 { 197 197 const RefPicList rpl=RefPicList(i); 198 m_apiMVPIdx[rpl] = new Char[ uiNumPartition ];199 m_apiMVPNum[rpl] = new Char[ uiNumPartition ];200 memset( m_apiMVPIdx[rpl], -1,uiNumPartition * sizeof( Char ) );198 m_apiMVPIdx[rpl] = new SChar[ uiNumPartition ]; 199 m_apiMVPNum[rpl] = new SChar[ uiNumPartition ]; 200 memset( m_apiMVPIdx[rpl], -1,uiNumPartition * sizeof( SChar ) ); 201 201 } 202 202 … … 212 212 const UInt totalSize = (uiWidth * uiHeight) >> chromaShift; 213 213 214 m_crossComponentPredictionAlpha[compID] = ( Char* )xMalloc(Char,uiNumPartition);214 m_crossComponentPredictionAlpha[compID] = (SChar* )xMalloc(SChar, uiNumPartition); 215 215 m_puhTransformSkip[compID] = (UChar* )xMalloc(UChar, uiNumPartition); 216 216 m_explicitRdpcmMode[compID] = (UChar* )xMalloc(UChar, uiNumPartition); … … 524 524 } 525 525 526 Bool TComDataCU::isLastSubCUOfCtu(const UInt absPartIdx) 526 Bool TComDataCU::isLastSubCUOfCtu(const UInt absPartIdx) const 527 527 { 528 528 const TComSPS &sps=*(getSlice()->getSPS()); … … 844 844 Int iSizeInUchar = sizeof( UChar ) * m_uiNumPartition; 845 845 Int iSizeInBool = sizeof( Bool ) * m_uiNumPartition; 846 Int sizeInChar = sizeof( Char ) * m_uiNumPartition;846 Int sizeInChar = sizeof( SChar ) * m_uiNumPartition; 847 847 848 848 memset( m_phQP, qp, sizeInChar ); … … 850 850 memset( m_puhMergeIndex, 0, iSizeInUchar ); 851 851 #if NH_3D_VSP 852 memset( m_piVSPFlag, 0, sizeof( Char) * m_uiNumPartition );852 memset( m_piVSPFlag, 0, sizeof( SChar ) * m_uiNumPartition ); 853 853 #endif 854 854 #if NH_3D_SPIVMP … … 1121 1121 1122 1122 // Copy inter prediction info from the biggest CU 1123 Void TComDataCU::copyInterPredInfoFrom ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList1124 1123 #if NH_3D_NBDV 1125 , Bool bNBDV 1126 #endif 1127 ) 1124 Void TComDataCU::copyInterPredInfoFrom ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList , Bool bNBDV ) 1125 #else 1126 Void TComDataCU::copyInterPredInfoFrom ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList ) 1127 #endif 1128 1128 { 1129 1129 m_pcPic = pcCU->getPic(); … … 1219 1219 Int iSizeInBool = sizeof( Bool ) * uiNumPartition; 1220 1220 1221 Int sizeInChar = sizeof( Char ) * uiNumPartition;1221 Int sizeInChar = sizeof( SChar ) * uiNumPartition; 1222 1222 memcpy( m_skipFlag + uiOffset, pcCU->getSkipFlag(), sizeof( *m_skipFlag ) * uiNumPartition ); 1223 1223 #if NH_3D_DIS … … 1233 1233 memcpy( m_puhMergeIndex + uiOffset, pcCU->getMergeIndex(), iSizeInUchar ); 1234 1234 #if NH_3D_VSP 1235 memcpy( m_piVSPFlag + uiOffset, pcCU->getVSPFlag(), sizeof( Char ) * uiNumPartition );1235 memcpy( m_piVSPFlag + uiOffset, pcCU->getVSPFlag(), sizeof( SChar ) * uiNumPartition ); 1236 1236 memcpy( m_pDvInfo + uiOffset, pcCU->getDvInfo(), sizeof( *m_pDvInfo ) * uiNumPartition ); 1237 1237 #endif … … 1335 1335 Int iSizeInUchar = sizeof( UChar ) * m_uiNumPartition; 1336 1336 Int iSizeInBool = sizeof( Bool ) * m_uiNumPartition; 1337 Int sizeInChar = sizeof( Char ) * m_uiNumPartition;1337 Int sizeInChar = sizeof( SChar ) * m_uiNumPartition; 1338 1338 1339 1339 memcpy( pCtu->getSkipFlag() + m_absZIdxInCtu, m_skipFlag, sizeof( *m_skipFlag ) * m_uiNumPartition ); … … 1355 1355 memcpy( pCtu->getMergeIndex() + m_absZIdxInCtu, m_puhMergeIndex, iSizeInUchar ); 1356 1356 #if NH_3D_VSP 1357 memcpy( pCtu->getVSPFlag() + m_absZIdxInCtu, m_piVSPFlag, sizeof( Char ) * m_uiNumPartition );1357 memcpy( pCtu->getVSPFlag() + m_absZIdxInCtu, m_piVSPFlag, sizeof( SChar ) * m_uiNumPartition ); 1358 1358 #endif 1359 1359 #if NH_3D_DBBP … … 1447 1447 // -------------------------------------------------------------------------------------------------------------------- 1448 1448 1449 TComDataCU* TComDataCU::getPULeft( UInt& uiLPartUnitIdx,1449 const TComDataCU* TComDataCU::getPULeft( UInt& uiLPartUnitIdx, 1450 1450 UInt uiCurrPartUnitIdx, 1451 1451 Bool bEnforceSliceRestriction, 1452 Bool bEnforceTileRestriction )1452 Bool bEnforceTileRestriction ) const 1453 1453 { 1454 1454 UInt uiAbsPartIdx = g_auiZscanToRaster[uiCurrPartUnitIdx]; … … 1479 1479 1480 1480 1481 TComDataCU* TComDataCU::getPUAbove( UInt& uiAPartUnitIdx,1481 const TComDataCU* TComDataCU::getPUAbove( UInt& uiAPartUnitIdx, 1482 1482 UInt uiCurrPartUnitIdx, 1483 1483 Bool bEnforceSliceRestriction, 1484 1484 Bool planarAtCtuBoundary, 1485 Bool bEnforceTileRestriction )1485 Bool bEnforceTileRestriction ) const 1486 1486 { 1487 1487 UInt uiAbsPartIdx = g_auiZscanToRaster[uiCurrPartUnitIdx]; … … 1517 1517 } 1518 1518 1519 TComDataCU* TComDataCU::getPUAboveLeft( UInt& uiALPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction ) 1519 const TComDataCU* TComDataCU::getPUAboveLeft( UInt& uiALPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction ) const 1520 1520 { 1521 1521 UInt uiAbsPartIdx = g_auiZscanToRaster[uiCurrPartUnitIdx]; … … 1564 1564 } 1565 1565 1566 TComDataCU* TComDataCU::getPUBelowLeft(UInt& uiBLPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset, Bool bEnforceSliceRestriction) 1566 const TComDataCU* TComDataCU::getPUBelowLeft(UInt& uiBLPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset, Bool bEnforceSliceRestriction) const 1567 1567 { 1568 1568 UInt uiAbsPartIdxLB = g_auiZscanToRaster[uiCurrPartUnitIdx]; … … 1608 1608 } 1609 1609 1610 TComDataCU* TComDataCU::getPUAboveRight(UInt& uiARPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset, Bool bEnforceSliceRestriction) 1610 const TComDataCU* TComDataCU::getPUAboveRight(UInt& uiARPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset, Bool bEnforceSliceRestriction) const 1611 1611 { 1612 1612 UInt uiAbsPartIdxRT = g_auiZscanToRaster[uiCurrPartUnitIdx]; … … 1668 1668 *\returns TComDataCU* point of TComDataCU of left QpMinCu 1669 1669 */ 1670 TComDataCU* TComDataCU::getQpMinCuLeft( UInt& uiLPartUnitIdx, UInt uiCurrAbsIdxInCtu ) 1670 const TComDataCU* TComDataCU::getQpMinCuLeft( UInt& uiLPartUnitIdx, UInt uiCurrAbsIdxInCtu ) const 1671 1671 { 1672 1672 const UInt numPartInCtuWidth = m_pcPic->getNumPartInCtuWidth(); … … 1695 1695 *\returns TComDataCU* point of TComDataCU of above QpMinCu 1696 1696 */ 1697 TComDataCU* TComDataCU::getQpMinCuAbove( UInt& uiAPartUnitIdx, UInt uiCurrAbsIdxInCtu ) 1697 const TComDataCU* TComDataCU::getQpMinCuAbove( UInt& uiAPartUnitIdx, UInt uiCurrAbsIdxInCtu ) const 1698 1698 { 1699 1699 const UInt numPartInCtuWidth = m_pcPic->getNumPartInCtuWidth(); … … 1721 1721 /** Get reference QP from left QpMinCu or latest coded QP 1722 1722 *\param uiCurrAbsIdxInCtu 1723 *\returns Char reference QP value1723 *\returns SChar reference QP value 1724 1724 */ 1725 Char TComDataCU::getRefQP( UInt uiCurrAbsIdxInCtu ) 1725 SChar TComDataCU::getRefQP( UInt uiCurrAbsIdxInCtu ) const 1726 1726 { 1727 1727 UInt lPartIdx = MAX_UINT; 1728 1728 UInt aPartIdx = MAX_UINT; 1729 TComDataCU* cULeft = getQpMinCuLeft ( lPartIdx, m_absZIdxInCtu + uiCurrAbsIdxInCtu );1730 TComDataCU* cUAbove = getQpMinCuAbove( aPartIdx, m_absZIdxInCtu + uiCurrAbsIdxInCtu );1729 const TComDataCU* cULeft = getQpMinCuLeft ( lPartIdx, m_absZIdxInCtu + uiCurrAbsIdxInCtu ); 1730 const TComDataCU* cUAbove = getQpMinCuAbove( aPartIdx, m_absZIdxInCtu + uiCurrAbsIdxInCtu ); 1731 1731 return (((cULeft? cULeft->getQP( lPartIdx ): getLastCodedQP( uiCurrAbsIdxInCtu )) + (cUAbove? cUAbove->getQP( aPartIdx ): getLastCodedQP( uiCurrAbsIdxInCtu )) + 1) >> 1); 1732 1732 } 1733 1733 1734 Int TComDataCU::getLastValidPartIdx( Int iAbsPartIdx ) 1734 Int TComDataCU::getLastValidPartIdx( Int iAbsPartIdx ) const 1735 1735 { 1736 1736 Int iLastValidPartIdx = iAbsPartIdx-1; … … 1744 1744 } 1745 1745 1746 Char TComDataCU::getLastCodedQP( UInt uiAbsPartIdx ) 1746 SChar TComDataCU::getLastCodedQP( UInt uiAbsPartIdx ) const 1747 1747 { 1748 1748 UInt uiQUPartIdxMask = ~((1<<((getSlice()->getSPS()->getMaxTotalCUDepth() - getSlice()->getPPS()->getMaxCuDQPDepth())<<1))-1); … … 1784 1784 * \returns true if the CU is coded in lossless coding mode; false if otherwise 1785 1785 */ 1786 Bool TComDataCU::isLosslessCoded(UInt absPartIdx) 1786 Bool TComDataCU::isLosslessCoded(UInt absPartIdx) const 1787 1787 { 1788 1788 return (getSlice()->getPPS()->getTransquantBypassEnableFlag() && getCUTransquantBypass (absPartIdx)); … … 1796 1796 *\param [out] uiModeList pointer to chroma intra modes array 1797 1797 */ 1798 Void TComDataCU::getAllowedChromaDir( UInt uiAbsPartIdx, UInt uiModeList[NUM_CHROMA_MODE] ) 1798 Void TComDataCU::getAllowedChromaDir( UInt uiAbsPartIdx, UInt uiModeList[NUM_CHROMA_MODE] ) const 1799 1799 { 1800 1800 uiModeList[0] = PLANAR_IDX; … … 1824 1824 *\returns Number of MPM 1825 1825 */ 1826 Void TComDataCU::getIntraDirPredictor( UInt uiAbsPartIdx, Int uiIntraDirPred[NUM_MOST_PROBABLE_MODES], const ComponentID compID, Int* piMode ) 1827 { 1828 TComDataCU* pcCULeft, *pcCUAbove; 1826 Void TComDataCU::getIntraDirPredictor( UInt uiAbsPartIdx, Int uiIntraDirPred[NUM_MOST_PROBABLE_MODES], const ComponentID compID, Int* piMode ) const 1827 { 1829 1828 UInt LeftPartIdx = MAX_UINT; 1830 1829 UInt AbovePartIdx = MAX_UINT; … … 1836 1835 const ChromaFormat chForm = getPic()->getChromaFormat(); 1837 1836 // Get intra direction of left PU 1838 pcCULeft = getPULeft( LeftPartIdx, m_absZIdxInCtu + uiAbsPartIdx );1837 const TComDataCU *pcCULeft = getPULeft( LeftPartIdx, m_absZIdxInCtu + uiAbsPartIdx ); 1839 1838 1840 1839 if (isChroma(compID)) … … 1848 1847 1849 1848 // Get intra direction of above PU 1850 pcCUAbove = getPUAbove( AbovePartIdx, m_absZIdxInCtu + uiAbsPartIdx, true, true );1849 const TComDataCU *pcCUAbove = getPUAbove( AbovePartIdx, m_absZIdxInCtu + uiAbsPartIdx, true, true ); 1851 1850 1852 1851 if (isChroma(compID)) … … 1917 1916 } 1918 1917 1919 UInt TComDataCU::getCtxSplitFlag( UInt uiAbsPartIdx, UInt uiDepth ) 1920 { 1921 TComDataCU* pcTempCU;1918 UInt TComDataCU::getCtxSplitFlag( UInt uiAbsPartIdx, UInt uiDepth ) const 1919 { 1920 const TComDataCU* pcTempCU; 1922 1921 UInt uiTempPartIdx; 1923 1922 UInt uiCtx; … … 1933 1932 } 1934 1933 1935 UInt TComDataCU::getCtxQtCbf( TComTU &rTu, const ChannelType chType ) 1934 UInt TComDataCU::getCtxQtCbf( TComTU &rTu, const ChannelType chType ) const 1936 1935 { 1937 1936 const UInt transformDepth = rTu.GetTransformDepthRel(); … … 1948 1947 } 1949 1948 1950 UInt TComDataCU::getQuadtreeTULog2MinSizeInCU( UInt absPartIdx ) 1949 UInt TComDataCU::getQuadtreeTULog2MinSizeInCU( UInt absPartIdx ) const 1951 1950 { 1952 1951 UInt log2CbSize = g_aucConvertToBit[getWidth( absPartIdx )] + 2; … … 1975 1974 } 1976 1975 1977 UInt TComDataCU::getCtxSkipFlag( UInt uiAbsPartIdx ) 1978 { 1979 TComDataCU* pcTempCU;1976 UInt TComDataCU::getCtxSkipFlag( UInt uiAbsPartIdx ) const 1977 { 1978 const TComDataCU* pcTempCU; 1980 1979 UInt uiTempPartIdx; 1981 1980 UInt uiCtx = 0; … … 1994 1993 UInt TComDataCU::getCTXARPWFlag( UInt uiAbsPartIdx ) 1995 1994 { 1996 TComDataCU* pcTempCU;1995 const TComDataCU* pcTempCU; 1997 1996 UInt uiTempPartIdx; 1998 1997 UInt uiCtx = 0; 1999 1998 2000 1999 pcTempCU = getPULeft( uiTempPartIdx, m_absZIdxInCtu + uiAbsPartIdx ); 2001 2000 uiCtx = ( pcTempCU ) ? ((pcTempCU->getARPW( uiTempPartIdx )==0)?0:1) : 0; 2002 2001 return uiCtx; 2003 2002 } 2004 2003 #endif … … 2086 2085 2087 2086 2088 UInt TComDataCU::getCtxInterDir( UInt uiAbsPartIdx ) 2087 UInt TComDataCU::getCtxInterDir( UInt uiAbsPartIdx ) const 2089 2088 { 2090 2089 return getDepth( uiAbsPartIdx ); … … 2092 2091 2093 2092 2094 UChar TComDataCU::getQtRootCbf( UInt uiIdx ) 2093 UChar TComDataCU::getQtRootCbf( UInt uiIdx ) const 2095 2094 { 2096 2095 const UInt numberValidComponents = getPic()->getNumberValidComponents(); … … 2148 2147 } 2149 2148 2150 Bool TComDataCU::isFirstAbsZorderIdxInDepth (UInt uiAbsPartIdx, UInt uiDepth) 2149 Bool TComDataCU::isFirstAbsZorderIdxInDepth (UInt uiAbsPartIdx, UInt uiDepth) const 2151 2150 { 2152 2151 UInt uiPartNumb = m_pcPic->getNumPartitionsInCtu() >> (uiDepth << 1); … … 2376 2375 2377 2376 #if NH_3D_VSP 2378 Void TComDataCU::setVSPFlagSubParts( Char iVSPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth )2379 { 2380 setSubPart< Char>( iVSPFlag, m_piVSPFlag, uiAbsPartIdx, uiDepth, uiPartIdx );2377 Void TComDataCU::setVSPFlagSubParts( SChar iVSPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) 2378 { 2379 setSubPart<SChar>( iVSPFlag, m_piVSPFlag, uiAbsPartIdx, uiDepth, uiPartIdx ); 2381 2380 } 2382 2381 template<typename T> … … 2523 2522 Void TComDataCU::setMVPIdxSubParts( Int iMVPIdx, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) 2524 2523 { 2525 setSubPart< Char>( iMVPIdx, m_apiMVPIdx[eRefPicList], uiAbsPartIdx, uiDepth, uiPartIdx );2524 setSubPart<SChar>( iMVPIdx, m_apiMVPIdx[eRefPicList], uiAbsPartIdx, uiDepth, uiPartIdx ); 2526 2525 } 2527 2526 2528 2527 Void TComDataCU::setMVPNumSubParts( Int iMVPNum, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) 2529 2528 { 2530 setSubPart< Char>( iMVPNum, m_apiMVPNum[eRefPicList], uiAbsPartIdx, uiDepth, uiPartIdx );2529 setSubPart<SChar>( iMVPNum, m_apiMVPNum[eRefPicList], uiAbsPartIdx, uiDepth, uiPartIdx ); 2531 2530 } 2532 2531 … … 2561 2560 } 2562 2561 2563 Void TComDataCU::setCrossComponentPredictionAlphaPartRange( Char alphaValue, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes )2564 { 2565 memset((m_crossComponentPredictionAlpha[compID] + uiAbsPartIdx), alphaValue, (sizeof( Char) * uiCoveredPartIdxes));2562 Void TComDataCU::setCrossComponentPredictionAlphaPartRange( SChar alphaValue, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes ) 2563 { 2564 memset((m_crossComponentPredictionAlpha[compID] + uiAbsPartIdx), alphaValue, (sizeof(SChar) * uiCoveredPartIdxes)); 2566 2565 } 2567 2566 … … 2579 2578 } 2580 2579 2581 UChar TComDataCU::getNumPartitions(const UInt uiAbsPartIdx) 2580 UChar TComDataCU::getNumPartitions(const UInt uiAbsPartIdx) const 2582 2581 { 2583 2582 UChar iNumPart = 0; … … 2601 2600 // This is for use by a leaf/sub CU object only, with no additional AbsPartIdx 2602 2601 #if NH_3D_IC || NH_3D_VSP 2603 Void TComDataCU::getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx, Bool bLCU) 2602 Void TComDataCU::getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx, Bool bLCU) const 2604 2603 { 2605 2604 UInt uiNumPartition = bLCU ? (getWidth(uiAbsPartIdx)*getHeight(uiAbsPartIdx) >> 4) : m_uiNumPartition; … … 2645 2644 #else 2646 2645 2647 Void TComDataCU::getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight ) 2646 Void TComDataCU::getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight ) const 2648 2647 { 2649 2648 switch ( m_pePartSize[0] ) … … 2686 2685 #endif 2687 2686 2688 2689 Void TComDataCU::getMvField ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList, TComMvField& rcMvField )2687 // static member function 2688 Void TComDataCU::getMvField ( const TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList, TComMvField& rcMvField ) 2690 2689 { 2691 2690 if ( pcCU == NULL ) // OUT OF BOUNDARY … … 2696 2695 } 2697 2696 2698 TComCUMvField* pcCUMvField = pcCU->getCUMvField( eRefPicList );2697 const TComCUMvField* pcCUMvField = pcCU->getCUMvField( eRefPicList ); 2699 2698 rcMvField.setMvField( pcCUMvField->getMv( uiAbsPartIdx ), pcCUMvField->getRefIdx( uiAbsPartIdx ) ); 2700 2699 } 2701 2700 2702 Void TComDataCU::deriveLeftRightTopIdxGeneral ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ) 2701 Void TComDataCU::deriveLeftRightTopIdxGeneral ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ) const 2703 2702 { 2704 2703 ruiPartIdxLT = m_absZIdxInCtu + uiAbsPartIdx; … … 2749 2748 } 2750 2749 2751 Void TComDataCU::deriveLeftBottomIdxGeneral( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLB ) 2750 Void TComDataCU::deriveLeftBottomIdxGeneral( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLB ) const 2752 2751 { 2753 2752 UInt uiPUHeight = 0; … … 2796 2795 } 2797 2796 2798 Void TComDataCU::deriveLeftRightTopIdx ( UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ) 2797 Void TComDataCU::deriveLeftRightTopIdx ( UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ) const 2799 2798 { 2800 2799 ruiPartIdxLT = m_absZIdxInCtu; … … 2836 2835 } 2837 2836 2838 Void TComDataCU::deriveLeftBottomIdx( UInt uiPartIdx, UInt& ruiPartIdxLB ) 2837 Void TComDataCU::deriveLeftBottomIdx( UInt uiPartIdx, UInt& ruiPartIdxLB ) const 2839 2838 { 2840 2839 ruiPartIdxLB = g_auiRasterToZscan [g_auiZscanToRaster[ m_absZIdxInCtu ] + ( ((m_puhHeight[0] / m_pcPic->getMinCUHeight())>>1) - 1)*m_pcPic->getNumPartInCtuWidth()]; … … 2876 2875 * \param [out] ruiPartIdxRB partition index of neighbouring bottom right block 2877 2876 */ 2878 Void TComDataCU::deriveRightBottomIdx( UInt uiPartIdx, UInt &ruiPartIdxRB ) 2877 Void TComDataCU::deriveRightBottomIdx( UInt uiPartIdx, UInt &ruiPartIdxRB ) const 2879 2878 { 2880 2879 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]; … … 2912 2911 } 2913 2912 2914 Bool TComDataCU::hasEqualMotion( UInt uiAbsPartIdx, TComDataCU* pcCandCU, UInt uiCandAbsPartIdx )2913 Bool TComDataCU::hasEqualMotion( UInt uiAbsPartIdx, const TComDataCU* pcCandCU, UInt uiCandAbsPartIdx ) const 2915 2914 { 2916 2915 if ( getInterDir( uiAbsPartIdx ) != pcCandCU->getInterDir( uiCandAbsPartIdx ) ) … … 3098 3097 3099 3098 3100 #if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC3099 #if ENC_DEC_TRACE && NH_MV_ENC_DEC_TRAC 3101 3100 if ( g_traceMergeCandListConst ) 3102 3101 { … … 3177 3176 } 3178 3177 3179 #if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC3178 #if ENC_DEC_TRACE && NH_MV_ENC_DEC_TRAC 3180 3179 if ( g_traceMergeCandListConst ) 3181 3180 { … … 3306 3305 //left 3307 3306 UInt uiLeftPartIdx = 0; 3308 TComDataCU* pcCULeft = 0;3307 const TComDataCU* pcCULeft = 0; 3309 3308 pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB ); 3310 3309 … … 3783 3782 3784 3783 //! Construct a list of merging candidates 3784 #if NH_3D 3785 3785 Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx ) 3786 #else 3787 Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx ) const 3788 #endif 3786 3789 { 3787 3790 UInt uiAbsPartAddr = m_absZIdxInCtu + uiAbsPartIdx; … … 3811 3814 //left 3812 3815 UInt uiLeftPartIdx = 0; 3813 TComDataCU* pcCULeft = 0; 3814 pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB ); 3816 const TComDataCU *pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB ); 3815 3817 3816 3818 Bool isAvailableA1 = pcCULeft && … … 3828 3830 puhInterDirNeighbours[iCount] = pcCULeft->getInterDir( uiLeftPartIdx ); 3829 3831 // get Mv from Left 3830 pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );3832 TComDataCU::getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 3831 3833 if ( getSlice()->isInterB() ) 3832 3834 { 3833 pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );3835 TComDataCU::getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 3834 3836 } 3835 3837 if ( mrgCandIdx == iCount ) … … 3847 3849 // above 3848 3850 UInt uiAbovePartIdx = 0; 3849 TComDataCU* pcCUAbove = 0; 3850 pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT ); 3851 const TComDataCU *pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT ); 3851 3852 3852 3853 Bool isAvailableB1 = pcCUAbove && … … 3864 3865 puhInterDirNeighbours[iCount] = pcCUAbove->getInterDir( uiAbovePartIdx ); 3865 3866 // get Mv from Left 3866 pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );3867 TComDataCU::getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 3867 3868 if ( getSlice()->isInterB() ) 3868 3869 { 3869 pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );3870 TComDataCU::getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 3870 3871 } 3871 3872 if ( mrgCandIdx == iCount ) … … 3883 3884 // above right 3884 3885 UInt uiAboveRightPartIdx = 0; 3885 TComDataCU* pcCUAboveRight = 0; 3886 pcCUAboveRight = getPUAboveRight( uiAboveRightPartIdx, uiPartIdxRT ); 3886 const TComDataCU *pcCUAboveRight = getPUAboveRight( uiAboveRightPartIdx, uiPartIdxRT ); 3887 3887 3888 3888 Bool isAvailableB0 = pcCUAboveRight && … … 3899 3899 puhInterDirNeighbours[iCount] = pcCUAboveRight->getInterDir( uiAboveRightPartIdx ); 3900 3900 // get Mv from Left 3901 pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );3901 TComDataCU::getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 3902 3902 if ( getSlice()->isInterB() ) 3903 3903 { 3904 pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );3904 TComDataCU::getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 3905 3905 } 3906 3906 if ( mrgCandIdx == iCount ) … … 3918 3918 //left bottom 3919 3919 UInt uiLeftBottomPartIdx = 0; 3920 TComDataCU* pcCULeftBottom = 0; 3921 pcCULeftBottom = this->getPUBelowLeft( uiLeftBottomPartIdx, uiPartIdxLB ); 3920 const TComDataCU *pcCULeftBottom = this->getPUBelowLeft( uiLeftBottomPartIdx, uiPartIdxLB ); 3922 3921 3923 3922 Bool isAvailableA0 = pcCULeftBottom && … … 3934 3933 puhInterDirNeighbours[iCount] = pcCULeftBottom->getInterDir( uiLeftBottomPartIdx ); 3935 3934 // get Mv from Left 3936 pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );3935 TComDataCU::getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 3937 3936 if ( getSlice()->isInterB() ) 3938 3937 { 3939 pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );3938 TComDataCU::getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 3940 3939 } 3941 3940 if ( mrgCandIdx == iCount ) … … 3955 3954 { 3956 3955 UInt uiAboveLeftPartIdx = 0; 3957 TComDataCU* pcCUAboveLeft = 0; 3958 pcCUAboveLeft = getPUAboveLeft( uiAboveLeftPartIdx, uiAbsPartAddr ); 3956 const TComDataCU *pcCUAboveLeft = getPUAboveLeft( uiAboveLeftPartIdx, uiAbsPartAddr ); 3959 3957 3960 3958 Bool isAvailableB2 = pcCUAboveLeft && … … 3972 3970 puhInterDirNeighbours[iCount] = pcCUAboveLeft->getInterDir( uiAboveLeftPartIdx ); 3973 3971 // get Mv from Left 3974 pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );3972 TComDataCU::getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 3975 3973 if ( getSlice()->isInterB() ) 3976 3974 { 3977 pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );3975 TComDataCU::getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 3978 3976 } 3979 3977 if ( mrgCandIdx == iCount ) … … 4166 4164 * \param xP, yP location of the upper-left corner pixel of the current PU 4167 4165 */ 4168 Bool TComDataCU::isDiffMER(Int xN, Int yN, Int xP, Int yP) 4166 Bool TComDataCU::isDiffMER(Int xN, Int yN, Int xP, Int yP) const 4169 4167 { 4170 4168 … … 4186 4184 * \param nPSW, nPSH size of the current PU 4187 4185 */ 4188 Void TComDataCU::getPartPosition( UInt partIdx, Int& xP, Int& yP, Int& nPSW, Int& nPSH) 4186 Void TComDataCU::getPartPosition( UInt partIdx, Int& xP, Int& yP, Int& nPSW, Int& nPSH) const 4189 4187 { 4190 4188 UInt col = m_uiCUPelX; … … 4247 4245 } 4248 4246 4249 /** Constructs a list of candidates for AMVP 4247 /** Constructs a list of candidates for AMVP (See specification, section "Derivation process for motion vector predictor candidates") 4250 4248 * \param uiPartIdx 4251 4249 * \param uiPartAddr … … 4254 4252 * \param pInfo 4255 4253 */ 4256 Void TComDataCU::fillMvpCand ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo ) 4257 { 4258 TComMv cMvPred; 4259 Bool bAddedSmvp = false; 4260 4254 Void TComDataCU::fillMvpCand ( const UInt partIdx, const UInt partAddr, const RefPicList eRefPicList, const Int refIdx, AMVPInfo* pInfo ) const 4255 { 4261 4256 pInfo->iN = 0; 4262 if ( iRefIdx < 0)4257 if (refIdx < 0) 4263 4258 { 4264 4259 return; … … 4266 4261 4267 4262 //-- Get Spatial MV 4268 UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB; 4269 const UInt numPartInCtuWidth = m_pcPic->getNumPartInCtuWidth(); 4270 const UInt numPartInCtuHeight = m_pcPic->getNumPartInCtuHeight(); 4271 Bool bAdded = false; 4272 4273 deriveLeftRightTopIdx( uiPartIdx, uiPartIdxLT, uiPartIdxRT ); 4274 deriveLeftBottomIdx( uiPartIdx, uiPartIdxLB ); 4275 4276 TComDataCU* tmpCU = NULL; 4277 UInt idx; 4278 tmpCU = getPUBelowLeft(idx, uiPartIdxLB); 4279 bAddedSmvp = (tmpCU != NULL) && (tmpCU->isInter(idx)); 4280 4281 if (!bAddedSmvp) 4282 { 4283 tmpCU = getPULeft(idx, uiPartIdxLB); 4284 bAddedSmvp = (tmpCU != NULL) && (tmpCU->isInter(idx)); 4263 UInt partIdxLT, partIdxRT, partIdxLB; 4264 deriveLeftRightTopIdx( partIdx, partIdxLT, partIdxRT ); 4265 deriveLeftBottomIdx( partIdx, partIdxLB ); 4266 4267 Bool isScaledFlagLX = false; /// variable name from specification; true when the PUs below left or left are available (availableA0 || availableA1). 4268 { 4269 UInt idx; 4270 const TComDataCU* tmpCU = getPUBelowLeft(idx, partIdxLB); 4271 isScaledFlagLX = (tmpCU != NULL) && (tmpCU->isInter(idx)); 4272 if (!isScaledFlagLX) 4273 { 4274 tmpCU = getPULeft(idx, partIdxLB); 4275 isScaledFlagLX = (tmpCU != NULL) && (tmpCU->isInter(idx)); 4276 } 4285 4277 } 4286 4278 4287 4279 // Left predictor search 4288 bAdded = xAddMVPCand( pInfo, eRefPicList, iRefIdx, uiPartIdxLB, MD_BELOW_LEFT); 4289 if (!bAdded) 4290 { 4291 bAdded = xAddMVPCand( pInfo, eRefPicList, iRefIdx, uiPartIdxLB, MD_LEFT ); 4292 } 4293 4294 if(!bAdded) 4295 { 4296 bAdded = xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxLB, MD_BELOW_LEFT); 4280 if (isScaledFlagLX) 4281 { 4282 Bool bAdded = xAddMVPCandUnscaled( *pInfo, eRefPicList, refIdx, partIdxLB, MD_BELOW_LEFT); 4297 4283 if (!bAdded) 4298 4284 { 4299 xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxLB, MD_LEFT ); 4285 bAdded = xAddMVPCandUnscaled( *pInfo, eRefPicList, refIdx, partIdxLB, MD_LEFT ); 4286 if(!bAdded) 4287 { 4288 bAdded = xAddMVPCandWithScaling( *pInfo, eRefPicList, refIdx, partIdxLB, MD_BELOW_LEFT); 4289 if (!bAdded) 4290 { 4291 xAddMVPCandWithScaling( *pInfo, eRefPicList, refIdx, partIdxLB, MD_LEFT ); 4292 } 4293 } 4300 4294 } 4301 4295 } 4302 4296 4303 4297 // Above predictor search 4304 bAdded = xAddMVPCand( pInfo, eRefPicList, iRefIdx, uiPartIdxRT, MD_ABOVE_RIGHT); 4305 4306 if (!bAdded) 4307 { 4308 bAdded = xAddMVPCand( pInfo, eRefPicList, iRefIdx, uiPartIdxRT, MD_ABOVE); 4309 } 4310 4311 if(!bAdded) 4312 { 4313 xAddMVPCand( pInfo, eRefPicList, iRefIdx, uiPartIdxLT, MD_ABOVE_LEFT); 4314 } 4315 4316 if(!bAddedSmvp) 4317 { 4318 bAdded = xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxRT, MD_ABOVE_RIGHT); 4298 { 4299 Bool bAdded = xAddMVPCandUnscaled( *pInfo, eRefPicList, refIdx, partIdxRT, MD_ABOVE_RIGHT); 4319 4300 if (!bAdded) 4320 4301 { 4321 bAdded = xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxRT, MD_ABOVE); 4322 } 4323 4324 if(!bAdded) 4325 { 4326 xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxLT, MD_ABOVE_LEFT); 4302 bAdded = xAddMVPCandUnscaled( *pInfo, eRefPicList, refIdx, partIdxRT, MD_ABOVE); 4303 if(!bAdded) 4304 { 4305 xAddMVPCandUnscaled( *pInfo, eRefPicList, refIdx, partIdxLT, MD_ABOVE_LEFT); 4306 } 4307 } 4308 } 4309 4310 if(!isScaledFlagLX) 4311 { 4312 Bool bAdded = xAddMVPCandWithScaling( *pInfo, eRefPicList, refIdx, partIdxRT, MD_ABOVE_RIGHT); 4313 if (!bAdded) 4314 { 4315 bAdded = xAddMVPCandWithScaling( *pInfo, eRefPicList, refIdx, partIdxRT, MD_ABOVE); 4316 if(!bAdded) 4317 { 4318 xAddMVPCandWithScaling( *pInfo, eRefPicList, refIdx, partIdxLT, MD_ABOVE_LEFT); 4319 } 4327 4320 } 4328 4321 } … … 4336 4329 } 4337 4330 4338 if ( getSlice()->getEnableTMVPFlag() )4331 if (pInfo->iN < AMVP_MAX_NUM_CANDS && getSlice()->getEnableTMVPFlag() ) 4339 4332 { 4340 4333 // Get Temporal Motion Predictor 4341 Int iRefIdx_Col = iRefIdx; 4334 const UInt numPartInCtuWidth = m_pcPic->getNumPartInCtuWidth(); 4335 const UInt numPartInCtuHeight = m_pcPic->getNumPartInCtuHeight(); 4336 #if NH_3D_TMVP 4337 Int refIdx_Col = refIdx; 4338 #else 4339 const Int refIdx_Col = refIdx; 4340 #endif 4342 4341 TComMv cColMv; 4343 UInt uiPartIdxRB; 4344 UInt uiAbsPartIdx; 4345 UInt uiAbsPartAddr; 4346 4347 deriveRightBottomIdx( uiPartIdx, uiPartIdxRB ); 4348 uiAbsPartAddr = m_absZIdxInCtu + uiPartAddr; 4342 UInt partIdxRB; 4343 UInt absPartIdx; 4344 4345 deriveRightBottomIdx( partIdx, partIdxRB ); 4346 UInt absPartAddr = m_absZIdxInCtu + partAddr; 4349 4347 4350 4348 //---- co-located RightBottom Temporal Predictor (H) ---// 4351 uiAbsPartIdx = g_auiZscanToRaster[uiPartIdxRB];4349 absPartIdx = g_auiZscanToRaster[partIdxRB]; 4352 4350 Int ctuRsAddr = -1; 4353 if ( ( ( m_pcPic->getCtu(m_ctuRsAddr)->getCUPelX() + g_auiRasterToPelX[ uiAbsPartIdx] + m_pcPic->getMinCUWidth () ) < m_pcSlice->getSPS()->getPicWidthInLumaSamples () ) // image boundary check4354 && ( ( m_pcPic->getCtu(m_ctuRsAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdx] + m_pcPic->getMinCUHeight() ) < m_pcSlice->getSPS()->getPicHeightInLumaSamples() ) )4355 { 4356 if ( ( uiAbsPartIdx % numPartInCtuWidth < numPartInCtuWidth - 1 ) && // is not at the last column of CTU4357 ( uiAbsPartIdx / numPartInCtuWidth < numPartInCtuHeight - 1 ) ) // is not at the last row of CTU4358 { 4359 uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdx + numPartInCtuWidth + 1 ];4351 if ( ( ( m_pcPic->getCtu(m_ctuRsAddr)->getCUPelX() + g_auiRasterToPelX[absPartIdx] + m_pcPic->getMinCUWidth () ) < m_pcSlice->getSPS()->getPicWidthInLumaSamples () ) // image boundary check 4352 && ( ( m_pcPic->getCtu(m_ctuRsAddr)->getCUPelY() + g_auiRasterToPelY[absPartIdx] + m_pcPic->getMinCUHeight() ) < m_pcSlice->getSPS()->getPicHeightInLumaSamples() ) ) 4353 { 4354 if ( ( absPartIdx % numPartInCtuWidth < numPartInCtuWidth - 1 ) && // is not at the last column of CTU 4355 ( absPartIdx / numPartInCtuWidth < numPartInCtuHeight - 1 ) ) // is not at the last row of CTU 4356 { 4357 absPartAddr = g_auiRasterToZscan[ absPartIdx + numPartInCtuWidth + 1 ]; 4360 4358 ctuRsAddr = getCtuRsAddr(); 4361 4359 } 4362 else if ( uiAbsPartIdx % numPartInCtuWidth < numPartInCtuWidth - 1 ) // is not at the last column of CTU But is last row of CTU4363 { 4364 uiAbsPartAddr = g_auiRasterToZscan[ (uiAbsPartIdx + numPartInCtuWidth + 1) % m_pcPic->getNumPartitionsInCtu() ];4365 } 4366 else if ( uiAbsPartIdx / numPartInCtuWidth < numPartInCtuHeight - 1 ) // is not at the last row of CTU But is last column of CTU4367 { 4368 uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdx + 1 ];4360 else if ( absPartIdx % numPartInCtuWidth < numPartInCtuWidth - 1 ) // is not at the last column of CTU But is last row of CTU 4361 { 4362 absPartAddr = g_auiRasterToZscan[ (absPartIdx + numPartInCtuWidth + 1) % m_pcPic->getNumPartitionsInCtu() ]; 4363 } 4364 else if ( absPartIdx / numPartInCtuWidth < numPartInCtuHeight - 1 ) // is not at the last row of CTU But is last column of CTU 4365 { 4366 absPartAddr = g_auiRasterToZscan[ absPartIdx + 1 ]; 4369 4367 ctuRsAddr = getCtuRsAddr() + 1; 4370 4368 } 4371 4369 else //is the right bottom corner of CTU 4372 4370 { 4373 uiAbsPartAddr = 0; 4374 } 4375 } 4376 if ( ctuRsAddr >= 0 && xGetColMVP( eRefPicList, ctuRsAddr, uiAbsPartAddr, cColMv, iRefIdx_Col 4371 absPartAddr = 0; 4372 } 4373 } 4377 4374 #if NH_3D_TMVP 4378 , 0 4379 #endif 4380 ) ) 4375 if ( ctuRsAddr >= 0 && xGetColMVP( eRefPicList, ctuRsAddr, absPartAddr, cColMv, refIdx_Col , 0 ) ) 4376 #else 4377 if ( ctuRsAddr >= 0 && xGetColMVP( eRefPicList, ctuRsAddr, absPartAddr, cColMv, refIdx_Col ) ) 4378 #endif 4381 4379 { 4382 4380 pInfo->m_acMvCand[pInfo->iN++] = cColMv; … … 4385 4383 { 4386 4384 UInt uiPartIdxCenter; 4387 xDeriveCenterIdx( uiPartIdx, uiPartIdxCenter ); 4388 if (xGetColMVP( eRefPicList, getCtuRsAddr(), uiPartIdxCenter, cColMv, iRefIdx_Col 4385 xDeriveCenterIdx( partIdx, uiPartIdxCenter ); 4389 4386 #if NH_3D_TMVP 4390 , 0 4391 #endif 4392 )) 4387 if (xGetColMVP( eRefPicList, getCtuRsAddr(), uiPartIdxCenter, cColMv, refIdx_Col , 0 )) 4388 #else 4389 if (xGetColMVP( eRefPicList, getCtuRsAddr(), uiPartIdxCenter, cColMv, refIdx_Col )) 4390 #endif 4393 4391 { 4394 4392 pInfo->m_acMvCand[pInfo->iN++] = cColMv; … … 4396 4394 } 4397 4395 //---- co-located RightBottom Temporal Predictor ---// 4398 }4399 4400 if (pInfo->iN > AMVP_MAX_NUM_CANDS)4401 {4402 pInfo->iN = AMVP_MAX_NUM_CANDS;4403 4396 } 4404 4397 … … 4412 4405 4413 4406 4414 Bool TComDataCU::isBipredRestriction(UInt puIdx) 4407 Bool TComDataCU::isBipredRestriction(UInt puIdx) const 4415 4408 { 4416 4409 Int width = 0; … … 4434 4427 4435 4428 4436 Void TComDataCU::clipMv (TComMv& rcMv) 4429 Void TComDataCU::clipMv (TComMv& rcMv) const 4437 4430 { 4438 4431 const TComSPS &sps=*(m_pcSlice->getSPS()); … … 4470 4463 #endif 4471 4464 4472 UInt TComDataCU::getIntraSizeIdx(UInt uiAbsPartIdx) 4465 UInt TComDataCU::getIntraSizeIdx(UInt uiAbsPartIdx) const 4473 4466 { 4474 4467 UInt uiShift = ( m_pePartSize[uiAbsPartIdx]==SIZE_NxN ? 1 : 0 ); … … 4507 4500 * \returns true if the current the block is skipped 4508 4501 */ 4509 Bool TComDataCU::isSkipped( UInt uiPartIdx ) 4502 Bool TComDataCU::isSkipped( UInt uiPartIdx ) const 4510 4503 { 4511 4504 return ( getSkipFlag( uiPartIdx ) ); … … 4516 4509 // ==================================================================================================================== 4517 4510 4518 Bool TComDataCU::xAddMVPCand ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir )4519 { 4520 TComDataCU* pcTmpCU = NULL;4521 UInt uiIdx;4511 Bool TComDataCU::xAddMVPCandUnscaled( AMVPInfo &info, const RefPicList eRefPicList, const Int iRefIdx, const UInt uiPartUnitIdx, const MVP_DIR eDir ) const 4512 { 4513 const TComDataCU* neibCU = NULL; 4514 UInt neibPUPartIdx; 4522 4515 switch( eDir ) 4523 4516 { 4524 4517 case MD_LEFT: 4525 4518 { 4526 pcTmpCU = getPULeft(uiIdx, uiPartUnitIdx);4519 neibCU = getPULeft(neibPUPartIdx, uiPartUnitIdx); 4527 4520 break; 4528 4521 } 4529 4522 case MD_ABOVE: 4530 4523 { 4531 pcTmpCU = getPUAbove(uiIdx, uiPartUnitIdx);4524 neibCU = getPUAbove(neibPUPartIdx, uiPartUnitIdx); 4532 4525 break; 4533 4526 } 4534 4527 case MD_ABOVE_RIGHT: 4535 4528 { 4536 pcTmpCU = getPUAboveRight(uiIdx, uiPartUnitIdx);4529 neibCU = getPUAboveRight(neibPUPartIdx, uiPartUnitIdx); 4537 4530 break; 4538 4531 } 4539 4532 case MD_BELOW_LEFT: 4540 4533 { 4541 pcTmpCU = getPUBelowLeft(uiIdx, uiPartUnitIdx);4534 neibCU = getPUBelowLeft(neibPUPartIdx, uiPartUnitIdx); 4542 4535 break; 4543 4536 } 4544 4537 case MD_ABOVE_LEFT: 4545 4538 { 4546 pcTmpCU = getPUAboveLeft(uiIdx, uiPartUnitIdx);4539 neibCU = getPUAboveLeft(neibPUPartIdx, uiPartUnitIdx); 4547 4540 break; 4548 4541 } … … 4553 4546 } 4554 4547 4555 if ( pcTmpCU == NULL )4548 if ( neibCU == NULL ) 4556 4549 { 4557 4550 return false; 4558 4551 } 4559 4552 4560 if ( pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) >= 0 && m_pcSlice->getRefPic( eRefPicList, iRefIdx)->getPOC() == pcTmpCU->getSlice()->getRefPOC( eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) )) 4561 { 4562 TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx); 4563 4564 pInfo->m_acMvCand[ pInfo->iN++] = cMvPred; 4565 return true; 4566 } 4567 4568 RefPicList eRefPicList2nd = REF_PIC_LIST_0; 4569 if( eRefPicList == REF_PIC_LIST_0 ) 4570 { 4571 eRefPicList2nd = REF_PIC_LIST_1; 4572 } 4573 else if ( eRefPicList == REF_PIC_LIST_1) 4574 { 4575 eRefPicList2nd = REF_PIC_LIST_0; 4576 } 4577 4578 4579 Int iCurrRefPOC = m_pcSlice->getRefPic( eRefPicList, iRefIdx)->getPOC(); 4580 Int iNeibRefPOC; 4581 4582 4583 if( pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) >= 0 ) 4584 { 4585 iNeibRefPOC = pcTmpCU->getSlice()->getRefPOC( eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) ); 4586 if( iNeibRefPOC == iCurrRefPOC ) // Same Reference Frame But Diff List// 4587 { 4588 TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList2nd)->getMv(uiIdx); 4589 pInfo->m_acMvCand[ pInfo->iN++] = cMvPred; 4553 const Int currRefPOC = m_pcSlice->getRefPic( eRefPicList, iRefIdx)->getPOC(); 4554 const RefPicList eRefPicList2nd = (eRefPicList == REF_PIC_LIST_0) ? REF_PIC_LIST_1 : REF_PIC_LIST_0; 4555 4556 for(Int predictorSource=0; predictorSource<2; predictorSource++) // examine the indicated reference picture list, then if not available, examine the other list. 4557 { 4558 const RefPicList eRefPicListIndex = (predictorSource==0) ? eRefPicList : eRefPicList2nd; 4559 const Int neibRefIdx = neibCU->getCUMvField(eRefPicListIndex)->getRefIdx(neibPUPartIdx); 4560 4561 if ( neibRefIdx >= 0 && currRefPOC == neibCU->getSlice()->getRefPOC( eRefPicListIndex, neibRefIdx )) 4562 { 4563 info.m_acMvCand[info.iN++] = neibCU->getCUMvField(eRefPicListIndex)->getMv(neibPUPartIdx); 4590 4564 return true; 4591 4565 } … … 4602 4576 * \returns Bool 4603 4577 */ 4604 Bool TComDataCU::xAddMVPCand Order( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir )4605 { 4606 TComDataCU* pcTmpCU = NULL;4607 UInt uiIdx;4578 Bool TComDataCU::xAddMVPCandWithScaling( AMVPInfo &info, const RefPicList eRefPicList, const Int iRefIdx, const UInt uiPartUnitIdx, const MVP_DIR eDir ) const 4579 { 4580 const TComDataCU* neibCU = NULL; 4581 UInt neibPUPartIdx; 4608 4582 switch( eDir ) 4609 4583 { 4610 4584 case MD_LEFT: 4611 4585 { 4612 pcTmpCU = getPULeft(uiIdx, uiPartUnitIdx);4586 neibCU = getPULeft(neibPUPartIdx, uiPartUnitIdx); 4613 4587 break; 4614 4588 } 4615 4589 case MD_ABOVE: 4616 4590 { 4617 pcTmpCU = getPUAbove(uiIdx, uiPartUnitIdx);4591 neibCU = getPUAbove(neibPUPartIdx, uiPartUnitIdx); 4618 4592 break; 4619 4593 } 4620 4594 case MD_ABOVE_RIGHT: 4621 4595 { 4622 pcTmpCU = getPUAboveRight(uiIdx, uiPartUnitIdx);4596 neibCU = getPUAboveRight(neibPUPartIdx, uiPartUnitIdx); 4623 4597 break; 4624 4598 } 4625 4599 case MD_BELOW_LEFT: 4626 4600 { 4627 pcTmpCU = getPUBelowLeft(uiIdx, uiPartUnitIdx);4601 neibCU = getPUBelowLeft(neibPUPartIdx, uiPartUnitIdx); 4628 4602 break; 4629 4603 } 4630 4604 case MD_ABOVE_LEFT: 4631 4605 { 4632 pcTmpCU = getPUAboveLeft(uiIdx, uiPartUnitIdx);4606 neibCU = getPUAboveLeft(neibPUPartIdx, uiPartUnitIdx); 4633 4607 break; 4634 4608 } … … 4639 4613 } 4640 4614 4641 if ( pcTmpCU == NULL )4615 if ( neibCU == NULL ) 4642 4616 { 4643 4617 return false; 4644 4618 } 4645 4619 4646 RefPicList eRefPicList2nd = REF_PIC_LIST_0; 4647 if( eRefPicList == REF_PIC_LIST_0 ) 4648 { 4649 eRefPicList2nd = REF_PIC_LIST_1; 4650 } 4651 else if ( eRefPicList == REF_PIC_LIST_1) 4652 { 4653 eRefPicList2nd = REF_PIC_LIST_0; 4654 } 4655 4656 Int iCurrPOC = m_pcSlice->getPOC(); 4657 Int iCurrRefPOC = m_pcSlice->getRefPic( eRefPicList, iRefIdx)->getPOC(); 4658 Int iNeibPOC = iCurrPOC; 4659 Int iNeibRefPOC; 4660 Bool bIsCurrRefLongTerm = m_pcSlice->getRefPic( eRefPicList, iRefIdx)->getIsLongTerm(); 4661 Bool bIsNeibRefLongTerm = false; 4662 4663 //--------------- V1 (END) ------------------// 4664 if( pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) >= 0) 4665 { 4666 iNeibRefPOC = pcTmpCU->getSlice()->getRefPOC( eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ); 4667 TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx); 4668 TComMv rcMv; 4669 4670 bIsNeibRefLongTerm = pcTmpCU->getSlice()->getRefPic( eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) )->getIsLongTerm(); 4671 if ( bIsCurrRefLongTerm == bIsNeibRefLongTerm ) 4672 { 4673 if ( bIsCurrRefLongTerm || bIsNeibRefLongTerm ) 4674 { 4675 rcMv = cMvPred; 4676 } 4677 else 4678 { 4679 Int iScale = xGetDistScaleFactor( iCurrPOC, iCurrRefPOC, iNeibPOC, iNeibRefPOC ); 4680 if ( iScale == 4096 ) 4620 const RefPicList eRefPicList2nd = (eRefPicList == REF_PIC_LIST_0) ? REF_PIC_LIST_1 : REF_PIC_LIST_0; 4621 4622 const Int currPOC = m_pcSlice->getPOC(); 4623 const Int currRefPOC = m_pcSlice->getRefPic( eRefPicList, iRefIdx)->getPOC(); 4624 const Bool bIsCurrRefLongTerm = m_pcSlice->getRefPic( eRefPicList, iRefIdx)->getIsLongTerm(); 4625 const Int neibPOC = currPOC; 4626 4627 for(Int predictorSource=0; predictorSource<2; predictorSource++) // examine the indicated reference picture list, then if not available, examine the other list. 4628 { 4629 const RefPicList eRefPicListIndex = (predictorSource==0) ? eRefPicList : eRefPicList2nd; 4630 const Int neibRefIdx = neibCU->getCUMvField(eRefPicListIndex)->getRefIdx(neibPUPartIdx); 4631 if( neibRefIdx >= 0) 4632 { 4633 const Bool bIsNeibRefLongTerm = neibCU->getSlice()->getRefPic( eRefPicListIndex, neibRefIdx )->getIsLongTerm(); 4634 4635 if ( bIsCurrRefLongTerm == bIsNeibRefLongTerm ) 4636 { 4637 const TComMv &cMvPred = neibCU->getCUMvField(eRefPicListIndex)->getMv(neibPUPartIdx); 4638 TComMv rcMv; 4639 if ( bIsCurrRefLongTerm /* || bIsNeibRefLongTerm*/ ) 4681 4640 { 4682 4641 rcMv = cMvPred; … … 4684 4643 else 4685 4644 { 4686 rcMv = cMvPred.scaleMv( iScale ); 4645 const Int neibRefPOC = neibCU->getSlice()->getRefPOC( eRefPicListIndex, neibRefIdx ); 4646 const Int scale = xGetDistScaleFactor( currPOC, currRefPOC, neibPOC, neibRefPOC ); 4647 if ( scale == 4096 ) 4648 { 4649 rcMv = cMvPred; 4650 } 4651 else 4652 { 4653 rcMv = cMvPred.scaleMv( scale ); 4654 } 4687 4655 } 4688 } 4689 4690 pInfo->m_acMvCand[ pInfo->iN++] = rcMv; 4691 return true; 4692 } 4693 } 4694 //---------------------- V2(END) --------------------// 4695 if( pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) >= 0) 4696 { 4697 iNeibRefPOC = pcTmpCU->getSlice()->getRefPOC( eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) ); 4698 TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList2nd)->getMv(uiIdx); 4699 TComMv rcMv; 4700 4701 bIsNeibRefLongTerm = pcTmpCU->getSlice()->getRefPic( eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) )->getIsLongTerm(); 4702 if ( bIsCurrRefLongTerm == bIsNeibRefLongTerm ) 4703 { 4704 if ( bIsCurrRefLongTerm || bIsNeibRefLongTerm ) 4705 { 4706 rcMv = cMvPred; 4707 } 4708 else 4709 { 4710 Int iScale = xGetDistScaleFactor( iCurrPOC, iCurrRefPOC, iNeibPOC, iNeibRefPOC ); 4711 if ( iScale == 4096 ) 4712 { 4713 rcMv = cMvPred; 4714 } 4715 else 4716 { 4717 rcMv = cMvPred.scaleMv( iScale ); 4718 } 4719 } 4720 4721 pInfo->m_acMvCand[ pInfo->iN++] = rcMv; 4722 return true; 4723 } 4724 } 4725 //---------------------- V3(END) --------------------// 4656 4657 info.m_acMvCand[info.iN++] = rcMv; 4658 return true; 4659 } 4660 } 4661 } 4726 4662 return false; 4727 4663 } 4728 4664 4729 Bool TComDataCU::xGetColMVP( RefPicList eRefPicList, Int ctuRsAddr, Int uiPartUnitIdx, TComMv& rcMv, Int& riRefIdx4730 4665 #if NH_3D_TMVP 4731 , Bool bMRG 4732 #endif 4733 ) 4734 { 4735 UInt uiAbsPartAddr = uiPartUnitIdx; 4736 4737 RefPicList eColRefPicList; 4738 Int iColPOC, iColRefPOC, iCurrPOC, iCurrRefPOC, iScale; 4739 TComMv cColMv; 4666 Bool TComDataCU::xGetColMVP( const RefPicList eRefPicList, const Int ctuRsAddr, const Int partUnitIdx, TComMv& rcMv, Int& refIdx, Bool bMRG ) const 4667 #else 4668 Bool TComDataCU::xGetColMVP( const RefPicList eRefPicList, const Int ctuRsAddr, const Int partUnitIdx, TComMv& rcMv, const Int refIdx ) const 4669 #endif 4670 { 4671 const UInt absPartAddr = partUnitIdx; 4740 4672 4741 4673 // use coldir. 4742 TComPic *pColPic = getSlice()->getRefPic( RefPicList(getSlice()->isInterB() ? 1-getSlice()->getColFromL0Flag() : 0), getSlice()->getColRefIdx());4743 TComDataCU *pColCtu = pColPic->getCtu( ctuRsAddr );4744 if(pColCtu->getPic()==0 ||pColCtu->getPartitionSize(uiPartUnitIdx)==NUMBER_OF_PART_SIZES)4674 const TComPic * const pColPic = getSlice()->getRefPic( RefPicList(getSlice()->isInterB() ? 1-getSlice()->getColFromL0Flag() : 0), getSlice()->getColRefIdx()); 4675 const TComDataCU * const pColCtu = pColPic->getCtu( ctuRsAddr ); 4676 if(pColCtu->getPic()==0 || pColCtu->getPartitionSize(partUnitIdx)==NUMBER_OF_PART_SIZES) 4745 4677 { 4746 4678 return false; 4747 4679 } 4748 iCurrPOC = m_pcSlice->getPOC(); 4749 iColPOC = pColCtu->getSlice()->getPOC(); 4750 4751 if (!pColCtu->isInter(uiAbsPartAddr)) 4680 4681 if (!pColCtu->isInter(absPartAddr)) 4752 4682 { 4753 4683 return false; 4754 4684 } 4755 4685 4756 eColRefPicList = getSlice()->getCheckLDC() ? eRefPicList : RefPicList(getSlice()->getColFromL0Flag()); 4757 4758 Int iColRefIdx = pColCtu->getCUMvField(RefPicList(eColRefPicList))->getRefIdx(uiAbsPartAddr); 4686 RefPicList eColRefPicList = getSlice()->getCheckLDC() ? eRefPicList : RefPicList(getSlice()->getColFromL0Flag()); 4687 Int iColRefIdx = pColCtu->getCUMvField(RefPicList(eColRefPicList))->getRefIdx(absPartAddr); 4759 4688 4760 4689 if (iColRefIdx < 0 ) 4761 4690 { 4762 4691 eColRefPicList = RefPicList(1 - eColRefPicList); 4763 iColRefIdx = pColCtu->getCUMvField(RefPicList(eColRefPicList))->getRefIdx( uiAbsPartAddr);4692 iColRefIdx = pColCtu->getCUMvField(RefPicList(eColRefPicList))->getRefIdx(absPartAddr); 4764 4693 4765 4694 if (iColRefIdx < 0 ) … … 4769 4698 } 4770 4699 4771 // Scale the vector. 4772 iColRefPOC = pColCtu->getSlice()->getRefPOC(eColRefPicList, iColRefIdx); 4773 cColMv = pColCtu->getCUMvField(eColRefPicList)->getMv(uiAbsPartAddr); 4774 4775 iCurrRefPOC = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getPOC(); 4776 4777 Bool bIsCurrRefLongTerm = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getIsLongTerm(); 4778 Bool bIsColRefLongTerm = pColCtu->getSlice()->getIsUsedAsLongTerm(eColRefPicList, iColRefIdx); 4700 #if NH_3D_TMVP 4701 Bool bIsCurrRefLongTerm = m_pcSlice->getRefPic(eRefPicList, refIdx)->getIsLongTerm(); 4702 #else 4703 const Bool bIsCurrRefLongTerm = m_pcSlice->getRefPic(eRefPicList, refIdx)->getIsLongTerm(); 4704 #endif 4705 const Bool bIsColRefLongTerm = pColCtu->getSlice()->getIsUsedAsLongTerm(eColRefPicList, iColRefIdx); 4779 4706 4780 4707 if ( bIsCurrRefLongTerm != bIsColRefLongTerm ) … … 4784 4711 if(bMRG && iAlterRefIdx > 0) 4785 4712 { 4786 riRefIdx = iAlterRefIdx; 4787 bIsCurrRefLongTerm = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getIsLongTerm(); 4788 iCurrRefPOC = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getPOC(); 4713 refIdx = iAlterRefIdx; 4714 bIsCurrRefLongTerm = m_pcSlice->getRefPic(eRefPicList, refIdx)->getIsLongTerm(); 4789 4715 assert(bIsCurrRefLongTerm == bIsColRefLongTerm); 4790 4716 } … … 4792 4718 { 4793 4719 #endif 4794 return false;4720 return false; 4795 4721 #if NH_3D_TMVP 4796 4722 } 4797 4723 #endif 4798 4724 } 4799 4725 // Scale the vector. 4726 const TComMv &cColMv = pColCtu->getCUMvField(eColRefPicList)->getMv(absPartAddr); 4727 4728 #if NH_3D_TMVP 4800 4729 if ( bIsCurrRefLongTerm || bIsColRefLongTerm ) 4730 #else 4731 if ( bIsCurrRefLongTerm /*|| bIsColRefLongTerm*/ ) 4732 #endif 4801 4733 { 4802 4734 #if NH_3D_TMVP 4803 Int iCurrViewId = m_pcSlice->getViewId ();4804 Int iCurrRefViewId = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getViewId ();4805 Int iColViewId = pColCtu->getSlice()->getViewId();4806 Int iColRefViewId = pColCtu->getSlice()->getRefPic( eColRefPicList, pColCtu->getCUMvField(eColRefPicList)->getRefIdx(uiAbsPartAddr))->getViewId();4807 iScale = 4096;4735 const Int iCurrViewId = m_pcSlice->getViewId (); 4736 const Int iCurrRefViewId = m_pcSlice->getRefPic(eRefPicList, refIdx)->getViewId (); 4737 const Int iColViewId = pColCtu->getSlice()->getViewId(); 4738 const Int iColRefViewId = pColCtu->getSlice()->getRefPic( eColRefPicList, pColCtu->getCUMvField(eColRefPicList)->getRefIdx(absPartAddr))->getViewId(); 4739 Int scale = 4096; 4808 4740 if ( iCurrRefViewId != iCurrViewId && iColViewId != iColRefViewId ) 4809 4741 { 4810 iScale = xGetDistScaleFactor( iCurrViewId, iCurrRefViewId, iColViewId, iColRefViewId );4811 } 4812 if ( bMRG && iScale != 4096 && m_pcSlice->getIvMvScalingFlag( ) )4813 { 4814 rcMv = cColMv.scaleMv( iScale );4742 scale = xGetDistScaleFactor( iCurrViewId, iCurrRefViewId, iColViewId, iColRefViewId ); 4743 } 4744 if ( bMRG && scale != 4096 && m_pcSlice->getIvMvScalingFlag( ) ) 4745 { 4746 rcMv = cColMv.scaleMv( scale ); 4815 4747 } 4816 4748 else 4817 4749 { 4818 4750 #endif 4819 rcMv = cColMv;4751 rcMv = cColMv; 4820 4752 #if NH_3D_TMVP 4821 4753 } … … 4824 4756 else 4825 4757 { 4826 iScale = xGetDistScaleFactor(iCurrPOC, iCurrRefPOC, iColPOC, iColRefPOC); 4827 if ( iScale == 4096 ) 4758 const Int currPOC = m_pcSlice->getPOC(); 4759 const Int colPOC = pColCtu->getSlice()->getPOC(); 4760 const Int colRefPOC = pColCtu->getSlice()->getRefPOC(eColRefPicList, iColRefIdx); 4761 const Int currRefPOC = m_pcSlice->getRefPic(eRefPicList, refIdx)->getPOC(); 4762 const Int scale = xGetDistScaleFactor(currPOC, currRefPOC, colPOC, colRefPOC); 4763 if ( scale == 4096 ) 4828 4764 { 4829 4765 rcMv = cColMv; … … 4831 4767 else 4832 4768 { 4833 rcMv = cColMv.scaleMv( iScale );4769 rcMv = cColMv.scaleMv( scale ); 4834 4770 } 4835 4771 } … … 4838 4774 } 4839 4775 4776 // Static member 4840 4777 Int TComDataCU::xGetDistScaleFactor(Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC) 4841 4778 { … … 4857 4794 } 4858 4795 4859 Void TComDataCU::xDeriveCenterIdx( UInt uiPartIdx, UInt& ruiPartIdxCenter ) 4796 Void TComDataCU::xDeriveCenterIdx( UInt uiPartIdx, UInt& ruiPartIdxCenter ) const 4860 4797 { 4861 4798 UInt uiPartAddr; … … 5001 4938 5002 4939 UInt uiMidPart, uiPartNeighbor; 5003 TComDataCU* pcCUNeighbor;4940 const TComDataCU* pcCUNeighbor; 5004 4941 Bool bDepAvail = false; 5005 4942 Pel *pDepth = this->getPic()->getPicYuvRec()->getAddr(COMPONENT_Y); … … 5133 5070 #if NH_3D_NBDV_REF 5134 5071 TComPic* picDepth = NULL; 5135 #if H_3D_FCO _VSP_DONBDV_E01635072 #if H_3D_FCO 5136 5073 picDepth = getSlice()->getIvPic(true, getSlice()->getViewIndex() ); 5137 5074 if ( picDepth->getPicYuvRec() != NULL ) … … 5161 5098 UInt uiIdx = 0; 5162 5099 Bool bCheckMcpDv = false; 5163 TComDataCU* pcTmpCU = NULL;5100 const TComDataCU* pcTmpCU = NULL; 5164 5101 5165 5102 //// ******* Get disparity from left block ******* ///// 5103 #if NH_3D_FIX_TICKET_91 5104 pcTmpCU = getPULeft(uiIdx, uiPartIdxLB); 5105 #else 5166 5106 pcTmpCU = getPULeft(uiIdx, uiPartIdxLB, true, false); 5107 #endif 5167 5108 bCheckMcpDv = true; 5168 5109 if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, pDInfo, bCheckMcpDv, &cIDVInfo, DVFROM_LEFT … … 5199 5140 pDInfo->m_aVIdxCan = cIDVInfo.m_aVIdxCan[iList][ curPos ]; 5200 5141 #if NH_3D_NBDV_REF 5201 #if H_3D_FCO _VSP_DONBDV_E01635142 #if H_3D_FCO 5202 5143 TComPic* picDepth = NULL; 5203 5144 … … 5238 5179 #if NH_3D_NBDV_REF 5239 5180 TComPic* picDepth = NULL; 5240 #if H_3D_FCO _VSP_DONBDV_E01635181 #if H_3D_FCO 5241 5182 picDepth = getSlice()->getIvPic(true, getSlice()->getViewIndex() ); 5242 5183 if ( picDepth->getPicYuvRec() != NULL ) … … 5307 5248 5308 5249 5309 Bool TComDataCU::xCheckSpatialNBDV( TComDataCU* pcTmpCU, UInt uiIdx, DisInfo* pNbDvInfo, Bool bSearchForMvpDv, IDVInfo* paIDVInfo, UInt uiMvpDvPos5250 Bool TComDataCU::xCheckSpatialNBDV( const TComDataCU* pcTmpCU, UInt uiIdx, DisInfo* pNbDvInfo, Bool bSearchForMvpDv, IDVInfo* paIDVInfo, UInt uiMvpDvPos 5310 5251 #if NH_3D_NBDV_REF 5311 5252 , Bool bDepthRefine … … 5332 5273 TComPic* picDepth = NULL; 5333 5274 assert(getSlice()->getRefPic(eRefPicList, refId)->getPOC() == getSlice()->getPOC()); 5334 #if H_3D_FCO _VSP_DONBDV_E01635275 #if H_3D_FCO 5335 5276 picDepth = getSlice()->getIvPic(true, getSlice()->getViewIndex() ); 5336 5277 if ( picDepth->getPicYuvRec() != NULL ) … … 5466 5407 } 5467 5408 5468 #if NH_3D_FIX_NBDV_COL5469 5409 // The picture pColCU->getSlice()->getRefPic(eColRefPicList, iColRefIdx) might not be in DPB anymore 5470 5410 // So don't access it directly. 5471 5411 iColRefViewIdx = pColCU->getSlice()->getVPS()->getViewOrderIdx( pColCU->getSlice()->getRefLayerId( eColRefPicList, iColRefIdx ) ); 5472 #else5473 iColRefViewIdx = pColCU->getSlice()->getRefPic(eColRefPicList, iColRefIdx)->getViewIndex();5474 #endif5475 5412 5476 5413 … … 6065 6002 Int depthRefViewIdx = pcCU->getDvInfo(partAddr).m_aVIdxCan; 6066 6003 6067 #if H_3D_FCO _VSP_DONBDV_E01636004 #if H_3D_FCO 6068 6005 TComPic* pRefPicBaseDepth = 0; 6069 6006 Bool bIsCurrDepthCoded = false; … … 6100 6037 pcCU->clipMv(cDv); 6101 6038 6102 #if H_3D_FCO _VSP_DONBDV_E01636039 #if H_3D_FCO 6103 6040 if ( bIsCurrDepthCoded ) 6104 6041 {
Note: See TracChangeset for help on using the changeset viewer.