Changeset 133 in SHVCSoftware for branches/SHM-2.0-dev/source/Lib/TLibEncoder/TEncSearch.cpp
- Timestamp:
- 28 Apr 2013, 08:49:16 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-2.0-dev/source/Lib/TLibEncoder/TEncSearch.cpp
r125 r133 3249 3249 UInt uiBitsTempL0[MAX_NUM_REF]; 3250 3250 3251 #if L0034_COMBINED_LIST_CLEANUP 3252 TComMv mvValidList1; 3253 Int refIdxValidList1 = 0; 3254 UInt bitsValidList1 = MAX_UINT; 3255 UInt costValidList1 = MAX_UINT; 3256 #endif 3257 3251 3258 #if (ENCODER_FAST_MODE) 3252 3259 Bool testILR; … … 3326 3333 uiBitsTemp += m_auiMVPIdxCost[aaiMvpIdx[iRefList][iRefIdxTemp]][AMVP_MAX_NUM_CANDS]; 3327 3334 #if ZERO_MVD_EST 3335 #if L0034_COMBINED_LIST_CLEANUP 3336 if ( iRefList == 0 || pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp ) < 0 ) 3337 #else 3328 3338 if ((iRefList != 1 || !pcCU->getSlice()->getNoBackPredFlag()) && 3329 3339 (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) <= 0 || pcCU->getSlice()->getRefIdxOfLC(eRefPicList, iRefIdxTemp)>=0)) 3340 #endif 3330 3341 { 3331 3342 uiZeroMvdBitsTemp = uiBitsTemp; … … 3347 3358 3348 3359 #if GPB_SIMPLE_UNI 3360 #if L0034_COMBINED_LIST_CLEANUP 3361 if ( iRefList == 1 ) // list 1 3362 { 3363 if ( pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp ) >= 0 ) 3364 { 3365 cMvTemp[1][iRefIdxTemp] = cMvTemp[0][pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp )]; 3366 uiCostTemp = uiCostTempL0[pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp )]; 3367 /*first subtract the bit-rate part of the cost of the other list*/ 3368 uiCostTemp -= m_pcRdCost->getCost( uiBitsTempL0[pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp )] ); 3369 /*correct the bit-rate part of the current ref*/ 3370 m_pcRdCost->setPredictor ( cMvPred[iRefList][iRefIdxTemp] ); 3371 uiBitsTemp += m_pcRdCost->getBits( cMvTemp[1][iRefIdxTemp].getHor(), cMvTemp[1][iRefIdxTemp].getVer() ); 3372 /*calculate the correct cost*/ 3373 uiCostTemp += m_pcRdCost->getCost( uiBitsTemp ); 3374 } 3375 else 3376 { 3377 xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp ); 3378 } 3379 } 3380 else 3381 { 3382 xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp ); 3383 } 3384 #else 3349 3385 if ( pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0) 3350 3386 { … … 3388 3424 } 3389 3425 } 3426 #endif 3390 3427 #else 3391 3428 xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp ); … … 3394 3431 xCheckBestMVP(pcCU, eRefPicList, cMvTemp[iRefList][iRefIdxTemp], cMvPred[iRefList][iRefIdxTemp], aaiMvpIdx[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp); 3395 3432 3433 #if L0034_COMBINED_LIST_CLEANUP 3434 if ( iRefList == 0 ) 3435 { 3436 uiCostTempL0[iRefIdxTemp] = uiCostTemp; 3437 uiBitsTempL0[iRefIdxTemp] = uiBitsTemp; 3438 } 3439 if ( uiCostTemp < uiCost[iRefList] ) 3440 { 3441 uiCost[iRefList] = uiCostTemp; 3442 uiBits[iRefList] = uiBitsTemp; // storing for bi-prediction 3443 3444 // set motion 3445 cMv[iRefList] = cMvTemp[iRefList][iRefIdxTemp]; 3446 iRefIdx[iRefList] = iRefIdxTemp; 3447 } 3448 3449 if ( iRefList == 1 && uiCostTemp < costValidList1 && pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp ) < 0 ) 3450 { 3451 costValidList1 = uiCostTemp; 3452 bitsValidList1 = uiBitsTemp; 3453 3454 // set motion 3455 mvValidList1 = cMvTemp[iRefList][iRefIdxTemp]; 3456 refIdxValidList1 = iRefIdxTemp; 3457 } 3458 #else 3396 3459 if(pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && !pcCU->getSlice()->getNoBackPredFlag()) 3397 3460 { … … 3449 3512 } 3450 3513 } 3514 #endif 3451 3515 } 3452 3516 } … … 3516 3580 3517 3581 Int iRefList = iIter % 2; 3582 #if L0034_COMBINED_LIST_CLEANUP 3583 if ( m_pcEncCfg->getUseFastEnc() ) 3584 { 3585 if( uiCost[0] <= uiCost[1] ) 3586 { 3587 iRefList = 1; 3588 } 3589 else 3590 { 3591 iRefList = 0; 3592 } 3593 } 3594 else if ( iIter == 0 ) 3595 { 3596 iRefList = 0; 3597 } 3598 if ( iIter == 0 && !pcCU->getSlice()->getMvdL1ZeroFlag()) 3599 { 3600 pcCU->getCUMvField(RefPicList(1-iRefList))->setAllMv( cMv[1-iRefList], ePartSize, uiPartAddr, 0, iPartIdx ); 3601 pcCU->getCUMvField(RefPicList(1-iRefList))->setAllRefIdx( iRefIdx[1-iRefList], ePartSize, uiPartAddr, 0, iPartIdx ); 3602 TComYuv* pcYuvPred = &m_acYuvPred[1-iRefList]; 3603 motionCompensation ( pcCU, pcYuvPred, RefPicList(1-iRefList), iPartIdx ); 3604 } 3605 #else 3518 3606 if ( m_pcEncCfg->getUseFastEnc() && (pcCU->getSlice()->getNoBackPredFlag() || (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(0)==0 )) ) 3519 3607 { 3520 3608 iRefList = 1; 3521 3609 } 3610 #endif 3522 3611 RefPicList eRefPicList = ( iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); 3523 3612 … … 3680 3769 UInt uiMEBits = 0; 3681 3770 // Set Motion Field_ 3771 #if L0034_COMBINED_LIST_CLEANUP 3772 cMv[1] = mvValidList1; 3773 iRefIdx[1] = refIdxValidList1; 3774 uiBits[1] = bitsValidList1; 3775 uiCost[1] = costValidList1; 3776 #else 3682 3777 if ( pcCU->getSlice()->getNoBackPredFlag() || (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(0)==0 ) ) 3683 3778 { 3684 3779 uiCost[1] = MAX_UINT; 3685 3780 } 3781 #endif 3686 3782 #if AMP_MRG 3687 3783 if (bTestNormalMC) … … 4663 4759 while( pcCU->getWidth(0) > (pcCU->getSlice()->getSPS()->getMaxTrSize()<<uiTrLevel) ) uiTrLevel++; 4664 4760 } 4665 UInt uiMaxTrMode = pcCU->getSlice()->getSPS()->getMaxTrDepth()+ uiTrLevel;4761 UInt uiMaxTrMode = 1 + uiTrLevel; 4666 4762 4667 4763 while((uiWidth>>uiMaxTrMode) < (g_uiMaxCUWidth>>g_uiMaxCUDepth)) uiMaxTrMode--;
Note: See TracChangeset for help on using the changeset viewer.