Opened 6 years ago

Last modified 6 years ago

#297 closed enhancement

some TMVP code that can be cleaned up — at Initial Version

Reported by: LGE_VCC Owned by:
Priority: minor Milestone:
Component: VTM Version: VTM-5.0
Keywords: Cc: ksuehring, XiangLi, fbossen, jvet@…

Description

This ticket is reporting that some TMVP code in VTM can be cleaned up without change of performance. (It’s not a bug.)

The following piece of TMVP code appeared four times in VTM5.0 (in getInterMergeCandidates, fillMvpCand, fillAffineMvpCand, getAffineMergeCand).
The four “if/else” branches below can be reduced to only one “if” statement and get identical result.

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

}

In the above code, the 4 branches and the resulting C0Avail are as follows:

posInCtu.x+4<pcv.maxCUWidth....posInCtu.y+4<pcv.maxCUHeight.... C0Avail
(1).............true....................................true................................... true
(2).............true....................................false....................................false
(3).............false...................................true.....................................true
(4).............false...................................false....................................false

As can be seen from the combinations, given posInCtu.y , the true/false branches with posInCtu.x can be merged together, so the check on posInCtu.x is unnecessary, and above logic is identical to

int posYInCtu = posRB.y & pcv.maxCUHeightMask;
if (posYInCtu + 4 < pcv.maxCUHeight)
{

posC0 = posRB.offset(4, 4);
C0Avail = true;

}

I already tested this simplification, and got identical results on the top of VTM5.0.

In addition, TMVP code appeared many times in VTM. It would be desirable to put it into a function.

Best.

Jane

Change history (0)

Note: See TracTickets for help on using tickets.