Changeset 722 in SHVCSoftware for branches/SHM-6-dev/source/Lib/TLibEncoder
- Timestamp:
- 22 Apr 2014, 09:11:10 (11 years ago)
- 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 1012 1012 if (m_layerId > 0) 1013 1013 { 1014 Int interLayerPredLayerIdcTmp[MAX_VPS_LAYER_ID_PLUS1];1015 Int activeNumILRRefIdxTmp = 0;1014 Int interLayerPredLayerIdcTmp[MAX_VPS_LAYER_ID_PLUS1]; 1015 Int activeNumILRRefIdxTmp = 0; 1016 1016 1017 1017 for( Int i = 0; i < pcSlice->getActiveNumILRRefIdx(); i++ ) 1018 1018 { 1019 1019 UInt refLayerIdc = pcSlice->getInterLayerPredLayerIdc(i); 1020 UInt refLayerId = pcSlice->getVPS()->getRefLayerId(m_layerId, refLayerIdc); 1020 1021 #if VPS_EXTN_DIRECT_REF_LAYERS 1021 1022 TComList<TComPic*> *cListPic = m_ppcTEncTop[m_layerId]->getRefLayerEnc(refLayerIdc)->getListPic(); … … 1041 1042 1042 1043 #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); 1044 1045 #else 1045 1046 const Window &scalEL = m_pcEncTop->getScaledRefLayerWindow(refLayerIdc); … … 1089 1090 #endif 1090 1091 #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 { 1093 1097 #if P0312_VERT_PHASE_ADJ 1094 //when PhasePositionEnableFlag is equal to 1, set vertPhasePositionFlag to 0 if BL is top field and 1 if bottom1095 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 } 1099 1103 #endif 1100 1104 #if O0215_PHASE_ALIGNMENT 1101 1105 #if O0194_JOINT_US_BITSHIFT 1102 1106 #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() ); 1106 1110 #endif 1107 1111 #else 1108 1112 #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() ); 1112 1116 #endif 1113 1117 #endif … … 1115 1119 #if O0194_JOINT_US_BITSHIFT 1116 1120 #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 ); 1120 1124 #endif 1121 1125 #else 1122 1126 #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 } 1129 1134 } 1130 1135 else … … 1154 1159 pcSlice->setInterLayerPredEnabledFlag(false); 1155 1160 } 1156 1161 1157 1162 if( pocCurr % m_pcCfg->getIntraPeriod() == 0 ) 1158 1163 { … … 1173 1178 else 1174 1179 #endif 1175 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_CRA);1180 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_CRA); 1176 1181 1177 1182 #if IDR_ALIGNMENT … … 1188 1193 #endif 1189 1194 } 1190 1195 1191 1196 if( pcSlice->getActiveNumILRRefIdx() == 0 && pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA ) 1192 1197 { … … 1196 1201 { 1197 1202 if( (pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP) && 1198 1199 1203 (pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA) && 1204 pcSlice->getSliceType() == B_SLICE ) 1200 1205 { 1201 1206 pcSlice->setSliceType(P_SLICE); 1202 1207 } 1203 } 1208 } 1204 1209 } 1205 1210 #endif //#if SVC_EXTENSION … … 1471 1476 if( m_layerId > 0 && pcSlice->getActiveNumILRRefIdx() ) 1472 1477 { 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 1473 1498 #if POC_RESET_FLAG 1474 1499 if ( pocCurr > 0 && pcSlice->isRADL() && pcPic->getSlice(0)->getBaseColPic(pcPic->getSlice(0)->getInterLayerPredLayerIdc(0))->getSlice(0)->isRASL()) … … 1567 1592 pcSlice->setColFromL0Flag(ColFromL0Flag); 1568 1593 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 } 1569 1646 } 1570 1647 } -
branches/SHM-6-dev/source/Lib/TLibEncoder/TEncSearch.cpp
r652 r722 3222 3222 for ( Int iRefIdxTemp = 0; iRefIdxTemp < pcCU->getSlice()->getNumRefIdx(eRefPicList); iRefIdxTemp++ ) 3223 3223 { 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 3224 3233 #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 ) 3226 3235 { 3227 3236 continue; 3228 3237 } 3229 3238 #endif 3230 #if (ENCODER_FAST_MODE) 3231 TComPic* pcPic = pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxTemp ); 3239 #if (ENCODER_FAST_MODE) 3232 3240 if( pcPic->isILR(pcCU->getLayerId()) && (ePartSize == SIZE_2Nx2N) ) 3233 3241 { 3234 3242 continue; 3235 3243 } 3244 #endif 3236 3245 #endif 3237 3246 … … 3462 3471 #if (ENCODER_FAST_MODE) 3463 3472 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 3465 3481 if(pcPic->isILR(pcCU->getLayerId()) && (ePartSize == SIZE_2Nx2N)) 3466 3482 { … … 5967 5983 Bool TEncSearch::predInterSearchILRUni( TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv*& rpcPredYuv, TComYuv*& rpcResiYuv, TComYuv*& rpcRecoYuv, UInt refLayerId ) 5968 5984 { 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; 6108 6129 } 6109 6130 #endif -
branches/SHM-6-dev/source/Lib/TLibEncoder/TEncSearch.h
r595 r722 126 126 127 127 #if SVC_EXTENSION 128 TEncTop** m_ppcTEncTop;129 128 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI 130 129 Bool m_disableILP; 131 130 #endif 132 #endif //SVC_EXTEN AION131 #endif //SVC_EXTENSION 133 132 134 133 public:
Note: See TracChangeset for help on using the changeset viewer.