Changeset 20 in SHVCSoftware for trunk/source
- Timestamp:
- 29 Jan 2013, 20:08:56 (12 years ago)
- Location:
- trunk/source/Lib
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/Lib/TLibCommon/TComPic.cpp
r6 r20 68 68 , m_bSpatialEnhLayer( false ) 69 69 , m_pcFullPelBaseRec( NULL ) 70 #if REF_IDX_ME_AROUND_ZEROMV 70 #if REF_IDX_ME_AROUND_ZEROMV || ENCODER_FAST_MODE 71 71 , m_bIsILR (false) 72 72 #endif -
trunk/source/Lib/TLibCommon/TComPic.h
r6 r20 88 88 Bool m_bSpatialEnhLayer; // whether current layer is a spatial enhancement layer, 89 89 TComPicYuv* m_pcFullPelBaseRec; // upsampled base layer recontruction for difference domain inter prediction 90 #if REF_IDX_ME_AROUND_ZEROMV 90 #if REF_IDX_ME_AROUND_ZEROMV || ENCODER_FAST_MODE 91 91 Bool m_bIsILR; // Is ILR picture 92 92 #endif … … 118 118 TComPicYuv* getFullPelBaseRec () { return m_pcFullPelBaseRec; } 119 119 #endif 120 #if REF_IDX_ME_AROUND_ZEROMV 120 #if REF_IDX_ME_AROUND_ZEROMV || ENCODER_FAST_MODE 121 121 Void setIsILR( Bool bIsILR) {m_bIsILR = bIsILR;} 122 122 Bool getIsILR() {return m_bIsILR;} -
trunk/source/Lib/TLibCommon/TypeDef.h
r19 r20 58 58 #if REF_IDX_FRAMEWORK 59 59 #define REF_IDX_ME_AROUND_ZEROMV 0 ///< added ME around zero MV for inter-layer reference picture 60 #define ENCODER_FAST_MODE 1 ///< L0174: enable encoder fast mode. TestMethod 1 is enabled by setting to 1 and TestMethod 2 is enable by setting to 2. By default it is set to 1. 60 61 #else 61 62 #define INTRA_BL 1 ///< inter-layer texture prediction -
trunk/source/Lib/TLibEncoder/TEncCu.cpp
r17 r20 471 471 if(!bSliceEnd && !bSliceStart && bInsidePicture ) 472 472 { 473 #if (ENCODER_FAST_MODE) 474 bool testInter = true; 475 if (rpcBestCU->getLayerId() > 0) 476 { 477 if (rpcBestCU->getSlice()->getBaseColPic()->getSlice(0)->getSliceType() == I_SLICE) 478 { 479 testInter = false; 480 } 481 482 } 483 #endif 473 484 for (Int iQP=iMinQP; iQP<=iMaxQP; iQP++) 474 485 { … … 485 496 486 497 // do inter modes, SKIP and 2Nx2N 498 #if (ENCODER_FAST_MODE == 1) 499 if( rpcBestCU->getSlice()->getSliceType() != I_SLICE && testInter ) 500 #else 487 501 if( rpcBestCU->getSlice()->getSliceType() != I_SLICE ) 502 #endif 488 503 { 489 504 // 2Nx2N … … 506 521 } 507 522 } 523 #if (ENCODER_FAST_MODE == 2) 524 if (testInter) 525 { 526 #endif 508 527 509 528 if(!m_pcEncCfg->getUseEarlySkipDetection()) … … 519 538 } 520 539 } 540 #if (ENCODER_FAST_MODE == 2) 541 } 542 #endif 521 543 522 544 } … … 550 572 551 573 // do inter modes, NxN, 2NxN, and Nx2N 574 #if (ENCODER_FAST_MODE) 575 if( rpcBestCU->getSlice()->getSliceType() != I_SLICE && testInter ) 576 #else 552 577 if( rpcBestCU->getSlice()->getSliceType() != I_SLICE ) 578 #endif 553 579 { 554 580 // 2Nx2N, NxN … … 709 735 { 710 736 // speedup for inter frames 737 #if (ENCODER_FAST_MODE) 711 738 if( rpcBestCU->getSlice()->getSliceType() == I_SLICE || 739 !testInter || 712 740 rpcBestCU->getCbf( 0, TEXT_LUMA ) != 0 || 713 741 rpcBestCU->getCbf( 0, TEXT_CHROMA_U ) != 0 || 714 742 rpcBestCU->getCbf( 0, TEXT_CHROMA_V ) != 0 ) // avoid very complex intra if it is unlikely 743 #else 744 if( rpcBestCU->getSlice()->getSliceType() == I_SLICE || 745 rpcBestCU->getCbf( 0, TEXT_LUMA ) != 0 || 746 rpcBestCU->getCbf( 0, TEXT_CHROMA_U ) != 0 || 747 rpcBestCU->getCbf( 0, TEXT_CHROMA_V ) != 0 ) // avoid very complex intra if it is unlikely 748 #endif 715 749 { 716 750 xCheckRDCostIntra( rpcBestCU, rpcTempCU, SIZE_2Nx2N ); … … 747 781 } 748 782 #endif 783 784 #if (ENCODER_FAST_MODE) 785 if(pcPic->getLayerId() > 0) 786 { 787 xCheckRDCostILRUni( rpcBestCU, rpcTempCU); 788 rpcTempCU->initEstData( uiDepth, iQP ); 789 } 790 #endif 791 749 792 if (isAddLowestQP && (iQP == lowestQP)) 750 793 { … … 1308 1351 for( UInt uiMergeCand = 0; uiMergeCand < numValidMergeCand; ++uiMergeCand ) 1309 1352 { 1310 {1311 1353 if(!(uiNoResidual==1 && mergeCandBuffer[uiMergeCand]==1)) 1312 1354 { … … 1361 1403 } 1362 1404 } 1363 }1364 1405 1365 1406 if(uiNoResidual == 0 && m_pcEncCfg->getUseEarlySkipDetection()) … … 1434 1475 xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth); 1435 1476 } 1436 1477 #if (ENCODER_FAST_MODE) 1478 Void TEncCu::xCheckRDCostILRUni(TComDataCU *&rpcBestCU, TComDataCU *&rpcTempCU) 1479 { 1480 UChar uhDepth = rpcTempCU->getDepth( 0 ); 1481 1482 rpcTempCU->setDepthSubParts( uhDepth, 0 ); 1483 1484 #if SKIP_FLAG 1485 rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth ); 1486 #endif 1487 1488 rpcTempCU->setPartSizeSubParts ( SIZE_2Nx2N, 0, uhDepth ); //2Nx2N 1489 rpcTempCU->setPredModeSubParts ( MODE_INTER, 0, uhDepth ); 1490 rpcTempCU->setCUTransquantBypassSubParts ( m_pcEncCfg->getCUTransquantBypassFlagValue(), 0, uhDepth ); 1491 1492 Bool exitILR = m_pcPredSearch->predInterSearchILRUni( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth] ); 1493 1494 if(!exitILR) 1495 return; 1496 1497 m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcResiYuvBest[uhDepth], m_ppcRecoYuvTemp[uhDepth], false ); 1498 1499 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 1500 1501 xCheckDQP( rpcTempCU ); 1502 xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth); 1503 1504 return; 1505 } 1506 #endif 1437 1507 Void TEncCu::xCheckRDCostIntra( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize eSize ) 1438 1508 { -
trunk/source/Lib/TLibEncoder/TEncCu.h
r2 r20 150 150 Void xCheckRDCostIntraBL ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU ); 151 151 #endif 152 #if ENCODER_FAST_MODE 153 Void xCheckRDCostILRUni ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU ); 154 #endif 152 155 153 156 Void xCheckBestMode ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU ); -
trunk/source/Lib/TLibEncoder/TEncSearch.cpp
r19 r20 3211 3211 for( UInt uiMergeCand = 0; uiMergeCand < numValidMergeCand; ++uiMergeCand ) 3212 3212 { 3213 {3214 3213 UInt uiCostCand = MAX_UINT; 3215 3214 UInt uiBitsCand = 0; … … 3236 3235 } 3237 3236 } 3238 }3239 3237 } 3240 3238 … … 3360 3358 UInt uiBitsTempL0[MAX_NUM_REF]; 3361 3359 3360 #if (ENCODER_FAST_MODE) 3361 Bool testILR; 3362 #endif 3363 3362 3364 xGetBlkBits( ePartSize, pcCU->getSlice()->isInterP(), iPartIdx, uiLastMode, uiMbBits); 3363 3365 … … 3381 3383 RefPicList eRefPicList = ( iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); 3382 3384 3385 #if (ENCODER_FAST_MODE) 3386 if (pcCU->getSlice()->getNumRefIdx(eRefPicList) > 1) 3387 { 3388 testILR = false; 3389 } 3390 else 3391 { 3392 testILR = true; 3393 } 3394 #endif 3395 3383 3396 for ( Int iRefIdxTemp = 0; iRefIdxTemp < pcCU->getSlice()->getNumRefIdx(eRefPicList); iRefIdxTemp++ ) 3384 3397 { 3398 #if (ENCODER_FAST_MODE) 3399 TComPic* pcPic = pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxTemp ); 3400 if( !testILR && pcPic->getIsILR() && (ePartSize == SIZE_2Nx2N) ) 3401 { 3402 continue; 3403 } 3404 #endif 3405 3385 3406 uiBitsTemp = uiMbBits[iRefList]; 3386 3407 if ( pcCU->getSlice()->getNumRefIdx(eRefPicList) > 1 ) … … 3613 3634 Bool bChanged = false; 3614 3635 3636 #if (ENCODER_FAST_MODE) 3637 Bool testIter = true; 3638 TComPic* pcPic = pcCU->getSlice()->getRefPic( RefPicList(1 - iRefList), iRefIdxBi[1 - iRefList] ); 3639 if(pcPic->getIsILR() && (ePartSize == SIZE_2Nx2N)) 3640 testIter = false; //the fixed part is ILR, skip this iteration 3641 if(testIter) 3642 { 3643 #endif 3615 3644 iRefStart = 0; 3616 3645 iRefEnd = pcCU->getSlice()->getNumRefIdx(eRefPicList)-1; … … 3618 3647 for ( Int iRefIdxTemp = iRefStart; iRefIdxTemp <= iRefEnd; iRefIdxTemp++ ) 3619 3648 { 3649 #if (ENCODER_FAST_MODE) 3650 Bool testRefIdx = true; 3651 pcPic = pcCU->getSlice()->getRefPic( RefPicList(iRefList) , iRefIdxTemp ); 3652 if(pcPic->getIsILR() && (ePartSize == SIZE_2Nx2N)) 3653 testRefIdx = false; //the refined part is ILR, skip this reference pic 3654 if(testRefIdx) 3655 { 3656 #endif 3620 3657 uiBitsTemp = uiMbBits[2] + uiMotBits[1-iRefList]; 3621 3658 if ( pcCU->getSlice()->getNumRefIdx(eRefPicList) > 1 ) … … 3658 3695 } 3659 3696 } 3697 #if (ENCODER_FAST_MODE) 3698 } 3699 #endif 3700 } 3701 #if (ENCODER_FAST_MODE) 3660 3702 } // for loop-iRefIdxTemp 3703 #endif 3661 3704 3662 3705 if ( !bChanged ) … … 3942 3985 return; 3943 3986 } 3987 #if ENCODER_FAST_MODE 3988 Bool TEncSearch::predInterSearchILRUni( TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv*& rpcPredYuv, TComYuv*& rpcResiYuv, TComYuv*& rpcRecoYuv ) 3989 { 3990 rpcPredYuv->clear(); 3991 rpcRecoYuv->clear(); 3992 3993 Int iNumPredDir = pcCU->getSlice()->isInterP() ? 1 : 2; 3994 3995 TComMv cMv[2]; 3996 TComMv cMvPred[2][33]; 3997 TComMv cMvTemp[2][33]; 3998 TComMv TempMv; 3999 4000 Int iRefIdx[2]={0,0}; 4001 4002 Int aaiMvpIdx[2][33]; 4003 Int aaiMvpNum[2][33]; 4004 4005 UInt uiMbBits[3] = {1, 1, 0}; 4006 UInt uiLastMode = 0; 4007 4008 UInt uiCost[2] = { MAX_UINT, MAX_UINT }; //uni, rdCost 4009 UInt uiCostTemp; 4010 UInt biPDistTemp = MAX_INT; 4011 UInt uiBitsTemp; 4012 4013 PartSize ePartSize = pcCU->getPartitionSize( 0 ); //2Nx2N 4014 Int iPartIdx = 0; //one PU in CU 4015 UInt uiPartAddr; 4016 Int iRoiWidth, iRoiHeight; 4017 4018 xGetBlkBits( ePartSize, pcCU->getSlice()->isInterP(), iPartIdx, uiLastMode, uiMbBits); 4019 pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iRoiWidth, iRoiHeight ); 4020 4021 for( Int iRefList = 0; iRefList < iNumPredDir; iRefList++) //list 4022 { 4023 RefPicList eRefPicList = ( iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); 4024 4025 Int iRefIdxTemp = -1; 4026 Bool foundILR = false; 4027 for( Int refIdx = 0; refIdx < pcCU->getSlice()->getNumRefIdx(eRefPicList); refIdx++ ) 4028 if( pcCU->getSlice()->getRefPic(eRefPicList, refIdx)->getIsILR() ) 4029 { 4030 iRefIdxTemp = refIdx; 4031 foundILR = true; 4032 break; 4033 } 4034 4035 if(!foundILR) //no ILR in eRefPiclist 4036 continue; 4037 4038 uiBitsTemp = uiMbBits[iRefList]; 4039 if ( pcCU->getSlice()->getNumRefIdx(eRefPicList) > 1 ) 4040 { 4041 uiBitsTemp += iRefIdxTemp+1; 4042 if ( iRefIdxTemp == pcCU->getSlice()->getNumRefIdx(eRefPicList)-1 ) uiBitsTemp--; 4043 } 4044 4045 xEstimateMvPredAMVP( pcCU, pcOrgYuv, iPartIdx, eRefPicList, iRefIdxTemp, cMvPred[iRefList][iRefIdxTemp], false, &biPDistTemp); 4046 aaiMvpIdx[iRefList][iRefIdxTemp] = pcCU->getMVPIdx(eRefPicList, uiPartAddr); 4047 aaiMvpNum[iRefList][iRefIdxTemp] = pcCU->getMVPNum(eRefPicList, uiPartAddr); 4048 4049 uiBitsTemp += m_auiMVPIdxCost[aaiMvpIdx[iRefList][iRefIdxTemp]][AMVP_MAX_NUM_CANDS]; 4050 4051 xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp ); 4052 xCheckBestMVP(pcCU, eRefPicList, cMvTemp[iRefList][iRefIdxTemp], cMvPred[iRefList][iRefIdxTemp], aaiMvpIdx[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp); 4053 4054 if( uiCostTemp < uiCost[iRefList] ) 4055 { 4056 uiCost[iRefList] = uiCostTemp; 4057 4058 cMv[iRefList] = cMvTemp[iRefList][iRefIdxTemp]; 4059 iRefIdx[iRefList] = iRefIdxTemp; 4060 4061 pcCU->getCUMvField(eRefPicList)->setAllMv( cMv[iRefList], ePartSize, uiPartAddr, 0, iPartIdx ); 4062 pcCU->getCUMvField(eRefPicList)->setAllRefIdx( iRefIdx[iRefList], ePartSize, uiPartAddr, 0, iPartIdx ); 4063 } 4064 } 4065 4066 if( uiCost[0] == MAX_UINT && uiCost[1] == MAX_UINT ) //no ILR in both list0 and list1 4067 return false; 4068 4069 // Clear Motion Field 4070 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvField( TComMvField(), ePartSize, uiPartAddr, 0, iPartIdx ); 4071 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvField( TComMvField(), ePartSize, uiPartAddr, 0, iPartIdx ); 4072 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvd ( TComMv(), ePartSize, uiPartAddr, 0, iPartIdx ); 4073 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvd ( TComMv(), ePartSize, uiPartAddr, 0, iPartIdx ); 4074 4075 pcCU->setMVPIdxSubParts( -1, REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4076 pcCU->setMVPNumSubParts( -1, REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4077 pcCU->setMVPIdxSubParts( -1, REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4078 pcCU->setMVPNumSubParts( -1, REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4079 4080 if( uiCost[0] <= uiCost[1] ) //list0 ILR 4081 { 4082 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMv ( cMv[0], ePartSize, uiPartAddr, 0, iPartIdx ); 4083 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllRefIdx( iRefIdx[0], ePartSize, uiPartAddr, 0, iPartIdx ); 4084 4085 TempMv = cMv[0] - cMvPred[0][iRefIdx[0]]; 4086 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvd( TempMv, ePartSize, uiPartAddr, 0, iPartIdx ); 4087 4088 pcCU->setInterDirSubParts( 1, uiPartAddr, iPartIdx, pcCU->getDepth(0) ); 4089 4090 pcCU->setMVPIdxSubParts( aaiMvpIdx[0][iRefIdx[0]], REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4091 pcCU->setMVPNumSubParts( aaiMvpNum[0][iRefIdx[0]], REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4092 } 4093 else if( uiCost[1] < uiCost[0] ) //list1 ILR 4094 { 4095 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMv ( cMv[1], ePartSize, uiPartAddr, 0, iPartIdx ); 4096 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllRefIdx( iRefIdx[1], ePartSize, uiPartAddr, 0, iPartIdx ); 4097 4098 TempMv = cMv[1] - cMvPred[1][iRefIdx[1]]; 4099 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvd( TempMv, ePartSize, uiPartAddr, 0, iPartIdx ); 4100 4101 pcCU->setInterDirSubParts( 2, uiPartAddr, iPartIdx, pcCU->getDepth(0) ); 4102 4103 pcCU->setMVPIdxSubParts( aaiMvpIdx[1][iRefIdx[1]], REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4104 pcCU->setMVPNumSubParts( aaiMvpNum[1][iRefIdx[1]], REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4105 } 4106 else 4107 assert(0); 4108 4109 pcCU->setMergeFlagSubParts( false, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 4110 4111 motionCompensation ( pcCU, rpcPredYuv, REF_PIC_LIST_X, iPartIdx ); 4112 4113 setWpScalingDistParam( pcCU, -1, REF_PIC_LIST_X ); 4114 4115 return true; 4116 } 4117 4118 4119 #endif 3944 4120 3945 4121 // AMVP -
trunk/source/Lib/TLibEncoder/TEncSearch.h
r2 r20 215 215 ); 216 216 217 #if (ENCODER_FAST_MODE) 218 Bool predInterSearchILRUni ( TComDataCU* pcCU, 219 TComYuv* pcOrgYuv, 220 TComYuv*& rpcPredYuv, 221 TComYuv*& rpcResiYuv, 222 TComYuv*& rpcRecoYuv 223 ); 224 225 #endif 226 217 227 /// encode residual and compute rd-cost for inter mode 218 228 Void encodeResAndCalcRdInterCU( TComDataCU* pcCU, -
trunk/source/Lib/TLibEncoder/TEncTop.cpp
r6 r20 394 394 m_cIlpPic[j]->create(m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, true); 395 395 #endif 396 #if REF_IDX_ME_AROUND_ZEROMV 396 #if REF_IDX_ME_AROUND_ZEROMV || ENCODER_FAST_MODE 397 397 m_cIlpPic[j]->setIsILR(true); 398 398 #endif
Note: See TracChangeset for help on using the changeset viewer.