HEVC inter-Frame Prediction 2 -- Analysis of TComDataCU: xGetColMVP

Source: Internet
Author: User

This document analyzes this function in detail: [cpp] Bool TComDataCU: xGetColMVP (RefPicList eRefPicList, Int uiCUAddr, Int uiPartUnitIdx, TComMv & RMV, Int & riRefIdx ){//! For more information, see draft 8.5.2.1.7, Derivation process for temporal luma motion vector prediction //! For The return conditions of this function, refer to The 3rd dots in this section. The variables mvLXCol and availableFlagLXCol are derived as follows... UInt uiAbsPartAddr = uiPartUnitIdx; RefPicList eColRefPicList; Int iColPOC, iColRefPOC, iCurrPOC, iCurrRefPOC, iScale; TComMv cColMv; // use coldir. //! Colocated Picture TComPic * pColPic = getSlice ()-> getRefPic (RefPicList (getSlice ()-> isInterB ()? 1-getSlice ()-> getColFromL0Flag (): 0), getSlice ()-> getColRefIdx ());//! Colocated CU TComDataCU * pColCU = pColPic-> getCU (uiCUAddr); if (pColCU-> getPic () = 0 | pColCU-> getPartitionSize (uiPartUnitIdx) = SIZE_NONE) //! <Colocated Picture or colocated CU does not exist {return false;} iCurrPOC = m_pcSlice-> getPOC ();//! <Current slice POC iCurrRefPOC = m_pcSlice-> getRefPic (eRefPicList, riRefIdx)-> getPOC ();//! <Current slice reference frame POC iColPOC = pColCU-> getSlice ()-> getPOC ();//! <Current slice's colocated picuture POC if (pColCU-> isIntra (uiAbsPartAddr ))//! <Colocated CU is in intra-frame prediction mode, that is, if no MV is available, false {return false;} eColRefPicList = getSlice ()-> getCheckLDC ()? ERefPicList: RefPicList (getSlice ()-> response (); Int iColRefIdx = pColCU-> getCUMvField (RefPicList (eColRefPicList)-> getRefIdx (response );//! <Colocated CU's reference frame sequence number if (iColRefIdx <0) {eColRefPicList = RefPicList (1-eColRefPicList); iColRefIdx = pColCU-> getCUMvField (RefPicList (Records )) -> getRefIdx (uiAbsPartAddr); if (iColRefIdx <0) {return false ;}// Scale the vector. iColRefPOC = pColCU-> getSlice ()-> getRefPOC (eColRefPicList, iColRefIdx); cColMv = pColCU-> getCUMvField (eColRefPicList)-> getMv (response); response = M_pcSlice-> getRefPic (eRefPicList, riRefIdx)-> getPOC (); Bool bIsCurrRefLongTerm = m_pcserver-> getRefPic (eRefPicList, riRefIdx)-> getIsLongTerm (); bool bIsColRefLongTerm = pColCU-> getSlice ()-> getRefPic (eColRefPicList, iColRefIdx)-> getIsUsedAsLongTerm (); if (bIsCurrRefLongTerm! = BIsColRefLongTerm) {return false;} if (bIsCurrRefLongTerm | bIsColRefLongTerm) {RMV = cColMv ;//! <Draft formula (8-155)} else {iScale = xGetDistScaleFactor (iCurrPOC, iCurrRefPOC, iColPOC, iColRefPOC );//! <Next, analyze if (iScale = 4096) {RMV = cColMv;} else {RMV = cColMv. scaleMv (iScale );//! <Draft formula (8-158)} return true;} [cpp] Int TComDataCU: xGetDistScaleFactor (Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC) {Int iDiffPocD = iColPOC-iColRefPOC ;//! <Draft formula (8-159) Int iDiffPocB = iCurrPOC-iCurrRefPOC ;//! <Draft formula (8-160) if (iDiffPocD = iDiffPocB) {return 4096;} else {www.2cto.com Int iTDB = Clip3 (-128,127, iDiffPocB ); int iTDD = Clip3 (-128,127, iDiffPocD); Int iX = (0x4000 + abs (iTDD/2)/iTDD ;//! <Draft formula (8-156) Int iScale = Clip3 (-4096,409 5, (iTDB * iX + 32)> 6 );//! <Draft formula (8-157) return iScale;} [cpp] const TComMv scaleMv (Int iScale) const {//! Draft formula (8-158) Int mvx = Clip3 (-32768,327 67, (iScale * getHor () + 127 + (iScale * getHor () <0)> 8 ); int mvy = Clip3 (-32768,327 67, (iScale * getVer () + 127 + (iScale * getVer () <0)> 8); return TComMv (mvx, mvy );}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.