Changeset 722 in SHVCSoftware for branches/SHM-6-dev/source/Lib/TLibEncoder


Ignore:
Timestamp:
22 Apr 2014, 09:11:10 (11 years ago)
Author:
seregin
Message:

add checks for the ILRP prediction type

Location:
branches/SHM-6-dev/source/Lib/TLibEncoder
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-6-dev/source/Lib/TLibEncoder/TEncGOP.cpp

    r705 r722  
    10121012    if (m_layerId > 0)
    10131013    {
    1014     Int interLayerPredLayerIdcTmp[MAX_VPS_LAYER_ID_PLUS1];
    1015     Int activeNumILRRefIdxTmp = 0;
     1014      Int interLayerPredLayerIdcTmp[MAX_VPS_LAYER_ID_PLUS1];
     1015      Int activeNumILRRefIdxTmp = 0;
    10161016
    10171017      for( Int i = 0; i < pcSlice->getActiveNumILRRefIdx(); i++ )
    10181018      {
    10191019        UInt refLayerIdc = pcSlice->getInterLayerPredLayerIdc(i);
     1020        UInt refLayerId = pcSlice->getVPS()->getRefLayerId(m_layerId, refLayerIdc);
    10201021#if VPS_EXTN_DIRECT_REF_LAYERS
    10211022        TComList<TComPic*> *cListPic = m_ppcTEncTop[m_layerId]->getRefLayerEnc(refLayerIdc)->getListPic();
     
    10411042
    10421043#if O0098_SCALED_REF_LAYER_ID
    1043         const Window &scalEL = m_pcEncTop->getScaledRefLayerWindowForLayer(pcSlice->getVPS()->getRefLayerId(m_layerId, refLayerIdc));
     1044        const Window &scalEL = m_pcEncTop->getScaledRefLayerWindowForLayer(refLayerId);
    10441045#else
    10451046        const Window &scalEL = m_pcEncTop->getScaledRefLayerWindow(refLayerIdc);
     
    10891090#endif
    10901091#if SVC_UPSAMPLING
    1091         if( pcPic->isSpatialEnhLayer(refLayerIdc))
    1092         {
     1092        if( pcPic->isSpatialEnhLayer(refLayerIdc) )
     1093        {
     1094          // check for the sample prediction picture type
     1095          if( m_ppcTEncTop[m_layerId]->getSamplePredEnabledFlag(refLayerId) )
     1096          {
    10931097#if P0312_VERT_PHASE_ADJ
    1094           //when PhasePositionEnableFlag is equal to 1, set vertPhasePositionFlag to 0 if BL is top field and 1 if bottom
    1095           if( scalEL.getVertPhasePositionEnableFlag() )
    1096           {
    1097             pcSlice->setVertPhasePositionFlag( pcSlice->getPOC()%2, refLayerIdc );
    1098           }
     1098            //when PhasePositionEnableFlag is equal to 1, set vertPhasePositionFlag to 0 if BL is top field and 1 if bottom
     1099            if( scalEL.getVertPhasePositionEnableFlag() )
     1100            {
     1101              pcSlice->setVertPhasePositionFlag( pcSlice->getPOC()%2, refLayerIdc );
     1102            }
    10991103#endif
    11001104#if O0215_PHASE_ALIGNMENT
    11011105#if O0194_JOINT_US_BITSHIFT
    11021106#if Q0048_CGS_3D_ASYMLUT
    1103           m_pcPredSearch->upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), pcSlice->getVPS()->getPhaseAlignFlag() );
    1104 #else
    1105           m_pcPredSearch->upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), pcSlice->getVPS()->getPhaseAlignFlag() );
     1107            m_pcPredSearch->upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), pcSlice->getVPS()->getPhaseAlignFlag() );
     1108#else
     1109            m_pcPredSearch->upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), pcSlice->getVPS()->getPhaseAlignFlag() );
    11061110#endif
    11071111#else
    11081112#if Q0048_CGS_3D_ASYMLUT
    1109           m_pcPredSearch->upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), scalEL, pcSlice->getVPS()->getPhaseAlignFlag() );
    1110 #else
    1111           m_pcPredSearch->upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL, pcSlice->getVPS()->getPhaseAlignFlag() );
     1113            m_pcPredSearch->upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), scalEL, pcSlice->getVPS()->getPhaseAlignFlag() );
     1114#else
     1115            m_pcPredSearch->upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL, pcSlice->getVPS()->getPhaseAlignFlag() );
    11121116#endif
    11131117#endif
     
    11151119#if O0194_JOINT_US_BITSHIFT
    11161120#if Q0048_CGS_3D_ASYMLUT
    1117           m_pcPredSearch->upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), scalEL );
    1118 #else
    1119           m_pcPredSearch->upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL );
     1121            m_pcPredSearch->upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), scalEL );
     1122#else
     1123            m_pcPredSearch->upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL );
    11201124#endif
    11211125#else
    11221126#if Q0048_CGS_3D_ASYMLUT
    1123           m_pcPredSearch->upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), scalEL );
    1124 #else
    1125           m_pcPredSearch->upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL );
    1126 #endif
    1127 #endif
    1128 #endif
     1127            m_pcPredSearch->upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), scalEL );
     1128#else
     1129            m_pcPredSearch->upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL );
     1130#endif
     1131#endif
     1132#endif
     1133          }
    11291134        }
    11301135        else
     
    11541159        pcSlice->setInterLayerPredEnabledFlag(false);
    11551160      }
    1156      
     1161
    11571162      if( pocCurr % m_pcCfg->getIntraPeriod() == 0 )
    11581163      {
     
    11731178        else
    11741179#endif
    1175         pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_CRA);
     1180          pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_CRA);
    11761181
    11771182#if IDR_ALIGNMENT
     
    11881193#endif
    11891194      }
    1190      
     1195
    11911196      if( pcSlice->getActiveNumILRRefIdx() == 0 && pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA )
    11921197      {
     
    11961201      {
    11971202        if( (pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP) &&
    1198            (pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA) &&
    1199            pcSlice->getSliceType() == B_SLICE )
     1203          (pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA) &&
     1204          pcSlice->getSliceType() == B_SLICE )
    12001205        {
    12011206          pcSlice->setSliceType(P_SLICE);
    12021207        }
    1203       }
     1208      }     
    12041209    }
    12051210#endif //#if SVC_EXTENSION
     
    14711476    if( m_layerId > 0 && pcSlice->getActiveNumILRRefIdx() )
    14721477    {
     1478      // check for the reference pictures whether there is at least one either temporal picture or ILRP with sample prediction type
     1479      if( pcSlice->getNumRefIdx( REF_PIC_LIST_0 ) == 0 && pcSlice->getNumRefIdx( REF_PIC_LIST_1 ) == 0 )
     1480      {
     1481        Bool foundSamplePredPicture = false;
     1482
     1483        for( Int i = 0; i < pcSlice->getActiveNumILRRefIdx(); i++ )
     1484        {
     1485          if( m_ppcTEncTop[m_layerId]->getSamplePredEnabledFlag( pcSlice->getVPS()->getRefLayerId( m_layerId, pcSlice->getInterLayerPredLayerIdc(i) ) ) )
     1486          {
     1487            foundSamplePredPicture = true;
     1488            break;
     1489          }
     1490        }
     1491
     1492        if( !foundSamplePredPicture )
     1493        {
     1494          pcSlice->setSliceType(I_SLICE);
     1495        }
     1496      }
     1497
    14731498#if POC_RESET_FLAG
    14741499      if ( pocCurr > 0          && pcSlice->isRADL() && pcPic->getSlice(0)->getBaseColPic(pcPic->getSlice(0)->getInterLayerPredLayerIdc(0))->getSlice(0)->isRASL())
     
    15671592          pcSlice->setColFromL0Flag(ColFromL0Flag);
    15681593          pcSlice->setColRefIdx(ColRefIdx);
     1594
     1595          // remove motion only ILRP from the end of the ColFromL0Flag reference picture list
     1596          RefPicList refList = RefPicList(ColFromL0Flag);
     1597          Int numRefIdx = pcSlice->getNumRefIdx(refList);
     1598
     1599          if( numRefIdx > 0 )
     1600          {
     1601            for( Int refIdx = pcSlice->getNumRefIdx(refList) - 1; refIdx >= pcSlice->getNumRefIdx(refList) - pcSlice->getActiveNumILRRefIdx(); refIdx-- )
     1602            {
     1603              TComPic* ilrp = pcSlice->getRefPic(refList, refIdx);
     1604
     1605              assert( ilrp->isILR(m_layerId) );
     1606
     1607              if( m_ppcTEncTop[m_layerId]->getSamplePredEnabledFlag( ilrp->getLayerId() ) )
     1608              {
     1609                break;
     1610              }
     1611              else
     1612              {
     1613                assert( numRefIdx > 1 );
     1614                numRefIdx--;             
     1615              }
     1616            }
     1617
     1618            pcSlice->setNumRefIdx( refList, numRefIdx );
     1619          }
     1620
     1621          // remove motion only ILRP from the end of the (1-ColFromL0Flag) reference picture list up to ColRefIdx
     1622          refList = RefPicList(1 - ColFromL0Flag);
     1623          numRefIdx = pcSlice->getNumRefIdx(refList);
     1624
     1625          if( numRefIdx > 0 )
     1626          {
     1627            for( Int refIdx = pcSlice->getNumRefIdx(refList) - 1; refIdx >= pcSlice->getNumRefIdx(refList) - pcSlice->getActiveNumILRRefIdx() && refIdx > ColRefIdx; refIdx-- )
     1628            {
     1629              TComPic* ilrp = pcSlice->getRefPic(refList, refIdx);
     1630
     1631              assert( ilrp->isILR(m_layerId) );
     1632
     1633              if( m_ppcTEncTop[m_layerId]->getSamplePredEnabledFlag( ilrp->getLayerId() ) )
     1634              {
     1635                break;
     1636              }
     1637              else
     1638              {
     1639                assert( numRefIdx > 1 );
     1640                numRefIdx--;             
     1641              }
     1642            }
     1643
     1644            pcSlice->setNumRefIdx( refList, numRefIdx );
     1645          }
    15691646        }
    15701647      }
  • branches/SHM-6-dev/source/Lib/TLibEncoder/TEncSearch.cpp

    r652 r722  
    32223222      for ( Int iRefIdxTemp = 0; iRefIdxTemp < pcCU->getSlice()->getNumRefIdx(eRefPicList); iRefIdxTemp++ )
    32233223      {
     3224#if SVC_EXTENSION
     3225        TComPic* pcPic = pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxTemp );
     3226       
     3227        // motion search only for the ILRP with sample prediction type
     3228        if( pcPic->isILR( pcCU->getLayerId() ) && !pcCU->getSlice()->getVPS()->isSamplePredictionType( pcCU->getLayerId(), pcPic->getLayerId() ) )
     3229        {
     3230          continue;
     3231        }
     3232
    32243233#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
    3225         if (pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxTemp )->isILR(pcCU->getLayerId()) && m_disableILP)
     3234        if( pcPic->isILR(pcCU->getLayerId()) && m_disableILP )
    32263235        {
    32273236          continue;
    32283237        }
    32293238#endif
    3230 #if (ENCODER_FAST_MODE)
    3231         TComPic* pcPic    = pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxTemp );
     3239#if (ENCODER_FAST_MODE)       
    32323240        if( pcPic->isILR(pcCU->getLayerId()) && (ePartSize == SIZE_2Nx2N) )
    32333241        {
    32343242          continue;
    32353243        }
     3244#endif
    32363245#endif
    32373246
     
    34623471#if (ENCODER_FAST_MODE)
    34633472          Bool testRefIdx = true;
    3464           pcPic           = pcCU->getSlice()->getRefPic( RefPicList(iRefList) , iRefIdxTemp );
     3473          pcPic = pcCU->getSlice()->getRefPic( RefPicList(iRefList) , iRefIdxTemp );
     3474
     3475          // motion search only for the ILRP with sample prediction type
     3476          if( pcPic->isILR( pcCU->getLayerId() ) && !pcCU->getSlice()->getVPS()->isSamplePredictionType( pcCU->getLayerId(), pcPic->getLayerId() ) )
     3477          {
     3478            continue;
     3479          }
     3480
    34653481          if(pcPic->isILR(pcCU->getLayerId()) && (ePartSize == SIZE_2Nx2N))
    34663482          {
     
    59675983Bool TEncSearch::predInterSearchILRUni( TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv*& rpcPredYuv, TComYuv*& rpcResiYuv, TComYuv*& rpcRecoYuv, UInt refLayerId )
    59685984{
    5969     rpcPredYuv->clear();
    5970     rpcRecoYuv->clear();
    5971 
    5972     Int           iNumPredDir = pcCU->getSlice()->isInterP() ? 1 : 2;
    5973 
    5974     TComMv        cMv[2];
    5975     TComMv        cMvPred[2][33];
    5976     TComMv        cMvTemp[2][33];
    5977     TComMv        TempMv;
    5978 
    5979     Int           iRefIdx[2]={0,0};
    5980 
    5981     Int           aaiMvpIdx[2][33];
    5982     Int           aaiMvpNum[2][33];
    5983 
    5984     UInt          uiMbBits[3] = {1, 1, 0};
    5985     UInt          uiLastMode = 0;
    5986 
    5987     UInt          uiCost[2]   = { MAX_UINT, MAX_UINT };     //uni, rdCost
    5988     UInt          uiCostTemp;
    5989     UInt          biPDistTemp = MAX_INT;
    5990     UInt          uiBitsTemp;
    5991 
    5992     PartSize      ePartSize = pcCU->getPartitionSize( 0 );  //2Nx2N
    5993     Int           iPartIdx  = 0;                            //one PU in CU
    5994     UInt          uiPartAddr;
    5995     Int           iRoiWidth, iRoiHeight;
    5996     Bool          bILRSearched = false;
    5997 
    5998     xGetBlkBits( ePartSize, pcCU->getSlice()->isInterP(), iPartIdx, uiLastMode, uiMbBits);
    5999     pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iRoiWidth, iRoiHeight );
    6000 
    6001     for( Int iRefList = 0; iRefList < iNumPredDir; iRefList++)  //list
    6002     {
    6003         if(bILRSearched)
    6004            continue;
    6005 
    6006         RefPicList  eRefPicList = ( iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0 );
    6007 
    6008         Int  iRefIdxTemp = -1;
    6009         Bool foundILR    = false;
    6010 
    6011         for( Int refIdx = 0; refIdx < pcCU->getSlice()->getNumRefIdx(eRefPicList); refIdx++ )
    6012         {
    6013             if( pcCU->getSlice()->getRefPic(eRefPicList, refIdx)->isILR(pcCU->getLayerId()) && pcCU->getSlice()->getRefPic(eRefPicList, refIdx)->getLayerId() == refLayerId )
    6014             {
    6015                 iRefIdxTemp = refIdx;
    6016                 foundILR    = true;
    6017                 bILRSearched = true;
    6018                 break;
    6019             }
    6020         }
    6021 
    6022         if(!foundILR)  //no ILR in eRefPiclist
    6023         {
    6024             continue; 
    6025         }
    6026 
    6027         uiBitsTemp = uiMbBits[iRefList];
    6028         if ( pcCU->getSlice()->getNumRefIdx(eRefPicList) > 1 )
    6029         {
    6030             uiBitsTemp += iRefIdxTemp+1;
    6031             if ( iRefIdxTemp == pcCU->getSlice()->getNumRefIdx(eRefPicList)-1 ) uiBitsTemp--;
    6032         }
    6033 
    6034         xEstimateMvPredAMVP( pcCU, pcOrgYuv, iPartIdx, eRefPicList, iRefIdxTemp, cMvPred[iRefList][iRefIdxTemp], false, &biPDistTemp);
    6035         aaiMvpIdx[iRefList][iRefIdxTemp] = pcCU->getMVPIdx(eRefPicList, uiPartAddr);
    6036         aaiMvpNum[iRefList][iRefIdxTemp] = pcCU->getMVPNum(eRefPicList, uiPartAddr);
    6037 
    6038         uiBitsTemp += m_auiMVPIdxCost[aaiMvpIdx[iRefList][iRefIdxTemp]][AMVP_MAX_NUM_CANDS];
    6039 
    6040         xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp );
    6041         xCheckBestMVP(pcCU, eRefPicList, cMvTemp[iRefList][iRefIdxTemp], cMvPred[iRefList][iRefIdxTemp], aaiMvpIdx[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp);
    6042 
    6043         if( uiCostTemp < uiCost[iRefList] )
    6044         {
    6045             uiCost[iRefList] = uiCostTemp;
    6046 
    6047             cMv[iRefList]     = cMvTemp[iRefList][iRefIdxTemp];
    6048             iRefIdx[iRefList] = iRefIdxTemp;
    6049 
    6050             pcCU->getCUMvField(eRefPicList)->setAllMv( cMv[iRefList], ePartSize, uiPartAddr, 0, iPartIdx );
    6051             pcCU->getCUMvField(eRefPicList)->setAllRefIdx( iRefIdx[iRefList], ePartSize, uiPartAddr, 0, iPartIdx );
    6052         }
    6053     }
    6054 
    6055     if( uiCost[0] == MAX_UINT && uiCost[1] == MAX_UINT )  //no ILR in both list0 and list1
    6056     {
    6057         return false;
    6058     }
    6059 
    6060     //  Clear Motion Field
    6061     pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvField( TComMvField(), ePartSize, uiPartAddr, 0, iPartIdx );
    6062     pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvField( TComMvField(), ePartSize, uiPartAddr, 0, iPartIdx );
    6063     pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvd    ( TComMv(),      ePartSize, uiPartAddr, 0, iPartIdx );
    6064     pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvd    ( TComMv(),      ePartSize, uiPartAddr, 0, iPartIdx );
    6065 
    6066     pcCU->setMVPIdxSubParts( -1, REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr));
    6067     pcCU->setMVPNumSubParts( -1, REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr));
    6068     pcCU->setMVPIdxSubParts( -1, REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr));
    6069     pcCU->setMVPNumSubParts( -1, REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr));
    6070 
    6071     if( uiCost[0] <= uiCost[1] )  //list0 ILR
    6072     {
    6073         pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMv    ( cMv[0], ePartSize, uiPartAddr, 0, iPartIdx );
    6074         pcCU->getCUMvField(REF_PIC_LIST_0)->setAllRefIdx( iRefIdx[0], ePartSize, uiPartAddr, 0, iPartIdx );
    6075 
    6076         TempMv = cMv[0] - cMvPred[0][iRefIdx[0]];
    6077         pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvd( TempMv, ePartSize, uiPartAddr, 0, iPartIdx );
    6078 
    6079         pcCU->setInterDirSubParts( 1, uiPartAddr, iPartIdx, pcCU->getDepth(0) );
    6080 
    6081         pcCU->setMVPIdxSubParts( aaiMvpIdx[0][iRefIdx[0]], REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr));
    6082         pcCU->setMVPNumSubParts( aaiMvpNum[0][iRefIdx[0]], REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr));
    6083     }
    6084     else if( uiCost[1] < uiCost[0] )  //list1 ILR
    6085     {
    6086         pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMv    ( cMv[1], ePartSize, uiPartAddr, 0, iPartIdx );
    6087         pcCU->getCUMvField(REF_PIC_LIST_1)->setAllRefIdx( iRefIdx[1], ePartSize, uiPartAddr, 0, iPartIdx );
    6088 
    6089         TempMv = cMv[1] - cMvPred[1][iRefIdx[1]];
    6090         pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvd( TempMv, ePartSize, uiPartAddr, 0, iPartIdx );
    6091 
    6092         pcCU->setInterDirSubParts( 2, uiPartAddr, iPartIdx, pcCU->getDepth(0) );
    6093 
    6094         pcCU->setMVPIdxSubParts( aaiMvpIdx[1][iRefIdx[1]], REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr));
    6095         pcCU->setMVPNumSubParts( aaiMvpNum[1][iRefIdx[1]], REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr));
    6096     }
    6097     else
    6098     {
    6099         assert(0);
    6100     }
    6101 
    6102     pcCU->setMergeFlagSubParts( false, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
    6103 
    6104     motionCompensation ( pcCU, rpcPredYuv, REF_PIC_LIST_X, iPartIdx );
    6105     setWpScalingDistParam( pcCU, -1, REF_PIC_LIST_X );
    6106 
    6107     return true;
     5985  rpcPredYuv->clear();
     5986  rpcRecoYuv->clear();
     5987
     5988  Int           iNumPredDir = pcCU->getSlice()->isInterP() ? 1 : 2;
     5989
     5990  TComMv        cMv[2];
     5991  TComMv        cMvPred[2][33];
     5992  TComMv        cMvTemp[2][33];
     5993  TComMv        TempMv;
     5994
     5995  Int           iRefIdx[2]={0,0};
     5996
     5997  Int           aaiMvpIdx[2][33];
     5998  Int           aaiMvpNum[2][33];
     5999
     6000  UInt          uiMbBits[3] = {1, 1, 0};
     6001  UInt          uiLastMode = 0;
     6002
     6003  UInt          uiCost[2]   = { MAX_UINT, MAX_UINT };     //uni, rdCost
     6004  UInt          uiCostTemp;
     6005  UInt          biPDistTemp = MAX_INT;
     6006  UInt          uiBitsTemp;
     6007
     6008  PartSize      ePartSize = pcCU->getPartitionSize( 0 );  //2Nx2N
     6009  Int           iPartIdx  = 0;                            //one PU in CU
     6010  UInt          uiPartAddr;
     6011  Int           iRoiWidth, iRoiHeight;
     6012  Bool          bILRSearched = false;
     6013
     6014  xGetBlkBits( ePartSize, pcCU->getSlice()->isInterP(), iPartIdx, uiLastMode, uiMbBits);
     6015  pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iRoiWidth, iRoiHeight );
     6016
     6017  for( Int iRefList = 0; iRefList < iNumPredDir; iRefList++)  //list
     6018  {
     6019    if(bILRSearched)
     6020    {
     6021      continue;
     6022    }
     6023
     6024    RefPicList  eRefPicList = ( iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0 );
     6025
     6026    Int  iRefIdxTemp = -1;
     6027    Bool foundILR    = false;
     6028
     6029    for( Int refIdx = 0; refIdx < pcCU->getSlice()->getNumRefIdx(eRefPicList); refIdx++ )
     6030    {
     6031      TComPic* refPic = pcCU->getSlice()->getRefPic(eRefPicList, refIdx);
     6032
     6033      // ILRP has to be for the sample prediction type
     6034      if( refPic->isILR(pcCU->getLayerId()) && refPic->getLayerId() == refLayerId && pcCU->getSlice()->getVPS()->isSamplePredictionType( pcCU->getLayerId(), refLayerId ) )
     6035      {
     6036        iRefIdxTemp = refIdx;
     6037        foundILR    = true;
     6038        bILRSearched = true;
     6039        break;
     6040      }
     6041    }
     6042
     6043    if(!foundILR)  //no ILR in eRefPiclist
     6044    {
     6045      continue; 
     6046    }   
     6047
     6048    uiBitsTemp = uiMbBits[iRefList];
     6049    if ( pcCU->getSlice()->getNumRefIdx(eRefPicList) > 1 )
     6050    {
     6051      uiBitsTemp += iRefIdxTemp+1;
     6052      if ( iRefIdxTemp == pcCU->getSlice()->getNumRefIdx(eRefPicList)-1 ) uiBitsTemp--;
     6053    }
     6054
     6055    xEstimateMvPredAMVP( pcCU, pcOrgYuv, iPartIdx, eRefPicList, iRefIdxTemp, cMvPred[iRefList][iRefIdxTemp], false, &biPDistTemp);
     6056    aaiMvpIdx[iRefList][iRefIdxTemp] = pcCU->getMVPIdx(eRefPicList, uiPartAddr);
     6057    aaiMvpNum[iRefList][iRefIdxTemp] = pcCU->getMVPNum(eRefPicList, uiPartAddr);
     6058
     6059    uiBitsTemp += m_auiMVPIdxCost[aaiMvpIdx[iRefList][iRefIdxTemp]][AMVP_MAX_NUM_CANDS];
     6060
     6061    xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp );
     6062    xCheckBestMVP(pcCU, eRefPicList, cMvTemp[iRefList][iRefIdxTemp], cMvPred[iRefList][iRefIdxTemp], aaiMvpIdx[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp);
     6063
     6064    if( uiCostTemp < uiCost[iRefList] )
     6065    {
     6066      uiCost[iRefList] = uiCostTemp;
     6067
     6068      cMv[iRefList]     = cMvTemp[iRefList][iRefIdxTemp];
     6069      iRefIdx[iRefList] = iRefIdxTemp;
     6070
     6071      pcCU->getCUMvField(eRefPicList)->setAllMv( cMv[iRefList], ePartSize, uiPartAddr, 0, iPartIdx );
     6072      pcCU->getCUMvField(eRefPicList)->setAllRefIdx( iRefIdx[iRefList], ePartSize, uiPartAddr, 0, iPartIdx );
     6073    }
     6074  }
     6075
     6076  if( uiCost[0] == MAX_UINT && uiCost[1] == MAX_UINT )  //no ILR in both list0 and list1
     6077  {
     6078    return false;
     6079  }
     6080
     6081  //  Clear Motion Field
     6082  pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvField( TComMvField(), ePartSize, uiPartAddr, 0, iPartIdx );
     6083  pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvField( TComMvField(), ePartSize, uiPartAddr, 0, iPartIdx );
     6084  pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvd    ( TComMv(),      ePartSize, uiPartAddr, 0, iPartIdx );
     6085  pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvd    ( TComMv(),      ePartSize, uiPartAddr, 0, iPartIdx );
     6086
     6087  pcCU->setMVPIdxSubParts( -1, REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr));
     6088  pcCU->setMVPNumSubParts( -1, REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr));
     6089  pcCU->setMVPIdxSubParts( -1, REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr));
     6090  pcCU->setMVPNumSubParts( -1, REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr));
     6091
     6092  if( uiCost[0] <= uiCost[1] )  //list0 ILR
     6093  {
     6094    pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMv    ( cMv[0], ePartSize, uiPartAddr, 0, iPartIdx );
     6095    pcCU->getCUMvField(REF_PIC_LIST_0)->setAllRefIdx( iRefIdx[0], ePartSize, uiPartAddr, 0, iPartIdx );
     6096
     6097    TempMv = cMv[0] - cMvPred[0][iRefIdx[0]];
     6098    pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvd( TempMv, ePartSize, uiPartAddr, 0, iPartIdx );
     6099
     6100    pcCU->setInterDirSubParts( 1, uiPartAddr, iPartIdx, pcCU->getDepth(0) );
     6101
     6102    pcCU->setMVPIdxSubParts( aaiMvpIdx[0][iRefIdx[0]], REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr));
     6103    pcCU->setMVPNumSubParts( aaiMvpNum[0][iRefIdx[0]], REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr));
     6104  }
     6105  else if( uiCost[1] < uiCost[0] )  //list1 ILR
     6106  {
     6107    pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMv    ( cMv[1], ePartSize, uiPartAddr, 0, iPartIdx );
     6108    pcCU->getCUMvField(REF_PIC_LIST_1)->setAllRefIdx( iRefIdx[1], ePartSize, uiPartAddr, 0, iPartIdx );
     6109
     6110    TempMv = cMv[1] - cMvPred[1][iRefIdx[1]];
     6111    pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvd( TempMv, ePartSize, uiPartAddr, 0, iPartIdx );
     6112
     6113    pcCU->setInterDirSubParts( 2, uiPartAddr, iPartIdx, pcCU->getDepth(0) );
     6114
     6115    pcCU->setMVPIdxSubParts( aaiMvpIdx[1][iRefIdx[1]], REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr));
     6116    pcCU->setMVPNumSubParts( aaiMvpNum[1][iRefIdx[1]], REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr));
     6117  }
     6118  else
     6119  {
     6120    assert(0);
     6121  }
     6122
     6123  pcCU->setMergeFlagSubParts( false, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
     6124
     6125  motionCompensation ( pcCU, rpcPredYuv, REF_PIC_LIST_X, iPartIdx );
     6126  setWpScalingDistParam( pcCU, -1, REF_PIC_LIST_X );
     6127
     6128  return true;
    61086129}
    61096130#endif
  • branches/SHM-6-dev/source/Lib/TLibEncoder/TEncSearch.h

    r595 r722  
    126126
    127127#if SVC_EXTENSION
    128   TEncTop**       m_ppcTEncTop;
    129128#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
    130129  Bool            m_disableILP;
    131130#endif
    132 #endif //SVC_EXTENAION
     131#endif //SVC_EXTENSION
    133132
    134133public:
Note: See TracChangeset for help on using the changeset viewer.