Changeset 1469 in SHVCSoftware
- Timestamp:
- 9 Sep 2015, 18:16:24 (9 years ago)
- Location:
- branches/SHM-dev/source/Lib
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-dev/source/Lib/TLibCommon/TComRdCost.cpp
r1397 r1469 165 165 m_costMode = COST_STANDARD_LOSSY; 166 166 167 m_ dCost= 0;167 m_motionLambda = 0; 168 168 m_iCostScale = 0; 169 169 } -
branches/SHM-dev/source/Lib/TLibCommon/TComRdCost.h
r1398 r1469 125 125 // for motion cost 126 126 TComMv m_mvPredictor; 127 Double m_ dCost;127 Double m_motionLambda; 128 128 Int m_iCostScale; 129 129 … … 157 157 // for motion cost 158 158 static UInt xGetExpGolombNumberOfBits( Int iVal ); 159 Void getMotionCost( Bool bSad, Int iAdd, Bool bIsTransquantBypass ) { m_dCost= (bSad ? m_dLambdaMotionSAD[(bIsTransquantBypass && m_costMode==COST_MIXED_LOSSLESS_LOSSY_CODING) ?1:0] + iAdd : m_dLambdaMotionSSE[(bIsTransquantBypass && m_costMode==COST_MIXED_LOSSLESS_LOSSY_CODING)?1:0] + iAdd); }159 Void selectMotionLambda( Bool bSad, Int iAdd, Bool bIsTransquantBypass ) { m_motionLambda = (bSad ? m_dLambdaMotionSAD[(bIsTransquantBypass && m_costMode==COST_MIXED_LOSSLESS_LOSSY_CODING) ?1:0] + iAdd : m_dLambdaMotionSSE[(bIsTransquantBypass && m_costMode==COST_MIXED_LOSSLESS_LOSSY_CODING)?1:0] + iAdd); } 160 160 Void setPredictor( TComMv& rcMv ) 161 161 { … … 163 163 } 164 164 Void setCostScale( Int iCostScale ) { m_iCostScale = iCostScale; } 165 __inline Distortion getCost( Int x, Int y ) 165 Distortion getCost( UInt b ) { return Distortion(( m_motionLambda * b ) / 65536.0); } 166 Distortion getCostOfVectorWithPredictor( const Int x, const Int y ) 166 167 { 167 return Distortion((m_ dCost * getBits(x, y)) / 65536.0);168 return Distortion((m_motionLambda * getBitsOfVectorWithPredictor(x, y)) / 65536.0); 168 169 } 169 Distortion getCost( UInt b ) { return Distortion(( m_dCost * b ) / 65536.0); } 170 UInt getBits( Int x, Int y ) 170 UInt getBitsOfVectorWithPredictor( const Int x, const Int y ) 171 171 { 172 172 return xGetExpGolombNumberOfBits((x << m_iCostScale) - m_mvPredictor.getHor()) -
branches/SHM-dev/source/Lib/TLibEncoder/TEncSearch.cpp
r1465 r1469 328 328 Int isubShift = 0; 329 329 // motion cost 330 Distortion uiBitCost = m_pcRdCost->getCost ( iSearchX, iSearchY );330 Distortion uiBitCost = m_pcRdCost->getCostOfVectorWithPredictor( iSearchX, iSearchY ); 331 331 332 332 // Skip search if bit cost is already larger than best SAD … … 404 404 { 405 405 // motion cost 406 uiSad += m_pcRdCost->getCost ( iSearchX, iSearchY );406 uiSad += m_pcRdCost->getCostOfVectorWithPredictor( iSearchX, iSearchY ); 407 407 408 408 if( uiSad < rcStruct.uiBestSad ) … … 862 862 m_cDistParam.bitDepth = pcPatternKey->getBitDepthY(); 863 863 uiDist = m_cDistParam.DistFunc( &m_cDistParam ); 864 uiDist += m_pcRdCost->getCost ( cMvTest.getHor(), cMvTest.getVer() );864 uiDist += m_pcRdCost->getCostOfVectorWithPredictor( cMvTest.getHor(), cMvTest.getVer() ); 865 865 866 866 if ( uiDist < uiDistBest ) … … 3158 3158 /*correct the bit-rate part of the current ref*/ 3159 3159 m_pcRdCost->setPredictor ( cMvPred[iRefList][iRefIdxTemp] ); 3160 uiBitsTemp += m_pcRdCost->getBits ( cMvTemp[1][iRefIdxTemp].getHor(), cMvTemp[1][iRefIdxTemp].getVer() );3160 uiBitsTemp += m_pcRdCost->getBitsOfVectorWithPredictor( cMvTemp[1][iRefIdxTemp].getHor(), cMvTemp[1][iRefIdxTemp].getVer() ); 3161 3161 /*calculate the correct cost*/ 3162 3162 uiCostTemp += m_pcRdCost->getCost( uiBitsTemp ); … … 3509 3509 TComMvField cMEMvField[2]; 3510 3510 3511 m_pcRdCost-> getMotionCost( true, 0, pcCU->getCUTransquantBypass(uiPartAddr) );3511 m_pcRdCost->selectMotionLambda( true, 0, pcCU->getCUTransquantBypass(uiPartAddr) ); 3512 3512 3513 3513 #if AMP_MRG … … 3745 3745 } 3746 3746 3747 m_pcRdCost-> getMotionCost( true, 0, pcCU->getCUTransquantBypass(0) );3747 m_pcRdCost->selectMotionLambda( true, 0, pcCU->getCUTransquantBypass(0) ); 3748 3748 m_pcRdCost->setCostScale ( 0 ); 3749 3749 … … 3751 3751 3752 3752 m_pcRdCost->setPredictor( rcMvPred ); 3753 Int iOrgMvBits = m_pcRdCost->getBits (cMv.getHor(), cMv.getVer());3753 Int iOrgMvBits = m_pcRdCost->getBitsOfVectorWithPredictor(cMv.getHor(), cMv.getVer()); 3754 3754 iOrgMvBits += m_auiMVPIdxCost[riMVPIdx][AMVP_MAX_NUM_CANDS]; 3755 3755 Int iBestMvBits = iOrgMvBits; … … 3764 3764 m_pcRdCost->setPredictor( pcAMVPInfo->m_acMvCand[iMVPIdx] ); 3765 3765 3766 Int iMvBits = m_pcRdCost->getBits (cMv.getHor(), cMv.getVer());3766 Int iMvBits = m_pcRdCost->getBitsOfVectorWithPredictor(cMv.getHor(), cMv.getVer()); 3767 3767 iMvBits += m_auiMVPIdxCost[iMVPIdx][AMVP_MAX_NUM_CANDS]; 3768 3768 … … 3911 3911 } 3912 3912 3913 m_pcRdCost-> getMotionCost( true, 0, pcCU->getCUTransquantBypass(uiPartAddr) );3913 m_pcRdCost->selectMotionLambda( true, 0, pcCU->getCUTransquantBypass(uiPartAddr) ); 3914 3914 3915 3915 m_pcRdCost->setPredictor ( *pcMvPred ); … … 3949 3949 #endif 3950 3950 3951 m_pcRdCost-> getMotionCost( true, 0, pcCU->getCUTransquantBypass(uiPartAddr) );3951 m_pcRdCost->selectMotionLambda( true, 0, pcCU->getCUTransquantBypass(uiPartAddr) ); 3952 3952 m_pcRdCost->setCostScale ( 1 ); 3953 3953 … … 3968 3968 rcMv += cMvQter; 3969 3969 3970 UInt uiMvBits = m_pcRdCost->getBits ( rcMv.getHor(), rcMv.getVer() );3970 UInt uiMvBits = m_pcRdCost->getBitsOfVectorWithPredictor( rcMv.getHor(), rcMv.getVer() ); 3971 3971 3972 3972 ruiBits += uiMvBits; … … 4044 4044 4045 4045 // motion cost 4046 uiSad += m_pcRdCost->getCost ( x, y );4046 uiSad += m_pcRdCost->getCostOfVectorWithPredictor( x, y ); 4047 4047 4048 4048 if ( uiSad < uiSadBest ) … … 4059 4059 rcMv.set( iBestX, iBestY ); 4060 4060 4061 ruiSAD = uiSadBest - m_pcRdCost->getCost ( iBestX, iBestY );4061 ruiSAD = uiSadBest - m_pcRdCost->getCostOfVectorWithPredictor( iBestX, iBestY ); 4062 4062 return; 4063 4063 } … … 4402 4402 // write out best match 4403 4403 rcMv.set( cStruct.iBestX, cStruct.iBestY ); 4404 ruiSAD = cStruct.uiBestSad - m_pcRdCost->getCost ( cStruct.iBestX, cStruct.iBestY );4404 ruiSAD = cStruct.uiBestSad - m_pcRdCost->getCostOfVectorWithPredictor( cStruct.iBestX, cStruct.iBestY ); 4405 4405 } 4406 4406 … … 4579 4579 // write out best match 4580 4580 rcMv.set( cStruct.iBestX, cStruct.iBestY ); 4581 ruiSAD = cStruct.uiBestSad - m_pcRdCost->getCost ( cStruct.iBestX, cStruct.iBestY );4581 ruiSAD = cStruct.uiBestSad - m_pcRdCost->getCostOfVectorWithPredictor( cStruct.iBestX, cStruct.iBestY ); 4582 4582 4583 4583 } … … 5968 5968 setDistParamComp(COMPONENT_Y); 5969 5969 ruiCost = m_cDistParam.DistFunc( &m_cDistParam ); //SATD 5970 ruiCost += m_pcRdCost->getCost ( pcMvInt->getHor(), pcMvInt->getVer() ); //SATD rdCost5970 ruiCost += m_pcRdCost->getCostOfVectorWithPredictor( pcMvInt->getHor(), pcMvInt->getVer() ); //SATD rdCost 5971 5971 rcMvHalf.setZero(); 5972 5972 rcMvQter.setZero(); -
branches/SHM-dev/source/Lib/TLibEncoder/TEncSearch.h
r1444 r1469 102 102 MESearchMethod m_motionEstimationSearchMethod; 103 103 Int m_aaiAdaptSR[MAX_NUM_REF_LIST_ADAPT_SR][MAX_IDX_ADAPT_SR]; 104 TComMv m_cSrchRngLT;105 TComMv m_cSrchRngRB;106 104 TComMv m_acMvPredictors[NUM_MV_PREDICTORS]; // Left, Above, AboveRight. enum MVP_DIR first NUM_MV_PREDICTORS entries are suitable for accessing. 107 105
Note: See TracChangeset for help on using the changeset viewer.