Changeset 1469 in SHVCSoftware


Ignore:
Timestamp:
9 Sep 2015, 18:16:24 (9 years ago)
Author:
seregin
Message:

port rev 4598

Location:
branches/SHM-dev/source/Lib
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-dev/source/Lib/TLibCommon/TComRdCost.cpp

    r1397 r1469  
    165165  m_costMode                   = COST_STANDARD_LOSSY;
    166166
    167   m_dCost                      = 0;
     167  m_motionLambda               = 0;
    168168  m_iCostScale                 = 0;
    169169}
  • branches/SHM-dev/source/Lib/TLibCommon/TComRdCost.h

    r1398 r1469  
    125125  // for motion cost
    126126  TComMv                  m_mvPredictor;
    127   Double                  m_dCost;
     127  Double                  m_motionLambda;
    128128  Int                     m_iCostScale;
    129129
     
    157157  // for motion cost
    158158  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); }
    160160  Void    setPredictor( TComMv& rcMv )
    161161  {
     
    163163  }
    164164  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 )
    166167  {
    167     return Distortion((m_dCost * getBits(x, y)) / 65536.0);
     168    return Distortion((m_motionLambda * getBitsOfVectorWithPredictor(x, y)) / 65536.0);
    168169  }
    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 )
    171171  {
    172172    return xGetExpGolombNumberOfBits((x << m_iCostScale) - m_mvPredictor.getHor())
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncSearch.cpp

    r1465 r1469  
    328328    Int isubShift = 0;
    329329    // motion cost
    330     Distortion uiBitCost = m_pcRdCost->getCost( iSearchX, iSearchY );
     330    Distortion uiBitCost = m_pcRdCost->getCostOfVectorWithPredictor( iSearchX, iSearchY );
    331331
    332332    // Skip search if bit cost is already larger than best SAD
     
    404404    {
    405405      // motion cost
    406       uiSad += m_pcRdCost->getCost( iSearchX, iSearchY );
     406      uiSad += m_pcRdCost->getCostOfVectorWithPredictor( iSearchX, iSearchY );
    407407
    408408      if( uiSad < rcStruct.uiBestSad )
     
    862862    m_cDistParam.bitDepth = pcPatternKey->getBitDepthY();
    863863    uiDist = m_cDistParam.DistFunc( &m_cDistParam );
    864     uiDist += m_pcRdCost->getCost( cMvTest.getHor(), cMvTest.getVer() );
     864    uiDist += m_pcRdCost->getCostOfVectorWithPredictor( cMvTest.getHor(), cMvTest.getVer() );
    865865
    866866    if ( uiDist < uiDistBest )
     
    31583158            /*correct the bit-rate part of the current ref*/
    31593159            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() );
    31613161            /*calculate the correct cost*/
    31623162            uiCostTemp += m_pcRdCost->getCost( uiBitsTemp );
     
    35093509      TComMvField cMEMvField[2];
    35103510
    3511       m_pcRdCost->getMotionCost( true, 0, pcCU->getCUTransquantBypass(uiPartAddr) );
     3511      m_pcRdCost->selectMotionLambda( true, 0, pcCU->getCUTransquantBypass(uiPartAddr) );
    35123512
    35133513#if AMP_MRG
     
    37453745  }
    37463746
    3747   m_pcRdCost->getMotionCost( true, 0, pcCU->getCUTransquantBypass(0) );
     3747  m_pcRdCost->selectMotionLambda( true, 0, pcCU->getCUTransquantBypass(0) );
    37483748  m_pcRdCost->setCostScale ( 0    );
    37493749
     
    37513751
    37523752  m_pcRdCost->setPredictor( rcMvPred );
    3753   Int iOrgMvBits  = m_pcRdCost->getBits(cMv.getHor(), cMv.getVer());
     3753  Int iOrgMvBits  = m_pcRdCost->getBitsOfVectorWithPredictor(cMv.getHor(), cMv.getVer());
    37543754  iOrgMvBits += m_auiMVPIdxCost[riMVPIdx][AMVP_MAX_NUM_CANDS];
    37553755  Int iBestMvBits = iOrgMvBits;
     
    37643764    m_pcRdCost->setPredictor( pcAMVPInfo->m_acMvCand[iMVPIdx] );
    37653765
    3766     Int iMvBits = m_pcRdCost->getBits(cMv.getHor(), cMv.getVer());
     3766    Int iMvBits = m_pcRdCost->getBitsOfVectorWithPredictor(cMv.getHor(), cMv.getVer());
    37673767    iMvBits += m_auiMVPIdxCost[iMVPIdx][AMVP_MAX_NUM_CANDS];
    37683768
     
    39113911  }
    39123912
    3913   m_pcRdCost->getMotionCost( true, 0, pcCU->getCUTransquantBypass(uiPartAddr) );
     3913  m_pcRdCost->selectMotionLambda( true, 0, pcCU->getCUTransquantBypass(uiPartAddr) );
    39143914
    39153915  m_pcRdCost->setPredictor  ( *pcMvPred );
     
    39493949#endif
    39503950
    3951   m_pcRdCost->getMotionCost( true, 0, pcCU->getCUTransquantBypass(uiPartAddr) );
     3951  m_pcRdCost->selectMotionLambda( true, 0, pcCU->getCUTransquantBypass(uiPartAddr) );
    39523952  m_pcRdCost->setCostScale ( 1 );
    39533953
     
    39683968  rcMv +=  cMvQter;
    39693969
    3970   UInt uiMvBits = m_pcRdCost->getBits( rcMv.getHor(), rcMv.getVer() );
     3970  UInt uiMvBits = m_pcRdCost->getBitsOfVectorWithPredictor( rcMv.getHor(), rcMv.getVer() );
    39713971
    39723972  ruiBits      += uiMvBits;
     
    40444044
    40454045      // motion cost
    4046       uiSad += m_pcRdCost->getCost( x, y );
     4046      uiSad += m_pcRdCost->getCostOfVectorWithPredictor( x, y );
    40474047
    40484048      if ( uiSad < uiSadBest )
     
    40594059  rcMv.set( iBestX, iBestY );
    40604060
    4061   ruiSAD = uiSadBest - m_pcRdCost->getCost( iBestX, iBestY );
     4061  ruiSAD = uiSadBest - m_pcRdCost->getCostOfVectorWithPredictor( iBestX, iBestY );
    40624062  return;
    40634063}
     
    44024402  // write out best match
    44034403  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 );
    44054405}
    44064406
     
    45794579  // write out best match
    45804580  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 );
    45824582
    45834583}
     
    59685968  setDistParamComp(COMPONENT_Y);
    59695969  ruiCost = m_cDistParam.DistFunc( &m_cDistParam );  //SATD
    5970   ruiCost += m_pcRdCost->getCost( pcMvInt->getHor(), pcMvInt->getVer() );  //SATD rdCost
     5970  ruiCost += m_pcRdCost->getCostOfVectorWithPredictor( pcMvInt->getHor(), pcMvInt->getVer() );  //SATD rdCost
    59715971  rcMvHalf.setZero();
    59725972  rcMvQter.setZero();
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncSearch.h

    r1444 r1469  
    102102  MESearchMethod  m_motionEstimationSearchMethod;
    103103  Int             m_aaiAdaptSR[MAX_NUM_REF_LIST_ADAPT_SR][MAX_IDX_ADAPT_SR];
    104   TComMv          m_cSrchRngLT;
    105   TComMv          m_cSrchRngRB;
    106104  TComMv          m_acMvPredictors[NUM_MV_PREDICTORS]; // Left, Above, AboveRight. enum MVP_DIR first NUM_MV_PREDICTORS entries are suitable for accessing.
    107105
Note: See TracChangeset for help on using the changeset viewer.