1 / 20

Motion Estimation and Prediction

Motion Estimation and Prediction. Present by : fakewen. Motion Estimation and Prediction. 主要分布位置 Tcomprediction.cpp TEncSearch.cpp. predInterSearch. I frame.

inez
Download Presentation

Motion Estimation and Prediction

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Motion Estimation and Prediction Present by :fakewen

  2. Motion Estimation and Prediction • 主要分布位置 • Tcomprediction.cpp • TEncSearch.cpp

  3. predInterSearch

  4. I frame xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp); I frame自己重算motion vector I frame

  5. P frame I frame pcCU->getSlice()->getNoBackPredFlag()==1 P frame enumRefPicList { REF_PIC_LIST_0 = 0, ///< reference list 0 REF_PIC_LIST_1 = 1, ///< reference list 1 #if DCM_COMB_LIST REF_PIC_LIST_C = 2, ///< combined reference list for uni-prediction in B-Slices #endif REF_PIC_LIST_X = 100 ///< special mark }; 如果很smooth且cost不高 ->SKIPMODE 直接拿之前的Motion vector來用 否則再從他的ref framelist裡找

  6. B frame I frame P frame 如果很smooth且cost不高 ->SKIPMODE 直接拿之前的Motion vector來用 否則再從他的ref framelist裡找

  7. Advancedmotionvectorprediction • AMVP • It allows the selectionof the best predictor from • threespatially adjacent motion vectors(a,b,c) • their median • temporalmotion vector. xCheckBestMVP 計算哪種的cost較低

  8. xEstimateMvPredAMVP Step 1 check AMVP mode還有number of motion vector predictor candidates for ( i = 0 ; i < pcAMVPInfo->iN; i++) 算uiBestCost rcMvPred = pcAMVPInfo->m_acMvCand[pcCU->getMVPIdx(eRefPicList,uiPartAddr)]; 從裡面選一個最像的當Mvpredict 並記錄cost還有選到的鄰居

  9. Merge xMergeEstimation 算出最小的cost的合併方式 xMergeEstimation(…); UIntuiMRGCost = uiMRGError + m_pcRdCost->getCost( uiMRGBits ); if ( bMergeValid && uiMRGCost < uiMECost) 合併!

  10. xMotionEstimation if ( !m_iFastSearch || bBi ) xPatternSearch xPatternSearchFast Mv初始值用傳入參數 xTZSearch xPatternSearchFracDIF( pcCU, pcPatternKey, piRefY, iRefStride, &rcMv, cMvHalf, cMvQter, ruiCost )

  11. xTZSearch range test whether one of PRED_A, PRED_B, PRED_C MV is better start point than Median predictor PK raster search if distance is too big idist raster refinement P.s. 若idist==1 則只考慮上下左右

  12. raster refinement Idist too big

  13. motionCompensation Step 1 Check iPartIdx >= 0 Step 2 eRefPicList!= REF_PIC_LIST_X(B frame) xPredInterLumaBlk xPredInterUni xPredInterBi xPredInterChromaBlk xPredInterLumaBlk_ha xPredInterChromaBlk_ha

  14. motionCompensation Void motionCompensation( TComDataCU* pcCU, TComYuv* pcYuvPred, RefPicListeRefPicList = REF_PIC_LIST_X, IntiPartIdx = -1 );初始 Motion Compensation pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iRoiWidth, iRoiHeight ); iPartIdx >= 0? getPartIndexAndSize For(pcCU->getNumPartInter()) eRefPicList != REF_PIC_LIST_X ? eRefPicList看是I還是Pframe xPredInterUni xPredInterBi

  15. predInterSearch SPS: sequence parameter set predInterSearch pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iRoiWidth, iRoiHeight);得到這個block的info if (pcCU->getWidth( 0 ) > 8 && iNumPart == 2 && iPartIdx == 0) bTestNormalMC = false; For(iNumPredDir) iNumPredDir = pcCU->getSlice()->isInterP() ? 1 : 2; P是1B是2 FOR(pcCU->getSlice()->getNumRefIdx(eRefPicList) enumRefPicList { REF_PIC_LIST_0 = 0, ///< reference list 0 REF_PIC_LIST_1 = 1, ///< reference list 1 #if DCM_COMB_LIST REF_PIC_LIST_C = 2, ///< combined reference list for uni-prediction in B-Slices #endif REF_PIC_LIST_X = 100 ///< special mark }; RefPicList標示現在是IPB RefPicListeRefPicList = ( iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); iRefList//若是Iframe則0 pcCU->getSlice()->getNoBackPredFlag()… 判斷式 pcCU->getSlice()->getNoBackPredFlag() || pcCU->getSlice()->getSPS()->getUseLDC() 判斷式 cMvTemp[1][iRefIdxTemp] = cMvTemp[0][iRefIdxTemp]; SKIPMODE xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp); I frame自己重算motion vector uiCostTemp = uiCostTempL0[pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(iRefIdxTemp)]; 用相近的block

  16. predInterSearch(cont.) // set motion cMv[iRefList] = cMvTemp[iRefList][iRefIdxTemp]; iRefIdx[iRefList] = iRefIdxTemp; pcCU->getCUMvField(eRefPicList)->setAllMvField( cMv[iRefList], iRefIdx[iRefList], ePartSize, uiPartAddr, iPartIdx, 0 ); 紀錄最後結果 接著做AMVP xEstimateMvPredAMVP( pcCU, pcOrgYuv, iPartIdx, eRefPicList, iRefIdxTemp, cMvPred[iRefList][iRefIdxTemp]); aaiMvpIdx[iRefList][iRefIdxTemp] = pcCU->getMVPIdx(eRefPicList, uiPartAddr); aaiMvpNum[iRefList][iRefIdxTemp] = pcCU->getMVPNum(eRefPicList, uiPartAddr); uiBitsTemp+= m_auiMVPIdxCost[aaiMvpIdx[iRefList][iRefIdxTemp]][aaiMvpNum[iRefList][iRefIdxTemp]]; for( UIntui = 0; ui < MRG_MAX_NUM_CANDS; ui++ ) { pcCU->setNeighbourCandIdxSubParts( ui, ucNeighCand[ui], uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); } if ( bMergeValid && uiMRGCost < uiMECost ) { // 可以merge且merge cost較低>>set Merge result } else { // set ME result記錄自己的motion estimation }

  17. xEstimateMvPredAMVP if( pcCU->getAMVPMode(uiPartAddr) == AM_NONE || (pcAMVPInfo->iN <= 1 && pcCU->getAMVPMode(uiPartAddr) == AM_EXPL) ) no AMVP mode或是number of motion vector predictor candidates小於一 if (pcCU->getAMVPMode(uiPartAddr) == AM_EXPL && bFilled) 來亂的 for ( i = 0 ; i < pcAMVPInfo->iN; i++) 算uiBestCost rcMvPred = pcAMVPInfo->m_acMvCand[pcCU->getMVPIdx(eRefPicList,uiPartAddr)]; 從裡面選一個最像的當Mvpredict 並記錄cost還有選到的鄰居

  18. xMotionEstimation xSetSearchRange ( pcCU, cMvPred, iSrchRng, cMvSrchRngLT, cMvSrchRngRB); 先設定一下range(Pframe) if ( !m_iFastSearch || bBi ) xPatternSearch xPatternSearchFast Mv初始值用傳入參數 xPatternSearchFracDIF( pcCU, pcPatternKey, piRefY, iRefStride, &rcMv, cMvHalf, cMvQter, ruiCost ) rcMv <<= 2; rcMv += (cMvHalf <<= 1); rcMv += cMvQter; 紀錄結果

  19. motionCompensation Void motionCompensation( TComDataCU* pcCU, TComYuv* pcYuvPred, RefPicListeRefPicList = REF_PIC_LIST_X, IntiPartIdx = -1 );初始 Motion Compensation pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iRoiWidth, iRoiHeight ); iPartIdx >= 0? getPartIndexAndSize For(pcCU->getNumPartInter()) eRefPicList != REF_PIC_LIST_X ? eRefPicList看是I還是Pframe xPredInterUni xPredInterBi

More Related