Changeset 655 in 3DVCSoftware for trunk/source/Lib/TLibEncoder/TEncSlice.cpp


Ignore:
Timestamp:
23 Oct 2013, 23:01:30 (11 years ago)
Author:
tech
Message:

Merged 8.1-Cleanup@654

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/Lib/TLibEncoder/TEncSlice.cpp

    r622 r655  
    157157  m_pdRdPicQp         = (Double*)xMalloc( Double, m_pcCfg->getDeltaQpRD() * 2 + 1 );
    158158  m_piRdPicQp         = (Int*   )xMalloc( Int,    m_pcCfg->getDeltaQpRD() * 2 + 1 );
     159#if KWU_RC_MADPRED_E0227
     160  if(m_pcCfg->getUseRateCtrl())
     161  {
     162    m_pcRateCtrl        = pcEncTop->getRateCtrl();
     163  }
     164  else
     165  {
     166    m_pcRateCtrl        = NULL;
     167  }
     168#else
    159169  m_pcRateCtrl        = pcEncTop->getRateCtrl();
     170#endif
    160171}
    161172
     
    176187 \param pPPS          PPS associated with the slice
    177188 */
    178 #if H_MV5
    179189#if H_MV
    180 Void TEncSlice::initEncSlice( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, TComVPS* pVPS, TComSPS* pSPS, TComPPS *pPPS, Int layerId )
    181 #else
    182 Void TEncSlice::initEncSlice( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, TComSPS* pSPS, TComPPS *pPPS )
    183 #endif
    184 #else
    185 #if H_3D
    186 Void TEncSlice::initEncSlice( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, TComVPS* pVPS, TComSPS* pSPS, TComPPS *pPPS, Int layerId )
    187 #else
    188 Void TEncSlice::initEncSlice( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, TComSPS* pSPS, TComPPS *pPPS )
    189 #endif
     190Void TEncSlice::initEncSlice( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, TComVPS* pVPS, TComSPS* pSPS, TComPPS *pPPS, Int layerId, bool isField )
     191#else
     192Void TEncSlice::initEncSlice( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, TComSPS* pSPS, TComPPS *pPPS, bool isField )
    190193#endif
    191194{
     
    195198  rpcSlice = pcPic->getSlice(0);
    196199
    197 #if H_MV5
     200#if H_MV
    198201  rpcSlice->setVPS( pVPS );
    199202
     
    203206#if H_3D
    204207  rpcSlice->setIsDepth     ( pVPS->getDepthId     ( layerId ) != 0 );   
    205 #endif
    206 #else
    207 #if H_3D
    208   // GT: Should also be activated for MV-HEVC at some stage
    209   rpcSlice->setVPS( pVPS );
    210   Int vpsLayerId = pVPS->getLayerIdInNuh( layerId );
    211 
    212   rpcSlice->setLayerId     ( layerId );
    213   rpcSlice->setViewId      ( pVPS->getViewId      ( vpsLayerId ) );   
    214   rpcSlice->setViewIndex   ( pVPS->getViewIndex   ( vpsLayerId ) );
    215   rpcSlice->setIsDepth     ( pVPS->getDepthId     ( vpsLayerId ) != 0 );   
    216208#endif
    217209#endif
     
    342334    Int    NumberBFrames = ( m_pcCfg->getGOPSize() - 1 );
    343335    Int    SHIFT_QP = 12;
    344     Double dLambda_scale = 1.0 - Clip3( 0.0, 0.5, 0.05*(Double)NumberBFrames );
     336    Double dLambda_scale = 1.0 - Clip3( 0.0, 0.5, 0.05*(Double)(isField ? NumberBFrames/2 : NumberBFrames) );
    345337#if FULL_NBIT
    346338    Int    bitdepth_luma_qp_scale = 6 * (g_bitDepth - 8);
     
    11251117    if(m_pcCfg->getUseRateCtrl())
    11261118    {
     1119#if KWU_RC_MADPRED_E0227
     1120      if(pcSlice->getLayerId() != 0 && m_pcCfg->getUseDepthMADPred() && !pcSlice->getIsDepth())
     1121      {
     1122        Double zn, zf, focallength, position, camshift;
     1123        Double basepos;
     1124        Bool bInterpolated;
     1125        Int direction = pcSlice->getViewId() - pcCU->getSlice()->getIvPic(false, 0)->getViewId();
     1126
     1127        pcEncTop->getCamParam()->xGetZNearZFar(pcEncTop->getCamParam()->getBaseViewNumbers()[pcSlice->getViewIndex()], pcSlice->getPOC(), zn, zf);
     1128        pcEncTop->getCamParam()->xGetGeometryData(pcEncTop->getCamParam()->getBaseViewNumbers()[0], pcSlice->getPOC(), focallength, basepos, camshift, bInterpolated);
     1129        pcEncTop->getCamParam()->xGetGeometryData(pcEncTop->getCamParam()->getBaseViewNumbers()[pcSlice->getViewIndex()], pcSlice->getPOC(), focallength, position, camshift, bInterpolated);
     1130
     1131        m_pcRateCtrl->updateLCUDataEnhancedView(pcCU, pcCU->getTotalBits(), pcCU->getQP(0), basepos, position, focallength, zn, zf, (direction > 0 ? 1 : -1));
     1132      }
     1133#endif
    11271134      if(m_pcRateCtrl->calculateUnitQP())
    11281135      {
     
    12231230        else
    12241231        {
     1232#if KWU_RC_MADPRED_E0227
     1233          if(pcSlice->getLayerId() != 0 && m_pcCfg->getUseDepthMADPred() && !pcSlice->getIsDepth())
     1234          {
     1235            Double zn, zf, focallength, position, camShift;
     1236            Double basePos;
     1237            Bool bInterpolated;
     1238            Int direction = pcSlice->getViewId() - pcCU->getSlice()->getIvPic(false, 0)->getViewId();
     1239            Int disparity;
     1240
     1241            pcEncTop->getCamParam()->xGetZNearZFar(pcEncTop->getCamParam()->getBaseViewNumbers()[pcSlice->getViewIndex()], pcSlice->getPOC(), zn, zf);
     1242            pcEncTop->getCamParam()->xGetGeometryData(pcEncTop->getCamParam()->getBaseViewNumbers()[0], pcSlice->getPOC(), focallength, basePos, camShift, bInterpolated);
     1243            pcEncTop->getCamParam()->xGetGeometryData(pcEncTop->getCamParam()->getBaseViewNumbers()[pcSlice->getViewIndex()], pcSlice->getPOC(), focallength, position, camShift, bInterpolated);
     1244            bpp       = m_pcRateCtrl->getRCPic()->getLCUTargetBppforInterView( m_pcRateCtrl->getPicList(), pcCU,
     1245              basePos, position, focallength, zn, zf, (direction > 0 ? 1 : -1), &disparity );
     1246          }
     1247          else
     1248          {
     1249#endif
    12251250#if RATE_CONTROL_INTRA
    12261251          bpp = m_pcRateCtrl->getRCPic()->getLCUTargetBpp(pcSlice->getSliceType());
     
    12391264          estQP     = m_pcRateCtrl->getRCPic()->getLCUEstQP    ( estLambda, pcSlice->getSliceQp() );
    12401265#endif
    1241 
     1266#if KWU_RC_MADPRED_E0227
     1267          }
     1268#endif
     1269#if KWU_RC_MADPRED_E0227
     1270          estLambda = m_pcRateCtrl->getRCPic()->getLCUEstLambda( bpp );
     1271          estQP     = m_pcRateCtrl->getRCPic()->getLCUEstQP    ( estLambda, pcSlice->getSliceQp() );
     1272#endif
    12421273          estQP     = Clip3( -pcSlice->getSPS()->getQpBDOffsetY(), MAX_QP, estQP );
    12431274
     
    13431374      if ( m_pcCfg->getUseRateCtrl() )
    13441375      {
    1345 #if !M0036_RC_IMPROVEMENT
     1376#if !M0036_RC_IMPROVEMENT || KWU_RC_MADPRED_E0227
    13461377        UInt SAD    = m_pcCuEncoder->getLCUPredictionSAD();
    13471378        Int height  = min( pcSlice->getSPS()->getMaxCUHeight(),pcSlice->getSPS()->getPicHeightInLumaSamples() - uiCUAddr / rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUHeight() );
Note: See TracChangeset for help on using the changeset viewer.