Changeset 716 in 3DVCSoftware for branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibCommon/TComDataCU.cpp
- Timestamp:
- 28 Nov 2013, 10:04:37 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibCommon/TComDataCU.cpp
r712 r716 146 146 m_piVSPFlag = NULL; 147 147 #endif 148 #if MTK_SPIVMP_F0110 149 m_pbSPIVMPFlag = NULL; 150 #endif 148 151 #if H_3D_ARP 149 152 m_puhARPW = NULL; … … 196 199 #if H_3D_VSP 197 200 m_piVSPFlag = (Char* )xMalloc(Char, uiNumPartition); 201 #endif 202 #if MTK_SPIVMP_F0110 203 m_pbSPIVMPFlag = (Bool* )xMalloc(Bool, uiNumPartition); 198 204 #endif 199 205 m_puhLumaIntraDir = (UChar* )xMalloc(UChar, uiNumPartition); … … 356 362 if ( m_piVSPFlag ) { xFree(m_piVSPFlag); m_piVSPFlag = NULL; } 357 363 #endif 364 #if MTK_SPIVMP_F0110 365 if ( m_pbSPIVMPFlag ) { xFree(m_pbSPIVMPFlag); m_pbSPIVMPFlag = NULL; } 366 #endif 358 367 if ( m_puhLumaIntraDir ) { xFree(m_puhLumaIntraDir); m_puhLumaIntraDir = NULL; } 359 368 if ( m_puhChromaIntraDir ) { xFree(m_puhChromaIntraDir); m_puhChromaIntraDir = NULL; } … … 561 570 #if H_3D_VSP 562 571 m_piVSPFlag[ui] = pcFrom->m_piVSPFlag[ui]; 572 #endif 573 #if MTK_SPIVMP_F0110 574 m_pbSPIVMPFlag[ui] = pcFrom->m_pbSPIVMPFlag[ui]; 563 575 #endif 564 576 m_puhLumaIntraDir[ui]=pcFrom->m_puhLumaIntraDir[ui]; … … 603 615 #if H_3D_VSP 604 616 memset( m_piVSPFlag + firstElement, 0, numElements * sizeof( *m_piVSPFlag ) ); 617 #endif 618 #if MTK_SPIVMP_F0110 619 memset( m_pbSPIVMPFlag + firstElement, 0, numElements * sizeof( *m_pbSPIVMPFlag ) ); 605 620 #endif 606 621 memset( m_puhLumaIntraDir + firstElement, DC_IDX, numElements * sizeof( *m_puhLumaIntraDir ) ); … … 784 799 m_piVSPFlag[ui] = 0; 785 800 #endif 801 #if MTK_SPIVMP_F0110 802 m_pbSPIVMPFlag[ui] = 0; 803 #endif 786 804 m_puhLumaIntraDir[ui] = DC_IDX; 787 805 m_puhChromaIntraDir[ui] = 0; … … 883 901 #if H_3D_VSP 884 902 memset( m_piVSPFlag, 0, sizeof( Char ) * m_uiNumPartition ); 903 #endif 904 #if MTK_SPIVMP_F0110 905 memset( m_pbSPIVMPFlag, 0, sizeof( Bool ) * m_uiNumPartition ); 885 906 #endif 886 907 memset( m_puhLumaIntraDir, DC_IDX, iSizeInUchar ); … … 980 1001 m_pDvInfo[ ui ] = pcCU->m_pDvInfo[uiPartOffset+ui]; 981 1002 #endif 1003 #if MTK_SPIVMP_F0110 1004 m_pbSPIVMPFlag[ui]=pcCU->m_pbSPIVMPFlag[uiPartOffset+ui]; 1005 #endif 982 1006 m_puhLumaIntraDir[ui]=pcCU->m_puhLumaIntraDir[uiPartOffset+ui]; 983 1007 m_puhChromaIntraDir[ui]=pcCU->m_puhChromaIntraDir[uiPartOffset+ui]; … … 1130 1154 m_piVSPFlag = pcCU->getVSPFlag() + uiPart; 1131 1155 #endif 1156 #if MTK_SPIVMP_F0110 1157 m_pbSPIVMPFlag = pcCU->getSPIVMPFlag() + uiPart; 1158 #endif 1132 1159 1133 1160 #if H_3D_ARP … … 1285 1312 m_piVSPFlag = pcCU->getVSPFlag() + uiAbsPartIdx; 1286 1313 m_pDvInfo = pcCU->getDvInfo() + uiAbsPartIdx; 1314 #endif 1315 #if MTK_SPIVMP_F0110 1316 m_pbSPIVMPFlag = pcCU->getSPIVMPFlag() + uiAbsPartIdx; 1287 1317 #endif 1288 1318 … … 1335 1365 1336 1366 #endif 1367 #if MTK_SPIVMP_F0110 1368 memcpy( m_pbSPIVMPFlag + uiOffset, pcCU->getSPIVMPFlag(), sizeof( Bool ) * uiNumPartition ); 1369 #endif 1337 1370 memcpy( m_puhLumaIntraDir + uiOffset, pcCU->getLumaIntraDir(), iSizeInUchar ); 1338 1371 memcpy( m_puhChromaIntraDir + uiOffset, pcCU->getChromaIntraDir(), iSizeInUchar ); … … 1464 1497 memcpy( rpcCU->getDvInfo() + m_uiAbsIdxInLCU, m_pDvInfo, sizeof( *m_pDvInfo ) * m_uiNumPartition ); 1465 1498 #endif 1499 #if MTK_SPIVMP_F0110 1500 memcpy( rpcCU->getSPIVMPFlag() + m_uiAbsIdxInLCU, m_pbSPIVMPFlag, sizeof( Bool ) * m_uiNumPartition ); 1501 #endif 1466 1502 memcpy( rpcCU->getLumaIntraDir() + m_uiAbsIdxInLCU, m_puhLumaIntraDir, iSizeInUchar ); 1467 1503 memcpy( rpcCU->getChromaIntraDir() + m_uiAbsIdxInLCU, m_puhChromaIntraDir, iSizeInUchar ); … … 1579 1615 #if H_3D_VSP 1580 1616 memcpy( rpcCU->getVSPFlag() + uiPartOffset, m_piVSPFlag, sizeof(Char) * uiQNumPart ); 1617 #endif 1618 #if MTK_SPIVMP_F0110 1619 memcpy( rpcCU->getSPIVMPFlag() + uiPartOffset, m_pbSPIVMPFlag, sizeof(Bool) * uiQNumPart ); 1581 1620 #endif 1582 1621 memcpy( rpcCU->getLumaIntraDir() + uiPartOffset, m_puhLumaIntraDir, iSizeInUchar ); … … 2705 2744 setSubPart<UChar>( uiMergeIndex, m_puhMergeIndex, uiAbsPartIdx, uiDepth, uiPartIdx ); 2706 2745 } 2746 2747 #if MTK_SPIVMP_F0110 2748 Void TComDataCU::setSPIVMPFlagSubParts( Bool bSPIVMPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) 2749 { 2750 setSubPart<Bool>( bSPIVMPFlag, m_pbSPIVMPFlag, uiAbsPartIdx, uiDepth, uiPartIdx ); 2751 } 2752 #endif 2707 2753 2708 2754 #if H_3D_VSP … … 3962 4008 , InheritedVSPDisInfo* inheritedVSPDisInfo 3963 4009 #endif 4010 #if MTK_SPIVMP_F0110 4011 , Bool* pbSPIVMPFlag, TComMvField* pcMvFieldSP, UChar* puhInterDirSP 4012 #endif 3964 4013 , Int& numValidMergeCand, Int mrgCandIdx 3965 4014 ) … … 4030 4079 #if QC_DEPTH_IV_MRG_F0125 4031 4080 Bool bIsDepth = getSlice()->getIsDepth(); 4081 #if !BUGFIX_F0093 4032 4082 Bool bDepthIPMCAvai = false; 4083 #endif 4033 4084 #endif 4034 4085 … … 4433 4484 , bIsDepth 4434 4485 #endif 4486 #if MTK_SPIVMP_F0110 4487 , pcMvFieldSP, puhInterDirSP 4488 #endif 4435 4489 ); 4436 4490 } … … 4459 4513 Int iCnloop=0; 4460 4514 4461 for(Int i = 0; i < 2; i ++) 4462 { 4463 iCnloop = iPosLeftAbove[i]; 4464 if ( iCnloop == -1 ) 4465 { 4466 continue; 4467 } 4468 if(ivCandDir[0] == puhInterDirNeighbours[iCnloop] && tmpMV[0]==pcMvFieldNeighbours[(iCnloop<<1)] && tmpMV[1]==pcMvFieldNeighbours[(iCnloop<<1)+1]) 4469 { 4470 bRemoveSpa = true; 4471 break; 4472 } 4473 } 4515 #if BUGFIX_F0093 4516 if (!bIsDepth) 4517 { 4518 #endif 4519 for(Int i = 0; i < 2; i ++) 4520 { 4521 iCnloop = iPosLeftAbove[i]; 4522 if ( iCnloop == -1 ) 4523 { 4524 continue; 4525 } 4526 if(ivCandDir[0] == puhInterDirNeighbours[iCnloop] && tmpMV[0]==pcMvFieldNeighbours[(iCnloop<<1)] && tmpMV[1]==pcMvFieldNeighbours[(iCnloop<<1)+1]) 4527 { 4528 bRemoveSpa = true; 4529 break; 4530 } 4531 } 4532 #if BUGFIX_F0093 4533 } 4534 #endif 4474 4535 #if QC_DEPTH_IV_MRG_F0125 4536 #if BUGFIX_F0093 4537 if (bIsDepth) 4538 #else 4475 4539 if ( bIsDepth && !bRemoveSpa) 4540 #endif 4476 4541 { 4477 4542 iCnloop = iCount-1; 4478 4543 for(; iCnloop >= 0; iCnloop --) 4479 4544 { 4545 #if BUGFIX_F0093 4546 if(ivCandDir[0] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==tmpMV[0] && pcMvFieldNeighbours[(iCnloop<<1)+1]==tmpMV[1]) // F0125 compatible with F0093 4547 #else 4480 4548 if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1]) 4549 #endif 4481 4550 { 4482 4551 bRemoveSpa = true; … … 4484 4553 } 4485 4554 } 4555 #if !BUGFIX_F0093 4486 4556 if(!bRemoveSpa) 4487 4557 { 4488 4558 bDepthIPMCAvai = true; 4489 4559 } 4560 #endif 4490 4561 } 4491 4562 #endif … … 4545 4616 if (bIvMC) 4546 4617 { 4618 #if MTK_SPIVMP_F0110 4619 pbSPIVMPFlag[iCount] = true; 4620 #endif 4547 4621 if( ( ivCandDir[0] & 1 ) == 1 ) 4548 4622 { … … 4556 4630 puhInterDirNeighbours[ iCount ] = ivCandDir[0]; 4557 4631 4632 #if !BUGFIX_F0093 4558 4633 #if QC_DEPTH_IV_MRG_F0125 4559 4634 if ( bDepthIPMCAvai || !bIsDepth ) 4560 4635 { 4561 4636 #endif 4562 if ( mrgCandIdx == iCount ) 4563 { 4564 return; 4565 } 4566 iCount ++; 4637 #endif 4638 if ( mrgCandIdx == iCount ) 4639 { 4640 return; 4641 } 4642 iCount ++; 4643 #if !BUGFIX_F0093 4567 4644 #if QC_DEPTH_IV_MRG_F0125 4568 4645 } 4646 #endif 4569 4647 #endif 4570 4648 } … … 8112 8190 } 8113 8191 #endif 8192 8193 #if MTK_SPIVMP_F0110 8194 Void TComDataCU::getSPPara(Int iPUWidth, Int iPUHeight, Int& iNumSP, Int& iNumSPInOneLine, Int& iSPWidth, Int& iSPHeight) 8195 { 8196 Int iSubPUSize = 1<<getSlice()->getVPS()->getSubPULog2Size(getSlice()->getLayerId()); 8197 iNumSPInOneLine = iPUWidth/iSubPUSize; 8198 iNumSPInOneLine = iNumSPInOneLine < 1 ? 1: iNumSPInOneLine; 8199 Int iNumSPInOneColumn = iPUHeight/iSubPUSize; 8200 iNumSPInOneColumn = iNumSPInOneColumn < 1 ? 1: iNumSPInOneColumn; 8201 iNumSP = iNumSPInOneLine * iNumSPInOneColumn; 8202 8203 iSPWidth = iNumSPInOneLine == 1 ? iPUWidth: iSubPUSize; 8204 iSPHeight = iNumSPInOneColumn == 1 ? iPUHeight: iSubPUSize; 8205 } 8206 8207 Void TComDataCU::getSPAbsPartIdx(UInt uiBaseAbsPartIdx, Int iWidth, Int iHeight, Int iPartIdx, Int iNumPartLine, UInt& ruiPartAddr ) 8208 { 8209 uiBaseAbsPartIdx += m_uiAbsIdxInLCU; 8210 Int iBasePelX = g_auiRasterToPelX[g_auiZscanToRaster[uiBaseAbsPartIdx]]; 8211 Int iBasePelY = g_auiRasterToPelY[g_auiZscanToRaster[uiBaseAbsPartIdx]]; 8212 Int iCurrPelX = iBasePelX + iPartIdx%iNumPartLine * iWidth; 8213 Int iCurrPelY = iBasePelY + iPartIdx/iNumPartLine * iHeight; 8214 Int iCurrRaster = iCurrPelY / getPic()->getMinCUHeight() * getPic()->getNumPartInWidth() + iCurrPelX/getPic()->getMinCUWidth(); 8215 ruiPartAddr = g_auiRasterToZscan[iCurrRaster]; 8216 ruiPartAddr -= m_uiAbsIdxInLCU; 8217 } 8218 8219 Void TComDataCU::setInterDirSP( UInt uiDir, UInt uiAbsPartIdx, Int iWidth, Int iHeight ) 8220 { 8221 uiAbsPartIdx += getZorderIdxInCU(); 8222 Int iStartPelX = g_auiRasterToPelX[g_auiZscanToRaster[uiAbsPartIdx]]; 8223 Int iStartPelY = g_auiRasterToPelY[g_auiZscanToRaster[uiAbsPartIdx]]; 8224 Int iEndPelX = iStartPelX + iWidth; 8225 Int iEndPelY = iStartPelY + iHeight; 8226 8227 Int iCurrRaster, uiPartAddr; 8228 8229 for (Int i=iStartPelY; i<iEndPelY; i+=getPic()->getMinCUHeight()) 8230 { 8231 for (Int j=iStartPelX; j < iEndPelX; j += getPic()->getMinCUWidth()) 8232 { 8233 iCurrRaster = i / getPic()->getMinCUHeight() * getPic()->getNumPartInWidth() + j/getPic()->getMinCUWidth(); 8234 uiPartAddr = g_auiRasterToZscan[iCurrRaster]; 8235 uiPartAddr -= getZorderIdxInCU(); 8236 8237 m_puhInterDir[uiPartAddr] = uiDir; 8238 } 8239 } 8240 } 8241 #endif 8242 8114 8243 #if H_3D_IV_MERGE 8115 8244 Bool … … 8118 8247 , Bool bIsDepth 8119 8248 #endif 8249 #if MTK_SPIVMP_F0110 8250 , TComMvField* pcMvFieldSP, UChar* puhInterDirSP 8251 #endif 8120 8252 ) 8121 8253 { … … 8139 8271 pcBaseRec->getTopLeftSamplePos( getAddr(), getZorderIdxInCU() + uiPartAddr, iCurrPosX, iCurrPosY ); 8140 8272 8273 #if !MTK_SPIVMP_F0110 8141 8274 #if QC_DEPTH_IV_MRG_F0125 8142 8275 iCurrPosX += ( iWidth >> 1 ); … … 8146 8279 iCurrPosY += ( ( iHeight - 1 ) >> 1 ); 8147 8280 #endif 8281 #endif 8148 8282 8149 8283 Bool depthRefineFlag = false; … … 8162 8296 #endif 8163 8297 8298 #if MTK_SPIVMP_F0110 8299 //////////////////////////////// 8300 //////////sub-PU IvMC/////////// 8301 //////////////////////////////// 8302 8303 Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight; 8304 getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight); 8305 8306 for (Int i=0; i<iNumSP; i++) 8307 { 8308 puhInterDirSP[i] = 0; 8309 pcMvFieldSP[2*i].getMv().set(0, 0); 8310 pcMvFieldSP[2*i+1].getMv().set(0,0); 8311 pcMvFieldSP[2*i].setRefIdx(-1); 8312 pcMvFieldSP[2*i+1].setRefIdx(-1); 8313 } 8314 8315 Int iBaseCUAddr; 8316 Int iBaseAbsPartIdx; 8317 TComDataCU* pcBaseCU; 8318 Int iPartition = 0; 8319 Int iInterDirLast = 0; 8320 TComMvField cMvFieldLast[2]; 8321 8322 Int iDelX = iSPWidth/2; 8323 Int iDelY = iSPHeight/2; 8324 8325 Int iBasePosX, iBasePosY; 8326 for (Int i=iCurrPosY; i < iCurrPosY + iHeight; i += iSPHeight) 8327 { 8328 for (Int j = iCurrPosX; j < iCurrPosX + iWidth; j += iSPWidth) 8329 { 8330 iBasePosX = Clip3( 0, pcBaseRec->getWidth () - 1, j + iDelX + ( (cDv.getHor() + 2 ) >> 2 )); 8331 iBasePosY = Clip3( 0, pcBaseRec->getHeight() - 1, i + iDelY + ( (cDv.getVer() + 2 ) >> 2 )); 8332 8333 pcBaseRec->getCUAddrAndPartIdx( iBasePosX , iBasePosY, iBaseCUAddr, iBaseAbsPartIdx ); 8334 pcBaseCU = pcBasePic->getCU( iBaseCUAddr ); 8335 if(!( pcBaseCU->getPredictionMode( iBaseAbsPartIdx ) == MODE_INTRA )) 8336 { 8337 for( UInt uiCurrRefListId = 0; uiCurrRefListId < 2; uiCurrRefListId++ ) 8338 { 8339 RefPicList eCurrRefPicList = RefPicList( uiCurrRefListId ); 8340 Bool bLoop_stop = false; 8341 for(Int iLoop = 0; iLoop < 2 && !bLoop_stop; ++iLoop) 8342 { 8343 RefPicList eBaseRefPicList = (iLoop ==1)? RefPicList( 1 - uiCurrRefListId ) : RefPicList( uiCurrRefListId ); 8344 TComMvField cBaseMvField; 8345 pcBaseCU->getMvField( pcBaseCU, iBaseAbsPartIdx, eBaseRefPicList, cBaseMvField ); 8346 Int iBaseRefIdx = cBaseMvField.getRefIdx(); 8347 if (iBaseRefIdx >= 0) 8348 { 8349 Int iBaseRefPOC = pcBaseCU->getSlice()->getRefPOC(eBaseRefPicList, iBaseRefIdx); 8350 if (iBaseRefPOC != pcSlice->getPOC()) 8351 { 8352 for (Int iPdmRefIdx = 0; iPdmRefIdx < pcSlice->getNumRefIdx( eCurrRefPicList ); iPdmRefIdx++) 8353 { 8354 if (iBaseRefPOC == pcSlice->getRefPOC(eCurrRefPicList, iPdmRefIdx)) 8355 { 8356 abPdmAvailable[ uiCurrRefListId ] = true; 8357 TComMv cMv(cBaseMvField.getHor(), cBaseMvField.getVer()); 8358 8359 if( !bIsDepth ) 8360 { 8361 cMv.setIDVFlag (true); 8362 cMv.setIDVHor (cDv.getHor()); 8363 cMv.setIDVVer (cDv.getVer()); 8364 cMv.setIDVVId (iViewIndex); 8365 } 8366 8367 clipMv( cMv ); 8368 bLoop_stop = true; 8369 8370 pcMvFieldSP[2*iPartition + uiCurrRefListId].setMvField(cMv, iPdmRefIdx); 8371 break; 8372 } 8373 } 8374 } 8375 } 8376 } 8377 } 8378 } 8379 8380 puhInterDirSP[iPartition] = (pcMvFieldSP[2*iPartition].getRefIdx()!=-1 ? 1: 0) + (pcMvFieldSP[2*iPartition+1].getRefIdx()!=-1 ? 2: 0); 8381 if (puhInterDirSP[iPartition] == 0) 8382 { 8383 if (iInterDirLast != 0) 8384 { 8385 puhInterDirSP[iPartition] = iInterDirLast; 8386 pcMvFieldSP[2*iPartition] = cMvFieldLast[0]; 8387 pcMvFieldSP[2*iPartition + 1] = cMvFieldLast[1]; 8388 } 8389 } 8390 else 8391 { 8392 if (iInterDirLast ==0) 8393 { 8394 availableMcDc[0] = puhInterDirSP[iPartition]; 8395 paiPdmRefIdx [ 0 ] = pcMvFieldSP[2*iPartition].getRefIdx(); 8396 pacPdmMv [ 0 ] = pcMvFieldSP[2*iPartition].getMv(); 8397 paiPdmRefIdx [ 1 ] = pcMvFieldSP[2*iPartition+1].getRefIdx(); 8398 pacPdmMv [ 1 ] = pcMvFieldSP[2*iPartition+1].getMv(); 8399 8400 if (iPartition != 0) 8401 { 8402 for (Int iPart = iPartition-1; iPart >= 0; iPart--) 8403 { 8404 puhInterDirSP[iPart] = puhInterDirSP[iPartition]; 8405 pcMvFieldSP[2*iPart] = pcMvFieldSP[2*iPartition]; 8406 pcMvFieldSP[2*iPart + 1] = pcMvFieldSP[2*iPartition + 1]; 8407 } 8408 } 8409 } 8410 iInterDirLast = puhInterDirSP[iPartition]; 8411 cMvFieldLast[0] = pcMvFieldSP[2*iPartition]; 8412 cMvFieldLast[1] = pcMvFieldSP[2*iPartition + 1]; 8413 } 8414 8415 iPartition ++; 8416 8417 } 8418 } 8419 8420 iCurrPosX += ( iWidth >> 1 ); 8421 iCurrPosY += ( iHeight >> 1 ); 8422 #endif 8423 8164 8424 //////////////////////////////// 8165 8425 /////// IvMC + IvMCShift /////// 8166 8426 //////////////////////////////// 8167 8427 8168 for(Int iLoopCan = 0; iLoopCan < 2; iLoopCan ++) 8428 #if MTK_SPIVMP_F0110 8429 for(Int iLoopCan = 1; iLoopCan < 2; iLoopCan ++) 8430 #else 8431 for(Int iLoopCan = 0; iLoopCan < 2; iLoopCan ++) 8432 #endif 8169 8433 { 8170 8434 // iLoopCan == 0 --> IvMC … … 8234 8498 } 8235 8499 } 8500 #if MTK_SPIVMP_F0110 8501 for(Int iLoopCan = 1; iLoopCan < 2; iLoopCan ++) 8502 #else 8236 8503 for(Int iLoopCan = 0; iLoopCan < 2; iLoopCan ++) 8504 #endif 8237 8505 { 8238 8506 availableMcDc[(iLoopCan << 1)] = ( abPdmAvailable[(iLoopCan<<2)] ? 1 : 0 ) + ( abPdmAvailable[1 + (iLoopCan<<2)] ? 2 : 0);
Note: See TracChangeset for help on using the changeset viewer.