From 5767894cecc97916c777403b6e3ff73eba654930 Mon Sep 17 00:00:00 2001 From: Jie <jie.zhao@lge.com> Date: Tue, 4 Jun 2019 07:21:18 +0200 Subject: [PATCH] Ticket #297: Cleanup on obtaining TMVP C0 availability --- source/Lib/CommonLib/UnitTools.cpp | 96 ++++-------------------------- 1 file changed, 13 insertions(+), 83 deletions(-) diff --git a/source/Lib/CommonLib/UnitTools.cpp b/source/Lib/CommonLib/UnitTools.cpp index aa6efa843..c3048364e 100644 --- a/source/Lib/CommonLib/UnitTools.cpp +++ b/source/Lib/CommonLib/UnitTools.cpp @@ -1912,30 +1912,11 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, #endif if (((posRB.x + pcv.minCUWidth) < pcv.lumaWidth) && ((posRB.y + pcv.minCUHeight) < pcv.lumaHeight)) { + int posYInCtu = posRB.y & pcv.maxCUHeightMask; + if (posYInCtu + 4 < pcv.maxCUHeight) { - Position posInCtu( posRB.x & pcv.maxCUWidthMask, posRB.y & pcv.maxCUHeightMask ); - - if( ( posInCtu.x + 4 < pcv.maxCUWidth ) && // is not at the last column of CTU - ( posInCtu.y + 4 < pcv.maxCUHeight ) ) // is not at the last row of CTU - { - posC0 = posRB.offset( 4, 4 ); - C0Avail = true; - } - else if( posInCtu.x + 4 < pcv.maxCUWidth ) // is not at the last column of CTU But is last row of CTU - { - posC0 = posRB.offset( 4, 4 ); - // in the reference the CTU address is not set - thus probably resulting in no using this C0 possibility - } - else if( posInCtu.y + 4 < pcv.maxCUHeight ) // is not at the last row of CTU But is last column of CTU - { - posC0 = posRB.offset( 4, 4 ); - C0Avail = true; - } - else //is the right bottom corner of CTU - { - posC0 = posRB.offset( 4, 4 ); - // same as for last column but not last row - } + posC0 = posRB.offset(4, 4); + C0Avail = true; } } @@ -2987,29 +2968,12 @@ void PU::fillMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, const in if( ( ( posRB.x + pcv.minCUWidth ) < pcv.lumaWidth ) && ( ( posRB.y + pcv.minCUHeight ) < pcv.lumaHeight ) ) { - Position posInCtu( posRB.x & pcv.maxCUWidthMask, posRB.y & pcv.maxCUHeightMask ); - - if ((posInCtu.x + 4 < pcv.maxCUWidth) && // is not at the last column of CTU - (posInCtu.y + 4 < pcv.maxCUHeight)) // is not at the last row of CTU - { - posC0 = posRB.offset(4, 4); - C0Avail = true; - } - else if (posInCtu.x + 4 < pcv.maxCUWidth) // is not at the last column of CTU But is last row of CTU - { - // in the reference the CTU address is not set - thus probably resulting in no using this C0 possibility - posC0 = posRB.offset(4, 4); - } - else if (posInCtu.y + 4 < pcv.maxCUHeight) // is not at the last row of CTU But is last column of CTU + int posYInCtu = posRB.y & pcv.maxCUHeightMask; + if (posYInCtu + 4 < pcv.maxCUHeight) { posC0 = posRB.offset(4, 4); C0Avail = true; } - else //is the right bottom corner of CTU - { - // same as for last column but not last row - posC0 = posRB.offset(4, 4); - } } #if JVET_N0266_SMALL_BLOCKS if ( ( C0Avail && getColocatedMVP( pu, eRefPicList, posC0, cColMv, refIdx_Col ) ) || getColocatedMVP( pu, eRefPicList, posC1, cColMv, refIdx_Col ) ) @@ -3326,30 +3290,13 @@ void PU::fillAffineMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, co #endif Mv cColMv; if ( ((posRB.x + pcv.minCUWidth) < pcv.lumaWidth) && ((posRB.y + pcv.minCUHeight) < pcv.lumaHeight) ) - { - Position posInCtu( posRB.x & pcv.maxCUWidthMask, posRB.y & pcv.maxCUHeightMask ); - - if ( (posInCtu.x + 4 < pcv.maxCUWidth) && // is not at the last column of CTU - (posInCtu.y + 4 < pcv.maxCUHeight) ) // is not at the last row of CTU - { - posC0 = posRB.offset( 4, 4 ); - C0Avail = true; - } - else if ( posInCtu.x + 4 < pcv.maxCUWidth ) // is not at the last column of CTU But is last row of CTU - { - // in the reference the CTU address is not set - thus probably resulting in no using this C0 possibility - posC0 = posRB.offset( 4, 4 ); - } - else if ( posInCtu.y + 4 < pcv.maxCUHeight ) // is not at the last row of CTU But is last column of CTU + { + int posYInCtu = posRB.y & pcv.maxCUHeightMask; + if (posYInCtu + 4 < pcv.maxCUHeight) { - posC0 = posRB.offset( 4, 4 ); + posC0 = posRB.offset(4, 4); C0Avail = true; } - else //is the right bottom corner of CTU - { - // same as for last column but not last row - posC0 = posRB.offset( 4, 4 ); - } } #if JVET_N0266_SMALL_BLOCKS if ( ( C0Avail && getColocatedMVP( pu, eRefPicList, posC0, cColMv, refIdxCol ) ) || getColocatedMVP( pu, eRefPicList, posC1, cColMv, refIdxCol ) ) @@ -4081,29 +4028,12 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx if ( ((posRB.x + pcv.minCUWidth) < pcv.lumaWidth) && ((posRB.y + pcv.minCUHeight) < pcv.lumaHeight) ) { - Position posInCtu( posRB.x & pcv.maxCUWidthMask, posRB.y & pcv.maxCUHeightMask ); - - if ( (posInCtu.x + 4 < pcv.maxCUWidth) && // is not at the last column of CTU - (posInCtu.y + 4 < pcv.maxCUHeight) ) // is not at the last row of CTU + int posYInCtu = posRB.y & pcv.maxCUHeightMask; + if (posYInCtu + 4 < pcv.maxCUHeight) { - posC0 = posRB.offset( 4, 4 ); + posC0 = posRB.offset(4, 4); C0Avail = true; } - else if ( posInCtu.x + 4 < pcv.maxCUWidth ) // is not at the last column of CTU But is last row of CTU - { - posC0 = posRB.offset( 4, 4 ); - // in the reference the CTU address is not set - thus probably resulting in no using this C0 possibility - } - else if ( posInCtu.y + 4 < pcv.maxCUHeight ) // is not at the last row of CTU But is last column of CTU - { - posC0 = posRB.offset( 4, 4 ); - C0Avail = true; - } - else //is the right bottom corner of CTU - { - posC0 = posRB.offset( 4, 4 ); - // same as for last column but not last row - } } Mv cColMv; -- GitLab