Changeset 442 in SHVCSoftware for trunk/source/Lib/TLibEncoder/TEncSlice.cpp


Ignore:
Timestamp:
21 Oct 2013, 13:41:29 (11 years ago)
Author:
seregin
Message:

reintegrate SHM-3.1-dev branch

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/source

  • trunk/source/Lib/TLibEncoder/TEncSlice.cpp

    r345 r442  
    180180#if SVC_EXTENSION
    181181//\param vps          VPS associated with the slice
    182 Void TEncSlice::initEncSlice( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, TComSPS* pSPS, TComPPS *pPPS, TComVPS *vps )
    183 #else
    184 Void TEncSlice::initEncSlice( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, TComSPS* pSPS, TComPPS *pPPS )
     182Void TEncSlice::initEncSlice( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, TComSPS* pSPS, TComPPS *pPPS, TComVPS *vps, Bool isField )
     183#else
     184Void TEncSlice::initEncSlice( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, TComSPS* pSPS, TComPPS *pPPS, Bool isField )
    185185#endif
    186186{
     
    260260  if(eSliceType!=I_SLICE)
    261261  {
     262#if REPN_FORMAT_IN_VPS
     263    if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getQpBDOffsetY() ) && (rpcSlice->getSPS()->getUseLossless())))
     264#else
    262265    if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getSPS()->getQpBDOffsetY() ) && (rpcSlice->getSPS()->getUseLossless())))
     266#endif
    263267    {
    264268      dQP += m_pcCfg->getGOPEntry(iGOPid).m_QPOffset;
     
    294298    Int    NumberBFrames = ( m_pcCfg->getGOPSize() - 1 );
    295299    Int    SHIFT_QP = 12;
    296     Double dLambda_scale = 1.0 - Clip3( 0.0, 0.5, 0.05*(Double)NumberBFrames );
     300
     301    Double dLambda_scale = 1.0 - Clip3( 0.0, 0.5, 0.05*(Double)(isField ? NumberBFrames/2 : NumberBFrames) );
     302
    297303#if FULL_NBIT
    298304    Int    bitdepth_luma_qp_scale = 6 * (g_bitDepth - 8);
     
    327333    }
    328334   
     335#if REPN_FORMAT_IN_VPS
     336    iQP = max( -rpcSlice->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );
     337#else
    329338    iQP = max( -pSPS->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );
     339#endif
    330340
    331341    m_pdRdPicLambda[iDQpIdx] = dLambda;
     
    400410  eSliceType = (pocLast == 0 || pocCurr % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType;
    401411 
    402 #if REF_IDX_FRAMEWORK
     412#if SVC_EXTENSION
    403413  if(m_pcCfg->getLayerId() > 0)
    404414  {
     
    412422  {
    413423    dQP = xGetQPValueAccordingToLambda( dLambda );
     424#if REPN_FORMAT_IN_VPS
     425    iQP = max( -rpcSlice->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );   
     426#else
    414427    iQP = max( -pSPS->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );   
     428#endif
    415429  }
    416430
     
    467481 
    468482  pcPic->setTLayer( m_pcCfg->getGOPEntry(iGOPid).m_temporalId );
     483#if TEMP_SCALABILITY_FIX
     484  if((eSliceType==I_SLICE) || (rpcSlice->getPOC() == 0))
     485#else
    469486  if(eSliceType==I_SLICE)
     487#endif
    470488  {
    471489    pcPic->setTLayer(0);
     
    485503  xStoreWPparam( pPPS->getUseWP(), pPPS->getWPBiPred() );
    486504
    487 #if SVC_EXTENSION && REF_IDX_FRAMEWORK
     505#if SVC_EXTENSION
    488506  if( layerId > 0 )
    489507  {
     
    606624    }
    607625
     626#if REPN_FORMAT_IN_VPS
     627    qp = max( -pcSlice->getQpBDOffsetY(), min( MAX_QP, (Int) floor( recalQP + 0.5 ) ) );
     628#else
    608629    qp = max( -pcSPS->getQpBDOffsetY(), min( MAX_QP, (Int) floor( recalQP + 0.5 ) ) );
     630#endif
    609631
    610632    m_pdRdPicLambda[deltqQpIdx] = lambda;
     
    849871    pcCU->initCU( rpcPic, uiCUAddr );
    850872
     873#if REPN_FORMAT_IN_VPS
     874    Int height  = min( pcSlice->getSPS()->getMaxCUHeight(),pcSlice->getPicHeightInLumaSamples() - uiCUAddr / rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUHeight() );
     875    Int width   = min( pcSlice->getSPS()->getMaxCUWidth(), pcSlice->getPicWidthInLumaSamples() - uiCUAddr % rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUWidth() );
     876#else
    851877    Int height  = min( pcSlice->getSPS()->getMaxCUHeight(),pcSlice->getSPS()->getPicHeightInLumaSamples() - uiCUAddr / rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUHeight() );
    852878    Int width   = min( pcSlice->getSPS()->getMaxCUWidth(),pcSlice->getSPS()->getPicWidthInLumaSamples() - uiCUAddr % rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUWidth() );
     879#endif
    853880
    854881    iSumHad = m_pcCuEncoder->updateLCUDataISlice(pcCU, uiCUAddr, width, height);
     
    11481175#endif
    11491176
     1177#if REPN_FORMAT_IN_VPS
     1178          estQP     = Clip3( -pcSlice->getQpBDOffsetY(), MAX_QP, estQP );
     1179#else
    11501180          estQP     = Clip3( -pcSlice->getSPS()->getQpBDOffsetY(), MAX_QP, estQP );
     1181#endif
    11511182
    11521183          m_pcRdCost->setLambda(estLambda);
     
    11761207#if !M0036_RC_IMPROVEMENT
    11771208        UInt SAD    = m_pcCuEncoder->getLCUPredictionSAD();
     1209#if REPN_FORMAT_IN_VPS
     1210        Int height  = min( pcSlice->getSPS()->getMaxCUHeight(),pcSlice->getPicHeightInLumaSamples() - uiCUAddr / rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUHeight() );
     1211        Int width   = min( pcSlice->getSPS()->getMaxCUWidth(),pcSlice->>getPicWidthInLumaSamples() - uiCUAddr % rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUWidth() );
     1212#else
    11781213        Int height  = min( pcSlice->getSPS()->getMaxCUHeight(),pcSlice->getSPS()->getPicHeightInLumaSamples() - uiCUAddr / rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUHeight() );
    11791214        Int width   = min( pcSlice->getSPS()->getMaxCUWidth(),pcSlice->getSPS()->getPicWidthInLumaSamples() - uiCUAddr % rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUWidth() );
     1215#endif
    11801216        Double MAD = (Double)SAD / (Double)(height * width);
    11811217        MAD = MAD * MAD;
     
    12531289#if !M0036_RC_IMPROVEMENT
    12541290        UInt SAD    = m_pcCuEncoder->getLCUPredictionSAD();
     1291#if REPN_FORMAT_IN_VPS
     1292        Int height  = min( pcSlice->getSPS()->getMaxCUHeight(),pcSlice->getPicHeightInLumaSamples() - uiCUAddr / rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUHeight() );
     1293        Int width   = min( pcSlice->getSPS()->getMaxCUWidth(),pcSlice->getPicWidthInLumaSamples() - uiCUAddr % rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUWidth() );
     1294#else
    12551295        Int height  = min( pcSlice->getSPS()->getMaxCUHeight(),pcSlice->getSPS()->getPicHeightInLumaSamples() - uiCUAddr / rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUHeight() );
    12561296        Int width   = min( pcSlice->getSPS()->getMaxCUWidth(),pcSlice->getSPS()->getPicWidthInLumaSamples() - uiCUAddr % rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUWidth() );
     1297#endif
    12571298        Double MAD = (Double)SAD / (Double)(height * width);
    12581299        MAD = MAD * MAD;
     
    19191960  UInt uiPosX = ( uiExternalAddress % rpcPic->getFrameWidthInCU() ) * g_uiMaxCUWidth+ g_auiRasterToPelX[ g_auiZscanToRaster[uiInternalAddress] ];
    19201961  UInt uiPosY = ( uiExternalAddress / rpcPic->getFrameWidthInCU() ) * g_uiMaxCUHeight+ g_auiRasterToPelY[ g_auiZscanToRaster[uiInternalAddress] ];
     1962#if REPN_FORMAT_IN_VPS
     1963  UInt uiWidth = pcSlice->getPicWidthInLumaSamples();
     1964  UInt uiHeight = pcSlice->getPicHeightInLumaSamples();
     1965#else
    19211966  UInt uiWidth = pcSlice->getSPS()->getPicWidthInLumaSamples();
    19221967  UInt uiHeight = pcSlice->getSPS()->getPicHeightInLumaSamples();
     1968#endif
    19231969  while((uiPosX>=uiWidth||uiPosY>=uiHeight)&&!(uiPosX>=uiWidth&&uiPosY>=uiHeight))
    19241970  {
     
    19421988  uiPosX = ( uiExternalAddress % rpcPic->getFrameWidthInCU() ) * g_uiMaxCUWidth+ g_auiRasterToPelX[ g_auiZscanToRaster[uiInternalAddress] ];
    19431989  uiPosY = ( uiExternalAddress / rpcPic->getFrameWidthInCU() ) * g_uiMaxCUHeight+ g_auiRasterToPelY[ g_auiZscanToRaster[uiInternalAddress] ];
     1990#if REPN_FORMAT_IN_VPS
     1991  uiWidth = pcSlice->getPicWidthInLumaSamples();
     1992  uiHeight = pcSlice->getPicHeightInLumaSamples();
     1993#else
    19441994  uiWidth = pcSlice->getSPS()->getPicWidthInLumaSamples();
    19451995  uiHeight = pcSlice->getSPS()->getPicHeightInLumaSamples();
     1996#endif
    19461997  while((uiPosX>=uiWidth||uiPosY>=uiHeight)&&!(uiPosX>=uiWidth&&uiPosY>=uiHeight))
    19471998  {
Note: See TracChangeset for help on using the changeset viewer.