diff -rupN HM-8.0-dev/source/Lib/TLibCommon/TComDataCU.cpp HM-8.0-cleanup/source/Lib/TLibCommon/TComDataCU.cpp
old
|
new
|
Void TComDataCU::getPartPosition( UInt p |
3187 | 3187 | } |
3188 | 3188 | } |
3189 | 3189 | |
3190 | | AMVP_MODE TComDataCU::getAMVPMode(UInt uiIdx) |
3191 | | { |
3192 | | return m_pcSlice->getSPS()->getAMVPMode(m_puhDepth[uiIdx]); |
3193 | | } |
3194 | | |
3195 | 3190 | /** Constructs a list of candidates for AMVP |
3196 | 3191 | * \param uiPartIdx |
3197 | 3192 | * \param uiPartAddr |
… |
… |
Void TComDataCU::fillMvpCand ( UInt uiPa |
3275 | 3270 | } |
3276 | 3271 | } |
3277 | 3272 | |
3278 | | if (getAMVPMode(uiPartAddr) == AM_NONE) //Should be optimized later for special cases |
3279 | | { |
3280 | | assert(pInfo->iN > 0); |
3281 | | pInfo->iN = 1; |
3282 | | return; |
3283 | | } |
3284 | | |
3285 | 3273 | if ( pInfo->iN == 2 ) |
3286 | 3274 | { |
3287 | 3275 | if ( pInfo->m_acMvCand[ 0 ] == pInfo->m_acMvCand[ 1 ] ) |
diff -rupN HM-8.0-dev/source/Lib/TLibCommon/TComDataCU.h HM-8.0-cleanup/source/Lib/TLibCommon/TComDataCU.h
old
|
new
|
public: |
437 | 437 | |
438 | 438 | Void getMvField ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList, TComMvField& rcMvField ); |
439 | 439 | |
440 | | AMVP_MODE getAMVPMode ( UInt uiIdx ); |
441 | 440 | Void fillMvpCand ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo ); |
442 | 441 | Bool isDiffMER ( Int xN, Int yN, Int xP, Int yP); |
443 | 442 | Void getPartPosition ( UInt partIdx, Int& xP, Int& yP, Int& nPSW, Int& nPSH); |
diff -rupN HM-8.0-dev/source/Lib/TLibCommon/TComPrediction.cpp HM-8.0-cleanup/source/Lib/TLibCommon/TComPrediction.cpp
old
|
new
|
Void TComPrediction::getMvPredAMVP( TCom |
661 | 661 | { |
662 | 662 | AMVPInfo* pcAMVPInfo = pcCU->getCUMvField(eRefPicList)->getAMVPInfo(); |
663 | 663 | |
664 | | if( pcCU->getAMVPMode(uiPartAddr) == AM_NONE || (pcAMVPInfo->iN <= 1 && pcCU->getAMVPMode(uiPartAddr) == AM_EXPL) ) |
| 664 | if( pcAMVPInfo->iN <= 1 ) |
665 | 665 | { |
666 | 666 | rcMvPred = pcAMVPInfo->m_acMvCand[0]; |
667 | 667 | |
diff -rupN HM-8.0-dev/source/Lib/TLibCommon/TComSlice.cpp HM-8.0-cleanup/source/Lib/TLibCommon/TComSlice.cpp
old
|
new
|
TComSPS::TComSPS() |
1358 | 1358 | , m_scalingListEnabledFlag (false) |
1359 | 1359 | { |
1360 | 1360 | // AMVP parameter |
1361 | | ::memset( m_aeAMVPMode, 0, sizeof( m_aeAMVPMode ) ); |
1362 | 1361 | for ( Int i = 0; i < MAX_TLAYER; i++ ) |
1363 | 1362 | { |
1364 | 1363 | m_uiMaxLatencyIncrease[i] = 0; |
diff -rupN HM-8.0-dev/source/Lib/TLibCommon/TComSlice.h HM-8.0-cleanup/source/Lib/TLibCommon/TComSlice.h
old
|
new
|
private: |
341 | 341 | Bool m_listsModificationPresentFlag; |
342 | 342 | |
343 | 343 | // Parameter |
344 | | AMVP_MODE m_aeAMVPMode[MAX_CU_DEPTH]; |
345 | 344 | UInt m_uiBitDepth; |
346 | 345 | UInt m_uiBitIncrement; |
347 | 346 | Int m_qpBDOffsetY; |
… |
… |
public: |
506 | 505 | Bool getListsModificationPresentFlag () { return m_listsModificationPresentFlag; } |
507 | 506 | Void setListsModificationPresentFlag ( Bool b ) { m_listsModificationPresentFlag = b; } |
508 | 507 | |
509 | | // AMVP mode (for each depth) |
510 | | AMVP_MODE getAMVPMode ( UInt uiDepth ) { assert(uiDepth < g_uiMaxCUDepth); return m_aeAMVPMode[uiDepth]; } |
511 | | Void setAMVPMode ( UInt uiDepth, AMVP_MODE eMode) { assert(uiDepth < g_uiMaxCUDepth); m_aeAMVPMode[uiDepth] = eMode; } |
512 | | |
513 | 508 | // AMP accuracy |
514 | 509 | Int getAMPAcc ( UInt uiDepth ) { return m_iAMPAcc[uiDepth]; } |
515 | 510 | Void setAMPAcc ( UInt uiDepth, Int iAccu ) { assert( uiDepth < g_uiMaxCUDepth); m_iAMPAcc[uiDepth] = iAccu; } |
diff -rupN HM-8.0-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp HM-8.0-cleanup/source/Lib/TLibDecoder/TDecCAVLC.cpp
old
|
new
|
Void TDecCavlc::parseSPS(TComSPS* pcSPS) |
782 | 782 | } |
783 | 783 | #endif |
784 | 784 | READ_FLAG( uiCode, "sps_temporal_mvp_enable_flag" ); pcSPS->setTMVPFlagsPresent(uiCode); |
785 | | // AMVP mode for each depth (AM_NONE or AM_EXPL) |
786 | | for (Int i = 0; i < pcSPS->getMaxCUDepth(); i++) |
787 | | { |
788 | | xReadFlag( uiCode ); |
789 | | pcSPS->setAMVPMode( i, (AMVP_MODE)uiCode ); |
790 | | } |
791 | | |
792 | 785 | READ_FLAG( uiCode, "sps_extension_flag"); |
793 | 786 | if (uiCode) |
794 | 787 | { |
diff -rupN HM-8.0-dev/source/Lib/TLibDecoder/TDecEntropy.cpp HM-8.0-cleanup/source/Lib/TLibDecoder/TDecEntropy.cpp
old
|
new
|
Void TDecEntropy::decodeMVPIdxPU( TComDa |
302 | 302 | iRefIdx = pcSubCUMvField->getRefIdx(uiPartAddr); |
303 | 303 | cMv = cZeroMv; |
304 | 304 | |
305 | | if ( (pcSubCU->getInterDir(uiPartAddr) & ( 1 << eRefList )) && (pcSubCU->getAMVPMode(uiPartAddr) == AM_EXPL) ) |
| 305 | if ( (pcSubCU->getInterDir(uiPartAddr) & ( 1 << eRefList )) ) |
306 | 306 | { |
307 | 307 | m_pcEntropyDecoderIf->parseMVPIdx( iMVPIdx ); |
308 | 308 | } |
diff -rupN HM-8.0-dev/source/Lib/TLibEncoder/TEncCavlc.cpp HM-8.0-cleanup/source/Lib/TLibEncoder/TEncCavlc.cpp
old
|
new
|
Void TEncCavlc::codeSPS( TComSPS* pcSPS |
537 | 537 | } |
538 | 538 | #endif |
539 | 539 | WRITE_FLAG( pcSPS->getTMVPFlagsPresent() ? 1 : 0, "sps_temporal_mvp_enable_flag" ); |
540 | | // AMVP mode for each depth |
541 | | for (Int i = 0; i < pcSPS->getMaxCUDepth(); i++) |
542 | | { |
543 | | xWriteFlag( pcSPS->getAMVPMode(i) ? 1 : 0); |
544 | | } |
545 | | |
546 | 540 | WRITE_FLAG( 0, "sps_extension_flag" ); |
547 | 541 | } |
548 | 542 | |
diff -rupN HM-8.0-dev/source/Lib/TLibEncoder/TEncEntropy.cpp HM-8.0-cleanup/source/Lib/TLibEncoder/TEncEntropy.cpp
old
|
new
|
Void TEncEntropy::encodeMvdPU( TComDataC |
663 | 663 | |
664 | 664 | Void TEncEntropy::encodeMVPIdxPU( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefList ) |
665 | 665 | { |
666 | | if ( (pcCU->getInterDir( uiAbsPartIdx ) & ( 1 << eRefList )) && (pcCU->getAMVPMode(uiAbsPartIdx) == AM_EXPL) ) |
| 666 | if ( (pcCU->getInterDir( uiAbsPartIdx ) & ( 1 << eRefList )) ) |
667 | 667 | { |
668 | 668 | m_pcEntropyCoderIf->codeMVPIdx( pcCU, uiAbsPartIdx, eRefList ); |
669 | 669 | } |
diff -rupN HM-8.0-dev/source/Lib/TLibEncoder/TEncSearch.cpp HM-8.0-cleanup/source/Lib/TLibEncoder/TEncSearch.cpp
old
|
new
|
Void TEncSearch::predInterSearch( TComDa |
3380 | 3380 | xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp ); |
3381 | 3381 | #endif |
3382 | 3382 | xCopyAMVPInfo(pcCU->getCUMvField(eRefPicList)->getAMVPInfo(), &aacAMVPInfo[iRefList][iRefIdxTemp]); // must always be done ( also when AMVP_MODE = AM_NONE ) |
3383 | | if ( pcCU->getAMVPMode(uiPartAddr) == AM_EXPL ) |
3384 | | { |
3385 | 3383 | xCheckBestMVP(pcCU, eRefPicList, cMvTemp[iRefList][iRefIdxTemp], cMvPred[iRefList][iRefIdxTemp], aaiMvpIdx[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp); |
3386 | | } |
3387 | 3384 | |
3388 | 3385 | if(pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && !pcCU->getSlice()->getNoBackPredFlag()) |
3389 | 3386 | { |
… |
… |
Void TEncSearch::predInterSearch( TComDa |
3525 | 3522 | uiBitsTemp += m_auiMVPIdxCost[aaiMvpIdxBi[iRefList][iRefIdxTemp]][AMVP_MAX_NUM_CANDS]; |
3526 | 3523 | // call ME |
3527 | 3524 | xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPredBi[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp, true ); |
3528 | | if ( pcCU->getAMVPMode(uiPartAddr) == AM_EXPL ) |
3529 | | { |
3530 | | xCopyAMVPInfo(&aacAMVPInfo[iRefList][iRefIdxTemp], pcCU->getCUMvField(eRefPicList)->getAMVPInfo()); |
3531 | | xCheckBestMVP(pcCU, eRefPicList, cMvTemp[iRefList][iRefIdxTemp], cMvPredBi[iRefList][iRefIdxTemp], aaiMvpIdxBi[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp); |
3532 | | } |
| 3525 | xCopyAMVPInfo(&aacAMVPInfo[iRefList][iRefIdxTemp], pcCU->getCUMvField(eRefPicList)->getAMVPInfo()); |
| 3526 | xCheckBestMVP(pcCU, eRefPicList, cMvTemp[iRefList][iRefIdxTemp], cMvPredBi[iRefList][iRefIdxTemp], aaiMvpIdxBi[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp); |
3533 | 3527 | |
3534 | 3528 | if ( uiCostTemp < uiCostBi ) |
3535 | 3529 | { |
… |
… |
Void TEncSearch::predInterSearch( TComDa |
3556 | 3550 | |
3557 | 3551 | if ( !bChanged ) |
3558 | 3552 | { |
3559 | | if ( uiCostBi <= uiCost[0] && uiCostBi <= uiCost[1] && pcCU->getAMVPMode(uiPartAddr) == AM_EXPL ) |
| 3553 | if ( uiCostBi <= uiCost[0] && uiCostBi <= uiCost[1] ) |
3560 | 3554 | { |
3561 | 3555 | xCopyAMVPInfo(&aacAMVPInfo[0][iRefIdxBi[0]], pcCU->getCUMvField(REF_PIC_LIST_0)->getAMVPInfo()); |
3562 | 3556 | xCheckBestMVP(pcCU, REF_PIC_LIST_0, cMvBi[0], cMvPredBi[0][iRefIdxBi[0]], aaiMvpIdxBi[0][iRefIdxBi[0]], uiBits[2], uiCostBi); |
… |
… |
Void TEncSearch::xEstimateMvPredAMVP( TC |
3862 | 3856 | iBestIdx = 0; |
3863 | 3857 | cBestMv = pcAMVPInfo->m_acMvCand[0]; |
3864 | 3858 | #if !ZERO_MVD_EST |
3865 | | if( pcCU->getAMVPMode(uiPartAddr) == AM_NONE || (pcAMVPInfo->iN <= 1 && pcCU->getAMVPMode(uiPartAddr) == AM_EXPL) ) |
| 3859 | if (pcAMVPInfo->iN <= 1) |
3866 | 3860 | { |
3867 | 3861 | rcMvPred = cBestMv; |
3868 | 3862 | |
… |
… |
Void TEncSearch::xEstimateMvPredAMVP( TC |
3880 | 3874 | return; |
3881 | 3875 | } |
3882 | 3876 | #endif |
3883 | | if (pcCU->getAMVPMode(uiPartAddr) == AM_EXPL && bFilled) |
| 3877 | if (bFilled) |
3884 | 3878 | { |
3885 | 3879 | assert(pcCU->getMVPIdx(eRefPicList,uiPartAddr) >= 0); |
3886 | 3880 | rcMvPred = pcAMVPInfo->m_acMvCand[pcCU->getMVPIdx(eRefPicList,uiPartAddr)]; |
3887 | 3881 | return; |
3888 | 3882 | } |
3889 | 3883 | |
3890 | | if (pcCU->getAMVPMode(uiPartAddr) == AM_EXPL) |
3891 | | { |
3892 | | m_cYuvPredTemp.clear(); |
| 3884 | m_cYuvPredTemp.clear(); |
3893 | 3885 | #if ZERO_MVD_EST |
3894 | | UInt uiDist; |
| 3886 | UInt uiDist; |
3895 | 3887 | #endif |
3896 | | //-- Check Minimum Cost. |
3897 | | for ( i = 0 ; i < pcAMVPInfo->iN; i++) |
3898 | | { |
3899 | | UInt uiTmpCost; |
| 3888 | //-- Check Minimum Cost. |
| 3889 | for ( i = 0 ; i < pcAMVPInfo->iN; i++) |
| 3890 | { |
| 3891 | UInt uiTmpCost; |
3900 | 3892 | #if ZERO_MVD_EST |
3901 | | uiTmpCost = xGetTemplateCost( pcCU, uiPartIdx, uiPartAddr, pcOrgYuv, &m_cYuvPredTemp, pcAMVPInfo->m_acMvCand[i], i, AMVP_MAX_NUM_CANDS, eRefPicList, iRefIdx, iRoiWidth, iRoiHeight, uiDist ); |
| 3893 | uiTmpCost = xGetTemplateCost( pcCU, uiPartIdx, uiPartAddr, pcOrgYuv, &m_cYuvPredTemp, pcAMVPInfo->m_acMvCand[i], i, AMVP_MAX_NUM_CANDS, eRefPicList, iRefIdx, iRoiWidth, iRoiHeight, uiDist ); |
3902 | 3894 | #else |
3903 | | uiTmpCost = xGetTemplateCost( pcCU, uiPartIdx, uiPartAddr, pcOrgYuv, &m_cYuvPredTemp, pcAMVPInfo->m_acMvCand[i], i, AMVP_MAX_NUM_CANDS, eRefPicList, iRefIdx, iRoiWidth, iRoiHeight); |
| 3895 | uiTmpCost = xGetTemplateCost( pcCU, uiPartIdx, uiPartAddr, pcOrgYuv, &m_cYuvPredTemp, pcAMVPInfo->m_acMvCand[i], i, AMVP_MAX_NUM_CANDS, eRefPicList, iRefIdx, iRoiWidth, iRoiHeight); |
3904 | 3896 | #endif |
3905 | | if ( uiBestCost > uiTmpCost ) |
3906 | | { |
3907 | | uiBestCost = uiTmpCost; |
3908 | | cBestMv = pcAMVPInfo->m_acMvCand[i]; |
3909 | | iBestIdx = i; |
3910 | | (*puiDistBiP) = uiTmpCost; |
3911 | | #if ZERO_MVD_EST |
3912 | | (*puiDist) = uiDist; |
3913 | | #endif |
3914 | | } |
3915 | | } |
3916 | | |
3917 | | m_cYuvPredTemp.clear(); |
| 3897 | if ( uiBestCost > uiTmpCost ) |
| 3898 | { |
| 3899 | uiBestCost = uiTmpCost; |
| 3900 | cBestMv = pcAMVPInfo->m_acMvCand[i]; |
| 3901 | iBestIdx = i; |
| 3902 | (*puiDistBiP) = uiTmpCost; |
| 3903 | #if ZERO_MVD_EST |
| 3904 | (*puiDist) = uiDist; |
| 3905 | #endif |
| 3906 | } |
3918 | 3907 | } |
| 3908 | m_cYuvPredTemp.clear(); |
3919 | 3909 | |
3920 | 3910 | // Setting Best MVP |
3921 | 3911 | rcMvPred = cBestMv; |
diff -rupN HM-8.0-dev/source/Lib/TLibEncoder/TEncTop.cpp HM-8.0-cleanup/source/Lib/TLibEncoder/TEncTop.cpp
old
|
new
|
Void TEncTop::xInitSPS() |
514 | 514 | #endif |
515 | 515 | |
516 | 516 | Int i; |
517 | | #if HHI_AMVP_OFF |
518 | | for ( i = 0; i < g_uiMaxCUDepth; i++ ) |
519 | | { |
520 | | m_cSPS.setAMVPMode( i, AM_NONE ); |
521 | | } |
522 | | #else |
523 | | for ( i = 0; i < g_uiMaxCUDepth; i++ ) |
524 | | { |
525 | | m_cSPS.setAMVPMode( i, AM_EXPL ); |
526 | | } |
527 | | #endif |
528 | 517 | |
529 | 518 | for (i = 0; i < g_uiMaxCUDepth-g_uiAddCUDepth; i++ ) |
530 | 519 | { |